@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
package/dist/types.gen.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.userAgent = void 0;
|
|
4
|
+
exports.appendUserAgentSuffix = appendUserAgentSuffix;
|
|
5
|
+
const workflow_policy_gen_1 = require("./workflow-policy.gen");
|
|
6
|
+
const version_gen_1 = require("./version.gen");
|
|
7
|
+
exports.userAgent = `boxrouter-typescript/${version_gen_1.sdkVersion}`;
|
|
8
|
+
function appendUserAgentSuffix(value, suffix) {
|
|
9
|
+
if (!suffix || (workflow_policy_gen_1.USER_AGENT_SUFFIX_REQUIRE_NON_SPACE && !suffix.trim()) || suffix.length > workflow_policy_gen_1.USER_AGENT_SUFFIX_MAX_CHARACTERS || /[^\x20-\x7e]/.test(suffix)) {
|
|
10
|
+
throw new TypeError(`User-Agent suffix must be 1–${workflow_policy_gen_1.USER_AGENT_SUFFIX_MAX_CHARACTERS} printable ASCII characters${workflow_policy_gen_1.USER_AGENT_SUFFIX_REQUIRE_NON_SPACE ? ' and include a non-space character' : ''}`);
|
|
11
|
+
}
|
|
12
|
+
if (value.endsWith(` ${suffix}`))
|
|
13
|
+
return value;
|
|
14
|
+
const result = `${value} ${suffix}`;
|
|
15
|
+
if (result.length > workflow_policy_gen_1.USER_AGENT_MAX_CHARACTERS)
|
|
16
|
+
throw new TypeError(`User-Agent must be at most ${workflow_policy_gen_1.USER_AGENT_MAX_CHARACTERS} characters`);
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sdkVersion = "0.12.190";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { BoxRouterApi } from './sdk.gen';
|
|
2
|
+
import type { CreateVolume, Volume, VolumeFile, VolumesDeleteCheckpointData, VolumesGetCheckpointData, VolumesListData, VolumeCheckpoint, VolumeCheckpointPage, VolumePage } from './types.gen';
|
|
3
|
+
import { type VolumeSaveArguments } from './creation.gen';
|
|
4
|
+
import { type MutationOptions, type RequestOptions } from './sandboxes';
|
|
5
|
+
import { type TransferProgress } from './transfer';
|
|
6
|
+
export interface VolumeUploadOptions extends MutationOptions {
|
|
7
|
+
concurrency?: number;
|
|
8
|
+
progress?: TransferProgress;
|
|
9
|
+
}
|
|
10
|
+
type UploadSource = string | Blob | Uint8Array;
|
|
11
|
+
/** Workspace-level persistent volumes and their immutable checkpoints. */
|
|
12
|
+
export declare class VolumeResources {
|
|
13
|
+
private readonly api;
|
|
14
|
+
constructor(api: BoxRouterApi);
|
|
15
|
+
create(body: CreateVolume, options?: MutationOptions): Promise<Volume>;
|
|
16
|
+
list(options?: RequestOptions & NonNullable<VolumesListData['query']>): Promise<VolumePage>;
|
|
17
|
+
get(id: string, options?: RequestOptions): Promise<Volume>;
|
|
18
|
+
listCheckpoints(id: string, options?: RequestOptions): Promise<VolumeCheckpointPage>;
|
|
19
|
+
getCheckpoint(id: string, checkpoint: VolumesGetCheckpointData['path']['checkpoint'], options?: RequestOptions): Promise<VolumeCheckpoint>;
|
|
20
|
+
save(id: string, ...[body, options]: VolumeSaveArguments): Promise<VolumeCheckpoint>;
|
|
21
|
+
deleteCheckpoint(id: string, checkpoint: VolumesDeleteCheckpointData['path']['checkpoint'], options?: MutationOptions): Promise<void>;
|
|
22
|
+
release(id: string, options?: MutationOptions): Promise<void>;
|
|
23
|
+
/** Upload one file or every regular file in a local directory to the volume head. */
|
|
24
|
+
upload(id: string, source: UploadSource, path?: string, options?: VolumeUploadOptions): Promise<void>;
|
|
25
|
+
/** Download one file to disk, or return its stream; a trailing slash or empty path selects a prefix. */
|
|
26
|
+
download(id: string, path: string, destination?: string): Promise<ReadableStream<Uint8Array> | void>;
|
|
27
|
+
/** Iterate over every file in path order, following the API's opaque pagination cursor. */
|
|
28
|
+
listFiles(id: string, options?: {
|
|
29
|
+
prefix?: string;
|
|
30
|
+
}): AsyncGenerator<VolumeFile>;
|
|
31
|
+
delete(id: string, options?: MutationOptions): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
package/dist/volumes.js
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VolumeResources = void 0;
|
|
4
|
+
const creation_gen_1 = require("./creation.gen");
|
|
5
|
+
const sandboxes_1 = require("./sandboxes");
|
|
6
|
+
const transfer_1 = require("./transfer");
|
|
7
|
+
const MAX_PATH_BYTES = 1024;
|
|
8
|
+
function operationMutationOptions(options, fileIndex, operation) {
|
|
9
|
+
const key = options.idempotencyKey;
|
|
10
|
+
if (key === undefined)
|
|
11
|
+
return (0, sandboxes_1.mutationOptions)(options);
|
|
12
|
+
const suffix = `:${fileIndex}:${operation}`;
|
|
13
|
+
return (0, sandboxes_1.mutationOptions)({ ...options, idempotencyKey: `${key.slice(0, 128 - suffix.length)}${suffix}` });
|
|
14
|
+
}
|
|
15
|
+
function validateVolumePath(path) {
|
|
16
|
+
if (path.length === 0 || path.startsWith('/') || path.includes('\0') ||
|
|
17
|
+
new TextEncoder().encode(path).byteLength > MAX_PATH_BYTES ||
|
|
18
|
+
path.split('/').some(segment => segment.length === 0 || segment === '.' || segment === '..')) {
|
|
19
|
+
throw new TypeError(`Invalid volume file path: ${JSON.stringify(path)}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function pathEscapes(root, target, relative, sep) {
|
|
23
|
+
const value = relative(root, target);
|
|
24
|
+
return value === '..' || value.startsWith(`..${sep}`) || value.startsWith(sep);
|
|
25
|
+
}
|
|
26
|
+
async function uploadEntries(source, targetPath) {
|
|
27
|
+
if (typeof source !== 'string') {
|
|
28
|
+
if (targetPath === undefined)
|
|
29
|
+
throw new TypeError('path is required when uploading a Blob or Uint8Array');
|
|
30
|
+
validateVolumePath(targetPath);
|
|
31
|
+
return [{ source, path: targetPath, size: source instanceof Blob ? source.size : source.byteLength }];
|
|
32
|
+
}
|
|
33
|
+
const fs = await import('node:fs/promises');
|
|
34
|
+
const paths = await import('node:path');
|
|
35
|
+
const info = await fs.stat(source);
|
|
36
|
+
if (info.isFile()) {
|
|
37
|
+
const target = targetPath ?? paths.basename(source);
|
|
38
|
+
validateVolumePath(target);
|
|
39
|
+
return [{ source, path: target, size: info.size }];
|
|
40
|
+
}
|
|
41
|
+
if (!info.isDirectory())
|
|
42
|
+
throw new TypeError('source must be a file, directory, Blob, or Uint8Array');
|
|
43
|
+
const rootName = paths.basename(paths.resolve(source));
|
|
44
|
+
const destinationRoot = (targetPath || rootName).replace(/\/+$/, '');
|
|
45
|
+
const entries = [];
|
|
46
|
+
const walk = async (directory) => {
|
|
47
|
+
const children = await fs.readdir(directory, { withFileTypes: true });
|
|
48
|
+
children.sort((left, right) => left.name.localeCompare(right.name));
|
|
49
|
+
for (const child of children) {
|
|
50
|
+
const absolute = paths.join(directory, child.name);
|
|
51
|
+
if (child.isDirectory()) {
|
|
52
|
+
await walk(absolute);
|
|
53
|
+
}
|
|
54
|
+
else if (child.isFile()) {
|
|
55
|
+
const relative = paths.relative(source, absolute).split(paths.sep).join('/');
|
|
56
|
+
const target = `${destinationRoot}/${relative}`;
|
|
57
|
+
validateVolumePath(target);
|
|
58
|
+
const file = await fs.stat(absolute);
|
|
59
|
+
entries.push({ source: absolute, path: target, size: file.size });
|
|
60
|
+
}
|
|
61
|
+
else if (child.isSymbolicLink()) {
|
|
62
|
+
const linked = await fs.stat(absolute);
|
|
63
|
+
if (linked.isFile()) {
|
|
64
|
+
const relative = paths.relative(source, absolute).split(paths.sep).join('/');
|
|
65
|
+
const target = `${destinationRoot}/${relative}`;
|
|
66
|
+
validateVolumePath(target);
|
|
67
|
+
entries.push({ source: absolute, path: target, size: linked.size });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
await walk(source);
|
|
73
|
+
return entries;
|
|
74
|
+
}
|
|
75
|
+
async function uploadFile(api, id, entry, concurrency, options, fileIndex) {
|
|
76
|
+
const source = await (0, transfer_1.openSource)({ source: entry.source, size: entry.size }, options.signal);
|
|
77
|
+
try {
|
|
78
|
+
const session = await api.volumes.createUpload({ path: { volume_id: id }, body: { path: entry.path, size: entry.size },
|
|
79
|
+
...operationMutationOptions(options, fileIndex, 'create') });
|
|
80
|
+
try {
|
|
81
|
+
// An Archil part PUT replaces the earlier copy of the part, so a part may be sent again.
|
|
82
|
+
const sent = await (0, transfer_1.sendParts)(source, session.parts, { concurrency, replayParts: true, label: 'Volume',
|
|
83
|
+
progress: options.progress, signal: options.signal });
|
|
84
|
+
// Volume completion needs every part's ETag; the engine itself does not.
|
|
85
|
+
const parts = sent.map(({ number, etag }) => {
|
|
86
|
+
if (!etag)
|
|
87
|
+
throw new Error('Volume upload part response did not include an ETag');
|
|
88
|
+
return { number, etag };
|
|
89
|
+
});
|
|
90
|
+
await (0, transfer_1.retryCompletion)(key => api.volumes.completeUpload({ path: { volume_id: id, upload_id: session.id }, body: { parts },
|
|
91
|
+
...(key === undefined ? operationMutationOptions(options, fileIndex, 'complete')
|
|
92
|
+
: (0, sandboxes_1.mutationOptions)({ signal: options.signal, idempotencyKey: key })) }), options.signal);
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
try {
|
|
96
|
+
await api.volumes.abortUpload({ path: { volume_id: id, upload_id: session.id },
|
|
97
|
+
...operationMutationOptions({ ...options, signal: undefined }, fileIndex, 'abort') });
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
// Preserve the failure that caused cleanup.
|
|
101
|
+
}
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
await source.close();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** Workspace-level persistent volumes and their immutable checkpoints. */
|
|
110
|
+
class VolumeResources {
|
|
111
|
+
api;
|
|
112
|
+
constructor(api) {
|
|
113
|
+
this.api = api;
|
|
114
|
+
}
|
|
115
|
+
async create(body, options = {}) {
|
|
116
|
+
return this.api.volumes.create({ body, ...(0, sandboxes_1.mutationOptions)(options) });
|
|
117
|
+
}
|
|
118
|
+
async list(options = {}) {
|
|
119
|
+
const { signal, ...query } = options;
|
|
120
|
+
return this.api.volumes.list({ query, signal });
|
|
121
|
+
}
|
|
122
|
+
async get(id, options = {}) {
|
|
123
|
+
return this.api.volumes.get({ path: { volume_id: id }, signal: options.signal });
|
|
124
|
+
}
|
|
125
|
+
async listCheckpoints(id, options = {}) {
|
|
126
|
+
return this.api.volumes.listCheckpoints({ path: { volume_id: id }, signal: options.signal });
|
|
127
|
+
}
|
|
128
|
+
async getCheckpoint(id, checkpoint, options = {}) {
|
|
129
|
+
return this.api.volumes.getCheckpoint({ path: { volume_id: id, checkpoint }, signal: options.signal });
|
|
130
|
+
}
|
|
131
|
+
async save(id, ...[body, options = {}]) {
|
|
132
|
+
return this.api.volumes.save({ path: { volume_id: id }, body: (0, creation_gen_1.volumeSaveBody)(body), ...(0, sandboxes_1.mutationOptions)(options) });
|
|
133
|
+
}
|
|
134
|
+
async deleteCheckpoint(id, checkpoint, options = {}) {
|
|
135
|
+
await this.api.volumes.deleteCheckpoint({ path: { volume_id: id, checkpoint }, ...(0, sandboxes_1.mutationOptions)(options) });
|
|
136
|
+
}
|
|
137
|
+
async release(id, options = {}) {
|
|
138
|
+
await this.api.volumes.release({ path: { volume_id: id }, ...(0, sandboxes_1.mutationOptions)(options) });
|
|
139
|
+
}
|
|
140
|
+
/** Upload one file or every regular file in a local directory to the volume head. */
|
|
141
|
+
async upload(id, source, path, options = {}) {
|
|
142
|
+
const entries = await uploadEntries(source, path);
|
|
143
|
+
const concurrency = options.concurrency ?? 4;
|
|
144
|
+
if (!Number.isInteger(concurrency) || concurrency < 1)
|
|
145
|
+
throw new TypeError('concurrency must be a positive integer');
|
|
146
|
+
for (const [index, entry] of entries.entries())
|
|
147
|
+
await uploadFile(this.api, id, entry, concurrency, options, index);
|
|
148
|
+
}
|
|
149
|
+
/** Download one file to disk, or return its stream; a trailing slash or empty path selects a prefix. */
|
|
150
|
+
async download(id, path, destination) {
|
|
151
|
+
const prefix = path === '' || path.endsWith('/');
|
|
152
|
+
if (!prefix)
|
|
153
|
+
validateVolumePath(path);
|
|
154
|
+
if (prefix && destination === undefined)
|
|
155
|
+
throw new TypeError('destination is required for a volume prefix download');
|
|
156
|
+
if (!prefix) {
|
|
157
|
+
const link = await this.api.volumes.createDownload({ path: { volume_id: id }, body: { path } });
|
|
158
|
+
if (destination === undefined)
|
|
159
|
+
return (0, transfer_1.downloadStream)(link, { label: 'Volume' });
|
|
160
|
+
await (0, transfer_1.downloadToFile)(link, destination, { label: 'Volume' });
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const fs = await import('node:fs/promises');
|
|
164
|
+
const paths = await import('node:path');
|
|
165
|
+
const root = paths.resolve(destination);
|
|
166
|
+
await fs.mkdir(root, { recursive: true });
|
|
167
|
+
const realRoot = await fs.realpath(root);
|
|
168
|
+
const prefixPath = path;
|
|
169
|
+
for await (const file of this.listFiles(id, { prefix: prefixPath })) {
|
|
170
|
+
const relative = prefixPath === '' ? file.path : file.path.startsWith(prefixPath) ? file.path.slice(prefixPath.length) : '';
|
|
171
|
+
if (relative === '')
|
|
172
|
+
throw new Error(`Volume file path is outside requested prefix: ${file.path}`);
|
|
173
|
+
validateVolumePath(relative);
|
|
174
|
+
const target = paths.resolve(realRoot, ...relative.split('/'));
|
|
175
|
+
if (pathEscapes(realRoot, target, paths.relative, paths.sep)) {
|
|
176
|
+
throw new Error(`Volume file path would escape destination: ${file.path}`);
|
|
177
|
+
}
|
|
178
|
+
const segments = relative.split('/');
|
|
179
|
+
let parent = realRoot;
|
|
180
|
+
for (const segment of segments.slice(0, -1)) {
|
|
181
|
+
parent = paths.join(parent, segment);
|
|
182
|
+
try {
|
|
183
|
+
const info = await fs.lstat(parent);
|
|
184
|
+
if (info.isSymbolicLink() || !info.isDirectory())
|
|
185
|
+
throw new Error(`Volume destination is not a directory: ${parent}`);
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
if (error && typeof error === 'object' && 'code' in error && error.code === 'ENOENT')
|
|
189
|
+
await fs.mkdir(parent);
|
|
190
|
+
else
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const targetInfo = await fs.lstat(target).catch(error => {
|
|
195
|
+
if (error && typeof error === 'object' && 'code' in error && error.code === 'ENOENT')
|
|
196
|
+
return undefined;
|
|
197
|
+
throw error;
|
|
198
|
+
});
|
|
199
|
+
if (targetInfo?.isSymbolicLink())
|
|
200
|
+
throw new Error(`Volume destination is a symbolic link: ${target}`);
|
|
201
|
+
const link = await this.api.volumes.createDownload({ path: { volume_id: id }, body: { path: file.path } });
|
|
202
|
+
await (0, transfer_1.downloadToFile)(link, target, { label: 'Volume' });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/** Iterate over every file in path order, following the API's opaque pagination cursor. */
|
|
206
|
+
async *listFiles(id, options = {}) {
|
|
207
|
+
let cursor;
|
|
208
|
+
do {
|
|
209
|
+
const page = await this.api.volumes.listFiles({ path: { volume_id: id }, query: {
|
|
210
|
+
...(options.prefix === undefined ? {} : { prefix: options.prefix }),
|
|
211
|
+
...(cursor === undefined ? {} : { cursor }),
|
|
212
|
+
} });
|
|
213
|
+
yield* page.data;
|
|
214
|
+
cursor = page.next_cursor ?? undefined;
|
|
215
|
+
} while (cursor !== undefined);
|
|
216
|
+
}
|
|
217
|
+
async delete(id, options = {}) {
|
|
218
|
+
await this.api.volumes.delete({ path: { volume_id: id }, ...(0, sandboxes_1.mutationOptions)(options) });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.VolumeResources = VolumeResources;
|
package/dist/waits.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** A wait the SDK owns was still pending when its bound ran out. The work continues on BoxRouter. */
|
|
2
|
+
export declare class WaitTimeoutError extends Error {
|
|
3
|
+
/** The id to read for the current state: an operation, launch or image. */
|
|
4
|
+
readonly id: string;
|
|
5
|
+
constructor(id: string, message: string);
|
|
6
|
+
}
|
|
7
|
+
export interface WaitTiming {
|
|
8
|
+
intervalSeconds: number;
|
|
9
|
+
boundSeconds: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The clock and the declared timing every SDK-owned wait uses. Internal: tests replace these members to
|
|
13
|
+
* run waits without real sleeping; nothing here is exported from the package entry.
|
|
14
|
+
*/
|
|
15
|
+
export declare const waitHooks: {
|
|
16
|
+
/** Seconds on a monotonic clock. */
|
|
17
|
+
now: () => number;
|
|
18
|
+
sleep: (seconds: number) => Promise<void>;
|
|
19
|
+
/** The timing a wait runs with; the declared one in production. */
|
|
20
|
+
timing: (declared: WaitTiming) => WaitTiming;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Read again while the value is pending: if one more interval would pass the bound, reject with
|
|
24
|
+
* the timeout; otherwise sleep an interval and read. HTTP errors from `read` propagate unchanged.
|
|
25
|
+
*/
|
|
26
|
+
export declare function pollWhile<T>(first: T, options: {
|
|
27
|
+
pending: (value: T) => boolean;
|
|
28
|
+
read: () => Promise<T>;
|
|
29
|
+
timing: WaitTiming;
|
|
30
|
+
timeout: () => WaitTimeoutError;
|
|
31
|
+
}): Promise<T>;
|
package/dist/waits.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.waitHooks = exports.WaitTimeoutError = void 0;
|
|
4
|
+
exports.pollWhile = pollWhile;
|
|
5
|
+
/** A wait the SDK owns was still pending when its bound ran out. The work continues on BoxRouter. */
|
|
6
|
+
class WaitTimeoutError extends Error {
|
|
7
|
+
/** The id to read for the current state: an operation, launch or image. */
|
|
8
|
+
id;
|
|
9
|
+
constructor(id, message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = 'TimeoutError';
|
|
12
|
+
this.id = id;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.WaitTimeoutError = WaitTimeoutError;
|
|
16
|
+
/**
|
|
17
|
+
* The clock and the declared timing every SDK-owned wait uses. Internal: tests replace these members to
|
|
18
|
+
* run waits without real sleeping; nothing here is exported from the package entry.
|
|
19
|
+
*/
|
|
20
|
+
exports.waitHooks = {
|
|
21
|
+
/** Seconds on a monotonic clock. */
|
|
22
|
+
now: () => performance.now() / 1000,
|
|
23
|
+
sleep: (seconds) => new Promise(resolve => setTimeout(resolve, seconds * 1000)),
|
|
24
|
+
/** The timing a wait runs with; the declared one in production. */
|
|
25
|
+
timing: (declared) => declared,
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Read again while the value is pending: if one more interval would pass the bound, reject with
|
|
29
|
+
* the timeout; otherwise sleep an interval and read. HTTP errors from `read` propagate unchanged.
|
|
30
|
+
*/
|
|
31
|
+
async function pollWhile(first, options) {
|
|
32
|
+
const { intervalSeconds, boundSeconds } = exports.waitHooks.timing(options.timing);
|
|
33
|
+
const deadline = exports.waitHooks.now() + boundSeconds;
|
|
34
|
+
let value = first;
|
|
35
|
+
while (options.pending(value)) {
|
|
36
|
+
if (exports.waitHooks.now() + intervalSeconds > deadline)
|
|
37
|
+
throw options.timeout();
|
|
38
|
+
await exports.waitHooks.sleep(intervalSeconds);
|
|
39
|
+
value = await options.read();
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const TERMINAL_ROWS = 24;
|
|
2
|
+
export declare const TERMINAL_COLS = 80;
|
|
3
|
+
export declare const TERMINAL_SIZE_MINIMUM = 1;
|
|
4
|
+
export declare const TERMINAL_SIZE_MAXIMUM = 1000;
|
|
5
|
+
export declare const TERMINAL_OUTPUT_EVENT_TYPE = "output";
|
|
6
|
+
export declare const TERMINAL_EXIT_EVENT_TYPE = "exit";
|
|
7
|
+
export declare const TERMINAL_ERROR_EVENT_TYPE = "error";
|
|
8
|
+
export declare const TERMINAL_EVENT_ID_FIELD = "id";
|
|
9
|
+
export declare const TERMINAL_EVENT_ID_HEADER = "Last-Event-ID";
|
|
10
|
+
export declare const TERMINAL_INPUT_BYTES = 65536;
|
|
11
|
+
export declare const TERMINAL_INPUT_ERROR = "Terminal input must be bytes of at most 65536 bytes";
|
|
12
|
+
export declare const USER_AGENT_SUFFIX_MAX_CHARACTERS = 256;
|
|
13
|
+
export declare const USER_AGENT_MAX_CHARACTERS = 512;
|
|
14
|
+
export declare const USER_AGENT_SUFFIX_REQUIRE_NON_SPACE = true;
|
|
15
|
+
export declare const PROCESS_WAIT_POLL_INTERVAL_SECONDS = 0.25;
|
|
16
|
+
export declare const PROCESS_WAIT_FIXED_RESULT_JSON = "{\"timed_out\":false,\"stdout_truncated\":false,\"stderr_truncated\":false,\"native_error\":null}";
|
|
17
|
+
export declare const DEFAULT_MAX_RETRIES = 2;
|
|
18
|
+
export declare const RETRY_WHEN = "safe";
|
|
19
|
+
export declare const RETRY_BASE_DELAY_SECONDS = 0.5;
|
|
20
|
+
export declare const RETRY_MAX_DELAY_SECONDS = 8;
|
|
21
|
+
export declare const DEFAULT_BASE_URL = "https://api.boxrouter.ai/api/v1";
|
|
22
|
+
export declare const LAUNCH_PENDING: string[];
|
|
23
|
+
export declare const LAUNCH_POLL_INTERVAL_SECONDS = 1;
|
|
24
|
+
export declare const LAUNCH_BOUND_SECONDS = 600;
|
|
25
|
+
export declare const IMAGES_PREPARE_PENDING: string[];
|
|
26
|
+
export declare const IMAGES_PREPARE_POLL_INTERVAL_SECONDS = 5;
|
|
27
|
+
export declare const IMAGES_PREPARE_BOUND_SECONDS = 600;
|
|
28
|
+
export declare const OPERATION_WAIT_PENDING: string[];
|
|
29
|
+
export declare const OPERATION_WAIT_POLL_INTERVAL_SECONDS = 2;
|
|
30
|
+
export declare const OPERATION_WAIT_BOUND_SECONDS = 120;
|
|
31
|
+
export declare const LAUNCH_OPERATION_NOT_FOUND_GRACE_SECONDS = 5;
|
|
32
|
+
export declare const LAUNCH_OPERATION_POLL_RETRY_INTERVAL_SECONDS = 0.25;
|
|
33
|
+
export declare const LAUNCH_SOURCE_MANIFEST_PATH = "boxrouter.yaml";
|
|
34
|
+
export declare const LAUNCH_SOURCE_DEFAULT_REF = "HEAD";
|
|
35
|
+
export declare const LAUNCH_DEFAULT_SHELL_COMMAND = "sh";
|
|
36
|
+
export declare const LAUNCH_CUSTOM_NAME_PATTERN = "^[a-z][a-z0-9-]{0,62}$";
|
|
37
|
+
export declare const LAUNCH_INPUT_POLICY_JSON = "{\"secret_names\":{\"option\":\"secret_names\",\"flag\":\"secret\",\"format\":\"name\",\"declared_field\":\"legacy_secret_names\",\"extra_field\":\"additional_secret_refs\",\"reference_field\":\"secret_name\",\"help\":\"Declared legacy names use the existing resolver; other names select saved custom secrets.\"},\"provider\":{\"option\":\"provider\",\"flag\":\"provider\",\"format\":\"name\",\"request_path\":[\"overrides\",\"placement\",\"preferences\",\"only\"],\"help\":\"Pin the launch to one provider.\"},\"credential_delivery\":{\"option\":\"credential_delivery\",\"flag\":\"credential-delivery\",\"format\":\"enum\",\"schema\":\"CredentialDeliveryPolicy\",\"request_field\":\"credential_delivery\",\"help\":\"Choose whether environment fallback is allowed.\"},\"retry\":{\"condition\":\"legacySecretMissing\",\"error_code\":\"secret_missing\",\"name_source\":\"manifest.secrets\",\"exclude_referenced_names\":true}}";
|
|
38
|
+
export declare const CREDENTIAL_DELIVERY_VALUES: string[];
|
|
39
|
+
export declare const MAX_ERROR_BYTES = 65536;
|
|
40
|
+
export declare const DEFAULT_EVENT_BYTES = 8388608;
|
|
41
|
+
export declare const CLI_LAUNCH_INPUTS_JSON = "{\"secret_names\":{\"name\":\"secret\",\"allow_repeating\":true,\"help\":\"Declared legacy names use the existing resolver; other names select saved custom secrets.\",\"grammar\":\"name\"},\"provider\":{\"name\":\"provider\",\"grammar\":\"name\",\"help\":\"Pin the launch to one provider.\"},\"credential_delivery\":{\"name\":\"credential-delivery\",\"grammar\":\"enum\",\"values\":[\"prefer_native\",\"require_native\"],\"help\":\"Choose whether environment fallback is allowed.\"}}";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLI_LAUNCH_INPUTS_JSON = exports.DEFAULT_EVENT_BYTES = exports.MAX_ERROR_BYTES = exports.CREDENTIAL_DELIVERY_VALUES = exports.LAUNCH_INPUT_POLICY_JSON = exports.LAUNCH_CUSTOM_NAME_PATTERN = exports.LAUNCH_DEFAULT_SHELL_COMMAND = exports.LAUNCH_SOURCE_DEFAULT_REF = exports.LAUNCH_SOURCE_MANIFEST_PATH = exports.LAUNCH_OPERATION_POLL_RETRY_INTERVAL_SECONDS = exports.LAUNCH_OPERATION_NOT_FOUND_GRACE_SECONDS = exports.OPERATION_WAIT_BOUND_SECONDS = exports.OPERATION_WAIT_POLL_INTERVAL_SECONDS = exports.OPERATION_WAIT_PENDING = exports.IMAGES_PREPARE_BOUND_SECONDS = exports.IMAGES_PREPARE_POLL_INTERVAL_SECONDS = exports.IMAGES_PREPARE_PENDING = exports.LAUNCH_BOUND_SECONDS = exports.LAUNCH_POLL_INTERVAL_SECONDS = exports.LAUNCH_PENDING = exports.DEFAULT_BASE_URL = exports.RETRY_MAX_DELAY_SECONDS = exports.RETRY_BASE_DELAY_SECONDS = exports.RETRY_WHEN = exports.DEFAULT_MAX_RETRIES = exports.PROCESS_WAIT_FIXED_RESULT_JSON = exports.PROCESS_WAIT_POLL_INTERVAL_SECONDS = exports.USER_AGENT_SUFFIX_REQUIRE_NON_SPACE = exports.USER_AGENT_MAX_CHARACTERS = exports.USER_AGENT_SUFFIX_MAX_CHARACTERS = exports.TERMINAL_INPUT_ERROR = exports.TERMINAL_INPUT_BYTES = exports.TERMINAL_EVENT_ID_HEADER = exports.TERMINAL_EVENT_ID_FIELD = exports.TERMINAL_ERROR_EVENT_TYPE = exports.TERMINAL_EXIT_EVENT_TYPE = exports.TERMINAL_OUTPUT_EVENT_TYPE = exports.TERMINAL_SIZE_MAXIMUM = exports.TERMINAL_SIZE_MINIMUM = exports.TERMINAL_COLS = exports.TERMINAL_ROWS = void 0;
|
|
4
|
+
// Generated from client-workflows.json and OpenAPI.
|
|
5
|
+
exports.TERMINAL_ROWS = 24;
|
|
6
|
+
exports.TERMINAL_COLS = 80;
|
|
7
|
+
exports.TERMINAL_SIZE_MINIMUM = 1;
|
|
8
|
+
exports.TERMINAL_SIZE_MAXIMUM = 1000;
|
|
9
|
+
exports.TERMINAL_OUTPUT_EVENT_TYPE = "output";
|
|
10
|
+
exports.TERMINAL_EXIT_EVENT_TYPE = "exit";
|
|
11
|
+
exports.TERMINAL_ERROR_EVENT_TYPE = "error";
|
|
12
|
+
exports.TERMINAL_EVENT_ID_FIELD = "id";
|
|
13
|
+
exports.TERMINAL_EVENT_ID_HEADER = "Last-Event-ID";
|
|
14
|
+
exports.TERMINAL_INPUT_BYTES = 65536;
|
|
15
|
+
exports.TERMINAL_INPUT_ERROR = "Terminal input must be bytes of at most 65536 bytes";
|
|
16
|
+
exports.USER_AGENT_SUFFIX_MAX_CHARACTERS = 256;
|
|
17
|
+
exports.USER_AGENT_MAX_CHARACTERS = 512;
|
|
18
|
+
exports.USER_AGENT_SUFFIX_REQUIRE_NON_SPACE = true;
|
|
19
|
+
exports.PROCESS_WAIT_POLL_INTERVAL_SECONDS = 0.25;
|
|
20
|
+
exports.PROCESS_WAIT_FIXED_RESULT_JSON = "{\"timed_out\":false,\"stdout_truncated\":false,\"stderr_truncated\":false,\"native_error\":null}";
|
|
21
|
+
exports.DEFAULT_MAX_RETRIES = 2;
|
|
22
|
+
exports.RETRY_WHEN = "safe";
|
|
23
|
+
exports.RETRY_BASE_DELAY_SECONDS = 0.5;
|
|
24
|
+
exports.RETRY_MAX_DELAY_SECONDS = 8;
|
|
25
|
+
exports.DEFAULT_BASE_URL = "https://api.boxrouter.ai/api/v1";
|
|
26
|
+
exports.LAUNCH_PENDING = ["queued", "running"];
|
|
27
|
+
exports.LAUNCH_POLL_INTERVAL_SECONDS = 1;
|
|
28
|
+
exports.LAUNCH_BOUND_SECONDS = 600;
|
|
29
|
+
exports.IMAGES_PREPARE_PENDING = ["queued", "preparing"];
|
|
30
|
+
exports.IMAGES_PREPARE_POLL_INTERVAL_SECONDS = 5;
|
|
31
|
+
exports.IMAGES_PREPARE_BOUND_SECONDS = 600;
|
|
32
|
+
exports.OPERATION_WAIT_PENDING = ["unknown"];
|
|
33
|
+
exports.OPERATION_WAIT_POLL_INTERVAL_SECONDS = 2;
|
|
34
|
+
exports.OPERATION_WAIT_BOUND_SECONDS = 120;
|
|
35
|
+
exports.LAUNCH_OPERATION_NOT_FOUND_GRACE_SECONDS = 5;
|
|
36
|
+
exports.LAUNCH_OPERATION_POLL_RETRY_INTERVAL_SECONDS = 0.25;
|
|
37
|
+
exports.LAUNCH_SOURCE_MANIFEST_PATH = "boxrouter.yaml";
|
|
38
|
+
exports.LAUNCH_SOURCE_DEFAULT_REF = "HEAD";
|
|
39
|
+
exports.LAUNCH_DEFAULT_SHELL_COMMAND = "sh";
|
|
40
|
+
exports.LAUNCH_CUSTOM_NAME_PATTERN = "^[a-z][a-z0-9-]{0,62}$";
|
|
41
|
+
exports.LAUNCH_INPUT_POLICY_JSON = "{\"secret_names\":{\"option\":\"secret_names\",\"flag\":\"secret\",\"format\":\"name\",\"declared_field\":\"legacy_secret_names\",\"extra_field\":\"additional_secret_refs\",\"reference_field\":\"secret_name\",\"help\":\"Declared legacy names use the existing resolver; other names select saved custom secrets.\"},\"provider\":{\"option\":\"provider\",\"flag\":\"provider\",\"format\":\"name\",\"request_path\":[\"overrides\",\"placement\",\"preferences\",\"only\"],\"help\":\"Pin the launch to one provider.\"},\"credential_delivery\":{\"option\":\"credential_delivery\",\"flag\":\"credential-delivery\",\"format\":\"enum\",\"schema\":\"CredentialDeliveryPolicy\",\"request_field\":\"credential_delivery\",\"help\":\"Choose whether environment fallback is allowed.\"},\"retry\":{\"condition\":\"legacySecretMissing\",\"error_code\":\"secret_missing\",\"name_source\":\"manifest.secrets\",\"exclude_referenced_names\":true}}";
|
|
42
|
+
exports.CREDENTIAL_DELIVERY_VALUES = ["prefer_native", "require_native"];
|
|
43
|
+
exports.MAX_ERROR_BYTES = 65536;
|
|
44
|
+
exports.DEFAULT_EVENT_BYTES = 8388608;
|
|
45
|
+
exports.CLI_LAUNCH_INPUTS_JSON = "{\"secret_names\":{\"name\":\"secret\",\"allow_repeating\":true,\"help\":\"Declared legacy names use the existing resolver; other names select saved custom secrets.\",\"grammar\":\"name\"},\"provider\":{\"name\":\"provider\",\"grammar\":\"name\",\"help\":\"Pin the launch to one provider.\"},\"credential_delivery\":{\"name\":\"credential-delivery\",\"grammar\":\"enum\",\"values\":[\"prefer_native\",\"require_native\"],\"help\":\"Choose whether environment fallback is allowed.\"}}";
|
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boxrouter/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "Early read-only BoxRouter provider discovery client",
|
|
3
|
+
"version": "0.12.190",
|
|
4
|
+
"description": "BoxRouter TypeScript SDK (alpha)",
|
|
6
5
|
"license": "Apache-2.0",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"import": "./dist/index.js"
|
|
14
|
-
}
|
|
6
|
+
"author": "BoxRouter, Inc.",
|
|
7
|
+
"homepage": "https://docs.boxrouter.ai/typescript",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"email": "support@boxrouter.ai"
|
|
15
10
|
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"main": "./dist/index.js",
|
|
16
13
|
"types": "./dist/index.d.ts",
|
|
17
14
|
"files": [
|
|
18
15
|
"dist",
|
|
@@ -20,8 +17,121 @@
|
|
|
20
17
|
"NOTICE",
|
|
21
18
|
"README.md"
|
|
22
19
|
],
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./choices": {
|
|
26
|
+
"types": "./dist/routing-choices.gen.d.ts",
|
|
27
|
+
"default": "./dist/routing-choices.gen.js"
|
|
28
|
+
},
|
|
29
|
+
"./browser-session": {
|
|
30
|
+
"types": "./dist/browser-session/index.d.ts",
|
|
31
|
+
"default": "./dist/browser-session/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./namespaces/agents": {
|
|
34
|
+
"types": "./dist/namespace-agents.d.mts",
|
|
35
|
+
"import": "./dist/namespace-agents.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./namespaces/launches": {
|
|
38
|
+
"types": "./dist/namespace-launches.d.mts",
|
|
39
|
+
"import": "./dist/namespace-launches.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./namespaces/launch_runs": {
|
|
42
|
+
"types": "./dist/namespace-launch_runs.d.mts",
|
|
43
|
+
"import": "./dist/namespace-launch_runs.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./namespaces/github": {
|
|
46
|
+
"types": "./dist/namespace-github.d.mts",
|
|
47
|
+
"import": "./dist/namespace-github.mjs"
|
|
48
|
+
},
|
|
49
|
+
"./namespaces/actions": {
|
|
50
|
+
"types": "./dist/namespace-actions.d.mts",
|
|
51
|
+
"import": "./dist/namespace-actions.mjs"
|
|
52
|
+
},
|
|
53
|
+
"./namespaces/routing": {
|
|
54
|
+
"types": "./dist/namespace-routing.d.mts",
|
|
55
|
+
"import": "./dist/namespace-routing.mjs"
|
|
56
|
+
},
|
|
57
|
+
"./namespaces/operations": {
|
|
58
|
+
"types": "./dist/namespace-operations.d.mts",
|
|
59
|
+
"import": "./dist/namespace-operations.mjs"
|
|
60
|
+
},
|
|
61
|
+
"./namespaces/artifacts": {
|
|
62
|
+
"types": "./dist/namespace-artifacts.d.mts",
|
|
63
|
+
"import": "./dist/namespace-artifacts.mjs"
|
|
64
|
+
},
|
|
65
|
+
"./namespaces/images": {
|
|
66
|
+
"types": "./dist/namespace-images.d.mts",
|
|
67
|
+
"import": "./dist/namespace-images.mjs"
|
|
68
|
+
},
|
|
69
|
+
"./namespaces/processes": {
|
|
70
|
+
"types": "./dist/namespace-processes.d.mts",
|
|
71
|
+
"import": "./dist/namespace-processes.mjs"
|
|
72
|
+
},
|
|
73
|
+
"./namespaces/credits": {
|
|
74
|
+
"types": "./dist/namespace-credits.d.mts",
|
|
75
|
+
"import": "./dist/namespace-credits.mjs"
|
|
76
|
+
},
|
|
77
|
+
"./namespaces/spend_limits": {
|
|
78
|
+
"types": "./dist/namespace-spend_limits.d.mts",
|
|
79
|
+
"import": "./dist/namespace-spend_limits.mjs"
|
|
80
|
+
},
|
|
81
|
+
"./namespaces/usage": {
|
|
82
|
+
"types": "./dist/namespace-usage.d.mts",
|
|
83
|
+
"import": "./dist/namespace-usage.mjs"
|
|
84
|
+
},
|
|
85
|
+
"./namespaces/terminals": {
|
|
86
|
+
"types": "./dist/namespace-terminals.d.mts",
|
|
87
|
+
"import": "./dist/namespace-terminals.mjs"
|
|
88
|
+
},
|
|
89
|
+
"./namespaces/secrets": {
|
|
90
|
+
"types": "./dist/namespace-secrets.d.mts",
|
|
91
|
+
"import": "./dist/namespace-secrets.mjs"
|
|
92
|
+
},
|
|
93
|
+
"./namespaces/previews": {
|
|
94
|
+
"types": "./dist/namespace-previews.d.mts",
|
|
95
|
+
"import": "./dist/namespace-previews.mjs"
|
|
96
|
+
},
|
|
97
|
+
"./namespaces/sandboxes": {
|
|
98
|
+
"types": "./dist/namespace-sandboxes.d.mts",
|
|
99
|
+
"import": "./dist/namespace-sandboxes.mjs"
|
|
100
|
+
},
|
|
101
|
+
"./namespaces/provider_accounts": {
|
|
102
|
+
"types": "./dist/namespace-provider_accounts.d.mts",
|
|
103
|
+
"import": "./dist/namespace-provider_accounts.mjs"
|
|
104
|
+
},
|
|
105
|
+
"./namespaces/volumes": {
|
|
106
|
+
"types": "./dist/namespace-volumes.d.mts",
|
|
107
|
+
"import": "./dist/namespace-volumes.mjs"
|
|
108
|
+
},
|
|
109
|
+
"./namespaces/commands": {
|
|
110
|
+
"types": "./dist/namespace-commands.d.mts",
|
|
111
|
+
"import": "./dist/namespace-commands.mjs"
|
|
112
|
+
},
|
|
113
|
+
"./namespaces/files": {
|
|
114
|
+
"types": "./dist/namespace-files.d.mts",
|
|
115
|
+
"import": "./dist/namespace-files.mjs"
|
|
116
|
+
},
|
|
117
|
+
"./namespaces/pricing": {
|
|
118
|
+
"types": "./dist/namespace-pricing.d.mts",
|
|
119
|
+
"import": "./dist/namespace-pricing.mjs"
|
|
120
|
+
},
|
|
121
|
+
"./namespaces/providers": {
|
|
122
|
+
"types": "./dist/namespace-providers.d.mts",
|
|
123
|
+
"import": "./dist/namespace-providers.mjs"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"engines": {
|
|
127
|
+
"node": ">=22.18.0"
|
|
128
|
+
},
|
|
129
|
+
"dependencies": {
|
|
130
|
+
"eventsource-parser": "4.1.0",
|
|
131
|
+
"ajv": "8.20.0",
|
|
132
|
+
"ajv-formats": "3.0.1",
|
|
133
|
+
"@opentelemetry/api": "1.9.1",
|
|
134
|
+
"lossless-json": "4.3.1",
|
|
135
|
+
"undici": "7.30.1"
|
|
26
136
|
}
|
|
27
137
|
}
|