@aerol-ai/aerolvm-sdk 0.8.0 → 0.8.1
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/MicroVM.d.ts +2 -2
- package/dist/MicroVM.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/internal/client.d.ts +3 -3
- package/dist/internal/client.js +8 -4
- package/dist/types.d.ts +10 -0
- package/package.json +1 -1
package/dist/MicroVM.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type APIVersion, type RetryConfig } from "./internal/client.js";
|
|
2
2
|
import { Sandbox } from "./Sandbox.js";
|
|
3
3
|
import { Image } from "./Image.js";
|
|
4
|
-
import type { APITokenList, BuildImageOptions, BuildImageResult, CloneGeneration, CreateAPITokenOptions, CreatedAPIToken, CreateOptions, CreateSessionOptions, CreateTemplateOptions, CreateWasmModuleOptions, PushWasmModuleOptions, PushWasmModuleResult, ExecStreamHandle, ExecStreamOptions, HealthStatus, EgressProfile, EgressProfileList, EgressProfileOptions, ListEgressProfilesOptions, NetworkPolicyCheckOptions, NetworkPolicyCheckResult, IngressTarget, Lifecycle, GetOptions, ListOptions, MountSpecRedacted, RegisterSnapshotOptions, ListSnapshotsOptions, SnapshotList, ResizeOptions, SandboxSnapshot, Session, SessionAttachHandle, SessionAttachOptions, Template, WasmModule, WhoAmI } from "./types.js";
|
|
4
|
+
import type { APITokenList, BuildImageOptions, BuildImageResult, CloneGeneration, CreateAPITokenOptions, CreatedAPIToken, CreateOptions, CreateSessionOptions, CreateTemplateOptions, CreateWasmModuleOptions, PushWasmModuleOptions, PushWasmModuleResult, ExecStreamHandle, ExecStreamOptions, HealthStatus, EgressProfile, EgressProfileList, EgressProfileOptions, ListEgressProfilesOptions, NetworkPolicyCheckOptions, NetworkPolicyCheckResult, IngressTarget, Lifecycle, GetOptions, ListOptions, MountSpecRedacted, CreateSnapshotOptions, RegisterSnapshotOptions, ListSnapshotsOptions, SnapshotList, ResizeOptions, SandboxSnapshot, Session, SessionAttachHandle, SessionAttachOptions, Template, WasmModule, WhoAmI } from "./types.js";
|
|
5
5
|
type FetchLike = typeof fetch;
|
|
6
6
|
/** Scoped API token calls, reached as `microvm.tokens`. */
|
|
7
7
|
export interface Tokens {
|
|
@@ -85,7 +85,7 @@ export declare class MicroVM {
|
|
|
85
85
|
getByName(name: string, options?: GetOptions): Promise<Sandbox | null>;
|
|
86
86
|
start(id: string): Promise<Sandbox>;
|
|
87
87
|
stop(id: string): Promise<Sandbox>;
|
|
88
|
-
createSnapshot(id: string, name: string): Promise<SandboxSnapshot>;
|
|
88
|
+
createSnapshot(id: string, name: string, options?: CreateSnapshotOptions): Promise<SandboxSnapshot>;
|
|
89
89
|
registerSnapshot(options: RegisterSnapshotOptions): Promise<SandboxSnapshot>;
|
|
90
90
|
registerSnapshotFromImage(name: string, image: Image, options?: Omit<RegisterSnapshotOptions, "name" | "image" | "dockerfileContent">): Promise<SandboxSnapshot>;
|
|
91
91
|
/** Look a snapshot up by name. In a cluster the request is routed to the node holding the image. */
|
package/dist/MicroVM.js
CHANGED
|
@@ -66,8 +66,8 @@ export class MicroVM {
|
|
|
66
66
|
const sandbox = await this.client.stop(id);
|
|
67
67
|
return this.wrap(sandbox.toJSON());
|
|
68
68
|
}
|
|
69
|
-
async createSnapshot(id, name) {
|
|
70
|
-
return this.client.createSnapshot(id, name);
|
|
69
|
+
async createSnapshot(id, name, options = {}) {
|
|
70
|
+
return this.client.createSnapshot(id, name, options);
|
|
71
71
|
}
|
|
72
72
|
async registerSnapshot(options) {
|
|
73
73
|
return this.client.registerSnapshot(options);
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export { Image } from "./Image.js";
|
|
|
4
4
|
export { MicroVMApiError } from "./errors.js";
|
|
5
5
|
export type { MicroVMConfig, Tokens } from "./MicroVM.js";
|
|
6
6
|
export type { RetryConfig } from "./internal/client.js";
|
|
7
|
-
export type { AddCustomDomainOptions, APIToken, APITokenList, CreateAPITokenOptions, CreatedAPIToken, WhoAmI, WhoAmIPrincipal, AuditEvent, AuditOptions, AuditPage, EgressProfile, EgressProfileList, EgressProfileOptions, EgressProfileRef, EgressInject, EgressRule, ListEgressProfilesOptions, NetworkLearned, NetworkLearnedEntry, NetworkPolicy, NetworkPolicyCheckOptions, NetworkPolicyCheckResult, NetworkPolicyOptions, BinaryLike, BuildImageOptions, BuildImagePushOptions, BuildImageResult, CloneGeneration, CreateOptions, CreateSessionOptions, CreateTemplateOptions, CreateWasmModuleOptions, CustomDomain, CustomDomainDNSRecords, CustomDomainStatus, DNSRecord, DNSRecordType, ExecRequest, ExecResult, ExecExitInfo, ExposedPort, ExposePortOptions, ExposeProtocol, ExposeResult, Failover, FailoverPolicy, GetOptions, HealthStatus, IngressTarget, IngressTargetSource, Lifecycle, ListOptions, MountSpec, MountSpecRedacted, MountType, PlatformVolumeMount, RegisterSnapshotOptions, ListSnapshotsOptions, SnapshotList, RegistryAuth, ResizeOptions, Sandbox as SandboxData, SandboxSnapshot, SandboxStatus, Session, SessionAttachHandle, SessionAttachOptions, SessionStatus, Template, TemplatePushState, TemplateStatus, WasmModule, WasmModuleStatus, PushWasmModuleOptions, PushWasmModuleResult, UpdateLifecycleOptions, } from "./types.js";
|
|
7
|
+
export type { AddCustomDomainOptions, APIToken, APITokenList, CreateAPITokenOptions, CreatedAPIToken, WhoAmI, WhoAmIPrincipal, AuditEvent, AuditOptions, AuditPage, EgressProfile, EgressProfileList, EgressProfileOptions, EgressProfileRef, EgressInject, EgressRule, ListEgressProfilesOptions, NetworkLearned, NetworkLearnedEntry, NetworkPolicy, NetworkPolicyCheckOptions, NetworkPolicyCheckResult, NetworkPolicyOptions, BinaryLike, BuildImageOptions, BuildImagePushOptions, BuildImageResult, CloneGeneration, CreateOptions, CreateSessionOptions, CreateTemplateOptions, CreateWasmModuleOptions, CustomDomain, CustomDomainDNSRecords, CustomDomainStatus, DNSRecord, DNSRecordType, ExecRequest, ExecResult, ExecExitInfo, ExposedPort, ExposePortOptions, ExposeProtocol, ExposeResult, Failover, FailoverPolicy, GetOptions, HealthStatus, IngressTarget, IngressTargetSource, Lifecycle, ListOptions, MountSpec, MountSpecRedacted, MountType, PlatformVolumeMount, CreateSnapshotOptions, RegisterSnapshotOptions, ListSnapshotsOptions, SnapshotList, RegistryAuth, ResizeOptions, Sandbox as SandboxData, SandboxSnapshot, SandboxStatus, Session, SessionAttachHandle, SessionAttachOptions, SessionStatus, Template, TemplatePushState, TemplateStatus, WasmModule, WasmModuleStatus, PushWasmModuleOptions, PushWasmModuleResult, UpdateLifecycleOptions, } from "./types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Image } from "../Image.js";
|
|
2
|
-
import type { AddCustomDomainOptions, APITokenList, BinaryLike, BuildImageOptions, BuildImageResult, CreateAPITokenOptions, CreatedAPIToken, CreateOptions, CreateSessionOptions, CreateTemplateOptions, CreateWasmModuleOptions, PushWasmModuleOptions, PushWasmModuleResult, CustomDomain, CloneGeneration, CustomDomainDNSRecords, ExecRequest, ExecResult, ExecStreamHandle, ExecStreamOptions, ExposedPort, ExposePortOptions, ExposeResult, Failover, HealthStatus, IngressTarget, Lifecycle, GetOptions, ListOptions, MountSpecRedacted, NetworkUsage, AuditOptions, AuditPage, EgressProfile, EgressProfileList, EgressProfileOptions, EgressProfileRef, EgressRule, ListEgressProfilesOptions, NetworkLearned, NetworkPolicy, NetworkPolicyCheckOptions, NetworkPolicyCheckResult, NetworkPolicyOptions, ListSnapshotsOptions, RegisterSnapshotOptions, SnapshotList, SetNetworkLimitsOptions, ResizeOptions, Sandbox, SandboxSnapshot, Session, SessionAttachHandle, SessionAttachOptions, Template, WasmModule, WhoAmI } from "../types.js";
|
|
2
|
+
import type { AddCustomDomainOptions, APITokenList, BinaryLike, BuildImageOptions, BuildImageResult, CreateAPITokenOptions, CreatedAPIToken, CreateOptions, CreateSessionOptions, CreateTemplateOptions, CreateWasmModuleOptions, PushWasmModuleOptions, PushWasmModuleResult, CustomDomain, CloneGeneration, CustomDomainDNSRecords, ExecRequest, ExecResult, ExecStreamHandle, ExecStreamOptions, ExposedPort, ExposePortOptions, ExposeResult, Failover, HealthStatus, IngressTarget, Lifecycle, GetOptions, ListOptions, MountSpecRedacted, NetworkUsage, AuditOptions, AuditPage, EgressProfile, EgressProfileList, EgressProfileOptions, EgressProfileRef, EgressRule, ListEgressProfilesOptions, NetworkLearned, NetworkPolicy, NetworkPolicyCheckOptions, NetworkPolicyCheckResult, NetworkPolicyOptions, ListSnapshotsOptions, CreateSnapshotOptions, RegisterSnapshotOptions, SnapshotList, SetNetworkLimitsOptions, ResizeOptions, Sandbox, SandboxSnapshot, Session, SessionAttachHandle, SessionAttachOptions, Template, WasmModule, WhoAmI } from "../types.js";
|
|
3
3
|
type FetchLike = typeof fetch;
|
|
4
4
|
/**
|
|
5
5
|
* The request header that selects which of a credential's teams a request
|
|
@@ -157,7 +157,7 @@ export declare class APIClient {
|
|
|
157
157
|
get(id: string, options?: GetOptions): Promise<SandboxResource>;
|
|
158
158
|
start(id: string): Promise<SandboxResource>;
|
|
159
159
|
stop(id: string): Promise<SandboxResource>;
|
|
160
|
-
createSnapshot(id: string, name: string): Promise<SandboxSnapshot>;
|
|
160
|
+
createSnapshot(id: string, name: string, options?: CreateSnapshotOptions): Promise<SandboxSnapshot>;
|
|
161
161
|
registerSnapshot(options: RegisterSnapshotOptions): Promise<SandboxSnapshot>;
|
|
162
162
|
registerSnapshotFromImage(name: string, image: Image, options?: Omit<RegisterSnapshotOptions, "name" | "image" | "dockerfileContent">): Promise<SandboxSnapshot>;
|
|
163
163
|
getSnapshot(name: string): Promise<SandboxSnapshot>;
|
|
@@ -337,7 +337,7 @@ export declare class SandboxResource implements Sandbox {
|
|
|
337
337
|
list(): Promise<CustomDomain[]>;
|
|
338
338
|
dns(): Promise<CustomDomainDNSRecords>;
|
|
339
339
|
};
|
|
340
|
-
createSnapshot(name: string): Promise<SandboxSnapshot>;
|
|
340
|
+
createSnapshot(name: string, options?: CreateSnapshotOptions): Promise<SandboxSnapshot>;
|
|
341
341
|
start(): Promise<this>;
|
|
342
342
|
stop(): Promise<this>;
|
|
343
343
|
destroy(): Promise<void>;
|
package/dist/internal/client.js
CHANGED
|
@@ -405,8 +405,12 @@ export class APIClient {
|
|
|
405
405
|
const response = await this.doJSON("POST", `${this.versionPrefix}/sandboxes/${id}/stop`);
|
|
406
406
|
return this.wrap(response);
|
|
407
407
|
}
|
|
408
|
-
async createSnapshot(id, name) {
|
|
409
|
-
const
|
|
408
|
+
async createSnapshot(id, name, options = {}) {
|
|
409
|
+
const body = { name };
|
|
410
|
+
if (options.allowPause !== undefined) {
|
|
411
|
+
body.allow_pause = options.allowPause;
|
|
412
|
+
}
|
|
413
|
+
const response = await this.doJSON("POST", `${this.versionPrefix}/sandboxes/${id}/snapshot`, body);
|
|
410
414
|
return fromApiSandboxSnapshot(response);
|
|
411
415
|
}
|
|
412
416
|
async registerSnapshot(options) {
|
|
@@ -946,8 +950,8 @@ export class SandboxResource {
|
|
|
946
950
|
dns: () => client.customDomainDNS(id),
|
|
947
951
|
};
|
|
948
952
|
}
|
|
949
|
-
async createSnapshot(name) {
|
|
950
|
-
return this.client.createSnapshot(this.id, name);
|
|
953
|
+
async createSnapshot(name, options = {}) {
|
|
954
|
+
return this.client.createSnapshot(this.id, name, options);
|
|
951
955
|
}
|
|
952
956
|
async start() {
|
|
953
957
|
const updated = await this.client.start(this.id);
|
package/dist/types.d.ts
CHANGED
|
@@ -29,6 +29,16 @@ export interface BuildImageResult {
|
|
|
29
29
|
/** Pushed reference, e.g. "ghcr.io/my-org/my-image:v1.2.3". */
|
|
30
30
|
pushed?: string;
|
|
31
31
|
}
|
|
32
|
+
export interface CreateSnapshotOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Whether the snapshot may pause a running sandbox. Defaults to true: a
|
|
35
|
+
* running sandbox is paused while it is copied (its disk writes wait;
|
|
36
|
+
* Docker pauses the container) and keeps running afterwards. Set false to
|
|
37
|
+
* have a sandbox that is not stopped refused with HTTP 409 instead, for a
|
|
38
|
+
* workload that must never stall. A stopped sandbox needs no pause.
|
|
39
|
+
*/
|
|
40
|
+
allowPause?: boolean;
|
|
41
|
+
}
|
|
32
42
|
export interface RegisterSnapshotOptions {
|
|
33
43
|
/** Human-readable identifier other callers use in `CreateOptions.snapshot`. */
|
|
34
44
|
name: string;
|