Model and DB refactor (#61)

- [x] Move from `sqlx` to `rusqlite`
- [x] Generate TS types from Rust models
This commit is contained in:
Gregory Schier
2024-08-05 07:58:20 -07:00
committed by GitHub
parent e5511922bf
commit f967820f12
193 changed files with 7083 additions and 8337 deletions

154
package-lock.json generated
View File

@@ -20,13 +20,13 @@
"@react-hook/resize-observer": "^1.2.6", "@react-hook/resize-observer": "^1.2.6",
"@tailwindcss/container-queries": "^0.1.0", "@tailwindcss/container-queries": "^0.1.0",
"@tanstack/react-query": "^5.45.1", "@tanstack/react-query": "^5.45.1",
"@tauri-apps/api": "^2.0.0-beta.15", "@tauri-apps/api": "^2.0.0-rc.0",
"@tauri-apps/plugin-clipboard-manager": "^2.1.0-beta.5", "@tauri-apps/plugin-clipboard-manager": "^2.0.0-rc.0",
"@tauri-apps/plugin-dialog": "^2.0.0-beta.7", "@tauri-apps/plugin-dialog": "^2.0.0-rc.0",
"@tauri-apps/plugin-fs": "^2.0.0-beta.7", "@tauri-apps/plugin-fs": "^2.0.0-rc.0",
"@tauri-apps/plugin-os": "^2.0.0-beta.7", "@tauri-apps/plugin-os": "^2.0.0-rc.0",
"@tauri-apps/plugin-shell": "^2.0.0-beta.8", "@tauri-apps/plugin-shell": "^2.0.0-rc.0",
"@yaakapp/api": "^0.1.0-beta.1", "@yaakapp/api": "^0.1.0-beta.8",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"classnames": "^2.3.2", "classnames": "^2.3.2",
"cm6-graphql": "^0.0.9", "cm6-graphql": "^0.0.9",
@@ -57,7 +57,7 @@
"devDependencies": { "devDependencies": {
"@tailwindcss/nesting": "^0.0.0-insiders.565cd3e", "@tailwindcss/nesting": "^0.0.0-insiders.565cd3e",
"@tanstack/react-query-devtools": "^5.45.1", "@tanstack/react-query-devtools": "^5.45.1",
"@tauri-apps/cli": "^2.0.0-beta.22", "@tauri-apps/cli": "^2.0.0-rc.1",
"@types/node": "^18.7.10", "@types/node": "^18.7.10",
"@types/papaparse": "^5.3.7", "@types/papaparse": "^5.3.7",
"@types/parse-color": "^1.0.1", "@types/parse-color": "^1.0.1",
@@ -2343,9 +2343,9 @@
} }
}, },
"node_modules/@tauri-apps/api": { "node_modules/@tauri-apps/api": {
"version": "2.0.0-beta.15", "version": "2.0.0-rc.0",
"resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.0.0-beta.15.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.0.0-rc.0.tgz",
"integrity": "sha512-H9w6iISmR+NvH4XuyCZB4zDN10tf9RFt6i/9JHEjaRhAowdAaJ+oiXq/3kedizNClHMtbTQ5j0oqDVPkZDAI8g==", "integrity": "sha512-v454Qs3REHc3Za59U+/eSmBsdmF+3NE5+76+lFDaitVqN4ZglDHENDaMARYKGJVZuxiSkzyqG0SeG7lLQjVkPA==",
"engines": { "engines": {
"node": ">= 18.18", "node": ">= 18.18",
"npm": ">= 6.6.0", "npm": ">= 6.6.0",
@@ -2357,9 +2357,9 @@
} }
}, },
"node_modules/@tauri-apps/cli": { "node_modules/@tauri-apps/cli": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.0.0-rc.1.tgz",
"integrity": "sha512-OAuiDdSRKxNmr/dseQKKMoZZxIhQ6aAxmXJctGYJxCnkd62tQ8xeq87roVXGNS5Qkuv7WpySAyR0ntiMjvNLUA==", "integrity": "sha512-9AzVrUMdb6EZ/Lwtdqt03XqqG6d/3gTJPOw2E9zmCHprJWEwqEp4JIVHYYfrqkkZyKclD3m5ggXwfYwclcYLdw==",
"dev": true, "dev": true,
"bin": { "bin": {
"tauri": "tauri.js" "tauri": "tauri.js"
@@ -2372,22 +2372,22 @@
"url": "https://opencollective.com/tauri" "url": "https://opencollective.com/tauri"
}, },
"optionalDependencies": { "optionalDependencies": {
"@tauri-apps/cli-darwin-arm64": "2.0.0-beta.22", "@tauri-apps/cli-darwin-arm64": "2.0.0-rc.1",
"@tauri-apps/cli-darwin-x64": "2.0.0-beta.22", "@tauri-apps/cli-darwin-x64": "2.0.0-rc.1",
"@tauri-apps/cli-linux-arm-gnueabihf": "2.0.0-beta.22", "@tauri-apps/cli-linux-arm-gnueabihf": "2.0.0-rc.1",
"@tauri-apps/cli-linux-arm64-gnu": "2.0.0-beta.22", "@tauri-apps/cli-linux-arm64-gnu": "2.0.0-rc.1",
"@tauri-apps/cli-linux-arm64-musl": "2.0.0-beta.22", "@tauri-apps/cli-linux-arm64-musl": "2.0.0-rc.1",
"@tauri-apps/cli-linux-x64-gnu": "2.0.0-beta.22", "@tauri-apps/cli-linux-x64-gnu": "2.0.0-rc.1",
"@tauri-apps/cli-linux-x64-musl": "2.0.0-beta.22", "@tauri-apps/cli-linux-x64-musl": "2.0.0-rc.1",
"@tauri-apps/cli-win32-arm64-msvc": "2.0.0-beta.22", "@tauri-apps/cli-win32-arm64-msvc": "2.0.0-rc.1",
"@tauri-apps/cli-win32-ia32-msvc": "2.0.0-beta.22", "@tauri-apps/cli-win32-ia32-msvc": "2.0.0-rc.1",
"@tauri-apps/cli-win32-x64-msvc": "2.0.0-beta.22" "@tauri-apps/cli-win32-x64-msvc": "2.0.0-rc.1"
} }
}, },
"node_modules/@tauri-apps/cli-darwin-arm64": { "node_modules/@tauri-apps/cli-darwin-arm64": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.0.0-rc.1.tgz",
"integrity": "sha512-Ofhythvg1Ks2IM87WUYNtgFzm21aU1Zn+8QP81lJy9Y7ZGMxP8FYfqeHz6GIWKI+CYf6I77HA8LHkT9pyE5PYg==", "integrity": "sha512-dJxyAi4P9fOkklBZXuwUVnHgdM/20fgM4zYdfejQfju5+q9GUqnMbrrIUqlJbQGf8EnrIdSWnieO8wU8GOwT0g==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2401,9 +2401,9 @@
} }
}, },
"node_modules/@tauri-apps/cli-darwin-x64": { "node_modules/@tauri-apps/cli-darwin-x64": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.0.0-rc.1.tgz",
"integrity": "sha512-/lWIixo7WgmMUqcxlPT7Ojlkl6qbVlNDwUZ+9DtTpoWnaaBxv/YpSe1k62vDWEC7l0apFY+Fz7cRONN2wglFyQ==", "integrity": "sha512-dwrqLzNIFk8a1Vf2YI8axHm7uvLfo4M4TSWCw2ZkgeSGWWK6Y6CYVZbBEjOEGIOf+GFAa9rVOSZRuMwpiufNng==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2417,9 +2417,9 @@
} }
}, },
"node_modules/@tauri-apps/cli-linux-arm-gnueabihf": { "node_modules/@tauri-apps/cli-linux-arm-gnueabihf": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.0.0-rc.1.tgz",
"integrity": "sha512-9nJCSStoxu4BKaKVJhu/uBJ8IsIofwAdsX0TWFxqo0obaZbeQSEpPhVsCy+uk3u/28dF+qyUtMCYawO2Uljnag==", "integrity": "sha512-jvMF4UNc3Jr/xHnw+4NNsWfk8WrcFrQVImAtKlCev9QepqfBmDh+FgXTvfysoBCSxEBS626TvYms3OhI0LOO4A==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -2433,9 +2433,9 @@
} }
}, },
"node_modules/@tauri-apps/cli-linux-arm64-gnu": { "node_modules/@tauri-apps/cli-linux-arm64-gnu": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.0.0-rc.1.tgz",
"integrity": "sha512-TF9q9zHFBx9LaG2fJJC+BcpIokOmX1UIniBapndvx3dJmdDiK4F6w2QYKDkrBQVzDzcIducmdo2zNBv17O9tFQ==", "integrity": "sha512-TGmadGW8BjTq864AYrv/u+vTnAodnOuzv1VCUOV23O8st35GZG6V47jwNsSjQjhrcO1XzmJiRAtrcVKuTZ/xUA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2449,9 +2449,9 @@
} }
}, },
"node_modules/@tauri-apps/cli-linux-arm64-musl": { "node_modules/@tauri-apps/cli-linux-arm64-musl": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.0.0-rc.1.tgz",
"integrity": "sha512-ak/RdmaV7sATQmNOxlpHVlbKlrdquH7WH8nOv82X+iK+1HgAOGGqLqBUMzzhkGqo9SHQ9zJ6A2yOo7Z6TJXMmQ==", "integrity": "sha512-+SJsRTW0PvvD7awEn+tIPJ3s12s6RpKXdOib2mztoKocasrGRfz+EFZuXc42Iwk3xROsrQkiw2UAmcNLkW5NwA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2465,9 +2465,9 @@
} }
}, },
"node_modules/@tauri-apps/cli-linux-x64-gnu": { "node_modules/@tauri-apps/cli-linux-x64-gnu": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.0.0-rc.1.tgz",
"integrity": "sha512-9t+jQeMqBdXz51ikTh1PQFG/gs9PBzXmtMcIzUxE0juvH/ynjw0Vf+yZbNmwqVS9g7cj8XiBXoc6/N41SZE2cA==", "integrity": "sha512-vjPrj2btS97IOp6cU42IrkI49SQZDSg8TPqwOwFqyQeAotCT1i0F38pLZWe1gLyPUowO8XdaaBdwYg6IRDKcZg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2481,9 +2481,9 @@
} }
}, },
"node_modules/@tauri-apps/cli-linux-x64-musl": { "node_modules/@tauri-apps/cli-linux-x64-musl": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.0.0-rc.1.tgz",
"integrity": "sha512-PemcztfHG3HAuuo7HcnhfDrtN9NT7kueyNg8ipxJNPMa+s4K7kfieViyEiMW5pTr2F5WG/UuBSNcuwY+DVCcPA==", "integrity": "sha512-MrE68/u6rMrkM1uM/DR1MNnMXiYebhSPGqqxshJ12SmFdk3yQ/Z73Wzvk8xv78eOExh4lTtEXI22YwaBCf9AEg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2497,9 +2497,9 @@
} }
}, },
"node_modules/@tauri-apps/cli-win32-arm64-msvc": { "node_modules/@tauri-apps/cli-win32-arm64-msvc": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.0.0-rc.1.tgz",
"integrity": "sha512-EgKoG/jGEtTzhOp7ISjMdQsfd8IOG/5yZhO9Z4L/u7oB9mprKAJohYs24+ZxJtq2bOz4f/ZIysZ19nbkpxUzrg==", "integrity": "sha512-SLulbiUjg8BGf/zX+U1PGjB+JpsN2nLRGuW07BYwSDW3s3mp2aagLuOwaTaOPBrDzfIMRYq8KT54A4jfRjEZlg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2513,9 +2513,9 @@
} }
}, },
"node_modules/@tauri-apps/cli-win32-ia32-msvc": { "node_modules/@tauri-apps/cli-win32-ia32-msvc": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.0.0-rc.1.tgz",
"integrity": "sha512-67OrM2m4FB3KujPbjd/i+9lqcLDO3/ixqL1GMc3BoHhcjF+7QY08OxqWeitdsP/8ihnMIIdir2xEjNUKc6Zelw==", "integrity": "sha512-rz85riTjcWdZlgTku6HcBx625Otdc0/NwDjRXgdXakL1ybw7E+G5YlLZNcQX25u17RKUAWX/2/VZ1pSz945Ovw==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@@ -2529,9 +2529,9 @@
} }
}, },
"node_modules/@tauri-apps/cli-win32-x64-msvc": { "node_modules/@tauri-apps/cli-win32-x64-msvc": {
"version": "2.0.0-beta.22", "version": "2.0.0-rc.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.0.0-beta.22.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.0.0-rc.1.tgz",
"integrity": "sha512-BsO5xMUxliTZTImXnOC73sKT2U9VUeqR8AtklSObBcAg5LaZKpYOdF2pZzU6rIMAZwzROTAT1hYsr4r/nx2UZg==", "integrity": "sha512-aRO70dDbn4w3CbALMG+b7g460xmbSTuUiGmRh0r/MNVeoZk/YbqluBUyhXdWGxJb8OVubw/4RlczKYcPmJceMw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2545,43 +2545,43 @@
} }
}, },
"node_modules/@tauri-apps/plugin-clipboard-manager": { "node_modules/@tauri-apps/plugin-clipboard-manager": {
"version": "2.1.0-beta.5", "version": "2.0.0-rc.0",
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-clipboard-manager/-/plugin-clipboard-manager-2.1.0-beta.5.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-clipboard-manager/-/plugin-clipboard-manager-2.0.0-rc.0.tgz",
"integrity": "sha512-7YQEXRHXn5dIr/YcE7RtkoAhc6XwpqI7Qz0I3FcHn5vMbVvQ5OxKnGqEa8ZGRud6R3G9pNdnEKglLXLgUXK8tA==", "integrity": "sha512-2fS3wbRQEtorkk3Np2msJUeKCXRqLQ9sSo2FzlFdUPYNzThsu43uWCF55McGLAfltNOvXQIcQLUBf05jbBL/5w==",
"dependencies": { "dependencies": {
"@tauri-apps/api": "2.0.0-beta.15" "@tauri-apps/api": "^2.0.0-rc.0"
} }
}, },
"node_modules/@tauri-apps/plugin-dialog": { "node_modules/@tauri-apps/plugin-dialog": {
"version": "2.0.0-beta.7", "version": "2.0.0-rc.0",
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-dialog/-/plugin-dialog-2.0.0-beta.7.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-dialog/-/plugin-dialog-2.0.0-rc.0.tgz",
"integrity": "sha512-myywwpsKbquDDzl5zaOmmLLv5O8EJ/GgHDAoVSPwO97R4iWzkDvj3HFF91tNh7i25Tu/bP6jYPAdZA1NCRxxtg==", "integrity": "sha512-DPOXYe8SQ6Radk/67EOdaomlxL7oF99JO/ZUaPp1IBEs3Wro7lhlz63CfdKIBfKIZTLJLzP1R7/EiPL/GTA3Bg==",
"dependencies": { "dependencies": {
"@tauri-apps/api": "2.0.0-beta.15" "@tauri-apps/api": "^2.0.0-rc.0"
} }
}, },
"node_modules/@tauri-apps/plugin-fs": { "node_modules/@tauri-apps/plugin-fs": {
"version": "2.0.0-beta.7", "version": "2.0.0-rc.0",
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-fs/-/plugin-fs-2.0.0-beta.7.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-fs/-/plugin-fs-2.0.0-rc.0.tgz",
"integrity": "sha512-hsZyhzvy+xtRfbrKI2rmU1ZfmgbSs7Zu/6a12MFlJKVzqXmUwJvggcjYdm1cEFdLbnOOsszENXbwMnkzmxtirA==", "integrity": "sha512-74VCXEZlzTJ+Jv1V3KrV0qIHhSePpE/ljsF78rcEuvSfyTxLtt/Sb5CIUmVhFlKTRFOH9dX50T4dTZ3qFLyRnA==",
"dependencies": { "dependencies": {
"@tauri-apps/api": "2.0.0-beta.15" "@tauri-apps/api": "^2.0.0-rc.0"
} }
}, },
"node_modules/@tauri-apps/plugin-os": { "node_modules/@tauri-apps/plugin-os": {
"version": "2.0.0-beta.7", "version": "2.0.0-rc.0",
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-os/-/plugin-os-2.0.0-beta.7.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-os/-/plugin-os-2.0.0-rc.0.tgz",
"integrity": "sha512-CHo09ecxUU0NFkAqctXeQzdaXw02EXulqcaZnbjrBfRJ2ulmGq7zaUCsHihfcqWcdnmNwmP9Wh/gyznMc1JF9Q==", "integrity": "sha512-OWAl8mooKnGykSD4iog8WRqcnOSx0gGmTJBlEExHdFeIuOHg0Ezvd+WiVLhT9LBg7go3ibNWRWpe/ZG7YEp4Vw==",
"dependencies": { "dependencies": {
"@tauri-apps/api": "2.0.0-beta.15" "@tauri-apps/api": "^2.0.0-rc.0"
} }
}, },
"node_modules/@tauri-apps/plugin-shell": { "node_modules/@tauri-apps/plugin-shell": {
"version": "2.0.0-beta.8", "version": "2.0.0-rc.0",
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-shell/-/plugin-shell-2.0.0-beta.8.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-shell/-/plugin-shell-2.0.0-rc.0.tgz",
"integrity": "sha512-rFXI6MvsCdSGbuKbDu/NaOePREb9YTVTdeugHdvvljnKWW3dvmThBb2h/8Hxj+Z7Cd8MUoRxPeJWUZbPbJ2Imw==", "integrity": "sha512-bhUcQcrqZoK8H1DFXapr5r1Z75oh6Kd5Tltz97XpZFLREEqp+KhN2Fvyh8r/fKAyenYsTYUIsDsyGdjdueuF9g==",
"dependencies": { "dependencies": {
"@tauri-apps/api": "2.0.0-beta.15" "@tauri-apps/api": "^2.0.0-rc.0"
} }
}, },
"node_modules/@types/babel__core": { "node_modules/@types/babel__core": {
@@ -2981,9 +2981,9 @@
"integrity": "sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ==" "integrity": "sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ=="
}, },
"node_modules/@yaakapp/api": { "node_modules/@yaakapp/api": {
"version": "0.1.0-beta.1", "version": "0.1.0-beta.8",
"resolved": "https://registry.npmjs.org/@yaakapp/api/-/api-0.1.0-beta.1.tgz", "resolved": "https://registry.npmjs.org/@yaakapp/api/-/api-0.1.0-beta.8.tgz",
"integrity": "sha512-govGMJy57nQq1k1LsGzaqahHXS0Uj5cinIxKJYRUyoasVUbShA6oE759J22lri+J3sF6KbfDC1rkE/kvKb2acw==", "integrity": "sha512-kR3c179QBlq/h29R/DWGJq7crAt9FZOFuhapdCYVFR1FsNGLP3+3PfyLc6rTj/SrqbH1lkIR4c2DmZKPE6yPPA==",
"dependencies": { "dependencies": {
"@types/node": "^22.0.0" "@types/node": "^22.0.0"
} }

View File

@@ -35,13 +35,13 @@
"@react-hook/resize-observer": "^1.2.6", "@react-hook/resize-observer": "^1.2.6",
"@tailwindcss/container-queries": "^0.1.0", "@tailwindcss/container-queries": "^0.1.0",
"@tanstack/react-query": "^5.45.1", "@tanstack/react-query": "^5.45.1",
"@tauri-apps/api": "^2.0.0-beta.15", "@tauri-apps/api": "^2.0.0-rc.0",
"@tauri-apps/plugin-clipboard-manager": "^2.1.0-beta.5", "@tauri-apps/plugin-clipboard-manager": "^2.0.0-rc.0",
"@tauri-apps/plugin-dialog": "^2.0.0-beta.7", "@tauri-apps/plugin-dialog": "^2.0.0-rc.0",
"@tauri-apps/plugin-fs": "^2.0.0-beta.7", "@tauri-apps/plugin-fs": "^2.0.0-rc.0",
"@tauri-apps/plugin-os": "^2.0.0-beta.7", "@tauri-apps/plugin-os": "^2.0.0-rc.0",
"@tauri-apps/plugin-shell": "^2.0.0-beta.8", "@tauri-apps/plugin-shell": "^2.0.0-rc.0",
"@yaakapp/api": "^0.1.0-beta.1", "@yaakapp/api": "^0.1.0-beta.8",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"classnames": "^2.3.2", "classnames": "^2.3.2",
"cm6-graphql": "^0.0.9", "cm6-graphql": "^0.0.9",
@@ -72,7 +72,7 @@
"devDependencies": { "devDependencies": {
"@tailwindcss/nesting": "^0.0.0-insiders.565cd3e", "@tailwindcss/nesting": "^0.0.0-insiders.565cd3e",
"@tanstack/react-query-devtools": "^5.45.1", "@tanstack/react-query-devtools": "^5.45.1",
"@tauri-apps/cli": "^2.0.0-beta.22", "@tauri-apps/cli": "^2.0.0-rc.1",
"@types/node": "^18.7.10", "@types/node": "^18.7.10",
"@types/papaparse": "^5.3.7", "@types/papaparse": "^5.3.7",
"@types/parse-color": "^1.0.1", "@types/parse-color": "^1.0.1",

View File

@@ -1,14 +1,16 @@
{ {
"name": "@yaakapp/api", "name": "@yaakapp/api",
"version": "0.0.1", "version": "0.1.0-beta.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@yaakapp/api", "name": "@yaakapp/api",
"version": "0.0.1", "version": "0.1.0-beta.4",
"dependencies": {
"@types/node": "^22.0.0"
},
"devDependencies": { "devDependencies": {
"@types/node": "^22.0.0",
"typescript": "^5.5.4" "typescript": "^5.5.4"
} }
}, },
@@ -16,7 +18,6 @@
"version": "22.0.0", "version": "22.0.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.0.0.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.0.0.tgz",
"integrity": "sha512-VT7KSYudcPOzP5Q0wfbowyNLaVR8QWUdw+088uFWwfvpY6uCWaXpqV6ieLAu9WBcnTa7H4Z5RLK8I5t2FuOcqw==", "integrity": "sha512-VT7KSYudcPOzP5Q0wfbowyNLaVR8QWUdw+088uFWwfvpY6uCWaXpqV6ieLAu9WBcnTa7H4Z5RLK8I5t2FuOcqw==",
"dev": true,
"dependencies": { "dependencies": {
"undici-types": "~6.11.1" "undici-types": "~6.11.1"
} }
@@ -37,8 +38,7 @@
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "6.11.1", "version": "6.11.1",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.11.1.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.11.1.tgz",
"integrity": "sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ==", "integrity": "sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ=="
"dev": true
} }
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@yaakapp/api", "name": "@yaakapp/api",
"version": "0.0.5", "version": "0.1.0-beta.8",
"main": "lib/index.js", "main": "lib/index.js",
"typings": "./lib/index.d.ts", "typings": "./lib/index.d.ts",
"files": [ "files": [
@@ -8,7 +8,7 @@
], ],
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"prepublish": "npm run build" "prepublishOnly": "npm run build"
}, },
"dependencies": { "dependencies": {
"@types/node": "^22.0.0" "@types/node": "^22.0.0"

View File

@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { EnvironmentVariable } from "./EnvironmentVariable";
export type Environment = { id: string, workspaceId: string, model: "environment", createdAt: string, updatedAt: string, name: string, variables: Array<EnvironmentVariable>, };

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type EnvironmentVariable = { enabled?: boolean, name: string, value: string, };

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type Folder = { createdAt: string, updatedAt: string, id: string, workspaceId: string, folderId: string | null, model: "folder", name: string, sortPriority: number, };

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type GrpcConnection = { id: string, model: "grpc_connection", workspaceId: string, requestId: string, createdAt: string, updatedAt: string, service: string, method: string, elapsed: number, status: number, url: string, error: string | null, trailers: { [key: string]: string }, };

View File

@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { GrpcEventType } from "./GrpcEventType";
export type GrpcEvent = { id: string, model: "grpc_event", workspaceId: string, requestId: string, connectionId: string, createdAt: string, content: string, eventType: GrpcEventType, metadata: { [key: string]: string }, status: number | null, error: string | null, };

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type GrpcEventType = "info" | "error" | "client_message" | "server_message" | "connection_start" | "connection_end";

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type GrpcMetadataEntry = { enabled?: boolean, name: string, value: string, };

View File

@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { GrpcMetadataEntry } from "./GrpcMetadataEntry";
export type GrpcRequest = { id: string, model: "grpc_request", workspaceId: string, createdAt: string, updatedAt: string, folderId: string | null, name: string, sortPriority: number, url: string, service: string | null, method: string | null, message: string, authenticationType: string | null, authentication: Record<string, any>, metadata: Array<GrpcMetadataEntry>, };

View File

@@ -0,0 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { HttpRequestHeader } from "./HttpRequestHeader";
import type { HttpUrlParameter } from "./HttpUrlParameter";
export type HttpRequest = { createdAt: string, updatedAt: string, id: string, workspaceId: string, folderId: string | null, model: "http_request", sortPriority: number, name: string, url: string, urlParameters: Array<HttpUrlParameter>, method: string, body: Record<string, any>, bodyType: string | null, authentication: Record<string, any>, authenticationType: string | null, headers: Array<HttpRequestHeader>, };

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type HttpRequestHeader = { enabled?: boolean, name: string, value: string, };

View File

@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { HttpResponseHeader } from "./HttpResponseHeader";
export type HttpResponse = { id: string, model: "http_response", workspaceId: string, requestId: string, createdAt: string, updatedAt: string, error: string | null, url: string, contentLength: number | null, version: string | null, elapsed: number, elapsedHeaders: number, remoteAddr: string | null, status: number, statusReason: string | null, bodyPath: string | null, headers: Array<HttpResponseHeader>, };

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type HttpResponseHeader = { name: string, value: string, };

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type HttpUrlParameter = { enabled?: boolean, name: string, value: string, };

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type KeyValue = { model: "key_value", createdAt: string, updatedAt: string, namespace: string, key: string, value: string, };

View File

@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { EnvironmentVariable } from "./EnvironmentVariable";
export type Workspace = { id: string, model: "workspace", createdAt: string, updatedAt: string, name: string, description: string, variables: Array<EnvironmentVariable>, settingValidateCertificates: boolean, settingFollowRedirects: boolean, settingRequestTimeout: number, };

View File

@@ -1,3 +1,18 @@
export type * from './models';
export type * from './plugins'; export type * from './plugins';
export type * from './themes'; export type * from './themes';
export * from './gen/Environment';
export * from './gen/EnvironmentVariable';
export * from './gen/Folder';
export * from './gen/GrpcConnection';
export * from './gen/GrpcEvent';
export * from './gen/GrpcEventType';
export * from './gen/GrpcMetadataEntry';
export * from './gen/GrpcRequest';
export * from './gen/HttpRequest';
export * from './gen/HttpRequestHeader';
export * from './gen/HttpResponse';
export * from './gen/HttpResponseHeader';
export * from './gen/HttpUrlParameter';
export * from './gen/KeyValue';
export * from './gen/Workspace';

View File

@@ -1 +0,0 @@
export * from './types';

View File

@@ -1,135 +0,0 @@
export interface BaseModel {
readonly model: string;
readonly id: string;
readonly createdAt: string;
readonly updatedAt: string;
}
export interface Workspace extends BaseModel {
readonly model: 'workspace';
name: string;
description: string;
variables: EnvironmentVariable[];
settingValidateCertificates: boolean;
settingFollowRedirects: boolean;
settingRequestTimeout: number;
}
export interface EnvironmentVariable {
name: string;
value: string;
enabled?: boolean;
}
export interface Folder extends BaseModel {
readonly workspaceId: string;
readonly model: 'folder';
folderId: string | null;
sortPriority: number;
name: string;
}
export interface Environment extends BaseModel {
readonly workspaceId: string;
readonly model: 'environment';
name: string;
variables: EnvironmentVariable[];
}
export interface HttpHeader {
name: string;
value: string;
enabled?: boolean;
}
export interface HttpUrlParameter {
name: string;
value: string;
enabled?: boolean;
}
export interface GrpcMetadataEntry {
name: string;
value: string;
enabled?: boolean;
}
export interface GrpcRequest extends BaseModel {
readonly workspaceId: string;
readonly model: 'grpc_request';
folderId: string | null;
sortPriority: number;
name: string;
url: string;
service: string | null;
method: string | null;
message: string;
authentication: Record<string, string | number | boolean | null | undefined>;
authenticationType: string | null;
metadata: GrpcMetadataEntry[];
}
export interface GrpcEvent extends BaseModel {
readonly workspaceId: string;
readonly requestId: string;
readonly connectionId: string;
readonly model: 'grpc_event';
content: string;
status: number | null;
error: string | null;
eventType:
| 'info'
| 'error'
| 'client_message'
| 'server_message'
| 'connection_start'
| 'connection_end';
metadata: Record<string, string>;
}
export interface GrpcConnection extends BaseModel {
readonly workspaceId: string;
readonly requestId: string;
readonly model: 'grpc_connection';
service: string;
method: string;
elapsed: number;
elapsedConnection: number;
status: number;
url: string;
error: string | null;
trailers: Record<string, string>;
}
export interface HttpRequest extends BaseModel {
readonly workspaceId: string;
readonly model: 'http_request';
folderId: string | null;
sortPriority: number;
name: string;
url: string;
urlParameters: HttpUrlParameter[];
body: Record<string, unknown>;
bodyType: string | null;
authentication: Record<string, string | number | boolean | null | undefined>;
authenticationType: string | null;
method: string;
headers: HttpHeader[];
}
export interface HttpResponse extends BaseModel {
readonly workspaceId: string;
readonly model: 'http_response';
readonly requestId: string;
readonly bodyPath: string | null;
readonly contentLength: number | null;
readonly error: string;
readonly status: number;
readonly elapsed: number;
readonly elapsedHeaders: number;
readonly statusReason: string;
readonly version: string;
readonly remoteAddr: string;
readonly url: string;
readonly headers: HttpHeader[];
}

View File

@@ -1,4 +1,5 @@
import { HttpRequest, HttpResponse } from '../models'; import { HttpRequest } from '../gen/HttpRequest';
import { HttpResponse } from '../gen/HttpResponse';
export type YaakContext = { export type YaakContext = {
metadata: { metadata: {

View File

@@ -1,4 +1,4 @@
import { HttpRequest } from '../models'; import { HttpRequest } from '../gen/HttpRequest';
import { YaakContext } from './context'; import { YaakContext } from './context';
export type HttpRequestActionPlugin = { export type HttpRequestActionPlugin = {

View File

@@ -1,5 +1,8 @@
import { Environment } from '../gen/Environment';
import { Folder } from '../gen/Folder';
import { HttpRequest } from '../gen/HttpRequest';
import { Workspace } from '../gen/Workspace';
import { AtLeast } from '../helpers'; import { AtLeast } from '../helpers';
import { Environment, Folder, HttpRequest, Workspace } from '../models';
import { YaakContext } from './context'; import { YaakContext } from './context';
export type ImportPluginResponse = null | { export type ImportPluginResponse = null | {

View File

@@ -1,50 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT model, created_at, updated_at, namespace, key, value\n FROM key_values\n WHERE namespace = ? AND key = ?\n ",
"describe": {
"columns": [
{
"name": "model",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 1,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "namespace",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "key",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "value",
"ordinal": 5,
"type_info": "Text"
}
],
"parameters": {
"Right": 2
},
"nullable": [
false,
false,
false,
false,
false,
false
]
},
"hash": "06aaf8f4a17566f1d25da2a60f0baf4b5fc28c3cf0c001a84e25edf9eab3c7e3"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n DELETE FROM http_responses\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "07d1a1c7b4f3d9625a766e60fd57bb779b71dae30e5bbce34885a911a5a42428"
}

View File

@@ -1,116 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, request_id, updated_at, created_at, url, status,\n status_reason, content_length, body_path, elapsed, elapsed_headers, error,\n version, remote_addr,\n headers AS \"headers!: sqlx::types::Json<Vec<HttpResponseHeader>>\"\n FROM http_responses\n WHERE id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "request_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "updated_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "created_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "url",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "status",
"ordinal": 7,
"type_info": "Int64"
},
{
"name": "status_reason",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "content_length",
"ordinal": 9,
"type_info": "Int64"
},
{
"name": "body_path",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "elapsed",
"ordinal": 11,
"type_info": "Int64"
},
{
"name": "elapsed_headers",
"ordinal": 12,
"type_info": "Int64"
},
{
"name": "error",
"ordinal": 13,
"type_info": "Text"
},
{
"name": "version",
"ordinal": 14,
"type_info": "Text"
},
{
"name": "remote_addr",
"ordinal": 15,
"type_info": "Text"
},
{
"name": "headers!: sqlx::types::Json<Vec<HttpResponseHeader>>",
"ordinal": 16,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false,
false,
true,
true,
true,
false,
false,
true,
true,
true,
false
]
},
"hash": "0fa6b56f8c996d14908a56928674b4b35af5fa36f63dc48b9b66ee6dfde78976"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO workspaces (\n id, name, description, variables, setting_request_timeout,\n setting_follow_redirects, setting_validate_certificates\n )\n VALUES (?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n name = excluded.name,\n description = excluded.description,\n variables = excluded.variables,\n setting_request_timeout = excluded.setting_request_timeout,\n setting_follow_redirects = excluded.setting_follow_redirects,\n setting_validate_certificates = excluded.setting_validate_certificates\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 7
},
"nullable": []
},
"hash": "12b265491d1ebba19e1ce8a660e458ffbcd8c0850aef16ba1f70e358623ac66a"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO environments (\n id, workspace_id, name, variables\n )\n VALUES (?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n name = excluded.name,\n variables = excluded.variables\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 4
},
"nullable": []
},
"hash": "13cb883199e81966174e6fda9c252bf7213fe01b5346266c0a89dc0ac89eda64"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO grpc_events (\n id, workspace_id, request_id, connection_id, content, event_type, metadata,\n status, error\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n content = excluded.content,\n event_type = excluded.event_type,\n metadata = excluded.metadata,\n status = excluded.status,\n error = excluded.error\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 9
},
"nullable": []
},
"hash": "14930955e8a914e292dfbebfce2ea43cc41c1d517386ed816c16d436bf626bf3"
}

View File

@@ -1,104 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, folder_id, created_at, updated_at, name, sort_priority,\n url, service, method, message, authentication_type,\n authentication AS \"authentication!: Json<HashMap<String, JsonValue>>\",\n metadata AS \"metadata!: sqlx::types::Json<Vec<GrpcMetadataEntry>>\"\n FROM grpc_requests\n WHERE workspace_id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "folder_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "name",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "sort_priority",
"ordinal": 7,
"type_info": "Float"
},
{
"name": "url",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "service",
"ordinal": 9,
"type_info": "Text"
},
{
"name": "method",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "message",
"ordinal": 11,
"type_info": "Text"
},
{
"name": "authentication_type",
"ordinal": 12,
"type_info": "Text"
},
{
"name": "authentication!: Json<HashMap<String, JsonValue>>",
"ordinal": 13,
"type_info": "Text"
},
{
"name": "metadata!: sqlx::types::Json<Vec<GrpcMetadataEntry>>",
"ordinal": 14,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
true,
false,
false,
false,
false,
false,
true,
true,
false,
true,
false,
false
]
},
"hash": "1821c2f60b9fa4514d58eb73b23e25ad683b80b9bd0c2944063190a0d0a19ee5"
}

View File

@@ -1,80 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, request_id, connection_id, created_at, content, status, error,\n event_type AS \"event_type!: GrpcEventType\",\n metadata AS \"metadata!: sqlx::types::Json<HashMap<String, String>>\"\n FROM grpc_events\n WHERE connection_id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "request_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "connection_id",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "content",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "status",
"ordinal": 7,
"type_info": "Int64"
},
{
"name": "error",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "event_type!: GrpcEventType",
"ordinal": 9,
"type_info": "Text"
},
{
"name": "metadata!: sqlx::types::Json<HashMap<String, String>>",
"ordinal": 10,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false,
true,
true,
false,
false
]
},
"hash": "18ada3bb42c29f1940ab2e61961d79cdd69210f3dc2076aedcadeba8e34dcb6e"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO settings (id)\n VALUES ('default')\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 0
},
"nullable": []
},
"hash": "2c181a4dc13efc52fe6a5a68291c5678a9624020df4ea744e78396f6926d5c88"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO http_responses (\n id, request_id, workspace_id, elapsed, elapsed_headers, url, status, status_reason,\n content_length, body_path, headers, version, remote_addr\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 13
},
"nullable": []
},
"hash": "2c9658a639c5e4994ae9c8ec30bd4e40a1945d640962991f879928619950ef62"
}

View File

@@ -1,92 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, request_id, created_at, updated_at, service,\n method, elapsed, status, error, url,\n trailers AS \"trailers!: sqlx::types::Json<HashMap<String, String>>\"\n FROM grpc_connections\n WHERE request_id = ?\n ORDER BY created_at DESC\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "request_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "service",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "method",
"ordinal": 7,
"type_info": "Text"
},
{
"name": "elapsed",
"ordinal": 8,
"type_info": "Int64"
},
{
"name": "status",
"ordinal": 9,
"type_info": "Int64"
},
{
"name": "error",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "url",
"ordinal": 11,
"type_info": "Text"
},
{
"name": "trailers!: sqlx::types::Json<HashMap<String, String>>",
"ordinal": 12,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
true,
false,
false
]
},
"hash": "3e8651cca7feecc208a676dfd24c7d8775040d5287c16890056dcb474674edfb"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n DELETE FROM grpc_connections\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "42bc0ded60b44dab19daf6d8fc7df83d83af5d88ea0b84514fdc877a668c27cd"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n DELETE FROM http_requests\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "448a1d1f1866ab42c0f81fcf8eb2930bf21dfdd43ca4831bc1a198cf45ac3732"
}

View File

@@ -1,62 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, created_at, updated_at, folder_id, name, sort_priority\n FROM folders\n WHERE workspace_id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "folder_id",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "name",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "sort_priority",
"ordinal": 7,
"type_info": "Float"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
true,
false,
false
]
},
"hash": "558e72df3c6f2635c6b3d52a199f9a5f7a3d82b379ff9af36645dcfb92548fdd"
}

View File

@@ -1,110 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, folder_id, created_at, updated_at, name, url, method,\n body_type, authentication_type, sort_priority,\n url_parameters AS \"url_parameters!: sqlx::types::Json<Vec<HttpUrlParameter>>\",\n body AS \"body!: Json<HashMap<String, JsonValue>>\",\n authentication AS \"authentication!: Json<HashMap<String, JsonValue>>\",\n headers AS \"headers!: sqlx::types::Json<Vec<HttpRequestHeader>>\"\n FROM http_requests\n WHERE id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "folder_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "name",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "url",
"ordinal": 7,
"type_info": "Text"
},
{
"name": "method",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "body_type",
"ordinal": 9,
"type_info": "Text"
},
{
"name": "authentication_type",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "sort_priority",
"ordinal": 11,
"type_info": "Float"
},
{
"name": "url_parameters!: sqlx::types::Json<Vec<HttpUrlParameter>>",
"ordinal": 12,
"type_info": "Text"
},
{
"name": "body!: Json<HashMap<String, JsonValue>>",
"ordinal": 13,
"type_info": "Text"
},
{
"name": "authentication!: Json<HashMap<String, JsonValue>>",
"ordinal": 14,
"type_info": "Text"
},
{
"name": "headers!: sqlx::types::Json<Vec<HttpRequestHeader>>",
"ordinal": 15,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
true,
false,
false,
false,
false,
false,
true,
true,
false,
false,
false,
false,
false
]
},
"hash": "573db23160de025e5c72efb90be7fff5e3ec4619b962d149fdd4d618fe02c680"
}

View File

@@ -1,56 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, created_at, updated_at, name,\n variables AS \"variables!: sqlx::types::Json<Vec<EnvironmentVariable>>\"\n FROM environments\n WHERE id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "name",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "variables!: sqlx::types::Json<Vec<EnvironmentVariable>>",
"ordinal": 6,
"type_info": "Null"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false
]
},
"hash": "5765e9565a8b89c5bc2d72197e0e4a1093739e9abba69f6fe5527d453fab4db8"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO grpc_requests (\n id, name, workspace_id, folder_id, sort_priority, url, service, method, message,\n authentication_type, authentication, metadata\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n workspace_id = excluded.workspace_id,\n name = excluded.name,\n folder_id = excluded.folder_id,\n sort_priority = excluded.sort_priority,\n url = excluded.url,\n service = excluded.service,\n method = excluded.method,\n message = excluded.message,\n authentication_type = excluded.authentication_type,\n authentication = excluded.authentication,\n metadata = excluded.metadata\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 12
},
"nullable": []
},
"hash": "5af82cd333895d3d7d67a92f37b0feb338f615b88aea2bd09cb5809008c645a3"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO http_requests (\n id, workspace_id, folder_id, name, url, url_parameters, method, body, body_type,\n authentication, authentication_type, headers, sort_priority\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n workspace_id = excluded.workspace_id,\n name = excluded.name,\n folder_id = excluded.folder_id,\n method = excluded.method,\n headers = excluded.headers,\n body = excluded.body,\n body_type = excluded.body_type,\n authentication = excluded.authentication,\n authentication_type = excluded.authentication_type,\n url = excluded.url,\n url_parameters = excluded.url_parameters,\n sort_priority = excluded.sort_priority\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 13
},
"nullable": []
},
"hash": "5f2f40062abbe93e23b38876319cf16d4d2b3f8d0be32ffe7848528c725e1429"
}

View File

@@ -1,56 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, created_at, updated_at, workspace_id, name,\n cookies AS \"cookies!: sqlx::types::Json<Vec<JsonValue>>\"\n FROM cookie_jars WHERE workspace_id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "workspace_id",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "name",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "cookies!: sqlx::types::Json<Vec<JsonValue>>",
"ordinal": 6,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false
]
},
"hash": "612efa9ac45723dc604a88f5e7e288b4055fec4ba7d9102131bd255c037fa021"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO grpc_connections (\n id, workspace_id, request_id, service, method, elapsed,\n status, error, trailers, url\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n service = excluded.service,\n method = excluded.method,\n elapsed = excluded.elapsed,\n status = excluded.status,\n error = excluded.error,\n trailers = excluded.trailers,\n url = excluded.url\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 10
},
"nullable": []
},
"hash": "66deed028199c78ed15ea2f837907887c2a2cb564d1d076dd4ebf0ecbc82e098"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n UPDATE settings SET (\n theme, appearance, theme_dark, theme_light, update_channel,\n interface_font_size, interface_scale, editor_font_size, editor_soft_wrap,\n open_workspace_new_window\n ) = (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) WHERE id = 'default';\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 10
},
"nullable": []
},
"hash": "6b5edf45a6799cd7f87c23a3c7f818ad110d58c601f694a619d9345ae9e8e11d"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n DELETE FROM workspaces\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "84be2b954870ab181738656ecd4d03fca2ff21012947014c79626abfce8e999b"
}

View File

@@ -1,74 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, created_at, updated_at, name, description, setting_request_timeout,\n setting_follow_redirects, setting_validate_certificates,\n variables AS \"variables!: sqlx::types::Json<Vec<EnvironmentVariable>>\"\n FROM workspaces\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "name",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "description",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "setting_request_timeout",
"ordinal": 6,
"type_info": "Int64"
},
{
"name": "setting_follow_redirects",
"ordinal": 7,
"type_info": "Bool"
},
{
"name": "setting_validate_certificates",
"ordinal": 8,
"type_info": "Bool"
},
{
"name": "variables!: sqlx::types::Json<Vec<EnvironmentVariable>>",
"ordinal": 9,
"type_info": "Text"
}
],
"parameters": {
"Right": 0
},
"nullable": [
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
]
},
"hash": "8dfbae65ddec905ea3734448cc9f7029b6c78de227c6fa3a85d75d0a7f21e0e9"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO folders (\n id, workspace_id, folder_id, name, sort_priority\n )\n VALUES (?, ?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n name = excluded.name,\n folder_id = excluded.folder_id,\n sort_priority = excluded.sort_priority\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 5
},
"nullable": []
},
"hash": "9238f94c688d91f42627e5b73c627c514bab4039ab5edadc79b77dfdfd63b208"
}

View File

@@ -1,80 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, request_id, connection_id, created_at, content, status, error,\n event_type AS \"event_type!: GrpcEventType\",\n metadata AS \"metadata!: sqlx::types::Json<HashMap<String, String>>\"\n FROM grpc_events\n WHERE id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "request_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "connection_id",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "content",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "status",
"ordinal": 7,
"type_info": "Int64"
},
{
"name": "error",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "event_type!: GrpcEventType",
"ordinal": 9,
"type_info": "Text"
},
{
"name": "metadata!: sqlx::types::Json<HashMap<String, String>>",
"ordinal": 10,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false,
true,
true,
false,
false
]
},
"hash": "92d8f003a8f7df692345f2d2fd2504c9222645976e3433e32e190f4ee4bf100d"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n DELETE FROM folders\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "93aea3881dffb70a82325263740a0bb6477e78f27991ce7456b394e84383acb6"
}

View File

@@ -1,74 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, created_at, updated_at, name, description, setting_request_timeout,\n setting_follow_redirects, setting_validate_certificates,\n variables AS \"variables!: sqlx::types::Json<Vec<EnvironmentVariable>>\"\n FROM workspaces WHERE id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "name",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "description",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "setting_request_timeout",
"ordinal": 6,
"type_info": "Int64"
},
{
"name": "setting_follow_redirects",
"ordinal": 7,
"type_info": "Bool"
},
{
"name": "setting_validate_certificates",
"ordinal": 8,
"type_info": "Bool"
},
{
"name": "variables!: sqlx::types::Json<Vec<EnvironmentVariable>>",
"ordinal": 9,
"type_info": "Null"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
]
},
"hash": "9ba3f783238b77637ffded4171b2fbb5e5ad0be952a0d832448d65cc5f0effc1"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n UPDATE grpc_connections\n SET (elapsed) = (-1)\n WHERE elapsed = 0;\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 0
},
"nullable": []
},
"hash": "a690a04cd1ebe8c3dbfd0cd98ae4ef093a1696d7b7ecaf694d12e5fafd62b685"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n UPDATE http_responses\n SET (elapsed, status_reason) = (-1, 'Cancelled')\n WHERE elapsed = 0;\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 0
},
"nullable": []
},
"hash": "ac1b4ffbd98b67f0a1a74e3525387d679dd6f44c561d55c7bbea747053e53671"
}

View File

@@ -1,116 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, request_id, updated_at, created_at, url, status,\n status_reason, content_length, body_path, elapsed, elapsed_headers, error,\n version, remote_addr,\n headers AS \"headers!: sqlx::types::Json<Vec<HttpResponseHeader>>\"\n FROM http_responses\n WHERE request_id = ?\n ORDER BY created_at DESC\n LIMIT ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "request_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "updated_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "created_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "url",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "status",
"ordinal": 7,
"type_info": "Int64"
},
{
"name": "status_reason",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "content_length",
"ordinal": 9,
"type_info": "Int64"
},
{
"name": "body_path",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "elapsed",
"ordinal": 11,
"type_info": "Int64"
},
{
"name": "elapsed_headers",
"ordinal": 12,
"type_info": "Int64"
},
{
"name": "error",
"ordinal": 13,
"type_info": "Text"
},
{
"name": "version",
"ordinal": 14,
"type_info": "Text"
},
{
"name": "remote_addr",
"ordinal": 15,
"type_info": "Text"
},
{
"name": "headers!: sqlx::types::Json<Vec<HttpResponseHeader>>",
"ordinal": 16,
"type_info": "Text"
}
],
"parameters": {
"Right": 2
},
"nullable": [
false,
false,
false,
false,
false,
false,
false,
false,
true,
true,
true,
false,
false,
true,
true,
true,
false
]
},
"hash": "ac38621cd947c3be9ca0d8ea73325fe35c3866d16f6482fc32c23762f112dc83"
}

View File

@@ -1,62 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, created_at, updated_at, folder_id, name, sort_priority\n FROM folders\n WHERE id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "folder_id",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "name",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "sort_priority",
"ordinal": 7,
"type_info": "Float"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
true,
false,
false
]
},
"hash": "ae98a7b35a5cb80a4bcd04faa22545deac2a5e9bfb814b60191f16b98ed49796"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n DELETE FROM environments\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "aeb0712785a9964d516dc8939bc54aa8206ad852e608b362d014b67a0f21b0ed"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO cookie_jars (\n id, workspace_id, name, cookies\n )\n VALUES (?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n name = excluded.name,\n cookies = excluded.cookies\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 4
},
"nullable": []
},
"hash": "b3fae40a793a6724dd2286a9ca4bc0a9c000a631ee0d751a9dc4f3e76de3d57c"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n DELETE FROM cookie_jars\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "b98609f65dd3a6bbd1ea8dc8bed2840a6d5d13fec1bbc0aa61ca4f60de98a09c"
}

View File

@@ -1,56 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT id, workspace_id, model, created_at, updated_at, name,\n variables AS \"variables!: sqlx::types::Json<Vec<EnvironmentVariable>>\"\n FROM environments\n WHERE workspace_id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "name",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "variables!: sqlx::types::Json<Vec<EnvironmentVariable>>",
"ordinal": 6,
"type_info": "Null"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false
]
},
"hash": "ba2b34a77723f24f86e4c3c45274dbfec6ca130e16e592f948844c037bdc0593"
}

View File

@@ -1,92 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, request_id, created_at, updated_at, service,\n method, elapsed, status, error, url,\n trailers AS \"trailers!: sqlx::types::Json<HashMap<String, String>>\"\n FROM grpc_connections\n WHERE id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "request_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "service",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "method",
"ordinal": 7,
"type_info": "Text"
},
{
"name": "elapsed",
"ordinal": 8,
"type_info": "Int64"
},
{
"name": "status",
"ordinal": 9,
"type_info": "Int64"
},
{
"name": "error",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "url",
"ordinal": 11,
"type_info": "Text"
},
{
"name": "trailers!: sqlx::types::Json<HashMap<String, String>>",
"ordinal": 12,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
true,
false,
false
]
},
"hash": "d4b64c466624eb75e0f5bd201ebfb6a73d25eb7c9e09cb9690afdb7fef5fca8b"
}

View File

@@ -1,116 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, request_id, updated_at, created_at, url, status,\n status_reason, content_length, body_path, elapsed, elapsed_headers, error,\n version, remote_addr,\n headers AS \"headers!: sqlx::types::Json<Vec<HttpResponseHeader>>\"\n FROM http_responses\n WHERE workspace_id = ?\n ORDER BY created_at DESC\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "request_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "updated_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "created_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "url",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "status",
"ordinal": 7,
"type_info": "Int64"
},
{
"name": "status_reason",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "content_length",
"ordinal": 9,
"type_info": "Int64"
},
{
"name": "body_path",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "elapsed",
"ordinal": 11,
"type_info": "Int64"
},
{
"name": "elapsed_headers",
"ordinal": 12,
"type_info": "Int64"
},
{
"name": "error",
"ordinal": 13,
"type_info": "Text"
},
{
"name": "version",
"ordinal": 14,
"type_info": "Text"
},
{
"name": "remote_addr",
"ordinal": 15,
"type_info": "Text"
},
{
"name": "headers!: sqlx::types::Json<Vec<HttpResponseHeader>>",
"ordinal": 16,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false,
false,
true,
true,
true,
false,
false,
true,
true,
true,
false
]
},
"hash": "d5e087caa163a0c7bfbbadf07eccb80105501cf5baab706aa6792dfe90af8fc9"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO key_values (namespace, key, value)\n VALUES (?, ?, ?) ON CONFLICT DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n value = excluded.value\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 3
},
"nullable": []
},
"hash": "d80c09497771e3641022e73ec6c6a87e73a551f88a948a5445d754922b82b50b"
}

View File

@@ -1,98 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, created_at, updated_at, theme, appearance,\n theme_dark, theme_light, update_channel,\n interface_font_size, interface_scale, editor_font_size, editor_soft_wrap,\n open_workspace_new_window\n FROM settings\n WHERE id = 'default'\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "theme",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "appearance",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "theme_dark",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "theme_light",
"ordinal": 7,
"type_info": "Text"
},
{
"name": "update_channel",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "interface_font_size",
"ordinal": 9,
"type_info": "Int64"
},
{
"name": "interface_scale",
"ordinal": 10,
"type_info": "Int64"
},
{
"name": "editor_font_size",
"ordinal": 11,
"type_info": "Int64"
},
{
"name": "editor_soft_wrap",
"ordinal": 12,
"type_info": "Bool"
},
{
"name": "open_workspace_new_window",
"ordinal": 13,
"type_info": "Bool"
}
],
"parameters": {
"Right": 0
},
"nullable": [
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
true
]
},
"hash": "daa61066517df649e7c80a8ce407839ad502e8e5e43aa8c02e049865acbbae75"
}

View File

@@ -1,104 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, folder_id, created_at, updated_at, name, sort_priority,\n url, service, method, message, authentication_type,\n authentication AS \"authentication!: Json<HashMap<String, JsonValue>>\",\n metadata AS \"metadata!: sqlx::types::Json<Vec<GrpcMetadataEntry>>\"\n FROM grpc_requests\n WHERE id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "folder_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "name",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "sort_priority",
"ordinal": 7,
"type_info": "Float"
},
{
"name": "url",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "service",
"ordinal": 9,
"type_info": "Text"
},
{
"name": "method",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "message",
"ordinal": 11,
"type_info": "Text"
},
{
"name": "authentication_type",
"ordinal": 12,
"type_info": "Text"
},
{
"name": "authentication!: Json<HashMap<String, JsonValue>>",
"ordinal": 13,
"type_info": "Text"
},
{
"name": "metadata!: sqlx::types::Json<Vec<GrpcMetadataEntry>>",
"ordinal": 14,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
true,
false,
false,
false,
false,
false,
true,
true,
false,
true,
false,
false
]
},
"hash": "e1cdba43bd938772631263966a9bee263923c387f4864917f36a04043bec4857"
}

View File

@@ -1,110 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, workspace_id, folder_id, created_at, updated_at, name, url,\n url_parameters AS \"url_parameters!: sqlx::types::Json<Vec<HttpUrlParameter>>\",\n method, body_type, authentication_type, sort_priority,\n body AS \"body!: Json<HashMap<String, JsonValue>>\",\n authentication AS \"authentication!: Json<HashMap<String, JsonValue>>\",\n headers AS \"headers!: sqlx::types::Json<Vec<HttpRequestHeader>>\"\n FROM http_requests\n WHERE workspace_id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "workspace_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "folder_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 5,
"type_info": "Datetime"
},
{
"name": "name",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "url",
"ordinal": 7,
"type_info": "Text"
},
{
"name": "url_parameters!: sqlx::types::Json<Vec<HttpUrlParameter>>",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "method",
"ordinal": 9,
"type_info": "Text"
},
{
"name": "body_type",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "authentication_type",
"ordinal": 11,
"type_info": "Text"
},
{
"name": "sort_priority",
"ordinal": 12,
"type_info": "Float"
},
{
"name": "body!: Json<HashMap<String, JsonValue>>",
"ordinal": 13,
"type_info": "Text"
},
{
"name": "authentication!: Json<HashMap<String, JsonValue>>",
"ordinal": 14,
"type_info": "Text"
},
{
"name": "headers!: sqlx::types::Json<Vec<HttpRequestHeader>>",
"ordinal": 15,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
true,
false,
false,
false,
false,
false,
false,
true,
true,
false,
false,
false,
false
]
},
"hash": "e61c0dddb3e86d271cb9399faa4e4443342796cb72bdd43a821fae2994ae8e2f"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n UPDATE http_responses SET (\n elapsed, elapsed_headers, url, status, status_reason, content_length, body_path,\n error, headers, version, remote_addr, updated_at\n ) = (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP) WHERE id = ?;\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 12
},
"nullable": []
},
"hash": "e7124f5570076bfd65985744f48d8e12cf29d6d243fffdd62ade2ab70c7bddda"
}

View File

@@ -1,56 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id, model, created_at, updated_at, workspace_id, name,\n cookies AS \"cookies!: sqlx::types::Json<Vec<JsonValue>>\"\n FROM cookie_jars WHERE id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "model",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "created_at",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "updated_at",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "workspace_id",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "name",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "cookies!: sqlx::types::Json<Vec<JsonValue>>",
"ordinal": 6,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
false,
false
]
},
"hash": "f5f20f3b37d932617499a0da50997edad59e4f5998b15c50ed6eae2e97064068"
}

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n DELETE FROM grpc_requests\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "fe0652396bc30d926cf99083651c1cbd668bcf00ebe1a5f36616700c84972b39"
}

514
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,6 @@
workspace = { members = ["grpc", "templates", "tauri-plugin-plugin-runtime"] } [workspace]
members = ["grpc", "templates", "yaak_plugin_runtime", "yaak_models"]
[package] [package]
name = "yaak-app" name = "yaak-app"
@@ -14,7 +16,7 @@ crate-type = ["staticlib", "cdylib", "lib"]
strip = true # Automatically strip symbols from the binary. strip = true # Automatically strip symbols from the binary.
[build-dependencies] [build-dependencies]
tauri-build = { version = "2.0.0-beta", features = [] } tauri-build = { version = "2.0.0-rc.0", features = [] }
[target.'cfg(target_os = "macos")'.dependencies] [target.'cfg(target_os = "macos")'.dependencies]
objc = "0.2.7" objc = "0.2.7"
@@ -26,7 +28,8 @@ openssl-sys = { version = "0.9", features = ["vendored"] } # For Ubuntu installa
[dependencies] [dependencies]
grpc = { path = "./grpc" } grpc = { path = "./grpc" }
templates = { path = "./templates" } templates = { path = "./templates" }
plugin_runtime = { path = "tauri-plugin-plugin-runtime" } yaak_plugin_runtime = { path = "yaak_plugin_runtime" }
yaak_models = { path = "yaak_models" }
anyhow = "1.0.86" anyhow = "1.0.86"
base64 = "0.22.0" base64 = "0.22.0"
chrono = { version = "0.4.31", features = ["serde"] } chrono = { version = "0.4.31", features = ["serde"] }
@@ -41,18 +44,22 @@ reqwest_cookie_store = "0.8.0"
serde = { version = "1.0.198", features = ["derive"] } serde = { version = "1.0.198", features = ["derive"] }
serde_json = { version = "1.0.116", features = ["raw_value"] } serde_json = { version = "1.0.116", features = ["raw_value"] }
serde_yaml = "0.9.34" serde_yaml = "0.9.34"
sqlx = { version = "0.7.4", features = ["sqlite", "runtime-tokio-rustls", "json", "chrono", "time"] } sqlx = { version = "0.8.0", features = ["sqlite", "runtime-tokio-rustls"] }
tauri = { version = "2.0.0-beta", features = ["devtools", "protocol-asset"] } tauri = { workspace = true }
tauri-plugin-clipboard-manager = "2.1.0-beta" tauri-plugin-shell = { workspace = true }
tauri-plugin-dialog = "2.0.0-beta" tauri-plugin-clipboard-manager = "2.0.0-rc.0"
tauri-plugin-fs = "2.0.0-beta" tauri-plugin-dialog = "2.0.0-rc.0"
tauri-plugin-log = { version = "2.0.0-beta", features = ["colored"] } tauri-plugin-fs = "2.0.0-rc.0"
tauri-plugin-os = "2.0.0-beta" tauri-plugin-log = { version = "2.0.0-rc.0", features = ["colored"] }
tauri-plugin-shell = "2.0.0-beta" tauri-plugin-os = "2.0.0-rc.0"
tauri-plugin-updater = "2.0.0-beta" tauri-plugin-updater = "2.0.0-rc.0"
tauri-plugin-window-state = "2.0.0-beta" tauri-plugin-window-state = "2.0.0-rc.0"
tokio = { version = "1.36.0", features = ["sync"] } tokio = { version = "1.36.0", features = ["sync"] }
tokio-stream = "0.1.15" tokio-stream = "0.1.15"
uuid = "1.7.0" uuid = "1.7.0"
thiserror = "1.0.61" thiserror = "1.0.61"
mime_guess = "2.0.5" mime_guess = "2.0.5"
[workspace.dependencies]
tauri = { version = "2.0.0-rc.0", features = ["devtools", "protocol-asset"] }
tauri-plugin-shell = "2.0.0-rc.0"

View File

@@ -7,14 +7,14 @@
"*" "*"
], ],
"permissions": [ "permissions": [
"core:event:allow-emit",
"core:event:allow-listen",
"core:event:allow-unlisten",
"os:allow-os-type", "os:allow-os-type",
"event:allow-emit",
"clipboard-manager:allow-write-text", "clipboard-manager:allow-write-text",
"clipboard-manager:allow-read-text", "clipboard-manager:allow-read-text",
"dialog:allow-open", "dialog:allow-open",
"dialog:allow-save", "dialog:allow-save",
"event:allow-listen",
"event:allow-unlisten",
"fs:allow-read-file", "fs:allow-read-file",
"fs:allow-read-text-file", "fs:allow-read-text-file",
{ {
@@ -29,17 +29,17 @@
] ]
}, },
"shell:allow-open", "shell:allow-open",
"webview:allow-set-webview-zoom", "core:webview:allow-set-webview-zoom",
"window:allow-close", "core:window:allow-close",
"window:allow-is-fullscreen", "core:window:allow-is-fullscreen",
"window:allow-maximize", "core:window:allow-maximize",
"window:allow-minimize", "core:window:allow-minimize",
"window:allow-toggle-maximize", "core:window:allow-toggle-maximize",
"window:allow-set-decorations", "core:window:allow-set-decorations",
"window:allow-set-title", "core:window:allow-set-title",
"window:allow-start-dragging", "core:window:allow-start-dragging",
"window:allow-unmaximize", "core:window:allow-unmaximize",
"window:allow-theme", "core:window:allow-theme",
"clipboard-manager:allow-read-text", "clipboard-manager:allow-read-text",
"clipboard-manager:allow-write-text" "clipboard-manager:allow-write-text"
] ]

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"main":{"identifier":"main","description":"Main permissions","local":true,"windows":["*"],"permissions":["os:allow-os-type","event:allow-emit","clipboard-manager:allow-write-text","clipboard-manager:allow-read-text","dialog:allow-open","dialog:allow-save","event:allow-listen","event:allow-unlisten","fs:allow-read-file","fs:allow-read-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPDATA"},{"path":"$APPDATA/**"}]},"shell:allow-open","webview:allow-set-webview-zoom","window:allow-close","window:allow-is-fullscreen","window:allow-maximize","window:allow-minimize","window:allow-toggle-maximize","window:allow-set-decorations","window:allow-set-title","window:allow-start-dragging","window:allow-unmaximize","window:allow-theme","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text"]}} {"main":{"identifier":"main","description":"Main permissions","local":true,"windows":["*"],"permissions":["core:event:allow-emit","core:event:allow-listen","core:event:allow-unlisten","os:allow-os-type","clipboard-manager:allow-write-text","clipboard-manager:allow-read-text","dialog:allow-open","dialog:allow-save","fs:allow-read-file","fs:allow-read-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPDATA"},{"path":"$APPDATA/**"}]},"shell:allow-open","core:webview:allow-set-webview-zoom","core:window:allow-close","core:window:allow-is-fullscreen","core:window:allow-maximize","core:window:allow-minimize","core:window:allow-toggle-maximize","core:window:allow-set-decorations","core:window:allow-set-title","core:window:allow-start-dragging","core:window:allow-unmaximize","core:window:allow-theme","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text"]}}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,7 @@ anyhow = "1.0.79"
hyper = { version = "0.14" } hyper = { version = "0.14" }
hyper-rustls = { version = "0.24.0", features = ["http2"] } hyper-rustls = { version = "0.24.0", features = ["http2"] }
uuid = { version = "1.7.0", features = ["v4"] } uuid = { version = "1.7.0", features = ["v4"] }
tauri = { version = "2.0.0-beta" } tauri = { workspace = true }
tauri-plugin-shell = "2.0.0-beta" tauri-plugin-shell = { workspace = true }
md5 = "0.7.0" md5 = "0.7.0"
dunce = "1.0.4" dunce = "1.0.4"

View File

@@ -6,10 +6,9 @@ use serde_json::json;
use sqlx::types::JsonValue; use sqlx::types::JsonValue;
use tauri::{AppHandle, Manager}; use tauri::{AppHandle, Manager};
use yaak_models::queries::{generate_id, get_key_value_int, get_key_value_string, set_key_value_int, set_key_value_string};
use crate::is_dev; use crate::is_dev;
use crate::models::{
generate_id, get_key_value_int, get_key_value_string, set_key_value_int, set_key_value_string,
};
const NAMESPACE: &str = "analytics"; const NAMESPACE: &str = "analytics";
const NUM_LAUNCHES_KEY: &str = "num_launches"; const NUM_LAUNCHES_KEY: &str = "num_launches";

View File

@@ -1,16 +0,0 @@
use deno_core::error::AnyError;
use deno_core::op2;
#[op2]
#[serde]
pub fn op_yaml_parse(#[string] text: String) -> Result<serde_json::Value, AnyError> {
let value = serde_yaml::from_str(&text)?;
Ok(value)
}
#[op2]
#[string]
pub fn op_yaml_stringify(#[serde] value: serde_json::Value) -> Result<String, AnyError> {
let value = serde_yaml::to_string(&value)?;
Ok(value)
}

View File

@@ -0,0 +1,77 @@
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use tauri::{Manager, WebviewWindow};
use yaak_models::models::{Environment, Folder, GrpcRequest, HttpRequest, Workspace};
#[derive(Default, Debug, Deserialize, Serialize)]
#[serde(default, rename_all = "camelCase")]
pub struct WorkspaceExport {
pub yaak_version: String,
pub yaak_schema: i64,
pub timestamp: NaiveDateTime,
pub resources: WorkspaceExportResources,
}
#[derive(Default, Debug, Deserialize, Serialize)]
#[serde(default, rename_all = "camelCase")]
pub struct WorkspaceExportResources {
pub workspaces: Vec<Workspace>,
pub environments: Vec<Environment>,
pub folders: Vec<Folder>,
pub http_requests: Vec<HttpRequest>,
pub grpc_requests: Vec<GrpcRequest>,
}
#[derive(Default, Debug, Deserialize, Serialize)]
pub struct ImportResult {
pub resources: WorkspaceExportResources,
}
pub async fn get_workspace_export_resources(
window: &WebviewWindow,
workspace_ids: Vec<&str>,
) -> WorkspaceExport {
let app_handle = window.app_handle();
let mut data = WorkspaceExport {
yaak_version: app_handle.package_info().version.clone().to_string(),
yaak_schema: 2,
timestamp: chrono::Utc::now().naive_utc(),
resources: WorkspaceExportResources {
workspaces: Vec::new(),
environments: Vec::new(),
folders: Vec::new(),
http_requests: Vec::new(),
grpc_requests: Vec::new(),
},
};
for workspace_id in workspace_ids {
data.resources.workspaces.push(
yaak_models::queries::get_workspace(window, workspace_id)
.await
.expect("Failed to get workspace"),
);
data.resources.environments.append(
&mut yaak_models::queries::list_environments(window, workspace_id)
.await
.expect("Failed to get environments"),
);
data.resources.folders.append(
&mut yaak_models::queries::list_folders(window, workspace_id)
.await
.expect("Failed to get folders"),
);
data.resources.http_requests.append(
&mut yaak_models::queries::list_http_requests(window, workspace_id)
.await
.expect("Failed to get http requests"),
);
data.resources.grpc_requests.append(
&mut yaak_models::queries::list_grpc_requests(window, workspace_id)
.await
.expect("Failed to get grpc requests"),
);
}
return data;
}

View File

@@ -6,6 +6,8 @@ use std::str::FromStr;
use std::sync::Arc; use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use crate::render::variables_from_environment;
use crate::{render, response_err};
use base64::Engine; use base64::Engine;
use http::header::{ACCEPT, USER_AGENT}; use http::header::{ACCEPT, USER_AGENT};
use http::{HeaderMap, HeaderName, HeaderValue}; use http::{HeaderMap, HeaderName, HeaderValue};
@@ -14,25 +16,23 @@ use mime_guess::Mime;
use reqwest::redirect::Policy; use reqwest::redirect::Policy;
use reqwest::Method; use reqwest::Method;
use reqwest::{multipart, Url}; use reqwest::{multipart, Url};
use sqlx::types::{Json, JsonValue};
use tauri::{Manager, WebviewWindow}; use tauri::{Manager, WebviewWindow};
use tokio::sync::oneshot; use tokio::sync::oneshot;
use tokio::sync::watch::Receiver; use tokio::sync::watch::Receiver;
use yaak_models::models::{Cookie, CookieJar, Environment, HttpRequest, HttpResponse, HttpResponseHeader};
use crate::render::variables_from_environment; use yaak_models::queries::{get_workspace, update_response_if_id, upsert_cookie_jar};
use crate::{models, render, response_err};
pub async fn send_http_request( pub async fn send_http_request(
window: &WebviewWindow, window: &WebviewWindow,
request: models::HttpRequest, request: HttpRequest,
response: &models::HttpResponse, response: &HttpResponse,
environment: Option<models::Environment>, environment: Option<Environment>,
cookie_jar: Option<models::CookieJar>, cookie_jar: Option<CookieJar>,
download_path: Option<PathBuf>, download_path: Option<PathBuf>,
cancel_rx: &mut Receiver<bool>, cancel_rx: &mut Receiver<bool>,
) -> Result<models::HttpResponse, String> { ) -> Result<HttpResponse, String> {
let environment_ref = environment.as_ref(); let environment_ref = environment.as_ref();
let workspace = models::get_workspace(window, &request.workspace_id) let workspace = get_workspace(window, &request.workspace_id)
.await .await
.expect("Failed to get Workspace"); .expect("Failed to get Workspace");
let vars = variables_from_environment(&workspace, environment_ref); let vars = variables_from_environment(&workspace, environment_ref);
@@ -63,11 +63,10 @@ pub async fn send_http_request(
// HACK: Can't construct Cookie without serde, so we have to do this // HACK: Can't construct Cookie without serde, so we have to do this
let cookies = cj let cookies = cj
.cookies .cookies
.0
.iter() .iter()
.map(|json_cookie| { .map(|cookie| {
serde_json::from_value(json_cookie.clone()) let json_cookie = serde_json::to_value(cookie).unwrap();
.expect("Failed to deserialize cookie") serde_json::from_value(json_cookie).expect("Failed to deserialize cookie")
}) })
.map(|c| Ok(c)) .map(|c| Ok(c))
.collect::<Vec<Result<_, ()>>>(); .collect::<Vec<Result<_, ()>>>();
@@ -85,7 +84,7 @@ pub async fn send_http_request(
if workspace.setting_request_timeout > 0 { if workspace.setting_request_timeout > 0 {
client_builder = client_builder.timeout(Duration::from_millis( client_builder = client_builder.timeout(Duration::from_millis(
workspace.setting_request_timeout.unsigned_abs(), workspace.setting_request_timeout.unsigned_abs() as u64,
)); ));
} }
@@ -138,7 +137,7 @@ pub async fn send_http_request(
// ); // );
// } // }
for h in request.headers.0 { for h in request.headers {
if h.name.is_empty() && h.value.is_empty() { if h.name.is_empty() && h.value.is_empty() {
continue; continue;
} }
@@ -170,7 +169,7 @@ pub async fn send_http_request(
if let Some(b) = &request.authentication_type { if let Some(b) = &request.authentication_type {
let empty_value = &serde_json::to_value("").unwrap(); let empty_value = &serde_json::to_value("").unwrap();
let a = request.authentication.0; let a = request.authentication;
if b == "basic" { if b == "basic" {
let raw_username = a let raw_username = a
@@ -203,7 +202,7 @@ pub async fn send_http_request(
} }
let mut query_params = Vec::new(); let mut query_params = Vec::new();
for p in request.url_parameters.0 { for p in request.url_parameters {
if !p.enabled || p.name.is_empty() { if !p.enabled || p.name.is_empty() {
continue; continue;
} }
@@ -217,7 +216,7 @@ pub async fn send_http_request(
if let Some(body_type) = &request.body_type { if let Some(body_type) = &request.body_type {
let empty_string = &serde_json::to_value("").unwrap(); let empty_string = &serde_json::to_value("").unwrap();
let empty_bool = &serde_json::to_value(false).unwrap(); let empty_bool = &serde_json::to_value(false).unwrap();
let request_body = request.body.0; let request_body = request.body;
if request_body.contains_key("text") { if request_body.contains_key("text") {
let raw_text = request_body let raw_text = request_body
@@ -382,19 +381,17 @@ pub async fn send_http_request(
match raw_response { match raw_response {
Ok(v) => { Ok(v) => {
let mut response = response.clone(); let mut response = response.clone();
response.elapsed_headers = start.elapsed().as_millis() as i64; response.elapsed_headers = start.elapsed().as_millis() as i32;
let response_headers = v.headers().clone(); let response_headers = v.headers().clone();
response.status = v.status().as_u16() as i64; response.status = v.status().as_u16() as i32;
response.status_reason = v.status().canonical_reason().map(|s| s.to_string()); response.status_reason = v.status().canonical_reason().map(|s| s.to_string());
response.headers = Json( response.headers = response_headers
response_headers .iter()
.iter() .map(|(k, v)| HttpResponseHeader {
.map(|(k, v)| models::HttpResponseHeader { name: k.as_str().to_string(),
name: k.as_str().to_string(), value: v.to_str().unwrap_or_default().to_string(),
value: v.to_str().unwrap().to_string(), })
}) .collect();
.collect(),
);
response.url = v.url().to_string(); response.url = v.url().to_string();
response.remote_addr = v.remote_addr().map(|a| a.to_string()); response.remote_addr = v.remote_addr().map(|a| a.to_string());
response.version = match v.version() { response.version = match v.version() {
@@ -408,12 +405,12 @@ pub async fn send_http_request(
let content_length = v.content_length(); let content_length = v.content_length();
let body_bytes = v.bytes().await.expect("Failed to get body").to_vec(); let body_bytes = v.bytes().await.expect("Failed to get body").to_vec();
response.elapsed = start.elapsed().as_millis() as i64; response.elapsed = start.elapsed().as_millis() as i32;
// Use content length if available, otherwise use body length // Use content length if available, otherwise use body length
response.content_length = match content_length { response.content_length = match content_length {
Some(l) => Some(l as i64), Some(l) => Some(l as i32),
None => Some(body_bytes.len() as i64), None => Some(body_bytes.len() as i32),
}; };
{ {
@@ -441,11 +438,11 @@ pub async fn send_http_request(
); );
} }
response = models::update_response_if_id(window, &response) response = update_response_if_id(window, &response)
.await .await
.expect("Failed to update response"); .expect("Failed to update response");
// Copy response to download path, if specified // Copy response to the download path, if specified
match (download_path, response.body_path.clone()) { match (download_path, response.body_path.clone()) {
(Some(dl_path), Some(body_path)) => { (Some(dl_path), Some(body_path)) => {
info!("Downloading response body to {}", dl_path.display()); info!("Downloading response body to {}", dl_path.display());
@@ -464,16 +461,17 @@ pub async fn send_http_request(
// }); // });
// store.store_response_cookies(cookies, &url); // store.store_response_cookies(cookies, &url);
let json_cookies: Json<Vec<JsonValue>> = Json( let json_cookies: Vec<Cookie> = cookie_store
cookie_store .lock()
.lock() .unwrap()
.unwrap() .iter_any()
.iter_any() .map(|c| {
.map(|c| serde_json::to_value(&c).expect("Failed to serialize cookie")) let json_cookie = serde_json::to_value(&c).expect("Failed to serialize cookie");
.collect::<Vec<_>>(), serde_json::from_value(json_cookie).expect("Failed to deserialize cookie")
); })
.collect::<Vec<_>>();
cookie_jar.cookies = json_cookies; cookie_jar.cookies = json_cookies;
if let Err(e) = models::upsert_cookie_jar(window, &cookie_jar).await { if let Err(e) = upsert_cookie_jar(window, &cookie_jar).await {
error!("Failed to update cookie jar: {}", e); error!("Failed to update cookie jar: {}", e);
}; };
} }

View File

@@ -6,7 +6,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; use std::fs;
use std::fs::{create_dir_all, File, read_to_string}; use std::fs::{create_dir_all, read_to_string, File};
use std::path::PathBuf; use std::path::PathBuf;
use std::process::exit; use std::process::exit;
use std::str::FromStr; use std::str::FromStr;
@@ -17,66 +17,65 @@ use fern::colors::ColoredLevelConfig;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rand::random; use rand::random;
use serde_json::{json, Value}; use serde_json::{json, Value};
use sqlx::{Pool, Sqlite, SqlitePool};
use sqlx::migrate::Migrator; use sqlx::migrate::Migrator;
use sqlx::sqlite::SqliteConnectOptions; use sqlx::sqlite::SqliteConnectOptions;
use sqlx::types::Json; use sqlx::{Pool, Sqlite, SqlitePool};
use tauri::{AppHandle, Emitter, LogicalSize, RunEvent, State, WebviewUrl, WebviewWindow};
use tauri::{Manager, WindowEvent};
use tauri::Listener;
use tauri::path::BaseDirectory; use tauri::path::BaseDirectory;
use tauri::Listener;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
use tauri::TitleBarStyle; use tauri::TitleBarStyle;
use tauri::{AppHandle, Emitter, LogicalSize, RunEvent, State, WebviewUrl, WebviewWindow};
use tauri::{Manager, WindowEvent};
use tauri_plugin_log::{fern, Target, TargetKind}; use tauri_plugin_log::{fern, Target, TargetKind};
use tauri_plugin_shell::ShellExt; use tauri_plugin_shell::ShellExt;
use tokio::sync::Mutex; use tokio::sync::Mutex;
use ::grpc::{Code, deserialize_message, serialize_message, ServiceDefinition};
use ::grpc::manager::{DynamicMessage, GrpcHandle}; use ::grpc::manager::{DynamicMessage, GrpcHandle};
use plugin_runtime::manager::PluginManager; use ::grpc::{deserialize_message, serialize_message, Code, ServiceDefinition};
use yaak_plugin_runtime::manager::PluginManager;
use crate::analytics::{AnalyticsAction, AnalyticsResource}; use crate::analytics::{AnalyticsAction, AnalyticsResource};
use crate::grpc::metadata_to_map; use crate::grpc::metadata_to_map;
use crate::http_request::send_http_request; use crate::http_request::send_http_request;
use crate::models::{ use crate::export_resources::{get_workspace_export_resources, ImportResult, WorkspaceExportResources};
cancel_pending_grpc_connections, cancel_pending_responses, CookieJar,
create_http_response, delete_all_grpc_connections, delete_all_http_responses, delete_cookie_jar,
delete_environment, delete_folder, delete_grpc_connection, delete_grpc_request,
delete_http_request, delete_http_response, delete_workspace, duplicate_grpc_request,
duplicate_http_request, Environment, EnvironmentVariable, Folder, generate_model_id,
get_cookie_jar, get_environment, get_folder, get_grpc_connection,
get_grpc_request, get_http_request, get_http_response, get_key_value_raw,
get_or_create_settings, get_workspace, get_workspace_export_resources, GrpcConnection, GrpcEvent,
GrpcEventType, GrpcRequest, HttpRequest, HttpResponse, KeyValue,
list_cookie_jars, list_environments, list_folders, list_grpc_connections, list_grpc_events,
list_grpc_requests, list_http_requests, list_responses, list_workspaces, ModelType,
set_key_value_raw, Settings, update_response_if_id, update_settings, upsert_cookie_jar, upsert_environment,
upsert_folder, upsert_grpc_connection, upsert_grpc_event, upsert_grpc_request, upsert_http_request, upsert_workspace, Workspace,
WorkspaceExportResources,
};
use crate::models::ImportResult;
use crate::notifications::YaakNotifier; use crate::notifications::YaakNotifier;
use crate::render::{render_request, variables_from_environment}; use crate::render::{render_request, variables_from_environment};
use crate::updates::{UpdateMode, YaakUpdater}; use crate::updates::{UpdateMode, YaakUpdater};
use crate::window_menu::app_menu; use crate::window_menu::app_menu;
use yaak_models::models::{
CookieJar, Environment, EnvironmentVariable, Folder, GrpcConnection, GrpcEvent, GrpcEventType,
GrpcRequest, HttpRequest, HttpResponse, KeyValue, ModelType, Settings, Workspace,
};
use yaak_models::queries::{
cancel_pending_grpc_connections, cancel_pending_responses, create_http_response,
delete_all_grpc_connections, delete_all_http_responses, delete_cookie_jar, delete_environment,
delete_folder, delete_grpc_connection, delete_grpc_request, delete_http_request,
delete_http_response, delete_workspace, duplicate_grpc_request, duplicate_http_request,
generate_model_id, get_cookie_jar, get_environment, get_folder, get_grpc_connection,
get_grpc_request, get_http_request, get_http_response, get_key_value_raw,
get_or_create_settings, get_workspace, list_cookie_jars, list_environments, list_folders,
list_grpc_connections, list_grpc_events, list_grpc_requests, list_http_requests,
list_responses, list_workspaces, set_key_value_raw, update_response_if_id, update_settings,
upsert_cookie_jar, upsert_environment, upsert_folder, upsert_grpc_connection,
upsert_grpc_event, upsert_grpc_request, upsert_http_request, upsert_workspace,
};
mod analytics; mod analytics;
mod grpc; mod grpc;
mod http_request; mod http_request;
mod models; mod export_resources;
mod notifications; mod notifications;
mod render; mod render;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
mod tauri_plugin_mac_window; mod tauri_plugin_mac_window;
mod template_fns;
mod updates; mod updates;
mod window_menu; mod window_menu;
mod template_fns;
const DEFAULT_WINDOW_WIDTH: f64 = 1100.0; const DEFAULT_WINDOW_WIDTH: f64 = 1100.0;
const DEFAULT_WINDOW_HEIGHT: f64 = 600.0; const DEFAULT_WINDOW_HEIGHT: f64 = 600.0;
async fn migrate_db(app_handle: &AppHandle, db: &Mutex<Pool<Sqlite>>) -> Result<(), String> { async fn migrate_db(app_handle: &AppHandle, pool: &Pool<Sqlite>) -> Result<(), String> {
let pool = &*db.lock().await;
let p = app_handle let p = app_handle
.path() .path()
.resolve("migrations", BaseDirectory::Resource) .resolve("migrations", BaseDirectory::Resource)
@@ -170,7 +169,7 @@ async fn cmd_grpc_go(
let vars = variables_from_environment(&workspace, environment.as_ref()); let vars = variables_from_environment(&workspace, environment.as_ref());
// Add rest of metadata // Add rest of metadata
for h in req.clone().metadata.0 { for h in req.clone().metadata {
if h.name.is_empty() && h.value.is_empty() { if h.name.is_empty() && h.value.is_empty() {
continue; continue;
} }
@@ -188,7 +187,7 @@ async fn cmd_grpc_go(
if let Some(b) = &req.authentication_type { if let Some(b) = &req.authentication_type {
let req = req.clone(); let req = req.clone();
let empty_value = &serde_json::to_value("").unwrap(); let empty_value = &serde_json::to_value("").unwrap();
let a = req.authentication.0; let a = req.authentication;
if b == "basic" { if b == "basic" {
let raw_username = a let raw_username = a
@@ -276,7 +275,7 @@ async fn cmd_grpc_go(
upsert_grpc_connection( upsert_grpc_connection(
&w, &w,
&GrpcConnection { &GrpcConnection {
elapsed: start.elapsed().as_millis() as i64, elapsed: start.elapsed().as_millis() as i32,
error: Some(err.clone()), error: Some(err.clone()),
..conn.clone() ..conn.clone()
}, },
@@ -392,7 +391,7 @@ async fn cmd_grpc_go(
&GrpcEvent { &GrpcEvent {
content: format!("Connecting to {}", req.url), content: format!("Connecting to {}", req.url),
event_type: GrpcEventType::ConnectionStart, event_type: GrpcEventType::ConnectionStart,
metadata: Json(metadata.clone()), metadata: metadata.clone(),
..base_event.clone() ..base_event.clone()
}, },
) )
@@ -452,7 +451,7 @@ async fn cmd_grpc_go(
upsert_grpc_event( upsert_grpc_event(
&w, &w,
&GrpcEvent { &GrpcEvent {
metadata: Json(metadata_to_map(msg.metadata().clone())), metadata: metadata_to_map(msg.metadata().clone()),
content: if msg.metadata().len() == 0 { content: if msg.metadata().len() == 0 {
"Received response" "Received response"
} else { } else {
@@ -480,7 +479,7 @@ async fn cmd_grpc_go(
&GrpcEvent { &GrpcEvent {
content: "Connection complete".to_string(), content: "Connection complete".to_string(),
event_type: GrpcEventType::ConnectionEnd, event_type: GrpcEventType::ConnectionEnd,
status: Some(Code::Ok as i64), status: Some(Code::Ok as i32),
..base_event.clone() ..base_event.clone()
}, },
) )
@@ -493,15 +492,15 @@ async fn cmd_grpc_go(
&(match e.status { &(match e.status {
Some(s) => GrpcEvent { Some(s) => GrpcEvent {
error: Some(s.message().to_string()), error: Some(s.message().to_string()),
status: Some(s.code() as i64), status: Some(s.code() as i32),
content: "Failed to connect".to_string(), content: "Failed to connect".to_string(),
metadata: Json(metadata_to_map(s.metadata().clone())), metadata: metadata_to_map(s.metadata().clone()),
event_type: GrpcEventType::ConnectionEnd, event_type: GrpcEventType::ConnectionEnd,
..base_event.clone() ..base_event.clone()
}, },
None => GrpcEvent { None => GrpcEvent {
error: Some(e.message), error: Some(e.message),
status: Some(Code::Unknown as i64), status: Some(Code::Unknown as i32),
content: "Failed to connect".to_string(), content: "Failed to connect".to_string(),
event_type: GrpcEventType::ConnectionEnd, event_type: GrpcEventType::ConnectionEnd,
..base_event.clone() ..base_event.clone()
@@ -521,7 +520,7 @@ async fn cmd_grpc_go(
upsert_grpc_event( upsert_grpc_event(
&w, &w,
&GrpcEvent { &GrpcEvent {
metadata: Json(metadata_to_map(stream.metadata().clone())), metadata: metadata_to_map(stream.metadata().clone()),
content: if stream.metadata().len() == 0 { content: if stream.metadata().len() == 0 {
"Received response" "Received response"
} else { } else {
@@ -542,15 +541,15 @@ async fn cmd_grpc_go(
&(match e.status { &(match e.status {
Some(s) => GrpcEvent { Some(s) => GrpcEvent {
error: Some(s.message().to_string()), error: Some(s.message().to_string()),
status: Some(s.code() as i64), status: Some(s.code() as i32),
content: "Failed to connect".to_string(), content: "Failed to connect".to_string(),
metadata: Json(metadata_to_map(s.metadata().clone())), metadata: metadata_to_map(s.metadata().clone()),
event_type: GrpcEventType::ConnectionEnd, event_type: GrpcEventType::ConnectionEnd,
..base_event.clone() ..base_event.clone()
}, },
None => GrpcEvent { None => GrpcEvent {
error: Some(e.message), error: Some(e.message),
status: Some(Code::Unknown as i64), status: Some(Code::Unknown as i32),
content: "Failed to connect".to_string(), content: "Failed to connect".to_string(),
event_type: GrpcEventType::ConnectionEnd, event_type: GrpcEventType::ConnectionEnd,
..base_event.clone() ..base_event.clone()
@@ -589,8 +588,8 @@ async fn cmd_grpc_go(
&w, &w,
&GrpcEvent { &GrpcEvent {
content: "Connection complete".to_string(), content: "Connection complete".to_string(),
status: Some(Code::Unavailable as i64), status: Some(Code::Unavailable as i32),
metadata: Json(metadata_to_map(trailers)), metadata: metadata_to_map(trailers),
event_type: GrpcEventType::ConnectionEnd, event_type: GrpcEventType::ConnectionEnd,
..base_event.clone() ..base_event.clone()
}, },
@@ -604,8 +603,8 @@ async fn cmd_grpc_go(
&w, &w,
&GrpcEvent { &GrpcEvent {
content: status.to_string(), content: status.to_string(),
status: Some(status.code() as i64), status: Some(status.code() as i32),
metadata: Json(metadata_to_map(status.metadata().clone())), metadata: metadata_to_map(status.metadata().clone()),
event_type: GrpcEventType::ConnectionEnd, event_type: GrpcEventType::ConnectionEnd,
..base_event.clone() ..base_event.clone()
}, },
@@ -630,11 +629,11 @@ async fn cmd_grpc_go(
let closed_event = events let closed_event = events
.iter() .iter()
.find(|e| GrpcEventType::ConnectionEnd == e.event_type); .find(|e| GrpcEventType::ConnectionEnd == e.event_type);
let closed_status = closed_event.and_then(|e| e.status).unwrap_or(Code::Unavailable as i64); let closed_status = closed_event.and_then(|e| e.status).unwrap_or(Code::Unavailable as i32);
upsert_grpc_connection( upsert_grpc_connection(
&w, &w,
&GrpcConnection{ &GrpcConnection{
elapsed: start.elapsed().as_millis() as i64, elapsed: start.elapsed().as_millis() as i32,
status: closed_status, status: closed_status,
..get_grpc_connection(&w, &conn_id).await.unwrap().clone() ..get_grpc_connection(&w, &conn_id).await.unwrap().clone()
}, },
@@ -646,15 +645,15 @@ async fn cmd_grpc_go(
&GrpcEvent { &GrpcEvent {
content: "Cancelled".to_string(), content: "Cancelled".to_string(),
event_type: GrpcEventType::ConnectionEnd, event_type: GrpcEventType::ConnectionEnd,
status: Some(Code::Cancelled as i64), status: Some(Code::Cancelled as i32),
..base_msg.clone() ..base_msg.clone()
}, },
).await.unwrap(); ).await.unwrap();
upsert_grpc_connection( upsert_grpc_connection(
&w, &w,
&GrpcConnection { &GrpcConnection {
elapsed: start.elapsed().as_millis() as i64, elapsed: start.elapsed().as_millis() as i32,
status: Code::Cancelled as i64, status: Code::Cancelled as i32,
..get_grpc_connection(&w, &conn_id).await.unwrap().clone() ..get_grpc_connection(&w, &conn_id).await.unwrap().clone()
}, },
) )
@@ -1182,7 +1181,7 @@ async fn cmd_create_environment(
Environment { Environment {
workspace_id: workspace_id.to_string(), workspace_id: workspace_id.to_string(),
name: name.to_string(), name: name.to_string(),
variables: Json(variables), variables,
..Default::default() ..Default::default()
}, },
) )
@@ -1194,7 +1193,7 @@ async fn cmd_create_environment(
async fn cmd_create_grpc_request( async fn cmd_create_grpc_request(
workspace_id: &str, workspace_id: &str,
name: &str, name: &str,
sort_priority: f64, sort_priority: f32,
folder_id: Option<&str>, folder_id: Option<&str>,
w: WebviewWindow, w: WebviewWindow,
) -> Result<GrpcRequest, String> { ) -> Result<GrpcRequest, String> {
@@ -1304,7 +1303,7 @@ async fn cmd_list_folders(workspace_id: &str, w: WebviewWindow) -> Result<Vec<Fo
async fn cmd_create_folder( async fn cmd_create_folder(
workspace_id: &str, workspace_id: &str,
name: &str, name: &str,
sort_priority: f64, sort_priority: f32,
folder_id: Option<&str>, folder_id: Option<&str>,
w: WebviewWindow, w: WebviewWindow,
) -> Result<Folder, String> { ) -> Result<Folder, String> {
@@ -1612,11 +1611,12 @@ pub fn run() {
.plugin(tauri_plugin_clipboard_manager::init()) .plugin(tauri_plugin_clipboard_manager::init())
.plugin(tauri_plugin_window_state::Builder::default().build()) .plugin(tauri_plugin_window_state::Builder::default().build())
.plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_updater::Builder::new().build()) .plugin(tauri_plugin_updater::Builder::default().build())
.plugin(tauri_plugin_dialog::init()) .plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_os::init())
.plugin(plugin_runtime::init()) .plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_fs::init()); .plugin(yaak_models::Builder::default().build())
.plugin(yaak_plugin_runtime::init());
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {
@@ -1671,11 +1671,9 @@ pub fn run() {
let pool = SqlitePool::connect_with(opts) let pool = SqlitePool::connect_with(opts)
.await .await
.expect("Failed to connect to database"); .expect("Failed to connect to database");
let m = Mutex::new(pool.clone()); migrate_db(app.handle(), &pool)
migrate_db(app.handle(), &m)
.await .await
.expect("Failed to migrate database"); .expect("Failed to migrate database");
app.manage(m);
let h = app.handle(); let h = app.handle();
let _ = cancel_pending_responses(h).await; let _ = cancel_pending_responses(h).await;
let _ = cancel_pending_grpc_connections(h).await; let _ = cancel_pending_grpc_connections(h).await;

File diff suppressed because it is too large Load Diff

View File

@@ -5,9 +5,8 @@ use log::debug;
use reqwest::Method; use reqwest::Method;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tauri::{AppHandle, Emitter}; use tauri::{AppHandle, Emitter};
use yaak_models::queries::{get_key_value_raw, set_key_value_raw};
use crate::analytics::get_num_launches; use crate::analytics::get_num_launches;
use crate::models::{get_key_value_raw, set_key_value_raw};
// Check for updates every hour // Check for updates every hour
const MAX_UPDATE_CHECK_SECONDS: u64 = 60 * 60; const MAX_UPDATE_CHECK_SECONDS: u64 = 60 * 60;

View File

@@ -1,13 +1,12 @@
use std::collections::HashMap; use std::collections::HashMap;
use sqlx::types::{Json, JsonValue}; use sqlx::types::JsonValue;
use crate::template_fns::timestamp;
use templates::parse_and_render; use templates::parse_and_render;
use yaak_models::models::{
use crate::models::{
Environment, EnvironmentVariable, HttpRequest, HttpRequestHeader, HttpUrlParameter, Workspace, Environment, EnvironmentVariable, HttpRequest, HttpRequestHeader, HttpUrlParameter, Workspace,
}; };
use crate::template_fns::timestamp;
pub fn render_request(r: &HttpRequest, w: &Workspace, e: Option<&Environment>) -> HttpRequest { pub fn render_request(r: &HttpRequest, w: &Workspace, e: Option<&Environment>) -> HttpRequest {
let r = r.clone(); let r = r.clone();
@@ -15,56 +14,48 @@ pub fn render_request(r: &HttpRequest, w: &Workspace, e: Option<&Environment>) -
HttpRequest { HttpRequest {
url: render(r.url.as_str(), vars), url: render(r.url.as_str(), vars),
url_parameters: Json( url_parameters: r
r.url_parameters .url_parameters
.0 .iter()
.iter() .map(|p| HttpUrlParameter {
.map(|p| HttpUrlParameter { enabled: p.enabled,
enabled: p.enabled, name: render(p.name.as_str(), vars),
name: render(p.name.as_str(), vars), value: render(p.value.as_str(), vars),
value: render(p.value.as_str(), vars), })
}) .collect::<Vec<HttpUrlParameter>>(),
.collect::<Vec<HttpUrlParameter>>(), headers: r
), .headers
headers: Json( .iter()
r.headers .map(|p| HttpRequestHeader {
.0 enabled: p.enabled,
.iter() name: render(p.name.as_str(), vars),
.map(|p| HttpRequestHeader { value: render(p.value.as_str(), vars),
enabled: p.enabled, })
name: render(p.name.as_str(), vars), .collect::<Vec<HttpRequestHeader>>(),
value: render(p.value.as_str(), vars), body: r
}) .body
.collect::<Vec<HttpRequestHeader>>(), .iter()
), .map(|(k, v)| {
body: Json( let v = if v.is_string() {
r.body render(v.as_str().unwrap(), vars)
.0 } else {
.iter() v.to_string()
.map(|(k, v)| { };
let v = if v.is_string() { (render(k, vars), JsonValue::from(v))
render(v.as_str().unwrap(), vars) })
} else { .collect::<HashMap<String, JsonValue>>(),
v.to_string() authentication: r
}; .authentication
(render(k, vars), JsonValue::from(v)) .iter()
}) .map(|(k, v)| {
.collect::<HashMap<String, JsonValue>>(), let v = if v.is_string() {
), render(v.as_str().unwrap(), vars)
authentication: Json( } else {
r.authentication v.to_string()
.0 };
.iter() (render(k, vars), JsonValue::from(v))
.map(|(k, v)| { })
let v = if v.is_string() { .collect::<HashMap<String, JsonValue>>(),
render(v.as_str().unwrap(), vars)
} else {
v.to_string()
};
(render(k, vars), JsonValue::from(v))
})
.collect::<HashMap<String, JsonValue>>(),
),
..r ..r
} }
} }
@@ -95,10 +86,10 @@ pub fn variables_from_environment(
environment: Option<&Environment>, environment: Option<&Environment>,
) -> HashMap<String, String> { ) -> HashMap<String, String> {
let mut variables = HashMap::new(); let mut variables = HashMap::new();
variables = add_variable_to_map(variables, &workspace.variables.0); variables = add_variable_to_map(variables, &workspace.variables);
if let Some(e) = environment { if let Some(e) = environment {
variables = add_variable_to_map(variables, &e.variables.0); variables = add_variable_to_map(variables, &e.variables);
} }
recursively_render_variables(&variables, 0) recursively_render_variables(&variables, 0)

View File

@@ -12,7 +12,10 @@ pub fn timestamp(args: HashMap<String, String>) -> Result<String, String> {
} }
_ => { _ => {
let json_from = serde_json::to_string(from).unwrap_or_default(); let json_from = serde_json::to_string(from).unwrap_or_default();
let now: DateTime<Utc> = serde_json::from_str(json_from.as_str()).unwrap(); let now: DateTime<Utc> = match serde_json::from_str(json_from.as_str()) {
Ok(r) => r,
Err(e) => return Err(e.to_string()),
};
now now
} }
}; };
@@ -43,7 +46,10 @@ mod tests {
fn timestamp_from() { fn timestamp_from() {
let mut args = HashMap::new(); let mut args = HashMap::new();
args.insert("from".to_string(), "2024-07-31T14:16:41.983Z".to_string()); args.insert("from".to_string(), "2024-07-31T14:16:41.983Z".to_string());
assert_eq!(timestamp(args), Ok("2024-07-31T14:16:41.983+00:00".to_string())); assert_eq!(
timestamp(args),
Ok("2024-07-31T14:16:41.983+00:00".to_string())
);
} }
#[test] #[test]

View File

@@ -0,0 +1,19 @@
[package]
name = "yaak_models"
version = "0.1.0"
edition = "2021"
[dependencies]
chrono = { version = "0.4.38", features = ["serde"] }
rusqlite = { version = "0.31.0", features = ["bundled", "chrono"] }
sea-query = { version = "0.31.0", features = ["with-chrono", "attr"] }
sea-query-rusqlite = { version = "0.6.0", features = ["with-chrono"] }
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.122"
thiserror = "1.0.63"
ts-rs = { version = "9.0.1", features = ["chrono-impl", "serde-json-impl"] }
tauri = { workspace = true }
log = "0.4.22"
rand = "0.8.5"
r2d2 = "0.8.10"
r2d2_sqlite = { version = "0.24.0" }

View File

@@ -0,0 +1,57 @@
use std::env::current_dir;
use std::fs::create_dir_all;
use r2d2;
use r2d2_sqlite;
use log::info;
use r2d2::Pool;
use r2d2_sqlite::SqliteConnectionManager;
use serde::Deserialize;
use tauri::async_runtime::Mutex;
use tauri::plugin::TauriPlugin;
use tauri::{is_dev, plugin, Manager, Runtime};
pub mod models;
pub mod queries;
pub struct SqliteConnection(Mutex<Pool<SqliteConnectionManager>>);
#[derive(Default, Deserialize)]
pub struct PluginConfig {
// Nothing yet (will be configurable in tauri.conf.json
}
/// Tauri SQL plugin builder.
#[derive(Default)]
pub struct Builder {
// Nothing Yet
}
impl Builder {
pub fn new() -> Self {
Self::default()
}
pub fn build<R: Runtime>(&self) -> TauriPlugin<R, Option<PluginConfig>> {
plugin::Builder::<R, Option<PluginConfig>>::new("yaak_models")
.setup(|app, _api| {
let app_path = match is_dev() {
true => current_dir().unwrap(),
false => app.path().app_data_dir().unwrap(),
};
create_dir_all(app_path.clone()).expect("Problem creating App directory!");
let db_file_path = app_path.join("db.sqlite");
info!("Opening SQLite DB at {db_file_path:?}");
let manager = SqliteConnectionManager::file(db_file_path);
let pool = Pool::new(manager).unwrap();
app.manage(SqliteConnection(Mutex::new(pool)));
Ok(())
})
.build()
}
}

View File

@@ -0,0 +1,796 @@
use chrono::NaiveDateTime;
use rusqlite::Row;
use sea_query::Iden;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use serde_json::Value;
use ts_rs::TS;
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../src-web/lib/gen/")]
pub struct Settings {
pub id: String,
#[ts(type = "\"settings\"")]
pub model: String,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub theme: String,
pub appearance: String,
pub theme_dark: String,
pub theme_light: String,
pub update_channel: String,
pub interface_font_size: i32,
pub interface_scale: i32,
pub editor_font_size: i32,
pub editor_soft_wrap: bool,
pub open_workspace_new_window: Option<bool>,
}
#[derive(Iden)]
pub enum SettingsIden {
#[iden = "settings"]
Table,
Id,
Model,
CreatedAt,
UpdatedAt,
Theme,
Appearance,
UpdateChannel,
ThemeDark,
ThemeLight,
InterfaceFontSize,
InterfaceScale,
EditorFontSize,
EditorSoftWrap,
OpenWorkspaceNewWindow,
}
impl<'s> TryFrom<&Row<'s>> for Settings {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
Ok(Settings {
id: r.get("id")?,
model: r.get("model")?,
created_at: r.get("created_at")?,
updated_at: r.get("updated_at")?,
theme: r.get("theme")?,
appearance: r.get("appearance")?,
theme_dark: r.get("theme_dark")?,
theme_light: r.get("theme_light")?,
update_channel: r.get("update_channel")?,
interface_font_size: r.get("interface_font_size")?,
interface_scale: r.get("interface_scale")?,
editor_font_size: r.get("editor_font_size")?,
editor_soft_wrap: r.get("editor_soft_wrap")?,
open_workspace_new_window: r.get("open_workspace_new_window")?,
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct Workspace {
pub id: String,
#[ts(type = "\"workspace\"")]
pub model: String,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub name: String,
pub description: String,
pub variables: Vec<EnvironmentVariable>,
// Settings
#[serde(default = "default_true")]
pub setting_validate_certificates: bool,
#[serde(default = "default_true")]
pub setting_follow_redirects: bool,
pub setting_request_timeout: i32,
}
#[derive(Iden)]
pub enum WorkspaceIden {
#[iden = "workspaces"]
Table,
Id,
Model,
CreatedAt,
UpdatedAt,
Name,
Description,
Variables,
SettingValidateCertificates,
SettingFollowRedirects,
SettingRequestTimeout,
}
impl<'s> TryFrom<&Row<'s>> for Workspace {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
let variables: String = r.get("variables")?;
Ok(Workspace {
id: r.get("id")?,
model: r.get("model")?,
created_at: r.get("created_at")?,
updated_at: r.get("updated_at")?,
name: r.get("name")?,
description: r.get("description")?,
variables: serde_json::from_str(variables.as_str()).unwrap_or_default(),
setting_validate_certificates: r.get("setting_validate_certificates")?,
setting_follow_redirects: r.get("setting_follow_redirects")?,
setting_request_timeout: r.get("setting_request_timeout")?,
})
}
}
impl Workspace {
pub fn new(name: String) -> Self {
Self {
name,
model: "workspace".to_string(),
setting_validate_certificates: true,
setting_follow_redirects: true,
..Default::default()
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[ts(export, export_to = "../../../src-web/lib/gen/")]
enum CookieDomain {
HostOnly(String),
Suffix(String),
NotPresent,
Empty,
}
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[ts(export, export_to = "../../../src-web/lib/gen/")]
enum CookieExpires {
AtUtc(String),
SessionEnd,
}
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[ts(export, export_to = "../../../src-web/lib/gen/")]
pub struct Cookie {
raw_cookie: String,
domain: CookieDomain,
expires: CookieExpires,
path: (String, bool),
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../src-web/lib/gen/")]
pub struct CookieJar {
pub id: String,
#[ts(type = "\"cookie_jar\"")]
pub model: String,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub workspace_id: String,
pub name: String,
pub cookies: Vec<Cookie>,
}
#[derive(Iden)]
pub enum CookieJarIden {
#[iden = "cookie_jars"]
Table,
Id,
Model,
WorkspaceId,
CreatedAt,
UpdatedAt,
Name,
Cookies,
}
impl<'s> TryFrom<&Row<'s>> for CookieJar {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
let cookies: String = r.get("cookies")?;
Ok(CookieJar {
id: r.get("id")?,
model: r.get("model")?,
workspace_id: r.get("workspace_id")?,
created_at: r.get("created_at")?,
updated_at: r.get("updated_at")?,
name: r.get("name")?,
cookies: serde_json::from_str(cookies.as_str()).unwrap_or_default(),
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct Environment {
pub id: String,
pub workspace_id: String,
#[ts(type = "\"environment\"")]
pub model: String,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub name: String,
pub variables: Vec<EnvironmentVariable>,
}
#[derive(Iden)]
pub enum EnvironmentIden {
#[iden = "environments"]
Table,
Id,
Model,
WorkspaceId,
CreatedAt,
UpdatedAt,
Name,
Variables,
}
impl<'s> TryFrom<&Row<'s>> for Environment {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
let variables: String = r.get("variables")?;
Ok(Environment {
id: r.get("id")?,
model: r.get("model")?,
workspace_id: r.get("workspace_id")?,
created_at: r.get("created_at")?,
updated_at: r.get("updated_at")?,
name: r.get("name")?,
variables: serde_json::from_str(variables.as_str()).unwrap_or_default(),
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct EnvironmentVariable {
#[serde(default = "default_true")]
#[ts(optional, as = "Option<bool>")]
pub enabled: bool,
pub name: String,
pub value: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct Folder {
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub id: String,
pub workspace_id: String,
pub folder_id: Option<String>,
#[ts(type = "\"folder\"")]
pub model: String,
pub name: String,
pub sort_priority: f32,
}
#[derive(Iden)]
pub enum FolderIden {
#[iden = "folders"]
Table,
Id,
Model,
WorkspaceId,
FolderId,
CreatedAt,
UpdatedAt,
Name,
SortPriority,
}
impl<'s> TryFrom<&Row<'s>> for Folder {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
Ok(Folder {
id: r.get("id")?,
model: r.get("model")?,
sort_priority: r.get("sort_priority")?,
workspace_id: r.get("workspace_id")?,
created_at: r.get("created_at")?,
updated_at: r.get("updated_at")?,
folder_id: r.get("folder_id")?,
name: r.get("name")?,
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct HttpRequestHeader {
#[serde(default = "default_true")]
#[ts(optional, as = "Option<bool>")]
pub enabled: bool,
pub name: String,
pub value: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct HttpUrlParameter {
#[serde(default = "default_true")]
#[ts(optional, as = "Option<bool>")]
pub enabled: bool,
pub name: String,
pub value: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct HttpRequest {
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub id: String,
pub workspace_id: String,
pub folder_id: Option<String>,
#[ts(type = "\"http_request\"")]
pub model: String,
pub sort_priority: f32,
pub name: String,
pub url: String,
pub url_parameters: Vec<HttpUrlParameter>,
#[serde(default = "default_http_request_method")]
pub method: String,
#[ts(type = "Record<string, any>")]
pub body: HashMap<String, Value>,
pub body_type: Option<String>,
#[ts(type = "Record<string, any>")]
pub authentication: HashMap<String, Value>,
pub authentication_type: Option<String>,
pub headers: Vec<HttpRequestHeader>,
}
#[derive(Iden)]
pub enum HttpRequestIden {
#[iden = "http_requests"]
Table,
Id,
Model,
WorkspaceId,
FolderId,
CreatedAt,
UpdatedAt,
Name,
SortPriority,
Url,
UrlParameters,
Method,
Body,
BodyType,
Authentication,
AuthenticationType,
Headers,
}
impl<'s> TryFrom<&Row<'s>> for HttpRequest {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
let url_parameters: String = r.get("url_parameters")?;
let body: String = r.get("body")?;
let authentication: String = r.get("authentication")?;
let headers: String = r.get("headers")?;
Ok(HttpRequest {
id: r.get("id")?,
model: r.get("model")?,
sort_priority: r.get("sort_priority")?,
workspace_id: r.get("workspace_id")?,
created_at: r.get("created_at")?,
updated_at: r.get("updated_at")?,
url: r.get("url")?,
url_parameters: serde_json::from_str(url_parameters.as_str()).unwrap_or_default(),
method: r.get("method")?,
body: serde_json::from_str(body.as_str()).unwrap_or_default(),
body_type: r.get("body_type")?,
authentication: serde_json::from_str(authentication.as_str()).unwrap_or_default(),
authentication_type: r.get("authentication_type")?,
headers: serde_json::from_str(headers.as_str()).unwrap_or_default(),
folder_id: r.get("folder_id")?,
name: r.get("name")?,
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct HttpResponseHeader {
pub name: String,
pub value: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct HttpResponse {
pub id: String,
#[ts(type = "\"http_response\"")]
pub model: String,
pub workspace_id: String,
pub request_id: String,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub error: Option<String>,
pub url: String,
pub content_length: Option<i32>,
pub version: Option<String>,
pub elapsed: i32,
pub elapsed_headers: i32,
pub remote_addr: Option<String>,
pub status: i32,
pub status_reason: Option<String>,
pub body_path: Option<String>,
pub headers: Vec<HttpResponseHeader>,
}
#[derive(Iden)]
pub enum HttpResponseIden {
#[iden = "http_responses"]
Table,
Id,
Model,
WorkspaceId,
RequestId,
CreatedAt,
UpdatedAt,
Error,
Url,
ContentLength,
Version,
Elapsed,
ElapsedHeaders,
RemoteAddr,
Status,
StatusReason,
BodyPath,
Headers,
}
impl<'s> TryFrom<&Row<'s>> for HttpResponse {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
let headers: String = r.get("headers")?;
Ok(HttpResponse {
id: r.get("id")?,
model: r.get("model")?,
workspace_id: r.get("workspace_id")?,
request_id: r.get("request_id")?,
created_at: r.get("created_at")?,
updated_at: r.get("updated_at")?,
error: r.get("error")?,
url: r.get("url")?,
content_length: r.get("content_length")?,
version: r.get("version")?,
elapsed: r.get("elapsed")?,
elapsed_headers: r.get("elapsed_headers")?,
remote_addr: r.get("remote_addr")?,
status: r.get("status")?,
status_reason: r.get("status_reason")?,
body_path: r.get("body_path")?,
headers: serde_json::from_str(headers.as_str()).unwrap_or_default(),
})
}
}
impl HttpResponse {
pub fn new() -> Self {
Self {
model: "http_response".to_string(),
..Default::default()
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct GrpcMetadataEntry {
#[serde(default = "default_true")]
#[ts(optional, as = "Option<bool>")]
pub enabled: bool,
pub name: String,
pub value: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct GrpcRequest {
pub id: String,
#[ts(type = "\"grpc_request\"")]
pub model: String,
pub workspace_id: String,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub folder_id: Option<String>,
pub name: String,
pub sort_priority: f32,
pub url: String,
pub service: Option<String>,
pub method: Option<String>,
pub message: String,
pub authentication_type: Option<String>,
#[ts(type = "Record<string, any>")]
pub authentication: HashMap<String, Value>,
pub metadata: Vec<GrpcMetadataEntry>,
}
#[derive(Iden)]
pub enum GrpcRequestIden {
#[iden = "grpc_requests"]
Table,
Id,
Model,
WorkspaceId,
CreatedAt,
UpdatedAt,
FolderId,
Name,
SortPriority,
Url,
Service,
Method,
Message,
AuthenticationType,
Authentication,
Metadata,
}
impl<'s> TryFrom<&Row<'s>> for GrpcRequest {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
let authentication: String = r.get("authentication")?;
let metadata: String = r.get("metadata")?;
Ok(GrpcRequest {
id: r.get("id")?,
model: r.get("model")?,
workspace_id: r.get("workspace_id")?,
created_at: r.get("created_at")?,
updated_at: r.get("updated_at")?,
folder_id: r.get("folder_id")?,
name: r.get("name")?,
service: r.get("service")?,
method: r.get("method")?,
message: r.get("message")?,
authentication_type: r.get("authentication_type")?,
authentication: serde_json::from_str(authentication.as_str()).unwrap_or_default(),
url: r.get("url")?,
sort_priority: r.get("sort_priority")?,
metadata: serde_json::from_str(metadata.as_str()).unwrap_or_default(),
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct GrpcConnection {
pub id: String,
#[ts(type = "\"grpc_connection\"")]
pub model: String,
pub workspace_id: String,
pub request_id: String,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub service: String,
pub method: String,
pub elapsed: i32,
pub status: i32,
pub url: String,
pub error: Option<String>,
pub trailers: HashMap<String, String>,
}
#[derive(Iden)]
pub enum GrpcConnectionIden {
#[iden = "grpc_connections"]
Table,
Id,
Model,
WorkspaceId,
CreatedAt,
UpdatedAt,
RequestId,
Service,
Method,
Elapsed,
Status,
Url,
Error,
Trailers,
}
impl<'s> TryFrom<&Row<'s>> for GrpcConnection {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
let trailers: String = r.get("trailers")?;
Ok(GrpcConnection {
id: r.get("id")?,
model: r.get("model")?,
workspace_id: r.get("workspace_id")?,
request_id: r.get("request_id")?,
created_at: r.get("created_at")?,
updated_at: r.get("updated_at")?,
service: r.get("service")?,
method: r.get("method")?,
elapsed: r.get("elapsed")?,
status: r.get("status")?,
url: r.get("url")?,
error: r.get("error")?,
trailers: serde_json::from_str(trailers.as_str()).unwrap_or_default(),
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, TS)]
#[serde(rename_all = "snake_case")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub enum GrpcEventType {
Info,
Error,
ClientMessage,
ServerMessage,
ConnectionStart,
ConnectionEnd,
}
impl Default for GrpcEventType {
fn default() -> Self {
GrpcEventType::Info
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct GrpcEvent {
pub id: String,
#[ts(type = "\"grpc_event\"")]
pub model: String,
pub workspace_id: String,
pub request_id: String,
pub connection_id: String,
pub created_at: NaiveDateTime,
pub content: String,
pub event_type: GrpcEventType,
pub metadata: HashMap<String, String>,
pub status: Option<i32>,
pub error: Option<String>,
}
#[derive(Iden)]
pub enum GrpcEventIden {
#[iden = "grpc_events"]
Table,
Id,
Model,
WorkspaceId,
RequestId,
ConnectionId,
CreatedAt,
UpdatedAt,
Content,
EventType,
Metadata,
Status,
Error,
}
impl<'s> TryFrom<&Row<'s>> for GrpcEvent {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
let event_type: String = r.get("event_type")?;
let metadata: String = r.get("metadata")?;
Ok(GrpcEvent {
id: r.get("id")?,
model: r.get("model")?,
workspace_id: r.get("workspace_id")?,
request_id: r.get("request_id")?,
connection_id: r.get("connection_id")?,
created_at: r.get("created_at")?,
content: r.get("content")?,
event_type: serde_json::from_str(event_type.as_str()).unwrap_or_default(),
metadata: serde_json::from_str(metadata.as_str()).unwrap_or_default(),
status: r.get("status")?,
error: r.get("error")?,
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
#[serde(default, rename_all = "camelCase")]
#[ts(export, export_to = "../../../plugin-runtime-types/src/gen/")]
pub struct KeyValue {
#[ts(type = "\"key_value\"")]
pub model: String,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub namespace: String,
pub key: String,
pub value: String,
}
#[derive(Iden)]
pub enum KeyValueIden {
#[iden = "key_values"]
Table,
Model,
CreatedAt,
UpdatedAt,
Namespace,
Key,
Value,
}
impl<'s> TryFrom<&Row<'s>> for KeyValue {
type Error = rusqlite::Error;
fn try_from(r: &Row<'s>) -> Result<Self, Self::Error> {
Ok(KeyValue {
model: r.get("model")?,
created_at: r.get("created_at")?,
updated_at: r.get("updated_at")?,
namespace: r.get("namespace")?,
key: r.get("key")?,
value: r.get("value")?,
})
}
}
fn default_true() -> bool {
true
}
fn default_http_request_method() -> String {
"GET".to_string()
}
pub enum ModelType {
TypeCookieJar,
TypeEnvironment,
TypeFolder,
TypeGrpcConnection,
TypeGrpcEvent,
TypeGrpcRequest,
TypeHttpRequest,
TypeHttpResponse,
TypeWorkspace,
}
impl ModelType {
pub fn id_prefix(&self) -> String {
match self {
ModelType::TypeCookieJar => "cj",
ModelType::TypeEnvironment => "ev",
ModelType::TypeFolder => "fl",
ModelType::TypeGrpcConnection => "gc",
ModelType::TypeGrpcEvent => "ge",
ModelType::TypeGrpcRequest => "gr",
ModelType::TypeHttpRequest => "rq",
ModelType::TypeHttpResponse => "rs",
ModelType::TypeWorkspace => "wk",
}
.to_string()
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "plugin_runtime" name = "yaak_plugin_runtime"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
@@ -13,8 +13,8 @@ rand = "0.8.5"
reqwest = { version = "0.12.5", features = ["stream"] } reqwest = { version = "0.12.5", features = ["stream"] }
serde = { version = "1.0.198", features = ["derive"] } serde = { version = "1.0.198", features = ["derive"] }
serde_json = "1.0.113" serde_json = "1.0.113"
tauri = { version = "2.0.0-beta" } tauri = { workspace = true }
tauri-plugin-shell = "2.0.0-beta" tauri-plugin-shell = { workspace = true }
tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "process"] } tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "process"] }
tonic = "0.12.1" tonic = "0.12.1"

View File

@@ -15,7 +15,7 @@ pub mod plugin_runtime {
} }
pub fn init<R: Runtime>() -> TauriPlugin<R> { pub fn init<R: Runtime>() -> TauriPlugin<R> {
Builder::new("plugin_runtime") Builder::new("yaak_plugin_runtime")
.setup(|app, _| { .setup(|app, _| {
tauri::async_runtime::block_on(async move { tauri::async_runtime::block_on(async move {
let manager = PluginManager::new(&app).await; let manager = PluginManager::new(&app).await;

View File

@@ -1,7 +1,7 @@
use std::path::PathBuf; use std::path::PathBuf;
use std::time::Duration; use std::time::Duration;
use log::{debug, info}; use log::info;
use rand::distributions::{Alphanumeric, DistString}; use rand::distributions::{Alphanumeric, DistString};
use serde; use serde;
use serde::Deserialize; use serde::Deserialize;
@@ -88,8 +88,7 @@ pub async fn node_start<R: Runtime>(
match fs::read_to_string(port_file_path.clone()).await { match fs::read_to_string(port_file_path.clone()).await {
Ok(s) => break s, Ok(s) => break s,
Err(err) => { Err(_) => {
debug!("Failed to read port file {}", err.to_string());
tokio::time::sleep(Duration::from_millis(500)).await; tokio::time::sleep(Duration::from_millis(500)).await;
} }
} }

View File

@@ -1,6 +1,6 @@
import { useUpdateAnyGrpcRequest } from '../hooks/useUpdateAnyGrpcRequest'; import { useUpdateAnyGrpcRequest } from '../hooks/useUpdateAnyGrpcRequest';
import { useUpdateAnyHttpRequest } from '../hooks/useUpdateAnyHttpRequest'; import { useUpdateAnyHttpRequest } from '../hooks/useUpdateAnyHttpRequest';
import type { GrpcRequest, HttpRequest } from '../lib/models'; import type { GrpcRequest, HttpRequest } from '@yaakapp/api';
import { Input } from './core/Input'; import { Input } from './core/Input';
import { VStack } from './core/Stacks'; import { VStack } from './core/Stacks';
@@ -27,7 +27,7 @@ export function BasicAuth<T extends HttpRequest | GrpcRequest>({ request }: Prop
if (request.model === 'http_request') { if (request.model === 'http_request') {
updateHttpRequest.mutate({ updateHttpRequest.mutate({
id: request.id, id: request.id,
update: (r) => ({ update: (r: HttpRequest) => ({
...r, ...r,
authentication: { password: r.authentication.password, username }, authentication: { password: r.authentication.password, username },
}), }),
@@ -35,7 +35,7 @@ export function BasicAuth<T extends HttpRequest | GrpcRequest>({ request }: Prop
} else { } else {
updateGrpcRequest.mutate({ updateGrpcRequest.mutate({
id: request.id, id: request.id,
update: (r) => ({ update: (r: GrpcRequest) => ({
...r, ...r,
authentication: { password: r.authentication.password, username }, authentication: { password: r.authentication.password, username },
}), }),
@@ -57,7 +57,7 @@ export function BasicAuth<T extends HttpRequest | GrpcRequest>({ request }: Prop
if (request.model === 'http_request') { if (request.model === 'http_request') {
updateHttpRequest.mutate({ updateHttpRequest.mutate({
id: request.id, id: request.id,
update: (r) => ({ update: (r: HttpRequest) => ({
...r, ...r,
authentication: { username: r.authentication.username, password }, authentication: { username: r.authentication.username, password },
}), }),
@@ -65,7 +65,7 @@ export function BasicAuth<T extends HttpRequest | GrpcRequest>({ request }: Prop
} else { } else {
updateGrpcRequest.mutate({ updateGrpcRequest.mutate({
id: request.id, id: request.id,
update: (r) => ({ update: (r: GrpcRequest) => ({
...r, ...r,
authentication: { username: r.authentication.username, password }, authentication: { username: r.authentication.username, password },
}), }),

View File

@@ -1,6 +1,6 @@
import { useUpdateAnyGrpcRequest } from '../hooks/useUpdateAnyGrpcRequest'; import { useUpdateAnyGrpcRequest } from '../hooks/useUpdateAnyGrpcRequest';
import { useUpdateAnyHttpRequest } from '../hooks/useUpdateAnyHttpRequest'; import { useUpdateAnyHttpRequest } from '../hooks/useUpdateAnyHttpRequest';
import type { GrpcRequest, HttpRequest } from '../lib/models'; import type { GrpcRequest, HttpRequest } from '@yaakapp/api';
import { Input } from './core/Input'; import { Input } from './core/Input';
import { VStack } from './core/Stacks'; import { VStack } from './core/Stacks';
@@ -27,7 +27,7 @@ export function BearerAuth<T extends HttpRequest | GrpcRequest>({ request }: Pro
if (request.model === 'http_request') { if (request.model === 'http_request') {
updateHttpRequest.mutate({ updateHttpRequest.mutate({
id: request.id ?? null, id: request.id ?? null,
update: (r) => ({ update: (r: HttpRequest) => ({
...r, ...r,
authentication: { token }, authentication: { token },
}), }),
@@ -35,7 +35,7 @@ export function BearerAuth<T extends HttpRequest | GrpcRequest>({ request }: Pro
} else { } else {
updateGrpcRequest.mutate({ updateGrpcRequest.mutate({
id: request.id ?? null, id: request.id ?? null,
update: (r) => ({ update: (r: GrpcRequest) => ({
...r, ...r,
authentication: { token }, authentication: { token },
}), }),

View File

@@ -1,6 +1,6 @@
import mime from 'mime'; import mime from 'mime';
import { useKeyValue } from '../hooks/useKeyValue'; import { useKeyValue } from '../hooks/useKeyValue';
import type { HttpRequest } from '../lib/models'; import type { HttpRequest } from '@yaakapp/api';
import { Banner } from './core/Banner'; import { Banner } from './core/Banner';
import { Button } from './core/Button'; import { Button } from './core/Button';
import { InlineCode } from './core/InlineCode'; import { InlineCode } from './core/InlineCode';

View File

@@ -1,5 +1,6 @@
import { useCookieJars } from '../hooks/useCookieJars'; import { useCookieJars } from '../hooks/useCookieJars';
import { useUpdateCookieJar } from '../hooks/useUpdateCookieJar'; import { useUpdateCookieJar } from '../hooks/useUpdateCookieJar';
import type { Cookie } from '../lib/gen/Cookie';
import { cookieDomain } from '../lib/models'; import { cookieDomain } from '../lib/models';
import { Banner } from './core/Banner'; import { Banner } from './core/Banner';
import { IconButton } from './core/IconButton'; import { IconButton } from './core/IconButton';
@@ -37,7 +38,7 @@ export const CookieDialog = function ({ cookieJarId }: Props) {
</tr> </tr>
</thead> </thead>
<tbody className="divide-y divide-background-highlight-secondary"> <tbody className="divide-y divide-background-highlight-secondary">
{cookieJar?.cookies.map((c) => ( {cookieJar?.cookies.map((c: Cookie) => (
<tr key={c.domain + c.raw_cookie}> <tr key={c.domain + c.raw_cookie}>
<td className="py-2 select-text cursor-text font-mono font-semibold max-w-0"> <td className="py-2 select-text cursor-text font-mono font-semibold max-w-0">
{cookieDomain(c)} {cookieDomain(c)}
@@ -55,7 +56,7 @@ export const CookieDialog = function ({ cookieJarId }: Props) {
onClick={async () => { onClick={async () => {
await updateCookieJar.mutateAsync({ await updateCookieJar.mutateAsync({
...cookieJar, ...cookieJar,
cookies: cookieJar.cookies.filter((c2) => c2 !== c), cookies: cookieJar.cookies.filter((c2: Cookie) => c2 !== c),
}); });
}} }}
/> />

View File

@@ -9,7 +9,7 @@ import { useKeyValue } from '../hooks/useKeyValue';
import { usePrompt } from '../hooks/usePrompt'; import { usePrompt } from '../hooks/usePrompt';
import { useUpdateEnvironment } from '../hooks/useUpdateEnvironment'; import { useUpdateEnvironment } from '../hooks/useUpdateEnvironment';
import { useUpdateWorkspace } from '../hooks/useUpdateWorkspace'; import { useUpdateWorkspace } from '../hooks/useUpdateWorkspace';
import type { Environment, Workspace } from '../lib/models'; import type { Environment, Workspace } from '@yaakapp/api';
import { Button } from './core/Button'; import { Button } from './core/Button';
import { ContextMenu } from './core/Dropdown'; import { ContextMenu } from './core/Dropdown';
import type { import type {

Some files were not shown because too many files have changed in this diff Show More