mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 17:18:32 +02:00
XPath plugin
This commit is contained in:
11
package.json
11
package.json
@@ -14,11 +14,12 @@
|
|||||||
"build:icon:release": "tauri icon design/icon.png --output ./src-tauri/icons/release",
|
"build:icon:release": "tauri icon design/icon.png --output ./src-tauri/icons/release",
|
||||||
"build:icon:dev": "tauri icon design/icon-dev.png --output ./src-tauri/icons/dev",
|
"build:icon:dev": "tauri icon design/icon-dev.png --output ./src-tauri/icons/dev",
|
||||||
"build:frontend": "vite build",
|
"build:frontend": "vite build",
|
||||||
"build:plugins": "run-p build:plugin:importer-insomnia build:plugin:importer-postman build:plugin:importer-yaak build:plugin:filter-jsonpath",
|
"build:plugins": "run-p build:plugin:*",
|
||||||
"build:plugin:importer-insomnia": "cd plugins/importer-insomnia && vite build",
|
"build:plugin:importer-insomnia": "cd plugins/importer-insomnia && vite build --emptyOutDir",
|
||||||
"build:plugin:importer-postman": "cd plugins/importer-postman && vite build",
|
"build:plugin:importer-postman": "cd plugins/importer-postman && vite build --emptyOutDir",
|
||||||
"build:plugin:importer-yaak": "cd plugins/importer-yaak && vite build",
|
"build:plugin:importer-yaak": "cd plugins/importer-yaak && vite build --emptyOutDir",
|
||||||
"build:plugin:filter-jsonpath": "cd plugins/filter-jsonpath && vite build",
|
"build:plugin:filter-jsonpath": "cd plugins/filter-jsonpath && vite build --emptyOutDir",
|
||||||
|
"build:plugin:filter-xpath": "cd plugins/filter-xpath && vite build --emptyOutDir",
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"coverage": "vitest run --coverage",
|
"coverage": "vitest run --coverage",
|
||||||
"prepare": "husky install"
|
"prepare": "husky install"
|
||||||
|
|||||||
41
plugins/filter-xpath/package-lock.json
generated
Normal file
41
plugins/filter-xpath/package-lock.json
generated
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"name": "filter-xpath",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "filter-xpath",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"dependencies": {
|
||||||
|
"@xmldom/xmldom": "^0.8.10",
|
||||||
|
"xmldom": "^0.6.0",
|
||||||
|
"xpath": "^0.0.34"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@xmldom/xmldom": {
|
||||||
|
"version": "0.8.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
|
||||||
|
"integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/xmldom": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.6.0.tgz",
|
||||||
|
"integrity": "sha512-iAcin401y58LckRZ0TkI4k0VSM1Qg0KGSc3i8rU+xrxe19A/BN1zHyVSJY7uoutVlaTSzYyk/v5AmkewAP7jtg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/xpath": {
|
||||||
|
"version": "0.0.34",
|
||||||
|
"resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.34.tgz",
|
||||||
|
"integrity": "sha512-FxF6+rkr1rNSQrhUNYrAFJpRXNzlDoMxeXN5qI84939ylEv3qqPFKa85Oxr6tDaJKqwW6KKyo2v26TSv3k6LeA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
plugins/filter-xpath/package.json
Normal file
8
plugins/filter-xpath/package.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "filter-xpath",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"dependencies": {
|
||||||
|
"@xmldom/xmldom": "^0.8.10",
|
||||||
|
"xpath": "^0.0.34"
|
||||||
|
}
|
||||||
|
}
|
||||||
8
plugins/filter-xpath/src/index.js
Normal file
8
plugins/filter-xpath/src/index.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import xpath from 'xpath';
|
||||||
|
import { DOMParser } from '@xmldom/xmldom';
|
||||||
|
|
||||||
|
export function pluginHookResponseFilter(filter, text) {
|
||||||
|
const doc = new DOMParser().parseFromString(text, 'text/xml');
|
||||||
|
const filtered = `${xpath.select(filter, doc)}`;
|
||||||
|
return { filtered };
|
||||||
|
}
|
||||||
13
plugins/filter-xpath/vite.config.js
Normal file
13
plugins/filter-xpath/vite.config.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { resolve } from 'path';
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
lib: {
|
||||||
|
entry: resolve(__dirname, 'src/index.js'),
|
||||||
|
fileName: 'index',
|
||||||
|
formats: ['es'],
|
||||||
|
},
|
||||||
|
outDir: resolve(__dirname, '../../src-tauri/plugins/filter-xpath'),
|
||||||
|
},
|
||||||
|
});
|
||||||
131
src-tauri/Cargo.lock
generated
131
src-tauri/Cargo.lock
generated
@@ -128,15 +128,6 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "atomic-polyfill"
|
|
||||||
version = "1.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4"
|
|
||||||
dependencies = [
|
|
||||||
"critical-section",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@@ -302,7 +293,7 @@ checksum = "f3e5afa991908cfbe79bd3109b824e473a1dc5f74f31fab91bb44c9e245daa77"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"boa_gc",
|
"boa_gc",
|
||||||
"boa_macros",
|
"boa_macros",
|
||||||
"hashbrown 0.14.2",
|
"hashbrown 0.14.3",
|
||||||
"indexmap 2.1.0",
|
"indexmap 2.1.0",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"phf 0.11.2",
|
"phf 0.11.2",
|
||||||
@@ -318,7 +309,7 @@ checksum = "005fa0c5bd20805466dda55eb34cd709bb31a2592bb26927b47714eeed6914d8"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -778,7 +769,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
|
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -788,7 +779,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e"
|
checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -812,7 +803,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"strsim",
|
"strsim",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -823,7 +814,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"darling_core",
|
"darling_core",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -833,7 +824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
|
checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"hashbrown 0.14.2",
|
"hashbrown 0.14.3",
|
||||||
"lock_api",
|
"lock_api",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"parking_lot_core",
|
"parking_lot_core",
|
||||||
@@ -934,7 +925,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1154,7 +1145,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1255,7 +1246,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1630,9 +1621,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.14.2"
|
version = "0.14.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
|
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
@@ -1644,7 +1635,7 @@ version = "0.8.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
|
checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown 0.14.2",
|
"hashbrown 0.14.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2022,7 +2013,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
|
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown 0.14.2",
|
"hashbrown 0.14.3",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2240,9 +2231,9 @@ checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "litemap"
|
name = "litemap"
|
||||||
version = "0.7.1"
|
version = "0.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "77a1a2647d5b7134127971a6de0d533c49de2159167e7f259c427195f87168a1"
|
checksum = "f9d642685b028806386b2b6e75685faadd3eb65a85fff7df711ce18446a422da"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "locale"
|
name = "locale"
|
||||||
@@ -2627,7 +2618,7 @@ dependencies = [
|
|||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2689,12 +2680,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.18.0"
|
version = "1.19.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atomic-polyfill",
|
|
||||||
"critical-section",
|
"critical-section",
|
||||||
|
"portable-atomic",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2730,7 +2721,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2966,7 +2957,7 @@ dependencies = [
|
|||||||
"phf_shared 0.11.2",
|
"phf_shared 0.11.2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3068,6 +3059,12 @@ version = "0.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"
|
checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "portable-atomic"
|
||||||
|
version = "1.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "postcard"
|
name = "postcard"
|
||||||
version = "1.0.8"
|
version = "1.0.8"
|
||||||
@@ -3139,9 +3136,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.69"
|
version = "1.0.76"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
|
checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
@@ -3157,9 +3154,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.33"
|
version = "1.0.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@@ -3622,29 +3619,29 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.192"
|
version = "1.0.195"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001"
|
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.192"
|
version = "1.0.195"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1"
|
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.108"
|
version = "1.0.111"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
|
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa 1.0.9",
|
"itoa 1.0.9",
|
||||||
"ryu",
|
"ryu",
|
||||||
@@ -3659,7 +3656,7 @@ checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3709,7 +3706,7 @@ dependencies = [
|
|||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4191,9 +4188,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.39"
|
version = "2.0.48"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
|
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -4208,7 +4205,7 @@ checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4611,28 +4608,28 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thin-vec"
|
name = "thin-vec"
|
||||||
version = "0.2.12"
|
version = "0.2.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aac81b6fd6beb5884b0cf3321b8117e6e5d47ecb6fc89f414cfdcca8b2fe2dd8"
|
checksum = "a38c90d48152c236a3ab59271da4f4ae63d678c5d7ad6b7714d7cb9760be5e4b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.50"
|
version = "1.0.56"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
|
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.50"
|
version = "1.0.56"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
|
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4847,7 +4844,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5129,7 +5126,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5163,7 +5160,7 @@ checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
@@ -5727,9 +5724,9 @@ checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "writeable"
|
name = "writeable"
|
||||||
version = "0.5.3"
|
version = "0.5.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0af0c3d13faebf8dda0b5256fa7096a2d5ccb662f7b9f54a40fe201077ab1c2"
|
checksum = "dad7bb64b8ef9c0aa27b6da38b452b0ee9fd82beaf276a87dd796fb55cbae14e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wry"
|
name = "wry"
|
||||||
@@ -5830,9 +5827,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yoke"
|
name = "yoke"
|
||||||
version = "0.7.2"
|
version = "0.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "61e38c508604d6bbbd292dadb3c02559aa7fff6b654a078a36217cad871636e4"
|
checksum = "65e71b2e4f287f467794c671e2b8f8a5f3716b3c829079a1c44740148eff07e4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
@@ -5842,13 +5839,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yoke-derive"
|
name = "yoke-derive"
|
||||||
version = "0.7.2"
|
version = "0.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d5e19fb6ed40002bab5403ffa37e53e0e56f914a4450c8765f533018db1db35f"
|
checksum = "9e6936f0cce458098a201c245a11bef556c6a0181129c7034d10d76d1ec3a2b8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5869,7 +5866,7 @@ checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5889,7 +5886,7 @@ checksum = "e6a647510471d372f2e6c2e6b7219e44d8c574d24fdc11c610a61455782f18c3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5919,7 +5916,7 @@ checksum = "7a4a1638a1934450809c2266a70362bfc96cd90550c073f5b8a55014d1010157"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.39",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -18,19 +18,19 @@ objc = "0.2.7"
|
|||||||
cocoa = "0.25.0"
|
cocoa = "0.25.0"
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
openssl-sys = {version = "0.9", features = ["vendored"] } # For Ubuntu installation to work
|
openssl-sys = { version = "0.9", features = ["vendored"] } # For Ubuntu installation to work
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = "0.21.0"
|
base64 = "0.21.0"
|
||||||
boa_engine = "0.17.3"
|
boa_engine = { version = "0.17.3", features = ["annex-b"] }
|
||||||
boa_runtime = "0.17.3"
|
boa_runtime = { version = "0.17.3" }
|
||||||
chrono = { version = "0.4.23", features = ["serde"] }
|
chrono = { version = "0.4.23", features = ["serde"] }
|
||||||
futures = "0.3.26"
|
futures = "0.3.26"
|
||||||
http = "0.2.8"
|
http = "0.2.8"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
reqwest = { version = "0.11.14", features = ["json", "multipart", "gzip", "brotli", "deflate"] }
|
reqwest = { version = "0.11.14", features = ["json", "multipart", "gzip", "brotli", "deflate"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0.195", features = ["derive"] }
|
||||||
serde_json = { version = "1.0", features = ["raw_value"] }
|
serde_json = { version = "1.0.111", features = ["raw_value"] }
|
||||||
sqlx = { version = "0.7.2", features = ["sqlite", "runtime-tokio-rustls", "json", "chrono", "time"] }
|
sqlx = { version = "0.7.2", features = ["sqlite", "runtime-tokio-rustls", "json", "chrono", "time"] }
|
||||||
tauri = { version = "1.5.2", features = [
|
tauri = { version = "1.5.2", features = [
|
||||||
"config-toml",
|
"config-toml",
|
||||||
|
|||||||
8346
src-tauri/plugins/filter-xpath/index.mjs
Normal file
8346
src-tauri/plugins/filter-xpath/index.mjs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ extern crate objc;
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::env::current_dir;
|
use std::env::current_dir;
|
||||||
use std::fs::{create_dir_all, File, read_to_string};
|
use std::fs::{create_dir_all, read_to_string, File};
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
use fern::colors::ColoredLevelConfig;
|
use fern::colors::ColoredLevelConfig;
|
||||||
@@ -17,13 +17,13 @@ use log::{debug, info, warn};
|
|||||||
use rand::random;
|
use rand::random;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use sqlx::{Pool, Sqlite, SqlitePool};
|
|
||||||
use sqlx::migrate::Migrator;
|
use sqlx::migrate::Migrator;
|
||||||
use sqlx::types::Json;
|
use sqlx::types::Json;
|
||||||
use tauri::{AppHandle, RunEvent, State, Window, WindowUrl, Wry};
|
use sqlx::{Pool, Sqlite, SqlitePool};
|
||||||
use tauri::{Manager, WindowEvent};
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use tauri::TitleBarStyle;
|
use tauri::TitleBarStyle;
|
||||||
|
use tauri::{AppHandle, RunEvent, State, Window, WindowUrl, Wry};
|
||||||
|
use tauri::{Manager, WindowEvent};
|
||||||
use tauri_plugin_log::{fern, LogTarget};
|
use tauri_plugin_log::{fern, LogTarget};
|
||||||
use tauri_plugin_window_state::{StateFlags, WindowExt};
|
use tauri_plugin_window_state::{StateFlags, WindowExt};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
@@ -37,10 +37,10 @@ use crate::plugin::{ImportResources, ImportResult};
|
|||||||
use crate::updates::{update_mode_from_str, UpdateMode, YaakUpdater};
|
use crate::updates::{update_mode_from_str, UpdateMode, YaakUpdater};
|
||||||
|
|
||||||
mod analytics;
|
mod analytics;
|
||||||
|
mod http;
|
||||||
mod models;
|
mod models;
|
||||||
mod plugin;
|
mod plugin;
|
||||||
mod render;
|
mod render;
|
||||||
mod http;
|
|
||||||
mod updates;
|
mod updates;
|
||||||
mod window_ext;
|
mod window_ext;
|
||||||
mod window_menu;
|
mod window_menu;
|
||||||
@@ -103,15 +103,26 @@ async fn filter_response(
|
|||||||
return Err("Response body not found".to_string());
|
return Err("Response body not found".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut content_type = "".to_string();
|
||||||
|
for header in response.headers.iter() {
|
||||||
|
if header.name.to_lowercase() == "content-type" {
|
||||||
|
content_type = header.value.to_string().to_lowercase();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Have plugins register their own content type (regex?)
|
||||||
|
let plugin_name = if content_type.contains("json") {
|
||||||
|
"filter-jsonpath"
|
||||||
|
} else {
|
||||||
|
"filter-xpath"
|
||||||
|
};
|
||||||
|
|
||||||
let body = read_to_string(response.body_path.unwrap()).unwrap();
|
let body = read_to_string(response.body_path.unwrap()).unwrap();
|
||||||
let filter_result = plugin::run_plugin_filter(
|
let filter_result =
|
||||||
&window.app_handle(),
|
plugin::run_plugin_filter(&window.app_handle(), plugin_name, filter, &body)
|
||||||
"filter-jsonpath",
|
.await
|
||||||
filter,
|
.expect("Failed to run filter");
|
||||||
&body,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
.expect("Failed to run filter");
|
|
||||||
Ok(filter_result.filtered)
|
Ok(filter_result.filtered)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,12 +321,10 @@ async fn create_workspace(
|
|||||||
db_instance: State<'_, Mutex<Pool<Sqlite>>>,
|
db_instance: State<'_, Mutex<Pool<Sqlite>>>,
|
||||||
) -> Result<models::Workspace, String> {
|
) -> Result<models::Workspace, String> {
|
||||||
let pool = &*db_instance.lock().await;
|
let pool = &*db_instance.lock().await;
|
||||||
let created_workspace = models::upsert_workspace(
|
let created_workspace =
|
||||||
pool,
|
models::upsert_workspace(pool, models::Workspace::new(name.to_string()))
|
||||||
models::Workspace::new(name.to_string()),
|
.await
|
||||||
)
|
.expect("Failed to create Workspace");
|
||||||
.await
|
|
||||||
.expect("Failed to create Workspace");
|
|
||||||
|
|
||||||
emit_and_return(&window, "created_model", created_workspace)
|
emit_and_return(&window, "created_model", created_workspace)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
use boa_engine::builtins::promise::PromiseState;
|
|
||||||
use boa_engine::{
|
use boa_engine::{
|
||||||
js_string,
|
Context, js_string, JsNativeError, JsValue, Module, module::SimpleModuleLoader,
|
||||||
module::{ModuleLoader, SimpleModuleLoader},
|
property::Attribute, Source,
|
||||||
property::Attribute,
|
|
||||||
Context, JsArgs, JsNativeError, JsValue, Module, NativeFunction, Source,
|
|
||||||
};
|
};
|
||||||
|
use boa_engine::builtins::promise::PromiseState;
|
||||||
|
use boa_engine::module::ModuleLoader;
|
||||||
use boa_runtime::Console;
|
use boa_runtime::Console;
|
||||||
use log::{debug, error};
|
use log::{debug, error};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -43,10 +42,7 @@ pub async fn run_plugin_filter(
|
|||||||
app_handle,
|
app_handle,
|
||||||
plugin_name,
|
plugin_name,
|
||||||
"pluginHookResponseFilter",
|
"pluginHookResponseFilter",
|
||||||
&[
|
&[js_string!(response_body).into(), js_string!(filter).into()],
|
||||||
js_string!(response_body).into(),
|
|
||||||
js_string!(filter).into(),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if result_json.is_null() {
|
if result_json.is_null() {
|
||||||
@@ -111,7 +107,6 @@ fn run_plugin(
|
|||||||
.expect("failed to create context");
|
.expect("failed to create context");
|
||||||
|
|
||||||
add_runtime(context);
|
add_runtime(context);
|
||||||
add_globals(context);
|
|
||||||
|
|
||||||
let source = Source::from_filepath(&plugin_index_file).expect("Error opening file");
|
let source = Source::from_filepath(&plugin_index_file).expect("Error opening file");
|
||||||
|
|
||||||
@@ -119,7 +114,6 @@ fn run_plugin(
|
|||||||
let module = Module::parse(source, None, context).expect("failed to parse module");
|
let module = Module::parse(source, None, context).expect("failed to parse module");
|
||||||
|
|
||||||
// Insert parsed entrypoint into the module loader
|
// Insert parsed entrypoint into the module loader
|
||||||
// TODO: Is this needed if loaded from file already?
|
|
||||||
loader.insert(plugin_index_file, module.clone());
|
loader.insert(plugin_index_file, module.clone());
|
||||||
|
|
||||||
let promise_result = module
|
let promise_result = module
|
||||||
@@ -162,26 +156,9 @@ fn run_plugin(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_runtime(context: &mut Context<'_>) {
|
fn add_runtime(context: &mut Context) {
|
||||||
let console = Console::init(context);
|
let console = Console::init(context);
|
||||||
context
|
context
|
||||||
.register_global_property(js_string!(Console::NAME), console, Attribute::all())
|
.register_global_property(js_string!(Console::NAME), console, Attribute::all())
|
||||||
.expect("the console builtin shouldn't exist");
|
.expect("the console builtin shouldn't exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_globals(context: &mut Context<'_>) {
|
|
||||||
context
|
|
||||||
.register_global_builtin_callable(
|
|
||||||
"sayHello",
|
|
||||||
1,
|
|
||||||
NativeFunction::from_fn_ptr(|_, args, context| {
|
|
||||||
let value: String = args
|
|
||||||
.get_or_undefined(0)
|
|
||||||
.try_js_into(context)
|
|
||||||
.expect("failed to convert arg");
|
|
||||||
println!("Hello {}!", value);
|
|
||||||
Ok(value.into())
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.expect("failed to register global");
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdo
|
|||||||
key: 'edit',
|
key: 'edit',
|
||||||
label: 'Manage Environments',
|
label: 'Manage Environments',
|
||||||
hotkeyAction: 'environmentEditor.toggle',
|
hotkeyAction: 'environmentEditor.toggle',
|
||||||
leftSlot: <Icon icon="gear" />,
|
leftSlot: <Icon icon="box" />,
|
||||||
onSelect: showEnvironmentDialog,
|
onSelect: showEnvironmentDialog,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export function SettingsDropdown() {
|
|||||||
key: 'settings',
|
key: 'settings',
|
||||||
label: 'Settings',
|
label: 'Settings',
|
||||||
hotkeyAction: 'settings.show',
|
hotkeyAction: 'settings.show',
|
||||||
leftSlot: <Icon icon="gear" />,
|
leftSlot: <Icon icon="settings" />,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
dialog.show({
|
dialog.show({
|
||||||
id: 'settings',
|
id: 'settings',
|
||||||
@@ -109,7 +109,7 @@ export function SettingsDropdown() {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<IconButton size="sm" title="Main Menu" icon="gear" className="pointer-events-auto" />
|
<IconButton size="sm" title="Main Menu" icon="settings" className="pointer-events-auto" />
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { ReactComponent as LeftPanelVisibleIcon } from '../../assets/icons/LeftP
|
|||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
archive: lucide.ArchiveIcon,
|
archive: lucide.ArchiveIcon,
|
||||||
|
box: lucide.BoxIcon,
|
||||||
chat: lucide.MessageSquare,
|
chat: lucide.MessageSquare,
|
||||||
check: lucide.CheckIcon,
|
check: lucide.CheckIcon,
|
||||||
chevronDown: lucide.ChevronDownIcon,
|
chevronDown: lucide.ChevronDownIcon,
|
||||||
@@ -20,7 +21,6 @@ const icons = {
|
|||||||
eyeClosed: lucide.EyeOffIcon,
|
eyeClosed: lucide.EyeOffIcon,
|
||||||
filter: lucide.FilterIcon,
|
filter: lucide.FilterIcon,
|
||||||
flask: lucide.FlaskConicalIcon,
|
flask: lucide.FlaskConicalIcon,
|
||||||
gear: lucide.CogIcon,
|
|
||||||
keyboard: lucide.KeyboardIcon,
|
keyboard: lucide.KeyboardIcon,
|
||||||
magicWand: lucide.Wand2Icon,
|
magicWand: lucide.Wand2Icon,
|
||||||
externalLink: lucide.ExternalLinkIcon,
|
externalLink: lucide.ExternalLinkIcon,
|
||||||
@@ -29,6 +29,8 @@ const icons = {
|
|||||||
question: lucide.ShieldQuestionIcon,
|
question: lucide.ShieldQuestionIcon,
|
||||||
plus: lucide.PlusIcon,
|
plus: lucide.PlusIcon,
|
||||||
plusCircle: lucide.PlusCircleIcon,
|
plusCircle: lucide.PlusCircleIcon,
|
||||||
|
settings: lucide.SettingsIcon,
|
||||||
|
settings2: lucide.Settings2Icon,
|
||||||
trash: lucide.TrashIcon,
|
trash: lucide.TrashIcon,
|
||||||
update: lucide.RefreshCcwIcon,
|
update: lucide.RefreshCcwIcon,
|
||||||
upload: lucide.UploadIcon,
|
upload: lucide.UploadIcon,
|
||||||
|
|||||||
@@ -104,8 +104,12 @@ export function Tabs({
|
|||||||
className={btnClassName}
|
className={btnClassName}
|
||||||
rightSlot={
|
rightSlot={
|
||||||
<Icon
|
<Icon
|
||||||
|
size="sm"
|
||||||
icon="chevronDown"
|
icon="chevronDown"
|
||||||
className={classNames('-mr-1.5', isActive ? 'opacity-100' : 'opacity-20')}
|
className={classNames(
|
||||||
|
'-mr-1.5 mt-0.5',
|
||||||
|
isActive ? 'opacity-100' : 'opacity-20',
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -31,7 +31,10 @@ export function TextViewer({ response, pretty }: Props) {
|
|||||||
setFilterText('');
|
setFilterText('');
|
||||||
}, [setFilterText, toggleIsSearching]);
|
}, [setFilterText, toggleIsSearching]);
|
||||||
|
|
||||||
const actions = contentType?.startsWith('application/json') && (
|
const isJson = contentType?.includes('json');
|
||||||
|
const isXml = contentType?.includes('xml') || contentType?.includes('html');
|
||||||
|
const canFilter = isJson || isXml;
|
||||||
|
const actions = canFilter && (
|
||||||
<HStack className="w-full" justifyContent="end" space={1}>
|
<HStack className="w-full" justifyContent="end" space={1}>
|
||||||
{isSearching && (
|
{isSearching && (
|
||||||
<Input
|
<Input
|
||||||
@@ -39,8 +42,8 @@ export function TextViewer({ response, pretty }: Props) {
|
|||||||
autoFocus
|
autoFocus
|
||||||
containerClassName="bg-gray-50"
|
containerClassName="bg-gray-50"
|
||||||
size="sm"
|
size="sm"
|
||||||
placeholder="Filter response"
|
placeholder={isJson ? 'JSONPath expression' : 'XPath expression'}
|
||||||
label="Filter with JSONPath"
|
label="Filter expression"
|
||||||
name="filter"
|
name="filter"
|
||||||
defaultValue={filterText}
|
defaultValue={filterText}
|
||||||
onKeyDown={(e) => e.key === 'Escape' && clearSearch()}
|
onKeyDown={(e) => e.key === 'Escape' && clearSearch()}
|
||||||
|
|||||||
Reference in New Issue
Block a user