sandbox 3.0.0-beta.24 → 3.0.0-beta.25
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.
|
@@ -2998,9 +2998,9 @@ var require_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-t
|
|
|
2998
2998
|
|
|
2999
2999
|
//#endregion
|
|
3000
3000
|
//#region src/args/runtime.ts
|
|
3001
|
-
var import_cjs$
|
|
3001
|
+
var import_cjs$28 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3002
3002
|
const runtimeType = {
|
|
3003
|
-
...import_cjs$
|
|
3003
|
+
...import_cjs$28.oneOf([
|
|
3004
3004
|
"node22",
|
|
3005
3005
|
"node24",
|
|
3006
3006
|
"node26",
|
|
@@ -3008,7 +3008,7 @@ const runtimeType = {
|
|
|
3008
3008
|
]),
|
|
3009
3009
|
displayName: "runtime"
|
|
3010
3010
|
};
|
|
3011
|
-
const runtime = import_cjs$
|
|
3011
|
+
const runtime = import_cjs$28.option({
|
|
3012
3012
|
long: "runtime",
|
|
3013
3013
|
type: runtimeType,
|
|
3014
3014
|
defaultValue: () => "node24",
|
|
@@ -3136,9 +3136,9 @@ var require_ms = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ms@2.1
|
|
|
3136
3136
|
|
|
3137
3137
|
//#endregion
|
|
3138
3138
|
//#region src/types/duration.ts
|
|
3139
|
-
var import_cjs$
|
|
3139
|
+
var import_cjs$27 = require_cjs();
|
|
3140
3140
|
init_source();
|
|
3141
|
-
const Duration = (0, import_cjs$
|
|
3141
|
+
const Duration = (0, import_cjs$27.extendType)(import_cjs$27.string, {
|
|
3142
3142
|
displayName: "num UNIT",
|
|
3143
3143
|
description: "A duration, e.g. 5m, 10s, 1h",
|
|
3144
3144
|
async from(string$2) {
|
|
@@ -3154,8 +3154,8 @@ const Duration = (0, import_cjs$26.extendType)(import_cjs$26.string, {
|
|
|
3154
3154
|
|
|
3155
3155
|
//#endregion
|
|
3156
3156
|
//#region src/args/timeout.ts
|
|
3157
|
-
var import_cjs$
|
|
3158
|
-
const timeout = import_cjs$
|
|
3157
|
+
var import_cjs$26 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3158
|
+
const timeout = import_cjs$26.option({
|
|
3159
3159
|
long: "timeout",
|
|
3160
3160
|
type: Duration,
|
|
3161
3161
|
description: "The maximum duration a sandbox can run for. Example: 5m, 30m",
|
|
@@ -3165,17 +3165,17 @@ const timeout = import_cjs$25.option({
|
|
|
3165
3165
|
|
|
3166
3166
|
//#endregion
|
|
3167
3167
|
//#region src/args/vcpus.ts
|
|
3168
|
-
var import_cjs$
|
|
3169
|
-
const vcpusType = import_cjs$
|
|
3168
|
+
var import_cjs$25 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3169
|
+
const vcpusType = import_cjs$25.extendType(import_cjs$25.number, {
|
|
3170
3170
|
displayName: "COUNT",
|
|
3171
3171
|
async from(n) {
|
|
3172
3172
|
if (!Number.isInteger(n) || n < 1) throw new Error(`Invalid vCPU count: ${n}. Must be a positive integer.`);
|
|
3173
3173
|
return n;
|
|
3174
3174
|
}
|
|
3175
3175
|
});
|
|
3176
|
-
const vcpus = import_cjs$
|
|
3176
|
+
const vcpus = import_cjs$25.option({
|
|
3177
3177
|
long: "vcpus",
|
|
3178
|
-
type: import_cjs$
|
|
3178
|
+
type: import_cjs$25.optional(vcpusType),
|
|
3179
3179
|
description: "Number of vCPUs to allocate (each vCPU includes 2048 MB of memory)"
|
|
3180
3180
|
});
|
|
3181
3181
|
|
|
@@ -6754,10 +6754,10 @@ function _usingCtx() {
|
|
|
6754
6754
|
|
|
6755
6755
|
//#endregion
|
|
6756
6756
|
//#region src/commands/login.ts
|
|
6757
|
-
var import_cjs$
|
|
6757
|
+
var import_cjs$24 = /* @__PURE__ */ __toESM(require_cjs());
|
|
6758
6758
|
init_source();
|
|
6759
6759
|
const debug$6 = createDebugger("sandbox:login");
|
|
6760
|
-
const login = import_cjs$
|
|
6760
|
+
const login = import_cjs$24.command({
|
|
6761
6761
|
name: "login",
|
|
6762
6762
|
description: "Log in to the Sandbox CLI",
|
|
6763
6763
|
args: {},
|
|
@@ -6975,7 +6975,7 @@ var require_dist = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/@ver
|
|
|
6975
6975
|
|
|
6976
6976
|
//#endregion
|
|
6977
6977
|
//#region src/args/auth.ts
|
|
6978
|
-
var import_cjs$
|
|
6978
|
+
var import_cjs$23 = /* @__PURE__ */ __toESM(require_cjs());
|
|
6979
6979
|
init_source();
|
|
6980
6980
|
var import_dist = require_dist();
|
|
6981
6981
|
const debug$5 = createDebugger("sandbox:args:auth");
|
|
@@ -6992,11 +6992,11 @@ function isTokenFresh() {
|
|
|
6992
6992
|
function markTokenAsFresh() {
|
|
6993
6993
|
freshTokenAcquiredAt = Date.now();
|
|
6994
6994
|
}
|
|
6995
|
-
const token = import_cjs$
|
|
6995
|
+
const token = import_cjs$23.option({
|
|
6996
6996
|
long: "token",
|
|
6997
6997
|
description: "A Vercel authentication token. If not provided, will use the token stored in your system from `VERCEL_AUTH_TOKEN` or will start a log in process.",
|
|
6998
6998
|
type: {
|
|
6999
|
-
...import_cjs$
|
|
6999
|
+
...import_cjs$23.string,
|
|
7000
7000
|
displayName: "pat_or_oidc",
|
|
7001
7001
|
defaultValueIsSerializable: false,
|
|
7002
7002
|
onMissing: async () => {
|
|
@@ -7179,29 +7179,29 @@ function getAuthFailureStatus(error) {
|
|
|
7179
7179
|
|
|
7180
7180
|
//#endregion
|
|
7181
7181
|
//#region src/args/scope.ts
|
|
7182
|
-
var import_cjs$
|
|
7182
|
+
var import_cjs$22 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7183
7183
|
init_source();
|
|
7184
|
-
const project = import_cjs$
|
|
7184
|
+
const project = import_cjs$22.option({
|
|
7185
7185
|
long: "project",
|
|
7186
7186
|
type: {
|
|
7187
|
-
...import_cjs$
|
|
7187
|
+
...import_cjs$22.optional(import_cjs$22.string),
|
|
7188
7188
|
displayName: "my-project"
|
|
7189
7189
|
},
|
|
7190
7190
|
description: "The project name or ID to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN."
|
|
7191
7191
|
});
|
|
7192
7192
|
/** Parser for the `--team` option. */
|
|
7193
|
-
const teamParser = import_cjs$
|
|
7193
|
+
const teamParser = import_cjs$22.option({
|
|
7194
7194
|
long: "team",
|
|
7195
7195
|
type: {
|
|
7196
|
-
...import_cjs$
|
|
7196
|
+
...import_cjs$22.optional(import_cjs$22.string),
|
|
7197
7197
|
displayName: "my-team"
|
|
7198
7198
|
}
|
|
7199
7199
|
});
|
|
7200
7200
|
/** Parser for the `--scope` option. */
|
|
7201
|
-
const scopeParser = import_cjs$
|
|
7201
|
+
const scopeParser = import_cjs$22.option({
|
|
7202
7202
|
long: "scope",
|
|
7203
7203
|
type: {
|
|
7204
|
-
...import_cjs$
|
|
7204
|
+
...import_cjs$22.optional(import_cjs$22.string),
|
|
7205
7205
|
displayName: "my-team"
|
|
7206
7206
|
},
|
|
7207
7207
|
description: "The scope/team to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN. [alias: --team]"
|
|
@@ -7290,7 +7290,7 @@ const scope = {
|
|
|
7290
7290
|
|
|
7291
7291
|
//#endregion
|
|
7292
7292
|
//#region package.json
|
|
7293
|
-
var version = "3.0.0-beta.
|
|
7293
|
+
var version = "3.0.0-beta.25";
|
|
7294
7294
|
|
|
7295
7295
|
//#endregion
|
|
7296
7296
|
//#region src/error.ts
|
|
@@ -7389,9 +7389,9 @@ async function writeResponseToTemp({ response, text }) {
|
|
|
7389
7389
|
|
|
7390
7390
|
//#endregion
|
|
7391
7391
|
//#region src/args/snapshot-id.ts
|
|
7392
|
-
var import_cjs$
|
|
7392
|
+
var import_cjs$21 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7393
7393
|
init_source();
|
|
7394
|
-
const snapshotId = import_cjs$
|
|
7394
|
+
const snapshotId = import_cjs$21.extendType(import_cjs$21.string, {
|
|
7395
7395
|
displayName: "snapshot_id",
|
|
7396
7396
|
description: "The ID of the snapshot",
|
|
7397
7397
|
async from(s$1) {
|
|
@@ -7402,9 +7402,9 @@ const snapshotId = import_cjs$20.extendType(import_cjs$20.string, {
|
|
|
7402
7402
|
|
|
7403
7403
|
//#endregion
|
|
7404
7404
|
//#region src/args/sandbox-name.ts
|
|
7405
|
-
var import_cjs$
|
|
7405
|
+
var import_cjs$20 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7406
7406
|
init_source();
|
|
7407
|
-
const sandboxName = import_cjs$
|
|
7407
|
+
const sandboxName = import_cjs$20.extendType(import_cjs$20.string, {
|
|
7408
7408
|
displayName: "name",
|
|
7409
7409
|
description: "The name of the sandbox",
|
|
7410
7410
|
async from(s$1) {
|
|
@@ -11409,9 +11409,9 @@ function getStderrStream() {
|
|
|
11409
11409
|
|
|
11410
11410
|
//#endregion
|
|
11411
11411
|
//#region src/args/key-value-pair.ts
|
|
11412
|
-
var import_cjs$
|
|
11412
|
+
var import_cjs$19 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11413
11413
|
init_source();
|
|
11414
|
-
const KeyValuePair = import_cjs$
|
|
11414
|
+
const KeyValuePair = import_cjs$19.extendType(import_cjs$19.string, {
|
|
11415
11415
|
displayName: "key=value",
|
|
11416
11416
|
async from(input) {
|
|
11417
11417
|
if (!input.includes("=")) return {
|
|
@@ -11425,7 +11425,7 @@ const KeyValuePair = import_cjs$18.extendType(import_cjs$18.string, {
|
|
|
11425
11425
|
};
|
|
11426
11426
|
}
|
|
11427
11427
|
});
|
|
11428
|
-
const ObjectFromKeyValue = import_cjs$
|
|
11428
|
+
const ObjectFromKeyValue = import_cjs$19.extendType(import_cjs$19.array(KeyValuePair), { async from(input) {
|
|
11429
11429
|
const obj = Object.create(null);
|
|
11430
11430
|
const missingVars = [];
|
|
11431
11431
|
for (const { key, value } of input) if (value === void 0) missingVars.push(key);
|
|
@@ -11439,27 +11439,27 @@ const ObjectFromKeyValue = import_cjs$18.extendType(import_cjs$18.array(KeyValue
|
|
|
11439
11439
|
|
|
11440
11440
|
//#endregion
|
|
11441
11441
|
//#region src/commands/exec.ts
|
|
11442
|
-
var import_cjs$
|
|
11442
|
+
var import_cjs$18 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11443
11443
|
init_source();
|
|
11444
11444
|
const args$3 = {
|
|
11445
|
-
sandbox: import_cjs$
|
|
11446
|
-
command: import_cjs$
|
|
11445
|
+
sandbox: import_cjs$18.positional({ type: sandboxName }),
|
|
11446
|
+
command: import_cjs$18.positional({
|
|
11447
11447
|
displayName: "command",
|
|
11448
11448
|
description: "The executable to invoke"
|
|
11449
11449
|
}),
|
|
11450
|
-
args: import_cjs$
|
|
11450
|
+
args: import_cjs$18.rest({
|
|
11451
11451
|
displayName: "args",
|
|
11452
11452
|
description: "arguments to pass to the command"
|
|
11453
11453
|
}),
|
|
11454
|
-
asSudo: import_cjs$
|
|
11454
|
+
asSudo: import_cjs$18.flag({
|
|
11455
11455
|
long: "sudo",
|
|
11456
11456
|
description: "Give extended privileges to the command."
|
|
11457
11457
|
}),
|
|
11458
|
-
interactive: import_cjs$
|
|
11458
|
+
interactive: import_cjs$18.flag({
|
|
11459
11459
|
long: "interactive",
|
|
11460
11460
|
short: "i",
|
|
11461
11461
|
description: "Run the command in a secure interactive shell",
|
|
11462
|
-
type: import_cjs$
|
|
11462
|
+
type: import_cjs$18.extendType(import_cjs$18.boolean, {
|
|
11463
11463
|
defaultValue() {
|
|
11464
11464
|
return false;
|
|
11465
11465
|
},
|
|
@@ -11469,22 +11469,22 @@ const args$3 = {
|
|
|
11469
11469
|
}
|
|
11470
11470
|
})
|
|
11471
11471
|
}),
|
|
11472
|
-
skipExtendingTimeout: import_cjs$
|
|
11472
|
+
skipExtendingTimeout: import_cjs$18.flag({
|
|
11473
11473
|
long: "no-extend-timeout",
|
|
11474
11474
|
description: "Do not extend the sandbox timeout while running an interactive command. Only affects interactive executions."
|
|
11475
11475
|
}),
|
|
11476
|
-
tty: import_cjs$
|
|
11476
|
+
tty: import_cjs$18.flag({
|
|
11477
11477
|
long: "tty",
|
|
11478
11478
|
short: "t",
|
|
11479
11479
|
description: "Allocate a tty for an interactive command. This is a no-op."
|
|
11480
11480
|
}),
|
|
11481
|
-
cwd: import_cjs$
|
|
11481
|
+
cwd: import_cjs$18.option({
|
|
11482
11482
|
long: "workdir",
|
|
11483
11483
|
short: "w",
|
|
11484
11484
|
description: "The working directory to run the command in",
|
|
11485
|
-
type: import_cjs$
|
|
11485
|
+
type: import_cjs$18.optional(import_cjs$18.string)
|
|
11486
11486
|
}),
|
|
11487
|
-
envVars: import_cjs$
|
|
11487
|
+
envVars: import_cjs$18.multioption({
|
|
11488
11488
|
long: "env",
|
|
11489
11489
|
short: "e",
|
|
11490
11490
|
type: ObjectFromKeyValue,
|
|
@@ -11492,7 +11492,7 @@ const args$3 = {
|
|
|
11492
11492
|
}),
|
|
11493
11493
|
scope
|
|
11494
11494
|
};
|
|
11495
|
-
const exec = import_cjs$
|
|
11495
|
+
const exec = import_cjs$18.command({
|
|
11496
11496
|
name: "exec",
|
|
11497
11497
|
description: "Execute a command in an existing sandbox",
|
|
11498
11498
|
args: args$3,
|
|
@@ -11529,9 +11529,9 @@ const exec = import_cjs$17.command({
|
|
|
11529
11529
|
|
|
11530
11530
|
//#endregion
|
|
11531
11531
|
//#region src/args/network-policy.ts
|
|
11532
|
-
var import_cjs$
|
|
11532
|
+
var import_cjs$17 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11533
11533
|
init_source();
|
|
11534
|
-
const networkPolicyMode = import_cjs$
|
|
11534
|
+
const networkPolicyMode = import_cjs$17.extendType(import_cjs$17.string, {
|
|
11535
11535
|
displayName: "MODE",
|
|
11536
11536
|
async from(value) {
|
|
11537
11537
|
const validModes = ["allow-all", "deny-all"];
|
|
@@ -11539,28 +11539,28 @@ const networkPolicyMode = import_cjs$16.extendType(import_cjs$16.string, {
|
|
|
11539
11539
|
return value;
|
|
11540
11540
|
}
|
|
11541
11541
|
});
|
|
11542
|
-
const networkPolicy = import_cjs$
|
|
11542
|
+
const networkPolicy = import_cjs$17.option({
|
|
11543
11543
|
long: "network-policy",
|
|
11544
11544
|
description: `Network policy mode: "allow-all" or "deny-all"
|
|
11545
11545
|
- allow-all: sandbox can access any website/domain
|
|
11546
11546
|
- deny-all: sandbox has no network access
|
|
11547
11547
|
Omit this option and use --allowed-domain / --allowed-cidr / --denied-cidr for custom policies.`,
|
|
11548
|
-
type: import_cjs$
|
|
11548
|
+
type: import_cjs$17.optional(networkPolicyMode)
|
|
11549
11549
|
});
|
|
11550
|
-
const allowedDomains = import_cjs$
|
|
11550
|
+
const allowedDomains = import_cjs$17.multioption({
|
|
11551
11551
|
long: "allowed-domain",
|
|
11552
11552
|
description: `Domain to allow traffic to (creates a custom network policy). Supports "*" for wildcards for a segment (e.g. '*.vercel.com', 'www.*.com'). If used as the first segment, will match any subdomain.`,
|
|
11553
|
-
type: import_cjs$
|
|
11553
|
+
type: import_cjs$17.array(import_cjs$17.string)
|
|
11554
11554
|
});
|
|
11555
|
-
const allowedCIDRs = import_cjs$
|
|
11555
|
+
const allowedCIDRs = import_cjs$17.multioption({
|
|
11556
11556
|
long: "allowed-cidr",
|
|
11557
11557
|
description: `CIDR to allow traffic to (creates a custom network policy). Takes precedence over 'allowed-domain'.`,
|
|
11558
|
-
type: import_cjs$
|
|
11558
|
+
type: import_cjs$17.array(import_cjs$17.string)
|
|
11559
11559
|
});
|
|
11560
|
-
const deniedCIDRs = import_cjs$
|
|
11560
|
+
const deniedCIDRs = import_cjs$17.multioption({
|
|
11561
11561
|
long: "denied-cidr",
|
|
11562
11562
|
description: `CIDR to deny traffic to (creates a custom network policy). Takes precedence over allowed domains/CIDRs.`,
|
|
11563
|
-
type: import_cjs$
|
|
11563
|
+
type: import_cjs$17.array(import_cjs$17.string)
|
|
11564
11564
|
});
|
|
11565
11565
|
const networkPolicyArgs = {
|
|
11566
11566
|
networkPolicy,
|
|
@@ -11599,8 +11599,8 @@ function buildNetworkPolicy(args$4) {
|
|
|
11599
11599
|
|
|
11600
11600
|
//#endregion
|
|
11601
11601
|
//#region src/types/snapshot-expiration.ts
|
|
11602
|
-
var import_cjs$
|
|
11603
|
-
const SnapshotExpiration = (0, import_cjs$
|
|
11602
|
+
var import_cjs$16 = require_cjs();
|
|
11603
|
+
const SnapshotExpiration = (0, import_cjs$16.extendType)(import_cjs$16.string, {
|
|
11604
11604
|
displayName: "DURATION|none",
|
|
11605
11605
|
description: "A duration (e.g. 7d, 30d) or \"none\" for no expiration",
|
|
11606
11606
|
async from(value) {
|
|
@@ -11609,6 +11609,27 @@ const SnapshotExpiration = (0, import_cjs$15.extendType)(import_cjs$15.string, {
|
|
|
11609
11609
|
}
|
|
11610
11610
|
});
|
|
11611
11611
|
|
|
11612
|
+
//#endregion
|
|
11613
|
+
//#region src/args/ports.ts
|
|
11614
|
+
var import_cjs$15 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11615
|
+
init_source();
|
|
11616
|
+
const publishPorts = import_cjs$15.multioption({
|
|
11617
|
+
long: "publish-port",
|
|
11618
|
+
short: "p",
|
|
11619
|
+
description: "Publish sandbox port(s) to DOMAIN.vercel.run",
|
|
11620
|
+
type: import_cjs$15.array(import_cjs$15.extendType(import_cjs$15.number, {
|
|
11621
|
+
displayName: "PORT",
|
|
11622
|
+
async from(number) {
|
|
11623
|
+
if (!Number.isInteger(number) || number < 1024 || number > 65535) throw new Error([
|
|
11624
|
+
`Invalid port: ${number}.`,
|
|
11625
|
+
`${source_default.bold("hint:")} Ports must be integers between 1024-65535 (privileged ports 0-1023 are reserved).`,
|
|
11626
|
+
"Examples: 3000, 8443"
|
|
11627
|
+
].join("\n"));
|
|
11628
|
+
return number;
|
|
11629
|
+
}
|
|
11630
|
+
}))
|
|
11631
|
+
});
|
|
11632
|
+
|
|
11612
11633
|
//#endregion
|
|
11613
11634
|
//#region src/commands/create.ts
|
|
11614
11635
|
var import_cjs$14 = /* @__PURE__ */ __toESM(require_cjs());
|
|
@@ -11627,22 +11648,7 @@ const args$2 = {
|
|
|
11627
11648
|
runtime,
|
|
11628
11649
|
timeout,
|
|
11629
11650
|
vcpus,
|
|
11630
|
-
ports:
|
|
11631
|
-
long: "publish-port",
|
|
11632
|
-
short: "p",
|
|
11633
|
-
description: "Publish sandbox port(s) to DOMAIN.vercel.run",
|
|
11634
|
-
type: import_cjs$14.array(import_cjs$14.extendType(import_cjs$14.number, {
|
|
11635
|
-
displayName: "PORT",
|
|
11636
|
-
async from(number) {
|
|
11637
|
-
if (number < 1024 || number > 65535) throw new Error([
|
|
11638
|
-
`Invalid port: ${number}.`,
|
|
11639
|
-
`${source_default.bold("hint:")} Ports must be between 1024-65535 (privileged ports 0-1023 are reserved).`,
|
|
11640
|
-
"╰▶ Examples: 3000, 8080, 8443"
|
|
11641
|
-
].join("\n"));
|
|
11642
|
-
return number;
|
|
11643
|
-
}
|
|
11644
|
-
}))
|
|
11645
|
-
}),
|
|
11651
|
+
ports: publishPorts,
|
|
11646
11652
|
silent: import_cjs$14.flag({
|
|
11647
11653
|
long: "silent",
|
|
11648
11654
|
description: "Don't write sandbox name to stdout"
|
|
@@ -15375,6 +15381,47 @@ const currentSnapshotCommand = import_cjs$1.command({
|
|
|
15375
15381
|
}
|
|
15376
15382
|
}
|
|
15377
15383
|
});
|
|
15384
|
+
const portsCommand = import_cjs$1.command({
|
|
15385
|
+
name: "ports",
|
|
15386
|
+
description: "Update the published ports of a sandbox. Replaces all existing published ports.",
|
|
15387
|
+
args: {
|
|
15388
|
+
sandbox: import_cjs$1.positional({
|
|
15389
|
+
type: sandboxName,
|
|
15390
|
+
description: "Sandbox name to update"
|
|
15391
|
+
}),
|
|
15392
|
+
ports: publishPorts,
|
|
15393
|
+
scope
|
|
15394
|
+
},
|
|
15395
|
+
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandbox: name, ports }) {
|
|
15396
|
+
const sandbox = await sandboxClient.get({
|
|
15397
|
+
name,
|
|
15398
|
+
projectId: project$1,
|
|
15399
|
+
teamId: team$1,
|
|
15400
|
+
token: token$1
|
|
15401
|
+
});
|
|
15402
|
+
const spinner = ora("Updating sandbox ports...").start();
|
|
15403
|
+
try {
|
|
15404
|
+
await sandbox.update({ ports });
|
|
15405
|
+
spinner.stop();
|
|
15406
|
+
process.stderr.write("✅ Ports updated for sandbox " + source_default.cyan(name) + "\n");
|
|
15407
|
+
if (ports.length === 0) process.stderr.write(source_default.dim(" ╰ ") + "all ports unpublished\n");
|
|
15408
|
+
else {
|
|
15409
|
+
const routes = getPublishedRoutes(sandbox);
|
|
15410
|
+
process.stderr.write(source_default.dim(" │ ") + "ports:\n");
|
|
15411
|
+
for (let i = 0; i < ports.length; i++) {
|
|
15412
|
+
const port = ports[i];
|
|
15413
|
+
const route = routes?.find((route$1) => route$1.port === port);
|
|
15414
|
+
const prefix$1 = i === ports.length - 1 ? source_default.dim(" ╰ ") : source_default.dim(" │ ");
|
|
15415
|
+
const url = route ? " -> " + source_default.cyan(route.url) : "";
|
|
15416
|
+
process.stderr.write(prefix$1 + "• " + port + url + "\n");
|
|
15417
|
+
}
|
|
15418
|
+
}
|
|
15419
|
+
} catch (error) {
|
|
15420
|
+
spinner.stop();
|
|
15421
|
+
throw error;
|
|
15422
|
+
}
|
|
15423
|
+
}
|
|
15424
|
+
});
|
|
15378
15425
|
const listCommand = import_cjs$1.command({
|
|
15379
15426
|
name: "list",
|
|
15380
15427
|
description: "Display the current configuration of a sandbox",
|
|
@@ -15421,6 +15468,10 @@ const listCommand = import_cjs$1.command({
|
|
|
15421
15468
|
field: "Network policy",
|
|
15422
15469
|
value: String(networkPolicy$1)
|
|
15423
15470
|
},
|
|
15471
|
+
{
|
|
15472
|
+
field: "Ports",
|
|
15473
|
+
value: formatPorts(sandbox)
|
|
15474
|
+
},
|
|
15424
15475
|
{
|
|
15425
15476
|
field: "Snapshot expiration",
|
|
15426
15477
|
value: sandbox.snapshotExpiration != null && sandbox.snapshotExpiration > 0 ? (0, import_ms.default)(sandbox.snapshotExpiration, { long: true }) : sandbox.snapshotExpiration === 0 ? "none" : "-"
|
|
@@ -15540,6 +15591,14 @@ function formatKeepLastSnapshots(keepLastSnapshots) {
|
|
|
15540
15591
|
if (keepLastSnapshots.deleteEvicted !== void 0) parts.push(`delete-evicted-snapshots=${keepLastSnapshots.deleteEvicted}`);
|
|
15541
15592
|
return parts.join(", ");
|
|
15542
15593
|
}
|
|
15594
|
+
function formatPorts(sandbox) {
|
|
15595
|
+
const ports = getPublishedRoutes(sandbox)?.map((route) => route.port) ?? [];
|
|
15596
|
+
if (ports.length === 0) return "-";
|
|
15597
|
+
return ports.join(", ");
|
|
15598
|
+
}
|
|
15599
|
+
function getPublishedRoutes(sandbox) {
|
|
15600
|
+
return sandbox.routes.filter((route) => route.port !== sandbox.interactivePort);
|
|
15601
|
+
}
|
|
15543
15602
|
const config = import_cjs$1.subcommands({
|
|
15544
15603
|
name: "config",
|
|
15545
15604
|
description: "View and update sandbox configuration",
|
|
@@ -15554,6 +15613,7 @@ const config = import_cjs$1.subcommands({
|
|
|
15554
15613
|
"keep-last-snapshots-for": keepLastSnapshotsForCommand,
|
|
15555
15614
|
"delete-evicted-snapshots": deleteEvictedSnapshotsCommand,
|
|
15556
15615
|
"current-snapshot": currentSnapshotCommand,
|
|
15616
|
+
ports: portsCommand,
|
|
15557
15617
|
tags: tagsCommand
|
|
15558
15618
|
}
|
|
15559
15619
|
});
|
|
@@ -15601,4 +15661,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
15601
15661
|
|
|
15602
15662
|
//#endregion
|
|
15603
15663
|
export { source_exports as a, init_source as i, StyledError as n, require_cjs as r, app as t };
|
|
15604
|
-
//# sourceMappingURL=app-
|
|
15664
|
+
//# sourceMappingURL=app-BdOGNXsw.mjs.map
|