@bugbug-io/sdk 14.4.2 → 14.5.0
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/index.js
CHANGED
|
@@ -9596,7 +9596,7 @@ var buildUserAgent = (clientType, version) => `BugBug ${clientType.toUpperCase()
|
|
|
9596
9596
|
// ../core/package.json
|
|
9597
9597
|
var package_default = {
|
|
9598
9598
|
name: "@bugbug-io/core",
|
|
9599
|
-
version: "14.
|
|
9599
|
+
version: "14.5.0",
|
|
9600
9600
|
private: true,
|
|
9601
9601
|
type: "module",
|
|
9602
9602
|
main: "dist/index.js",
|
|
@@ -10309,6 +10309,8 @@ var BugBugApiClient = class {
|
|
|
10309
10309
|
*/
|
|
10310
10310
|
#handleOpenApiError = async (error, response, request) => {
|
|
10311
10311
|
const status = response?.status;
|
|
10312
|
+
const requestId = response?.headers.get("X-Request-Id")?.trim();
|
|
10313
|
+
const requestWithResponseContext = requestId ? { ...request, requestId } : request;
|
|
10312
10314
|
const errorMessage = formatApiErrorMessage(error);
|
|
10313
10315
|
const errorBody = parseErrorBody(error);
|
|
10314
10316
|
const fields = extractFieldErrors(errorBody);
|
|
@@ -10318,33 +10320,37 @@ var BugBugApiClient = class {
|
|
|
10318
10320
|
throw new AuthenticationError(
|
|
10319
10321
|
errorMessage || "Invalid API token or authentication failed",
|
|
10320
10322
|
response,
|
|
10321
|
-
|
|
10323
|
+
requestWithResponseContext
|
|
10322
10324
|
);
|
|
10323
10325
|
case 402:
|
|
10324
10326
|
throw new SubscriptionError(
|
|
10325
10327
|
errorMessage || "This operation is not available on your current plan. Upgrade your plan to continue.",
|
|
10326
10328
|
response,
|
|
10327
|
-
|
|
10329
|
+
requestWithResponseContext,
|
|
10328
10330
|
subscriptionUpgradeUrl
|
|
10329
10331
|
);
|
|
10330
10332
|
case 403:
|
|
10331
10333
|
throw new AuthorizationError(
|
|
10332
10334
|
errorMessage || "Access denied. Check your permissions.",
|
|
10333
10335
|
response,
|
|
10334
|
-
|
|
10336
|
+
requestWithResponseContext
|
|
10335
10337
|
);
|
|
10336
10338
|
case 404:
|
|
10337
|
-
throw new NotFoundError(
|
|
10339
|
+
throw new NotFoundError(
|
|
10340
|
+
errorMessage || "Resource not found",
|
|
10341
|
+
response,
|
|
10342
|
+
requestWithResponseContext
|
|
10343
|
+
);
|
|
10338
10344
|
case 400:
|
|
10339
10345
|
case 422:
|
|
10340
10346
|
if (status === 400 && this.#isMissingProjectId(errorMessage, fields)) {
|
|
10341
|
-
throw new MissingProjectIdError(void 0, response,
|
|
10347
|
+
throw new MissingProjectIdError(void 0, response, requestWithResponseContext);
|
|
10342
10348
|
}
|
|
10343
10349
|
throw new ValidationError(
|
|
10344
10350
|
errorMessage || "Validation failed. Check your request data.",
|
|
10345
10351
|
response,
|
|
10346
10352
|
fields,
|
|
10347
|
-
|
|
10353
|
+
requestWithResponseContext
|
|
10348
10354
|
);
|
|
10349
10355
|
case 429: {
|
|
10350
10356
|
const retryAfter = response?.headers.get("Retry-After");
|
|
@@ -10353,14 +10359,14 @@ var BugBugApiClient = class {
|
|
|
10353
10359
|
retryAfterMs,
|
|
10354
10360
|
errorMessage || "Rate limit exceeded",
|
|
10355
10361
|
response,
|
|
10356
|
-
|
|
10362
|
+
requestWithResponseContext
|
|
10357
10363
|
);
|
|
10358
10364
|
}
|
|
10359
10365
|
case 500:
|
|
10360
10366
|
throw new InternalServerError(
|
|
10361
10367
|
errorMessage || "Internal server error. Please try again later.",
|
|
10362
10368
|
response,
|
|
10363
|
-
|
|
10369
|
+
requestWithResponseContext
|
|
10364
10370
|
);
|
|
10365
10371
|
case 502:
|
|
10366
10372
|
case 503:
|
|
@@ -10368,21 +10374,21 @@ var BugBugApiClient = class {
|
|
|
10368
10374
|
throw new ServiceUnavailableError(
|
|
10369
10375
|
errorMessage || "Service temporarily unavailable. Please try again later.",
|
|
10370
10376
|
response,
|
|
10371
|
-
|
|
10377
|
+
requestWithResponseContext
|
|
10372
10378
|
);
|
|
10373
10379
|
default:
|
|
10374
10380
|
if (status === void 0) {
|
|
10375
10381
|
throw new NetworkError(
|
|
10376
10382
|
errorMessage || "No response received from BugBug API",
|
|
10377
10383
|
void 0,
|
|
10378
|
-
|
|
10384
|
+
requestWithResponseContext
|
|
10379
10385
|
);
|
|
10380
10386
|
}
|
|
10381
10387
|
throw new HttpError(
|
|
10382
10388
|
errorMessage || `HTTP ${status}: ${response?.statusText || "Unknown error"}`,
|
|
10383
10389
|
status,
|
|
10384
10390
|
response,
|
|
10385
|
-
|
|
10391
|
+
requestWithResponseContext
|
|
10386
10392
|
);
|
|
10387
10393
|
}
|
|
10388
10394
|
};
|
|
@@ -15178,7 +15184,7 @@ var STEP_ERROR_CODES = [
|
|
|
15178
15184
|
// ../api-schema/dist/schemas/steps.js
|
|
15179
15185
|
var WaitingConditionSchema = external_exports.object({
|
|
15180
15186
|
type: WaitingConditionTypeSchema,
|
|
15181
|
-
expected: external_exports.string().nullable().describe("Expected value for the waiting condition, if any.")
|
|
15187
|
+
expected: external_exports.string().nullable().optional().default(null).describe("Expected value for the waiting condition, if any.")
|
|
15182
15188
|
}).passthrough();
|
|
15183
15189
|
var StepErrorCodeSchema = external_exports.enum(STEP_ERROR_CODES);
|
|
15184
15190
|
var StepSourceSchema = external_exports.enum(["api", "agent"]).describe("Creation source for public API step writes.");
|