@slicervm/sdk 0.1.8 → 0.1.10
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/README.md +10 -2
- package/dist/index.cjs +65 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -2
- package/dist/index.d.ts +39 -2
- package/dist/index.js +65 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -27,6 +27,15 @@ interface VMInfo {
|
|
|
27
27
|
status?: string;
|
|
28
28
|
persistent?: boolean;
|
|
29
29
|
}
|
|
30
|
+
interface VMTagResponse {
|
|
31
|
+
hostname: string;
|
|
32
|
+
tags: string[];
|
|
33
|
+
}
|
|
34
|
+
interface VMTagUpdate {
|
|
35
|
+
add?: string[];
|
|
36
|
+
remove?: string[];
|
|
37
|
+
replace?: string[];
|
|
38
|
+
}
|
|
30
39
|
/**
|
|
31
40
|
* Per-launch network policy override for isolated host groups.
|
|
32
41
|
* Omitted lists inherit the host group's policy. Empty lists intentionally
|
|
@@ -320,11 +329,31 @@ interface VMForkNetworkPolicy {
|
|
|
320
329
|
/** Omit to inherit; pass an empty array to clear the drop list. */
|
|
321
330
|
drop?: string[];
|
|
322
331
|
}
|
|
332
|
+
type VMForkWait = 'agent' | 'none';
|
|
333
|
+
type VMForkTagMode = 'append' | 'replace';
|
|
334
|
+
type VMForkFixup = 'hostname' | 'machine-id' | 'ssh-host-keys';
|
|
323
335
|
interface VMForkOptions {
|
|
324
|
-
/**
|
|
336
|
+
/**
|
|
337
|
+
* Defaults to agent. None acknowledges launch only; the daemon removes the
|
|
338
|
+
* child if requested asynchronous finalisation later fails.
|
|
339
|
+
*/
|
|
340
|
+
wait?: VMForkWait;
|
|
341
|
+
/** Server-side agent/finalisation timeout in seconds when waiting. */
|
|
325
342
|
waitTimeoutSec?: number;
|
|
326
343
|
network?: VMForkNetworkPolicy;
|
|
344
|
+
/** Omit to inherit tags; provided tags append unless tagMode is replace. */
|
|
327
345
|
tags?: string[];
|
|
346
|
+
tagMode?: VMForkTagMode;
|
|
347
|
+
/** Omit to inherit grants; pass an empty array to clear and blot secrets. */
|
|
348
|
+
secrets?: string[];
|
|
349
|
+
/** Defaults to true; false makes the fork ephemeral. */
|
|
350
|
+
persistent?: boolean;
|
|
351
|
+
/** Omit for all correctness fix-ups; pass an empty array to disable them. */
|
|
352
|
+
fixups?: VMForkFixup[];
|
|
353
|
+
/** Child vCPU count, up to the source host-group limit. */
|
|
354
|
+
vcpu?: number;
|
|
355
|
+
/** Child RAM in bytes, up to the source host-group limit. */
|
|
356
|
+
ramBytes?: number;
|
|
328
357
|
}
|
|
329
358
|
interface VMForkResponse {
|
|
330
359
|
hostname: string;
|
|
@@ -334,6 +363,7 @@ interface VMForkResponse {
|
|
|
334
363
|
parentStatus?: string;
|
|
335
364
|
childStatus?: string;
|
|
336
365
|
mode: string;
|
|
366
|
+
persistent?: boolean;
|
|
337
367
|
}
|
|
338
368
|
interface VMNetworkPolicy {
|
|
339
369
|
allow: string[];
|
|
@@ -629,6 +659,7 @@ interface VMInit {
|
|
|
629
659
|
ip?: string;
|
|
630
660
|
createdAt?: string;
|
|
631
661
|
arch?: string;
|
|
662
|
+
tags?: string[];
|
|
632
663
|
}
|
|
633
664
|
declare class CommittedVM {
|
|
634
665
|
private readonly transport;
|
|
@@ -651,10 +682,16 @@ declare class VM {
|
|
|
651
682
|
readonly ip?: string;
|
|
652
683
|
readonly createdAt?: string;
|
|
653
684
|
readonly arch?: string;
|
|
685
|
+
tags?: string[];
|
|
654
686
|
readonly fs: VMFileSystem;
|
|
655
687
|
readonly bg: VMBg;
|
|
656
688
|
private readonly transport;
|
|
657
689
|
constructor(transport: TransportClient, init: VMInit);
|
|
690
|
+
getTags(): Promise<string[]>;
|
|
691
|
+
updateTags(update: VMTagUpdate): Promise<string[]>;
|
|
692
|
+
addTags(...tags: string[]): Promise<string[]>;
|
|
693
|
+
removeTags(...tags: string[]): Promise<string[]>;
|
|
694
|
+
replaceTags(tags: string[]): Promise<string[]>;
|
|
658
695
|
delete(): Promise<void>;
|
|
659
696
|
health(): Promise<AgentHealth>;
|
|
660
697
|
logs(): Promise<VMLogs>;
|
|
@@ -1088,4 +1125,4 @@ declare class SlicerShellSession {
|
|
|
1088
1125
|
private teardown;
|
|
1089
1126
|
}
|
|
1090
1127
|
|
|
1091
|
-
export { type AddProxyAllowRequest, type AddressMapping, type AgentHealth, type BgDeleteResponse, type BgExecInfo, type BgExecRequest, type BgExecResponse, type BgKillOptions, type BgKillResponse, type BgLogOptions, type BgWaitExitResponse, CommitsAPI, CommittedVM, type CreateProxyClientOptions, type CreateProxySecretRequest, type CreateSecretRequest, type CreateVMNetworkPolicy, type CreateVMOptions, type CreateVMRequest, type CreateVMResponse, type DeleteResponse, type ExecFrame, type ExecRequest, type ExecResult, type ExecResultBinary, type ExecStdio, ExecStdioBase64, ExecStdioText, FRAME_TYPE_DATA, FRAME_TYPE_HEARTBEAT, FRAME_TYPE_SESSION_CLOSE, FRAME_TYPE_SHUTDOWN, FRAME_TYPE_WINDOW_SIZE, type FSEntry, type FSMkdirRequest, type FSWatchEvent, type FSWatchEventType, type FSWatchRequest, Forwarder, type ForwarderListener, type ForwarderOptions, GiB, type HostGroup, HostGroupsAPI, type ListOptions, MiB, NonRootUser, ProxyAPI, type ProxyAllowRule, ProxyAllowsAPI, type ProxyClient, type ProxyClientCreated, ProxyClientsAPI, type ProxySecret, ProxySecretBasic, ProxySecretBearer, ProxySecretOAuthClientCredentials, type ProxySecretType, ProxySecretsAPI, type RemoveProxyAllowByTupleRequest, type Secret, SecretExistsError, SecretsAPI, type ShellSessionOptions, type ShutdownRequest, SlicerAPIError, SlicerClient, type SlicerClientOptions, type SlicerInfo, SlicerShellSession, type UpdateSecretRequest, VM, VMBg, type VMCommitDeleteResponse, type VMCommitInfo, type VMCommitListOptions, type VMCommitOptions, type VMCommitResponse, type VMDescription, VMFileSystem, type VMForkNetworkPolicy, type VMForkOptions, type VMForkResponse, type VMInfo, type VMInit, type VMLogs, type VMNetworkDescription, type VMNetworkPolicy, type VMSnapshot, type VMStat, VMsAPI, type WaitOptions, type XTermLike, encodeFrame, parseAddressMapping, parseFrame, resolveTransport };
|
|
1128
|
+
export { type AddProxyAllowRequest, type AddressMapping, type AgentHealth, type BgDeleteResponse, type BgExecInfo, type BgExecRequest, type BgExecResponse, type BgKillOptions, type BgKillResponse, type BgLogOptions, type BgWaitExitResponse, CommitsAPI, CommittedVM, type CreateProxyClientOptions, type CreateProxySecretRequest, type CreateSecretRequest, type CreateVMNetworkPolicy, type CreateVMOptions, type CreateVMRequest, type CreateVMResponse, type DeleteResponse, type ExecFrame, type ExecRequest, type ExecResult, type ExecResultBinary, type ExecStdio, ExecStdioBase64, ExecStdioText, FRAME_TYPE_DATA, FRAME_TYPE_HEARTBEAT, FRAME_TYPE_SESSION_CLOSE, FRAME_TYPE_SHUTDOWN, FRAME_TYPE_WINDOW_SIZE, type FSEntry, type FSMkdirRequest, type FSWatchEvent, type FSWatchEventType, type FSWatchRequest, Forwarder, type ForwarderListener, type ForwarderOptions, GiB, type HostGroup, HostGroupsAPI, type ListOptions, MiB, NonRootUser, ProxyAPI, type ProxyAllowRule, ProxyAllowsAPI, type ProxyClient, type ProxyClientCreated, ProxyClientsAPI, type ProxySecret, ProxySecretBasic, ProxySecretBearer, ProxySecretOAuthClientCredentials, type ProxySecretType, ProxySecretsAPI, type RemoveProxyAllowByTupleRequest, type Secret, SecretExistsError, SecretsAPI, type ShellSessionOptions, type ShutdownRequest, SlicerAPIError, SlicerClient, type SlicerClientOptions, type SlicerInfo, SlicerShellSession, type UpdateSecretRequest, VM, VMBg, type VMCommitDeleteResponse, type VMCommitInfo, type VMCommitListOptions, type VMCommitOptions, type VMCommitResponse, type VMDescription, VMFileSystem, type VMForkFixup, type VMForkNetworkPolicy, type VMForkOptions, type VMForkResponse, type VMForkTagMode, type VMForkWait, type VMInfo, type VMInit, type VMLogs, type VMNetworkDescription, type VMNetworkPolicy, type VMSnapshot, type VMStat, type VMTagResponse, type VMTagUpdate, VMsAPI, type WaitOptions, type XTermLike, encodeFrame, parseAddressMapping, parseFrame, resolveTransport };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,15 @@ interface VMInfo {
|
|
|
27
27
|
status?: string;
|
|
28
28
|
persistent?: boolean;
|
|
29
29
|
}
|
|
30
|
+
interface VMTagResponse {
|
|
31
|
+
hostname: string;
|
|
32
|
+
tags: string[];
|
|
33
|
+
}
|
|
34
|
+
interface VMTagUpdate {
|
|
35
|
+
add?: string[];
|
|
36
|
+
remove?: string[];
|
|
37
|
+
replace?: string[];
|
|
38
|
+
}
|
|
30
39
|
/**
|
|
31
40
|
* Per-launch network policy override for isolated host groups.
|
|
32
41
|
* Omitted lists inherit the host group's policy. Empty lists intentionally
|
|
@@ -320,11 +329,31 @@ interface VMForkNetworkPolicy {
|
|
|
320
329
|
/** Omit to inherit; pass an empty array to clear the drop list. */
|
|
321
330
|
drop?: string[];
|
|
322
331
|
}
|
|
332
|
+
type VMForkWait = 'agent' | 'none';
|
|
333
|
+
type VMForkTagMode = 'append' | 'replace';
|
|
334
|
+
type VMForkFixup = 'hostname' | 'machine-id' | 'ssh-host-keys';
|
|
323
335
|
interface VMForkOptions {
|
|
324
|
-
/**
|
|
336
|
+
/**
|
|
337
|
+
* Defaults to agent. None acknowledges launch only; the daemon removes the
|
|
338
|
+
* child if requested asynchronous finalisation later fails.
|
|
339
|
+
*/
|
|
340
|
+
wait?: VMForkWait;
|
|
341
|
+
/** Server-side agent/finalisation timeout in seconds when waiting. */
|
|
325
342
|
waitTimeoutSec?: number;
|
|
326
343
|
network?: VMForkNetworkPolicy;
|
|
344
|
+
/** Omit to inherit tags; provided tags append unless tagMode is replace. */
|
|
327
345
|
tags?: string[];
|
|
346
|
+
tagMode?: VMForkTagMode;
|
|
347
|
+
/** Omit to inherit grants; pass an empty array to clear and blot secrets. */
|
|
348
|
+
secrets?: string[];
|
|
349
|
+
/** Defaults to true; false makes the fork ephemeral. */
|
|
350
|
+
persistent?: boolean;
|
|
351
|
+
/** Omit for all correctness fix-ups; pass an empty array to disable them. */
|
|
352
|
+
fixups?: VMForkFixup[];
|
|
353
|
+
/** Child vCPU count, up to the source host-group limit. */
|
|
354
|
+
vcpu?: number;
|
|
355
|
+
/** Child RAM in bytes, up to the source host-group limit. */
|
|
356
|
+
ramBytes?: number;
|
|
328
357
|
}
|
|
329
358
|
interface VMForkResponse {
|
|
330
359
|
hostname: string;
|
|
@@ -334,6 +363,7 @@ interface VMForkResponse {
|
|
|
334
363
|
parentStatus?: string;
|
|
335
364
|
childStatus?: string;
|
|
336
365
|
mode: string;
|
|
366
|
+
persistent?: boolean;
|
|
337
367
|
}
|
|
338
368
|
interface VMNetworkPolicy {
|
|
339
369
|
allow: string[];
|
|
@@ -629,6 +659,7 @@ interface VMInit {
|
|
|
629
659
|
ip?: string;
|
|
630
660
|
createdAt?: string;
|
|
631
661
|
arch?: string;
|
|
662
|
+
tags?: string[];
|
|
632
663
|
}
|
|
633
664
|
declare class CommittedVM {
|
|
634
665
|
private readonly transport;
|
|
@@ -651,10 +682,16 @@ declare class VM {
|
|
|
651
682
|
readonly ip?: string;
|
|
652
683
|
readonly createdAt?: string;
|
|
653
684
|
readonly arch?: string;
|
|
685
|
+
tags?: string[];
|
|
654
686
|
readonly fs: VMFileSystem;
|
|
655
687
|
readonly bg: VMBg;
|
|
656
688
|
private readonly transport;
|
|
657
689
|
constructor(transport: TransportClient, init: VMInit);
|
|
690
|
+
getTags(): Promise<string[]>;
|
|
691
|
+
updateTags(update: VMTagUpdate): Promise<string[]>;
|
|
692
|
+
addTags(...tags: string[]): Promise<string[]>;
|
|
693
|
+
removeTags(...tags: string[]): Promise<string[]>;
|
|
694
|
+
replaceTags(tags: string[]): Promise<string[]>;
|
|
658
695
|
delete(): Promise<void>;
|
|
659
696
|
health(): Promise<AgentHealth>;
|
|
660
697
|
logs(): Promise<VMLogs>;
|
|
@@ -1088,4 +1125,4 @@ declare class SlicerShellSession {
|
|
|
1088
1125
|
private teardown;
|
|
1089
1126
|
}
|
|
1090
1127
|
|
|
1091
|
-
export { type AddProxyAllowRequest, type AddressMapping, type AgentHealth, type BgDeleteResponse, type BgExecInfo, type BgExecRequest, type BgExecResponse, type BgKillOptions, type BgKillResponse, type BgLogOptions, type BgWaitExitResponse, CommitsAPI, CommittedVM, type CreateProxyClientOptions, type CreateProxySecretRequest, type CreateSecretRequest, type CreateVMNetworkPolicy, type CreateVMOptions, type CreateVMRequest, type CreateVMResponse, type DeleteResponse, type ExecFrame, type ExecRequest, type ExecResult, type ExecResultBinary, type ExecStdio, ExecStdioBase64, ExecStdioText, FRAME_TYPE_DATA, FRAME_TYPE_HEARTBEAT, FRAME_TYPE_SESSION_CLOSE, FRAME_TYPE_SHUTDOWN, FRAME_TYPE_WINDOW_SIZE, type FSEntry, type FSMkdirRequest, type FSWatchEvent, type FSWatchEventType, type FSWatchRequest, Forwarder, type ForwarderListener, type ForwarderOptions, GiB, type HostGroup, HostGroupsAPI, type ListOptions, MiB, NonRootUser, ProxyAPI, type ProxyAllowRule, ProxyAllowsAPI, type ProxyClient, type ProxyClientCreated, ProxyClientsAPI, type ProxySecret, ProxySecretBasic, ProxySecretBearer, ProxySecretOAuthClientCredentials, type ProxySecretType, ProxySecretsAPI, type RemoveProxyAllowByTupleRequest, type Secret, SecretExistsError, SecretsAPI, type ShellSessionOptions, type ShutdownRequest, SlicerAPIError, SlicerClient, type SlicerClientOptions, type SlicerInfo, SlicerShellSession, type UpdateSecretRequest, VM, VMBg, type VMCommitDeleteResponse, type VMCommitInfo, type VMCommitListOptions, type VMCommitOptions, type VMCommitResponse, type VMDescription, VMFileSystem, type VMForkNetworkPolicy, type VMForkOptions, type VMForkResponse, type VMInfo, type VMInit, type VMLogs, type VMNetworkDescription, type VMNetworkPolicy, type VMSnapshot, type VMStat, VMsAPI, type WaitOptions, type XTermLike, encodeFrame, parseAddressMapping, parseFrame, resolveTransport };
|
|
1128
|
+
export { type AddProxyAllowRequest, type AddressMapping, type AgentHealth, type BgDeleteResponse, type BgExecInfo, type BgExecRequest, type BgExecResponse, type BgKillOptions, type BgKillResponse, type BgLogOptions, type BgWaitExitResponse, CommitsAPI, CommittedVM, type CreateProxyClientOptions, type CreateProxySecretRequest, type CreateSecretRequest, type CreateVMNetworkPolicy, type CreateVMOptions, type CreateVMRequest, type CreateVMResponse, type DeleteResponse, type ExecFrame, type ExecRequest, type ExecResult, type ExecResultBinary, type ExecStdio, ExecStdioBase64, ExecStdioText, FRAME_TYPE_DATA, FRAME_TYPE_HEARTBEAT, FRAME_TYPE_SESSION_CLOSE, FRAME_TYPE_SHUTDOWN, FRAME_TYPE_WINDOW_SIZE, type FSEntry, type FSMkdirRequest, type FSWatchEvent, type FSWatchEventType, type FSWatchRequest, Forwarder, type ForwarderListener, type ForwarderOptions, GiB, type HostGroup, HostGroupsAPI, type ListOptions, MiB, NonRootUser, ProxyAPI, type ProxyAllowRule, ProxyAllowsAPI, type ProxyClient, type ProxyClientCreated, ProxyClientsAPI, type ProxySecret, ProxySecretBasic, ProxySecretBearer, ProxySecretOAuthClientCredentials, type ProxySecretType, ProxySecretsAPI, type RemoveProxyAllowByTupleRequest, type Secret, SecretExistsError, SecretsAPI, type ShellSessionOptions, type ShutdownRequest, SlicerAPIError, SlicerClient, type SlicerClientOptions, type SlicerInfo, SlicerShellSession, type UpdateSecretRequest, VM, VMBg, type VMCommitDeleteResponse, type VMCommitInfo, type VMCommitListOptions, type VMCommitOptions, type VMCommitResponse, type VMDescription, VMFileSystem, type VMForkFixup, type VMForkNetworkPolicy, type VMForkOptions, type VMForkResponse, type VMForkTagMode, type VMForkWait, type VMInfo, type VMInit, type VMLogs, type VMNetworkDescription, type VMNetworkPolicy, type VMSnapshot, type VMStat, type VMTagResponse, type VMTagUpdate, VMsAPI, type WaitOptions, type XTermLike, encodeFrame, parseAddressMapping, parseFrame, resolveTransport };
|
package/dist/index.js
CHANGED
|
@@ -312,7 +312,8 @@ function vmForkFromWire(w) {
|
|
|
312
312
|
status: w.status,
|
|
313
313
|
...w.parent_status !== void 0 && { parentStatus: w.parent_status },
|
|
314
314
|
...w.child_status !== void 0 && { childStatus: w.child_status },
|
|
315
|
-
mode: w.mode ?? ""
|
|
315
|
+
mode: w.mode ?? "",
|
|
316
|
+
...w.persistent !== void 0 && { persistent: w.persistent }
|
|
316
317
|
};
|
|
317
318
|
}
|
|
318
319
|
function vmDescriptionFromWire(w) {
|
|
@@ -362,6 +363,31 @@ function secretFromWire(w) {
|
|
|
362
363
|
...w.modified_at !== void 0 && { modifiedAt: w.modified_at }
|
|
363
364
|
};
|
|
364
365
|
}
|
|
366
|
+
|
|
367
|
+
// src/fork.ts
|
|
368
|
+
function buildForkRequest(opts) {
|
|
369
|
+
const wait = opts.wait ?? "agent";
|
|
370
|
+
if (wait !== "agent" && wait !== "none") {
|
|
371
|
+
throw new Error(`invalid fork wait mode ${JSON.stringify(wait)}`);
|
|
372
|
+
}
|
|
373
|
+
const query = new URLSearchParams({ wait });
|
|
374
|
+
if (opts.waitTimeoutSec !== void 0 && opts.waitTimeoutSec > 0) {
|
|
375
|
+
query.set("timeout", `${opts.waitTimeoutSec}s`);
|
|
376
|
+
}
|
|
377
|
+
const body = {};
|
|
378
|
+
if (opts.network !== void 0) body.network = opts.network;
|
|
379
|
+
if (opts.tags !== void 0) body.tags = opts.tags;
|
|
380
|
+
if (opts.tagMode !== void 0) body.tag_mode = opts.tagMode;
|
|
381
|
+
if (opts.secrets !== void 0) body.secrets = opts.secrets;
|
|
382
|
+
if (opts.persistent !== void 0) body.persistent = opts.persistent;
|
|
383
|
+
if (opts.fixups !== void 0) body.fixups = opts.fixups;
|
|
384
|
+
if (opts.vcpu !== void 0) body.vcpu = opts.vcpu;
|
|
385
|
+
if (opts.ramBytes !== void 0) body.ram_bytes = opts.ramBytes;
|
|
386
|
+
return {
|
|
387
|
+
query: query.toString(),
|
|
388
|
+
...Object.keys(body).length > 0 && { body }
|
|
389
|
+
};
|
|
390
|
+
}
|
|
365
391
|
function looksLikeUnixSocketPath(s) {
|
|
366
392
|
if (!s) return false;
|
|
367
393
|
return s.startsWith("/") || s.startsWith("./") || s.startsWith("../") || s.includes("/");
|
|
@@ -840,6 +866,7 @@ var VM = class {
|
|
|
840
866
|
ip;
|
|
841
867
|
createdAt;
|
|
842
868
|
arch;
|
|
869
|
+
tags;
|
|
843
870
|
fs;
|
|
844
871
|
bg;
|
|
845
872
|
transport;
|
|
@@ -850,10 +877,37 @@ var VM = class {
|
|
|
850
877
|
if (init.ip !== void 0) this.ip = init.ip;
|
|
851
878
|
if (init.createdAt !== void 0) this.createdAt = init.createdAt;
|
|
852
879
|
if (init.arch !== void 0) this.arch = init.arch;
|
|
880
|
+
if (init.tags !== void 0) this.tags = init.tags;
|
|
853
881
|
this.fs = new VMFileSystem(transport, this.hostname);
|
|
854
882
|
this.bg = new VMBg(transport, this.hostname);
|
|
855
883
|
}
|
|
856
884
|
// --- lifecycle --------------------------------------------------------
|
|
885
|
+
async getTags() {
|
|
886
|
+
const response = await this.transport.request(
|
|
887
|
+
"GET",
|
|
888
|
+
`/vm/${encodeURIComponent(this.hostname)}/tags`
|
|
889
|
+
);
|
|
890
|
+
this.tags = response.tags;
|
|
891
|
+
return response.tags;
|
|
892
|
+
}
|
|
893
|
+
async updateTags(update) {
|
|
894
|
+
const response = await this.transport.request(
|
|
895
|
+
"PATCH",
|
|
896
|
+
`/vm/${encodeURIComponent(this.hostname)}/tags`,
|
|
897
|
+
update
|
|
898
|
+
);
|
|
899
|
+
this.tags = response.tags;
|
|
900
|
+
return response.tags;
|
|
901
|
+
}
|
|
902
|
+
async addTags(...tags) {
|
|
903
|
+
return this.updateTags({ add: tags });
|
|
904
|
+
}
|
|
905
|
+
async removeTags(...tags) {
|
|
906
|
+
return this.updateTags({ remove: tags });
|
|
907
|
+
}
|
|
908
|
+
async replaceTags(tags) {
|
|
909
|
+
return this.updateTags({ replace: tags });
|
|
910
|
+
}
|
|
857
911
|
async delete() {
|
|
858
912
|
await this.transport.request(
|
|
859
913
|
"DELETE",
|
|
@@ -1087,20 +1141,11 @@ function errMsg(e) {
|
|
|
1087
1141
|
}
|
|
1088
1142
|
async function forkPath(transport, commitId, opts) {
|
|
1089
1143
|
const id = validateCommitId(commitId);
|
|
1090
|
-
const
|
|
1091
|
-
q.set("wait", "agent");
|
|
1092
|
-
if (opts.waitTimeoutSec !== void 0 && opts.waitTimeoutSec > 0) {
|
|
1093
|
-
q.set("timeout", `${opts.waitTimeoutSec}s`);
|
|
1094
|
-
}
|
|
1095
|
-
const query = q.toString() ? `?${q.toString()}` : "";
|
|
1096
|
-
const body = opts.network !== void 0 || (opts.tags?.length ?? 0) > 0 ? {
|
|
1097
|
-
...opts.network !== void 0 && { network: opts.network },
|
|
1098
|
-
...(opts.tags?.length ?? 0) > 0 && { tags: opts.tags }
|
|
1099
|
-
} : void 0;
|
|
1144
|
+
const request = buildForkRequest(opts);
|
|
1100
1145
|
const wire = await transport.request(
|
|
1101
1146
|
"POST",
|
|
1102
|
-
`/vm/commits/${encodeURIComponent(id)}/fork
|
|
1103
|
-
body
|
|
1147
|
+
`/vm/commits/${encodeURIComponent(id)}/fork?${request.query}`,
|
|
1148
|
+
request.body
|
|
1104
1149
|
);
|
|
1105
1150
|
return vmForkFromWire(wire);
|
|
1106
1151
|
}
|
|
@@ -1319,7 +1364,8 @@ var VMsAPI = class {
|
|
|
1319
1364
|
hostGroup: res.hostGroup ?? hostGroup,
|
|
1320
1365
|
...res.ip !== void 0 && { ip: res.ip },
|
|
1321
1366
|
...res.createdAt !== void 0 && { createdAt: res.createdAt },
|
|
1322
|
-
...res.arch !== void 0 && { arch: res.arch }
|
|
1367
|
+
...res.arch !== void 0 && { arch: res.arch },
|
|
1368
|
+
...req.tags !== void 0 && { tags: [...req.tags] }
|
|
1323
1369
|
});
|
|
1324
1370
|
}
|
|
1325
1371
|
/**
|
|
@@ -1339,7 +1385,8 @@ var VMsAPI = class {
|
|
|
1339
1385
|
hostGroup: found.hostGroup ?? "",
|
|
1340
1386
|
...found.ip !== void 0 && { ip: found.ip },
|
|
1341
1387
|
...found.createdAt !== void 0 && { createdAt: found.createdAt },
|
|
1342
|
-
...found.arch !== void 0 && { arch: found.arch }
|
|
1388
|
+
...found.arch !== void 0 && { arch: found.arch },
|
|
1389
|
+
...found.tags !== void 0 && { tags: found.tags }
|
|
1343
1390
|
});
|
|
1344
1391
|
}
|
|
1345
1392
|
/** Return raw VM metadata across all host groups. */
|
|
@@ -1401,18 +1448,11 @@ var CommitsAPI = class {
|
|
|
1401
1448
|
}
|
|
1402
1449
|
async fork(commitId, opts = {}) {
|
|
1403
1450
|
const id = validateCommitId2(commitId);
|
|
1404
|
-
const
|
|
1405
|
-
if (opts.waitTimeoutSec !== void 0 && opts.waitTimeoutSec > 0) {
|
|
1406
|
-
qs.set("timeout", `${opts.waitTimeoutSec}s`);
|
|
1407
|
-
}
|
|
1408
|
-
const body = opts.network !== void 0 || (opts.tags?.length ?? 0) > 0 ? {
|
|
1409
|
-
...opts.network !== void 0 && { network: opts.network },
|
|
1410
|
-
...(opts.tags?.length ?? 0) > 0 && { tags: opts.tags }
|
|
1411
|
-
} : void 0;
|
|
1451
|
+
const request = buildForkRequest(opts);
|
|
1412
1452
|
const wire = await this.transport.request(
|
|
1413
1453
|
"POST",
|
|
1414
|
-
`/vm/commits/${encodeURIComponent(id)}/fork?${
|
|
1415
|
-
body
|
|
1454
|
+
`/vm/commits/${encodeURIComponent(id)}/fork?${request.query}`,
|
|
1455
|
+
request.body
|
|
1416
1456
|
);
|
|
1417
1457
|
return vmForkFromWire(wire);
|
|
1418
1458
|
}
|