sandbox 3.0.0-beta.3 → 3.0.0-beta.5

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.
@@ -7427,7 +7427,7 @@ const scope = {
7427
7427
 
7428
7428
  //#endregion
7429
7429
  //#region package.json
7430
- var version = "3.0.0-beta.3";
7430
+ var version = "3.0.0-beta.5";
7431
7431
 
7432
7432
  //#endregion
7433
7433
  //#region src/error.ts
@@ -11876,13 +11876,18 @@ const args$1 = {
11876
11876
  removeAfterUse: import_cjs$13.flag({
11877
11877
  long: "rm",
11878
11878
  description: "Automatically remove the sandbox when the command exits."
11879
+ }),
11880
+ stopAfterUse: import_cjs$13.flag({
11881
+ long: "stop",
11882
+ description: "Stop the sandbox when the command exits."
11879
11883
  })
11880
11884
  };
11881
11885
  const run = import_cjs$13.command({
11882
11886
  name: "run",
11883
11887
  description: "Create and run a command in a sandbox",
11884
11888
  args: args$1,
11885
- async handler({ removeAfterUse, ...rest$1 }) {
11889
+ async handler({ removeAfterUse, stopAfterUse, ...rest$1 }) {
11890
+ if (removeAfterUse && stopAfterUse) throw new Error("--rm and --stop are mutually exclusive.");
11886
11891
  let sandbox;
11887
11892
  if (rest$1.name) try {
11888
11893
  sandbox = await sandboxClient.get({
@@ -11894,10 +11899,16 @@ const run = import_cjs$13.command({
11894
11899
  __includeSystemRoutes: true
11895
11900
  });
11896
11901
  } catch (error) {
11897
- if (error instanceof StyledError && error.cause instanceof APIError && error.cause.response.status === 404) sandbox = await create.handler({ ...rest$1 });
11902
+ if (error instanceof StyledError && error.cause instanceof APIError && error.cause.response.status === 404) sandbox = await create.handler({
11903
+ ...rest$1,
11904
+ nonPersistent: rest$1.nonPersistent || removeAfterUse
11905
+ });
11898
11906
  else throw error;
11899
11907
  }
11900
- else sandbox = await create.handler({ ...rest$1 });
11908
+ else sandbox = await create.handler({
11909
+ ...rest$1,
11910
+ nonPersistent: rest$1.nonPersistent || removeAfterUse
11911
+ });
11901
11912
  try {
11902
11913
  await exec.handler({
11903
11914
  ...rest$1,
@@ -11905,6 +11916,7 @@ const run = import_cjs$13.command({
11905
11916
  });
11906
11917
  } finally {
11907
11918
  if (removeAfterUse) await sandbox.delete();
11919
+ if (stopAfterUse) await sandbox.stop();
11908
11920
  }
11909
11921
  }
11910
11922
  });
@@ -14532,8 +14544,15 @@ const list$2 = import_cjs$4.command({
14532
14544
  name: "list",
14533
14545
  aliases: ["ls"],
14534
14546
  description: "List snapshots for the specified account and project.",
14535
- args: { scope },
14536
- async handler({ scope: { token: token$1, team: team$1, project: project$1 } }) {
14547
+ args: {
14548
+ scope,
14549
+ name: import_cjs$4.option({
14550
+ type: import_cjs$4.optional(sandboxName),
14551
+ long: "name",
14552
+ description: "Filter snapshots by sandbox."
14553
+ })
14554
+ },
14555
+ async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name }) {
14537
14556
  const snapshots$1 = await (async () => {
14538
14557
  try {
14539
14558
  var _usingCtx$1 = _usingCtx();
@@ -14542,6 +14561,7 @@ const list$2 = import_cjs$4.command({
14542
14561
  token: token$1,
14543
14562
  teamId: team$1,
14544
14563
  projectId: project$1,
14564
+ name,
14545
14565
  limit: 100
14546
14566
  });
14547
14567
  return json.snapshots;
@@ -14986,4 +15006,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
14986
15006
 
14987
15007
  //#endregion
14988
15008
  export { source_exports as a, init_source as i, StyledError as n, require_cjs as r, app as t };
14989
- //# sourceMappingURL=app-B87e0EN4.mjs.map
15009
+ //# sourceMappingURL=app-BvyZgr9h.mjs.map