@bedrock-rbx/ocale 0.3.4 → 0.4.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.
Files changed (85) hide show
  1. package/README.md +9 -5
  2. package/dist/badge-cost-mismatch-DrlvhlQc.mjs +47 -0
  3. package/dist/badge-cost-mismatch-DrlvhlQc.mjs.map +1 -0
  4. package/dist/badges.d.mts +228 -184
  5. package/dist/badges.d.mts.map +1 -1
  6. package/dist/badges.mjs +176 -18
  7. package/dist/badges.mjs.map +1 -1
  8. package/dist/capacity-admission-hycCFkTo.d.mts +355 -0
  9. package/dist/capacity-admission-hycCFkTo.d.mts.map +1 -0
  10. package/dist/{data.generated-B2ceLfSn.d.mts → data.generated-D_vpa5-g.d.mts} +23 -23
  11. package/dist/data.generated-D_vpa5-g.d.mts.map +1 -0
  12. package/dist/developer-products.d.mts +181 -186
  13. package/dist/developer-products.d.mts.map +1 -1
  14. package/dist/developer-products.mjs +24 -24
  15. package/dist/developer-products.mjs.map +1 -1
  16. package/dist/game-passes.d.mts +206 -203
  17. package/dist/game-passes.d.mts.map +1 -1
  18. package/dist/game-passes.mjs +26 -21
  19. package/dist/game-passes.mjs.map +1 -1
  20. package/dist/index.d.mts +905 -343
  21. package/dist/index.d.mts.map +1 -1
  22. package/dist/index.mjs +325 -10
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/locales.d.mts +30 -2
  25. package/dist/locales.d.mts.map +1 -0
  26. package/dist/locales.mjs +24 -1
  27. package/dist/locales.mjs.map +1 -1
  28. package/dist/luau-execution.d.mts +154 -151
  29. package/dist/luau-execution.d.mts.map +1 -1
  30. package/dist/luau-execution.mjs +11 -8
  31. package/dist/luau-execution.mjs.map +1 -1
  32. package/dist/{network-error-DR9FX5hb.mjs → network-error-iVSng5MT.mjs} +44 -6
  33. package/dist/network-error-iVSng5MT.mjs.map +1 -0
  34. package/dist/places.d.mts +204 -180
  35. package/dist/places.d.mts.map +1 -1
  36. package/dist/places.mjs +66 -20
  37. package/dist/places.mjs.map +1 -1
  38. package/dist/{poll-timeout-3PXLsabj.mjs → poll-timeout-DzztDymd.mjs} +2 -2
  39. package/dist/{poll-timeout-3PXLsabj.mjs.map → poll-timeout-DzztDymd.mjs.map} +1 -1
  40. package/dist/{polling-helpers-CoVhsC33.mjs → polling-helpers-DfF5dspc.mjs} +249 -83
  41. package/dist/polling-helpers-DfF5dspc.mjs.map +1 -0
  42. package/dist/{price-information-B0tkOoAX.mjs → price-information-DEkEQ8Pq.mjs} +2 -2
  43. package/dist/{price-information-B0tkOoAX.mjs.map → price-information-DEkEQ8Pq.mjs.map} +1 -1
  44. package/dist/resource-client-BCKukheG.d.mts +168 -0
  45. package/dist/resource-client-BCKukheG.d.mts.map +1 -0
  46. package/dist/{resource-client-rqTMkBeR.mjs → resource-client-CaIVr-go.mjs} +586 -158
  47. package/dist/resource-client-CaIVr-go.mjs.map +1 -0
  48. package/dist/retry-C2oHesDx.d.mts +229 -0
  49. package/dist/retry-C2oHesDx.d.mts.map +1 -0
  50. package/dist/{retry-BlX4tUnT.mjs → retry-CMRDvAR4.mjs} +278 -18
  51. package/dist/retry-CMRDvAR4.mjs.map +1 -0
  52. package/dist/storage.d.mts +333 -334
  53. package/dist/storage.d.mts.map +1 -1
  54. package/dist/storage.mjs +29 -22
  55. package/dist/storage.mjs.map +1 -1
  56. package/dist/testing.d.mts +347 -360
  57. package/dist/testing.d.mts.map +1 -1
  58. package/dist/testing.mjs +3 -4
  59. package/dist/testing.mjs.map +1 -1
  60. package/dist/types-CdMr_J1M.d.mts +509 -0
  61. package/dist/types-CdMr_J1M.d.mts.map +1 -0
  62. package/dist/universes.d.mts +619 -422
  63. package/dist/universes.d.mts.map +1 -1
  64. package/dist/universes.mjs +421 -48
  65. package/dist/universes.mjs.map +1 -1
  66. package/dist/{validation-B_Zs1So2.mjs → validation-964VNlbp.mjs} +2 -2
  67. package/dist/{validation-B_Zs1So2.mjs.map → validation-964VNlbp.mjs.map} +1 -1
  68. package/dist/wire-DJqupefn.d.mts +41 -0
  69. package/dist/wire-DJqupefn.d.mts.map +1 -0
  70. package/package.json +14 -14
  71. package/dist/capacity-admission-IDO3fcUC.d.mts +0 -369
  72. package/dist/capacity-admission-IDO3fcUC.d.mts.map +0 -1
  73. package/dist/data.generated-B2ceLfSn.d.mts.map +0 -1
  74. package/dist/network-error-DR9FX5hb.mjs.map +0 -1
  75. package/dist/polling-helpers-CoVhsC33.mjs.map +0 -1
  76. package/dist/resource-client-B6NeFXUv.d.mts +0 -164
  77. package/dist/resource-client-B6NeFXUv.d.mts.map +0 -1
  78. package/dist/resource-client-rqTMkBeR.mjs.map +0 -1
  79. package/dist/retry-BlX4tUnT.mjs.map +0 -1
  80. package/dist/retry-war_-9tb.d.mts +0 -373
  81. package/dist/retry-war_-9tb.d.mts.map +0 -1
  82. package/dist/types-CvYh4SPC.d.mts +0 -386
  83. package/dist/types-CvYh4SPC.d.mts.map +0 -1
  84. package/dist/wire-D3K-a-UP.d.mts +0 -37
  85. package/dist/wire-D3K-a-UP.d.mts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { a as ApiError, i as markServerRetryGuidance, n as RateLimitError, r as hasServerRetryGuidance, s as OpenCloudError, t as NetworkError } from "./network-error-DR9FX5hb.mjs";
1
+ import { a as ApiError, i as markServerRetryGuidance, n as RateLimitError, r as hasServerRetryGuidance, s as OpenCloudError, t as NetworkError } from "./network-error-iVSng5MT.mjs";
2
2
  //#region src/internal/utils/try-catch.ts
3
3
  /**
4
4
  * Wraps a promise into a {@link Result}, catching rejections.
@@ -24,14 +24,14 @@ async function tryCatchAsync(promise) {
24
24
  //#region src/internal/http/diagnostics.ts
25
25
  const MAX_DETAIL_LENGTH = 500;
26
26
  const CONTENT_TYPE_HEADER$1 = "content-type";
27
- const DIAGNOSTIC_HEADER_ALLOWLIST = new Set([
27
+ const DIAGNOSTIC_HEADER_ALLOWLIST = /* @__PURE__ */ new Set([
28
28
  "cf-ray",
29
29
  "server",
30
30
  "via",
31
31
  "x-request-id"
32
32
  ]);
33
33
  const DIAGNOSTIC_HEADER_PREFIX = "x-roblox-";
34
- const RATE_LIMIT_HEADER_ALLOWLIST = new Set([
34
+ const RATE_LIMIT_HEADER_ALLOWLIST = /* @__PURE__ */ new Set([
35
35
  "date",
36
36
  "retry-after",
37
37
  "x-envoy-ratelimited",
@@ -128,7 +128,8 @@ function bodyDetail(text, parsed) {
128
128
  * @returns An ApiError carrying the diagnostic context.
129
129
  */
130
130
  function parseFailureError({ cause, context, response, text }) {
131
- return new ApiError(`Failed to parse response body (content-type: ${response.headers.get(CONTENT_TYPE_HEADER$1) ?? "unknown"}, ${String(text.length)} chars read)`, {
131
+ const contentType = response.headers.get(CONTENT_TYPE_HEADER$1) ?? "unknown";
132
+ return new ApiError(`Failed to parse response body (content-type: ${contentType}, ${String(text.length)} chars read)`, {
132
133
  cause,
133
134
  details: text.slice(0, MAX_DETAIL_LENGTH),
134
135
  elapsedMs: context.elapsedMs,
@@ -330,6 +331,20 @@ function constructHttp1(agent) {
330
331
  }
331
332
  }
332
333
  //#endregion
334
+ //#region src/internal/utils/is-record.ts
335
+ /**
336
+ * Narrows `value` to a plain JSON-style record. Excludes arrays, class
337
+ * instances, primitives, and `null`/`undefined`. Used by resource
338
+ * parsers to gate property access on wire bodies whose shape isn't
339
+ * known at compile time.
340
+ *
341
+ * @param value - The unknown value to narrow.
342
+ * @returns `true` when `value` is a plain `[object Object]`.
343
+ */
344
+ function isRecord(value) {
345
+ return Object.prototype.toString.call(value) === "[object Object]";
346
+ }
347
+ //#endregion
333
348
  //#region src/internal/http/rate-limit-sample.ts
334
349
  const LIMIT_POLICY_PATTERN = /^(\d+);w=(\d+)$/;
335
350
  const NON_NEGATIVE_INTEGER_PATTERN = /^\d+$/;
@@ -551,6 +566,22 @@ function parseHttpDate(value, nowMs) {
551
566
  //#endregion
552
567
  //#region src/internal/http/rate-limit-response.ts
553
568
  /**
569
+ * Classifies which layer refused a 429 from its headers and parsed body.
570
+ * `"service"` needs a non-blank `x-roblox-system-reason` header. `"edge"`
571
+ * needs no such header and a body of only `{ code: 0, message: "" }` entries
572
+ * under `errors`. Anything else, including a body `code` alone, is
573
+ * `"unknown"`.
574
+ *
575
+ * @param headers - The response headers (lowercased keys).
576
+ * @param details - The parsed or safely truncated response body.
577
+ * @returns The refusing layer, or `"unknown"` without positive evidence.
578
+ */
579
+ function classifyRateLimitSource(headers, details) {
580
+ const reason = headers["x-roblox-system-reason"];
581
+ if (isNonBlankString(reason)) return "service";
582
+ return isEdgeBody(details) ? "edge" : "unknown";
583
+ }
584
+ /**
554
585
  * Builds a public rate-limit error from a 429 response and its already-read
555
586
  * body, retaining safe raw evidence alongside the existing parsed guidance.
556
587
  *
@@ -573,14 +604,25 @@ function createRateLimitError(response, details) {
573
604
  remaining,
574
605
  responseHeaders: pickRateLimitHeaders(headers),
575
606
  retryAfterSeconds: guidedRetrySeconds ?? 0,
607
+ source: classifyRateLimitSource(headers, details),
576
608
  statusCode: response.status
577
609
  });
578
610
  return guidedRetrySeconds === void 0 ? error : markServerRetryGuidance(error);
579
611
  }
612
+ function isEdgeBody(body) {
613
+ if (!isRecord(body)) return false;
614
+ const { errors } = body;
615
+ return Array.isArray(errors) && errors.length > 0 && errors.every((entry) => {
616
+ return isRecord(entry) && entry["code"] === 0 && entry["message"] === "";
617
+ });
618
+ }
619
+ function isNonBlankString(value) {
620
+ return typeof value === "string" && value.trim() !== "";
621
+ }
580
622
  function extractRateLimitErrorCode(body) {
581
- if (body === null || typeof body !== "object") return;
582
- const code = Reflect.get(body, "code");
583
- return typeof code === "string" && code.trim() ? code : void 0;
623
+ if (!isRecord(body)) return;
624
+ const { code } = body;
625
+ return isNonBlankString(code) ? code : void 0;
584
626
  }
585
627
  //#endregion
586
628
  //#region src/errors/request-aborted.ts
@@ -707,6 +749,8 @@ function isUploadRequest(request) {
707
749
  //#region src/internal/http/fetch-client.ts
708
750
  const CONTENT_TYPE_HEADER = "content-type";
709
751
  const CONNECTION_HEADER = "connection";
752
+ /** Headers the transport owns for the credential; a request cannot set them. */
753
+ const CREDENTIAL_HEADERS = /* @__PURE__ */ new Set(["authorization", "x-api-key"]);
710
754
  /**
711
755
  * Joins the base URL from config with the relative path from the request.
712
756
  *
@@ -721,11 +765,11 @@ function buildUrl(request, config) {
721
765
  * Constructs the `RequestInit` options for a `fetch` call.
722
766
  *
723
767
  * @param request - The HTTP request to build options for.
724
- * @param config - The request config containing API key and timeout.
768
+ * @param config - The request config containing the credential and timeout.
725
769
  * @returns A `RequestInit` object ready for `fetch`.
726
770
  */
727
771
  function buildFetchOptions(request, config) {
728
- const headers = new Headers({ "x-api-key": config.apiKey });
772
+ const headers = new Headers(credentialHeader(config));
729
773
  const options = {
730
774
  headers,
731
775
  method: request.method
@@ -764,10 +808,26 @@ function createFetchHttpClient(fetchFunc = fetch, { createDispatcher = createHtt
764
808
  } };
765
809
  }
766
810
  /**
811
+ * Picks the credential header for a request: `x-api-key` for an API key,
812
+ * `authorization: Bearer` for an OAuth access token, and none for an
813
+ * unauthenticated request.
814
+ *
815
+ * @param config - The request config holding the credential.
816
+ * @returns The credential header to send, if any.
817
+ */
818
+ function credentialHeader({ credential }) {
819
+ switch (credential.kind) {
820
+ case "apiKey": return { "x-api-key": credential.apiKey };
821
+ case "none": return {};
822
+ case "oauth": return { authorization: `Bearer ${credential.accessToken}` };
823
+ }
824
+ }
825
+ /**
767
826
  * Merges the request's own headers onto the transport's, then applies the
768
- * transport-owned connection directive. `x-api-key` is skipped so a request
769
- * cannot override the configured credential, and the upload directive is set
770
- * last so a request header cannot silently re-enable pooling for an upload.
827
+ * transport-owned connection directive. `x-api-key` and `authorization` are
828
+ * skipped so a request cannot override the configured credential, and the
829
+ * upload directive is set last so a request header cannot silently re-enable
830
+ * pooling for an upload.
771
831
  *
772
832
  * @param headers - The headers being built for the fetch call. Mutated.
773
833
  * @param request - The request whose headers and body shape drive the merge.
@@ -775,7 +835,7 @@ function createFetchHttpClient(fetchFunc = fetch, { createDispatcher = createHtt
775
835
  function applyRequestHeaders(headers, request) {
776
836
  const requestHeaders = request.headers ?? {};
777
837
  for (const [name, value] of Object.entries(requestHeaders)) {
778
- if (name.toLowerCase() === "x-api-key") continue;
838
+ if (CREDENTIAL_HEADERS.has(name.toLowerCase())) continue;
779
839
  headers.set(name, value);
780
840
  }
781
841
  if (isUploadRequest(request)) headers.set(CONNECTION_HEADER, "close");
@@ -828,9 +888,10 @@ function createApiError(args) {
828
888
  });
829
889
  const body = bodyDetail(rawText, args.parsed);
830
890
  const code = extractErrorCode(body);
891
+ const message = extractErrorMessage(body);
831
892
  return new ApiError(formatApiErrorMessage({
832
893
  code,
833
- message: extractErrorMessage(body),
894
+ message,
834
895
  status
835
896
  }), {
836
897
  ...requestContext,
@@ -980,6 +1041,111 @@ function createUploadDispatcherCache(createDispatcher) {
980
1041
  };
981
1042
  }
982
1043
  //#endregion
1044
+ //#region src/errors/credential-error.ts
1045
+ /**
1046
+ * Returned when an OAuth credential's `getAccessToken` throws or rejects.
1047
+ * The provider's error is the `cause`, passed through unchanged. The client
1048
+ * sends no request for that attempt and spends no retry.
1049
+ *
1050
+ * @since 0.4.0
1051
+ *
1052
+ * @example
1053
+ *
1054
+ * ```ts
1055
+ * import { CredentialError } from "@bedrock-rbx/ocale";
1056
+ *
1057
+ * const providerError = new Error("refresh token revoked");
1058
+ * const error = new CredentialError("Credential provider failed", {
1059
+ * cause: providerError,
1060
+ * });
1061
+ *
1062
+ * expect(error).toBeInstanceOf(CredentialError);
1063
+ * expect(error.cause).toBe(providerError);
1064
+ * ```
1065
+ */
1066
+ var CredentialError = class extends OpenCloudError {
1067
+ name = "CredentialError";
1068
+ };
1069
+ //#endregion
1070
+ //#region src/errors/credential-not-supported.ts
1071
+ /**
1072
+ * Returned when an OAuth credential calls an Operation that Roblox accepts
1073
+ * only with an API key (place publish and save, Luau execution and memory
1074
+ * stores). The client returns it before it asks the provider for a token, and
1075
+ * it sends no request.
1076
+ *
1077
+ * @since 0.4.0
1078
+ *
1079
+ * @example
1080
+ *
1081
+ * ```ts
1082
+ * import { CredentialNotSupportedError } from "@bedrock-rbx/ocale";
1083
+ *
1084
+ * const error = new CredentialNotSupportedError("Operation needs an API key", {
1085
+ * operationKey: "places.publishVersion",
1086
+ * });
1087
+ *
1088
+ * expect(error).toBeInstanceOf(CredentialNotSupportedError);
1089
+ * expect(error.operationKey).toBe("places.publishVersion");
1090
+ * ```
1091
+ */
1092
+ var CredentialNotSupportedError = class extends OpenCloudError {
1093
+ name = "CredentialNotSupportedError";
1094
+ operationKey;
1095
+ /**
1096
+ * Creates a new CredentialNotSupportedError.
1097
+ *
1098
+ * @param message - Human-readable description of the failure.
1099
+ * @param options - Error options including the Operation's key.
1100
+ */
1101
+ constructor(message, options) {
1102
+ super(message, options);
1103
+ this.operationKey = options.operationKey;
1104
+ }
1105
+ };
1106
+ //#endregion
1107
+ //#region src/errors/credential-rejected.ts
1108
+ /**
1109
+ * Returned when Roblox refuses an OAuth Credential's token: a non-gateway
1110
+ * 401, or a non-gateway 502 whose body message is "Scope authorization
1111
+ * failed.". The grant is lost, so the client does not retry. Carries the
1112
+ * Credential `identity` (never the token) so the caller can ask that user to
1113
+ * consent again. The upstream `ApiError` is the `cause`.
1114
+ *
1115
+ * @since 0.4.0
1116
+ *
1117
+ * @example
1118
+ *
1119
+ * ```ts
1120
+ * import { CredentialRejectedError } from "@bedrock-rbx/ocale";
1121
+ *
1122
+ * const error = new CredentialRejectedError("HTTP 401: Invalid Token.", {
1123
+ * identity: "user-123",
1124
+ * statusCode: 401,
1125
+ * });
1126
+ *
1127
+ * expect(error.identity).toBe("user-123");
1128
+ * expect(error.statusCode).toBe(401);
1129
+ * ```
1130
+ */
1131
+ var CredentialRejectedError = class extends OpenCloudError {
1132
+ identity;
1133
+ name = "CredentialRejectedError";
1134
+ statusCode;
1135
+ /**
1136
+ * Creates a new CredentialRejectedError.
1137
+ *
1138
+ * @param message - Human-readable error description.
1139
+ * @param options - Error options including the Credential identity and
1140
+ * the HTTP status of the refusal.
1141
+ */
1142
+ constructor(message, options) {
1143
+ super(message, options);
1144
+ this.identity = options.identity;
1145
+ this.statusCode = options.statusCode;
1146
+ }
1147
+ };
1148
+ //#endregion
983
1149
  //#region src/errors/permission-error.ts
984
1150
  /**
985
1151
  * Thrown when the Roblox Open Cloud API returns a 401 or 403 for an operation
@@ -1177,6 +1343,89 @@ var RetryDelayExceededError = class extends RequestDeadlineExceededError {
1177
1343
  }
1178
1344
  };
1179
1345
  //#endregion
1346
+ //#region src/errors/unexpected-response.ts
1347
+ const NEW_ISSUE_URL = "https://github.com/christopher-buss/bedrock/issues/new";
1348
+ /**
1349
+ * Returned when Open Cloud accepts a request and answers, but the response
1350
+ * body has a shape that ocale's wire model rejects. The API did not refuse the
1351
+ * request, so this is not an `ApiError`: the fault is more likely a stale wire
1352
+ * model or a parser bug in ocale than a problem with the caller's input. The
1353
+ * raw body is kept on `details`, with the request context, so the mismatch can
1354
+ * be reported. `reportUrl` opens an ocale bug report prefilled with the
1355
+ * message, status, and failing call. It leaves out the body, which can hold
1356
+ * private data.
1357
+ *
1358
+ * @since 0.4.0
1359
+ *
1360
+ * @example
1361
+ *
1362
+ * ```ts
1363
+ * import { ApiError, UnexpectedResponseError } from "@bedrock-rbx/ocale";
1364
+ *
1365
+ * const error = new UnexpectedResponseError("Malformed badge response", {
1366
+ * details: { id: "not-a-number" },
1367
+ * method: "GET",
1368
+ * statusCode: 200,
1369
+ * url: "https://apis.roblox.com/legacy-badges/v1/badges/1",
1370
+ * });
1371
+ *
1372
+ * // A shape mismatch is not an API rejection.
1373
+ * expect(error).not.toBeInstanceOf(ApiError);
1374
+ * expect(error.details).toStrictEqual({ id: "not-a-number" });
1375
+ * ```
1376
+ */
1377
+ var UnexpectedResponseError = class extends OpenCloudError {
1378
+ details;
1379
+ method;
1380
+ name = "UnexpectedResponseError";
1381
+ /** Link to a new ocale bug report, prefilled with this failure. */
1382
+ reportUrl;
1383
+ responseHeaders;
1384
+ statusCode;
1385
+ url;
1386
+ /**
1387
+ * Creates a new UnexpectedResponseError.
1388
+ *
1389
+ * @param message - Human-readable description naming the response that
1390
+ * did not match.
1391
+ * @param options - The status code, the raw body as `details`, and the
1392
+ * request context when known.
1393
+ */
1394
+ constructor(message, options) {
1395
+ const reportUrl = buildReportUrl(message, options);
1396
+ super(options.reportHint === true ? `${message}\n${reportLine(reportUrl)}` : message, options);
1397
+ this.details = options.details;
1398
+ this.method = options.method;
1399
+ this.responseHeaders = options.responseHeaders;
1400
+ this.statusCode = options.statusCode;
1401
+ this.url = options.url;
1402
+ this.reportUrl = reportUrl;
1403
+ }
1404
+ };
1405
+ function reportLine(reportUrl) {
1406
+ return `This is likely a bug in @bedrock-rbx/ocale. Report it at ${reportUrl}`;
1407
+ }
1408
+ function reportBody(message, { method, responseHeaders, statusCode, url }) {
1409
+ const request = method !== void 0 && url !== void 0 ? [`- Request: ${method} ${url}`] : [];
1410
+ const headers = Object.entries(responseHeaders ?? {}).map(([name, value]) => `- ${name}: ${value}`);
1411
+ return [
1412
+ "`UnexpectedResponseError` from `@bedrock-rbx/ocale`.",
1413
+ "",
1414
+ `- Message: ${message}`,
1415
+ `- Status: ${String(statusCode)}`,
1416
+ ...request,
1417
+ ...headers
1418
+ ].join("\n");
1419
+ }
1420
+ function buildReportUrl(message, options) {
1421
+ const query = new URLSearchParams({
1422
+ body: reportBody(message, options),
1423
+ template: "bug-report.md",
1424
+ title: `[Bug]: ${message}`
1425
+ });
1426
+ return `${NEW_ISSUE_URL}?${query.toString()}`;
1427
+ }
1428
+ //#endregion
1180
1429
  //#region src/internal/utils/find-error-code.ts
1181
1430
  /**
1182
1431
  * Maximum cause-chain depth walked by {@link findErrorCode}. Caps pathological
@@ -1442,6 +1691,17 @@ function hasGuidedWait(error) {
1442
1691
  return error instanceof RateLimitError && error.retryAfterSeconds > 0;
1443
1692
  }
1444
1693
  /**
1694
+ * Whether a failure is a rate limit whose guided wait is longer than the
1695
+ * {@link MAX_GUIDED_WAIT_SECONDS} the SDK waits out on its own, so the SDK
1696
+ * refuses it.
1697
+ *
1698
+ * @param error - The error returned by the failing request.
1699
+ * @returns `true` for a rate limit naming a wait the SDK refuses.
1700
+ */
1701
+ function isRefusedGuidedWait(error) {
1702
+ return hasGuidedWait(error) && error.retryAfterSeconds > 60;
1703
+ }
1704
+ /**
1445
1705
  * Decides whether a failed request is eligible for retry. {@link
1446
1706
  * RateLimitError} (checked against 429) and {@link ApiError} (checked against
1447
1707
  * its `statusCode`) are retryable when their status is in `retryableStatuses`.
@@ -1527,8 +1787,8 @@ function shouldRetry(error, config) {
1527
1787
  * } from "./retry";
1528
1788
  *
1529
1789
  * const clientConfig: RetryResolvable = {
1530
- * apiKey: "k",
1531
1790
  * baseUrl: "https://apis.roblox.com",
1791
+ * credential: { apiKey: "k", kind: "apiKey" },
1532
1792
  * maxRetries: 3,
1533
1793
  * retryableStatuses: [429, 500],
1534
1794
  * retryableTransportCodes: [],
@@ -1555,8 +1815,8 @@ function shouldRetry(error, config) {
1555
1815
  * } from "./retry";
1556
1816
  *
1557
1817
  * const clientConfig: RetryResolvable = {
1558
- * apiKey: "k",
1559
1818
  * baseUrl: "https://apis.roblox.com",
1819
+ * credential: { apiKey: "k", kind: "apiKey" },
1560
1820
  * maxRetries: 3,
1561
1821
  * retryableStatuses: [429],
1562
1822
  * retryableTransportCodes: [],
@@ -1594,6 +1854,6 @@ function mergeConfig(clientConfig, { methodDefaults, methodKind, requestOptions
1594
1854
  }
1595
1855
  }
1596
1856
  //#endregion
1597
- export { parseRateLimitHeaders as C, RequestAbortedError as S, createFetchHttpClient as _, TRANSIENT_TRANSPORT_CODES as a, raceWithAbortAsync as b, defaultRetryDelay as c, shouldRetry as d, findErrorCode as f, PermissionError as g, RateLimitWaitRefusedError as h, RESPONSE_UNPARSEABLE as i, hasGuidedWait as l, RequestDeadlineExceededError as m, GATEWAY_REJECTED as n, UPLOAD_METHOD_DEFAULTS as o, RetryDelayExceededError as p, IDEMPOTENT_METHOD_DEFAULTS as r, computeRetryWaitMs as s, CREATE_METHOD_DEFAULTS as t, mergeConfig as u, isUploadRequest as v, withReportedWindow as w, requestAbortedError as x, ABORTED as y };
1857
+ export { withReportedWindow as A, isUploadRequest as C, RequestAbortedError as D, requestAbortedError as E, extractErrorMessage as M, pickDiagnosticHeaders as N, parseQuotaResetSeconds as O, createFetchHttpClient as S, raceWithAbortAsync as T, RateLimitWaitRefusedError as _, TRANSIENT_TRANSPORT_CODES as a, CredentialNotSupportedError as b, defaultRetryDelay as c, mergeConfig as d, shouldRetry as f, RequestDeadlineExceededError as g, RetryDelayExceededError as h, RESPONSE_UNPARSEABLE as i, isRecord as j, parseRateLimitHeaders as k, hasGuidedWait as l, UnexpectedResponseError as m, GATEWAY_REJECTED as n, UPLOAD_METHOD_DEFAULTS as o, findErrorCode as p, IDEMPOTENT_METHOD_DEFAULTS as r, computeRetryWaitMs as s, CREATE_METHOD_DEFAULTS as t, isRefusedGuidedWait as u, PermissionError as v, ABORTED as w, CredentialError as x, CredentialRejectedError as y };
1598
1858
 
1599
- //# sourceMappingURL=retry-BlX4tUnT.mjs.map
1859
+ //# sourceMappingURL=retry-CMRDvAR4.mjs.map