sim 2.2.25 → 2.2.26-preview.293.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.
- package/dist/http/client.d.ts +5 -1
- package/dist/index.js +41 -24
- package/dist/runtime.js +43 -24
- package/package.json +1 -1
package/dist/http/client.d.ts
CHANGED
|
@@ -10,7 +10,11 @@ export declare class SimApiError extends Error {
|
|
|
10
10
|
readonly code: string | null;
|
|
11
11
|
readonly details?: unknown;
|
|
12
12
|
readonly exitCode: number;
|
|
13
|
-
|
|
13
|
+
/** The server's id for the failed request (`x-request-id`), to quote to support. */
|
|
14
|
+
readonly requestId: string | null;
|
|
15
|
+
constructor(message: string, status: number, code?: string | null, details?: unknown, exitCode?: number,
|
|
16
|
+
/** The server's id for the failed request (`x-request-id`), to quote to support. */
|
|
17
|
+
requestId?: string | null);
|
|
14
18
|
}
|
|
15
19
|
/** `{ data, nextCursor }` — one page of a list. */
|
|
16
20
|
export interface V2Page<T> {
|
package/dist/index.js
CHANGED
|
@@ -8411,12 +8411,14 @@ class SimApiError extends Error {
|
|
|
8411
8411
|
code;
|
|
8412
8412
|
details;
|
|
8413
8413
|
exitCode;
|
|
8414
|
-
|
|
8414
|
+
requestId;
|
|
8415
|
+
constructor(message, status, code = null, details, exitCode = 1, requestId = null) {
|
|
8415
8416
|
super(message);
|
|
8416
8417
|
this.status = status;
|
|
8417
8418
|
this.code = code;
|
|
8418
8419
|
this.details = details;
|
|
8419
8420
|
this.exitCode = exitCode;
|
|
8421
|
+
this.requestId = requestId;
|
|
8420
8422
|
this.name = "SimApiError";
|
|
8421
8423
|
}
|
|
8422
8424
|
}
|
|
@@ -8435,33 +8437,41 @@ var KEY_SCOPE_REFUSALS = new Set([
|
|
|
8435
8437
|
"WORKSPACE_KEY_OPERATION_NOT_PERMITTED",
|
|
8436
8438
|
"PRINCIPAL_KIND_NOT_PERMITTED"
|
|
8437
8439
|
]);
|
|
8438
|
-
function toNonJsonError(url, status, contentType, raw) {
|
|
8440
|
+
function toNonJsonError(url, status, contentType, raw, requestId = null) {
|
|
8439
8441
|
const type = contentType?.split(";")[0]?.trim().toLowerCase();
|
|
8440
8442
|
const isMarkup = type === "text/html" || type === "application/xhtml+xml" || MARKUP_PREFIX.test(raw);
|
|
8441
8443
|
const kind = isMarkup ? "HTML" : type && type !== "application/json" ? type : "a non-JSON response";
|
|
8442
8444
|
const text = raw.trim();
|
|
8443
8445
|
const keepSnippet = !isMarkup && text.length > 0 && text.length <= 200;
|
|
8444
|
-
return new SimApiError(`${url} returned ${kind}, not JSON (HTTP ${status}) — check your endpoint.${keepSnippet ? ` Response: ${truncate(text, 200, "…")}` : ""}`, status);
|
|
8446
|
+
return new SimApiError(`${url} returned ${kind}, not JSON (HTTP ${status}) — check your endpoint.${keepSnippet ? ` Response: ${truncate(text, 200, "…")}` : ""}`, status, null, undefined, 1, requestId);
|
|
8445
8447
|
}
|
|
8446
|
-
function toApiError(url,
|
|
8448
|
+
function toApiError(url, response, raw) {
|
|
8449
|
+
const { status } = response;
|
|
8450
|
+
const headerRequestId = responseRequestId(response);
|
|
8447
8451
|
let parsed;
|
|
8448
8452
|
try {
|
|
8449
8453
|
parsed = JSON.parse(raw);
|
|
8450
8454
|
} catch {
|
|
8451
|
-
if (!raw.trim())
|
|
8452
|
-
return new SimApiError(`Request failed with status ${status}`, status);
|
|
8453
|
-
|
|
8455
|
+
if (!raw.trim()) {
|
|
8456
|
+
return new SimApiError(`Request failed with status ${status}`, status, null, undefined, 1, headerRequestId);
|
|
8457
|
+
}
|
|
8458
|
+
return toNonJsonError(url, status, response.headers.get("content-type"), raw, headerRequestId);
|
|
8454
8459
|
}
|
|
8455
8460
|
const body = parsed;
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8461
|
+
const error = body.error && typeof body.error === "object" ? body.error : null;
|
|
8462
|
+
const requestId = nonEmptyString(error?.requestId) ?? nonEmptyString(body.requestId) ?? headerRequestId;
|
|
8463
|
+
const failure = (message, code = null, details) => new SimApiError(message, status, code, details, 1, requestId);
|
|
8464
|
+
if (error) {
|
|
8465
|
+
return failure(typeof error.message === "string" ? error.message : `Request failed with status ${status}`, typeof error.code === "string" ? error.code : null, error.details);
|
|
8459
8466
|
}
|
|
8460
8467
|
if (typeof body.error === "string")
|
|
8461
|
-
return
|
|
8468
|
+
return failure(body.error);
|
|
8462
8469
|
if (typeof body.message === "string")
|
|
8463
|
-
return
|
|
8464
|
-
return
|
|
8470
|
+
return failure(body.message);
|
|
8471
|
+
return failure(`Request failed with status ${status}`);
|
|
8472
|
+
}
|
|
8473
|
+
function nonEmptyString(value) {
|
|
8474
|
+
return typeof value === "string" && value ? value : null;
|
|
8465
8475
|
}
|
|
8466
8476
|
function transportErrorMessage(error) {
|
|
8467
8477
|
const messages = [];
|
|
@@ -8479,11 +8489,14 @@ function transportErrorMessage(error) {
|
|
|
8479
8489
|
}
|
|
8480
8490
|
return messages.join(": ") || "Unknown network error";
|
|
8481
8491
|
}
|
|
8492
|
+
function responseRequestId(response) {
|
|
8493
|
+
return response.headers.get("x-request-id")?.trim() || null;
|
|
8494
|
+
}
|
|
8482
8495
|
async function readResponseText(response) {
|
|
8483
8496
|
try {
|
|
8484
8497
|
return await response.text();
|
|
8485
8498
|
} catch (error) {
|
|
8486
|
-
throw new SimApiError(`Unable to read the response: ${transportErrorMessage(error)}`, response.status, "RESPONSE_READ_FAILED");
|
|
8499
|
+
throw new SimApiError(`Unable to read the response: ${transportErrorMessage(error)}`, response.status, "RESPONSE_READ_FAILED", undefined, 1, responseRequestId(response));
|
|
8487
8500
|
}
|
|
8488
8501
|
}
|
|
8489
8502
|
function refusalCode(error) {
|
|
@@ -8670,7 +8683,7 @@ class SimClient {
|
|
|
8670
8683
|
try {
|
|
8671
8684
|
return JSON.parse(raw);
|
|
8672
8685
|
} catch {
|
|
8673
|
-
throw toNonJsonError(url, response.status, response.headers.get("content-type"), raw);
|
|
8686
|
+
throw toNonJsonError(url, response.status, response.headers.get("content-type"), raw, responseRequestId(response));
|
|
8674
8687
|
}
|
|
8675
8688
|
}
|
|
8676
8689
|
async send(path, options, retriedAfterRefresh = false) {
|
|
@@ -8729,7 +8742,7 @@ class SimClient {
|
|
|
8729
8742
|
}
|
|
8730
8743
|
if (!response.ok) {
|
|
8731
8744
|
const raw = await readResponseText(response);
|
|
8732
|
-
const error = toApiError(url, response
|
|
8745
|
+
const error = toApiError(url, response, raw);
|
|
8733
8746
|
if (response.status === 401) {
|
|
8734
8747
|
error.message = `${error.message} — run: sim login --profile ${this.profile.authProfile}`;
|
|
8735
8748
|
}
|
|
@@ -8741,6 +8754,7 @@ class SimClient {
|
|
|
8741
8754
|
return { response, url };
|
|
8742
8755
|
}
|
|
8743
8756
|
toRedirectError(url, path, response) {
|
|
8757
|
+
const requestId = responseRequestId(response);
|
|
8744
8758
|
const location = response.headers.get("location")?.trim();
|
|
8745
8759
|
let target = null;
|
|
8746
8760
|
if (location) {
|
|
@@ -8751,13 +8765,13 @@ class SimClient {
|
|
|
8751
8765
|
}
|
|
8752
8766
|
}
|
|
8753
8767
|
if (!target) {
|
|
8754
|
-
return new SimApiError(`${url} answered HTTP ${response.status} with no usable redirect target. Check the endpoint for profile "${this.profile.name}".`, response.status);
|
|
8768
|
+
return new SimApiError(`${url} answered HTTP ${response.status} with no usable redirect target. Check the endpoint for profile "${this.profile.name}".`, response.status, null, undefined, 1, requestId);
|
|
8755
8769
|
}
|
|
8756
8770
|
const suggested = redirectEndpoint(this.profile.endpoint, path, target);
|
|
8757
8771
|
if (!suggested) {
|
|
8758
|
-
return new SimApiError(`${url} redirected to ${target.href}. The CLI does not follow redirects, because a redirect can drop the request body and turn a write into a silent no-op.`, response.status);
|
|
8772
|
+
return new SimApiError(`${url} redirected to ${target.href}. The CLI does not follow redirects, because a redirect can drop the request body and turn a write into a silent no-op.`, response.status, null, undefined, 1, requestId);
|
|
8759
8773
|
}
|
|
8760
|
-
return new SimApiError(`Endpoint redirected to ${suggested}. Run: sim configure --profile ${this.profile.name} --set-endpoint ${suggested}`, response.status);
|
|
8774
|
+
return new SimApiError(`Endpoint redirected to ${suggested}. Run: sim configure --profile ${this.profile.name} --set-endpoint ${suggested}`, response.status, null, undefined, 1, requestId);
|
|
8761
8775
|
}
|
|
8762
8776
|
}
|
|
8763
8777
|
function redirectEndpoint(endpoint, requestPath, target) {
|
|
@@ -21768,7 +21782,7 @@ async function waitWorkspaceOperation(client, workspaceId, operationId, timeoutS
|
|
|
21768
21782
|
operationId,
|
|
21769
21783
|
requestId: report?.requestId,
|
|
21770
21784
|
applied: report?.applied
|
|
21771
|
-
}, failure.exitCode);
|
|
21785
|
+
}, failure.exitCode, failure.requestId);
|
|
21772
21786
|
}
|
|
21773
21787
|
if (report.status !== "processing")
|
|
21774
21788
|
return { report, timedOut: false };
|
|
@@ -22760,7 +22774,7 @@ async function executeOperation(operation, commandSpec, operationSpec, invocatio
|
|
|
22760
22774
|
workspaceId: requestWorkspaceId,
|
|
22761
22775
|
applied: "unknown",
|
|
22762
22776
|
reconciliation: "Find the operation using this requestId, or retry identical inputs with the same requestId."
|
|
22763
|
-
}, failure.exitCode);
|
|
22777
|
+
}, failure.exitCode, failure.requestId);
|
|
22764
22778
|
}
|
|
22765
22779
|
throw error;
|
|
22766
22780
|
}
|
|
@@ -22881,7 +22895,7 @@ function retypeApiError(error, operation, commandSpec, operationSpec) {
|
|
|
22881
22895
|
const spellings = typeableFields(operation, commandSpec, operationSpec);
|
|
22882
22896
|
if (spellings.size === 0)
|
|
22883
22897
|
return error;
|
|
22884
|
-
return new SimApiError(retypeLocatedMessage(error.message, spellings), error.status, error.code, error.details === undefined ? undefined : retypeDetails(error.details, spellings));
|
|
22898
|
+
return new SimApiError(retypeLocatedMessage(error.message, spellings), error.status, error.code, error.details === undefined ? undefined : retypeDetails(error.details, spellings), error.exitCode, error.requestId);
|
|
22885
22899
|
}
|
|
22886
22900
|
|
|
22887
22901
|
// src/runtime/build.ts
|
|
@@ -23351,7 +23365,7 @@ function withKeylessRetryHint(error, providerId) {
|
|
|
23351
23365
|
const code = refusalCode(error);
|
|
23352
23366
|
if (code === null || !KEYLESS_RETRY_CODES.has(code))
|
|
23353
23367
|
return error;
|
|
23354
|
-
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);
|
|
23368
|
+
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, error.requestId);
|
|
23355
23369
|
}
|
|
23356
23370
|
async function createKeylessSubject({ client, profile }, providerId) {
|
|
23357
23371
|
const response = await client.request("createCredentialWorkloadIdentitySubject", { body: { workspaceId: client.requireWorkspace(), providerId } });
|
|
@@ -27081,7 +27095,8 @@ function explainFailure(error, program) {
|
|
|
27081
27095
|
error: {
|
|
27082
27096
|
code: error.code ?? "CLI_ERROR",
|
|
27083
27097
|
message: error.message,
|
|
27084
|
-
...error.details === undefined ? {} : { details: error.details }
|
|
27098
|
+
...error.details === undefined ? {} : { details: error.details },
|
|
27099
|
+
...error.requestId ? { requestId: error.requestId } : {}
|
|
27085
27100
|
}
|
|
27086
27101
|
};
|
|
27087
27102
|
process.stderr.write(output === "json" ? `${JSON.stringify(payload)}
|
|
@@ -27096,6 +27111,8 @@ function explainFailure(error, program) {
|
|
|
27096
27111
|
console.error(styles3().dim(sanitize(line)));
|
|
27097
27112
|
}
|
|
27098
27113
|
}
|
|
27114
|
+
if (error.requestId)
|
|
27115
|
+
console.error(styles3().dim(` request id: ${sanitize(error.requestId)}`));
|
|
27099
27116
|
return error.exitCode;
|
|
27100
27117
|
}
|
|
27101
27118
|
return null;
|
package/dist/runtime.js
CHANGED
|
@@ -4930,12 +4930,14 @@ class SimApiError extends Error {
|
|
|
4930
4930
|
code;
|
|
4931
4931
|
details;
|
|
4932
4932
|
exitCode;
|
|
4933
|
-
|
|
4933
|
+
requestId;
|
|
4934
|
+
constructor(message, status, code = null, details, exitCode = 1, requestId = null) {
|
|
4934
4935
|
super(message);
|
|
4935
4936
|
this.status = status;
|
|
4936
4937
|
this.code = code;
|
|
4937
4938
|
this.details = details;
|
|
4938
4939
|
this.exitCode = exitCode;
|
|
4940
|
+
this.requestId = requestId;
|
|
4939
4941
|
this.name = "SimApiError";
|
|
4940
4942
|
}
|
|
4941
4943
|
}
|
|
@@ -4954,33 +4956,41 @@ var KEY_SCOPE_REFUSALS = new Set([
|
|
|
4954
4956
|
"WORKSPACE_KEY_OPERATION_NOT_PERMITTED",
|
|
4955
4957
|
"PRINCIPAL_KIND_NOT_PERMITTED"
|
|
4956
4958
|
]);
|
|
4957
|
-
function toNonJsonError(url, status, contentType, raw) {
|
|
4959
|
+
function toNonJsonError(url, status, contentType, raw, requestId = null) {
|
|
4958
4960
|
const type = contentType?.split(";")[0]?.trim().toLowerCase();
|
|
4959
4961
|
const isMarkup = type === "text/html" || type === "application/xhtml+xml" || MARKUP_PREFIX.test(raw);
|
|
4960
4962
|
const kind = isMarkup ? "HTML" : type && type !== "application/json" ? type : "a non-JSON response";
|
|
4961
4963
|
const text = raw.trim();
|
|
4962
4964
|
const keepSnippet = !isMarkup && text.length > 0 && text.length <= 200;
|
|
4963
|
-
return new SimApiError(`${url} returned ${kind}, not JSON (HTTP ${status}) — check your endpoint.${keepSnippet ? ` Response: ${truncate(text, 200, "…")}` : ""}`, status);
|
|
4965
|
+
return new SimApiError(`${url} returned ${kind}, not JSON (HTTP ${status}) — check your endpoint.${keepSnippet ? ` Response: ${truncate(text, 200, "…")}` : ""}`, status, null, undefined, 1, requestId);
|
|
4964
4966
|
}
|
|
4965
|
-
function toApiError(url,
|
|
4967
|
+
function toApiError(url, response, raw) {
|
|
4968
|
+
const { status } = response;
|
|
4969
|
+
const headerRequestId = responseRequestId(response);
|
|
4966
4970
|
let parsed;
|
|
4967
4971
|
try {
|
|
4968
4972
|
parsed = JSON.parse(raw);
|
|
4969
4973
|
} catch {
|
|
4970
|
-
if (!raw.trim())
|
|
4971
|
-
return new SimApiError(`Request failed with status ${status}`, status);
|
|
4972
|
-
|
|
4974
|
+
if (!raw.trim()) {
|
|
4975
|
+
return new SimApiError(`Request failed with status ${status}`, status, null, undefined, 1, headerRequestId);
|
|
4976
|
+
}
|
|
4977
|
+
return toNonJsonError(url, status, response.headers.get("content-type"), raw, headerRequestId);
|
|
4973
4978
|
}
|
|
4974
4979
|
const body = parsed;
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4980
|
+
const error = body.error && typeof body.error === "object" ? body.error : null;
|
|
4981
|
+
const requestId = nonEmptyString(error?.requestId) ?? nonEmptyString(body.requestId) ?? headerRequestId;
|
|
4982
|
+
const failure = (message, code = null, details) => new SimApiError(message, status, code, details, 1, requestId);
|
|
4983
|
+
if (error) {
|
|
4984
|
+
return failure(typeof error.message === "string" ? error.message : `Request failed with status ${status}`, typeof error.code === "string" ? error.code : null, error.details);
|
|
4978
4985
|
}
|
|
4979
4986
|
if (typeof body.error === "string")
|
|
4980
|
-
return
|
|
4987
|
+
return failure(body.error);
|
|
4981
4988
|
if (typeof body.message === "string")
|
|
4982
|
-
return
|
|
4983
|
-
return
|
|
4989
|
+
return failure(body.message);
|
|
4990
|
+
return failure(`Request failed with status ${status}`);
|
|
4991
|
+
}
|
|
4992
|
+
function nonEmptyString(value) {
|
|
4993
|
+
return typeof value === "string" && value ? value : null;
|
|
4984
4994
|
}
|
|
4985
4995
|
function transportErrorMessage(error) {
|
|
4986
4996
|
const messages = [];
|
|
@@ -4998,11 +5008,14 @@ function transportErrorMessage(error) {
|
|
|
4998
5008
|
}
|
|
4999
5009
|
return messages.join(": ") || "Unknown network error";
|
|
5000
5010
|
}
|
|
5011
|
+
function responseRequestId(response) {
|
|
5012
|
+
return response.headers.get("x-request-id")?.trim() || null;
|
|
5013
|
+
}
|
|
5001
5014
|
async function readResponseText(response) {
|
|
5002
5015
|
try {
|
|
5003
5016
|
return await response.text();
|
|
5004
5017
|
} catch (error) {
|
|
5005
|
-
throw new SimApiError(`Unable to read the response: ${transportErrorMessage(error)}`, response.status, "RESPONSE_READ_FAILED");
|
|
5018
|
+
throw new SimApiError(`Unable to read the response: ${transportErrorMessage(error)}`, response.status, "RESPONSE_READ_FAILED", undefined, 1, responseRequestId(response));
|
|
5006
5019
|
}
|
|
5007
5020
|
}
|
|
5008
5021
|
function refusalCode(error) {
|
|
@@ -5189,7 +5202,7 @@ class SimClient {
|
|
|
5189
5202
|
try {
|
|
5190
5203
|
return JSON.parse(raw);
|
|
5191
5204
|
} catch {
|
|
5192
|
-
throw toNonJsonError(url, response.status, response.headers.get("content-type"), raw);
|
|
5205
|
+
throw toNonJsonError(url, response.status, response.headers.get("content-type"), raw, responseRequestId(response));
|
|
5193
5206
|
}
|
|
5194
5207
|
}
|
|
5195
5208
|
async send(path, options, retriedAfterRefresh = false) {
|
|
@@ -5248,7 +5261,7 @@ class SimClient {
|
|
|
5248
5261
|
}
|
|
5249
5262
|
if (!response.ok) {
|
|
5250
5263
|
const raw = await readResponseText(response);
|
|
5251
|
-
const error = toApiError(url, response
|
|
5264
|
+
const error = toApiError(url, response, raw);
|
|
5252
5265
|
if (response.status === 401) {
|
|
5253
5266
|
error.message = `${error.message} — run: sim login --profile ${this.profile.authProfile}`;
|
|
5254
5267
|
}
|
|
@@ -5260,6 +5273,7 @@ class SimClient {
|
|
|
5260
5273
|
return { response, url };
|
|
5261
5274
|
}
|
|
5262
5275
|
toRedirectError(url, path, response) {
|
|
5276
|
+
const requestId = responseRequestId(response);
|
|
5263
5277
|
const location = response.headers.get("location")?.trim();
|
|
5264
5278
|
let target = null;
|
|
5265
5279
|
if (location) {
|
|
@@ -5270,13 +5284,13 @@ class SimClient {
|
|
|
5270
5284
|
}
|
|
5271
5285
|
}
|
|
5272
5286
|
if (!target) {
|
|
5273
|
-
return new SimApiError(`${url} answered HTTP ${response.status} with no usable redirect target. Check the endpoint for profile "${this.profile.name}".`, response.status);
|
|
5287
|
+
return new SimApiError(`${url} answered HTTP ${response.status} with no usable redirect target. Check the endpoint for profile "${this.profile.name}".`, response.status, null, undefined, 1, requestId);
|
|
5274
5288
|
}
|
|
5275
5289
|
const suggested = redirectEndpoint(this.profile.endpoint, path, target);
|
|
5276
5290
|
if (!suggested) {
|
|
5277
|
-
return new SimApiError(`${url} redirected to ${target.href}. The CLI does not follow redirects, because a redirect can drop the request body and turn a write into a silent no-op.`, response.status);
|
|
5291
|
+
return new SimApiError(`${url} redirected to ${target.href}. The CLI does not follow redirects, because a redirect can drop the request body and turn a write into a silent no-op.`, response.status, null, undefined, 1, requestId);
|
|
5278
5292
|
}
|
|
5279
|
-
return new SimApiError(`Endpoint redirected to ${suggested}. Run: sim configure --profile ${this.profile.name} --set-endpoint ${suggested}`, response.status);
|
|
5293
|
+
return new SimApiError(`Endpoint redirected to ${suggested}. Run: sim configure --profile ${this.profile.name} --set-endpoint ${suggested}`, response.status, null, undefined, 1, requestId);
|
|
5280
5294
|
}
|
|
5281
5295
|
}
|
|
5282
5296
|
function redirectEndpoint(endpoint, requestPath, target) {
|
|
@@ -21817,7 +21831,7 @@ async function waitWorkspaceOperation(client, workspaceId, operationId, timeoutS
|
|
|
21817
21831
|
operationId,
|
|
21818
21832
|
requestId: report?.requestId,
|
|
21819
21833
|
applied: report?.applied
|
|
21820
|
-
}, failure.exitCode);
|
|
21834
|
+
}, failure.exitCode, failure.requestId);
|
|
21821
21835
|
}
|
|
21822
21836
|
if (report.status !== "processing")
|
|
21823
21837
|
return { report, timedOut: false };
|
|
@@ -22809,7 +22823,7 @@ async function executeOperation(operation, commandSpec, operationSpec, invocatio
|
|
|
22809
22823
|
workspaceId: requestWorkspaceId,
|
|
22810
22824
|
applied: "unknown",
|
|
22811
22825
|
reconciliation: "Find the operation using this requestId, or retry identical inputs with the same requestId."
|
|
22812
|
-
}, failure.exitCode);
|
|
22826
|
+
}, failure.exitCode, failure.requestId);
|
|
22813
22827
|
}
|
|
22814
22828
|
throw error;
|
|
22815
22829
|
}
|
|
@@ -22930,7 +22944,7 @@ function retypeApiError(error, operation, commandSpec, operationSpec) {
|
|
|
22930
22944
|
const spellings = typeableFields(operation, commandSpec, operationSpec);
|
|
22931
22945
|
if (spellings.size === 0)
|
|
22932
22946
|
return error;
|
|
22933
|
-
return new SimApiError(retypeLocatedMessage(error.message, spellings), error.status, error.code, error.details === undefined ? undefined : retypeDetails(error.details, spellings));
|
|
22947
|
+
return new SimApiError(retypeLocatedMessage(error.message, spellings), error.status, error.code, error.details === undefined ? undefined : retypeDetails(error.details, spellings), error.exitCode, error.requestId);
|
|
22934
22948
|
}
|
|
22935
22949
|
|
|
22936
22950
|
// src/runtime/build.ts
|
|
@@ -23400,7 +23414,7 @@ function withKeylessRetryHint(error, providerId) {
|
|
|
23400
23414
|
const code = refusalCode(error);
|
|
23401
23415
|
if (code === null || !KEYLESS_RETRY_CODES.has(code))
|
|
23402
23416
|
return error;
|
|
23403
|
-
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);
|
|
23417
|
+
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, error.requestId);
|
|
23404
23418
|
}
|
|
23405
23419
|
async function createKeylessSubject({ client, profile }, providerId) {
|
|
23406
23420
|
const response = await client.request("createCredentialWorkloadIdentitySubject", { body: { workspaceId: client.requireWorkspace(), providerId } });
|
|
@@ -27209,6 +27223,8 @@ function renderEmbeddedError(ctx, error) {
|
|
|
27209
27223
|
for (const line of formatApiErrorDetails(error.details))
|
|
27210
27224
|
ctx.stderr.diagnostic(sanitize(line));
|
|
27211
27225
|
}
|
|
27226
|
+
if (error.requestId)
|
|
27227
|
+
ctx.stderr.diagnostic(` request id: ${sanitize(error.requestId)}`);
|
|
27212
27228
|
return error.exitCode;
|
|
27213
27229
|
}
|
|
27214
27230
|
ctx.stderr.diagnostic(`Error: ${sanitize(getErrorMessage(error))}`);
|
|
@@ -27248,7 +27264,8 @@ function explainFailure(error, program) {
|
|
|
27248
27264
|
error: {
|
|
27249
27265
|
code: error.code ?? "CLI_ERROR",
|
|
27250
27266
|
message: error.message,
|
|
27251
|
-
...error.details === undefined ? {} : { details: error.details }
|
|
27267
|
+
...error.details === undefined ? {} : { details: error.details },
|
|
27268
|
+
...error.requestId ? { requestId: error.requestId } : {}
|
|
27252
27269
|
}
|
|
27253
27270
|
};
|
|
27254
27271
|
process.stderr.write(output === "json" ? `${JSON.stringify(payload)}
|
|
@@ -27263,6 +27280,8 @@ function explainFailure(error, program) {
|
|
|
27263
27280
|
console.error(styles3().dim(sanitize(line)));
|
|
27264
27281
|
}
|
|
27265
27282
|
}
|
|
27283
|
+
if (error.requestId)
|
|
27284
|
+
console.error(styles3().dim(` request id: ${sanitize(error.requestId)}`));
|
|
27266
27285
|
return error.exitCode;
|
|
27267
27286
|
}
|
|
27268
27287
|
return null;
|