sim 2.1.3-preview.51.1 → 2.1.3

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.
Files changed (2) hide show
  1. package/dist/index.js +45 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9208,7 +9208,7 @@ var V2_OPERATIONS = {
9208
9208
  },
9209
9209
  parentPath: {
9210
9210
  kind: "string",
9211
- describe: "Restrict results to direct children of this parent path."
9211
+ describe: "Restrict results to direct children of this parent path. A path that names no folder narrows the result to nothing, so the response is an empty page rather than an error."
9212
9212
  },
9213
9213
  search: {
9214
9214
  kind: "string",
@@ -9541,7 +9541,7 @@ var V2_OPERATIONS = {
9541
9541
  },
9542
9542
  parentPath: {
9543
9543
  kind: "string",
9544
- describe: "Restrict results to direct children of this parent path."
9544
+ describe: "Restrict results to direct children of this parent path. A path that names no folder narrows the result to nothing, so the response is an empty page rather than an error."
9545
9545
  },
9546
9546
  search: {
9547
9547
  kind: "string",
@@ -9894,7 +9894,7 @@ var V2_OPERATIONS = {
9894
9894
  },
9895
9895
  parentPath: {
9896
9896
  kind: "string",
9897
- describe: "Restrict results to direct children of this parent path."
9897
+ describe: "Restrict results to direct children of this parent path. A path that names no folder narrows the result to nothing, so the response is an empty page rather than an error."
9898
9898
  },
9899
9899
  search: {
9900
9900
  kind: "string",
@@ -10060,7 +10060,7 @@ var V2_OPERATIONS = {
10060
10060
  },
10061
10061
  parentPath: {
10062
10062
  kind: "string",
10063
- describe: "Restrict results to direct children of this parent path."
10063
+ describe: "Restrict results to direct children of this parent path. A path that names no folder narrows the result to nothing, so the response is an empty page rather than an error."
10064
10064
  },
10065
10065
  search: {
10066
10066
  kind: "string",
@@ -11912,14 +11912,22 @@ function requireValue(value, flag, key) {
11912
11912
  throw new SimApiError(`${flag} requires a value. To remove it, run: sim configure --unset ${key}`, 0);
11913
11913
  }
11914
11914
  }
11915
+ function quoteProfileArgument(name) {
11916
+ const redacted = redact(name);
11917
+ if (PROFILE_NAME_PATTERN.test(redacted))
11918
+ return redacted;
11919
+ return `'${redacted.replaceAll("'", "'\\''")}'`;
11920
+ }
11915
11921
  function configureCommand() {
11916
11922
  return new Command("configure").description("Set a profile's endpoint, default workspace, or output format").option("--set-endpoint <url>", "Sim deployment to talk to").option("--set-workspace <id>", "Default workspace for workspace-scoped commands").option("--set-output <format>", `Default output format (${OUTPUT_FORMATS.join(" | ")})`).option("--unset <key...>", "Remove settings (endpoint, workspace, output)").action((options, command) => {
11917
11923
  const globals = globalsOf(command);
11924
+ const selectedProfile = globals.profile || process.env.SIM_PROFILE;
11925
+ const profileArg = selectedProfile ? ` --profile ${quoteProfileArgument(selectedProfile)}` : "";
11918
11926
  for (const { option, flag, setFlag } of GLOBAL_FLAG_TWINS) {
11919
11927
  const value = globals[option];
11920
11928
  if (value === undefined)
11921
11929
  continue;
11922
- throw new SimApiError(`${flag} applies to a single command and is not stored. To save it, run: sim configure ${setFlag} ${redact(value)}`, 0);
11930
+ throw new SimApiError(`${flag} applies to a single command and is not stored. To save it, run: sim configure${profileArg} ${setFlag} ${redact(value)}`, 0);
11923
11931
  }
11924
11932
  const profile = profileFrom(command, { allowUnknownProfile: true });
11925
11933
  const authProfile = resolveAuthenticationProfileName(profile.name);
@@ -12326,6 +12334,9 @@ var CLI_CONTRACT = {
12326
12334
  rollbackWorkflow: {
12327
12335
  confirm: "This changes which deployed version runs in production for every API and chat consumer."
12328
12336
  },
12337
+ activateWorkflowVersion: {
12338
+ confirm: "This changes which deployed version runs in production for every API and chat consumer."
12339
+ },
12329
12340
  moveWorkflows: {
12330
12341
  command: "workflows move",
12331
12342
  flags: {
@@ -13983,6 +13994,14 @@ var BULK_OUTCOME_CHECKS = {
13983
13994
  const reported2 = payload.errors?.[0];
13984
13995
  return typeof reported2 === "string" && reported2 ? safeOneLine(reported2) : `Updated nothing: none of the ${requested} requested ${requested === 1 ? "chunk" : "chunks"} matched.`;
13985
13996
  },
13997
+ deleteTableRows: (payload) => {
13998
+ if (countOf(payload.deletedCount) > 0)
13999
+ return null;
14000
+ const requested = countOf(payload.requestedCount);
14001
+ if (requested === 0)
14002
+ return null;
14003
+ return `Deleted nothing: none of the ${requested} requested ${requested === 1 ? "row was" : "rows were"} deleted.`;
14004
+ },
13986
14005
  moveTables: (payload) => {
13987
14006
  if (lengthOf(payload.moved) > 0)
13988
14007
  return null;
@@ -14254,18 +14273,30 @@ function commandPath(command) {
14254
14273
  }
14255
14274
  return names.join(" ");
14256
14275
  }
14257
- function addMissingArgumentExample(command) {
14276
+ var UNKNOWN_OPTION_TOKEN = /^error: unknown option '(.+?)'/;
14277
+ function looksLikeAnId(token2) {
14278
+ return token2.length > 2 && !token2.startsWith("--") && /^-[A-Za-z0-9_-]*[A-Z0-9][A-Za-z0-9_-]*$/.test(token2);
14279
+ }
14280
+ function addArgumentExamples(command) {
14258
14281
  const outputError = command.configureOutput().outputError;
14259
14282
  if (!outputError)
14260
14283
  throw new Error("Commander output formatter is not configured");
14261
14284
  command.configureOutput({
14262
14285
  outputError: (message, write) => {
14263
14286
  outputError(message, write);
14264
- if (!message.startsWith("error: missing required argument "))
14287
+ if (message.startsWith("error: missing required argument ")) {
14288
+ const syntax = argumentSyntax(command);
14289
+ const example = syntax ? `${commandPath(command)} ${syntax}` : commandPath(command);
14290
+ write(`Example: ${example}
14291
+ `);
14292
+ return;
14293
+ }
14294
+ if (command.registeredArguments.length === 0)
14295
+ return;
14296
+ const token2 = UNKNOWN_OPTION_TOKEN.exec(message)?.[1];
14297
+ if (!token2 || !looksLikeAnId(token2))
14265
14298
  return;
14266
- const syntax = argumentSyntax(command);
14267
- const example = syntax ? `${commandPath(command)} ${syntax}` : commandPath(command);
14268
- write(`Example: ${example}
14299
+ write(`Example: ${commandPath(command)} -- ${token2}
14269
14300
  `);
14270
14301
  }
14271
14302
  });
@@ -14392,7 +14423,7 @@ function configureOperation(command, operation, spec) {
14392
14423
  return command;
14393
14424
  }
14394
14425
  function buildLeaf(operation, spec, leafName) {
14395
- return addMissingArgumentExample(configureOperation(new Command(leafName), operation, spec));
14426
+ return addArgumentExamples(configureOperation(new Command(leafName), operation, spec));
14396
14427
  }
14397
14428
  function addRenamedCommand(groups, operation, spec, from, to) {
14398
14429
  const segments = from.split(" ");
@@ -16259,7 +16290,9 @@ Profiles work like the AWS CLI: settings live in ~/.sim/config, keys in
16259
16290
  with -P, --profile, or SIM_PROFILE.
16260
16291
 
16261
16292
  Workflow, knowledge-base and workspace IDs are bare UUIDs. Table IDs carry a
16262
- tbl_ prefix and file IDs a wf_ one, so wf_ never names a workflow.
16293
+ tbl_ prefix and file IDs a wf_ one, so wf_ never names a workflow. An audit-log
16294
+ or custom-tool ID can open with a dash, which reads as a flag; put -- in front
16295
+ of it, as in sim audit-logs get -- -HlDcD1z76nK6R4crsUp0.
16263
16296
 
16264
16297
  Examples:
16265
16298
  $ sim login Authorize the default profile
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.1.3-preview.51.1",
3
+ "version": "2.1.3",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "bin": {