sim 2.2.25-preview.288.1 → 2.2.25-preview.289.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.
@@ -12,6 +12,8 @@ export interface AuthRequest {
12
12
  export interface MintedKey {
13
13
  id: string;
14
14
  apiKey: string;
15
+ /** The name the key is listed under, or null from a server that predates it. */
16
+ name: string | null;
15
17
  scope: CliAuthScope;
16
18
  /** The workspace picked in the browser — the profile's default target. */
17
19
  workspaceId: string | null;
@@ -18545,7 +18545,7 @@ export declare const V2_OPERATIONS: {
18545
18545
  readonly kind: 'enum';
18546
18546
  readonly values: readonly ['createdAt'];
18547
18547
  readonly default: 'createdAt';
18548
- readonly describe: 'Field used to sort the result.';
18548
+ readonly describe: "Field used to sort the result. `createdAt` is when the schedule was created for the deployment version that runs it: each deploy creates new schedule rows, so a redeployed workflow's schedules move to the newest end.";
18549
18549
  };
18550
18550
  readonly sortOrder: {
18551
18551
  readonly kind: 'enum';
package/dist/index.js CHANGED
@@ -9485,6 +9485,7 @@ async function pollForKey(endpoint, auth, signal) {
9485
9485
  return {
9486
9486
  id: body.key.id,
9487
9487
  apiKey: body.key.apiKey,
9488
+ name: typeof body.key.name === "string" ? body.key.name : null,
9488
9489
  scope: body.scope ?? "copilot",
9489
9490
  workspaceId: body.workspaceId ?? null,
9490
9491
  workspaceBound: body.workspaceBound === true,
@@ -15749,7 +15750,7 @@ var V2_OPERATIONS = {
15749
15750
  kind: "enum",
15750
15751
  values: ["createdAt"],
15751
15752
  default: "createdAt",
15752
- describe: "Field used to sort the result."
15753
+ describe: "Field used to sort the result. `createdAt` is when the schedule was created for the deployment version that runs it: each deploy creates new schedule rows, so a redeployed workflow's schedules move to the newest end."
15753
15754
  },
15754
15755
  sortOrder: {
15755
15756
  kind: "enum",
@@ -18624,6 +18625,8 @@ async function chooseLoginFlow(profile, options) {
18624
18625
  if (status === "unreachable") {
18625
18626
  throw new SimApiError(`Could not reach ${profile.endpoint}. Check the endpoint.`, 0);
18626
18627
  }
18628
+ if (options.method === undefined && options.expiresIn !== undefined)
18629
+ return "handoff";
18627
18630
  if (status === "unavailable") {
18628
18631
  if (options.method === "oauth") {
18629
18632
  throw new SimApiError(`${profile.endpoint} does not offer OAuth sign-in. Enable OAuth on the server or explicitly choose sim login --method api-key.`, 0);
@@ -18706,7 +18709,7 @@ Waiting for you to approve in the browser…`));
18706
18709
  }
18707
18710
  }
18708
18711
  function loginCommand() {
18709
- return new Command("login").description("Log in through the browser and store the login for the profile").addOption(new Option("--method <method>", "Credential to obtain: oauth requires OAuth support; api-key creates an API key through pairing (auto-selects when omitted)").choices(["oauth", "api-key"])).option("--no-browser", "Print the approval URL without opening it (either login method)").option("--read-only", "Ask only for permission to read, never to change anything").option("--expires-in <days>", `API-key login only: days until the key expires (${MIN_KEY_EXPIRY_DAYS}-${MAX_KEY_EXPIRY_DAYS}); omit for a key that never expires`).option("--callback-port <port>", "Pin the local port the browser returns to").option("-y, --yes", "Overwrite an existing API-key profile without prompting").action(async (options, command) => {
18712
+ return new Command("login").description("Log in through the browser and store the login for the profile").addOption(new Option("--method <method>", "Credential to obtain: oauth requires OAuth support; api-key creates an API key through pairing (auto-selects when omitted)").choices(["oauth", "api-key"])).option("--no-browser", "Print the approval URL without opening it (either login method)").option("--read-only", "Ask only for permission to read, never to change anything").option("--expires-in <days>", `Log in with an API key that expires after this many days (${MIN_KEY_EXPIRY_DAYS}-${MAX_KEY_EXPIRY_DAYS}); without it an API key never expires`).option("--callback-port <port>", "Pin the local port the browser returns to").option("-y, --yes", "Overwrite an existing API-key profile without prompting").action(async (options, command) => {
18710
18713
  const profile = profileFrom(command, { allowUnknownProfile: true });
18711
18714
  const authProfile = resolveAuthenticationProfileName(profile.name);
18712
18715
  if (authProfile !== profile.name) {
@@ -18746,7 +18749,7 @@ function loginCommand() {
18746
18749
  var DAY_MS = 24 * 60 * 60 * 1000;
18747
18750
  var EXPIRY_TOLERANCE_MS = 60 * 60 * 1000;
18748
18751
  function requireRequestedKey(key, keyRequest) {
18749
- const refuse = (issued, flag) => new SimApiError(`The server issued ${issued}, not the key requested. Nothing was stored; update the Sim deployment or adjust ${flag}.`, 0);
18752
+ const refuse = (issued, flag) => new SimApiError(`The server issued ${issued}, not the key requested, so the CLI did not store it. Revoke that key as described above, then update the Sim deployment or adjust ${flag}.`, 0);
18750
18753
  const requestedAccess = keyRequest.readOnly ? "read" : "write";
18751
18754
  const issuedAccess = key.access ?? "write";
18752
18755
  if (issuedAccess !== requestedAccess) {
@@ -18813,7 +18816,8 @@ Waiting for approval…`));
18813
18816
  });
18814
18817
  } catch (error) {
18815
18818
  const keyId = typeof key.id === "string" && key.id ? safeOneLine(key.id) : "unknown";
18816
- printLine(styles3().yellow(`API key ${keyId} was created but could not be stored safely. Revoke it in Settings → API keys.`));
18819
+ const listedAs = key.name ? `"${safeOneLine(key.name)}"` : `the newest key named "CLI (…Z)", created at about ${new Date().toISOString().slice(0, 19).replace("T", " ")}Z,`;
18820
+ printLine(styles3().yellow(`API key ${keyId} was created on your account but could not be stored safely. Revoke ${listedAs} in Settings → API keys.`));
18817
18821
  throw error;
18818
18822
  }
18819
18823
  printLine(styles3().green(`
@@ -22664,6 +22668,15 @@ function retypeMessage(message, spellings) {
22664
22668
  }
22665
22669
  return retyped;
22666
22670
  }
22671
+ var LOCATION_PREFIX = /^(?:path|query|header|body)\.([^:\s]+): /;
22672
+ function retypeLocatedMessage(message, spellings) {
22673
+ const match = LOCATION_PREFIX.exec(message);
22674
+ if (!match)
22675
+ return retypeMessage(message, spellings);
22676
+ const [head, ...rest] = match[1].split(".");
22677
+ const location = [spellings.get(head) ?? head, ...rest].join(".");
22678
+ return `${location}: ${retypeMessage(message.slice(match[0].length), spellings)}`;
22679
+ }
22667
22680
  function retypeDetails(details, spellings) {
22668
22681
  if (Array.isArray(details))
22669
22682
  return details.map((issue) => retypeDetails(issue, spellings));
@@ -22691,7 +22704,7 @@ function retypeApiError(error, operation, commandSpec, operationSpec) {
22691
22704
  const spellings = typeableFields(operation, commandSpec, operationSpec);
22692
22705
  if (spellings.size === 0)
22693
22706
  return error;
22694
- return new SimApiError(retypeMessage(error.message, spellings), error.status, error.code, error.details === undefined ? undefined : retypeDetails(error.details, spellings));
22707
+ return new SimApiError(retypeLocatedMessage(error.message, spellings), error.status, error.code, error.details === undefined ? undefined : retypeDetails(error.details, spellings));
22695
22708
  }
22696
22709
 
22697
22710
  // src/runtime/build.ts
package/dist/runtime.js CHANGED
@@ -9194,6 +9194,7 @@ async function pollForKey(endpoint, auth, signal) {
9194
9194
  return {
9195
9195
  id: body.key.id,
9196
9196
  apiKey: body.key.apiKey,
9197
+ name: typeof body.key.name === "string" ? body.key.name : null,
9197
9198
  scope: body.scope ?? "copilot",
9198
9199
  workspaceId: body.workspaceId ?? null,
9199
9200
  workspaceBound: body.workspaceBound === true,
@@ -15798,7 +15799,7 @@ var V2_OPERATIONS = {
15798
15799
  kind: "enum",
15799
15800
  values: ["createdAt"],
15800
15801
  default: "createdAt",
15801
- describe: "Field used to sort the result."
15802
+ describe: "Field used to sort the result. `createdAt` is when the schedule was created for the deployment version that runs it: each deploy creates new schedule rows, so a redeployed workflow's schedules move to the newest end."
15802
15803
  },
15803
15804
  sortOrder: {
15804
15805
  kind: "enum",
@@ -18673,6 +18674,8 @@ async function chooseLoginFlow(profile, options) {
18673
18674
  if (status === "unreachable") {
18674
18675
  throw new SimApiError(`Could not reach ${profile.endpoint}. Check the endpoint.`, 0);
18675
18676
  }
18677
+ if (options.method === undefined && options.expiresIn !== undefined)
18678
+ return "handoff";
18676
18679
  if (status === "unavailable") {
18677
18680
  if (options.method === "oauth") {
18678
18681
  throw new SimApiError(`${profile.endpoint} does not offer OAuth sign-in. Enable OAuth on the server or explicitly choose sim login --method api-key.`, 0);
@@ -18755,7 +18758,7 @@ Waiting for you to approve in the browser…`));
18755
18758
  }
18756
18759
  }
18757
18760
  function loginCommand() {
18758
- return new Command("login").description("Log in through the browser and store the login for the profile").addOption(new Option("--method <method>", "Credential to obtain: oauth requires OAuth support; api-key creates an API key through pairing (auto-selects when omitted)").choices(["oauth", "api-key"])).option("--no-browser", "Print the approval URL without opening it (either login method)").option("--read-only", "Ask only for permission to read, never to change anything").option("--expires-in <days>", `API-key login only: days until the key expires (${MIN_KEY_EXPIRY_DAYS}-${MAX_KEY_EXPIRY_DAYS}); omit for a key that never expires`).option("--callback-port <port>", "Pin the local port the browser returns to").option("-y, --yes", "Overwrite an existing API-key profile without prompting").action(async (options, command) => {
18761
+ return new Command("login").description("Log in through the browser and store the login for the profile").addOption(new Option("--method <method>", "Credential to obtain: oauth requires OAuth support; api-key creates an API key through pairing (auto-selects when omitted)").choices(["oauth", "api-key"])).option("--no-browser", "Print the approval URL without opening it (either login method)").option("--read-only", "Ask only for permission to read, never to change anything").option("--expires-in <days>", `Log in with an API key that expires after this many days (${MIN_KEY_EXPIRY_DAYS}-${MAX_KEY_EXPIRY_DAYS}); without it an API key never expires`).option("--callback-port <port>", "Pin the local port the browser returns to").option("-y, --yes", "Overwrite an existing API-key profile without prompting").action(async (options, command) => {
18759
18762
  const profile = profileFrom(command, { allowUnknownProfile: true });
18760
18763
  const authProfile = resolveAuthenticationProfileName(profile.name);
18761
18764
  if (authProfile !== profile.name) {
@@ -18795,7 +18798,7 @@ function loginCommand() {
18795
18798
  var DAY_MS = 24 * 60 * 60 * 1000;
18796
18799
  var EXPIRY_TOLERANCE_MS = 60 * 60 * 1000;
18797
18800
  function requireRequestedKey(key, keyRequest) {
18798
- const refuse = (issued, flag) => new SimApiError(`The server issued ${issued}, not the key requested. Nothing was stored; update the Sim deployment or adjust ${flag}.`, 0);
18801
+ const refuse = (issued, flag) => new SimApiError(`The server issued ${issued}, not the key requested, so the CLI did not store it. Revoke that key as described above, then update the Sim deployment or adjust ${flag}.`, 0);
18799
18802
  const requestedAccess = keyRequest.readOnly ? "read" : "write";
18800
18803
  const issuedAccess = key.access ?? "write";
18801
18804
  if (issuedAccess !== requestedAccess) {
@@ -18862,7 +18865,8 @@ Waiting for approval…`));
18862
18865
  });
18863
18866
  } catch (error) {
18864
18867
  const keyId = typeof key.id === "string" && key.id ? safeOneLine(key.id) : "unknown";
18865
- printLine(styles3().yellow(`API key ${keyId} was created but could not be stored safely. Revoke it in Settings → API keys.`));
18868
+ const listedAs = key.name ? `"${safeOneLine(key.name)}"` : `the newest key named "CLI (…Z)", created at about ${new Date().toISOString().slice(0, 19).replace("T", " ")}Z,`;
18869
+ printLine(styles3().yellow(`API key ${keyId} was created on your account but could not be stored safely. Revoke ${listedAs} in Settings → API keys.`));
18866
18870
  throw error;
18867
18871
  }
18868
18872
  printLine(styles3().green(`
@@ -22713,6 +22717,15 @@ function retypeMessage(message, spellings) {
22713
22717
  }
22714
22718
  return retyped;
22715
22719
  }
22720
+ var LOCATION_PREFIX = /^(?:path|query|header|body)\.([^:\s]+): /;
22721
+ function retypeLocatedMessage(message, spellings) {
22722
+ const match = LOCATION_PREFIX.exec(message);
22723
+ if (!match)
22724
+ return retypeMessage(message, spellings);
22725
+ const [head, ...rest] = match[1].split(".");
22726
+ const location = [spellings.get(head) ?? head, ...rest].join(".");
22727
+ return `${location}: ${retypeMessage(message.slice(match[0].length), spellings)}`;
22728
+ }
22716
22729
  function retypeDetails(details, spellings) {
22717
22730
  if (Array.isArray(details))
22718
22731
  return details.map((issue) => retypeDetails(issue, spellings));
@@ -22740,7 +22753,7 @@ function retypeApiError(error, operation, commandSpec, operationSpec) {
22740
22753
  const spellings = typeableFields(operation, commandSpec, operationSpec);
22741
22754
  if (spellings.size === 0)
22742
22755
  return error;
22743
- return new SimApiError(retypeMessage(error.message, spellings), error.status, error.code, error.details === undefined ? undefined : retypeDetails(error.details, spellings));
22756
+ return new SimApiError(retypeLocatedMessage(error.message, spellings), error.status, error.code, error.details === undefined ? undefined : retypeDetails(error.details, spellings));
22744
22757
  }
22745
22758
 
22746
22759
  // src/runtime/build.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.2.25-preview.288.1",
3
+ "version": "2.2.25-preview.289.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "bin": {