@boxrouter/sdk 0.0.1-alpha.0 → 0.12.190
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +29 -5
- package/README.md +497 -24
- package/dist/addresses.d.ts +5 -0
- package/dist/addresses.js +10 -0
- package/dist/api-error.d.ts +62 -0
- package/dist/api-error.js +264 -0
- package/dist/boxrouter.d.ts +68 -0
- package/dist/boxrouter.js +291 -0
- package/dist/browser-session/index.d.ts +17 -0
- package/dist/browser-session/index.js +48 -0
- package/dist/browser-session/operations.gen.d.ts +272 -0
- package/dist/browser-session/operations.gen.js +58 -0
- package/dist/browser-session/responseContracts/api_keys.d.ts +2 -0
- package/dist/browser-session/responseContracts/api_keys.js +10 -0
- package/dist/browser-session/responseContracts/credits.d.ts +2 -0
- package/dist/browser-session/responseContracts/credits.js +8 -0
- package/dist/browser-session/responseContracts/github.d.ts +2 -0
- package/dist/browser-session/responseContracts/github.js +11 -0
- package/dist/browser-session/responseContracts/identity.d.ts +2 -0
- package/dist/browser-session/responseContracts/identity.js +30 -0
- package/dist/browser-session/responseContracts/organizations.d.ts +2 -0
- package/dist/browser-session/responseContracts/organizations.js +17 -0
- package/dist/browser-session/responseContracts/privacy.d.ts +2 -0
- package/dist/browser-session/responseContracts/privacy.js +7 -0
- package/dist/browser-session/responseContracts.gen.d.ts +3 -0
- package/dist/browser-session/responseContracts.gen.js +10 -0
- package/dist/browser-session/responseValidators/api_keys-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/api_keys-diagnostics.d.cts +4 -0
- package/dist/browser-session/responseValidators/api_keys.cjs +2 -0
- package/dist/browser-session/responseValidators/api_keys.d.cts +4 -0
- package/dist/browser-session/responseValidators/credits-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/credits-diagnostics.d.cts +3 -0
- package/dist/browser-session/responseValidators/credits.cjs +2 -0
- package/dist/browser-session/responseValidators/credits.d.cts +3 -0
- package/dist/browser-session/responseValidators/github-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/github-diagnostics.d.cts +3 -0
- package/dist/browser-session/responseValidators/github.cjs +2 -0
- package/dist/browser-session/responseValidators/github.d.cts +3 -0
- package/dist/browser-session/responseValidators/identity-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/identity-diagnostics.d.cts +23 -0
- package/dist/browser-session/responseValidators/identity.cjs +2 -0
- package/dist/browser-session/responseValidators/identity.d.cts +23 -0
- package/dist/browser-session/responseValidators/organizations-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/organizations-diagnostics.d.cts +15 -0
- package/dist/browser-session/responseValidators/organizations.cjs +2 -0
- package/dist/browser-session/responseValidators/organizations.d.cts +15 -0
- package/dist/browser-session/responseValidators/privacy-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/privacy-diagnostics.d.cts +2 -0
- package/dist/browser-session/responseValidators/privacy.cjs +2 -0
- package/dist/browser-session/responseValidators/privacy.d.cts +2 -0
- package/dist/client/client.gen.d.ts +1 -1
- package/dist/client/client.gen.js +46 -94
- package/dist/client/index.d.ts +10 -10
- package/dist/client/index.js +16 -5
- package/dist/client/types.gen.d.ts +6 -6
- package/dist/client/types.gen.js +2 -1
- package/dist/client/utils.gen.d.ts +2 -2
- package/dist/client/utils.gen.js +31 -20
- package/dist/client.gen.d.ts +2 -2
- package/dist/client.gen.js +5 -2
- package/dist/command-check.gen.d.ts +14 -0
- package/dist/command-check.gen.js +23 -0
- package/dist/command-input.gen.d.ts +6 -0
- package/dist/command-input.gen.js +45 -0
- package/dist/core/auth.gen.js +5 -1
- package/dist/core/binaryStream.d.ts +8 -0
- package/dist/core/binaryStream.js +76 -0
- package/dist/core/bodySerializer.gen.d.ts +1 -1
- package/dist/core/bodySerializer.gen.js +8 -5
- package/dist/core/commandValidators.cjs +1 -0
- package/dist/core/commandValidators.d.cts +14 -0
- package/dist/core/eventValidation.d.ts +17 -0
- package/dist/core/eventValidation.js +56 -0
- package/dist/core/eventValidators.cjs +1 -0
- package/dist/core/eventValidators.d.cts +2 -0
- package/dist/core/json.d.ts +3 -0
- package/dist/core/json.js +33 -0
- package/dist/core/params.gen.js +4 -1
- package/dist/core/pathSerializer.gen.js +20 -11
- package/dist/core/queryKeySerializer.gen.js +12 -6
- package/dist/core/responseContracts/actions.d.ts +2 -0
- package/dist/core/responseContracts/actions.js +30 -0
- package/dist/core/responseContracts/agents.d.ts +2 -0
- package/dist/core/responseContracts/agents.js +7 -0
- package/dist/core/responseContracts/artifacts.d.ts +2 -0
- package/dist/core/responseContracts/artifacts.js +8 -0
- package/dist/core/responseContracts/commands.d.ts +2 -0
- package/dist/core/responseContracts/commands.js +6 -0
- package/dist/core/responseContracts/credits.d.ts +2 -0
- package/dist/core/responseContracts/credits.js +27 -0
- package/dist/core/responseContracts/files.d.ts +2 -0
- package/dist/core/responseContracts/files.js +15 -0
- package/dist/core/responseContracts/github.d.ts +2 -0
- package/dist/core/responseContracts/github.js +8 -0
- package/dist/core/responseContracts/images.d.ts +2 -0
- package/dist/core/responseContracts/images.js +8 -0
- package/dist/core/responseContracts/launchRuns.d.ts +2 -0
- package/dist/core/responseContracts/launchRuns.js +10 -0
- package/dist/core/responseContracts/launches.d.ts +2 -0
- package/dist/core/responseContracts/launches.js +10 -0
- package/dist/core/responseContracts/operations.d.ts +2 -0
- package/dist/core/responseContracts/operations.js +7 -0
- package/dist/core/responseContracts/previews.d.ts +2 -0
- package/dist/core/responseContracts/previews.js +8 -0
- package/dist/core/responseContracts/pricing.d.ts +2 -0
- package/dist/core/responseContracts/pricing.js +6 -0
- package/dist/core/responseContracts/processes.d.ts +2 -0
- package/dist/core/responseContracts/processes.js +11 -0
- package/dist/core/responseContracts/provider_accounts.d.ts +2 -0
- package/dist/core/responseContracts/provider_accounts.js +13 -0
- package/dist/core/responseContracts/providers.d.ts +2 -0
- package/dist/core/responseContracts/providers.js +6 -0
- package/dist/core/responseContracts/routing.d.ts +2 -0
- package/dist/core/responseContracts/routing.js +8 -0
- package/dist/core/responseContracts/sandboxes.d.ts +2 -0
- package/dist/core/responseContracts/sandboxes.js +15 -0
- package/dist/core/responseContracts/secrets.d.ts +2 -0
- package/dist/core/responseContracts/secrets.js +8 -0
- package/dist/core/responseContracts/spend_limits.d.ts +2 -0
- package/dist/core/responseContracts/spend_limits.js +8 -0
- package/dist/core/responseContracts/terminals.d.ts +2 -0
- package/dist/core/responseContracts/terminals.js +11 -0
- package/dist/core/responseContracts/usage.d.ts +2 -0
- package/dist/core/responseContracts/usage.js +7 -0
- package/dist/core/responseContracts/volumes.d.ts +2 -0
- package/dist/core/responseContracts/volumes.js +19 -0
- package/dist/core/responseContracts.gen.d.ts +3 -0
- package/dist/core/responseContracts.gen.js +27 -0
- package/dist/core/responseModes.d.ts +19 -0
- package/dist/core/responseModes.js +13 -0
- package/dist/core/responseValidation.d.ts +44 -0
- package/dist/core/responseValidation.js +174 -0
- package/dist/core/responseValidators/actions-diagnostics.cjs +4 -0
- package/dist/core/responseValidators/actions-diagnostics.d.cts +24 -0
- package/dist/core/responseValidators/actions.cjs +2 -0
- package/dist/core/responseValidators/actions.d.cts +24 -0
- package/dist/core/responseValidators/agents-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/agents-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/agents.cjs +2 -0
- package/dist/core/responseValidators/agents.d.cts +2 -0
- package/dist/core/responseValidators/artifacts-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/artifacts-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/artifacts.cjs +2 -0
- package/dist/core/responseValidators/artifacts.d.cts +2 -0
- package/dist/core/responseValidators/commands-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/commands-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/commands.cjs +2 -0
- package/dist/core/responseValidators/commands.d.cts +1 -0
- package/dist/core/responseValidators/compact.cjs +122 -0
- package/dist/core/responseValidators/credits-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/credits-diagnostics.d.cts +21 -0
- package/dist/core/responseValidators/credits.cjs +2 -0
- package/dist/core/responseValidators/credits.d.cts +21 -0
- package/dist/core/responseValidators/files-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/files-diagnostics.d.cts +5 -0
- package/dist/core/responseValidators/files.cjs +2 -0
- package/dist/core/responseValidators/files.d.cts +5 -0
- package/dist/core/responseValidators/github-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/github-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/github.cjs +2 -0
- package/dist/core/responseValidators/github.d.cts +2 -0
- package/dist/core/responseValidators/images-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/images-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/images.cjs +2 -0
- package/dist/core/responseValidators/images.d.cts +3 -0
- package/dist/core/responseValidators/launchRuns-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/launchRuns-diagnostics.d.cts +5 -0
- package/dist/core/responseValidators/launchRuns.cjs +2 -0
- package/dist/core/responseValidators/launchRuns.d.cts +5 -0
- package/dist/core/responseValidators/launches-diagnostics.cjs +10 -0
- package/dist/core/responseValidators/launches-diagnostics.d.cts +5 -0
- package/dist/core/responseValidators/launches.cjs +2 -0
- package/dist/core/responseValidators/launches.d.cts +5 -0
- package/dist/core/responseValidators/operations-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/operations-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/operations.cjs +2 -0
- package/dist/core/responseValidators/operations.d.cts +2 -0
- package/dist/core/responseValidators/previews-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/previews-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/previews.cjs +2 -0
- package/dist/core/responseValidators/previews.d.cts +3 -0
- package/dist/core/responseValidators/pricing-diagnostics.cjs +7 -0
- package/dist/core/responseValidators/pricing-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/pricing.cjs +2 -0
- package/dist/core/responseValidators/pricing.d.cts +1 -0
- package/dist/core/responseValidators/processes-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/processes-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/processes.cjs +2 -0
- package/dist/core/responseValidators/processes.d.cts +2 -0
- package/dist/core/responseValidators/provider_accounts-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/provider_accounts-diagnostics.d.cts +8 -0
- package/dist/core/responseValidators/provider_accounts.cjs +2 -0
- package/dist/core/responseValidators/provider_accounts.d.cts +8 -0
- package/dist/core/responseValidators/providers-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/providers-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/providers.cjs +2 -0
- package/dist/core/responseValidators/providers.d.cts +1 -0
- package/dist/core/responseValidators/routing-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/routing-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/routing.cjs +2 -0
- package/dist/core/responseValidators/routing.d.cts +3 -0
- package/dist/core/responseValidators/sandboxes-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/sandboxes-diagnostics.d.cts +10 -0
- package/dist/core/responseValidators/sandboxes.cjs +2 -0
- package/dist/core/responseValidators/sandboxes.d.cts +10 -0
- package/dist/core/responseValidators/secrets-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/secrets-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/secrets.cjs +2 -0
- package/dist/core/responseValidators/secrets.d.cts +1 -0
- package/dist/core/responseValidators/spend_limits-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/spend_limits-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/spend_limits.cjs +2 -0
- package/dist/core/responseValidators/spend_limits.d.cts +3 -0
- package/dist/core/responseValidators/terminals-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/terminals-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/terminals.cjs +2 -0
- package/dist/core/responseValidators/terminals.d.cts +2 -0
- package/dist/core/responseValidators/usage-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/usage-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/usage.cjs +2 -0
- package/dist/core/responseValidators/usage.d.cts +1 -0
- package/dist/core/responseValidators/volumes-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/volumes-diagnostics.d.cts +10 -0
- package/dist/core/responseValidators/volumes.cjs +2 -0
- package/dist/core/responseValidators/volumes.d.cts +10 -0
- package/dist/core/serverSentEvents.gen.d.ts +21 -62
- package/dist/core/serverSentEvents.gen.js +297 -116
- package/dist/core/streamErrors.d.ts +32 -0
- package/dist/core/streamErrors.js +51 -0
- package/dist/core/types.gen.d.ts +2 -2
- package/dist/core/types.gen.js +2 -1
- package/dist/core/utils.gen.d.ts +1 -1
- package/dist/core/utils.gen.js +16 -10
- package/dist/creation.gen.d.ts +21 -0
- package/dist/creation.gen.js +35 -0
- package/dist/data-origin.d.ts +25 -0
- package/dist/data-origin.js +57 -0
- package/dist/error-codes.gen.d.ts +2 -0
- package/dist/error-codes.gen.js +2 -0
- package/dist/idempotency.gen.d.ts +1 -0
- package/dist/idempotency.gen.js +60 -0
- package/dist/images.d.ts +74 -0
- package/dist/images.js +88 -0
- package/dist/index.d.ts +22 -2
- package/dist/index.js +79 -1
- package/dist/launch-input.gen.d.ts +9 -0
- package/dist/launch-input.gen.js +83 -0
- package/dist/launch.d.ts +28 -0
- package/dist/launch.js +222 -0
- package/dist/namespace-actions.d.mts +307 -0
- package/dist/namespace-actions.mjs +595 -0
- package/dist/namespace-agents.d.mts +33 -0
- package/dist/namespace-agents.mjs +40 -0
- package/dist/namespace-artifacts.d.mts +46 -0
- package/dist/namespace-artifacts.mjs +69 -0
- package/dist/namespace-base.d.mts +7 -0
- package/dist/namespace-base.mjs +7 -0
- package/dist/namespace-commands.d.mts +57 -0
- package/dist/namespace-commands.mjs +57 -0
- package/dist/namespace-credits.d.mts +213 -0
- package/dist/namespace-credits.mjs +476 -0
- package/dist/namespace-files.d.mts +203 -0
- package/dist/namespace-files.mjs +334 -0
- package/dist/namespace-github.d.mts +50 -0
- package/dist/namespace-github.mjs +68 -0
- package/dist/namespace-images.d.mts +52 -0
- package/dist/namespace-images.mjs +78 -0
- package/dist/namespace-launch_runs.d.mts +89 -0
- package/dist/namespace-launch_runs.mjs +133 -0
- package/dist/namespace-launches.d.mts +89 -0
- package/dist/namespace-launches.mjs +133 -0
- package/dist/namespace-operations.d.mts +45 -0
- package/dist/namespace-operations.mjs +52 -0
- package/dist/namespace-previews.d.mts +79 -0
- package/dist/namespace-previews.mjs +101 -0
- package/dist/namespace-pricing.d.mts +31 -0
- package/dist/namespace-pricing.mjs +22 -0
- package/dist/namespace-processes.d.mts +125 -0
- package/dist/namespace-processes.mjs +184 -0
- package/dist/namespace-provider_accounts.d.mts +156 -0
- package/dist/namespace-provider_accounts.mjs +241 -0
- package/dist/namespace-providers.d.mts +28 -0
- package/dist/namespace-providers.mjs +24 -0
- package/dist/namespace-routing.d.mts +64 -0
- package/dist/namespace-routing.mjs +86 -0
- package/dist/namespace-sandboxes.d.mts +287 -0
- package/dist/namespace-sandboxes.mjs +402 -0
- package/dist/namespace-secrets.d.mts +46 -0
- package/dist/namespace-secrets.mjs +68 -0
- package/dist/namespace-spend_limits.d.mts +48 -0
- package/dist/namespace-spend_limits.mjs +70 -0
- package/dist/namespace-terminals.d.mts +112 -0
- package/dist/namespace-terminals.mjs +177 -0
- package/dist/namespace-usage.d.mts +46 -0
- package/dist/namespace-usage.mjs +53 -0
- package/dist/namespace-volumes.d.mts +110 -0
- package/dist/namespace-volumes.mjs +269 -0
- package/dist/operations.d.ts +14 -0
- package/dist/operations.js +31 -0
- package/dist/retry.d.ts +8 -0
- package/dist/retry.js +63 -0
- package/dist/routing-choices.gen.d.ts +132 -0
- package/dist/routing-choices.gen.js +136 -0
- package/dist/routing.d.ts +23 -0
- package/dist/routing.js +38 -0
- package/dist/sandbox-handle.gen.d.ts +8 -0
- package/dist/sandbox-handle.gen.js +14 -0
- package/dist/sandboxes.d.ts +213 -0
- package/dist/sandboxes.js +507 -0
- package/dist/sdk.gen.d.ts +2016 -12
- package/dist/sdk.gen.js +3862 -16
- package/dist/server-timing.d.ts +19 -0
- package/dist/server-timing.gen.d.ts +265 -0
- package/dist/server-timing.gen.js +254 -0
- package/dist/server-timing.js +421 -0
- package/dist/spend-limits.d.ts +17 -0
- package/dist/spend-limits.js +26 -0
- package/dist/telemetry.d.ts +51 -0
- package/dist/telemetry.gen.d.ts +1 -0
- package/dist/telemetry.gen.js +5 -0
- package/dist/telemetry.js +438 -0
- package/dist/terminal.d.ts +61 -0
- package/dist/terminal.js +266 -0
- package/dist/transfer.d.ts +75 -0
- package/dist/transfer.js +389 -0
- package/dist/types.gen.d.ts +14936 -110
- package/dist/types.gen.js +2 -1
- package/dist/user-agent.d.ts +2 -0
- package/dist/user-agent.js +18 -0
- package/dist/version.gen.d.ts +1 -0
- package/dist/version.gen.js +5 -0
- package/dist/volumes.d.ts +33 -0
- package/dist/volumes.js +221 -0
- package/dist/waits.d.ts +31 -0
- package/dist/waits.js +42 -0
- package/dist/workflow-policy.gen.d.ts +41 -0
- package/dist/workflow-policy.gen.js +45 -0
- package/package.json +124 -14
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.operations = void 0;
|
|
4
|
+
const loadValidators = () => import("../responseValidators/volumes.cjs").then(module => module.default);
|
|
5
|
+
const loadDiagnostics = () => import("../responseValidators/volumes-diagnostics.cjs").then(module => module.default);
|
|
6
|
+
exports.operations = { "GET /volumes": { responses: { "200": { "media": ["application/json"], "validator": "validate0" } }, completeErrors: { "400": false, "default": false }, loadValidators, loadDiagnostics },
|
|
7
|
+
"POST /volumes": { responses: { "201": { "media": ["application/json"], "validator": "validate1" } }, completeErrors: { "400": false, "409": false, "413": false, "default": false }, loadValidators, loadDiagnostics },
|
|
8
|
+
"GET /volumes/{volume_id}": { responses: { "200": { "media": ["application/json"], "validator": "validate2" } }, completeErrors: { "404": false, "default": false }, loadValidators, loadDiagnostics },
|
|
9
|
+
"DELETE /volumes/{volume_id}": { responses: { "204": { "media": [] } }, completeErrors: { "404": false, "409": false, "default": false } },
|
|
10
|
+
"GET /volumes/{volume_id}/checkpoints": { responses: { "200": { "media": ["application/json"], "validator": "validate3" } }, completeErrors: { "404": false, "default": false }, loadValidators, loadDiagnostics },
|
|
11
|
+
"POST /volumes/{volume_id}/checkpoints": { responses: { "201": { "media": ["application/json"], "validator": "validate4" } }, completeErrors: { "404": false, "409": false, "413": false, "502": false, "default": false }, loadValidators, loadDiagnostics },
|
|
12
|
+
"GET /volumes/{volume_id}/checkpoints/{checkpoint}": { responses: { "200": { "media": ["application/json"], "validator": "validate5" } }, completeErrors: { "404": false, "default": false }, loadValidators, loadDiagnostics },
|
|
13
|
+
"DELETE /volumes/{volume_id}/checkpoints/{checkpoint}": { responses: { "204": { "media": [] } }, completeErrors: { "404": false, "409": false, "default": false } },
|
|
14
|
+
"DELETE /volumes/{volume_id}/lease": { responses: { "204": { "media": [] } }, completeErrors: { "404": false, "409": false, "default": false } },
|
|
15
|
+
"POST /volumes/{volume_id}/uploads": { responses: { "201": { "media": ["application/json"], "validator": "validate6" } }, completeErrors: { "400": false, "404": false, "409": false, "413": false, "default": false }, loadValidators, loadDiagnostics },
|
|
16
|
+
"POST /volumes/{volume_id}/uploads/{upload_id}/complete": { responses: { "200": { "media": ["application/json"], "validator": "validate7" } }, completeErrors: { "400": false, "404": false, "409": false, "default": false }, loadValidators, loadDiagnostics },
|
|
17
|
+
"DELETE /volumes/{volume_id}/uploads/{upload_id}": { responses: { "204": { "media": [] } }, completeErrors: { "404": false, "default": false } },
|
|
18
|
+
"POST /volumes/{volume_id}/downloads": { responses: { "201": { "media": ["application/json"], "validator": "validate8" } }, completeErrors: { "400": false, "404": false, "default": false }, loadValidators, loadDiagnostics },
|
|
19
|
+
"GET /volumes/{volume_id}/files": { responses: { "200": { "media": ["application/json"], "validator": "validate9" } }, completeErrors: { "400": false, "404": false, "default": false }, loadValidators, loadDiagnostics } };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.responseContractLoaders = exports.responseGroups = void 0;
|
|
4
|
+
exports.responseGroups = { "GET /agents": "agents", "GET /agents/{name}": "agents", "POST /launches": "launches", "GET /launches/{operation_id}": "launches", "GET /launches/{operation_id}/settings": "launches", "GET /launches/{operation_id}/command": "launches", "GET /launch-runs": "launchRuns", "POST /launch-runs": "launchRuns", "GET /launch-runs/{run_id}": "launchRuns", "POST /launch-runs/{run_id}/stop": "launchRuns", "POST /launch-runs/{run_id}/copies/{copy_index}/destroy": "launchRuns", "GET /repositories/{owner}/{repo}/access": "launches", "GET /github/installations": "github", "DELETE /github/installations/{installation_id}": "github", "GET /github/repositories": "github", "GET /actions/repositories/{repository_id}": "actions", "PUT /actions/repositories/{repository_id}": "actions", "GET /routing/settings": "routing", "PUT /routing/settings": "routing", "GET /routing/preview": "routing", "GET /actions/readiness": "actions", "GET /actions/runner-catalog": "actions", "GET /actions/policies": "actions", "POST /actions/policies": "actions", "GET /actions/policies/{policy_id}": "actions", "PUT /actions/policies/{policy_id}": "actions", "DELETE /actions/policies/{policy_id}": "actions", "POST /actions/preview": "actions", "GET /actions/runs": "actions", "GET /actions/runs/facets": "actions", "GET /actions/pool-idle-time": "actions", "GET /actions/runs/{run_id}": "actions", "GET /actions/runs/{run_id}/jobs": "actions", "GET /actions/runs/{run_id}/placements": "actions", "GET /actions/jobs/{job_id}": "actions", "GET /actions/jobs/{job_id}/steps": "actions", "GET /actions/jobs/{job_id}/logs": "actions", "GET /actions/jobs/{job_id}/steps/{step_position}/logs": "actions", "GET /actions/jobs/{job_id}/events": "actions", "GET /actions/placements/{placement_id}": "actions", "POST /actions/runs/{run_id}/cancel": "actions", "POST /actions/runs/{run_id}/rerun": "actions", "POST /actions/runs/{run_id}/rerun-failed-jobs": "actions", "GET /operations": "operations", "POST /artifacts": "artifacts", "GET /artifacts/{artifact_id}": "artifacts", "DELETE /artifacts/{artifact_id}": "artifacts", "POST /images/prepare": "images", "GET /images/preparations": "images", "POST /images/unprepare": "images", "POST /sandboxes/{sandbox_id}/processes": "processes", "GET /sandboxes/{sandbox_id}/processes/{process_id}": "processes", "DELETE /sandboxes/{sandbox_id}/processes/{process_id}": "processes", "POST /sandboxes/{sandbox_id}/processes/{process_id}/stdin": "processes", "POST /sandboxes/{sandbox_id}/processes/{process_id}/stdin/close": "processes", "POST /sandboxes/{sandbox_id}/processes/{process_id}/cancel": "processes", "GET /credits": "credits", "GET /spend-limits": "spend_limits", "PUT /spend-limits/{scope}": "spend_limits", "DELETE /spend-limits/{scope}": "spend_limits", "POST /credits/purchases": "credits", "GET /credits/purchases": "credits", "POST /credits/purchases/quote": "credits", "GET /credits/usage": "credits", "GET /usage": "usage", "GET /usage.csv": "usage", "GET /credits/purchases/{purchase_id}": "credits", "POST /credits/purchases/{purchase_id}/cancel": "credits", "POST /credits/promotions": "credits", "GET /credits/promotions": "credits", "GET /credits/billing-details": "credits", "PUT /credits/billing-details": "credits", "GET /credits/alerts": "credits", "PUT /credits/alerts": "credits", "GET /credits/payment-methods": "credits", "POST /credits/payment-methods/setup": "credits", "POST /credits/payment-methods/setup-intent": "credits", "PUT /credits/payment-methods/order": "credits", "GET /credits/payment-method-setups/{setup_id}": "credits", "DELETE /credits/payment-methods/{payment_method_id}": "credits", "POST /credits/payment-methods/{payment_method_id}/default": "credits", "GET /credits/auto-top-up": "credits", "PUT /credits/auto-top-up": "credits", "POST /sandboxes/{sandbox_id}/terminals": "terminals", "GET /sandboxes/{sandbox_id}/terminals/{terminal_id}": "terminals", "GET /sandboxes/{sandbox_id}/terminals/{terminal_id}/events": "terminals", "POST /sandboxes/{sandbox_id}/terminals/{terminal_id}/input": "terminals", "POST /sandboxes/{sandbox_id}/terminals/{terminal_id}/resize": "terminals", "POST /sandboxes/{sandbox_id}/terminals/{terminal_id}/kill": "terminals", "GET /secrets": "secrets", "PUT /secrets/{name}": "secrets", "DELETE /secrets/{name}": "secrets", "GET /sandboxes/{sandbox_id}/previews": "previews", "POST /sandboxes/{sandbox_id}/previews": "previews", "DELETE /sandboxes/{sandbox_id}/previews/{preview_id}": "previews", "POST /sandboxes/{sandbox_id}/browser": "sandboxes", "POST /sandboxes/{sandbox_id}/pause": "sandboxes", "POST /sandboxes/{sandbox_id}/resume": "sandboxes", "POST /sandboxes/{sandbox_id}/lifetime": "sandboxes", "POST /sandboxes/{sandbox_id}/network-policy": "sandboxes", "POST /provider-accounts": "provider_accounts", "GET /provider-accounts": "provider_accounts", "POST /provider-accounts/test": "provider_accounts", "GET /provider-accounts/{account_id}": "provider_accounts", "DELETE /provider-accounts/{account_id}": "provider_accounts", "PUT /provider-accounts/{account_id}/credentials": "provider_accounts", "POST /provider-accounts/{account_id}/test": "provider_accounts", "POST /provider-accounts/{account_id}/standard-image/setup": "provider_accounts", "GET /operations/{operation_id}": "operations", "GET /volumes": "volumes", "POST /volumes": "volumes", "GET /volumes/{volume_id}": "volumes", "DELETE /volumes/{volume_id}": "volumes", "GET /volumes/{volume_id}/checkpoints": "volumes", "POST /volumes/{volume_id}/checkpoints": "volumes", "GET /volumes/{volume_id}/checkpoints/{checkpoint}": "volumes", "DELETE /volumes/{volume_id}/checkpoints/{checkpoint}": "volumes", "DELETE /volumes/{volume_id}/lease": "volumes", "POST /volumes/{volume_id}/uploads": "volumes", "POST /volumes/{volume_id}/uploads/{upload_id}/complete": "volumes", "DELETE /volumes/{volume_id}/uploads/{upload_id}": "volumes", "POST /volumes/{volume_id}/downloads": "volumes", "GET /volumes/{volume_id}/files": "volumes", "POST /sandboxes": "sandboxes", "GET /sandboxes": "sandboxes", "POST /sandboxes/match": "sandboxes", "GET /sandboxes/{sandbox_id}": "sandboxes", "DELETE /sandboxes/{sandbox_id}": "sandboxes", "POST /sandboxes/{sandbox_id}/commands": "commands", "GET /sandboxes/{sandbox_id}/files/content": "files", "PUT /sandboxes/{sandbox_id}/files/content": "files", "POST /sandboxes/{sandbox_id}/files/uploads": "files", "POST /sandboxes/{sandbox_id}/files/uploads/{upload_id}/complete": "files", "DELETE /sandboxes/{sandbox_id}/files/uploads/{upload_id}": "files", "POST /sandboxes/{sandbox_id}/files/downloads": "files", "GET /sandboxes/{sandbox_id}/files/directories": "files", "POST /sandboxes/{sandbox_id}/files/directories": "files", "GET /sandboxes/{sandbox_id}/files/exists": "files", "POST /sandboxes/{sandbox_id}/files/remove": "files", "GET /price-versions": "pricing", "GET /providers": "providers" };
|
|
5
|
+
exports.responseContractLoaders = { "agents": () => import("./responseContracts/agents.js").then(module => module.operations),
|
|
6
|
+
"launches": () => import("./responseContracts/launches.js").then(module => module.operations),
|
|
7
|
+
"launchRuns": () => import("./responseContracts/launchRuns.js").then(module => module.operations),
|
|
8
|
+
"github": () => import("./responseContracts/github.js").then(module => module.operations),
|
|
9
|
+
"actions": () => import("./responseContracts/actions.js").then(module => module.operations),
|
|
10
|
+
"routing": () => import("./responseContracts/routing.js").then(module => module.operations),
|
|
11
|
+
"operations": () => import("./responseContracts/operations.js").then(module => module.operations),
|
|
12
|
+
"artifacts": () => import("./responseContracts/artifacts.js").then(module => module.operations),
|
|
13
|
+
"images": () => import("./responseContracts/images.js").then(module => module.operations),
|
|
14
|
+
"processes": () => import("./responseContracts/processes.js").then(module => module.operations),
|
|
15
|
+
"credits": () => import("./responseContracts/credits.js").then(module => module.operations),
|
|
16
|
+
"spend_limits": () => import("./responseContracts/spend_limits.js").then(module => module.operations),
|
|
17
|
+
"usage": () => import("./responseContracts/usage.js").then(module => module.operations),
|
|
18
|
+
"terminals": () => import("./responseContracts/terminals.js").then(module => module.operations),
|
|
19
|
+
"secrets": () => import("./responseContracts/secrets.js").then(module => module.operations),
|
|
20
|
+
"previews": () => import("./responseContracts/previews.js").then(module => module.operations),
|
|
21
|
+
"sandboxes": () => import("./responseContracts/sandboxes.js").then(module => module.operations),
|
|
22
|
+
"provider_accounts": () => import("./responseContracts/provider_accounts.js").then(module => module.operations),
|
|
23
|
+
"volumes": () => import("./responseContracts/volumes.js").then(module => module.operations),
|
|
24
|
+
"commands": () => import("./responseContracts/commands.js").then(module => module.operations),
|
|
25
|
+
"files": () => import("./responseContracts/files.js").then(module => module.operations),
|
|
26
|
+
"pricing": () => import("./responseContracts/pricing.js").then(module => module.operations),
|
|
27
|
+
"providers": () => import("./responseContracts/providers.js").then(module => module.operations) };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type ResponseBodyMode<Body, Mode extends boolean> = Body extends unknown ? Omit<Body, 'stream'> & {
|
|
2
|
+
stream?: Mode;
|
|
3
|
+
} : never;
|
|
4
|
+
export type ResponseModeOptions<T extends {
|
|
5
|
+
body: {
|
|
6
|
+
stream?: boolean;
|
|
7
|
+
};
|
|
8
|
+
}, Mode extends boolean> = Omit<T, 'body'> & {
|
|
9
|
+
body: ResponseBodyMode<T['body'], Mode>;
|
|
10
|
+
};
|
|
11
|
+
/** A named response variant must select the matching server-side behavior. */
|
|
12
|
+
export declare function withResponseMode<T extends {
|
|
13
|
+
body: {
|
|
14
|
+
stream?: boolean;
|
|
15
|
+
};
|
|
16
|
+
headers?: Config['headers'];
|
|
17
|
+
}>(options: T, stream: boolean): T;
|
|
18
|
+
import type { Config } from './types.gen';
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withResponseMode = withResponseMode;
|
|
4
|
+
/** A named response variant must select the matching server-side behavior. */
|
|
5
|
+
function withResponseMode(options, stream) {
|
|
6
|
+
if (options.body.stream !== undefined && options.body.stream !== stream) {
|
|
7
|
+
throw new TypeError(`This method requires stream=${stream}`);
|
|
8
|
+
}
|
|
9
|
+
const headers = (0, client_1.mergeHeaders)(options.headers);
|
|
10
|
+
headers.set('Accept', stream ? 'text/event-stream' : 'application/json');
|
|
11
|
+
return { ...options, body: { ...options.body, stream }, headers: Object.fromEntries(headers) };
|
|
12
|
+
}
|
|
13
|
+
const client_1 = require("../client");
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type ResponseSchemaDiagnostic } from '../api-error';
|
|
2
|
+
import type { RequestTrace } from '../telemetry';
|
|
3
|
+
type Contracts = Record<string, ResponseOperation>;
|
|
4
|
+
type ContractIndex = {
|
|
5
|
+
groups: Record<string, string>;
|
|
6
|
+
loaders: Record<string, () => Promise<Contracts>>;
|
|
7
|
+
};
|
|
8
|
+
type ValidatorIssue = Pick<ResponseSchemaDiagnostic, 'keyword' | 'instancePath' | 'schemaPath'>;
|
|
9
|
+
type Validator = ((value: unknown) => boolean) & {
|
|
10
|
+
errors?: readonly ValidatorIssue[] | null;
|
|
11
|
+
};
|
|
12
|
+
type Validators = Record<string, Validator>;
|
|
13
|
+
export type ResponseContract = Record<string, {
|
|
14
|
+
media: string[];
|
|
15
|
+
validator?: string;
|
|
16
|
+
}>;
|
|
17
|
+
export type ResponseOperation = {
|
|
18
|
+
responses: ResponseContract;
|
|
19
|
+
completeErrors: Record<string, boolean>;
|
|
20
|
+
loadValidators?: () => Promise<Validators>;
|
|
21
|
+
loadDiagnostics?: () => Promise<Validators>;
|
|
22
|
+
};
|
|
23
|
+
type Prepared = {
|
|
24
|
+
contract?: ResponseContract;
|
|
25
|
+
completeErrors?: Record<string, boolean>;
|
|
26
|
+
validators?: Validators;
|
|
27
|
+
loadDiagnostics?: () => Promise<Validators>;
|
|
28
|
+
};
|
|
29
|
+
type ParseAs = 'arrayBuffer' | 'auto' | 'binaryStream' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
30
|
+
/** Missing contract or validator chunks fail before an operation can dispatch. */
|
|
31
|
+
export declare function prepareResponseValidation(method: string | undefined, path: string, signal?: AbortSignal | null, index?: ContractIndex): Promise<Prepared>;
|
|
32
|
+
/**
|
|
33
|
+
* Canonical media selects validation; caller parsing options cannot disable it. Only a caller
|
|
34
|
+
* that parses JSON can omit the trace; every other parse mode may stream and must provide one.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseValidatedResponse(response: Response, request: Request, prepared: Prepared, parseAs: 'json', telemetry?: RequestTrace): Promise<{
|
|
37
|
+
data: unknown;
|
|
38
|
+
isJson: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
export declare function parseValidatedResponse(response: Response, request: Request, prepared: Prepared, parseAs: ParseAs, telemetry: RequestTrace): Promise<{
|
|
41
|
+
data: unknown;
|
|
42
|
+
isJson: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareResponseValidation = prepareResponseValidation;
|
|
4
|
+
exports.parseValidatedResponse = parseValidatedResponse;
|
|
5
|
+
const workflow_policy_gen_1 = require("../workflow-policy.gen");
|
|
6
|
+
const api_1 = require("@opentelemetry/api");
|
|
7
|
+
const api_error_1 = require("../api-error");
|
|
8
|
+
const json_1 = require("./json");
|
|
9
|
+
const responseContracts_gen_1 = require("./responseContracts.gen");
|
|
10
|
+
const mainIndex = { groups: responseContracts_gen_1.responseGroups, loaders: responseContracts_gen_1.responseContractLoaders };
|
|
11
|
+
// Each index caches its own namespaces, so two indexes can share a group name.
|
|
12
|
+
const caches = new WeakMap();
|
|
13
|
+
/** Settle with the caller's cancellation without cancelling the shared load. */
|
|
14
|
+
async function untilAborted(pending, signal) {
|
|
15
|
+
if (!signal)
|
|
16
|
+
return pending;
|
|
17
|
+
let abort;
|
|
18
|
+
try {
|
|
19
|
+
return await Promise.race([pending, new Promise((_, reject) => {
|
|
20
|
+
signal.addEventListener('abort', abort = () => reject(signal.reason));
|
|
21
|
+
})]);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
signal.removeEventListener('abort', abort);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Missing contract or validator chunks fail before an operation can dispatch. */
|
|
28
|
+
async function prepareResponseValidation(method, path, signal, index = mainIndex) {
|
|
29
|
+
signal?.throwIfAborted();
|
|
30
|
+
const key = `${method} ${path}`;
|
|
31
|
+
const group = index.groups[key];
|
|
32
|
+
const loadContracts = group && index.loaders[group];
|
|
33
|
+
const contracts = caches.get(index) ?? new Map();
|
|
34
|
+
caches.set(index, contracts);
|
|
35
|
+
let operation;
|
|
36
|
+
const parent = api_1.context.active();
|
|
37
|
+
if (loadContracts) {
|
|
38
|
+
// A namespace's contracts load once and callers share the load; later calls add no asynchronous hop.
|
|
39
|
+
let loaded = contracts.get(group);
|
|
40
|
+
if (!loaded) {
|
|
41
|
+
contracts.set(group, loaded = loadContracts().then(table => { contracts.set(group, table); return table; }, error => { contracts.delete(group); throw error; }));
|
|
42
|
+
}
|
|
43
|
+
operation = (loaded.then ? await untilAborted(loaded, signal) : loaded)[key];
|
|
44
|
+
}
|
|
45
|
+
const validators = operation?.loadValidators && await untilAborted(operation.loadValidators(), signal);
|
|
46
|
+
return api_1.context.with(parent, () => ({ contract: operation?.responses, completeErrors: operation?.completeErrors,
|
|
47
|
+
validators, loadDiagnostics: operation?.loadDiagnostics }));
|
|
48
|
+
}
|
|
49
|
+
/** Retain declared complete errors or bounded diagnostics, plus mutation identity on disconnect. */
|
|
50
|
+
async function responseError(response, request, invalid, complete) {
|
|
51
|
+
const reader = response.body?.getReader();
|
|
52
|
+
const chunks = [];
|
|
53
|
+
const limit = complete ? Infinity : workflow_policy_gen_1.MAX_ERROR_BYTES;
|
|
54
|
+
let length = 0;
|
|
55
|
+
const abort = () => { void reader?.cancel(request.signal.reason).catch(() => { }); };
|
|
56
|
+
request.signal.addEventListener('abort', abort, { once: true });
|
|
57
|
+
try {
|
|
58
|
+
if (request.signal.aborted)
|
|
59
|
+
abort();
|
|
60
|
+
if (reader) {
|
|
61
|
+
while (true) {
|
|
62
|
+
const { done, value } = await reader.read();
|
|
63
|
+
if (done)
|
|
64
|
+
break;
|
|
65
|
+
const chunk = complete ? value : value.slice(0, limit - length);
|
|
66
|
+
chunks.push(chunk);
|
|
67
|
+
length += chunk.byteLength;
|
|
68
|
+
if (length === limit)
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// The received HTTP status and request still provide recovery context.
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
request.signal.removeEventListener('abort', abort);
|
|
78
|
+
if (reader) {
|
|
79
|
+
await reader.cancel().catch(() => { });
|
|
80
|
+
reader.releaseLock();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const buffer = new Uint8Array(length);
|
|
84
|
+
let offset = 0;
|
|
85
|
+
for (const chunk of chunks) {
|
|
86
|
+
buffer.set(chunk, offset);
|
|
87
|
+
offset += chunk.byteLength;
|
|
88
|
+
}
|
|
89
|
+
let payload;
|
|
90
|
+
try {
|
|
91
|
+
payload = (0, json_1.parseJson)(new TextDecoder().decode(buffer.subarray(0, length)));
|
|
92
|
+
}
|
|
93
|
+
catch { /* No JSON envelope. */ }
|
|
94
|
+
if (invalid)
|
|
95
|
+
return (0, api_error_1.invalidResponse)(response, request, payload);
|
|
96
|
+
return new api_error_1.APIError(payload, response, request);
|
|
97
|
+
}
|
|
98
|
+
/** Binary streaming reports through the request's trace; a caller without one cannot stream. */
|
|
99
|
+
function streamTrace(telemetry) {
|
|
100
|
+
if (!telemetry)
|
|
101
|
+
throw new TypeError('Streaming a response requires a request trace');
|
|
102
|
+
return telemetry;
|
|
103
|
+
}
|
|
104
|
+
async function parseValidatedResponse(response, request, prepared, parseAs, telemetry) {
|
|
105
|
+
const declaration = prepared.contract?.[String(response.status)];
|
|
106
|
+
const media = response.headers.get('content-type')?.split(';', 1)[0].trim().toLowerCase() ?? '';
|
|
107
|
+
if (!response.ok || (prepared.contract && !declaration) ||
|
|
108
|
+
(declaration?.media.length && !declaration.media.includes(media))) {
|
|
109
|
+
const status = String(response.status);
|
|
110
|
+
const complete = !response.ok && media === 'application/json' &&
|
|
111
|
+
(prepared.completeErrors?.[status] ?? prepared.completeErrors?.default) === true;
|
|
112
|
+
throw await responseError(response, request, response.ok, complete);
|
|
113
|
+
}
|
|
114
|
+
if (response.status === 204 || declaration?.media.length === 0)
|
|
115
|
+
return { data: undefined, isJson: false };
|
|
116
|
+
const json = media === 'application/json' && declaration?.validator !== undefined;
|
|
117
|
+
const mode = parseAs === 'auto' || parseAs === 'binaryStream' || parseAs === undefined
|
|
118
|
+
? (media === 'application/json' ? 'json' : parseAs === 'binaryStream' ? 'stream'
|
|
119
|
+
: media.startsWith('text/') ? 'text' : 'blob') : parseAs;
|
|
120
|
+
// A missing trace is a caller error, not an invalid response, so it must not reach the catch below.
|
|
121
|
+
const trace = mode === 'stream' ? streamTrace(telemetry) : undefined;
|
|
122
|
+
if (json || mode === 'json') {
|
|
123
|
+
let text;
|
|
124
|
+
let data;
|
|
125
|
+
let unknownKind = false;
|
|
126
|
+
let schemaDiagnostics;
|
|
127
|
+
try {
|
|
128
|
+
text = await response.text();
|
|
129
|
+
data = (0, json_1.parseJson)(text);
|
|
130
|
+
if (json) {
|
|
131
|
+
const validate = prepared.validators[declaration.validator];
|
|
132
|
+
if (!validate(data)) {
|
|
133
|
+
const detailed = prepared.loadDiagnostics
|
|
134
|
+
? (await prepared.loadDiagnostics())[declaration.validator] : validate;
|
|
135
|
+
if (detailed !== validate)
|
|
136
|
+
detailed(data);
|
|
137
|
+
// An enum/constant failure identifies a closed vocabulary mismatch, not an unknown
|
|
138
|
+
// record kind. In particular, a legacy/current response union can fail because a
|
|
139
|
+
// nested closed field has a future value.
|
|
140
|
+
const errors = detailed.errors ?? [];
|
|
141
|
+
schemaDiagnostics = errors;
|
|
142
|
+
const failedRecordUnion = errors.some(({ keyword, instancePath }) => (keyword === 'anyOf' || keyword === 'oneOf') && isRecord(pointerValue(data, instancePath)) &&
|
|
143
|
+
!errors.some(error => (error.keyword === 'anyOf' || error.keyword === 'oneOf') &&
|
|
144
|
+
error.instancePath !== instancePath && !isRecord(pointerValue(data, error.instancePath))));
|
|
145
|
+
const hasClosedValueFailure = errors.some(({ keyword }) => keyword === 'enum' || keyword === 'const');
|
|
146
|
+
unknownKind = failedRecordUnion && !hasClosedValueFailure;
|
|
147
|
+
throw new TypeError('Invalid schema');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
throw (0, api_error_1.invalidResponse)(response, request, data, unknownKind, schemaDiagnostics);
|
|
153
|
+
}
|
|
154
|
+
if (mode === 'json')
|
|
155
|
+
return { data, isJson: true };
|
|
156
|
+
const buffered = new Response(text, { headers: response.headers });
|
|
157
|
+
return { data: mode === 'stream' ? (await import('./binaryStream.js')).binaryStream(buffered.body, response, request, trace)
|
|
158
|
+
: await buffered[mode](), isJson: false };
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
return { data: mode === 'stream' ? (await import('./binaryStream.js')).binaryStream(response.body, response, request, trace)
|
|
162
|
+
: await response[mode](), isJson: false };
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
throw (0, api_error_1.invalidResponse)(response, request);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function pointerValue(value, pointer) {
|
|
169
|
+
return pointer.split('/').slice(1).reduce((node, key) => node !== null && typeof node === 'object'
|
|
170
|
+
? node[key.replaceAll('~1', '/').replaceAll('~0', '~')] : undefined, value);
|
|
171
|
+
}
|
|
172
|
+
function isRecord(value) {
|
|
173
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
174
|
+
}
|