@sandbox-engine/sdk 0.1.0 → 0.1.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/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +20 -1
- package/dist/index.mjs +20 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -31,6 +31,11 @@ interface SandboxOptions {
|
|
|
31
31
|
dockerfile?: string;
|
|
32
32
|
timeout?: number;
|
|
33
33
|
}
|
|
34
|
+
interface ProxyEnvResult {
|
|
35
|
+
proxyBase: string;
|
|
36
|
+
expiresAt: string;
|
|
37
|
+
env: Record<string, string>;
|
|
38
|
+
}
|
|
34
39
|
interface ExecOptions {
|
|
35
40
|
args?: string[];
|
|
36
41
|
cwd?: string;
|
|
@@ -108,11 +113,16 @@ declare class Sandbox {
|
|
|
108
113
|
stream: true;
|
|
109
114
|
}): Promise<Process>;
|
|
110
115
|
terminal(): Promise<Terminal>;
|
|
116
|
+
readonly secrets: {
|
|
117
|
+
getProxyEnv: (secretNames: string[]) => Promise<ProxyEnvResult>;
|
|
118
|
+
};
|
|
111
119
|
readonly ports: {
|
|
112
120
|
list: () => Promise<PortMapping[]>;
|
|
121
|
+
expose: (containerPort: number) => Promise<void>;
|
|
122
|
+
unexpose: (containerPort: number) => Promise<void>;
|
|
113
123
|
};
|
|
114
124
|
info(): Promise<SandboxApiResponse>;
|
|
115
125
|
close(): Promise<void>;
|
|
116
126
|
}
|
|
117
127
|
|
|
118
|
-
export { type ExecOptions, type ExecResult, type FileEntry, Filesystem, type PortMapping, Process, Sandbox, type SandboxOptions, Terminal, type WsMessage, type WsMessageType };
|
|
128
|
+
export { type ExecOptions, type ExecResult, type FileEntry, Filesystem, type PortMapping, Process, type ProxyEnvResult, Sandbox, type SandboxOptions, Terminal, type WsMessage, type WsMessageType };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,11 @@ interface SandboxOptions {
|
|
|
31
31
|
dockerfile?: string;
|
|
32
32
|
timeout?: number;
|
|
33
33
|
}
|
|
34
|
+
interface ProxyEnvResult {
|
|
35
|
+
proxyBase: string;
|
|
36
|
+
expiresAt: string;
|
|
37
|
+
env: Record<string, string>;
|
|
38
|
+
}
|
|
34
39
|
interface ExecOptions {
|
|
35
40
|
args?: string[];
|
|
36
41
|
cwd?: string;
|
|
@@ -108,11 +113,16 @@ declare class Sandbox {
|
|
|
108
113
|
stream: true;
|
|
109
114
|
}): Promise<Process>;
|
|
110
115
|
terminal(): Promise<Terminal>;
|
|
116
|
+
readonly secrets: {
|
|
117
|
+
getProxyEnv: (secretNames: string[]) => Promise<ProxyEnvResult>;
|
|
118
|
+
};
|
|
111
119
|
readonly ports: {
|
|
112
120
|
list: () => Promise<PortMapping[]>;
|
|
121
|
+
expose: (containerPort: number) => Promise<void>;
|
|
122
|
+
unexpose: (containerPort: number) => Promise<void>;
|
|
113
123
|
};
|
|
114
124
|
info(): Promise<SandboxApiResponse>;
|
|
115
125
|
close(): Promise<void>;
|
|
116
126
|
}
|
|
117
127
|
|
|
118
|
-
export { type ExecOptions, type ExecResult, type FileEntry, Filesystem, type PortMapping, Process, Sandbox, type SandboxOptions, Terminal, type WsMessage, type WsMessageType };
|
|
128
|
+
export { type ExecOptions, type ExecResult, type FileEntry, Filesystem, type PortMapping, Process, type ProxyEnvResult, Sandbox, type SandboxOptions, Terminal, type WsMessage, type WsMessageType };
|
package/dist/index.js
CHANGED
|
@@ -246,7 +246,8 @@ var Sandbox = class _Sandbox {
|
|
|
246
246
|
type: "input",
|
|
247
247
|
cmd,
|
|
248
248
|
args,
|
|
249
|
-
cwd
|
|
249
|
+
cwd,
|
|
250
|
+
env
|
|
250
251
|
};
|
|
251
252
|
ws.send(JSON.stringify(req));
|
|
252
253
|
resolve();
|
|
@@ -271,12 +272,30 @@ var Sandbox = class _Sandbox {
|
|
|
271
272
|
});
|
|
272
273
|
return new Terminal(ws);
|
|
273
274
|
}
|
|
275
|
+
secrets = {
|
|
276
|
+
getProxyEnv: async (secretNames) => {
|
|
277
|
+
return this.client.post(`/api/sandboxes/${this.id}/proxy-env`, {
|
|
278
|
+
secrets: secretNames
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
};
|
|
274
282
|
ports = {
|
|
275
283
|
list: async () => {
|
|
276
284
|
const res = await this.client.get(
|
|
277
285
|
`/api/sandboxes/${this.id}/ports`
|
|
278
286
|
);
|
|
279
287
|
return res.ports;
|
|
288
|
+
},
|
|
289
|
+
expose: async (containerPort) => {
|
|
290
|
+
await this.client.post(
|
|
291
|
+
`/api/sandboxes/${this.id}/ports/${containerPort}/expose`,
|
|
292
|
+
{}
|
|
293
|
+
);
|
|
294
|
+
},
|
|
295
|
+
unexpose: async (containerPort) => {
|
|
296
|
+
await this.client.delete(
|
|
297
|
+
`/api/sandboxes/${this.id}/ports/${containerPort}/expose`
|
|
298
|
+
);
|
|
280
299
|
}
|
|
281
300
|
};
|
|
282
301
|
async info() {
|
package/dist/index.mjs
CHANGED
|
@@ -207,7 +207,8 @@ var Sandbox = class _Sandbox {
|
|
|
207
207
|
type: "input",
|
|
208
208
|
cmd,
|
|
209
209
|
args,
|
|
210
|
-
cwd
|
|
210
|
+
cwd,
|
|
211
|
+
env
|
|
211
212
|
};
|
|
212
213
|
ws.send(JSON.stringify(req));
|
|
213
214
|
resolve();
|
|
@@ -232,12 +233,30 @@ var Sandbox = class _Sandbox {
|
|
|
232
233
|
});
|
|
233
234
|
return new Terminal(ws);
|
|
234
235
|
}
|
|
236
|
+
secrets = {
|
|
237
|
+
getProxyEnv: async (secretNames) => {
|
|
238
|
+
return this.client.post(`/api/sandboxes/${this.id}/proxy-env`, {
|
|
239
|
+
secrets: secretNames
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
};
|
|
235
243
|
ports = {
|
|
236
244
|
list: async () => {
|
|
237
245
|
const res = await this.client.get(
|
|
238
246
|
`/api/sandboxes/${this.id}/ports`
|
|
239
247
|
);
|
|
240
248
|
return res.ports;
|
|
249
|
+
},
|
|
250
|
+
expose: async (containerPort) => {
|
|
251
|
+
await this.client.post(
|
|
252
|
+
`/api/sandboxes/${this.id}/ports/${containerPort}/expose`,
|
|
253
|
+
{}
|
|
254
|
+
);
|
|
255
|
+
},
|
|
256
|
+
unexpose: async (containerPort) => {
|
|
257
|
+
await this.client.delete(
|
|
258
|
+
`/api/sandboxes/${this.id}/ports/${containerPort}/expose`
|
|
259
|
+
);
|
|
241
260
|
}
|
|
242
261
|
};
|
|
243
262
|
async info() {
|
package/package.json
CHANGED