@watasu/sdk 0.1.68 → 0.1.71
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/dist/codeInterpreter.d.ts +1 -1
- package/dist/codeInterpreter.js +1 -1
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/sandbox.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Sandbox as BaseSandbox } from './sandbox.js';
|
|
2
|
-
export { ApiError, AuthenticationError, BuildError, ConflictError, FileNotFoundError, FileUploadError, GitAuthError, GitUpstreamError, InvalidArgumentError, NotEnoughSpaceError, NotFoundError, RateLimitError, SandboxError, SandboxNotFoundError, TemplateError, TimeoutError, VolumeError, } from './errors.js';
|
|
2
|
+
export { ApiError, AuthenticationError, BuildError, ConflictError, FileNotFoundError, FileUploadError, GitAuthError, GitUpstreamError, InvalidArgumentError, NotEnoughSpaceError, NotFoundError, RateLimitError, SandboxError, SandboxNotFoundError, SandboxOverloadedError, TemplateError, TimeoutError, VolumeError, } from './errors.js';
|
|
3
3
|
export { ConnectionConfig, KEEPALIVE_PING_INTERVAL_SEC } from './connectionConfig.js';
|
|
4
4
|
export type { ConnectionOpts, Username } from './connectionConfig.js';
|
|
5
5
|
export { ControlClient as ApiClient } from './transport.js';
|
package/dist/codeInterpreter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InvalidArgumentError } from './errors.js';
|
|
2
2
|
import { Sandbox as BaseSandbox } from './sandbox.js';
|
|
3
|
-
export { ApiError, AuthenticationError, BuildError, ConflictError, FileNotFoundError, FileUploadError, GitAuthError, GitUpstreamError, InvalidArgumentError, NotEnoughSpaceError, NotFoundError, RateLimitError, SandboxError, SandboxNotFoundError, TemplateError, TimeoutError, VolumeError, } from './errors.js';
|
|
3
|
+
export { ApiError, AuthenticationError, BuildError, ConflictError, FileNotFoundError, FileUploadError, GitAuthError, GitUpstreamError, InvalidArgumentError, NotEnoughSpaceError, NotFoundError, RateLimitError, SandboxError, SandboxNotFoundError, SandboxOverloadedError, TemplateError, TimeoutError, VolumeError, } from './errors.js';
|
|
4
4
|
export { ConnectionConfig, KEEPALIVE_PING_INTERVAL_SEC } from './connectionConfig.js';
|
|
5
5
|
export { ControlClient as ApiClient } from './transport.js';
|
|
6
6
|
export { ALL_TRAFFIC, SandboxPaginator, SnapshotPaginator, getSignature, } from './sandbox.js';
|
package/dist/errors.d.ts
CHANGED
|
@@ -51,4 +51,7 @@ export declare class ApiError extends SandboxError {
|
|
|
51
51
|
readonly code?: string | undefined;
|
|
52
52
|
constructor(message: string, status: number, code?: string | undefined);
|
|
53
53
|
}
|
|
54
|
+
export declare class SandboxOverloadedError extends ApiError {
|
|
55
|
+
constructor(message?: string);
|
|
56
|
+
}
|
|
54
57
|
export declare function errorFromResponse(status: number, payload: unknown): Error;
|
package/dist/errors.js
CHANGED
|
@@ -104,11 +104,21 @@ export class ApiError extends SandboxError {
|
|
|
104
104
|
this.name = 'ApiError';
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
export class SandboxOverloadedError extends ApiError {
|
|
108
|
+
constructor(message = 'Sandbox is overloaded') {
|
|
109
|
+
super(message, 503, 'sandbox_overloaded');
|
|
110
|
+
this.name = 'SandboxOverloadedError';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
107
113
|
export function errorFromResponse(status, payload) {
|
|
108
114
|
const body = asRecord(payload);
|
|
115
|
+
const reason = asRecord(body.reason);
|
|
109
116
|
const code = stringValue(body.error);
|
|
110
117
|
const message = stringValue(body.message) ||
|
|
111
118
|
listMessage(body.errors) ||
|
|
119
|
+
stringValue(reason.message) ||
|
|
120
|
+
listMessage(reason.errors) ||
|
|
121
|
+
stringValue(body.reason) ||
|
|
112
122
|
code ||
|
|
113
123
|
`Request failed with status ${status}`;
|
|
114
124
|
if (code === 'not_enough_space')
|
|
@@ -117,6 +127,8 @@ export function errorFromResponse(status, payload) {
|
|
|
117
127
|
return new FileNotFoundError(message);
|
|
118
128
|
if (code === 'sandbox_not_found')
|
|
119
129
|
return new SandboxNotFoundError(message);
|
|
130
|
+
if (code === 'sandbox_overloaded')
|
|
131
|
+
return new SandboxOverloadedError(message);
|
|
120
132
|
if (code === 'git_auth')
|
|
121
133
|
return new GitAuthError(message);
|
|
122
134
|
if (code === 'git_upstream')
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ApiError, AuthenticationError, BuildError, ConflictError, FileNotFoundError, FileUploadError, GitAuthError, GitUpstreamError, InvalidArgumentError, NotEnoughSpaceError, NotFoundError, RateLimitError, SandboxError, SandboxNotFoundError, TemplateError, TimeoutError, VolumeError, } from './errors.js';
|
|
1
|
+
export { ApiError, AuthenticationError, BuildError, ConflictError, FileNotFoundError, FileUploadError, GitAuthError, GitUpstreamError, InvalidArgumentError, NotEnoughSpaceError, NotFoundError, RateLimitError, SandboxError, SandboxNotFoundError, SandboxOverloadedError, TemplateError, TimeoutError, VolumeError, } from './errors.js';
|
|
2
2
|
export { ConnectionConfig, KEEPALIVE_PING_INTERVAL_SEC } from './connectionConfig.js';
|
|
3
3
|
export type { ConnectionOpts, Username } from './connectionConfig.js';
|
|
4
4
|
export { ControlClient as ApiClient } from './transport.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ApiError, AuthenticationError, BuildError, ConflictError, FileNotFoundError, FileUploadError, GitAuthError, GitUpstreamError, InvalidArgumentError, NotEnoughSpaceError, NotFoundError, RateLimitError, SandboxError, SandboxNotFoundError, TemplateError, TimeoutError, VolumeError, } from './errors.js';
|
|
1
|
+
export { ApiError, AuthenticationError, BuildError, ConflictError, FileNotFoundError, FileUploadError, GitAuthError, GitUpstreamError, InvalidArgumentError, NotEnoughSpaceError, NotFoundError, RateLimitError, SandboxError, SandboxNotFoundError, SandboxOverloadedError, TemplateError, TimeoutError, VolumeError, } from './errors.js';
|
|
2
2
|
export { ConnectionConfig, KEEPALIVE_PING_INTERVAL_SEC } from './connectionConfig.js';
|
|
3
3
|
export { ControlClient as ApiClient } from './transport.js';
|
|
4
4
|
export { ALL_TRAFFIC, Sandbox, SandboxPaginator, SnapshotPaginator, getSignature, } from './sandbox.js';
|
package/dist/sandbox.js
CHANGED
|
@@ -163,8 +163,8 @@ export class Sandbox {
|
|
|
163
163
|
metadata: opts.metadata ?? {},
|
|
164
164
|
envs: opts.envs ?? {},
|
|
165
165
|
secure: opts.secure ?? true,
|
|
166
|
-
allow_internet_access: opts.allowInternetAccess ?? true,
|
|
167
166
|
};
|
|
167
|
+
putIfPresent(sandboxPayload, 'allow_internet_access', opts.allowInternetAccess);
|
|
168
168
|
putIfPresent(sandboxPayload, 'template', template);
|
|
169
169
|
putIfPresent(sandboxPayload, 'mcp', opts.mcp);
|
|
170
170
|
putIfPresent(sandboxPayload, 'lifecycle', lifecyclePayload(opts.lifecycle));
|