diff --git a/packages/js-sdk/package.json b/packages/js-sdk/package.json index 5d2af9335..aa0e6ac6d 100644 --- a/packages/js-sdk/package.json +++ b/packages/js-sdk/package.json @@ -56,7 +56,7 @@ "knip": "^5.43.6", "npm-check-updates": "^16.14.20", "npm-run-all": "^4.1.5", - "openapi-typescript": "^7.6.1", + "openapi-typescript": "^7.9.1", "playwright": "^1.48.0", "react": "^18.3.1", "tsup": "^8.4.0", @@ -92,7 +92,7 @@ "compare-versions": "^6.1.0", "dockerfile-ast": "^0.7.1", "glob": "^11.0.3", - "openapi-fetch": "^0.9.7", + "openapi-fetch": "^0.14.1", "platform": "^1.3.6", "tar": "^7.4.3" }, diff --git a/packages/js-sdk/src/envd/api.ts b/packages/js-sdk/src/envd/api.ts index 1df7a034a..5520ebb97 100644 --- a/packages/js-sdk/src/envd/api.ts +++ b/packages/js-sdk/src/envd/api.ts @@ -15,9 +15,11 @@ import { StartResponse, ConnectResponse } from './process/process_pb' import { Code, ConnectError } from '@connectrpc/connect' import { WatchDirResponse } from './filesystem/filesystem_pb' -export async function handleEnvdApiError( - res: FetchResponse -) { +export async function handleEnvdApiError< + A extends { responses: Record }, + B, + C extends `${string}/${string}` +>(res: FetchResponse) { if (!res.error) { return } @@ -25,7 +27,7 @@ export async function handleEnvdApiError( const message: string = typeof res.error == 'string' ? res.error - : res.error?.message || (await res.response.text()) + : (res.error as any)?.message || (await res.response.text()) switch (res.response.status) { case 400: diff --git a/packages/js-sdk/src/logs.ts b/packages/js-sdk/src/logs.ts index 5d6d51a2b..a483389a7 100644 --- a/packages/js-sdk/src/logs.ts +++ b/packages/js-sdk/src/logs.ts @@ -54,19 +54,18 @@ export function createRpcLogger(logger: Logger): Interceptor { export function createApiLogger(logger: Logger): Middleware { return { - async onRequest(req) { - logger.info?.(`Request ${req.method} ${req.url}`) - - return req + async onRequest({ request }) { + logger.info?.(`Request ${request.method} ${request.url}`) + return request }, - async onResponse(res) { - if (res.status >= 400) { - logger.error?.('Response:', res.status, res.statusText) + async onResponse({ response }) { + if (response.status >= 400) { + logger.error?.('Response:', response.status, response.statusText) } else { - logger.info?.('Response:', res.status, res.statusText) + logger.info?.('Response:', response.status, response.statusText) } - return res + return response }, } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3c695eb1b..c12217898 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -366,8 +366,8 @@ importers: specifier: ^11.0.3 version: 11.0.3 openapi-fetch: - specifier: ^0.9.7 - version: 0.9.8 + specifier: ^0.14.1 + version: 0.14.1 platform: specifier: ^1.3.6 version: 1.3.6 @@ -415,8 +415,8 @@ importers: specifier: ^4.1.5 version: 4.1.5 openapi-typescript: - specifier: ^7.6.1 - version: 7.6.1(typescript@5.5.3) + specifier: ^7.9.1 + version: 7.9.1(typescript@5.5.3) playwright: specifier: ^1.48.0 version: 1.48.0 @@ -2185,12 +2185,12 @@ packages: '@redocly/ajv@8.11.2': resolution: {integrity: sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==} - '@redocly/config@0.20.3': - resolution: {integrity: sha512-Nyyv1Bj7GgYwj/l46O0nkH1GTKWbO3Ixe7KFcn021aZipkZd+z8Vlu1BwkhqtVgivcKaClaExtWU/lDHkjBzag==} + '@redocly/config@0.22.2': + resolution: {integrity: sha512-roRDai8/zr2S9YfmzUfNhKjOF0NdcOIqF7bhf4MVC5UxpjIysDjyudvlAiVbpPHp3eDRWbdzUgtkK1a7YiDNyQ==} - '@redocly/openapi-core@1.28.2': - resolution: {integrity: sha512-nC8ZTFfp1C0RrK7OjYYJL1u0SPYdOtXbLBichCMMfsjwMuEBdGfbDNBJF07mx6/hw6rGRxPsLlvPPa7csX4UpA==} - engines: {node: '>=18.17.0', npm: '>=10.8.2'} + '@redocly/openapi-core@1.34.5': + resolution: {integrity: sha512-0EbE8LRbkogtcCXU7liAyC00n9uNG9hJ+eMyHFdUsy9lB/WGqnEBgwjA9q2cyzAVcdTkQqTBBU1XePNnN3OijA==} + engines: {node: '>=18.17.0', npm: '>=9.5.0'} '@rollup/plugin-commonjs@28.0.1': resolution: {integrity: sha512-+tNWdlWKbpB3WgBN7ijjYkq9X5uhjmcvyjEght4NmH5fAU++zfQzAJ6wumLS+dNcvwEZhKx2Z+skY8m7v0wGSA==} @@ -4851,8 +4851,8 @@ packages: indento@1.1.13: resolution: {integrity: sha512-YZWk3mreBEM7sBPddsiQnW9Z8SGg/gNpFfscJq00HCDS7pxcQWWWMSVKJU7YkTRyDu1Zv2s8zaK8gQWKmCXHlg==} - index-to-position@0.1.2: - resolution: {integrity: sha512-MWDKS3AS1bGCHLBA2VLImJz42f7bJh8wQsTGCzI3j519/CASStoDONUBVz2I/VID0MpiX3SGSnbOD2xUalbE5g==} + index-to-position@1.2.0: + resolution: {integrity: sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==} engines: {node: '>=18'} inflight@1.0.6: @@ -6099,14 +6099,20 @@ packages: resolution: {integrity: sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==} engines: {node: '>=14.16'} + openapi-fetch@0.14.1: + resolution: {integrity: sha512-l7RarRHxlEZYjMLd/PR0slfMVse2/vvIAGm75/F7J6MlQ8/b9uUQmUF2kCPrQhJqMXSxmYWObVgeYXbFYzZR+A==} + openapi-fetch@0.9.8: resolution: {integrity: sha512-zM6elH0EZStD/gSiNlcPrzXcVQ/pZo3BDvC6CDwRDUt1dDzxlshpmQnpD6cZaJ39THaSmwVCxxRrPKNM1hHrDg==} + openapi-typescript-helpers@0.0.15: + resolution: {integrity: sha512-opyTPaunsklCBpTK8JGef6mfPhLSnyy5a0IN9vKtx3+4aExf+KxEqYwIy3hqkedXIB97u357uLMJsOnm3GVjsw==} + openapi-typescript-helpers@0.0.8: resolution: {integrity: sha512-1eNjQtbfNi5Z/kFhagDIaIRj6qqDzhjNJKz8cmMW0CVdGwT6e1GLbAfgI0d28VTJa1A8jz82jm/4dG8qNoNS8g==} - openapi-typescript@7.6.1: - resolution: {integrity: sha512-F7RXEeo/heF3O9lOXo2bNjCOtfp7u+D6W3a3VNEH2xE6v+fxLtn5nq0uvUcA1F5aT+CMhNeC5Uqtg5tlXFX/ag==} + openapi-typescript@7.9.1: + resolution: {integrity: sha512-9gJtoY04mk6iPMbToPjPxEAtfXZ0dTsMZtsgUI8YZta0btPPig9DJFP4jlerQD/7QOwYgb0tl+zLUpDf7vb7VA==} hasBin: true peerDependencies: typescript: ^5.x @@ -6200,8 +6206,8 @@ packages: resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==} engines: {node: '>=4'} - parse-json@8.1.0: - resolution: {integrity: sha512-rum1bPifK5SSar35Z6EKZuYPJx85pkNaFrxBK3mwdfSJ1/WKbYrjoW/zTPSjRRamfmVX1ACBIdFAO0VRErW/EA==} + parse-json@8.3.0: + resolution: {integrity: sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==} engines: {node: '>=18'} parse-ms@4.0.0: @@ -7154,6 +7160,10 @@ packages: summary@2.1.0: resolution: {integrity: sha512-nMIjMrd5Z2nuB2RZCKJfFMjgS3fygbeyGk9PxPPaJR1RIcyN9yn4A63Isovzm3ZtQuEkLBVgMdPup8UeLH7aQw==} + supports-color@10.2.2: + resolution: {integrity: sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==} + engines: {node: '>=18'} + supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -7166,10 +7176,6 @@ packages: resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} engines: {node: '>=10'} - supports-color@9.4.0: - resolution: {integrity: sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw==} - engines: {node: '>=12'} - supports-preserve-symlinks-flag@1.0.0: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} @@ -7421,10 +7427,6 @@ packages: resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==} engines: {node: '>=12.20'} - type-fest@4.26.1: - resolution: {integrity: sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==} - engines: {node: '>=16'} - type-fest@4.41.0: resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} engines: {node: '>=16'} @@ -8183,7 +8185,7 @@ snapshots: '@babel/traverse': 7.27.1 '@babel/types': 7.27.1 convert-source-map: 2.0.0 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -8274,7 +8276,7 @@ snapshots: '@babel/parser': 7.27.2 '@babel/template': 7.27.2 '@babel/types': 7.27.1 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -8566,7 +8568,7 @@ snapshots: '@eslint/eslintrc@2.1.4': dependencies: ajv: 6.12.6 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 espree: 9.6.1 globals: 13.24.0 ignore: 5.3.2 @@ -8609,7 +8611,7 @@ snapshots: '@humanwhocodes/config-array@0.13.0': dependencies: '@humanwhocodes/object-schema': 2.0.3 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -10133,14 +10135,14 @@ snapshots: require-from-string: 2.0.2 uri-js-replace: 1.0.1 - '@redocly/config@0.20.3': {} + '@redocly/config@0.22.2': {} - '@redocly/openapi-core@1.28.2(supports-color@9.4.0)': + '@redocly/openapi-core@1.34.5(supports-color@10.2.2)': dependencies: '@redocly/ajv': 8.11.2 - '@redocly/config': 0.20.3 + '@redocly/config': 0.22.2 colorette: 1.4.0 - https-proxy-agent: 7.0.6(supports-color@9.4.0) + https-proxy-agent: 7.0.6(supports-color@10.2.2) js-levenshtein: 1.1.6 js-yaml: 4.1.0 minimatch: 5.1.6 @@ -11002,7 +11004,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 6.7.2(typescript@5.5.3) '@typescript-eslint/utils': 6.7.2(eslint@8.57.1)(typescript@5.5.3) - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 eslint: 8.57.1 ts-api-utils: 1.0.3(typescript@5.5.3) optionalDependencies: @@ -11044,7 +11046,7 @@ snapshots: dependencies: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -11059,7 +11061,7 @@ snapshots: dependencies: '@typescript-eslint/types': 6.7.2 '@typescript-eslint/visitor-keys': 6.7.2 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 globby: 11.1.0 is-glob: 4.0.3 semver: 7.7.2 @@ -11203,7 +11205,7 @@ snapshots: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 1.0.2 ast-v8-to-istanbul: 0.3.5 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) istanbul-lib-coverage: 3.2.2 istanbul-lib-report: 3.0.1 istanbul-lib-source-maps: 5.0.6 @@ -11407,7 +11409,7 @@ snapshots: agent-base@6.0.2: dependencies: - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 transitivePeerDependencies: - supports-color @@ -12152,15 +12154,15 @@ snapshots: dependencies: ms: 2.1.2 - debug@4.4.0(supports-color@9.4.0): + debug@4.4.0: dependencies: ms: 2.1.3 - optionalDependencies: - supports-color: 9.4.0 - debug@4.4.3: + debug@4.4.3(supports-color@10.2.2): dependencies: ms: 2.1.3 + optionalDependencies: + supports-color: 10.2.2 decode-named-character-reference@1.0.2: dependencies: @@ -12595,7 +12597,7 @@ snapshots: eslint-import-resolver-typescript@3.6.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.1.6))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.57.1): dependencies: - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 enhanced-resolve: 5.18.1 eslint: 8.57.1 eslint-module-utils: 2.8.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.1.6))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.0)(eslint@8.57.1) @@ -12726,7 +12728,7 @@ snapshots: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.6 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -13363,7 +13365,7 @@ snapshots: dependencies: '@tootallnate/once': 2.0.0 agent-base: 6.0.2 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 transitivePeerDependencies: - supports-color @@ -13375,14 +13377,14 @@ snapshots: https-proxy-agent@5.0.1: dependencies: agent-base: 6.0.2 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 transitivePeerDependencies: - supports-color - https-proxy-agent@7.0.6(supports-color@9.4.0): + https-proxy-agent@7.0.6(supports-color@10.2.2): dependencies: agent-base: 7.1.3 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -13435,7 +13437,7 @@ snapshots: indento@1.1.13: {} - index-to-position@0.1.2: {} + index-to-position@1.2.0: {} inflight@1.0.6: dependencies: @@ -13761,7 +13763,7 @@ snapshots: istanbul-lib-source-maps@5.0.6: dependencies: '@jridgewell/trace-mapping': 0.3.30 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) istanbul-lib-coverage: 3.2.2 transitivePeerDependencies: - supports-color @@ -14542,7 +14544,7 @@ snapshots: micromark@3.2.0: dependencies: '@types/debug': 4.1.8 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 decode-named-character-reference: 1.0.2 micromark-core-commonmark: 1.1.0 micromark-factory-space: 1.1.0 @@ -15092,19 +15094,25 @@ snapshots: is-inside-container: 1.0.0 is-wsl: 2.2.0 + openapi-fetch@0.14.1: + dependencies: + openapi-typescript-helpers: 0.0.15 + openapi-fetch@0.9.8: dependencies: openapi-typescript-helpers: 0.0.8 + openapi-typescript-helpers@0.0.15: {} + openapi-typescript-helpers@0.0.8: {} - openapi-typescript@7.6.1(typescript@5.5.3): + openapi-typescript@7.9.1(typescript@5.5.3): dependencies: - '@redocly/openapi-core': 1.28.2(supports-color@9.4.0) + '@redocly/openapi-core': 1.34.5(supports-color@10.2.2) ansi-colors: 4.1.3 change-case: 5.4.4 - parse-json: 8.1.0 - supports-color: 9.4.0 + parse-json: 8.3.0 + supports-color: 10.2.2 typescript: 5.5.3 yargs-parser: 21.1.1 @@ -15229,11 +15237,11 @@ snapshots: error-ex: 1.3.2 json-parse-better-errors: 1.0.2 - parse-json@8.1.0: + parse-json@8.3.0: dependencies: - '@babel/code-frame': 7.26.2 - index-to-position: 0.1.2 - type-fest: 4.26.1 + '@babel/code-frame': 7.27.1 + index-to-position: 1.2.0 + type-fest: 4.41.0 parse-ms@4.0.0: {} @@ -15718,7 +15726,7 @@ snapshots: require-in-the-middle@7.3.0: dependencies: - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 module-details-from-path: 1.0.3 resolve: 1.22.8 transitivePeerDependencies: @@ -16052,7 +16060,7 @@ snapshots: socks-proxy-agent@7.0.0: dependencies: agent-base: 6.0.2 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 socks: 2.7.1 transitivePeerDependencies: - supports-color @@ -16266,6 +16274,8 @@ snapshots: summary@2.1.0: {} + supports-color@10.2.2: {} + supports-color@5.5.0: dependencies: has-flag: 3.0.0 @@ -16278,8 +16288,6 @@ snapshots: dependencies: has-flag: 4.0.0 - supports-color@9.4.0: {} - supports-preserve-symlinks-flag@1.0.0: {} tailwind-merge@1.14.0: {} @@ -16509,7 +16517,7 @@ snapshots: cac: 6.7.14 chokidar: 4.0.3 consola: 3.4.2 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 esbuild: 0.25.0 joycon: 3.1.1 picocolors: 1.1.1 @@ -16536,7 +16544,7 @@ snapshots: cac: 6.7.14 chokidar: 4.0.3 consola: 3.4.2 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 esbuild: 0.25.0 joycon: 3.1.1 picocolors: 1.1.1 @@ -16560,7 +16568,7 @@ snapshots: tuf-js@1.1.7: dependencies: '@tufjs/models': 1.0.4 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 make-fetch-happen: 11.1.1 transitivePeerDependencies: - supports-color @@ -16583,10 +16591,7 @@ snapshots: type-fest@2.19.0: {} - type-fest@4.26.1: {} - - type-fest@4.41.0: - optional: true + type-fest@4.41.0: {} type@1.2.0: {} @@ -16924,7 +16929,7 @@ snapshots: vite-node@3.1.1(@types/node@18.18.6)(jiti@2.4.2)(terser@5.44.0)(yaml@2.5.1): dependencies: cac: 6.7.14 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 es-module-lexer: 1.6.0 pathe: 2.0.3 vite: 6.3.5(@types/node@18.18.6)(jiti@2.4.2)(terser@5.44.0)(yaml@2.5.1) @@ -16945,7 +16950,7 @@ snapshots: vite-node@3.2.4(@types/node@18.18.6)(jiti@2.4.2)(terser@5.44.0)(yaml@2.5.1): dependencies: cac: 6.7.14 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) es-module-lexer: 1.7.0 pathe: 2.0.3 vite: 6.3.5(@types/node@18.18.6)(jiti@2.4.2)(terser@5.44.0)(yaml@2.5.1) @@ -16998,7 +17003,7 @@ snapshots: '@vitest/spy': 3.1.1 '@vitest/utils': 3.1.1 chai: 5.2.0 - debug: 4.4.0(supports-color@9.4.0) + debug: 4.4.0 expect-type: 1.2.1 magic-string: 0.30.17 pathe: 2.0.3 @@ -17038,7 +17043,7 @@ snapshots: '@vitest/spy': 3.2.4 '@vitest/utils': 3.2.4 chai: 5.2.0 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) expect-type: 1.2.1 magic-string: 0.30.17 pathe: 2.0.3