sim 2.2.24-preview.283.1 → 2.2.24-preview.285.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.
@@ -1507,6 +1507,29 @@ type CreateCredentialConnectionResponseRef0 = {
1507
1507
  export type CreateCredentialConnectionResponse = {
1508
1508
  data: CreateCredentialConnectionResponseRef0;
1509
1509
  };
1510
+ /** `POST /api/v2/credentials/workload-identity/subjects` */
1511
+ export type CreateCredentialWorkloadIdentitySubjectQuery = Record<string, unknown>;
1512
+ export type CreateCredentialWorkloadIdentitySubjectBody = {
1513
+ workspaceId: string;
1514
+ providerId: 'aws-service-account' | 'databricks-service-account' | 'snowflake-service-account' | 'microsoft-app-service-account' | 'google-service-account';
1515
+ };
1516
+ type CreateCredentialWorkloadIdentitySubjectResponseRef0 = {
1517
+ issuer: string;
1518
+ audience?: string;
1519
+ subject: string;
1520
+ subjectProof: string;
1521
+ expiresAt: string;
1522
+ keylessConfig: {
1523
+ authType: string;
1524
+ subject: string;
1525
+ subjectProof: string;
1526
+ };
1527
+ requiredConfigFields: Array<string>;
1528
+ optionalConfigFields: Array<string>;
1529
+ };
1530
+ export type CreateCredentialWorkloadIdentitySubjectResponse = {
1531
+ data: CreateCredentialWorkloadIdentitySubjectResponseRef0;
1532
+ };
1510
1533
  /** `POST /api/v2/custom-tools` */
1511
1534
  export type CreateCustomToolQuery = Record<string, unknown>;
1512
1535
  export type CreateCustomToolBody = {
@@ -6514,6 +6537,11 @@ type ListCredentialProvidersResponseRef0 = {
6514
6537
  }>;
6515
6538
  hint?: string;
6516
6539
  }>;
6540
+ keyless?: {
6541
+ authType: string;
6542
+ requiredConfigFields: Array<string>;
6543
+ optionalConfigFields: Array<string>;
6544
+ };
6517
6545
  };
6518
6546
  export type ListCredentialProvidersResponse = {
6519
6547
  data: Array<ListCredentialProvidersResponseRef0>;
@@ -12720,6 +12748,27 @@ export declare const V2_OPERATIONS: {
12720
12748
  readonly workspaceKeyUnsupported: true;
12721
12749
  readonly opaqueBody: true;
12722
12750
  };
12751
+ readonly createCredentialWorkloadIdentitySubject: {
12752
+ readonly method: 'POST';
12753
+ readonly path: '/api/v2/credentials/workload-identity/subjects';
12754
+ readonly pathParams: readonly [];
12755
+ readonly responseMode: 'json';
12756
+ readonly summary: 'Create workload identity subject';
12757
+ readonly workspaceKeyUnsupported: true;
12758
+ readonly body: {
12759
+ readonly workspaceId: {
12760
+ readonly kind: 'string';
12761
+ readonly required: true;
12762
+ readonly describe: 'Workspace that will own the keyless credential.';
12763
+ };
12764
+ readonly providerId: {
12765
+ readonly kind: 'enum';
12766
+ readonly required: true;
12767
+ readonly values: readonly ['aws-service-account', 'databricks-service-account', 'snowflake-service-account', 'microsoft-app-service-account', 'google-service-account'];
12768
+ readonly describe: 'Service-account provider the keyless credential will be created under; pass the same value to Create service-account credential. The response and List credential providers name the fields its keyless configuration needs.';
12769
+ };
12770
+ };
12771
+ };
12723
12772
  readonly createCustomTool: {
12724
12773
  readonly method: 'POST';
12725
12774
  readonly path: '/api/v2/custom-tools';
@@ -64,6 +64,8 @@ export declare function buildUrl(endpoint: string, path: string, query?: Record<
64
64
  * redirect would also hand the API key to whatever origin `Location` names.
65
65
  */
66
66
  export declare const REDIRECT_STATUSES: Set<number>;
67
+ /** A refusal's machine-readable code: `details.code` when present, else the top-level `code`. */
68
+ export declare function refusalCode(error: SimApiError): string | null;
67
69
  /** The one instruction that resolves an elapsed request bound, wherever it surfaces. */
68
70
  export declare const RAISE_TIMEOUT_HINT = "Raise SIM_TIMEOUT_SECONDS, or set it to 0 to wait indefinitely.";
69
71
  /**
package/dist/index.js CHANGED
@@ -8486,14 +8486,18 @@ async function readResponseText(response) {
8486
8486
  throw new SimApiError(`Unable to read the response: ${transportErrorMessage(error)}`, response.status, "RESPONSE_READ_FAILED");
8487
8487
  }
8488
8488
  }
8489
- function namesKeyScopeRefusal(error) {
8490
- if (typeof error.code === "string" && KEY_SCOPE_REFUSALS.has(error.code))
8491
- return true;
8489
+ function refusalCode(error) {
8492
8490
  const details = error.details;
8493
- if (!details || typeof details !== "object")
8494
- return false;
8495
- const code = details.code;
8496
- return typeof code === "string" && KEY_SCOPE_REFUSALS.has(code);
8491
+ if (details && typeof details === "object") {
8492
+ const code = details.code;
8493
+ if (typeof code === "string")
8494
+ return code;
8495
+ }
8496
+ return error.code;
8497
+ }
8498
+ function namesKeyScopeRefusal(error) {
8499
+ const code = refusalCode(error);
8500
+ return code !== null && KEY_SCOPE_REFUSALS.has(code);
8497
8501
  }
8498
8502
  function isStrictPrefix(path, other) {
8499
8503
  if (path.length >= other.length)
@@ -10211,6 +10215,33 @@ var V2_OPERATIONS = {
10211
10215
  workspaceKeyUnsupported: true,
10212
10216
  opaqueBody: true
10213
10217
  },
10218
+ createCredentialWorkloadIdentitySubject: {
10219
+ method: "POST",
10220
+ path: "/api/v2/credentials/workload-identity/subjects",
10221
+ pathParams: [],
10222
+ responseMode: "json",
10223
+ summary: "Create workload identity subject",
10224
+ workspaceKeyUnsupported: true,
10225
+ body: {
10226
+ workspaceId: {
10227
+ kind: "string",
10228
+ required: true,
10229
+ describe: "Workspace that will own the keyless credential."
10230
+ },
10231
+ providerId: {
10232
+ kind: "enum",
10233
+ required: true,
10234
+ values: [
10235
+ "aws-service-account",
10236
+ "databricks-service-account",
10237
+ "snowflake-service-account",
10238
+ "microsoft-app-service-account",
10239
+ "google-service-account"
10240
+ ],
10241
+ describe: "Service-account provider the keyless credential will be created under; pass the same value to Create service-account credential. The response and List credential providers name the fields its keyless configuration needs."
10242
+ }
10243
+ }
10244
+ },
10214
10245
  createCustomTool: {
10215
10246
  method: "POST",
10216
10247
  path: "/api/v2/custom-tools",
@@ -19198,6 +19229,7 @@ function moveResource(command, resource) {
19198
19229
  var CLI_CONTRACT = {
19199
19230
  chat: { hidden: true },
19200
19231
  createCredentialConnection: { hidden: true },
19232
+ createCredentialWorkloadIdentitySubject: { hidden: true },
19201
19233
  createServiceAccountCredential: { hidden: true },
19202
19234
  getBillingStatus: {
19203
19235
  command: "billing status",
@@ -22899,6 +22931,40 @@ var SERVICE_ACCOUNT_RESULT = {
22899
22931
  { header: "created", path: "createdAt", format: "timestamp" }
22900
22932
  ]
22901
22933
  };
22934
+ var KEYLESS_SUBJECT_RESULT = {
22935
+ fields: [
22936
+ { header: "issuer" },
22937
+ { header: "audience" },
22938
+ { header: "subject" },
22939
+ { header: "subject proof", path: "subjectProof" },
22940
+ { header: "expires", path: "expiresAt", format: "timestamp" },
22941
+ { header: "auth type", path: "keylessConfig.authType" },
22942
+ { header: "required fields", path: "requiredConfigFields" },
22943
+ { header: "optional fields", path: "optionalConfigFields" }
22944
+ ]
22945
+ };
22946
+ var KEYLESS_PROVIDER_IDS = V2_OPERATIONS.createCredentialWorkloadIdentitySubject.body.providerId.values;
22947
+ var KEYLESS_RETRY_CODES = new Set([
22948
+ "WORKLOAD_IDENTITY_PROOF_EXPIRED",
22949
+ "WORKLOAD_IDENTITY_PROOF_INVALID",
22950
+ "WORKLOAD_IDENTITY_SUBJECT_REQUIRED",
22951
+ "WORKLOAD_IDENTITY_SUBJECT_IN_USE"
22952
+ ]);
22953
+ var KEYLESS_FLOW_HELP = [
22954
+ "Keyless (workload identity) credentials take two steps.",
22955
+ "",
22956
+ "Step 1: run `sim credentials keyless-subject <providerId> --output json` and configure your cloud to trust the printed issuer, audience, and subject. Its requiredConfigFields lists the values your provider's keylessConfig still needs.",
22957
+ "",
22958
+ "Step 2: add those values to keylessConfig and pass it to `sim credentials create <providerId> --credentials @file`.",
22959
+ "",
22960
+ `The proof expires after 24 hours and works only for the user who requested it, with the same providerId. If creation reports ${[...KEYLESS_RETRY_CODES].join(", ")}, run step 1 again, trust the new subject, and retry.`,
22961
+ "",
22962
+ "Examples:",
22963
+ " $ sim credentials keyless-subject aws-service-account --output json > subject.json",
22964
+ ` $ jq '.keylessConfig + {"roleArn":"arn:aws:iam::123456789012:role/SimWorkflows"}' subject.json > keyless.json`,
22965
+ ' $ sim credentials create aws-service-account --name "Keyless" --credentials @keyless.json'
22966
+ ].join(`
22967
+ `);
22902
22968
  function serviceAccountProvider(providers, providerId) {
22903
22969
  const provider = providers.find((candidate) => candidate.type === "service_account" && candidate.providerId === providerId);
22904
22970
  if (!provider) {
@@ -22914,8 +22980,8 @@ async function credentialValues(provider, raw) {
22914
22980
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
22915
22981
  throw new SimApiError("--credentials must be a JSON object", 0);
22916
22982
  }
22917
- const values = parsed;
22918
22983
  const fields = new Map(provider.fields.map((field) => [field.id, field]));
22984
+ const values = asServiceAccountJson(parsed, provider);
22919
22985
  for (const [id, value] of Object.entries(values)) {
22920
22986
  const field = fields.get(id);
22921
22987
  if (!field) {
@@ -22928,6 +22994,9 @@ async function credentialValues(provider, raw) {
22928
22994
  throw new SimApiError(`--credentials.${id} must be one of: ${field.options.map((option) => option.value).join(", ")}.`, 0);
22929
22995
  }
22930
22996
  }
22997
+ if (provider.keyless && values.serviceAccountJson !== undefined) {
22998
+ return values;
22999
+ }
22931
23000
  const authMethod = typeof values.authMethod === "string" ? values.authMethod : undefined;
22932
23001
  const missing = provider.fields.filter((field) => field.required || authMethod !== undefined && field.requiredForAuthMethods?.includes(authMethod)).filter((field) => values[field.id] === undefined).map((field) => field.id);
22933
23002
  if (missing.length > 0) {
@@ -22935,6 +23004,22 @@ async function credentialValues(provider, raw) {
22935
23004
  }
22936
23005
  return values;
22937
23006
  }
23007
+ function asServiceAccountJson(values, provider) {
23008
+ const keylessConfig = values.subject !== undefined && values.subjectProof !== undefined || provider.keyless !== undefined && values.authType === provider.keyless.authType;
23009
+ return keylessConfig ? { serviceAccountJson: JSON.stringify(values) } : values;
23010
+ }
23011
+ function withKeylessRetryHint(error, providerId) {
23012
+ if (!(error instanceof SimApiError))
23013
+ return error;
23014
+ const code = refusalCode(error);
23015
+ if (code === null || !KEYLESS_RETRY_CODES.has(code))
23016
+ return error;
23017
+ return new SimApiError(`${error.message} Run \`sim credentials keyless-subject ${providerId}\` for a new subject, trust it in your cloud, and retry.`, error.status, error.code, error.details, error.exitCode);
23018
+ }
23019
+ async function createKeylessSubject({ client, profile }, providerId) {
23020
+ const response = await client.request("createCredentialWorkloadIdentitySubject", { body: { workspaceId: client.requireWorkspace(), providerId } });
23021
+ renderResult("createCredentialWorkloadIdentitySubject", profile.output, response.data, KEYLESS_SUBJECT_RESULT);
23022
+ }
22938
23023
  async function createServiceAccount({ client, profile }, providerId, options) {
22939
23024
  const workspaceId = client.requireWorkspace();
22940
23025
  const catalog = await client.request("listCredentialProviders", {
@@ -22955,6 +23040,8 @@ async function createServiceAccount({ client, profile }, providerId, options) {
22955
23040
  ...options.id ? { id: options.id } : {},
22956
23041
  credentials: JSON.stringify(credentialFields)
22957
23042
  }
23043
+ }).catch((error) => {
23044
+ throw withKeylessRetryHint(error, providerId);
22958
23045
  });
22959
23046
  renderResult("createServiceAccountCredential", profile.output, response.data, SERVICE_ACCOUNT_RESULT);
22960
23047
  }
@@ -22987,7 +23074,20 @@ function attachCredentialCommands(program) {
22987
23074
  throw new Error("The generated credentials command group is missing");
22988
23075
  acceptNameOnUpdate(credentials);
22989
23076
  const [create, connectCreate] = apiCommand(credentials, "create", ["listCredentialProviders", "createServiceAccountCredential"], { runs: "createServiceAccountCredential" });
22990
- create.argument("<providerId>", "Service-account provider to create a credential for").description(describeOperation(V2_OPERATIONS.createServiceAccountCredential, "Create a service-account credential using its discovered provider schema")).requiredOption("--name <displayName>", "Name shown for the credential in Sim (required)").requiredOption("--credentials <json|@file>", "Provider credentials as JSON (or @path / @- to read a file or stdin) (required)").option("--description <description>", "Optional credential description").option("--id <credentialId>", "Client-generated credential ID when provider discovery requires it").action((providerId, options) => createServiceAccount(connectCreate(), providerId, options));
23077
+ create.argument("<providerId>", "Service-account provider to create a credential for").description(describeOperation(V2_OPERATIONS.createServiceAccountCredential, "Create a service-account credential using its discovered provider schema")).requiredOption("--name <displayName>", "Name shown for the credential in Sim (required)").requiredOption("--credentials <json|@file>", "Provider credentials as JSON (or @path / @- to read a file or stdin) (required)").option("--description <description>", "Optional credential description").option("--id <credentialId>", "Client-generated credential ID when provider discovery requires it").addHelpText("after", [
23078
+ "",
23079
+ "--credentials takes the provider's fields, or the keylessConfig from `sim credentials keyless-subject` (with the required fields filled in). Pass @path or @- to keep secrets out of shell history.",
23080
+ "",
23081
+ KEYLESS_FLOW_HELP
23082
+ ].join(`
23083
+ `)).action((providerId, options) => createServiceAccount(connectCreate(), providerId, options));
23084
+ const [keylessSubject, connectKeylessSubject] = apiCommand(credentials, "keyless-subject", [
23085
+ "createCredentialWorkloadIdentitySubject"
23086
+ ]);
23087
+ keylessSubject.addArgument(new Argument("<providerId>", "Service-account provider for the keyless credential").choices([
23088
+ ...KEYLESS_PROVIDER_IDS
23089
+ ])).description(describeOperation(V2_OPERATIONS.createCredentialWorkloadIdentitySubject, "Issue the subject and proof for a new keyless (workload identity) credential")).addHelpText("after", `
23090
+ ${KEYLESS_FLOW_HELP}`).action((providerId) => createKeylessSubject(connectKeylessSubject(), providerId));
22991
23091
  const [connect, connectLink] = apiCommand(credentials, "connect", ["createCredentialConnection"]);
22992
23092
  connect.argument("<providerId>", "OAuth provider to connect").description(describeOperation(V2_OPERATIONS.createCredentialConnection, "Create a short-lived link for connecting an OAuth provider")).requiredOption("--name <displayName>", "Name shown for the new credential in Sim (required)").action(async (providerId, options) => createConnectionLink(connectLink(), { providerId, displayName: options.name }));
22993
23093
  const [reconnect, reconnectLink] = apiCommand(credentials, "reconnect", [
package/dist/runtime.js CHANGED
@@ -5005,14 +5005,18 @@ async function readResponseText(response) {
5005
5005
  throw new SimApiError(`Unable to read the response: ${transportErrorMessage(error)}`, response.status, "RESPONSE_READ_FAILED");
5006
5006
  }
5007
5007
  }
5008
- function namesKeyScopeRefusal(error) {
5009
- if (typeof error.code === "string" && KEY_SCOPE_REFUSALS.has(error.code))
5010
- return true;
5008
+ function refusalCode(error) {
5011
5009
  const details = error.details;
5012
- if (!details || typeof details !== "object")
5013
- return false;
5014
- const code = details.code;
5015
- return typeof code === "string" && KEY_SCOPE_REFUSALS.has(code);
5010
+ if (details && typeof details === "object") {
5011
+ const code = details.code;
5012
+ if (typeof code === "string")
5013
+ return code;
5014
+ }
5015
+ return error.code;
5016
+ }
5017
+ function namesKeyScopeRefusal(error) {
5018
+ const code = refusalCode(error);
5019
+ return code !== null && KEY_SCOPE_REFUSALS.has(code);
5016
5020
  }
5017
5021
  function isStrictPrefix(path, other) {
5018
5022
  if (path.length >= other.length)
@@ -10260,6 +10264,33 @@ var V2_OPERATIONS = {
10260
10264
  workspaceKeyUnsupported: true,
10261
10265
  opaqueBody: true
10262
10266
  },
10267
+ createCredentialWorkloadIdentitySubject: {
10268
+ method: "POST",
10269
+ path: "/api/v2/credentials/workload-identity/subjects",
10270
+ pathParams: [],
10271
+ responseMode: "json",
10272
+ summary: "Create workload identity subject",
10273
+ workspaceKeyUnsupported: true,
10274
+ body: {
10275
+ workspaceId: {
10276
+ kind: "string",
10277
+ required: true,
10278
+ describe: "Workspace that will own the keyless credential."
10279
+ },
10280
+ providerId: {
10281
+ kind: "enum",
10282
+ required: true,
10283
+ values: [
10284
+ "aws-service-account",
10285
+ "databricks-service-account",
10286
+ "snowflake-service-account",
10287
+ "microsoft-app-service-account",
10288
+ "google-service-account"
10289
+ ],
10290
+ describe: "Service-account provider the keyless credential will be created under; pass the same value to Create service-account credential. The response and List credential providers name the fields its keyless configuration needs."
10291
+ }
10292
+ }
10293
+ },
10263
10294
  createCustomTool: {
10264
10295
  method: "POST",
10265
10296
  path: "/api/v2/custom-tools",
@@ -19247,6 +19278,7 @@ function moveResource(command, resource) {
19247
19278
  var CLI_CONTRACT = {
19248
19279
  chat: { hidden: true },
19249
19280
  createCredentialConnection: { hidden: true },
19281
+ createCredentialWorkloadIdentitySubject: { hidden: true },
19250
19282
  createServiceAccountCredential: { hidden: true },
19251
19283
  getBillingStatus: {
19252
19284
  command: "billing status",
@@ -22948,6 +22980,40 @@ var SERVICE_ACCOUNT_RESULT = {
22948
22980
  { header: "created", path: "createdAt", format: "timestamp" }
22949
22981
  ]
22950
22982
  };
22983
+ var KEYLESS_SUBJECT_RESULT = {
22984
+ fields: [
22985
+ { header: "issuer" },
22986
+ { header: "audience" },
22987
+ { header: "subject" },
22988
+ { header: "subject proof", path: "subjectProof" },
22989
+ { header: "expires", path: "expiresAt", format: "timestamp" },
22990
+ { header: "auth type", path: "keylessConfig.authType" },
22991
+ { header: "required fields", path: "requiredConfigFields" },
22992
+ { header: "optional fields", path: "optionalConfigFields" }
22993
+ ]
22994
+ };
22995
+ var KEYLESS_PROVIDER_IDS = V2_OPERATIONS.createCredentialWorkloadIdentitySubject.body.providerId.values;
22996
+ var KEYLESS_RETRY_CODES = new Set([
22997
+ "WORKLOAD_IDENTITY_PROOF_EXPIRED",
22998
+ "WORKLOAD_IDENTITY_PROOF_INVALID",
22999
+ "WORKLOAD_IDENTITY_SUBJECT_REQUIRED",
23000
+ "WORKLOAD_IDENTITY_SUBJECT_IN_USE"
23001
+ ]);
23002
+ var KEYLESS_FLOW_HELP = [
23003
+ "Keyless (workload identity) credentials take two steps.",
23004
+ "",
23005
+ "Step 1: run `sim credentials keyless-subject <providerId> --output json` and configure your cloud to trust the printed issuer, audience, and subject. Its requiredConfigFields lists the values your provider's keylessConfig still needs.",
23006
+ "",
23007
+ "Step 2: add those values to keylessConfig and pass it to `sim credentials create <providerId> --credentials @file`.",
23008
+ "",
23009
+ `The proof expires after 24 hours and works only for the user who requested it, with the same providerId. If creation reports ${[...KEYLESS_RETRY_CODES].join(", ")}, run step 1 again, trust the new subject, and retry.`,
23010
+ "",
23011
+ "Examples:",
23012
+ " $ sim credentials keyless-subject aws-service-account --output json > subject.json",
23013
+ ` $ jq '.keylessConfig + {"roleArn":"arn:aws:iam::123456789012:role/SimWorkflows"}' subject.json > keyless.json`,
23014
+ ' $ sim credentials create aws-service-account --name "Keyless" --credentials @keyless.json'
23015
+ ].join(`
23016
+ `);
22951
23017
  function serviceAccountProvider(providers, providerId) {
22952
23018
  const provider = providers.find((candidate) => candidate.type === "service_account" && candidate.providerId === providerId);
22953
23019
  if (!provider) {
@@ -22963,8 +23029,8 @@ async function credentialValues(provider, raw) {
22963
23029
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
22964
23030
  throw new SimApiError("--credentials must be a JSON object", 0);
22965
23031
  }
22966
- const values = parsed;
22967
23032
  const fields = new Map(provider.fields.map((field) => [field.id, field]));
23033
+ const values = asServiceAccountJson(parsed, provider);
22968
23034
  for (const [id, value] of Object.entries(values)) {
22969
23035
  const field = fields.get(id);
22970
23036
  if (!field) {
@@ -22977,6 +23043,9 @@ async function credentialValues(provider, raw) {
22977
23043
  throw new SimApiError(`--credentials.${id} must be one of: ${field.options.map((option) => option.value).join(", ")}.`, 0);
22978
23044
  }
22979
23045
  }
23046
+ if (provider.keyless && values.serviceAccountJson !== undefined) {
23047
+ return values;
23048
+ }
22980
23049
  const authMethod = typeof values.authMethod === "string" ? values.authMethod : undefined;
22981
23050
  const missing = provider.fields.filter((field) => field.required || authMethod !== undefined && field.requiredForAuthMethods?.includes(authMethod)).filter((field) => values[field.id] === undefined).map((field) => field.id);
22982
23051
  if (missing.length > 0) {
@@ -22984,6 +23053,22 @@ async function credentialValues(provider, raw) {
22984
23053
  }
22985
23054
  return values;
22986
23055
  }
23056
+ function asServiceAccountJson(values, provider) {
23057
+ const keylessConfig = values.subject !== undefined && values.subjectProof !== undefined || provider.keyless !== undefined && values.authType === provider.keyless.authType;
23058
+ return keylessConfig ? { serviceAccountJson: JSON.stringify(values) } : values;
23059
+ }
23060
+ function withKeylessRetryHint(error, providerId) {
23061
+ if (!(error instanceof SimApiError))
23062
+ return error;
23063
+ const code = refusalCode(error);
23064
+ if (code === null || !KEYLESS_RETRY_CODES.has(code))
23065
+ return error;
23066
+ return new SimApiError(`${error.message} Run \`sim credentials keyless-subject ${providerId}\` for a new subject, trust it in your cloud, and retry.`, error.status, error.code, error.details, error.exitCode);
23067
+ }
23068
+ async function createKeylessSubject({ client, profile }, providerId) {
23069
+ const response = await client.request("createCredentialWorkloadIdentitySubject", { body: { workspaceId: client.requireWorkspace(), providerId } });
23070
+ renderResult("createCredentialWorkloadIdentitySubject", profile.output, response.data, KEYLESS_SUBJECT_RESULT);
23071
+ }
22987
23072
  async function createServiceAccount({ client, profile }, providerId, options) {
22988
23073
  const workspaceId = client.requireWorkspace();
22989
23074
  const catalog = await client.request("listCredentialProviders", {
@@ -23004,6 +23089,8 @@ async function createServiceAccount({ client, profile }, providerId, options) {
23004
23089
  ...options.id ? { id: options.id } : {},
23005
23090
  credentials: JSON.stringify(credentialFields)
23006
23091
  }
23092
+ }).catch((error) => {
23093
+ throw withKeylessRetryHint(error, providerId);
23007
23094
  });
23008
23095
  renderResult("createServiceAccountCredential", profile.output, response.data, SERVICE_ACCOUNT_RESULT);
23009
23096
  }
@@ -23036,7 +23123,20 @@ function attachCredentialCommands(program) {
23036
23123
  throw new Error("The generated credentials command group is missing");
23037
23124
  acceptNameOnUpdate(credentials);
23038
23125
  const [create, connectCreate] = apiCommand(credentials, "create", ["listCredentialProviders", "createServiceAccountCredential"], { runs: "createServiceAccountCredential" });
23039
- create.argument("<providerId>", "Service-account provider to create a credential for").description(describeOperation(V2_OPERATIONS.createServiceAccountCredential, "Create a service-account credential using its discovered provider schema")).requiredOption("--name <displayName>", "Name shown for the credential in Sim (required)").requiredOption("--credentials <json|@file>", "Provider credentials as JSON (or @path / @- to read a file or stdin) (required)").option("--description <description>", "Optional credential description").option("--id <credentialId>", "Client-generated credential ID when provider discovery requires it").action((providerId, options) => createServiceAccount(connectCreate(), providerId, options));
23126
+ create.argument("<providerId>", "Service-account provider to create a credential for").description(describeOperation(V2_OPERATIONS.createServiceAccountCredential, "Create a service-account credential using its discovered provider schema")).requiredOption("--name <displayName>", "Name shown for the credential in Sim (required)").requiredOption("--credentials <json|@file>", "Provider credentials as JSON (or @path / @- to read a file or stdin) (required)").option("--description <description>", "Optional credential description").option("--id <credentialId>", "Client-generated credential ID when provider discovery requires it").addHelpText("after", [
23127
+ "",
23128
+ "--credentials takes the provider's fields, or the keylessConfig from `sim credentials keyless-subject` (with the required fields filled in). Pass @path or @- to keep secrets out of shell history.",
23129
+ "",
23130
+ KEYLESS_FLOW_HELP
23131
+ ].join(`
23132
+ `)).action((providerId, options) => createServiceAccount(connectCreate(), providerId, options));
23133
+ const [keylessSubject, connectKeylessSubject] = apiCommand(credentials, "keyless-subject", [
23134
+ "createCredentialWorkloadIdentitySubject"
23135
+ ]);
23136
+ keylessSubject.addArgument(new Argument("<providerId>", "Service-account provider for the keyless credential").choices([
23137
+ ...KEYLESS_PROVIDER_IDS
23138
+ ])).description(describeOperation(V2_OPERATIONS.createCredentialWorkloadIdentitySubject, "Issue the subject and proof for a new keyless (workload identity) credential")).addHelpText("after", `
23139
+ ${KEYLESS_FLOW_HELP}`).action((providerId) => createKeylessSubject(connectKeylessSubject(), providerId));
23040
23140
  const [connect, connectLink] = apiCommand(credentials, "connect", ["createCredentialConnection"]);
23041
23141
  connect.argument("<providerId>", "OAuth provider to connect").description(describeOperation(V2_OPERATIONS.createCredentialConnection, "Create a short-lived link for connecting an OAuth provider")).requiredOption("--name <displayName>", "Name shown for the new credential in Sim (required)").action(async (providerId, options) => createConnectionLink(connectLink(), { providerId, displayName: options.name }));
23042
23142
  const [reconnect, reconnectLink] = apiCommand(credentials, "reconnect", [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.2.24-preview.283.1",
3
+ "version": "2.2.24-preview.285.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "bin": {