Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Update openapi fetch (#929)

Jakub Novákbec5b140c892
diff --git a/.changeset/little-students-float.md b/.changeset/little-students-float.md
new file mode 100644
index 000000000..6ef5bcfe9
--- /dev/null
+++ b/.changeset/little-students-float.md
@@ -0,0 +1,5 @@
+---
+'e2b': patch
+---
+
+Update openapi fetch
diff --git a/packages/js-sdk/package.json b/packages/js-sdk/package.json
index 638290a37..8243ebc6c 100644
--- a/packages/js-sdk/package.json
+++ b/packages/js-sdk/package.json
@@ -58,7 +58,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",
@@ -95,7 +95,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..233b8f4dd 100644
--- a/packages/js-sdk/src/envd/api.ts
+++ b/packages/js-sdk/src/envd/api.ts
@@ -1,4 +1,4 @@
-import createClient, { FetchResponse } from 'openapi-fetch'
+import createClient from 'openapi-fetch'
import type { components, paths } from './schema.gen'
import { ConnectionConfig } from '../connectionConfig'
@@ -15,9 +15,12 @@ import { StartResponse, ConnectResponse } from './process/process_pb'
import { Code, ConnectError } from '@connectrpc/connect'
import { WatchDirResponse } from './filesystem/filesystem_pb'
-export async function handleEnvdApiError<A, B, C extends `${string}/${string}`>(
- res: FetchResponse<A, B, C>
-) {
+type ApiError = { message?: string } | string
+
+export async function handleEnvdApiError(res: {
+ error?: ApiError
+ response: Response
+}) {
if (!res.error) {
return
}
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/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.ts
index 9fabec4c5..e31669a5d 100644
--- a/packages/js-sdk/src/sandbox/filesystem/index.ts
+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts
@@ -359,17 +359,13 @@ export class Filesystem {
// Important: RFC 7578, Section 4.2 requires that if a filename is provided,
// the directory path information must not be used.
// BUT in our case we need to use the directory path information with a custom
- // muktipart part name getter in envd.
+ // multipart part name getter in envd.
fd.append('file', blob, writeFiles[i].path)
return fd
}, new FormData())
},
body: {},
- headers: {
- 'Content-Type': 'multipart/form-data',
- 'Bun-Content-Type': 'temporary-fix', // https://github.com/oven-sh/bun/issues/14988
- },
})
const err = await handleEnvdApiError(res)
diff --git a/packages/js-sdk/tests/runtimes/bun/run.test.ts b/packages/js-sdk/tests/runtimes/bun/run.test.ts
index 7463b762e..5c77b02e3 100644
--- a/packages/js-sdk/tests/runtimes/bun/run.test.ts
+++ b/packages/js-sdk/tests/runtimes/bun/run.test.ts
@@ -17,6 +17,11 @@ test(
expect(cmd.exitCode).toBe(0)
expect(cmd.stdout).toEqual(`${text}\n`)
+
+ await sbx.files.write('test.txt', text)
+ const test = await sbx.files.read('test.txt')
+
+ expect(test).toEqual(text)
} finally {
await sbx.kill()
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9d8b3130c..2da96d786 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -369,8 +369,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
@@ -421,8 +421,8 @@ importers:
specifier: ^4.1.5
version: 4.1.5
openapi-typescript:
- specifier: ^7.6.1
- version: 7.6.1([email protected])
+ specifier: ^7.9.1
+ version: 7.9.1([email protected])
playwright:
specifier: ^1.48.0
version: 1.48.0
@@ -2198,12 +2198,12 @@ packages:
'@redocly/[email protected]':
resolution: {integrity: sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==}
- '@redocly/[email protected]':
- resolution: {integrity: sha512-Nyyv1Bj7GgYwj/l46O0nkH1GTKWbO3Ixe7KFcn021aZipkZd+z8Vlu1BwkhqtVgivcKaClaExtWU/lDHkjBzag==}
+ '@redocly/[email protected]':
+ resolution: {integrity: sha512-roRDai8/zr2S9YfmzUfNhKjOF0NdcOIqF7bhf4MVC5UxpjIysDjyudvlAiVbpPHp3eDRWbdzUgtkK1a7YiDNyQ==}
- '@redocly/[email protected]':
- resolution: {integrity: sha512-nC8ZTFfp1C0RrK7OjYYJL1u0SPYdOtXbLBichCMMfsjwMuEBdGfbDNBJF07mx6/hw6rGRxPsLlvPPa7csX4UpA==}
- engines: {node: '>=18.17.0', npm: '>=10.8.2'}
+ '@redocly/[email protected]':
+ resolution: {integrity: sha512-0EbE8LRbkogtcCXU7liAyC00n9uNG9hJ+eMyHFdUsy9lB/WGqnEBgwjA9q2cyzAVcdTkQqTBBU1XePNnN3OijA==}
+ engines: {node: '>=18.17.0', npm: '>=9.5.0'}
'@rollup/[email protected]':
resolution: {integrity: sha512-+tNWdlWKbpB3WgBN7ijjYkq9X5uhjmcvyjEght4NmH5fAU++zfQzAJ6wumLS+dNcvwEZhKx2Z+skY8m7v0wGSA==}
@@ -4863,8 +4863,8 @@ packages:
resolution: {integrity: sha512-YZWk3mreBEM7sBPddsiQnW9Z8SGg/gNpFfscJq00HCDS7pxcQWWWMSVKJU7YkTRyDu1Zv2s8zaK8gQWKmCXHlg==}
- resolution: {integrity: sha512-MWDKS3AS1bGCHLBA2VLImJz42f7bJh8wQsTGCzI3j519/CASStoDONUBVz2I/VID0MpiX3SGSnbOD2xUalbE5g==}
+ resolution: {integrity: sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==}
engines: {node: '>=18'}
@@ -6116,14 +6116,20 @@ packages:
resolution: {integrity: sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==}
engines: {node: '>=14.16'}
+ resolution: {integrity: sha512-l7RarRHxlEZYjMLd/PR0slfMVse2/vvIAGm75/F7J6MlQ8/b9uUQmUF2kCPrQhJqMXSxmYWObVgeYXbFYzZR+A==}
+
resolution: {integrity: sha512-zM6elH0EZStD/gSiNlcPrzXcVQ/pZo3BDvC6CDwRDUt1dDzxlshpmQnpD6cZaJ39THaSmwVCxxRrPKNM1hHrDg==}
+ resolution: {integrity: sha512-opyTPaunsklCBpTK8JGef6mfPhLSnyy5a0IN9vKtx3+4aExf+KxEqYwIy3hqkedXIB97u357uLMJsOnm3GVjsw==}
+
resolution: {integrity: sha512-1eNjQtbfNi5Z/kFhagDIaIRj6qqDzhjNJKz8cmMW0CVdGwT6e1GLbAfgI0d28VTJa1A8jz82jm/4dG8qNoNS8g==}
- resolution: {integrity: sha512-F7RXEeo/heF3O9lOXo2bNjCOtfp7u+D6W3a3VNEH2xE6v+fxLtn5nq0uvUcA1F5aT+CMhNeC5Uqtg5tlXFX/ag==}
+ resolution: {integrity: sha512-9gJtoY04mk6iPMbToPjPxEAtfXZ0dTsMZtsgUI8YZta0btPPig9DJFP4jlerQD/7QOwYgb0tl+zLUpDf7vb7VA==}
hasBin: true
peerDependencies:
typescript: ^5.x
@@ -6217,8 +6223,8 @@ packages:
resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==}
engines: {node: '>=4'}
- resolution: {integrity: sha512-rum1bPifK5SSar35Z6EKZuYPJx85pkNaFrxBK3mwdfSJ1/WKbYrjoW/zTPSjRRamfmVX1ACBIdFAO0VRErW/EA==}
+ resolution: {integrity: sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==}
engines: {node: '>=18'}
@@ -7176,6 +7182,10 @@ packages:
resolution: {integrity: sha512-nMIjMrd5Z2nuB2RZCKJfFMjgS3fygbeyGk9PxPPaJR1RIcyN9yn4A63Isovzm3ZtQuEkLBVgMdPup8UeLH7aQw==}
+ resolution: {integrity: sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
engines: {node: '>=4'}
@@ -7188,10 +7198,6 @@ packages:
resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
engines: {node: '>=10'}
- resolution: {integrity: sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw==}
- engines: {node: '>=12'}
-
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
@@ -7443,10 +7449,6 @@ packages:
resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==}
engines: {node: '>=12.20'}
- resolution: {integrity: sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==}
- engines: {node: '>=16'}
-
resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==}
engines: {node: '>=16'}
@@ -8211,7 +8213,7 @@ snapshots:
'@babel/traverse': 7.27.1
'@babel/types': 7.27.1
convert-source-map: 2.0.0
- debug: 4.4.0([email protected])
+ debug: 4.4.0
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@@ -8302,7 +8304,7 @@ snapshots:
'@babel/parser': 7.27.2
'@babel/template': 7.27.2
'@babel/types': 7.27.1
- debug: 4.4.0([email protected])
+ debug: 4.4.0
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@@ -8594,7 +8596,7 @@ snapshots:
'@eslint/[email protected]':
dependencies:
ajv: 6.12.6
- debug: 4.4.0([email protected])
+ debug: 4.4.0
espree: 9.6.1
globals: 13.24.0
ignore: 5.3.2
@@ -8637,7 +8639,7 @@ snapshots:
'@humanwhocodes/[email protected]':
dependencies:
'@humanwhocodes/object-schema': 2.0.3
- debug: 4.4.0([email protected])
+ debug: 4.4.0
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
@@ -10163,14 +10165,14 @@ snapshots:
require-from-string: 2.0.2
uri-js-replace: 1.0.1
- '@redocly/[email protected]': {}
+ '@redocly/[email protected]': {}
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([email protected])
+ https-proxy-agent: 7.0.6([email protected])
js-levenshtein: 1.1.6
js-yaml: 4.1.0
minimatch: 5.1.6
@@ -11036,7 +11038,7 @@ snapshots:
dependencies:
'@typescript-eslint/typescript-estree': 6.7.2([email protected])
'@typescript-eslint/utils': 6.7.2([email protected])([email protected])
- debug: 4.4.0([email protected])
+ debug: 4.4.0
eslint: 8.57.1
ts-api-utils: 1.0.3([email protected])
optionalDependencies:
@@ -11078,7 +11080,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 6.21.0
'@typescript-eslint/visitor-keys': 6.21.0
- debug: 4.4.0([email protected])
+ debug: 4.4.0
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.3
@@ -11093,7 +11095,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 6.7.2
'@typescript-eslint/visitor-keys': 6.7.2
- debug: 4.4.0([email protected])
+ debug: 4.4.0
globby: 11.1.0
is-glob: 4.0.3
semver: 7.7.2
@@ -11237,7 +11239,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([email protected])
istanbul-lib-coverage: 3.2.2
istanbul-lib-report: 3.0.1
istanbul-lib-source-maps: 5.0.6
@@ -11441,7 +11443,7 @@ snapshots:
dependencies:
- debug: 4.4.0([email protected])
+ debug: 4.4.0
transitivePeerDependencies:
- supports-color
@@ -12186,15 +12188,15 @@ snapshots:
dependencies:
ms: 2.1.2
dependencies:
ms: 2.1.3
- optionalDependencies:
- supports-color: 9.4.0
dependencies:
ms: 2.1.3
+ optionalDependencies:
+ supports-color: 10.2.2
dependencies:
@@ -12621,7 +12623,7 @@ snapshots:
dependencies:
- debug: 4.4.0([email protected])
+ debug: 4.4.0
enhanced-resolve: 5.18.1
eslint: 8.57.1
@@ -12752,7 +12754,7 @@ snapshots:
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.6
- debug: 4.4.0([email protected])
+ debug: 4.4.0
doctrine: 3.0.0
escape-string-regexp: 4.0.0
eslint-scope: 7.2.2
@@ -13389,7 +13391,7 @@ snapshots:
dependencies:
'@tootallnate/once': 2.0.0
agent-base: 6.0.2
- debug: 4.4.0([email protected])
+ debug: 4.4.0
transitivePeerDependencies:
- supports-color
@@ -13401,14 +13403,14 @@ snapshots:
dependencies:
agent-base: 6.0.2
- debug: 4.4.0([email protected])
+ debug: 4.4.0
transitivePeerDependencies:
- supports-color
dependencies:
agent-base: 7.1.3
- debug: 4.4.0([email protected])
+ debug: 4.4.3([email protected])
transitivePeerDependencies:
- supports-color
@@ -13461,7 +13463,7 @@ snapshots:
dependencies:
@@ -13787,7 +13789,7 @@ snapshots:
dependencies:
'@jridgewell/trace-mapping': 0.3.30
- debug: 4.4.3
+ debug: 4.4.3([email protected])
istanbul-lib-coverage: 3.2.2
transitivePeerDependencies:
- supports-color
@@ -14580,7 +14582,7 @@ snapshots:
dependencies:
'@types/debug': 4.1.8
- debug: 4.4.0([email protected])
+ debug: 4.4.0
decode-named-character-reference: 1.0.2
micromark-core-commonmark: 1.1.0
micromark-factory-space: 1.1.0
@@ -15130,19 +15132,25 @@ snapshots:
is-inside-container: 1.0.0
is-wsl: 2.2.0
+ dependencies:
+ openapi-typescript-helpers: 0.0.15
+
dependencies:
openapi-typescript-helpers: 0.0.8
+
dependencies:
- '@redocly/openapi-core': 1.28.2([email protected])
+ '@redocly/openapi-core': 1.34.5([email protected])
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
@@ -15267,11 +15275,11 @@ snapshots:
error-ex: 1.3.2
json-parse-better-errors: 1.0.2
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
@@ -15758,7 +15766,7 @@ snapshots:
dependencies:
- debug: 4.4.0([email protected])
+ debug: 4.4.0
module-details-from-path: 1.0.3
resolve: 1.22.8
transitivePeerDependencies:
@@ -16092,7 +16100,7 @@ snapshots:
dependencies:
agent-base: 6.0.2
- debug: 4.4.0([email protected])
+ debug: 4.4.0
socks: 2.7.1
transitivePeerDependencies:
- supports-color
@@ -16306,6 +16314,8 @@ snapshots:
+
dependencies:
has-flag: 3.0.0
@@ -16318,8 +16328,6 @@ snapshots:
dependencies:
has-flag: 4.0.0
-
@@ -16549,7 +16557,7 @@ snapshots:
cac: 6.7.14
chokidar: 4.0.3
consola: 3.4.2
- debug: 4.4.0([email protected])
+ debug: 4.4.0
esbuild: 0.25.0
joycon: 3.1.1
picocolors: 1.1.1
@@ -16576,7 +16584,7 @@ snapshots:
cac: 6.7.14
chokidar: 4.0.3
consola: 3.4.2
- debug: 4.4.0([email protected])
+ debug: 4.4.0
esbuild: 0.25.0
joycon: 3.1.1
picocolors: 1.1.1
@@ -16600,7 +16608,7 @@ snapshots:
dependencies:
'@tufjs/models': 1.0.4
- debug: 4.4.0([email protected])
+ debug: 4.4.0
make-fetch-happen: 11.1.1
transitivePeerDependencies:
- supports-color
@@ -16623,10 +16631,7 @@ snapshots:
-
- optional: true
@@ -16964,7 +16969,7 @@ snapshots:
dependencies:
cac: 6.7.14
- debug: 4.4.0([email protected])
+ debug: 4.4.0
es-module-lexer: 1.6.0
pathe: 2.0.3
@@ -16985,7 +16990,7 @@ snapshots:
dependencies:
cac: 6.7.14
- debug: 4.4.3
+ debug: 4.4.3([email protected])
es-module-lexer: 1.7.0
pathe: 2.0.3
@@ -17038,7 +17043,7 @@ snapshots:
'@vitest/spy': 3.1.1
'@vitest/utils': 3.1.1
chai: 5.2.0
- debug: 4.4.0([email protected])
+ debug: 4.4.0
expect-type: 1.2.1
magic-string: 0.30.17
pathe: 2.0.3
@@ -17078,7 +17083,7 @@ snapshots:
'@vitest/spy': 3.2.4
'@vitest/utils': 3.2.4
chai: 5.2.0
- debug: 4.4.3
+ debug: 4.4.3([email protected])
expect-type: 1.2.1
magic-string: 0.30.17
pathe: 2.0.3