@declaw/sdk 1.1.0 → 1.1.2
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/CHANGELOG.md +34 -0
- package/dist/index.cjs +215 -218
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -5
- package/dist/index.d.ts +30 -5
- package/dist/index.js +213 -218
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -55,6 +55,8 @@ declare class ApiClient {
|
|
|
55
55
|
});
|
|
56
56
|
/** Send a GET request and return parsed JSON. */
|
|
57
57
|
get(path: string, opts?: RequestOpts): Promise<unknown>;
|
|
58
|
+
/** Send a GET request and return the response body as raw bytes. */
|
|
59
|
+
getBytes(path: string, opts?: RequestOpts): Promise<Uint8Array>;
|
|
58
60
|
/** Send a POST request and return parsed JSON. */
|
|
59
61
|
post(path: string, opts?: RequestOpts): Promise<unknown>;
|
|
60
62
|
/** Send a PATCH request and return parsed JSON. */
|
|
@@ -75,6 +77,12 @@ declare class ApiClient {
|
|
|
75
77
|
streamGet(path: string, opts?: RequestOpts): Promise<Response>;
|
|
76
78
|
/**
|
|
77
79
|
* Abort all in-flight requests and release resources.
|
|
80
|
+
*
|
|
81
|
+
* Since 1.1.1 the SDK maintains a process-wide shared ApiClient cache
|
|
82
|
+
* for hot class-method paths (Sandbox.create, Volumes.*, Template.*).
|
|
83
|
+
* Calling `close()` on a shared instance aborts its AbortController,
|
|
84
|
+
* which would cancel any concurrent in-flight call. Prefer
|
|
85
|
+
* `resetSharedClients()` if you want to tear down every cached client.
|
|
78
86
|
*/
|
|
79
87
|
close(): void;
|
|
80
88
|
private buildUrl;
|
|
@@ -87,6 +95,8 @@ declare class ApiClient {
|
|
|
87
95
|
*/
|
|
88
96
|
private delay;
|
|
89
97
|
}
|
|
98
|
+
declare function getSharedClient(config: ConnectionConfig): ApiClient;
|
|
99
|
+
declare function resetSharedClients(): void;
|
|
90
100
|
|
|
91
101
|
/** CIDR for all traffic. */
|
|
92
102
|
declare const ALL_TRAFFIC = "0.0.0.0/0";
|
|
@@ -689,16 +699,27 @@ declare class Filesystem {
|
|
|
689
699
|
private readonly client;
|
|
690
700
|
constructor(sandboxId: string, client: ApiClient);
|
|
691
701
|
/**
|
|
692
|
-
* Read a file's contents
|
|
702
|
+
* Read a file's contents.
|
|
703
|
+
*
|
|
704
|
+
* Default returns the content as a string. Pass `{ format: "bytes" }`
|
|
705
|
+
* to get a `Uint8Array` for binary-safe reads — the SDK negotiates
|
|
706
|
+
* `application/octet-stream` end-to-end so high-bit bytes survive the
|
|
707
|
+
* round trip.
|
|
693
708
|
*
|
|
694
709
|
* @param path - Absolute path to the file.
|
|
695
|
-
* @param opts - Optional user and request timeout.
|
|
696
|
-
* @returns The file contents as a string.
|
|
710
|
+
* @param opts - Optional format, user, and request timeout.
|
|
711
|
+
* @returns The file contents as a string, or Uint8Array when format="bytes".
|
|
697
712
|
*/
|
|
698
713
|
read(path: string, opts?: {
|
|
714
|
+
format?: 'text';
|
|
699
715
|
user?: string;
|
|
700
716
|
requestTimeout?: number;
|
|
701
717
|
}): Promise<string>;
|
|
718
|
+
read(path: string, opts: {
|
|
719
|
+
format: 'bytes';
|
|
720
|
+
user?: string;
|
|
721
|
+
requestTimeout?: number;
|
|
722
|
+
}): Promise<Uint8Array>;
|
|
702
723
|
/**
|
|
703
724
|
* Write data to a file.
|
|
704
725
|
*
|
|
@@ -1185,7 +1206,11 @@ declare class Sandbox {
|
|
|
1185
1206
|
requestTimeout?: number;
|
|
1186
1207
|
}): Promise<Sandbox>;
|
|
1187
1208
|
/**
|
|
1188
|
-
*
|
|
1209
|
+
* Historically closed the sandbox's HTTP client; since 1.1.1 the SDK
|
|
1210
|
+
* maintains a process-wide shared ApiClient (see `getSharedClient` in
|
|
1211
|
+
* api/client.ts) so per-sandbox close no longer tears the connection
|
|
1212
|
+
* pool down. Kept as a no-op for backwards compatibility — call
|
|
1213
|
+
* `resetSharedClients()` if you want to force a full teardown.
|
|
1189
1214
|
*/
|
|
1190
1215
|
close(): void;
|
|
1191
1216
|
/**
|
|
@@ -1464,4 +1489,4 @@ declare class Volumes {
|
|
|
1464
1489
|
static delete(volumeId: string, opts?: VolumeRequestOpts): Promise<void>;
|
|
1465
1490
|
}
|
|
1466
1491
|
|
|
1467
|
-
export { ALL_TRAFFIC, ApiClient, type AuditConfig, type AuditEntry, AuthenticationError, BuildError, type BuildInfo, type CodeSecurityConfig, CommandExitError, CommandHandle, type CommandResult, type CommandWaitOpts, Commands, ConnectionConfig, type ConnectionConfigOptions, type CopyItem, DEFAULT_MASK_PATTERNS, type EntryInfo, type EnvSecurityConfig, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOpts, GitAuthError, GitUpstreamError, InjectionAction, type InjectionDefenseConfig, InjectionSensitivity, InvalidArgumentError, type InvisibleTextConfig, type NetworkPolicy, NotEnoughSpaceError, NotFoundError, type PIIConfig, PIIType, type ProcessInfo, Pty, type PtyConnectOpts, type PtyCreateOpts, PtyHandle, type PtyOutput, type PtyResult, type PtySize, RedactionAction, type RequestOpts, type RunOpts, type RunStreamOpts, Sandbox, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxMetrics, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxQuery, SandboxState, type SecureEnvVar, type SecurityPolicy, type Snapshot, type SnapshotInfo, SnapshotPaginator, type SnapshotSource, type Stderr, type Stdout, Template, TemplateBase, type TemplateBuildOpts, type TemplateBuildStatus, TemplateError, TimeoutError, type ToxicityConfig, TransformDirection, type TransformationRule, type VolumeAttachment, type VolumeCreateOpts, type VolumeInfo, type VolumeRequestOpts, Volumes, WatchHandle, type WriteEntry, type WriteInfo, applyTransformation, codeSecurityConfigToJSON, createAuditConfig, createCodeSecurityConfig, createEnvSecurityConfig, createInjectionDefenseConfig, createInvisibleTextConfig, createNetworkPolicy, createPIIConfig, createSecurityPolicy, createToxicityConfig, createTransformationRule, domainMatches, invisibleTextConfigToJSON, isSensitive, networkPolicyToOpts, parseAuditConfig, parseAuditEntry, parseBuildInfo, parseCodeSecurityConfig, parseCommandResult, parseEntryInfo, parseEnvSecurityConfig, parseFilesystemEvent, parseInjectionDefenseConfig, parseInvisibleTextConfig, parseNetworkPolicy, parsePIIConfig, parseProcessInfo, parseSandboxInfo, parseSandboxLifecycle, parseSandboxMetrics, parseSecurityPolicy, parseSnapshot, parseSnapshotInfo, parseTemplateBuildStatus, parseToxicityConfig, parseVolumeInfo, parseWriteInfo, requiresTlsInterception, securityPolicyToJSON, toxicityConfigToJSON, validateNetworkEntry, volumeAttachmentToJSON };
|
|
1492
|
+
export { ALL_TRAFFIC, ApiClient, type AuditConfig, type AuditEntry, AuthenticationError, BuildError, type BuildInfo, type CodeSecurityConfig, CommandExitError, CommandHandle, type CommandResult, type CommandWaitOpts, Commands, ConnectionConfig, type ConnectionConfigOptions, type CopyItem, DEFAULT_MASK_PATTERNS, type EntryInfo, type EnvSecurityConfig, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOpts, GitAuthError, GitUpstreamError, InjectionAction, type InjectionDefenseConfig, InjectionSensitivity, InvalidArgumentError, type InvisibleTextConfig, type NetworkPolicy, NotEnoughSpaceError, NotFoundError, type PIIConfig, PIIType, type ProcessInfo, Pty, type PtyConnectOpts, type PtyCreateOpts, PtyHandle, type PtyOutput, type PtyResult, type PtySize, RedactionAction, type RequestOpts, type RunOpts, type RunStreamOpts, Sandbox, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxMetrics, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxQuery, SandboxState, type SecureEnvVar, type SecurityPolicy, type Snapshot, type SnapshotInfo, SnapshotPaginator, type SnapshotSource, type Stderr, type Stdout, Template, TemplateBase, type TemplateBuildOpts, type TemplateBuildStatus, TemplateError, TimeoutError, type ToxicityConfig, TransformDirection, type TransformationRule, type VolumeAttachment, type VolumeCreateOpts, type VolumeInfo, type VolumeRequestOpts, Volumes, WatchHandle, type WriteEntry, type WriteInfo, applyTransformation, codeSecurityConfigToJSON, createAuditConfig, createCodeSecurityConfig, createEnvSecurityConfig, createInjectionDefenseConfig, createInvisibleTextConfig, createNetworkPolicy, createPIIConfig, createSecurityPolicy, createToxicityConfig, createTransformationRule, domainMatches, getSharedClient, invisibleTextConfigToJSON, isSensitive, networkPolicyToOpts, parseAuditConfig, parseAuditEntry, parseBuildInfo, parseCodeSecurityConfig, parseCommandResult, parseEntryInfo, parseEnvSecurityConfig, parseFilesystemEvent, parseInjectionDefenseConfig, parseInvisibleTextConfig, parseNetworkPolicy, parsePIIConfig, parseProcessInfo, parseSandboxInfo, parseSandboxLifecycle, parseSandboxMetrics, parseSecurityPolicy, parseSnapshot, parseSnapshotInfo, parseTemplateBuildStatus, parseToxicityConfig, parseVolumeInfo, parseWriteInfo, requiresTlsInterception, resetSharedClients, securityPolicyToJSON, toxicityConfigToJSON, validateNetworkEntry, volumeAttachmentToJSON };
|
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ declare class ApiClient {
|
|
|
55
55
|
});
|
|
56
56
|
/** Send a GET request and return parsed JSON. */
|
|
57
57
|
get(path: string, opts?: RequestOpts): Promise<unknown>;
|
|
58
|
+
/** Send a GET request and return the response body as raw bytes. */
|
|
59
|
+
getBytes(path: string, opts?: RequestOpts): Promise<Uint8Array>;
|
|
58
60
|
/** Send a POST request and return parsed JSON. */
|
|
59
61
|
post(path: string, opts?: RequestOpts): Promise<unknown>;
|
|
60
62
|
/** Send a PATCH request and return parsed JSON. */
|
|
@@ -75,6 +77,12 @@ declare class ApiClient {
|
|
|
75
77
|
streamGet(path: string, opts?: RequestOpts): Promise<Response>;
|
|
76
78
|
/**
|
|
77
79
|
* Abort all in-flight requests and release resources.
|
|
80
|
+
*
|
|
81
|
+
* Since 1.1.1 the SDK maintains a process-wide shared ApiClient cache
|
|
82
|
+
* for hot class-method paths (Sandbox.create, Volumes.*, Template.*).
|
|
83
|
+
* Calling `close()` on a shared instance aborts its AbortController,
|
|
84
|
+
* which would cancel any concurrent in-flight call. Prefer
|
|
85
|
+
* `resetSharedClients()` if you want to tear down every cached client.
|
|
78
86
|
*/
|
|
79
87
|
close(): void;
|
|
80
88
|
private buildUrl;
|
|
@@ -87,6 +95,8 @@ declare class ApiClient {
|
|
|
87
95
|
*/
|
|
88
96
|
private delay;
|
|
89
97
|
}
|
|
98
|
+
declare function getSharedClient(config: ConnectionConfig): ApiClient;
|
|
99
|
+
declare function resetSharedClients(): void;
|
|
90
100
|
|
|
91
101
|
/** CIDR for all traffic. */
|
|
92
102
|
declare const ALL_TRAFFIC = "0.0.0.0/0";
|
|
@@ -689,16 +699,27 @@ declare class Filesystem {
|
|
|
689
699
|
private readonly client;
|
|
690
700
|
constructor(sandboxId: string, client: ApiClient);
|
|
691
701
|
/**
|
|
692
|
-
* Read a file's contents
|
|
702
|
+
* Read a file's contents.
|
|
703
|
+
*
|
|
704
|
+
* Default returns the content as a string. Pass `{ format: "bytes" }`
|
|
705
|
+
* to get a `Uint8Array` for binary-safe reads — the SDK negotiates
|
|
706
|
+
* `application/octet-stream` end-to-end so high-bit bytes survive the
|
|
707
|
+
* round trip.
|
|
693
708
|
*
|
|
694
709
|
* @param path - Absolute path to the file.
|
|
695
|
-
* @param opts - Optional user and request timeout.
|
|
696
|
-
* @returns The file contents as a string.
|
|
710
|
+
* @param opts - Optional format, user, and request timeout.
|
|
711
|
+
* @returns The file contents as a string, or Uint8Array when format="bytes".
|
|
697
712
|
*/
|
|
698
713
|
read(path: string, opts?: {
|
|
714
|
+
format?: 'text';
|
|
699
715
|
user?: string;
|
|
700
716
|
requestTimeout?: number;
|
|
701
717
|
}): Promise<string>;
|
|
718
|
+
read(path: string, opts: {
|
|
719
|
+
format: 'bytes';
|
|
720
|
+
user?: string;
|
|
721
|
+
requestTimeout?: number;
|
|
722
|
+
}): Promise<Uint8Array>;
|
|
702
723
|
/**
|
|
703
724
|
* Write data to a file.
|
|
704
725
|
*
|
|
@@ -1185,7 +1206,11 @@ declare class Sandbox {
|
|
|
1185
1206
|
requestTimeout?: number;
|
|
1186
1207
|
}): Promise<Sandbox>;
|
|
1187
1208
|
/**
|
|
1188
|
-
*
|
|
1209
|
+
* Historically closed the sandbox's HTTP client; since 1.1.1 the SDK
|
|
1210
|
+
* maintains a process-wide shared ApiClient (see `getSharedClient` in
|
|
1211
|
+
* api/client.ts) so per-sandbox close no longer tears the connection
|
|
1212
|
+
* pool down. Kept as a no-op for backwards compatibility — call
|
|
1213
|
+
* `resetSharedClients()` if you want to force a full teardown.
|
|
1189
1214
|
*/
|
|
1190
1215
|
close(): void;
|
|
1191
1216
|
/**
|
|
@@ -1464,4 +1489,4 @@ declare class Volumes {
|
|
|
1464
1489
|
static delete(volumeId: string, opts?: VolumeRequestOpts): Promise<void>;
|
|
1465
1490
|
}
|
|
1466
1491
|
|
|
1467
|
-
export { ALL_TRAFFIC, ApiClient, type AuditConfig, type AuditEntry, AuthenticationError, BuildError, type BuildInfo, type CodeSecurityConfig, CommandExitError, CommandHandle, type CommandResult, type CommandWaitOpts, Commands, ConnectionConfig, type ConnectionConfigOptions, type CopyItem, DEFAULT_MASK_PATTERNS, type EntryInfo, type EnvSecurityConfig, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOpts, GitAuthError, GitUpstreamError, InjectionAction, type InjectionDefenseConfig, InjectionSensitivity, InvalidArgumentError, type InvisibleTextConfig, type NetworkPolicy, NotEnoughSpaceError, NotFoundError, type PIIConfig, PIIType, type ProcessInfo, Pty, type PtyConnectOpts, type PtyCreateOpts, PtyHandle, type PtyOutput, type PtyResult, type PtySize, RedactionAction, type RequestOpts, type RunOpts, type RunStreamOpts, Sandbox, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxMetrics, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxQuery, SandboxState, type SecureEnvVar, type SecurityPolicy, type Snapshot, type SnapshotInfo, SnapshotPaginator, type SnapshotSource, type Stderr, type Stdout, Template, TemplateBase, type TemplateBuildOpts, type TemplateBuildStatus, TemplateError, TimeoutError, type ToxicityConfig, TransformDirection, type TransformationRule, type VolumeAttachment, type VolumeCreateOpts, type VolumeInfo, type VolumeRequestOpts, Volumes, WatchHandle, type WriteEntry, type WriteInfo, applyTransformation, codeSecurityConfigToJSON, createAuditConfig, createCodeSecurityConfig, createEnvSecurityConfig, createInjectionDefenseConfig, createInvisibleTextConfig, createNetworkPolicy, createPIIConfig, createSecurityPolicy, createToxicityConfig, createTransformationRule, domainMatches, invisibleTextConfigToJSON, isSensitive, networkPolicyToOpts, parseAuditConfig, parseAuditEntry, parseBuildInfo, parseCodeSecurityConfig, parseCommandResult, parseEntryInfo, parseEnvSecurityConfig, parseFilesystemEvent, parseInjectionDefenseConfig, parseInvisibleTextConfig, parseNetworkPolicy, parsePIIConfig, parseProcessInfo, parseSandboxInfo, parseSandboxLifecycle, parseSandboxMetrics, parseSecurityPolicy, parseSnapshot, parseSnapshotInfo, parseTemplateBuildStatus, parseToxicityConfig, parseVolumeInfo, parseWriteInfo, requiresTlsInterception, securityPolicyToJSON, toxicityConfigToJSON, validateNetworkEntry, volumeAttachmentToJSON };
|
|
1492
|
+
export { ALL_TRAFFIC, ApiClient, type AuditConfig, type AuditEntry, AuthenticationError, BuildError, type BuildInfo, type CodeSecurityConfig, CommandExitError, CommandHandle, type CommandResult, type CommandWaitOpts, Commands, ConnectionConfig, type ConnectionConfigOptions, type CopyItem, DEFAULT_MASK_PATTERNS, type EntryInfo, type EnvSecurityConfig, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOpts, GitAuthError, GitUpstreamError, InjectionAction, type InjectionDefenseConfig, InjectionSensitivity, InvalidArgumentError, type InvisibleTextConfig, type NetworkPolicy, NotEnoughSpaceError, NotFoundError, type PIIConfig, PIIType, type ProcessInfo, Pty, type PtyConnectOpts, type PtyCreateOpts, PtyHandle, type PtyOutput, type PtyResult, type PtySize, RedactionAction, type RequestOpts, type RunOpts, type RunStreamOpts, Sandbox, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxMetrics, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxQuery, SandboxState, type SecureEnvVar, type SecurityPolicy, type Snapshot, type SnapshotInfo, SnapshotPaginator, type SnapshotSource, type Stderr, type Stdout, Template, TemplateBase, type TemplateBuildOpts, type TemplateBuildStatus, TemplateError, TimeoutError, type ToxicityConfig, TransformDirection, type TransformationRule, type VolumeAttachment, type VolumeCreateOpts, type VolumeInfo, type VolumeRequestOpts, Volumes, WatchHandle, type WriteEntry, type WriteInfo, applyTransformation, codeSecurityConfigToJSON, createAuditConfig, createCodeSecurityConfig, createEnvSecurityConfig, createInjectionDefenseConfig, createInvisibleTextConfig, createNetworkPolicy, createPIIConfig, createSecurityPolicy, createToxicityConfig, createTransformationRule, domainMatches, getSharedClient, invisibleTextConfigToJSON, isSensitive, networkPolicyToOpts, parseAuditConfig, parseAuditEntry, parseBuildInfo, parseCodeSecurityConfig, parseCommandResult, parseEntryInfo, parseEnvSecurityConfig, parseFilesystemEvent, parseInjectionDefenseConfig, parseInvisibleTextConfig, parseNetworkPolicy, parsePIIConfig, parseProcessInfo, parseSandboxInfo, parseSandboxLifecycle, parseSandboxMetrics, parseSecurityPolicy, parseSnapshot, parseSnapshotInfo, parseTemplateBuildStatus, parseToxicityConfig, parseVolumeInfo, parseWriteInfo, requiresTlsInterception, resetSharedClients, securityPolicyToJSON, toxicityConfigToJSON, validateNetworkEntry, volumeAttachmentToJSON };
|