@bedrock-rbx/ocale 0.1.0-beta.2 → 0.1.0-beta.3

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 (49) hide show
  1. package/dist/badges.d.mts +2 -2
  2. package/dist/badges.mjs +3 -3
  3. package/dist/{data.generated-BtkDGH8C.d.mts → data.generated-DOaDx6J0.d.mts} +1 -1
  4. package/dist/{data.generated-BtkDGH8C.d.mts.map → data.generated-DOaDx6J0.d.mts.map} +1 -1
  5. package/dist/developer-products.d.mts +2 -2
  6. package/dist/developer-products.mjs +4 -4
  7. package/dist/game-passes.d.mts +2 -2
  8. package/dist/game-passes.mjs +4 -4
  9. package/dist/index.d.mts +92 -3
  10. package/dist/index.d.mts.map +1 -1
  11. package/dist/index.mjs +3 -2
  12. package/dist/{is-date-time-string-Cuf1TaSC.mjs → is-date-time-string-Ds8Ew-Xa.mjs} +1 -1
  13. package/dist/{is-date-time-string-Cuf1TaSC.mjs.map → is-date-time-string-Ds8Ew-Xa.mjs.map} +1 -1
  14. package/dist/locales.d.mts +1 -1
  15. package/dist/luau-execution.d.mts +93 -6
  16. package/dist/luau-execution.d.mts.map +1 -1
  17. package/dist/luau-execution.mjs +115 -3
  18. package/dist/luau-execution.mjs.map +1 -1
  19. package/dist/places.d.mts +46 -6
  20. package/dist/places.d.mts.map +1 -1
  21. package/dist/places.mjs +23 -4
  22. package/dist/places.mjs.map +1 -1
  23. package/dist/poll-timeout-BdUcWv52.mjs +79 -0
  24. package/dist/poll-timeout-BdUcWv52.mjs.map +1 -0
  25. package/dist/{types-BZ0959rh.d.mts → polling-Cc50rgl6.d.mts} +106 -2
  26. package/dist/polling-Cc50rgl6.d.mts.map +1 -0
  27. package/dist/polling-helpers-BVkmr6C7.mjs +636 -0
  28. package/dist/polling-helpers-BVkmr6C7.mjs.map +1 -0
  29. package/dist/{price-information-s7DY0GV2.mjs → price-information-DFf89abd.mjs} +2 -2
  30. package/dist/{price-information-s7DY0GV2.mjs.map → price-information-DFf89abd.mjs.map} +1 -1
  31. package/dist/{rate-limit-DzHBFwps.d.mts → rate-limit-BSbFNSGT.d.mts} +2 -2
  32. package/dist/{rate-limit-DzHBFwps.d.mts.map → rate-limit-BSbFNSGT.d.mts.map} +1 -1
  33. package/dist/{resource-client-Wi4Mwqy5.mjs → resource-client-opC6BUkL.mjs} +10 -2
  34. package/dist/{resource-client-Wi4Mwqy5.mjs.map → resource-client-opC6BUkL.mjs.map} +1 -1
  35. package/dist/storage.d.mts +7 -1
  36. package/dist/storage.d.mts.map +1 -1
  37. package/dist/storage.mjs +2 -2
  38. package/dist/{to-blob-1BtHsDGK.mjs → to-blob-DHN7UoM8.mjs} +1 -1
  39. package/dist/{to-blob-1BtHsDGK.mjs.map → to-blob-DHN7UoM8.mjs.map} +1 -1
  40. package/dist/{types-Cp8w8uwA.d.mts → types-DUzm6maA.d.mts} +1 -1
  41. package/dist/{types-Cp8w8uwA.d.mts.map → types-DUzm6maA.d.mts.map} +1 -1
  42. package/dist/universes.d.mts +2 -2
  43. package/dist/universes.mjs +4 -4
  44. package/dist/{validation-b7KAoEio.mjs → validation-VImVHzxg.mjs} +1 -1
  45. package/dist/{validation-b7KAoEio.mjs.map → validation-VImVHzxg.mjs.map} +1 -1
  46. package/package.json +1 -1
  47. package/dist/specs-Co6qYp_E.mjs +0 -309
  48. package/dist/specs-Co6qYp_E.mjs.map +0 -1
  49. package/dist/types-BZ0959rh.d.mts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polling-helpers-BVkmr6C7.mjs","names":["SECONDS_PER_MINUTE","malformed","makeSpec"],"sources":["../src/domains/cloud-v2/luau-execution-task-logs/builders.ts","../src/domains/cloud-v2/luau-execution-task-logs/operations.ts","../src/domains/cloud-v2/luau-execution-task-logs/parsers.ts","../src/domains/cloud-v2/luau-execution-task-logs/specs.ts","../src/domains/cloud-v2/luau-execution-tasks/builders.ts","../src/domains/cloud-v2/luau-execution-tasks/operations.ts","../src/domains/cloud-v2/luau-execution-tasks/parsers.ts","../src/domains/cloud-v2/luau-execution-tasks/specs.ts","../src/resources/luau-execution/polling.ts","../src/resources/luau-execution/polling-helpers.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { ListLogsParameters } from \"./types.ts\";\n\n/**\n * Builds a `GET` request for the Open Cloud \"list Luau execution session\n * task logs\" endpoint. The endpoint requires the maximal x-aep-resource\n * path shape (universe, place, version, session, task), so the supplied\n * ref must include `versionId` and `sessionId`; refs extracted from the\n * narrower path formats are rejected with a {@link ValidationError}.\n *\n * The `view` query parameter is hard-coded to `STRUCTURED` so callers\n * always receive typed structured messages. No public `view` parameter\n * is exposed.\n *\n * @param parameters - Task ref, and optional `pageSize` and `pageToken`\n * pagination controls.\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when the ref is missing `versionId` or\n * `sessionId`.\n */\nexport function buildListLogsRequest(\n\tparameters: ListLogsParameters,\n): Result<HttpRequest, ValidationError> {\n\tconst { pageSize, pageToken, ref } = parameters;\n\tconst { placeId, sessionId, taskId, universeId, versionId } = ref;\n\n\tif (versionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing versionId; cannot list logs\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tif (sessionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing sessionId; cannot list logs\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst base = `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-sessions/${sessionId}/tasks/${taskId}/logs`;\n\tconst url = `${base}?${buildQuery(pageSize, pageToken).toString()}`;\n\treturn { data: { method: \"GET\", url }, success: true };\n}\n\nfunction buildQuery(pageSize: number | undefined, pageToken: string | undefined): URLSearchParams {\n\tconst query = new URLSearchParams({ view: \"STRUCTURED\" });\n\n\tif (pageSize !== undefined) {\n\t\tquery.append(\"maxPageSize\", String(pageSize));\n\t}\n\n\tif (pageToken !== undefined) {\n\t\tquery.append(\"pageToken\", pageToken);\n\t}\n\n\treturn query;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst LIST_LOGS_PER_MINUTE = 45;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for listing Luau execution task logs,\n * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_ListLuauExecutionSessionTaskLogs` operation (45 requests per\n * minute per API key owner).\n */\nexport const LIST_LOGS_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: LIST_LOGS_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-task-logs.list\",\n});\n\n/**\n * Scopes required to list Luau execution task logs, sourced from\n * `x-roblox-scopes` on the list-logs operation in the vendored OpenAPI\n * schema. Surfaced via the `requiredScopes` field of the per-method\n * spec so a 401 or 403 ApiError is upgraded to a `PermissionError`\n * naming the missing scope. Only `:read` is required as the\n * minimum-privilege scope for this read-only operation.\n */\nexport const LIST_LOGS_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:read\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { LogMessage, LogPage } from \"./types.ts\";\nimport type { ListLogsResponseWire, LogChunkWire, LogMessageWire } from \"./wire.ts\";\n\nconst MALFORMED_LOGS_MESSAGE = \"Malformed list-luau-execution-task-logs response\";\n\n/**\n * Parses a successful Open Cloud list-luau-execution-task-logs response\n * body into the public {@link LogPage} shape. Chunks are flattened into\n * a single ordered array of {@link LogMessage} values. The\n * `MESSAGE_TYPE_UNSPECIFIED` sentinel is rejected.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link LogPage}, or an\n * {@link ApiError} when the body does not match a supported shape.\n */\nexport function parseListLogsResponse(response: HttpResponse): Result<LogPage, ApiError> {\n\tconst { body, status: statusCode } = response;\n\tif (!isListLogsResponseWire(body)) {\n\t\treturn malformed(statusCode);\n\t}\n\n\tconst chunks = body.luauExecutionSessionTaskLogs ?? [];\n\tconst messages: Array<LogMessage> = [];\n\n\tfor (const chunk of chunks) {\n\t\tfor (const wireMessage of chunk.structuredMessages ?? []) {\n\t\t\tmessages.push({\n\t\t\t\tcreateTime: wireMessage.createTime,\n\t\t\t\tmessage: wireMessage.message,\n\t\t\t\tmessageType: wireMessage.messageType,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn {\n\t\tdata: { messages, nextPageToken: body.nextPageToken },\n\t\tsuccess: true,\n\t};\n}\n\nfunction isAcceptedMessageType(value: unknown): value is LogMessageWire[\"messageType\"] {\n\treturn value === \"OUTPUT\" || value === \"INFO\" || value === \"WARNING\" || value === \"ERROR\";\n}\n\nfunction isLogMessageWire(value: unknown): value is LogMessageWire {\n\treturn (\n\t\tisRecord(value) &&\n\t\ttypeof value[\"createTime\"] === \"string\" &&\n\t\ttypeof value[\"message\"] === \"string\" &&\n\t\tisAcceptedMessageType(value[\"messageType\"])\n\t);\n}\n\nfunction isOptionalStructuredMessages(\n\tvalue: unknown,\n): value is ReadonlyArray<LogMessageWire> | undefined {\n\treturn (\n\t\tvalue === undefined ||\n\t\t(Array.isArray(value) && value.every((item: unknown) => isLogMessageWire(item)))\n\t);\n}\n\nfunction isLogChunkWire(value: unknown): value is LogChunkWire {\n\treturn isRecord(value) && isOptionalStructuredMessages(value[\"structuredMessages\"]);\n}\n\nfunction isOptionalLogChunks(value: unknown): value is ReadonlyArray<LogChunkWire> | undefined {\n\treturn (\n\t\tvalue === undefined ||\n\t\t(Array.isArray(value) && value.every((item: unknown) => isLogChunkWire(item)))\n\t);\n}\n\nfunction isListLogsResponseWire(body: unknown): body is ListLogsResponseWire {\n\treturn (\n\t\tisRecord(body) &&\n\t\tisOptionalLogChunks(body[\"luauExecutionSessionTaskLogs\"]) &&\n\t\t(body[\"nextPageToken\"] === undefined || typeof body[\"nextPageToken\"] === \"string\")\n\t);\n}\n\nfunction malformed(statusCode: number): Result<LogPage, ApiError> {\n\treturn { err: new ApiError(MALFORMED_LOGS_MESSAGE, { statusCode }), success: false };\n}\n","import { IDEMPOTENT_METHOD_DEFAULTS } from \"../../../internal/http/retry.ts\";\nimport type { ResourceMethodSpec } from \"../../../internal/resource-client.ts\";\nimport { buildListLogsRequest } from \"./builders.ts\";\nimport { LIST_LOGS_OPERATION_LIMIT, LIST_LOGS_REQUIRED_SCOPES } from \"./operations.ts\";\nimport { parseListLogsResponse } from \"./parsers.ts\";\nimport type { ListLogsParameters, LogPage } from \"./types.ts\";\n\nfunction makeSpec<P>(spec: ResourceMethodSpec<P, LogPage>): ResourceMethodSpec<P, LogPage> {\n\treturn Object.freeze(spec);\n}\n\n/**\n * Per-method dispatch spec for listing the structured log messages\n * produced by a Luau execution task. Frozen at module scope so both\n * the top-level `LuauExecutionClient` and the `luauExecution` Operation\n * Group on `PlacesClient` share the same instance reference.\n */\nexport const LIST_LOGS_SPEC = makeSpec<ListLogsParameters>({\n\tbuildRequest: buildListLogsRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: LIST_LOGS_OPERATION_LIMIT,\n\tparse: parseListLogsResponse,\n\trequiredScopes: LIST_LOGS_REQUIRED_SCOPES,\n});\n","import type { HttpRequest } from \"../../../client/types.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { GetParameters, SubmitAtHeadParameters, SubmitAtVersionParameters } from \"./types.ts\";\n\ninterface SubmitBodyInput {\n\treadonly binaryInput?: string | undefined;\n\treadonly enableBinaryOutput?: boolean | undefined;\n\treadonly script: string;\n\treadonly timeoutSeconds?: number;\n}\n\nconst JSON_HEADERS: Readonly<Record<string, string>> = { \"content-type\": \"application/json\" };\n\n/**\n * Builds a `POST` request for the Open Cloud \"create Luau execution\n * session task\" endpoint, targeting the place's head version. Serializes\n * `timeoutSeconds` into the wire's duration string format (`\"<n>s\"`)\n * when supplied.\n *\n * @param parameters - Universe and place identifiers, the script body,\n * and an optional `timeoutSeconds`.\n * @returns A pure {@link HttpRequest} describing the submit call.\n */\nexport function buildSubmitAtHeadRequest(parameters: SubmitAtHeadParameters): HttpRequest {\n\tconst { placeId, universeId } = parameters;\n\treturn {\n\t\tbody: buildSubmitBody(parameters),\n\t\theaders: JSON_HEADERS,\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}/luau-execution-session-tasks`,\n\t};\n}\n\n/**\n * Builds a `POST` request for the Open Cloud \"create Luau execution\n * session task\" endpoint, targeting a specific place version. Differs\n * from {@link buildSubmitAtHeadRequest} only in URL shape: the path\n * includes the `versions/{versionId}` segment so the script runs\n * against that exact place version instead of the live head.\n *\n * @param parameters - Universe, place, and version identifiers, the\n * script body, and an optional `timeoutSeconds`.\n * @returns A pure {@link HttpRequest} describing the submit call.\n */\nexport function buildSubmitAtVersionRequest(parameters: SubmitAtVersionParameters): HttpRequest {\n\tconst { placeId, universeId, versionId } = parameters;\n\treturn {\n\t\tbody: buildSubmitBody(parameters),\n\t\theaders: JSON_HEADERS,\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-session-tasks`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the Open Cloud \"read Luau execution session\n * task\" endpoint. The endpoint accepts only the maximal x-aep-resource\n * path shape (universe, place, version, session, task), so the supplied\n * ref must include `versionId` and `sessionId`; refs extracted from the\n * narrower path formats are rejected with a {@link ValidationError}.\n *\n * @param parameters - Task ref and optional view selector. When `view`\n * is omitted, no `?view=` query is sent and the server applies its\n * own default (`BASIC`).\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when the ref is missing `versionId` or\n * `sessionId`.\n */\nexport function buildGetRequest(parameters: GetParameters): Result<HttpRequest, ValidationError> {\n\tconst { ref, view } = parameters;\n\tconst { placeId, sessionId, taskId, universeId, versionId } = ref;\n\n\tif (versionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing versionId; cannot GET\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tif (sessionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing sessionId; cannot GET\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst base = `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-sessions/${sessionId}/tasks/${taskId}`;\n\tconst url = view === undefined ? base : `${base}?view=${view}`;\n\treturn { data: { method: \"GET\", url }, success: true };\n}\n\nfunction buildSubmitBody(parameters: SubmitBodyInput): Record<string, unknown> {\n\tconst {\n\t\tbinaryInput,\n\t\tenableBinaryOutput: shouldEnableBinaryOutput,\n\t\tscript,\n\t\ttimeoutSeconds,\n\t} = parameters;\n\tconst body: Record<string, unknown> = { script };\n\tif (timeoutSeconds !== undefined) {\n\t\tbody[\"timeout\"] = `${timeoutSeconds}s`;\n\t}\n\n\tif (binaryInput !== undefined) {\n\t\tbody[\"binaryInput\"] = binaryInput;\n\t}\n\n\tif (shouldEnableBinaryOutput !== undefined) {\n\t\tbody[\"enableBinaryOutput\"] = shouldEnableBinaryOutput;\n\t}\n\n\treturn body;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst SUBMIT_PER_MINUTE = 40;\nconst GET_PER_MINUTE = 200;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for submitting a Luau execution task,\n * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_CreateLuauExecutionSessionTask__Using_Universes` operation\n * (40 requests per minute per API key owner). The two URL shapes\n * (head and version) share this queue because Roblox attributes both\n * to the same per-minute quota.\n */\nexport const SUBMIT_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: SUBMIT_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.submit\",\n});\n\n/**\n * Per-second request ceiling for fetching a Luau execution task,\n * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_GetLuauExecutionSessionTask` operation (200 requests per\n * minute per API key owner).\n */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: GET_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.get\",\n});\n\n/**\n * Scopes required to submit a Luau execution task, sourced from\n * `x-roblox-scopes` on the create operation in the vendored OpenAPI\n * schema. Surfaced via the `requiredScopes` field of the per-method\n * spec so a 401 or 403 ApiError is upgraded to a `PermissionError`\n * naming the missing scope.\n */\nexport const SUBMIT_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:write\",\n]);\n\n/**\n * Scopes required to fetch a Luau execution task, sourced from\n * `x-roblox-scopes` on the get operation. The `:write` scope also\n * grants read in upstream auth, but we surface only `:read` here as\n * the minimum-privilege requirement for this method.\n */\nexport const GET_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:read\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { LuauExecutionTask, LuauExecutionTaskRef } from \"./types.ts\";\nimport type {\n\tLuauExecutionTaskErrorWire,\n\tLuauExecutionTaskOutputWire,\n\tLuauExecutionTaskWire,\n} from \"./wire.ts\";\n\nconst MALFORMED_TASK_MESSAGE = \"Malformed luau-execution-session-task response\";\n\n// Matches any of the four x-aep-resource path formats for a luau\n// execution session task.\n//\n// Capture groups:\n// 1. universeId\n// 2. placeId\n// 3. versionId (when `/versions/{v}/` segment is present, else undefined)\n// 4. sessionId (when `/luau-execution-sessions/{s}/tasks/...` branch matched)\n// 5. taskId (when `/luau-execution-sessions/.../tasks/{t}` branch matched)\n// 6. taskId (when `/luau-execution-session-tasks/{t}` branch matched)\nconst PATH_PATTERN =\n\t/^universes\\/(\\d+)\\/places\\/(\\d+)(?:\\/versions\\/(\\d+))?(?:\\/luau-execution-sessions\\/([^/]+)\\/tasks\\/([^/]+)|\\/luau-execution-session-tasks\\/([^/]+))$/;\n\ntype InProgressWireState = Exclude<LuauExecutionTaskWire[\"state\"], \"COMPLETE\" | \"FAILED\">;\n\ninterface ParseVariantArgs {\n\treadonly body: LuauExecutionTaskWire;\n\treadonly ref: LuauExecutionTaskRef;\n\treadonly statusCode: number;\n\treadonly timeoutSeconds: number | undefined;\n}\n\n/**\n * Parses a successful Open Cloud `LuauExecutionSessionTask` response\n * body into the public {@link LuauExecutionTask} discriminated union.\n * Handles every supported task state (in-progress, COMPLETE, FAILED)\n * across all four x-aep-resource path shapes the server returns.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud\n * API.\n * @returns A success result wrapping the parsed task, or an\n * {@link ApiError} when the body or path do not match a supported\n * shape.\n */\nexport function parseLuauExecutionTaskResponse(\n\tresponse: HttpResponse,\n): Result<LuauExecutionTask, ApiError> {\n\tconst { body, status: statusCode } = response;\n\tif (!isLuauExecutionTaskWire(body)) {\n\t\treturn malformed(statusCode);\n\t}\n\n\tconst ref = parseTaskRef(body.path);\n\tif (ref === undefined) {\n\t\treturn malformed(statusCode);\n\t}\n\n\tconst timeoutSeconds = parseTimeoutSeconds(body.timeout);\n\n\tif (body.state === \"COMPLETE\") {\n\t\treturn parseCompleteTask({ body, ref, statusCode, timeoutSeconds });\n\t}\n\n\tif (body.state === \"FAILED\") {\n\t\treturn parseFailedTask({ body, ref, statusCode, timeoutSeconds });\n\t}\n\n\treturn parseInProgressTask({ body, ref, state: body.state, statusCode, timeoutSeconds });\n}\n\nfunction isAcceptedWireState(\n\tstate: unknown,\n): state is \"CANCELLED\" | \"COMPLETE\" | \"FAILED\" | \"PROCESSING\" | \"QUEUED\" {\n\treturn (\n\t\tstate === \"QUEUED\" ||\n\t\tstate === \"PROCESSING\" ||\n\t\tstate === \"CANCELLED\" ||\n\t\tstate === \"COMPLETE\" ||\n\t\tstate === \"FAILED\"\n\t);\n}\n\nfunction isErrorWireCode(code: unknown): code is LuauExecutionTaskErrorWire[\"code\"] {\n\treturn (\n\t\tcode === \"SCRIPT_ERROR\" ||\n\t\tcode === \"DEADLINE_EXCEEDED\" ||\n\t\tcode === \"OUTPUT_SIZE_LIMIT_EXCEEDED\" ||\n\t\tcode === \"INTERNAL_ERROR\"\n\t);\n}\n\nfunction isErrorWire(value: unknown): value is LuauExecutionTaskErrorWire {\n\treturn (\n\t\tisRecord(value) && isErrorWireCode(value[\"code\"]) && typeof value[\"message\"] === \"string\"\n\t);\n}\n\nfunction isOptionalErrorWire(value: unknown): value is LuauExecutionTaskErrorWire | undefined {\n\treturn value === undefined || isErrorWire(value);\n}\n\nfunction isOutputWire(value: unknown): value is LuauExecutionTaskOutputWire {\n\treturn isRecord(value) && Array.isArray(value[\"results\"]);\n}\n\nfunction isOptionalOutputWire(value: unknown): value is LuauExecutionTaskOutputWire | undefined {\n\treturn value === undefined || isOutputWire(value);\n}\n\nfunction isOptionalString(value: unknown): value is string | undefined {\n\treturn value === undefined || typeof value === \"string\";\n}\n\nfunction isOptionalBoolean(value: unknown): value is boolean | undefined {\n\treturn value === undefined || typeof value === \"boolean\";\n}\n\nfunction isLuauExecutionTaskWire(body: unknown): body is LuauExecutionTaskWire {\n\treturn (\n\t\tisRecord(body) &&\n\t\ttypeof body[\"path\"] === \"string\" &&\n\t\ttypeof body[\"createTime\"] === \"string\" &&\n\t\ttypeof body[\"updateTime\"] === \"string\" &&\n\t\tisAcceptedWireState(body[\"state\"]) &&\n\t\ttypeof body[\"user\"] === \"string\" &&\n\t\tisOptionalOutputWire(body[\"output\"]) &&\n\t\tisOptionalErrorWire(body[\"error\"]) &&\n\t\tisOptionalDurationWire(body[\"timeout\"]) &&\n\t\tisOptionalString(body[\"binaryInput\"]) &&\n\t\tisOptionalBoolean(body[\"enableBinaryOutput\"]) &&\n\t\tisOptionalString(body[\"binaryOutputUri\"])\n\t);\n}\n\nconst DURATION_PATTERN = /^(\\d+)s$/;\n\nfunction isOptionalDurationWire(value: unknown): value is string | undefined {\n\treturn value === undefined || (typeof value === \"string\" && DURATION_PATTERN.test(value));\n}\n\nfunction parseTimeoutSeconds(value: string | undefined): number | undefined {\n\tif (value === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst match = DURATION_PATTERN.exec(value);\n\tconst seconds = match?.[1];\n\tif (seconds === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn Number.parseInt(seconds, 10);\n}\n\nfunction malformed(statusCode: number): Result<LuauExecutionTask, ApiError> {\n\treturn { err: new ApiError(MALFORMED_TASK_MESSAGE, { statusCode }), success: false };\n}\n\nfunction parseInProgressTask(\n\targs: ParseVariantArgs & { readonly state: InProgressWireState },\n): Result<LuauExecutionTask, ApiError> {\n\tconst { body, ref, state, timeoutSeconds } = args;\n\treturn {\n\t\tdata: {\n\t\t\tbinaryInput: body.binaryInput,\n\t\t\tbinaryOutputUri: body.binaryOutputUri,\n\t\t\tcreatedAt: new Date(body.createTime),\n\t\t\tenableBinaryOutput: body.enableBinaryOutput,\n\t\t\tref,\n\t\t\tstate,\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt: new Date(body.updateTime),\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseCompleteTask(args: ParseVariantArgs): Result<LuauExecutionTask, ApiError> {\n\tconst { body, ref, statusCode, timeoutSeconds } = args;\n\tif (body.output === undefined) {\n\t\treturn malformed(statusCode);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbinaryInput: body.binaryInput,\n\t\t\tbinaryOutputUri: body.binaryOutputUri,\n\t\t\tcreatedAt: new Date(body.createTime),\n\t\t\tenableBinaryOutput: body.enableBinaryOutput,\n\t\t\toutput: { results: body.output.results },\n\t\t\tref,\n\t\t\tstate: \"COMPLETE\",\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt: new Date(body.updateTime),\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseFailedTask(args: ParseVariantArgs): Result<LuauExecutionTask, ApiError> {\n\tconst { body, ref, statusCode, timeoutSeconds } = args;\n\tif (body.error === undefined) {\n\t\treturn malformed(statusCode);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbinaryInput: body.binaryInput,\n\t\t\tbinaryOutputUri: body.binaryOutputUri,\n\t\t\tcreatedAt: new Date(body.createTime),\n\t\t\tenableBinaryOutput: body.enableBinaryOutput,\n\t\t\terror: { code: body.error.code, message: body.error.message },\n\t\t\tref,\n\t\t\tstate: \"FAILED\",\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt: new Date(body.updateTime),\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseTaskRef(path: string): LuauExecutionTaskRef | undefined {\n\tconst match = PATH_PATTERN.exec(path);\n\tif (match === null) {\n\t\treturn undefined;\n\t}\n\n\tconst [, universeId, placeId, versionId, sessionId, sessionTaskId, plainTaskId] = match;\n\tconst taskId = sessionTaskId ?? plainTaskId;\n\tif (universeId === undefined || placeId === undefined || taskId === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn { placeId, sessionId, taskId, universeId, versionId };\n}\n","import {\n\tCREATE_METHOD_DEFAULTS,\n\tIDEMPOTENT_METHOD_DEFAULTS,\n} from \"../../../internal/http/retry.ts\";\nimport { okRequest, type ResourceMethodSpec } from \"../../../internal/resource-client.ts\";\nimport {\n\tbuildGetRequest,\n\tbuildSubmitAtHeadRequest,\n\tbuildSubmitAtVersionRequest,\n} from \"./builders.ts\";\nimport {\n\tGET_OPERATION_LIMIT,\n\tGET_REQUIRED_SCOPES,\n\tSUBMIT_OPERATION_LIMIT,\n\tSUBMIT_REQUIRED_SCOPES,\n} from \"./operations.ts\";\nimport { parseLuauExecutionTaskResponse } from \"./parsers.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"./types.ts\";\n\nfunction makeSpec<P>(\n\tspec: ResourceMethodSpec<P, LuauExecutionTask>,\n): ResourceMethodSpec<P, LuauExecutionTask> {\n\treturn Object.freeze(spec);\n}\n\n/**\n * Per-method dispatch spec for submitting a Luau execution task at a\n * place's head version. Frozen at module scope so both the top-level\n * `LuauExecutionClient` and the `luauExecution` Operation Group on\n * `PlacesClient` share the same instance reference.\n */\nexport const SUBMIT_HEAD_SPEC = makeSpec<SubmitAtHeadParameters>({\n\tbuildRequest: (parameters) => okRequest(buildSubmitAtHeadRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: SUBMIT_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: SUBMIT_REQUIRED_SCOPES,\n});\n\n/**\n * Per-method dispatch spec for submitting a Luau execution task at a\n * specific place version. Shares the rate-limit queue and required\n * scope set with {@link SUBMIT_HEAD_SPEC} because Roblox attributes\n * both URL shapes to one per-minute quota.\n */\nexport const SUBMIT_VERSION_SPEC = makeSpec<SubmitAtVersionParameters>({\n\tbuildRequest: (parameters) => okRequest(buildSubmitAtVersionRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: SUBMIT_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: SUBMIT_REQUIRED_SCOPES,\n});\n\n/**\n * Per-method dispatch spec for fetching a Luau execution task. Uses\n * idempotent retry semantics (429 and 5xx both retried) so reads\n * recover transparently from transient server errors.\n */\nexport const GET_SPEC = makeSpec<GetParameters>({\n\tbuildRequest: buildGetRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: GET_REQUIRED_SCOPES,\n});\n","import type { RequestOptions } from \"../../client/types.ts\";\nimport type { LuauExecutionTask } from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { PollAbortedError } from \"../../errors/poll-aborted.ts\";\nimport { PollTimeoutError } from \"../../errors/poll-timeout.ts\";\nimport { defaultRetryDelay } from \"../../internal/http/retry.ts\";\nimport type { SleepFunc } from \"../../internal/utils/sleep.ts\";\nimport type { Result } from \"../../types.ts\";\n\n/** Default total polling budget in milliseconds (5 minutes). */\nexport const DEFAULT_POLL_TIMEOUT_MS = 300_000;\n\n/**\n * Injected dependencies for the deep-module polling loop. The `fetch`\n * callback is pre-bound by the wiring layer and closes over the task ref\n * and request options, keeping the core loop narrow.\n */\nexport interface PollDeps {\n\t/** Returns the current task or an error. Called on each loop iteration. */\n\treadonly fetch: () => Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/** Returns the current wall-clock time in ms. */\n\treadonly now: () => number;\n\t/** Injectable sleep for deterministic tests. */\n\treadonly sleep: SleepFunc;\n}\n\n/** Public options accepted by `pollUntilDone` and `runUntilDone` on both client surfaces. */\nexport type PollUntilDoneOptions = PollOptions & RequestOptions;\n\n/** Caller-supplied polling-loop options; all fields optional. */\ninterface PollOptions {\n\t/** Returns the sleep duration for a given zero-indexed attempt. Defaults to {@link defaultRetryDelay}. */\n\treadonly pollDelay?: (attempt: number) => number;\n\t/** When aborted, the loop returns {@link PollAbortedError} rather than continuing. */\n\treadonly signal?: AbortSignal;\n\t/** Total wall-clock budget in ms before the loop returns {@link PollTimeoutError}. */\n\treadonly timeoutMs?: number;\n}\n\nconst ABORTED = Symbol(\"poll-aborted\");\ntype Aborted = typeof ABORTED;\n\ninterface AbortObserver {\n\treadonly cleanup: () => void;\n\treadonly promise: Promise<Aborted>;\n}\n\ninterface SleepWithAbortOptions {\n\treadonly ms: number;\n\treadonly signal: AbortSignal | undefined;\n\treadonly sleep: SleepFunc;\n}\n\ntype IterationOutcome =\n\t| { readonly done: false; readonly task: LuauExecutionTask }\n\t| { readonly done: true; readonly result: Result<LuauExecutionTask, OpenCloudError> };\n\ninterface PollIterationOptions {\n\treadonly delayMs: number;\n\treadonly deps: PollDeps;\n\treadonly signal: AbortSignal | undefined;\n}\n\n/**\n * Core polling loop. Calls `deps.fetch()` repeatedly, sleeping\n * `pollDelay(attempt)` ms between iterations, until a terminal state\n * is observed, the wall-clock budget is exhausted, or an `AbortSignal`\n * fires. Returns the terminal task on success.\n *\n * @param deps - Injected fetch, now, and sleep callbacks.\n * @param options - Optional poll delay, timeout, and abort signal.\n * @returns The terminal task, or an error if aborted, timed out, or the transport fails.\n */\nexport async function pollUntilDoneCore(\n\tdeps: PollDeps,\n\toptions: PollOptions = {},\n): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst timeoutMs = options.timeoutMs ?? DEFAULT_POLL_TIMEOUT_MS;\n\tconst pollDelay = options.pollDelay ?? defaultRetryDelay;\n\tconst sig = options.signal;\n\tconst startedAt = deps.now();\n\tif (sig?.aborted === true) {\n\t\treturn abortedResult(sig);\n\t}\n\n\tlet lastTask: LuauExecutionTask | undefined;\n\tfor (let attempt = 0; ; attempt += 1) {\n\t\tif (deps.now() - startedAt >= timeoutMs) {\n\t\t\treturn { err: makeTimeout(lastTask, timeoutMs), success: false };\n\t\t}\n\n\t\tconst iteration = await pollIteration({ delayMs: pollDelay(attempt), deps, signal: sig });\n\t\tif (iteration.done) {\n\t\t\treturn iteration.result;\n\t\t}\n\n\t\tlastTask = iteration.task;\n\t}\n}\n\nfunction makeAborted(signal: AbortSignal | undefined): PollAbortedError {\n\treturn new PollAbortedError(\"Polling was aborted\", { reason: signal?.reason });\n}\n\nfunction abortedResult(signal: AbortSignal | undefined): Result<LuauExecutionTask, OpenCloudError> {\n\treturn { err: makeAborted(signal), success: false };\n}\n\nfunction isTerminal(task: LuauExecutionTask): boolean {\n\treturn task.state === \"COMPLETE\" || task.state === \"FAILED\" || task.state === \"CANCELLED\";\n}\n\nfunction abortObserver(signal: AbortSignal): AbortObserver {\n\tconst { promise, resolve } = Promise.withResolvers<Aborted>();\n\tfunction onAbort(): void {\n\t\tresolve(ABORTED);\n\t}\n\n\tsignal.addEventListener(\"abort\", onAbort);\n\tfunction cleanup(): void {\n\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t}\n\n\treturn { cleanup, promise };\n}\n\nasync function raceWithAbort<T>(\n\tpromise: Promise<T>,\n\tsignal: AbortSignal | undefined,\n): Promise<Aborted | T> {\n\tif (signal === undefined) {\n\t\treturn promise;\n\t}\n\n\tif (signal.aborted) {\n\t\treturn ABORTED;\n\t}\n\n\tconst observer = abortObserver(signal);\n\ttry {\n\t\treturn await Promise.race([promise, observer.promise]);\n\t} finally {\n\t\tobserver.cleanup();\n\t}\n}\n\nasync function sleepWithAbort(options: SleepWithAbortOptions): Promise<boolean> {\n\tconst { ms, signal, sleep } = options;\n\tconst raced = await raceWithAbort(sleep(ms), signal);\n\treturn raced === ABORTED;\n}\n\nasync function pollIteration(options: PollIterationOptions): Promise<IterationOutcome> {\n\tconst { delayMs, deps, signal } = options;\n\tconst fetchResult = await raceWithAbort(deps.fetch(), signal);\n\tif (fetchResult === ABORTED) {\n\t\treturn { done: true, result: abortedResult(signal) };\n\t}\n\n\tif (!fetchResult.success) {\n\t\treturn { done: true, result: fetchResult };\n\t}\n\n\tif (isTerminal(fetchResult.data)) {\n\t\treturn { done: true, result: { data: fetchResult.data, success: true } };\n\t}\n\n\tif (await sleepWithAbort({ ms: delayMs, signal, sleep: deps.sleep })) {\n\t\treturn { done: true, result: abortedResult(signal) };\n\t}\n\n\treturn { done: false, task: fetchResult.data };\n}\n\nfunction makeTimeout(\n\ttask: LuauExecutionTask | undefined,\n\ttimeoutMs: number,\n): PollTimeoutError<LuauExecutionTask> {\n\treturn new PollTimeoutError(`Polling timed out after ${timeoutMs} ms`, {\n\t\tlastObservedTask: task,\n\t\ttimeoutMs,\n\t});\n}\n","import {\n\tGET_SPEC,\n\tSUBMIT_HEAD_SPEC,\n\tSUBMIT_VERSION_SPEC,\n} from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport type { ResourceClient } from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { type PollDeps, pollUntilDoneCore, type PollUntilDoneOptions } from \"./polling.ts\";\n\n/**\n * Builds the {@link PollDeps} bundle used by {@link pollUntilDoneCore},\n * closing over the supplied {@link ResourceClient}, task ref, and\n * per-request options so the core loop stays narrow.\n *\n * @param inner - The {@link ResourceClient} that issues each `tasks.get` call.\n * @param args - The polling options and the task ref to fetch on every iteration.\n * @returns A {@link PollDeps} bundle wiring `fetch`, `now`, and `sleep`.\n */\nexport function buildPollDeps(\n\tinner: ResourceClient,\n\targs: { options: PollUntilDoneOptions; ref: LuauExecutionTaskRef },\n): PollDeps {\n\treturn {\n\t\tfetch: async () => {\n\t\t\treturn inner.execute({\n\t\t\t\toptions: args.options,\n\t\t\t\tparameters: { ref: args.ref, view: \"BASIC\" },\n\t\t\t\tspec: GET_SPEC,\n\t\t\t});\n\t\t},\n\t\tnow: Date.now,\n\t\tsleep: inner.sleep,\n\t};\n}\n\n/**\n * Submits a Luau execution task and polls it to a terminal state.\n * Dispatches to the head-version or specific-version submit spec based on\n * the presence of `versionId`, then delegates to {@link pollUntilDoneCore}.\n *\n * @param inner - The {@link ResourceClient} that issues submit and poll calls.\n * @param args - The polling options and submit parameters.\n * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask}, or\n * the {@link OpenCloudError} that caused submit or polling to fail.\n */\nexport async function submitAndPoll(\n\tinner: ResourceClient,\n\targs: {\n\t\toptions: PollUntilDoneOptions;\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters;\n\t},\n): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst { options, parameters } = args;\n\tconst submitResult = await (\"versionId\" in parameters\n\t\t? inner.execute({ options, parameters, spec: SUBMIT_VERSION_SPEC })\n\t\t: inner.execute({ options, parameters, spec: SUBMIT_HEAD_SPEC }));\n\tif (!submitResult.success) {\n\t\treturn submitResult;\n\t}\n\n\treturn pollUntilDoneCore(\n\t\tbuildPollDeps(inner, { options, ref: submitResult.data.ref }),\n\t\toptions,\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,qBACf,YACuC;CACvC,MAAM,EAAE,UAAU,WAAW,QAAQ;CACrC,MAAM,EAAE,SAAS,WAAW,QAAQ,YAAY,cAAc;AAE9D,KAAI,cAAc,KAAA,EACjB,QAAO;EACN,KAAK,IAAI,gBAAgB,mDAAmD,EAC3E,MAAM,kBACN,CAAC;EACF,SAAS;EACT;AAGF,KAAI,cAAc,KAAA,EACjB,QAAO;EACN,KAAK,IAAI,gBAAgB,mDAAmD,EAC3E,MAAM,kBACN,CAAC;EACF,SAAS;EACT;AAKF,QAAO;EAAE,MAAM;GAAE,QAAQ;GAAO,KADpB,GADC,uBAAuB,WAAW,UAAU,QAAQ,YAAY,UAAU,2BAA2B,UAAU,SAAS,OAAO,OACxH,GAAG,WAAW,UAAU,UAAU,CAAC,UAAU;GAC5B;EAAE,SAAS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ord } from "./resource-client-Wi4Mwqy5.mjs";
1
+ import { s as isRecord } from "./resource-client-opC6BUkL.mjs";
2
2
  //#region src/internal/price-information.ts
3
3
  /**
4
4
  * Narrows `value` to {@link PriceInformationLike} for a given feature literal
@@ -39,4 +39,4 @@ function copyPriceInformation(wire) {
39
39
  //#endregion
40
40
  export { isPriceInformationLike as n, copyPriceInformation as t };
41
41
 
42
- //# sourceMappingURL=price-information-s7DY0GV2.mjs.map
42
+ //# sourceMappingURL=price-information-DFf89abd.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"price-information-s7DY0GV2.mjs","names":[],"sources":["../src/internal/price-information.ts"],"sourcesContent":["import { isRecord } from \"./utils/is-record.ts\";\n\n/**\n * Wire shape shared by every Roblox commerce resource that carries a\n * `priceInformation` block (game passes, developer products, ...). Resources\n * vary in the literal set their `enabledFeatures` may contain, so the feature\n * type is left as a parameter `F`.\n *\n * @template F - The string-literal union for this resource's pricing-feature flags.\n */\nexport interface PriceInformationLike<F extends string> {\n\t/** Default Robux price; `undefined` when the schema returns null. */\n\treadonly defaultPriceInRobux: number | undefined;\n\t/** Enabled pricing feature flags, in the order returned by the API. */\n\treadonly enabledFeatures: ReadonlyArray<F>;\n}\n\n/**\n * Narrows `value` to {@link PriceInformationLike} for a given feature literal\n * union by delegating per-element validation to the supplied `isFeature`\n * predicate.\n *\n * @template F - The pricing-feature literal union the caller wants to narrow to.\n * @param value - Unknown wire value to validate.\n * @param isFeature - Type guard for a single `enabledFeatures` element.\n * @returns `true` when `value` is a record whose `defaultPriceInRobux` is a\n * number, `null`, or absent and whose `enabledFeatures` is an array of\n * values that all satisfy `isFeature`.\n */\nexport function isPriceInformationLike<F extends string>(\n\tvalue: unknown,\n\tisFeature: (candidate: unknown) => candidate is F,\n): value is PriceInformationLike<F> {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\tconst defaultPrice = value[\"defaultPriceInRobux\"] ?? undefined;\n\tif (defaultPrice !== undefined && typeof defaultPrice !== \"number\") {\n\t\treturn false;\n\t}\n\n\tconst features = value[\"enabledFeatures\"];\n\tif (!Array.isArray(features)) {\n\t\treturn false;\n\t}\n\n\tfor (const feature of features) {\n\t\tif (!isFeature(feature)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Returns a fresh {@link PriceInformationLike} value with a new\n * `enabledFeatures` array, so the caller can hand the result on without\n * exposing the wire object's internal storage.\n *\n * @template F - The pricing-feature literal union of the input.\n * @param wire - Already-validated wire shape.\n * @returns A new record with the same defaults and a copied feature array.\n */\nexport function copyPriceInformation<F extends string>(\n\twire: PriceInformationLike<F>,\n): PriceInformationLike<F> {\n\treturn {\n\t\tdefaultPriceInRobux: wire.defaultPriceInRobux ?? undefined,\n\t\tenabledFeatures: [...wire.enabledFeatures],\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;AA6BA,SAAgB,uBACf,OACA,WACmC;AACnC,KAAI,CAAC,SAAS,MAAM,CACnB,QAAO;CAGR,MAAM,eAAe,MAAM,0BAA0B,KAAA;AACrD,KAAI,iBAAiB,KAAA,KAAa,OAAO,iBAAiB,SACzD,QAAO;CAGR,MAAM,WAAW,MAAM;AACvB,KAAI,CAAC,MAAM,QAAQ,SAAS,CAC3B,QAAO;AAGR,MAAK,MAAM,WAAW,SACrB,KAAI,CAAC,UAAU,QAAQ,CACtB,QAAO;AAIT,QAAO;;;;;;;;;;;AAYR,SAAgB,qBACf,MAC0B;AAC1B,QAAO;EACN,qBAAqB,KAAK,uBAAuB,KAAA;EACjD,iBAAiB,CAAC,GAAG,KAAK,gBAAgB;EAC1C"}
1
+ {"version":3,"file":"price-information-DFf89abd.mjs","names":[],"sources":["../src/internal/price-information.ts"],"sourcesContent":["import { isRecord } from \"./utils/is-record.ts\";\n\n/**\n * Wire shape shared by every Roblox commerce resource that carries a\n * `priceInformation` block (game passes, developer products, ...). Resources\n * vary in the literal set their `enabledFeatures` may contain, so the feature\n * type is left as a parameter `F`.\n *\n * @template F - The string-literal union for this resource's pricing-feature flags.\n */\nexport interface PriceInformationLike<F extends string> {\n\t/** Default Robux price; `undefined` when the schema returns null. */\n\treadonly defaultPriceInRobux: number | undefined;\n\t/** Enabled pricing feature flags, in the order returned by the API. */\n\treadonly enabledFeatures: ReadonlyArray<F>;\n}\n\n/**\n * Narrows `value` to {@link PriceInformationLike} for a given feature literal\n * union by delegating per-element validation to the supplied `isFeature`\n * predicate.\n *\n * @template F - The pricing-feature literal union the caller wants to narrow to.\n * @param value - Unknown wire value to validate.\n * @param isFeature - Type guard for a single `enabledFeatures` element.\n * @returns `true` when `value` is a record whose `defaultPriceInRobux` is a\n * number, `null`, or absent and whose `enabledFeatures` is an array of\n * values that all satisfy `isFeature`.\n */\nexport function isPriceInformationLike<F extends string>(\n\tvalue: unknown,\n\tisFeature: (candidate: unknown) => candidate is F,\n): value is PriceInformationLike<F> {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\tconst defaultPrice = value[\"defaultPriceInRobux\"] ?? undefined;\n\tif (defaultPrice !== undefined && typeof defaultPrice !== \"number\") {\n\t\treturn false;\n\t}\n\n\tconst features = value[\"enabledFeatures\"];\n\tif (!Array.isArray(features)) {\n\t\treturn false;\n\t}\n\n\tfor (const feature of features) {\n\t\tif (!isFeature(feature)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Returns a fresh {@link PriceInformationLike} value with a new\n * `enabledFeatures` array, so the caller can hand the result on without\n * exposing the wire object's internal storage.\n *\n * @template F - The pricing-feature literal union of the input.\n * @param wire - Already-validated wire shape.\n * @returns A new record with the same defaults and a copied feature array.\n */\nexport function copyPriceInformation<F extends string>(\n\twire: PriceInformationLike<F>,\n): PriceInformationLike<F> {\n\treturn {\n\t\tdefaultPriceInRobux: wire.defaultPriceInRobux ?? undefined,\n\t\tenabledFeatures: [...wire.enabledFeatures],\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;AA6BA,SAAgB,uBACf,OACA,WACmC;AACnC,KAAI,CAAC,SAAS,MAAM,CACnB,QAAO;CAGR,MAAM,eAAe,MAAM,0BAA0B,KAAA;AACrD,KAAI,iBAAiB,KAAA,KAAa,OAAO,iBAAiB,SACzD,QAAO;CAGR,MAAM,WAAW,MAAM;AACvB,KAAI,CAAC,MAAM,QAAQ,SAAS,CAC3B,QAAO;AAGR,MAAK,MAAM,WAAW,SACrB,KAAI,CAAC,UAAU,QAAQ,CACtB,QAAO;AAIT,QAAO;;;;;;;;;;;AAYR,SAAgB,qBACf,MAC0B;AAC1B,QAAO;EACN,qBAAqB,KAAK,uBAAuB,KAAA;EACjD,iBAAiB,CAAC,GAAG,KAAK,gBAAgB;EAC1C"}
@@ -1,4 +1,4 @@
1
- import { d as OpenCloudError } from "./types-Cp8w8uwA.mjs";
1
+ import { d as OpenCloudError } from "./types-DUzm6maA.mjs";
2
2
 
3
3
  //#region src/errors/api-error.d.ts
4
4
  /**
@@ -89,4 +89,4 @@ declare class RateLimitError extends OpenCloudError {
89
89
  }
90
90
  //#endregion
91
91
  export { ApiErrorOptions as i, RateLimitErrorOptions as n, ApiError as r, RateLimitError as t };
92
- //# sourceMappingURL=rate-limit-DzHBFwps.d.mts.map
92
+ //# sourceMappingURL=rate-limit-BSbFNSGT.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rate-limit-DzHBFwps.d.mts","names":[],"sources":["../src/errors/api-error.ts","../src/errors/rate-limit.ts"],"mappings":";;;;;AAKA;UAAiB,eAAA,SAAwB,YAAA;;EAExC,IAAA;;EAEA,OAAA,GAAU,SAAA;;EAEV,UAAA;AAAA;;;AA2BD;;;;;;;;;;;;;;;;;;;;;;cAAa,QAAA,SAAiB,cAAA;EAAA,SACb,IAAA;EAAA,SACA,OAAA,EAAS,SAAA;EAAA,kBACA,IAAA;EAAA,SACT,UAAA;ECnChB;AAoBD;;;;;;EDwBC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,eAAA;AAAA;;;;;AA9CvC;UCAiB,qBAAA,SAA8B,YAAA;;EAE9C,iBAAA;AAAA;;;;;;;AD+BD;;;;;;;;;;;cCXa,cAAA,SAAuB,cAAA;EAAA,kBACV,IAAA;EAAA,SACT,iBAAA;;;;;;;EAQhB,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,qBAAA;AAAA"}
1
+ {"version":3,"file":"rate-limit-BSbFNSGT.d.mts","names":[],"sources":["../src/errors/api-error.ts","../src/errors/rate-limit.ts"],"mappings":";;;;;AAKA;UAAiB,eAAA,SAAwB,YAAA;;EAExC,IAAA;;EAEA,OAAA,GAAU,SAAA;;EAEV,UAAA;AAAA;;;AA2BD;;;;;;;;;;;;;;;;;;;;;;cAAa,QAAA,SAAiB,cAAA;EAAA,SACb,IAAA;EAAA,SACA,OAAA,EAAS,SAAA;EAAA,kBACA,IAAA;EAAA,SACT,UAAA;ECnChB;AAoBD;;;;;;EDwBC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,eAAA;AAAA;;;;;AA9CvC;UCAiB,qBAAA,SAA8B,YAAA;;EAE9C,iBAAA;AAAA;;;;;;;AD+BD;;;;;;;;;;;cCXa,cAAA,SAAuB,cAAA;EAAA,kBACV,IAAA;EAAA,SACT,iBAAA;;;;;;;EAQhB,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,qBAAA;AAAA"}
@@ -679,6 +679,14 @@ var ResourceClient = class {
679
679
  };
680
680
  return spec.parse(httpResult.data);
681
681
  }
682
+ /**
683
+ * Returns the sleep function used by this client instance.
684
+ *
685
+ * @returns The sleep function injected at construction time.
686
+ */
687
+ get sleep() {
688
+ return this.#sleep;
689
+ }
682
690
  #getQueue(apiKey, limit) {
683
691
  const key = `${apiKey}::${limit.operationKey}`;
684
692
  const existing = this.#queues.get(key);
@@ -702,6 +710,6 @@ function enrichPermissionError(err, spec) {
702
710
  });
703
711
  }
704
712
  //#endregion
705
- export { IDEMPOTENT_METHOD_DEFAULTS as a, CREATE_METHOD_DEFAULTS as i, okRequest as n, isRecord as o, parseEmptyResponse as r, ResourceClient as t };
713
+ export { IDEMPOTENT_METHOD_DEFAULTS as a, CREATE_METHOD_DEFAULTS as i, okRequest as n, defaultRetryDelay as o, parseEmptyResponse as r, isRecord as s, ResourceClient as t };
706
714
 
707
- //# sourceMappingURL=resource-client-Wi4Mwqy5.mjs.map
715
+ //# sourceMappingURL=resource-client-opC6BUkL.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource-client-Wi4Mwqy5.mjs","names":["#hooks","#intervalMs","#maxBucketLevel","#sleep","#chain","#waitForToken","#lastCheck","#bucketLevel","#config","#hooks","#httpClient","#queues","#sleep","#getQueue"],"sources":["../src/internal/utils/is-record.ts","../src/internal/http/retry.ts","../src/internal/http/execute.ts","../src/internal/http/rate-limit-queue.ts","../src/internal/utils/try-catch.ts","../src/internal/http/fetch-client.ts","../src/internal/http/resolve-dependencies.ts","../src/internal/resource-client.ts"],"sourcesContent":["/**\n * Narrows `value` to a plain JSON-style record. Excludes arrays, class\n * instances, primitives, and `null`/`undefined`. Used by resource\n * parsers to gate property access on wire bodies whose shape isn't\n * known at compile time.\n *\n * @param value - The unknown value to narrow.\n * @returns `true` when `value` is a plain `[object Object]`.\n */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n\treturn Object.prototype.toString.call(value) === \"[object Object]\";\n}\n","import { ApiError } from \"../../errors/api-error.ts\";\nimport { RateLimitError } from \"../../errors/rate-limit.ts\";\n\n/**\n * Fully-resolved retry config shape that {@link mergeConfig} and\n * {@link shouldRetry} operate on. Fields are required because this represents\n * the post-defaulting, internal view — callers should supply every field (or\n * resolve them via a test factory / client constructor). The partial,\n * user-facing type lives on client construction options; method defaults and\n * per-request overrides use `Partial<RetryResolvable>`.\n */\nexport interface RetryResolvable {\n\t/** Roblox Open Cloud API key. */\n\treadonly apiKey: string;\n\t/** Base URL for the Open Cloud API. */\n\treadonly baseUrl: string;\n\t/** Maximum retry attempts before giving up. */\n\treadonly maxRetries: number;\n\t/** Status codes that are eligible for retry. */\n\treadonly retryableStatuses: ReadonlyArray<number>;\n\t/** Fallback delay function when no server hint is available. */\n\treadonly retryDelay: (attempt: number) => number;\n\t/** Per-request timeout in milliseconds. */\n\treadonly timeout: number;\n}\n\n/**\n * Default retry status codes for idempotent operations (read, list, update,\n * delete). Safe to retry on both rate limits and transient server errors.\n */\nexport const IDEMPOTENT_METHOD_DEFAULTS: Readonly<Pick<RetryResolvable, \"retryableStatuses\">> =\n\tObject.freeze({\n\t\tretryableStatuses: Object.freeze([429, 500, 502, 503, 504] as const),\n\t});\n\n/**\n * Default retry status codes for create operations. Retries rate limits only,\n * to prevent duplicate resources on 5xx (Roblox Open Cloud has no\n * idempotency-key support).\n */\nexport const CREATE_METHOD_DEFAULTS: Readonly<Pick<RetryResolvable, \"retryableStatuses\">> =\n\tObject.freeze({\n\t\tretryableStatuses: Object.freeze([429] as const),\n\t});\n\n/** Kind of HTTP method the merge is being performed for. */\nexport type MethodKind = \"create\" | \"idempotent\";\n\n/**\n * Options for {@link mergeConfig}.\n *\n * @template T - Concrete `RetryResolvable` subtype being merged.\n */\ninterface MergeConfigOptions<T> {\n\t/** Method-level defaults (e.g. {@link CREATE_METHOD_DEFAULTS}). */\n\treadonly methodDefaults: Partial<T>;\n\t/** Whether the method is a create or idempotent operation. */\n\treadonly methodKind: MethodKind;\n\t/** Optional per-request overrides; always win when provided. */\n\treadonly requestOptions?: Partial<T>;\n}\n\n/**\n * Options for {@link computeRetryWaitMs}.\n */\ninterface ComputeRetryWaitMsOptions {\n\t/** Zero-indexed retry attempt number. */\n\treadonly attempt: number;\n\t/** Fallback delay function when no server hint is available. */\n\treadonly retryDelay: (attempt: number) => number;\n}\n\n/**\n * Default exponential backoff: 1s → 2s → 4s → 8s → 16s → 30s (capped).\n *\n * @example\n *\n * ```ts\n * import { defaultRetryDelay } from \"./retry\";\n *\n * expect(defaultRetryDelay(0)).toBe(1000);\n * expect(defaultRetryDelay(4)).toBe(16_000);\n * expect(defaultRetryDelay(10)).toBe(30_000);\n * ```\n *\n * @param attempt - Zero-indexed retry attempt number.\n * @returns Wait duration in milliseconds.\n */\nexport function defaultRetryDelay(attempt: number): number {\n\treturn Math.min(1000 * 2 ** attempt, 30_000);\n}\n\n/**\n * Computes how long to wait before the next retry. Prefers the server's\n * suggested delay when the error is a {@link RateLimitError} with a positive\n * `retryAfterSeconds`; otherwise falls through to `retryDelay(attempt)`.\n *\n * @example\n *\n * ```ts\n * import { RateLimitError } from \"../../errors/rate-limit.ts\";\n * import { computeRetryWaitMs, defaultRetryDelay } from \"./retry\";\n *\n * const error = new RateLimitError(\"slow down\", { retryAfterSeconds: 3 });\n *\n * expect(computeRetryWaitMs(error, { attempt: 0, retryDelay: defaultRetryDelay })).toBe(\n * 3000,\n * );\n * ```\n *\n * @example\n *\n * ```ts\n * import { ApiError } from \"../../errors/api-error.ts\";\n * import { computeRetryWaitMs, defaultRetryDelay } from \"./retry\";\n *\n * const error = new ApiError(\"server error\", { statusCode: 503 });\n *\n * expect(computeRetryWaitMs(error, { attempt: 2, retryDelay: defaultRetryDelay })).toBe(\n * 4000,\n * );\n * ```\n *\n * @param error - The error returned by the failing request.\n * @param options - Retry attempt index and fallback delay function.\n * @returns Wait duration in milliseconds before the next attempt.\n */\nexport function computeRetryWaitMs(\n\terror: ApiError | RateLimitError,\n\toptions: ComputeRetryWaitMsOptions,\n): number {\n\tif (error instanceof RateLimitError && error.retryAfterSeconds > 0) {\n\t\treturn error.retryAfterSeconds * 1000;\n\t}\n\n\treturn options.retryDelay(options.attempt);\n}\n\n/**\n * Decides whether a failed request is eligible for retry under the given\n * `retryableStatuses`. Only {@link RateLimitError} (checked against 429) and\n * {@link ApiError} (checked against its `statusCode`) are retryable — network\n * errors and other failures always return `false`.\n *\n * @example\n *\n * ```ts\n * import { RateLimitError } from \"../../errors/rate-limit.ts\";\n * import { shouldRetry } from \"./retry\";\n *\n * const error = new RateLimitError(\"\", { retryAfterSeconds: 1 });\n *\n * expect(shouldRetry(error, { retryableStatuses: [429] })).toBe(true);\n * ```\n *\n * @example\n *\n * ```ts\n * import { ApiError } from \"../../errors/api-error.ts\";\n * import { shouldRetry } from \"./retry\";\n *\n * const error = new ApiError(\"\", { statusCode: 503 });\n *\n * expect(shouldRetry(error, { retryableStatuses: [429, 500, 502, 503, 504] })).toBe(\n * true,\n * );\n * ```\n *\n * @example\n *\n * ```ts\n * import { NetworkError } from \"../../errors/network-error.ts\";\n * import { shouldRetry } from \"./retry\";\n *\n * const error = new NetworkError(\"offline\");\n *\n * expect(shouldRetry(error, { retryableStatuses: [429] })).toBe(false);\n * ```\n *\n * @param error - The error returned by the failing request.\n * @param config - Object carrying the retry-eligible status list.\n * @returns `true` if the error should be retried, `false` otherwise.\n */\nexport function shouldRetry(\n\terror: unknown,\n\tconfig: { readonly retryableStatuses: ReadonlyArray<number> },\n): error is ApiError | RateLimitError {\n\tif (error instanceof RateLimitError) {\n\t\treturn config.retryableStatuses.includes(429);\n\t}\n\n\tif (error instanceof ApiError) {\n\t\treturn config.retryableStatuses.includes(error.statusCode);\n\t}\n\n\treturn false;\n}\n\n/**\n * Resolves the effective config for a single request by shallow-merging the\n * client config, method defaults, and per-request options. Precedence depends\n * on `methodKind`:\n *\n * - `\"create\"`: method defaults override client config, so client-level\n * settings cannot silently relax create-method safety. Only explicit\n * per-request `requestOptions` can.\n * - `\"idempotent\"`: client config overrides method defaults, so consumers\n * can loosen or tighten retry policy globally. `requestOptions` still wins\n * when provided.\n *\n * Array-valued fields like `retryableStatuses` are *replaced*, not extended.\n *\n * @template T - Concrete `RetryResolvable` subtype being merged.\n *\n * @example\n *\n * ```ts\n * import {\n * CREATE_METHOD_DEFAULTS,\n * defaultRetryDelay,\n * mergeConfig,\n * type RetryResolvable,\n * } from \"./retry\";\n *\n * const clientConfig: RetryResolvable = {\n * apiKey: \"k\",\n * baseUrl: \"https://apis.roblox.com\",\n * maxRetries: 3,\n * retryableStatuses: [429, 500],\n * retryDelay: defaultRetryDelay,\n * timeout: 30_000,\n * };\n *\n * const merged = mergeConfig(clientConfig, {\n * methodDefaults: CREATE_METHOD_DEFAULTS,\n * methodKind: \"create\",\n * });\n *\n * expect(merged.retryableStatuses).toStrictEqual([429]);\n * ```\n *\n * @example\n *\n * ```ts\n * import {\n * defaultRetryDelay,\n * IDEMPOTENT_METHOD_DEFAULTS,\n * mergeConfig,\n * type RetryResolvable,\n * } from \"./retry\";\n *\n * const clientConfig: RetryResolvable = {\n * apiKey: \"k\",\n * baseUrl: \"https://apis.roblox.com\",\n * maxRetries: 3,\n * retryableStatuses: [429],\n * retryDelay: defaultRetryDelay,\n * timeout: 30_000,\n * };\n *\n * const merged = mergeConfig(clientConfig, {\n * methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n * methodKind: \"idempotent\",\n * requestOptions: { timeout: 10_000 },\n * });\n *\n * expect(merged.retryableStatuses).toStrictEqual([429]);\n * expect(merged.timeout).toBe(10_000);\n * ```\n *\n * @param clientConfig - Config frozen at client construction.\n * @param options - Method defaults, method kind, and optional per-request overrides.\n * @returns A new merged config object. Inputs are not mutated.\n */\nexport function mergeConfig<T extends RetryResolvable>(\n\tclientConfig: T,\n\toptions: MergeConfigOptions<T>,\n): T {\n\tconst { methodDefaults, methodKind, requestOptions } = options;\n\n\tswitch (methodKind) {\n\t\tcase \"create\": {\n\t\t\treturn { ...clientConfig, ...methodDefaults, ...requestOptions };\n\t\t}\n\t\tcase \"idempotent\": {\n\t\t\treturn { ...methodDefaults, ...clientConfig, ...requestOptions };\n\t\t}\n\t\tdefault: {\n\t\t\tconst exhaustive: never = methodKind;\n\t\t\tthrow new Error(`Unexpected methodKind: ${String(exhaustive)}`);\n\t\t}\n\t}\n}\n","import type { OpenCloudError } from \"../../errors/base.ts\";\nimport type { Result } from \"../../types.ts\";\nimport type { SleepFunc } from \"../utils/sleep.ts\";\nimport { computeRetryWaitMs, type RetryResolvable, shouldRetry } from \"./retry.ts\";\nimport type { HttpRequest, HttpResponse, OpenCloudHooks } from \"./types.ts\";\n\n/** A transport callback: takes a request, returns a classified Result. */\ntype SendFunc = (request: HttpRequest) => Promise<Result<HttpResponse, OpenCloudError>>;\n\n/**\n * Inputs to {@link executeWithRetry} bundled as an options object to keep the\n * function signature narrow.\n */\ninterface ExecuteOptions {\n\t/** Fully-resolved retry config (post-merge). */\n\treadonly config: RetryResolvable;\n\t/** Client-level observability hooks. */\n\treadonly hooks: OpenCloudHooks;\n\t/** Transport callback. May be pre-wrapped by a rate-limit queue. */\n\treadonly send: SendFunc;\n\t/** Injectable sleep (tests pass a fake). */\n\treadonly sleep: SleepFunc;\n}\n\n/**\n * Retry-aware orchestration loop. Coordinates a single logical request,\n * looping over `options.send` until it succeeds, the error is non-retryable,\n * or `options.config.maxRetries` is exhausted. Fires observability hooks\n * at each transition. Domain- and queue-agnostic: `send` may be any\n * callback, including one wrapped by a rate-limit queue.\n *\n * @param request - The immutable request to send.\n * @param options - The transport callback, resolved config, hooks, and sleep.\n * @returns The first success, or the final error after retries are exhausted.\n */\nexport async function executeWithRetry(\n\trequest: HttpRequest,\n\toptions: ExecuteOptions,\n): Promise<Result<HttpResponse, OpenCloudError>> {\n\tconst { config, hooks, send, sleep } = options;\n\n\tasync function attempt(): Promise<Result<HttpResponse, OpenCloudError>> {\n\t\thooks.onRequest?.(request);\n\t\treturn send(request);\n\t}\n\n\tlet result = await attempt();\n\n\tfor (let retry = 0; retry < config.maxRetries; retry++) {\n\t\tif (result.success || !shouldRetry(result.err, config)) {\n\t\t\treturn result;\n\t\t}\n\n\t\tconst { err } = result;\n\t\thooks.onRetry?.(retry + 1, err);\n\t\tconst waitMs = computeRetryWaitMs(err, { attempt: retry, retryDelay: config.retryDelay });\n\t\thooks.onRateLimit?.(waitMs);\n\t\tawait sleep(waitMs);\n\n\t\tresult = await attempt();\n\t}\n\n\treturn result;\n}\n","import type { SleepFunc } from \"../utils/sleep.ts\";\nimport type { OpenCloudHooks } from \"./types.ts\";\n\n/**\n * Identifies and bounds a single Roblox Open Cloud operation for rate\n * limiting, e.g. `{ operationKey: \"game-passes.create\", maxPerSecond: 5 }`.\n */\nexport interface OperationLimit {\n\t/** Maximum sustained request rate in requests per second. */\n\treadonly maxPerSecond: number;\n\t/**\n\t * Stable identifier for the operation (e.g. \"game-passes.create\"). Not\n\t * consumed by the queue itself; callers use it to key per-operation\n\t * queues in a registry (see GamePassesClient).\n\t */\n\treadonly operationKey: string;\n}\n\n/**\n * Token-bucket rate limiter for a single `(apiKey, operation)` pair. Every\n * call to `acquire` consumes one token; when the bucket is empty the call\n * waits until a token regenerates before invoking the task. Burst capacity\n * equals `maxPerSecond`, refilling at `maxPerSecond` tokens per second.\n *\n * Implemented as a leaky bucket tracking drain debt in ms. `#lastCheck`\n * advances by `waitMs` after every sleep so the algorithm stays correct\n * whether or not the injected sleep moves `Date.now()` forward.\n */\nexport class RateLimitQueue {\n\treadonly #hooks: OpenCloudHooks;\n\treadonly #intervalMs: number;\n\treadonly #maxBucketLevel: number;\n\treadonly #sleep: SleepFunc;\n\n\t#bucketLevel = 0;\n\t#chain: Promise<void> = Promise.resolve();\n\t#lastCheck: number = Date.now();\n\n\t/**\n\t * Creates a rate-limit queue bound to a single operation.\n\t *\n\t * @param limit - The operation key and its per-second request ceiling.\n\t * @param hooks - Observability callbacks; `onRateLimit` fires when the\n\t * bucket is empty and a sleep is about to start.\n\t * @param sleep - Injectable sleep (tests pass a fake).\n\t */\n\tconstructor(limit: OperationLimit, hooks: OpenCloudHooks, sleep: SleepFunc) {\n\t\tthis.#intervalMs = 1000 / limit.maxPerSecond;\n\t\tthis.#maxBucketLevel = limit.maxPerSecond * this.#intervalMs;\n\t\tthis.#hooks = hooks;\n\t\tthis.#sleep = sleep;\n\t}\n\n\t/**\n\t * Waits for a token — sleeping and firing `hooks.onRateLimit` if the\n\t * bucket is empty — then executes `task`. Concurrent callers are\n\t * serialized at token acquisition; tasks themselves run independently\n\t * once their token is secured.\n\t *\n\t * @param task - The request to run once a token is available.\n\t * @returns The value produced by `task`.\n\t */\n\tpublic async acquire<T>(task: () => Promise<T>): Promise<T> {\n\t\tconst myTurn = this.#chain.then(async () => this.#waitForToken());\n\t\tthis.#chain = myTurn;\n\t\tawait myTurn;\n\t\treturn task();\n\t}\n\n\tasync #waitForToken(): Promise<void> {\n\t\tconst now = Math.max(Date.now(), this.#lastCheck);\n\t\tconst drained = Math.max(0, this.#bucketLevel - (now - this.#lastCheck));\n\t\tthis.#lastCheck = now;\n\n\t\tif (drained + this.#intervalMs <= this.#maxBucketLevel) {\n\t\t\tthis.#bucketLevel = drained + this.#intervalMs;\n\t\t\treturn;\n\t\t}\n\n\t\tconst waitMs = drained + this.#intervalMs - this.#maxBucketLevel;\n\t\tthis.#hooks.onRateLimit?.(waitMs);\n\t\tawait this.#sleep(waitMs);\n\t\tthis.#bucketLevel = this.#maxBucketLevel;\n\t\tthis.#lastCheck = now + waitMs;\n\t}\n}\n","import type { Result } from \"../../types.ts\";\n\n/**\n * Wraps a promise into a {@link Result}, catching rejections.\n *\n * @template T - The resolved value type.\n * @param promise - The promise to wrap.\n * @returns A Result containing the resolved value or the rejection error.\n */\nexport async function tryCatch<T>(promise: Promise<T>): Promise<Result<T>> {\n\ttry {\n\t\tconst data = await promise;\n\t\treturn { data, success: true };\n\t} catch (err) {\n\t\treturn { err: err instanceof Error ? err : new Error(String(err)), success: false };\n\t}\n}\n","import { ApiError } from \"../../errors/api-error.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { NetworkError } from \"../../errors/network-error.ts\";\nimport { RateLimitError } from \"../../errors/rate-limit.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { tryCatch } from \"../utils/try-catch.ts\";\nimport type { HttpClient, HttpRequest, HttpResponse, RequestConfig } from \"./types.ts\";\n\ninterface ApiErrorMessageParts {\n\treadonly code: string | undefined;\n\treadonly message: string | undefined;\n\treadonly status: number;\n}\n\n/**\n * Converts a `Headers` object to a plain record with lowercased keys.\n *\n * @param headers - The `Headers` instance to convert.\n * @returns A record mapping lowercased header names to their values.\n */\nexport function headersToRecord(headers: Headers): Record<string, string> {\n\treturn Object.fromEntries(headers);\n}\n\n/**\n * Permissively extracts a machine-readable error code from a response body.\n *\n * Modern Open Cloud responses use `{ errorCode: string, message: string }`;\n * the legacy game-internationalization endpoints use\n * `{ errors: [{ code: number, message: string }, ...] }`. Both shapes are\n * checked; numeric legacy codes are returned as strings so callers see one\n * consistent type.\n *\n * @param body - The parsed response body (unknown shape).\n * @returns The error code if present, otherwise `undefined`.\n */\nexport function extractErrorCode(body: unknown): string | undefined {\n\tif (body === null || typeof body !== \"object\") {\n\t\treturn undefined;\n\t}\n\n\tconst errorCode = Reflect.get(body, \"errorCode\");\n\tif (typeof errorCode === \"string\") {\n\t\treturn errorCode;\n\t}\n\n\treturn extractLegacyCode(body);\n}\n\n/**\n * Permissively extracts a human-readable error message from a response body.\n *\n * Modern Open Cloud responses expose `message` at the top level; the legacy\n * game-internationalization endpoints nest it under `errors[0].message`.\n *\n * @param body - The parsed response body (unknown shape).\n * @returns The message if present, otherwise `undefined`.\n */\nexport function extractErrorMessage(body: unknown): string | undefined {\n\tif (body === null || typeof body !== \"object\") {\n\t\treturn undefined;\n\t}\n\n\tconst message = Reflect.get(body, \"message\");\n\tif (typeof message === \"string\") {\n\t\treturn message;\n\t}\n\n\treturn extractLegacyMessage(body);\n}\n\n/**\n * Parses the `x-ratelimit-reset` header value into seconds.\n *\n * @param headerValue - The raw header value, or `undefined` if missing.\n * @returns The number of seconds to wait, or 0 if missing/invalid.\n */\nexport function parseRetryAfterSeconds(headerValue: string | undefined): number {\n\tconst parsed = Number(headerValue);\n\tif (Number.isNaN(parsed)) {\n\t\treturn 0;\n\t}\n\n\treturn Math.max(0, Math.floor(parsed));\n}\n\n/**\n * Joins the base URL from config with the relative path from the request.\n *\n * @param request - The HTTP request containing the relative URL.\n * @param config - The request config containing the base URL.\n * @returns The fully-qualified URL string.\n */\nexport function buildUrl(request: HttpRequest, config: RequestConfig): string {\n\tconst base = config.baseUrl.endsWith(\"/\") ? config.baseUrl.slice(0, -1) : config.baseUrl;\n\treturn `${base}${request.url}`;\n}\n\n/**\n * Constructs the `RequestInit` options for a `fetch` call.\n *\n * @param request - The HTTP request to build options for.\n * @param config - The request config containing API key and timeout.\n * @returns A `RequestInit` object ready for `fetch`.\n */\nexport function buildFetchOptions(request: HttpRequest, config: RequestConfig): RequestInit {\n\tconst headers = new Headers({\n\t\t\"x-api-key\": config.apiKey,\n\t});\n\n\tconst options: RequestInit = {\n\t\theaders,\n\t\tmethod: request.method,\n\t};\n\n\tif (request.body instanceof FormData) {\n\t\toptions.body = request.body;\n\t} else if (request.body instanceof Uint8Array) {\n\t\theaders.set(\"content-type\", \"application/octet-stream\");\n\t\toptions.body = request.body;\n\t} else if (request.body !== undefined) {\n\t\theaders.set(\"content-type\", \"application/json\");\n\t\toptions.body = JSON.stringify(request.body);\n\t}\n\n\tif (request.headers !== undefined) {\n\t\tfor (const [name, value] of Object.entries(request.headers)) {\n\t\t\tif (name.toLowerCase() === \"x-api-key\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\theaders.set(name, value);\n\t\t}\n\t}\n\n\tif (config.timeout !== undefined) {\n\t\toptions.signal = AbortSignal.timeout(config.timeout);\n\t}\n\n\treturn options;\n}\n\n/**\n * Creates an {@link HttpClient} backed by the Fetch API.\n *\n * @param fetchFunc - The fetch implementation to use. Defaults to `globalThis.fetch`.\n * @returns An HttpClient that classifies responses into typed Results.\n */\nexport function createFetchHttpClient(\n\tfetchFunc: (url: string, init: RequestInit) => Promise<Response> = globalThis.fetch,\n): HttpClient {\n\treturn {\n\t\tasync request(\n\t\t\thttpRequest: HttpRequest,\n\t\t\tconfig: RequestConfig,\n\t\t): Promise<Result<HttpResponse, OpenCloudError>> {\n\t\t\tconst url = buildUrl(httpRequest, config);\n\t\t\tconst options = buildFetchOptions(httpRequest, config);\n\n\t\t\tconst fetchResult = await tryCatch(fetchFunc(url, options));\n\t\t\tif (!fetchResult.success) {\n\t\t\t\treturn {\n\t\t\t\t\terr: new NetworkError(\"Network request failed\", { cause: fetchResult.err }),\n\t\t\t\t\tsuccess: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn classifyResponse(fetchResult.data);\n\t\t},\n\t};\n}\n\nfunction readLegacyErrorEntry(body: object): object | undefined {\n\tconst errors = Reflect.get(body, \"errors\");\n\tif (!Array.isArray(errors)) {\n\t\treturn undefined;\n\t}\n\n\tconst [first] = errors;\n\tif (typeof first !== \"object\" || first === null) {\n\t\treturn undefined;\n\t}\n\n\treturn first;\n}\n\nfunction extractLegacyCode(body: object): string | undefined {\n\tconst first = readLegacyErrorEntry(body);\n\tif (first === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst code = Reflect.get(first, \"code\");\n\tif (typeof code === \"string\") {\n\t\treturn code;\n\t}\n\n\treturn typeof code === \"number\" ? String(code) : undefined;\n}\n\nfunction extractLegacyMessage(body: object): string | undefined {\n\tconst first = readLegacyErrorEntry(body);\n\tif (first === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst message = Reflect.get(first, \"message\");\n\treturn typeof message === \"string\" ? message : undefined;\n}\n\nfunction formatApiErrorMessage(parts: ApiErrorMessageParts): string {\n\tconst { code, message, status } = parts;\n\tconst base = `HTTP ${status}`;\n\tif (message === undefined && code === undefined) {\n\t\treturn base;\n\t}\n\n\tif (message === undefined) {\n\t\treturn `${base} (code ${code})`;\n\t}\n\n\tif (code === undefined) {\n\t\treturn `${base}: ${message}`;\n\t}\n\n\treturn `${base}: ${message} (code ${code})`;\n}\n\nfunction createApiError(status: number, body: JSONValue | undefined): ApiError {\n\tconst code = extractErrorCode(body);\n\tconst message = extractErrorMessage(body);\n\treturn new ApiError(formatApiErrorMessage({ code, message, status }), {\n\t\tcode,\n\t\tdetails: body,\n\t\tstatusCode: status,\n\t});\n}\n\nfunction createRateLimitError(response: Response): RateLimitError {\n\treturn new RateLimitError(\"Rate limited\", {\n\t\tretryAfterSeconds: parseRetryAfterSeconds(\n\t\t\tresponse.headers.get(\"x-ratelimit-reset\") ?? undefined,\n\t\t),\n\t});\n}\n\nasync function readResponseBody(\n\tresponse: Response,\n): Promise<Result<JSONValue | undefined, OpenCloudError>> {\n\ttry {\n\t\tconst text = await response.text();\n\t\treturn { data: text === \"\" ? undefined : JSON.parse(text), success: true };\n\t} catch {\n\t\treturn {\n\t\t\terr: new ApiError(\"Failed to parse response body\", { statusCode: response.status }),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n}\n\n/**\n * Classifies a fetch `Response` into a typed `Result`.\n *\n * @param response - The raw fetch Response to classify.\n * @returns A Result containing an HttpResponse on success or an OpenCloudError on failure.\n */\nasync function classifyResponse(response: Response): Promise<Result<HttpResponse, OpenCloudError>> {\n\tif (response.status === 429) {\n\t\treturn { err: createRateLimitError(response), success: false };\n\t}\n\n\tconst bodyResult = await readResponseBody(response);\n\tif (!bodyResult.success) {\n\t\treturn bodyResult;\n\t}\n\n\tif (response.status >= 300) {\n\t\treturn { err: createApiError(response.status, bodyResult.data), success: false };\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbody: bodyResult.data,\n\t\t\theaders: headersToRecord(response.headers),\n\t\t\tstatus: response.status,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n","import { setTimeout } from \"node:timers/promises\";\n\nimport type { HttpClient, SleepFunc } from \"../../client/types.ts\";\nimport { createFetchHttpClient } from \"./fetch-client.ts\";\n\n/**\n * Options accepted by {@link resolveDependencies}. Mirrors the test-seam\n * subset of the public client options.\n */\ninterface ResolveDependenciesOptions {\n\t/** Test seam: custom {@link HttpClient}. Defaults to a fetch-backed client. */\n\treadonly httpClient?: HttpClient | undefined;\n\t/** Test seam: custom {@link SleepFunc}. Defaults to a `setTimeout`-backed sleep. */\n\treadonly sleep?: SleepFunc | undefined;\n}\n\n/**\n * Fully-populated dependency set consumed by resource client constructors.\n */\ninterface ResolvedDependencies {\n\t/** Concrete {@link HttpClient} implementation. */\n\treadonly httpClient: HttpClient;\n\t/** Concrete {@link SleepFunc} implementation. */\n\treadonly sleep: SleepFunc;\n}\n\n/**\n * Resolves the concrete HTTP client and sleep implementation a resource\n * client should use. Falls back to the fetch-backed HTTP client and the\n * default `setTimeout`-based sleep when the caller omits the test seams.\n *\n * Extracted so resource client constructors can keep their dependency\n * resolution logic in a single, unit-testable place; this makes the\n * default branches easy to cover without stubbing globals like `fetch`.\n *\n * @param options - Optional {@link HttpClient} and {@link SleepFunc} test seams.\n * @returns A {@link ResolvedDependencies} with defaults applied.\n */\nexport function resolveDependencies(options: ResolveDependenciesOptions): ResolvedDependencies {\n\treturn {\n\t\thttpClient: options.httpClient ?? createFetchHttpClient(),\n\t\tsleep: options.sleep ?? setTimeout,\n\t};\n}\n","import type { Except } from \"type-fest\";\n\nimport type {\n\tHttpClient,\n\tHttpRequest,\n\tHttpResponse,\n\tOpenCloudClientOptions,\n\tOpenCloudHooks,\n\tRequestOptions,\n\tSleepFunc,\n} from \"../client/types.ts\";\nimport { ApiError } from \"../errors/api-error.ts\";\nimport type { OpenCloudError } from \"../errors/base.ts\";\nimport { PermissionError } from \"../errors/permission-error.ts\";\nimport type { Result } from \"../types.ts\";\nimport { executeWithRetry } from \"./http/execute.ts\";\nimport { type OperationLimit, RateLimitQueue } from \"./http/rate-limit-queue.ts\";\nimport { resolveDependencies } from \"./http/resolve-dependencies.ts\";\nimport {\n\tdefaultRetryDelay,\n\tIDEMPOTENT_METHOD_DEFAULTS,\n\tmergeConfig,\n\ttype MethodKind,\n\ttype RetryResolvable,\n} from \"./http/retry.ts\";\n\n/**\n * Describes a single resource method's shape for dispatch through\n * `ResourceClient.execute`. Each resource client declares one module-level\n * constant per public method; that constant binds the four resource-specific\n * values (request builder, response parser, retry-policy method kind,\n * operation-level rate limit) and flows through `execute` uniformly.\n *\n * @template P - The resource-specific parameter shape the builder\n * accepts.\n * @template T - The resource-specific parsed success type the parser\n * produces.\n */\nexport interface ResourceMethodSpec<P, T> {\n\t/**\n\t * Builds the pure {@link HttpRequest} for a single call. Returns a\n\t * {@link Result} so a builder can short-circuit with a local error\n\t * (typically a {@link OpenCloudError} subclass such as `ValidationError`)\n\t * before any HTTP, queue, or retry work happens. Builders that cannot\n\t * fail wrap their return as `{ data: request, success: true }`.\n\t */\n\treadonly buildRequest: (parameters: P) => Result<HttpRequest, OpenCloudError>;\n\t/** Method-level retry defaults merged into the resolved config. */\n\treadonly methodDefaults: Partial<RetryResolvable>;\n\t/**\n\t * Method kind, controlling merge precedence: `\"create\"` lets method\n\t * defaults win over client config so create safety cannot be relaxed\n\t * silently; `\"idempotent\"` lets client config win over method defaults\n\t * so consumers can loosen retry globally.\n\t */\n\treadonly methodKind: MethodKind;\n\t/** Operation-level rate limit, keyed into the client's per-key queue map. */\n\treadonly operationLimit: OperationLimit;\n\t/**\n\t * Converts the full {@link HttpResponse} into the resource-specific\n\t * parsed shape. Takes the whole response (body, status, headers) so\n\t * future parsers can read headers without widening the signature.\n\t */\n\treadonly parse: (response: HttpResponse) => Result<T, OpenCloudError>;\n\t/**\n\t * Open Cloud scopes the API key or OAuth token must carry for this\n\t * method, sourced from the vendored OpenAPI schema's `x-roblox-scopes`.\n\t * When set, a 401 or 403 ApiError from the upstream call is upgraded to\n\t * a {@link PermissionError} carrying these scopes alongside\n\t * {@link OperationLimit.operationKey}, so callers can name the missing\n\t * scope instead of just the HTTP status. Optional so test specs and\n\t * not-yet-wired resources can opt out.\n\t */\n\treadonly requiredScopes?: ReadonlyArray<string>;\n}\n\n/**\n * Single-argument bundle consumed by `ResourceClient.execute`: the per-method\n * spec, the resource-specific parameters, and optional per-request config\n * overrides.\n *\n * @template P - The resource-specific parameter shape the builder accepts.\n * @template T - The resource-specific parsed success type the parser produces.\n */\ninterface ExecuteCall<P, T> {\n\t/** Optional per-request config overrides. */\n\treadonly options?: RequestOptions | undefined;\n\t/** Resource-specific request parameters. */\n\treadonly parameters: P;\n\t/** Per-method binding of builder, parser, method kind, and operation limit. */\n\treadonly spec: ResourceMethodSpec<P, T>;\n}\n\n/**\n * Wraps an infallible request build as a {@link Result}-returning\n * `buildRequest` callback compatible with {@link ResourceMethodSpec}.\n * Use from a resource client whose builder cannot fail; resource clients\n * with local validation should construct the {@link Result} directly.\n *\n * @param request - The pre-built {@link HttpRequest}.\n * @returns A success Result wrapping the request.\n */\nexport function okRequest(request: HttpRequest): Result<HttpRequest, OpenCloudError> {\n\treturn { data: request, success: true };\n}\n\n/**\n * A {@link ResourceMethodSpec.parse} implementation for endpoints that return\n * no business payload on success (such as `DELETE` and reorder operations).\n * Surfaces `undefined` data and never inspects the response body.\n *\n * @returns A success Result with `undefined` data.\n */\nexport function parseEmptyResponse(): Result<undefined, OpenCloudError> {\n\treturn { data: undefined, success: true };\n}\n\nconst CLIENT_DEFAULTS = Object.freeze({\n\tbaseUrl: \"https://apis.roblox.com\",\n\tmaxRetries: 3,\n\tretryableStatuses: IDEMPOTENT_METHOD_DEFAULTS.retryableStatuses,\n\tretryDelay: defaultRetryDelay,\n\ttimeout: 30_000,\n} satisfies Except<RetryResolvable, \"apiKey\">);\n\n/**\n * Internal orchestrator shared by every Open Cloud resource client. Holds\n * the frozen client config, observability hooks, injected HTTP client and\n * sleep, and the per-effective-key rate-limit queue registry. Resource\n * classes compose one instance and dispatch every public method through\n * {@link ResourceClient.execute} with a per-method {@link ResourceMethodSpec}.\n * Not exported from any package subpath; reachable only via sibling\n * `src/resources/**` modules in this package.\n */\nexport class ResourceClient {\n\treadonly #config: Readonly<RetryResolvable>;\n\treadonly #hooks: OpenCloudHooks;\n\treadonly #httpClient: HttpClient;\n\treadonly #queues = new Map<string, RateLimitQueue>();\n\treadonly #sleep: SleepFunc;\n\n\t/**\n\t * Creates a new {@link ResourceClient}. Resolves the injected HTTP\n\t * client and sleep (defaulting to fetch + `setTimeout`) and freezes the\n\t * merged client config so subsequent calls cannot mutate it.\n\t *\n\t * @param options - Client-level configuration including the API key\n\t * and optional construction-time test seams.\n\t */\n\tconstructor(options: OpenCloudClientOptions) {\n\t\tconst { apiKey, hooks, httpClient, sleep, ...overrides } = options;\n\t\tconst resolved = resolveDependencies({ httpClient, sleep });\n\t\tthis.#httpClient = resolved.httpClient;\n\t\tthis.#sleep = resolved.sleep;\n\t\tthis.#hooks = hooks ?? {};\n\t\tthis.#config = Object.freeze({\n\t\t\t...CLIENT_DEFAULTS,\n\t\t\tapiKey,\n\t\t\t...overrides,\n\t\t});\n\t}\n\n\t/**\n\t * Dispatches a single resource-method call. Merges the frozen client\n\t * config with the method's `methodDefaults` and the caller's optional\n\t * per-request `options`, routes through the effective-apiKey rate-limit\n\t * queue, runs the retry loop, and finally parses the response with the\n\t * spec's parser.\n\t *\n\t * @param call - The per-method spec, resource-specific parameters, and\n\t * optional per-request overrides.\n\t * @returns The parsed success payload or the {@link OpenCloudError} that\n\t * caused the request to fail. Never throws.\n\t */\n\tpublic async execute<P, T>(call: ExecuteCall<P, T>): Promise<Result<T, OpenCloudError>> {\n\t\tconst { options, parameters, spec } = call;\n\t\tconst merged = mergeConfig(this.#config, {\n\t\t\tmethodDefaults: spec.methodDefaults,\n\t\t\tmethodKind: spec.methodKind,\n\t\t\trequestOptions: options ?? {},\n\t\t});\n\t\tconst requestResult = spec.buildRequest(parameters);\n\t\tif (!requestResult.success) {\n\t\t\treturn requestResult;\n\t\t}\n\n\t\tconst requestConfig = {\n\t\t\tapiKey: merged.apiKey,\n\t\t\tbaseUrl: merged.baseUrl,\n\t\t\ttimeout: merged.timeout,\n\t\t};\n\t\tconst queue = this.#getQueue(merged.apiKey, spec.operationLimit);\n\t\tconst httpResult = await queue.acquire(async () => {\n\t\t\treturn executeWithRetry(requestResult.data, {\n\t\t\t\tconfig: merged,\n\t\t\t\thooks: this.#hooks,\n\t\t\t\tsend: async (toSend) => this.#httpClient.request(toSend, requestConfig),\n\t\t\t\tsleep: this.#sleep,\n\t\t\t});\n\t\t});\n\t\tif (!httpResult.success) {\n\t\t\treturn { err: enrichPermissionError(httpResult.err, spec), success: false };\n\t\t}\n\n\t\treturn spec.parse(httpResult.data);\n\t}\n\n\t#getQueue(apiKey: string, limit: OperationLimit): RateLimitQueue {\n\t\tconst key = `${apiKey}::${limit.operationKey}`;\n\t\tconst existing = this.#queues.get(key);\n\t\tif (existing !== undefined) {\n\t\t\treturn existing;\n\t\t}\n\n\t\tconst queue = new RateLimitQueue(limit, this.#hooks, this.#sleep);\n\t\tthis.#queues.set(key, queue);\n\t\treturn queue;\n\t}\n}\n\nfunction enrichPermissionError<P, T>(\n\terr: OpenCloudError,\n\tspec: ResourceMethodSpec<P, T>,\n): OpenCloudError {\n\tif (spec.requiredScopes === undefined) {\n\t\treturn err;\n\t}\n\n\tif (err instanceof PermissionError) {\n\t\treturn err;\n\t}\n\n\tif (!(err instanceof ApiError)) {\n\t\treturn err;\n\t}\n\n\tif (err.statusCode !== 401 && err.statusCode !== 403) {\n\t\treturn err;\n\t}\n\n\treturn new PermissionError(err.message, {\n\t\tcause: err.cause,\n\t\tcode: err.code,\n\t\toperationKey: spec.operationLimit.operationKey,\n\t\trequiredScopes: spec.requiredScopes,\n\t\tstatusCode: err.statusCode,\n\t});\n}\n"],"mappings":";;;;;;;;;;;;AASA,SAAgB,SAAS,OAAkD;AAC1E,QAAO,OAAO,UAAU,SAAS,KAAK,MAAM,KAAK;;;;;;;;ACoBlD,MAAa,6BACZ,OAAO,OAAO,EACb,mBAAmB,OAAO,OAAO;CAAC;CAAK;CAAK;CAAK;CAAK;CAAI,CAAU,EACpE,CAAC;;;;;;AAOH,MAAa,yBACZ,OAAO,OAAO,EACb,mBAAmB,OAAO,OAAO,CAAC,IAAI,CAAU,EAChD,CAAC;;;;;;;;;;;;;;;;;AA6CH,SAAgB,kBAAkB,SAAyB;AAC1D,QAAO,KAAK,IAAI,MAAO,KAAK,SAAS,IAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsC7C,SAAgB,mBACf,OACA,SACS;AACT,KAAI,iBAAiB,kBAAkB,MAAM,oBAAoB,EAChE,QAAO,MAAM,oBAAoB;AAGlC,QAAO,QAAQ,WAAW,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AAW,KAAK;;CAGnC,UAAU,QAAgB,OAAuC;EAChE,MAAM,MAAM,GAAG,OAAO,IAAI,MAAM;EAChC,MAAM,WAAW,MAAA,OAAa,IAAI,IAAI;AACtC,MAAI,aAAa,KAAA,EAChB,QAAO;EAGR,MAAM,QAAQ,IAAI,eAAe,OAAO,MAAA,OAAa,MAAA,MAAY;AACjE,QAAA,OAAa,IAAI,KAAK,MAAM;AAC5B,SAAO;;;AAIT,SAAS,sBACR,KACA,MACiB;AACjB,KAAI,KAAK,mBAAmB,KAAA,EAC3B,QAAO;AAGR,KAAI,eAAe,gBAClB,QAAO;AAGR,KAAI,EAAE,eAAe,UACpB,QAAO;AAGR,KAAI,IAAI,eAAe,OAAO,IAAI,eAAe,IAChD,QAAO;AAGR,QAAO,IAAI,gBAAgB,IAAI,SAAS;EACvC,OAAO,IAAI;EACX,MAAM,IAAI;EACV,cAAc,KAAK,eAAe;EAClC,gBAAgB,KAAK;EACrB,YAAY,IAAI;EAChB,CAAC"}
1
+ {"version":3,"file":"resource-client-opC6BUkL.mjs","names":["#hooks","#intervalMs","#maxBucketLevel","#sleep","#chain","#waitForToken","#lastCheck","#bucketLevel","#config","#hooks","#httpClient","#queues","#sleep","#getQueue"],"sources":["../src/internal/utils/is-record.ts","../src/internal/http/retry.ts","../src/internal/http/execute.ts","../src/internal/http/rate-limit-queue.ts","../src/internal/utils/try-catch.ts","../src/internal/http/fetch-client.ts","../src/internal/http/resolve-dependencies.ts","../src/internal/resource-client.ts"],"sourcesContent":["/**\n * Narrows `value` to a plain JSON-style record. Excludes arrays, class\n * instances, primitives, and `null`/`undefined`. Used by resource\n * parsers to gate property access on wire bodies whose shape isn't\n * known at compile time.\n *\n * @param value - The unknown value to narrow.\n * @returns `true` when `value` is a plain `[object Object]`.\n */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n\treturn Object.prototype.toString.call(value) === \"[object Object]\";\n}\n","import { ApiError } from \"../../errors/api-error.ts\";\nimport { RateLimitError } from \"../../errors/rate-limit.ts\";\n\n/**\n * Fully-resolved retry config shape that {@link mergeConfig} and\n * {@link shouldRetry} operate on. Fields are required because this represents\n * the post-defaulting, internal view — callers should supply every field (or\n * resolve them via a test factory / client constructor). The partial,\n * user-facing type lives on client construction options; method defaults and\n * per-request overrides use `Partial<RetryResolvable>`.\n */\nexport interface RetryResolvable {\n\t/** Roblox Open Cloud API key. */\n\treadonly apiKey: string;\n\t/** Base URL for the Open Cloud API. */\n\treadonly baseUrl: string;\n\t/** Maximum retry attempts before giving up. */\n\treadonly maxRetries: number;\n\t/** Status codes that are eligible for retry. */\n\treadonly retryableStatuses: ReadonlyArray<number>;\n\t/** Fallback delay function when no server hint is available. */\n\treadonly retryDelay: (attempt: number) => number;\n\t/** Per-request timeout in milliseconds. */\n\treadonly timeout: number;\n}\n\n/**\n * Default retry status codes for idempotent operations (read, list, update,\n * delete). Safe to retry on both rate limits and transient server errors.\n */\nexport const IDEMPOTENT_METHOD_DEFAULTS: Readonly<Pick<RetryResolvable, \"retryableStatuses\">> =\n\tObject.freeze({\n\t\tretryableStatuses: Object.freeze([429, 500, 502, 503, 504] as const),\n\t});\n\n/**\n * Default retry status codes for create operations. Retries rate limits only,\n * to prevent duplicate resources on 5xx (Roblox Open Cloud has no\n * idempotency-key support).\n */\nexport const CREATE_METHOD_DEFAULTS: Readonly<Pick<RetryResolvable, \"retryableStatuses\">> =\n\tObject.freeze({\n\t\tretryableStatuses: Object.freeze([429] as const),\n\t});\n\n/** Kind of HTTP method the merge is being performed for. */\nexport type MethodKind = \"create\" | \"idempotent\";\n\n/**\n * Options for {@link mergeConfig}.\n *\n * @template T - Concrete `RetryResolvable` subtype being merged.\n */\ninterface MergeConfigOptions<T> {\n\t/** Method-level defaults (e.g. {@link CREATE_METHOD_DEFAULTS}). */\n\treadonly methodDefaults: Partial<T>;\n\t/** Whether the method is a create or idempotent operation. */\n\treadonly methodKind: MethodKind;\n\t/** Optional per-request overrides; always win when provided. */\n\treadonly requestOptions?: Partial<T>;\n}\n\n/**\n * Options for {@link computeRetryWaitMs}.\n */\ninterface ComputeRetryWaitMsOptions {\n\t/** Zero-indexed retry attempt number. */\n\treadonly attempt: number;\n\t/** Fallback delay function when no server hint is available. */\n\treadonly retryDelay: (attempt: number) => number;\n}\n\n/**\n * Default exponential backoff: 1s → 2s → 4s → 8s → 16s → 30s (capped).\n *\n * @example\n *\n * ```ts\n * import { defaultRetryDelay } from \"./retry\";\n *\n * expect(defaultRetryDelay(0)).toBe(1000);\n * expect(defaultRetryDelay(4)).toBe(16_000);\n * expect(defaultRetryDelay(10)).toBe(30_000);\n * ```\n *\n * @param attempt - Zero-indexed retry attempt number.\n * @returns Wait duration in milliseconds.\n */\nexport function defaultRetryDelay(attempt: number): number {\n\treturn Math.min(1000 * 2 ** attempt, 30_000);\n}\n\n/**\n * Computes how long to wait before the next retry. Prefers the server's\n * suggested delay when the error is a {@link RateLimitError} with a positive\n * `retryAfterSeconds`; otherwise falls through to `retryDelay(attempt)`.\n *\n * @example\n *\n * ```ts\n * import { RateLimitError } from \"../../errors/rate-limit.ts\";\n * import { computeRetryWaitMs, defaultRetryDelay } from \"./retry\";\n *\n * const error = new RateLimitError(\"slow down\", { retryAfterSeconds: 3 });\n *\n * expect(computeRetryWaitMs(error, { attempt: 0, retryDelay: defaultRetryDelay })).toBe(\n * 3000,\n * );\n * ```\n *\n * @example\n *\n * ```ts\n * import { ApiError } from \"../../errors/api-error.ts\";\n * import { computeRetryWaitMs, defaultRetryDelay } from \"./retry\";\n *\n * const error = new ApiError(\"server error\", { statusCode: 503 });\n *\n * expect(computeRetryWaitMs(error, { attempt: 2, retryDelay: defaultRetryDelay })).toBe(\n * 4000,\n * );\n * ```\n *\n * @param error - The error returned by the failing request.\n * @param options - Retry attempt index and fallback delay function.\n * @returns Wait duration in milliseconds before the next attempt.\n */\nexport function computeRetryWaitMs(\n\terror: ApiError | RateLimitError,\n\toptions: ComputeRetryWaitMsOptions,\n): number {\n\tif (error instanceof RateLimitError && error.retryAfterSeconds > 0) {\n\t\treturn error.retryAfterSeconds * 1000;\n\t}\n\n\treturn options.retryDelay(options.attempt);\n}\n\n/**\n * Decides whether a failed request is eligible for retry under the given\n * `retryableStatuses`. Only {@link RateLimitError} (checked against 429) and\n * {@link ApiError} (checked against its `statusCode`) are retryable — network\n * errors and other failures always return `false`.\n *\n * @example\n *\n * ```ts\n * import { RateLimitError } from \"../../errors/rate-limit.ts\";\n * import { shouldRetry } from \"./retry\";\n *\n * const error = new RateLimitError(\"\", { retryAfterSeconds: 1 });\n *\n * expect(shouldRetry(error, { retryableStatuses: [429] })).toBe(true);\n * ```\n *\n * @example\n *\n * ```ts\n * import { ApiError } from \"../../errors/api-error.ts\";\n * import { shouldRetry } from \"./retry\";\n *\n * const error = new ApiError(\"\", { statusCode: 503 });\n *\n * expect(shouldRetry(error, { retryableStatuses: [429, 500, 502, 503, 504] })).toBe(\n * true,\n * );\n * ```\n *\n * @example\n *\n * ```ts\n * import { NetworkError } from \"../../errors/network-error.ts\";\n * import { shouldRetry } from \"./retry\";\n *\n * const error = new NetworkError(\"offline\");\n *\n * expect(shouldRetry(error, { retryableStatuses: [429] })).toBe(false);\n * ```\n *\n * @param error - The error returned by the failing request.\n * @param config - Object carrying the retry-eligible status list.\n * @returns `true` if the error should be retried, `false` otherwise.\n */\nexport function shouldRetry(\n\terror: unknown,\n\tconfig: { readonly retryableStatuses: ReadonlyArray<number> },\n): error is ApiError | RateLimitError {\n\tif (error instanceof RateLimitError) {\n\t\treturn config.retryableStatuses.includes(429);\n\t}\n\n\tif (error instanceof ApiError) {\n\t\treturn config.retryableStatuses.includes(error.statusCode);\n\t}\n\n\treturn false;\n}\n\n/**\n * Resolves the effective config for a single request by shallow-merging the\n * client config, method defaults, and per-request options. Precedence depends\n * on `methodKind`:\n *\n * - `\"create\"`: method defaults override client config, so client-level\n * settings cannot silently relax create-method safety. Only explicit\n * per-request `requestOptions` can.\n * - `\"idempotent\"`: client config overrides method defaults, so consumers\n * can loosen or tighten retry policy globally. `requestOptions` still wins\n * when provided.\n *\n * Array-valued fields like `retryableStatuses` are *replaced*, not extended.\n *\n * @template T - Concrete `RetryResolvable` subtype being merged.\n *\n * @example\n *\n * ```ts\n * import {\n * CREATE_METHOD_DEFAULTS,\n * defaultRetryDelay,\n * mergeConfig,\n * type RetryResolvable,\n * } from \"./retry\";\n *\n * const clientConfig: RetryResolvable = {\n * apiKey: \"k\",\n * baseUrl: \"https://apis.roblox.com\",\n * maxRetries: 3,\n * retryableStatuses: [429, 500],\n * retryDelay: defaultRetryDelay,\n * timeout: 30_000,\n * };\n *\n * const merged = mergeConfig(clientConfig, {\n * methodDefaults: CREATE_METHOD_DEFAULTS,\n * methodKind: \"create\",\n * });\n *\n * expect(merged.retryableStatuses).toStrictEqual([429]);\n * ```\n *\n * @example\n *\n * ```ts\n * import {\n * defaultRetryDelay,\n * IDEMPOTENT_METHOD_DEFAULTS,\n * mergeConfig,\n * type RetryResolvable,\n * } from \"./retry\";\n *\n * const clientConfig: RetryResolvable = {\n * apiKey: \"k\",\n * baseUrl: \"https://apis.roblox.com\",\n * maxRetries: 3,\n * retryableStatuses: [429],\n * retryDelay: defaultRetryDelay,\n * timeout: 30_000,\n * };\n *\n * const merged = mergeConfig(clientConfig, {\n * methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n * methodKind: \"idempotent\",\n * requestOptions: { timeout: 10_000 },\n * });\n *\n * expect(merged.retryableStatuses).toStrictEqual([429]);\n * expect(merged.timeout).toBe(10_000);\n * ```\n *\n * @param clientConfig - Config frozen at client construction.\n * @param options - Method defaults, method kind, and optional per-request overrides.\n * @returns A new merged config object. Inputs are not mutated.\n */\nexport function mergeConfig<T extends RetryResolvable>(\n\tclientConfig: T,\n\toptions: MergeConfigOptions<T>,\n): T {\n\tconst { methodDefaults, methodKind, requestOptions } = options;\n\n\tswitch (methodKind) {\n\t\tcase \"create\": {\n\t\t\treturn { ...clientConfig, ...methodDefaults, ...requestOptions };\n\t\t}\n\t\tcase \"idempotent\": {\n\t\t\treturn { ...methodDefaults, ...clientConfig, ...requestOptions };\n\t\t}\n\t\tdefault: {\n\t\t\tconst exhaustive: never = methodKind;\n\t\t\tthrow new Error(`Unexpected methodKind: ${String(exhaustive)}`);\n\t\t}\n\t}\n}\n","import type { OpenCloudError } from \"../../errors/base.ts\";\nimport type { Result } from \"../../types.ts\";\nimport type { SleepFunc } from \"../utils/sleep.ts\";\nimport { computeRetryWaitMs, type RetryResolvable, shouldRetry } from \"./retry.ts\";\nimport type { HttpRequest, HttpResponse, OpenCloudHooks } from \"./types.ts\";\n\n/** A transport callback: takes a request, returns a classified Result. */\ntype SendFunc = (request: HttpRequest) => Promise<Result<HttpResponse, OpenCloudError>>;\n\n/**\n * Inputs to {@link executeWithRetry} bundled as an options object to keep the\n * function signature narrow.\n */\ninterface ExecuteOptions {\n\t/** Fully-resolved retry config (post-merge). */\n\treadonly config: RetryResolvable;\n\t/** Client-level observability hooks. */\n\treadonly hooks: OpenCloudHooks;\n\t/** Transport callback. May be pre-wrapped by a rate-limit queue. */\n\treadonly send: SendFunc;\n\t/** Injectable sleep (tests pass a fake). */\n\treadonly sleep: SleepFunc;\n}\n\n/**\n * Retry-aware orchestration loop. Coordinates a single logical request,\n * looping over `options.send` until it succeeds, the error is non-retryable,\n * or `options.config.maxRetries` is exhausted. Fires observability hooks\n * at each transition. Domain- and queue-agnostic: `send` may be any\n * callback, including one wrapped by a rate-limit queue.\n *\n * @param request - The immutable request to send.\n * @param options - The transport callback, resolved config, hooks, and sleep.\n * @returns The first success, or the final error after retries are exhausted.\n */\nexport async function executeWithRetry(\n\trequest: HttpRequest,\n\toptions: ExecuteOptions,\n): Promise<Result<HttpResponse, OpenCloudError>> {\n\tconst { config, hooks, send, sleep } = options;\n\n\tasync function attempt(): Promise<Result<HttpResponse, OpenCloudError>> {\n\t\thooks.onRequest?.(request);\n\t\treturn send(request);\n\t}\n\n\tlet result = await attempt();\n\n\tfor (let retry = 0; retry < config.maxRetries; retry++) {\n\t\tif (result.success || !shouldRetry(result.err, config)) {\n\t\t\treturn result;\n\t\t}\n\n\t\tconst { err } = result;\n\t\thooks.onRetry?.(retry + 1, err);\n\t\tconst waitMs = computeRetryWaitMs(err, { attempt: retry, retryDelay: config.retryDelay });\n\t\thooks.onRateLimit?.(waitMs);\n\t\tawait sleep(waitMs);\n\n\t\tresult = await attempt();\n\t}\n\n\treturn result;\n}\n","import type { SleepFunc } from \"../utils/sleep.ts\";\nimport type { OpenCloudHooks } from \"./types.ts\";\n\n/**\n * Identifies and bounds a single Roblox Open Cloud operation for rate\n * limiting, e.g. `{ operationKey: \"game-passes.create\", maxPerSecond: 5 }`.\n */\nexport interface OperationLimit {\n\t/** Maximum sustained request rate in requests per second. */\n\treadonly maxPerSecond: number;\n\t/**\n\t * Stable identifier for the operation (e.g. \"game-passes.create\"). Not\n\t * consumed by the queue itself; callers use it to key per-operation\n\t * queues in a registry (see GamePassesClient).\n\t */\n\treadonly operationKey: string;\n}\n\n/**\n * Token-bucket rate limiter for a single `(apiKey, operation)` pair. Every\n * call to `acquire` consumes one token; when the bucket is empty the call\n * waits until a token regenerates before invoking the task. Burst capacity\n * equals `maxPerSecond`, refilling at `maxPerSecond` tokens per second.\n *\n * Implemented as a leaky bucket tracking drain debt in ms. `#lastCheck`\n * advances by `waitMs` after every sleep so the algorithm stays correct\n * whether or not the injected sleep moves `Date.now()` forward.\n */\nexport class RateLimitQueue {\n\treadonly #hooks: OpenCloudHooks;\n\treadonly #intervalMs: number;\n\treadonly #maxBucketLevel: number;\n\treadonly #sleep: SleepFunc;\n\n\t#bucketLevel = 0;\n\t#chain: Promise<void> = Promise.resolve();\n\t#lastCheck: number = Date.now();\n\n\t/**\n\t * Creates a rate-limit queue bound to a single operation.\n\t *\n\t * @param limit - The operation key and its per-second request ceiling.\n\t * @param hooks - Observability callbacks; `onRateLimit` fires when the\n\t * bucket is empty and a sleep is about to start.\n\t * @param sleep - Injectable sleep (tests pass a fake).\n\t */\n\tconstructor(limit: OperationLimit, hooks: OpenCloudHooks, sleep: SleepFunc) {\n\t\tthis.#intervalMs = 1000 / limit.maxPerSecond;\n\t\tthis.#maxBucketLevel = limit.maxPerSecond * this.#intervalMs;\n\t\tthis.#hooks = hooks;\n\t\tthis.#sleep = sleep;\n\t}\n\n\t/**\n\t * Waits for a token — sleeping and firing `hooks.onRateLimit` if the\n\t * bucket is empty — then executes `task`. Concurrent callers are\n\t * serialized at token acquisition; tasks themselves run independently\n\t * once their token is secured.\n\t *\n\t * @param task - The request to run once a token is available.\n\t * @returns The value produced by `task`.\n\t */\n\tpublic async acquire<T>(task: () => Promise<T>): Promise<T> {\n\t\tconst myTurn = this.#chain.then(async () => this.#waitForToken());\n\t\tthis.#chain = myTurn;\n\t\tawait myTurn;\n\t\treturn task();\n\t}\n\n\tasync #waitForToken(): Promise<void> {\n\t\tconst now = Math.max(Date.now(), this.#lastCheck);\n\t\tconst drained = Math.max(0, this.#bucketLevel - (now - this.#lastCheck));\n\t\tthis.#lastCheck = now;\n\n\t\tif (drained + this.#intervalMs <= this.#maxBucketLevel) {\n\t\t\tthis.#bucketLevel = drained + this.#intervalMs;\n\t\t\treturn;\n\t\t}\n\n\t\tconst waitMs = drained + this.#intervalMs - this.#maxBucketLevel;\n\t\tthis.#hooks.onRateLimit?.(waitMs);\n\t\tawait this.#sleep(waitMs);\n\t\tthis.#bucketLevel = this.#maxBucketLevel;\n\t\tthis.#lastCheck = now + waitMs;\n\t}\n}\n","import type { Result } from \"../../types.ts\";\n\n/**\n * Wraps a promise into a {@link Result}, catching rejections.\n *\n * @template T - The resolved value type.\n * @param promise - The promise to wrap.\n * @returns A Result containing the resolved value or the rejection error.\n */\nexport async function tryCatch<T>(promise: Promise<T>): Promise<Result<T>> {\n\ttry {\n\t\tconst data = await promise;\n\t\treturn { data, success: true };\n\t} catch (err) {\n\t\treturn { err: err instanceof Error ? err : new Error(String(err)), success: false };\n\t}\n}\n","import { ApiError } from \"../../errors/api-error.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { NetworkError } from \"../../errors/network-error.ts\";\nimport { RateLimitError } from \"../../errors/rate-limit.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { tryCatch } from \"../utils/try-catch.ts\";\nimport type { HttpClient, HttpRequest, HttpResponse, RequestConfig } from \"./types.ts\";\n\ninterface ApiErrorMessageParts {\n\treadonly code: string | undefined;\n\treadonly message: string | undefined;\n\treadonly status: number;\n}\n\n/**\n * Converts a `Headers` object to a plain record with lowercased keys.\n *\n * @param headers - The `Headers` instance to convert.\n * @returns A record mapping lowercased header names to their values.\n */\nexport function headersToRecord(headers: Headers): Record<string, string> {\n\treturn Object.fromEntries(headers);\n}\n\n/**\n * Permissively extracts a machine-readable error code from a response body.\n *\n * Modern Open Cloud responses use `{ errorCode: string, message: string }`;\n * the legacy game-internationalization endpoints use\n * `{ errors: [{ code: number, message: string }, ...] }`. Both shapes are\n * checked; numeric legacy codes are returned as strings so callers see one\n * consistent type.\n *\n * @param body - The parsed response body (unknown shape).\n * @returns The error code if present, otherwise `undefined`.\n */\nexport function extractErrorCode(body: unknown): string | undefined {\n\tif (body === null || typeof body !== \"object\") {\n\t\treturn undefined;\n\t}\n\n\tconst errorCode = Reflect.get(body, \"errorCode\");\n\tif (typeof errorCode === \"string\") {\n\t\treturn errorCode;\n\t}\n\n\treturn extractLegacyCode(body);\n}\n\n/**\n * Permissively extracts a human-readable error message from a response body.\n *\n * Modern Open Cloud responses expose `message` at the top level; the legacy\n * game-internationalization endpoints nest it under `errors[0].message`.\n *\n * @param body - The parsed response body (unknown shape).\n * @returns The message if present, otherwise `undefined`.\n */\nexport function extractErrorMessage(body: unknown): string | undefined {\n\tif (body === null || typeof body !== \"object\") {\n\t\treturn undefined;\n\t}\n\n\tconst message = Reflect.get(body, \"message\");\n\tif (typeof message === \"string\") {\n\t\treturn message;\n\t}\n\n\treturn extractLegacyMessage(body);\n}\n\n/**\n * Parses the `x-ratelimit-reset` header value into seconds.\n *\n * @param headerValue - The raw header value, or `undefined` if missing.\n * @returns The number of seconds to wait, or 0 if missing/invalid.\n */\nexport function parseRetryAfterSeconds(headerValue: string | undefined): number {\n\tconst parsed = Number(headerValue);\n\tif (Number.isNaN(parsed)) {\n\t\treturn 0;\n\t}\n\n\treturn Math.max(0, Math.floor(parsed));\n}\n\n/**\n * Joins the base URL from config with the relative path from the request.\n *\n * @param request - The HTTP request containing the relative URL.\n * @param config - The request config containing the base URL.\n * @returns The fully-qualified URL string.\n */\nexport function buildUrl(request: HttpRequest, config: RequestConfig): string {\n\tconst base = config.baseUrl.endsWith(\"/\") ? config.baseUrl.slice(0, -1) : config.baseUrl;\n\treturn `${base}${request.url}`;\n}\n\n/**\n * Constructs the `RequestInit` options for a `fetch` call.\n *\n * @param request - The HTTP request to build options for.\n * @param config - The request config containing API key and timeout.\n * @returns A `RequestInit` object ready for `fetch`.\n */\nexport function buildFetchOptions(request: HttpRequest, config: RequestConfig): RequestInit {\n\tconst headers = new Headers({\n\t\t\"x-api-key\": config.apiKey,\n\t});\n\n\tconst options: RequestInit = {\n\t\theaders,\n\t\tmethod: request.method,\n\t};\n\n\tif (request.body instanceof FormData) {\n\t\toptions.body = request.body;\n\t} else if (request.body instanceof Uint8Array) {\n\t\theaders.set(\"content-type\", \"application/octet-stream\");\n\t\toptions.body = request.body;\n\t} else if (request.body !== undefined) {\n\t\theaders.set(\"content-type\", \"application/json\");\n\t\toptions.body = JSON.stringify(request.body);\n\t}\n\n\tif (request.headers !== undefined) {\n\t\tfor (const [name, value] of Object.entries(request.headers)) {\n\t\t\tif (name.toLowerCase() === \"x-api-key\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\theaders.set(name, value);\n\t\t}\n\t}\n\n\tif (config.timeout !== undefined) {\n\t\toptions.signal = AbortSignal.timeout(config.timeout);\n\t}\n\n\treturn options;\n}\n\n/**\n * Creates an {@link HttpClient} backed by the Fetch API.\n *\n * @param fetchFunc - The fetch implementation to use. Defaults to `globalThis.fetch`.\n * @returns An HttpClient that classifies responses into typed Results.\n */\nexport function createFetchHttpClient(\n\tfetchFunc: (url: string, init: RequestInit) => Promise<Response> = globalThis.fetch,\n): HttpClient {\n\treturn {\n\t\tasync request(\n\t\t\thttpRequest: HttpRequest,\n\t\t\tconfig: RequestConfig,\n\t\t): Promise<Result<HttpResponse, OpenCloudError>> {\n\t\t\tconst url = buildUrl(httpRequest, config);\n\t\t\tconst options = buildFetchOptions(httpRequest, config);\n\n\t\t\tconst fetchResult = await tryCatch(fetchFunc(url, options));\n\t\t\tif (!fetchResult.success) {\n\t\t\t\treturn {\n\t\t\t\t\terr: new NetworkError(\"Network request failed\", { cause: fetchResult.err }),\n\t\t\t\t\tsuccess: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn classifyResponse(fetchResult.data);\n\t\t},\n\t};\n}\n\nfunction readLegacyErrorEntry(body: object): object | undefined {\n\tconst errors = Reflect.get(body, \"errors\");\n\tif (!Array.isArray(errors)) {\n\t\treturn undefined;\n\t}\n\n\tconst [first] = errors;\n\tif (typeof first !== \"object\" || first === null) {\n\t\treturn undefined;\n\t}\n\n\treturn first;\n}\n\nfunction extractLegacyCode(body: object): string | undefined {\n\tconst first = readLegacyErrorEntry(body);\n\tif (first === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst code = Reflect.get(first, \"code\");\n\tif (typeof code === \"string\") {\n\t\treturn code;\n\t}\n\n\treturn typeof code === \"number\" ? String(code) : undefined;\n}\n\nfunction extractLegacyMessage(body: object): string | undefined {\n\tconst first = readLegacyErrorEntry(body);\n\tif (first === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst message = Reflect.get(first, \"message\");\n\treturn typeof message === \"string\" ? message : undefined;\n}\n\nfunction formatApiErrorMessage(parts: ApiErrorMessageParts): string {\n\tconst { code, message, status } = parts;\n\tconst base = `HTTP ${status}`;\n\tif (message === undefined && code === undefined) {\n\t\treturn base;\n\t}\n\n\tif (message === undefined) {\n\t\treturn `${base} (code ${code})`;\n\t}\n\n\tif (code === undefined) {\n\t\treturn `${base}: ${message}`;\n\t}\n\n\treturn `${base}: ${message} (code ${code})`;\n}\n\nfunction createApiError(status: number, body: JSONValue | undefined): ApiError {\n\tconst code = extractErrorCode(body);\n\tconst message = extractErrorMessage(body);\n\treturn new ApiError(formatApiErrorMessage({ code, message, status }), {\n\t\tcode,\n\t\tdetails: body,\n\t\tstatusCode: status,\n\t});\n}\n\nfunction createRateLimitError(response: Response): RateLimitError {\n\treturn new RateLimitError(\"Rate limited\", {\n\t\tretryAfterSeconds: parseRetryAfterSeconds(\n\t\t\tresponse.headers.get(\"x-ratelimit-reset\") ?? undefined,\n\t\t),\n\t});\n}\n\nasync function readResponseBody(\n\tresponse: Response,\n): Promise<Result<JSONValue | undefined, OpenCloudError>> {\n\ttry {\n\t\tconst text = await response.text();\n\t\treturn { data: text === \"\" ? undefined : JSON.parse(text), success: true };\n\t} catch {\n\t\treturn {\n\t\t\terr: new ApiError(\"Failed to parse response body\", { statusCode: response.status }),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n}\n\n/**\n * Classifies a fetch `Response` into a typed `Result`.\n *\n * @param response - The raw fetch Response to classify.\n * @returns A Result containing an HttpResponse on success or an OpenCloudError on failure.\n */\nasync function classifyResponse(response: Response): Promise<Result<HttpResponse, OpenCloudError>> {\n\tif (response.status === 429) {\n\t\treturn { err: createRateLimitError(response), success: false };\n\t}\n\n\tconst bodyResult = await readResponseBody(response);\n\tif (!bodyResult.success) {\n\t\treturn bodyResult;\n\t}\n\n\tif (response.status >= 300) {\n\t\treturn { err: createApiError(response.status, bodyResult.data), success: false };\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbody: bodyResult.data,\n\t\t\theaders: headersToRecord(response.headers),\n\t\t\tstatus: response.status,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n","import { setTimeout } from \"node:timers/promises\";\n\nimport type { HttpClient, SleepFunc } from \"../../client/types.ts\";\nimport { createFetchHttpClient } from \"./fetch-client.ts\";\n\n/**\n * Options accepted by {@link resolveDependencies}. Mirrors the test-seam\n * subset of the public client options.\n */\ninterface ResolveDependenciesOptions {\n\t/** Test seam: custom {@link HttpClient}. Defaults to a fetch-backed client. */\n\treadonly httpClient?: HttpClient | undefined;\n\t/** Test seam: custom {@link SleepFunc}. Defaults to a `setTimeout`-backed sleep. */\n\treadonly sleep?: SleepFunc | undefined;\n}\n\n/**\n * Fully-populated dependency set consumed by resource client constructors.\n */\ninterface ResolvedDependencies {\n\t/** Concrete {@link HttpClient} implementation. */\n\treadonly httpClient: HttpClient;\n\t/** Concrete {@link SleepFunc} implementation. */\n\treadonly sleep: SleepFunc;\n}\n\n/**\n * Resolves the concrete HTTP client and sleep implementation a resource\n * client should use. Falls back to the fetch-backed HTTP client and the\n * default `setTimeout`-based sleep when the caller omits the test seams.\n *\n * Extracted so resource client constructors can keep their dependency\n * resolution logic in a single, unit-testable place; this makes the\n * default branches easy to cover without stubbing globals like `fetch`.\n *\n * @param options - Optional {@link HttpClient} and {@link SleepFunc} test seams.\n * @returns A {@link ResolvedDependencies} with defaults applied.\n */\nexport function resolveDependencies(options: ResolveDependenciesOptions): ResolvedDependencies {\n\treturn {\n\t\thttpClient: options.httpClient ?? createFetchHttpClient(),\n\t\tsleep: options.sleep ?? setTimeout,\n\t};\n}\n","import type { Except } from \"type-fest\";\n\nimport type {\n\tHttpClient,\n\tHttpRequest,\n\tHttpResponse,\n\tOpenCloudClientOptions,\n\tOpenCloudHooks,\n\tRequestOptions,\n\tSleepFunc,\n} from \"../client/types.ts\";\nimport { ApiError } from \"../errors/api-error.ts\";\nimport type { OpenCloudError } from \"../errors/base.ts\";\nimport { PermissionError } from \"../errors/permission-error.ts\";\nimport type { Result } from \"../types.ts\";\nimport { executeWithRetry } from \"./http/execute.ts\";\nimport { type OperationLimit, RateLimitQueue } from \"./http/rate-limit-queue.ts\";\nimport { resolveDependencies } from \"./http/resolve-dependencies.ts\";\nimport {\n\tdefaultRetryDelay,\n\tIDEMPOTENT_METHOD_DEFAULTS,\n\tmergeConfig,\n\ttype MethodKind,\n\ttype RetryResolvable,\n} from \"./http/retry.ts\";\n\n/**\n * Describes a single resource method's shape for dispatch through\n * `ResourceClient.execute`. Each resource client declares one module-level\n * constant per public method; that constant binds the four resource-specific\n * values (request builder, response parser, retry-policy method kind,\n * operation-level rate limit) and flows through `execute` uniformly.\n *\n * @template P - The resource-specific parameter shape the builder\n * accepts.\n * @template T - The resource-specific parsed success type the parser\n * produces.\n */\nexport interface ResourceMethodSpec<P, T> {\n\t/**\n\t * Builds the pure {@link HttpRequest} for a single call. Returns a\n\t * {@link Result} so a builder can short-circuit with a local error\n\t * (typically a {@link OpenCloudError} subclass such as `ValidationError`)\n\t * before any HTTP, queue, or retry work happens. Builders that cannot\n\t * fail wrap their return as `{ data: request, success: true }`.\n\t */\n\treadonly buildRequest: (parameters: P) => Result<HttpRequest, OpenCloudError>;\n\t/** Method-level retry defaults merged into the resolved config. */\n\treadonly methodDefaults: Partial<RetryResolvable>;\n\t/**\n\t * Method kind, controlling merge precedence: `\"create\"` lets method\n\t * defaults win over client config so create safety cannot be relaxed\n\t * silently; `\"idempotent\"` lets client config win over method defaults\n\t * so consumers can loosen retry globally.\n\t */\n\treadonly methodKind: MethodKind;\n\t/** Operation-level rate limit, keyed into the client's per-key queue map. */\n\treadonly operationLimit: OperationLimit;\n\t/**\n\t * Converts the full {@link HttpResponse} into the resource-specific\n\t * parsed shape. Takes the whole response (body, status, headers) so\n\t * future parsers can read headers without widening the signature.\n\t */\n\treadonly parse: (response: HttpResponse) => Result<T, OpenCloudError>;\n\t/**\n\t * Open Cloud scopes the API key or OAuth token must carry for this\n\t * method, sourced from the vendored OpenAPI schema's `x-roblox-scopes`.\n\t * When set, a 401 or 403 ApiError from the upstream call is upgraded to\n\t * a {@link PermissionError} carrying these scopes alongside\n\t * {@link OperationLimit.operationKey}, so callers can name the missing\n\t * scope instead of just the HTTP status. Optional so test specs and\n\t * not-yet-wired resources can opt out.\n\t */\n\treadonly requiredScopes?: ReadonlyArray<string>;\n}\n\n/**\n * Single-argument bundle consumed by `ResourceClient.execute`: the per-method\n * spec, the resource-specific parameters, and optional per-request config\n * overrides.\n *\n * @template P - The resource-specific parameter shape the builder accepts.\n * @template T - The resource-specific parsed success type the parser produces.\n */\ninterface ExecuteCall<P, T> {\n\t/** Optional per-request config overrides. */\n\treadonly options?: RequestOptions | undefined;\n\t/** Resource-specific request parameters. */\n\treadonly parameters: P;\n\t/** Per-method binding of builder, parser, method kind, and operation limit. */\n\treadonly spec: ResourceMethodSpec<P, T>;\n}\n\n/**\n * Wraps an infallible request build as a {@link Result}-returning\n * `buildRequest` callback compatible with {@link ResourceMethodSpec}.\n * Use from a resource client whose builder cannot fail; resource clients\n * with local validation should construct the {@link Result} directly.\n *\n * @param request - The pre-built {@link HttpRequest}.\n * @returns A success Result wrapping the request.\n */\nexport function okRequest(request: HttpRequest): Result<HttpRequest, OpenCloudError> {\n\treturn { data: request, success: true };\n}\n\n/**\n * A {@link ResourceMethodSpec.parse} implementation for endpoints that return\n * no business payload on success (such as `DELETE` and reorder operations).\n * Surfaces `undefined` data and never inspects the response body.\n *\n * @returns A success Result with `undefined` data.\n */\nexport function parseEmptyResponse(): Result<undefined, OpenCloudError> {\n\treturn { data: undefined, success: true };\n}\n\nconst CLIENT_DEFAULTS = Object.freeze({\n\tbaseUrl: \"https://apis.roblox.com\",\n\tmaxRetries: 3,\n\tretryableStatuses: IDEMPOTENT_METHOD_DEFAULTS.retryableStatuses,\n\tretryDelay: defaultRetryDelay,\n\ttimeout: 30_000,\n} satisfies Except<RetryResolvable, \"apiKey\">);\n\n/**\n * Internal orchestrator shared by every Open Cloud resource client. Holds\n * the frozen client config, observability hooks, injected HTTP client and\n * sleep, and the per-effective-key rate-limit queue registry. Resource\n * classes compose one instance and dispatch every public method through\n * {@link ResourceClient.execute} with a per-method {@link ResourceMethodSpec}.\n * Not exported from any package subpath; reachable only via sibling\n * `src/resources/**` modules in this package.\n */\nexport class ResourceClient {\n\treadonly #config: Readonly<RetryResolvable>;\n\treadonly #hooks: OpenCloudHooks;\n\treadonly #httpClient: HttpClient;\n\treadonly #queues = new Map<string, RateLimitQueue>();\n\treadonly #sleep: SleepFunc;\n\n\t/**\n\t * Creates a new {@link ResourceClient}. Resolves the injected HTTP\n\t * client and sleep (defaulting to fetch + `setTimeout`) and freezes the\n\t * merged client config so subsequent calls cannot mutate it.\n\t *\n\t * @param options - Client-level configuration including the API key\n\t * and optional construction-time test seams.\n\t */\n\tconstructor(options: OpenCloudClientOptions) {\n\t\tconst { apiKey, hooks, httpClient, sleep, ...overrides } = options;\n\t\tconst resolved = resolveDependencies({ httpClient, sleep });\n\t\tthis.#httpClient = resolved.httpClient;\n\t\tthis.#sleep = resolved.sleep;\n\t\tthis.#hooks = hooks ?? {};\n\t\tthis.#config = Object.freeze({\n\t\t\t...CLIENT_DEFAULTS,\n\t\t\tapiKey,\n\t\t\t...overrides,\n\t\t});\n\t}\n\n\t/**\n\t * Dispatches a single resource-method call. Merges the frozen client\n\t * config with the method's `methodDefaults` and the caller's optional\n\t * per-request `options`, routes through the effective-apiKey rate-limit\n\t * queue, runs the retry loop, and finally parses the response with the\n\t * spec's parser.\n\t *\n\t * @param call - The per-method spec, resource-specific parameters, and\n\t * optional per-request overrides.\n\t * @returns The parsed success payload or the {@link OpenCloudError} that\n\t * caused the request to fail. Never throws.\n\t */\n\tpublic async execute<P, T>(call: ExecuteCall<P, T>): Promise<Result<T, OpenCloudError>> {\n\t\tconst { options, parameters, spec } = call;\n\t\tconst merged = mergeConfig(this.#config, {\n\t\t\tmethodDefaults: spec.methodDefaults,\n\t\t\tmethodKind: spec.methodKind,\n\t\t\trequestOptions: options ?? {},\n\t\t});\n\t\tconst requestResult = spec.buildRequest(parameters);\n\t\tif (!requestResult.success) {\n\t\t\treturn requestResult;\n\t\t}\n\n\t\tconst requestConfig = {\n\t\t\tapiKey: merged.apiKey,\n\t\t\tbaseUrl: merged.baseUrl,\n\t\t\ttimeout: merged.timeout,\n\t\t};\n\t\tconst queue = this.#getQueue(merged.apiKey, spec.operationLimit);\n\t\tconst httpResult = await queue.acquire(async () => {\n\t\t\treturn executeWithRetry(requestResult.data, {\n\t\t\t\tconfig: merged,\n\t\t\t\thooks: this.#hooks,\n\t\t\t\tsend: async (toSend) => this.#httpClient.request(toSend, requestConfig),\n\t\t\t\tsleep: this.#sleep,\n\t\t\t});\n\t\t});\n\t\tif (!httpResult.success) {\n\t\t\treturn { err: enrichPermissionError(httpResult.err, spec), success: false };\n\t\t}\n\n\t\treturn spec.parse(httpResult.data);\n\t}\n\n\t/**\n\t * Returns the sleep function used by this client instance.\n\t *\n\t * @returns The sleep function injected at construction time.\n\t */\n\tpublic get sleep(): SleepFunc {\n\t\treturn this.#sleep;\n\t}\n\n\t#getQueue(apiKey: string, limit: OperationLimit): RateLimitQueue {\n\t\tconst key = `${apiKey}::${limit.operationKey}`;\n\t\tconst existing = this.#queues.get(key);\n\t\tif (existing !== undefined) {\n\t\t\treturn existing;\n\t\t}\n\n\t\tconst queue = new RateLimitQueue(limit, this.#hooks, this.#sleep);\n\t\tthis.#queues.set(key, queue);\n\t\treturn queue;\n\t}\n}\n\nfunction enrichPermissionError<P, T>(\n\terr: OpenCloudError,\n\tspec: ResourceMethodSpec<P, T>,\n): OpenCloudError {\n\tif (spec.requiredScopes === undefined) {\n\t\treturn err;\n\t}\n\n\tif (err instanceof PermissionError) {\n\t\treturn err;\n\t}\n\n\tif (!(err instanceof ApiError)) {\n\t\treturn err;\n\t}\n\n\tif (err.statusCode !== 401 && err.statusCode !== 403) {\n\t\treturn err;\n\t}\n\n\treturn new PermissionError(err.message, {\n\t\tcause: err.cause,\n\t\tcode: err.code,\n\t\toperationKey: spec.operationLimit.operationKey,\n\t\trequiredScopes: spec.requiredScopes,\n\t\tstatusCode: err.statusCode,\n\t});\n}\n"],"mappings":";;;;;;;;;;;;AASA,SAAgB,SAAS,OAAkD;AAC1E,QAAO,OAAO,UAAU,SAAS,KAAK,MAAM,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se, s as RequestOptions } from "./types-Cp8w8uwA.mjs";
1
+ import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, n as HttpRequest, r as HttpResponse, s as RequestOptions, u as SleepFunc } from "./types-DUzm6maA.mjs";
2
2
 
3
3
  //#region src/domains/cloud-v2/memory-store-queues/types.d.ts
4
4
  /**
@@ -260,6 +260,12 @@ declare class ResourceClient {
260
260
  * caused the request to fail. Never throws.
261
261
  */
262
262
  execute<P, T>(call: ExecuteCall<P, T>): Promise<Result<T, OpenCloudError>>;
263
+ /**
264
+ * Returns the sleep function used by this client instance.
265
+ *
266
+ * @returns The sleep function injected at construction time.
267
+ */
268
+ get sleep(): SleepFunc;
263
269
  }
264
270
  //#endregion
265
271
  //#region src/resources/storage/queues-group.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.mts","names":[],"sources":["../src/domains/cloud-v2/memory-store-queues/types.ts","../src/internal/http/rate-limit-queue.ts","../src/internal/http/retry.ts","../src/internal/resource-client.ts","../src/resources/storage/queues-group.ts","../src/resources/storage/client.ts"],"mappings":";;;;;;AAIA;UAAiB,0BAAA;;;;;;;WAOP,IAAA,EAAM,OAAA,CAAQ,SAAA;;;;;AAwBxB;WAlBU,QAAA;;WAEA,OAAA;;;;;;WAMA,GAAA;;WAEA,UAAA;AAAA;;;;;;UAQO,SAAA;EAsBjB;EAAA,SApBU,EAAA;;;;;WAKA,IAAA,EAAM,OAAA,CAAQ,SAAA;;WAEd,SAAA,EAAW,IAAA;;WAEX,QAAA;EAyCV;EAAA,SAvCU,OAAA;;WAEA,UAAA;AAAA;;;;;UAOO,2BAAA;EA+CjB;;;;;EAAA,SAzCU,YAAA;;;;;WAKA,KAAA;;AC7DV;;;;WDmEU,kBAAA;;WAEA,OAAA;;WAEA,UAAA;AAAA;;;;;;;UASO,aAAA;;WAEP,KAAA,EAAO,aAAA,CAAc,SAAA;;;;AE3C/B;WFgDU,MAAA;AAAA;;;;;;AGxDV;;UHkEiB,2BAAA;;WAEP,OAA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,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,aAAA,EAAe,cAAA;;;AJ7BlC;;;;;;;;;;AAiBA;;;;;EIiCC,OAAA,CACC,UAAA,EAAY,2BAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,YAAkB,cAAA;;;;;;;AHrI9B;;;;;;;;ACIA;EEoJC,OAAA,CACC,UAAA,EAAY,0BAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,SAAA,EAAW,cAAA;AAAA;;;;AJ9J9B;;;;;;;;;;;;;AA+BA;;;;;cKZa,aAAA;;WAEI,MAAA,EAAQ,sBAAA;;;;;;;EAQxB,WAAA,CAAY,OAAA,EAAS,sBAAA;AAAA"}
1
+ {"version":3,"file":"storage.d.mts","names":[],"sources":["../src/domains/cloud-v2/memory-store-queues/types.ts","../src/internal/http/rate-limit-queue.ts","../src/internal/http/retry.ts","../src/internal/resource-client.ts","../src/resources/storage/queues-group.ts","../src/resources/storage/client.ts"],"mappings":";;;;;;AAIA;UAAiB,0BAAA;;;;;;;WAOP,IAAA,EAAM,OAAA,CAAQ,SAAA;;;;;AAwBxB;WAlBU,QAAA;;WAEA,OAAA;;;;;;WAMA,GAAA;;WAEA,UAAA;AAAA;;;;;;UAQO,SAAA;EAsBjB;EAAA,SApBU,EAAA;;;;;WAKA,IAAA,EAAM,OAAA,CAAQ,SAAA;;WAEd,SAAA,EAAW,IAAA;;WAEX,QAAA;EAyCV;EAAA,SAvCU,OAAA;;WAEA,UAAA;AAAA;;;;;UAOO,2BAAA;EA+CjB;;;;;EAAA,SAzCU,YAAA;;;;;WAKA,KAAA;;AC7DV;;;;WDmEU,kBAAA;;WAEA,OAAA;;WAEA,UAAA;AAAA;;;;;;;UASO,aAAA;;WAEP,KAAA,EAAO,aAAA,CAAc,SAAA;;;;AE3C/B;WFgDU,MAAA;AAAA;;;;;;AGxDV;;UHkEiB,2BAAA;;WAEP,OAAA;;WAEA,MAA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,EAAY,2BAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,aAAA,EAAe,cAAA;;;AJ7BlC;;;;;;;;;;AAiBA;;;;;EIiCC,OAAA,CACC,UAAA,EAAY,2BAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,YAAkB,cAAA;;;;;;;AHrI9B;;;;;;;;ACIA;EEoJC,OAAA,CACC,UAAA,EAAY,0BAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,SAAA,EAAW,cAAA;AAAA;;;;AJ9J9B;;;;;;;;;;;;;AA+BA;;;;;cKZa,aAAA;;WAEI,MAAA,EAAQ,sBAAA;;;;;;;EAQxB,WAAA,CAAY,OAAA,EAAS,sBAAA;AAAA"}
package/dist/storage.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as ApiError } from "./rate-limit-CKfuhxT1.mjs";
2
- import { t as isDateTimeString } from "./is-date-time-string-Cuf1TaSC.mjs";
3
- import { a as IDEMPOTENT_METHOD_DEFAULTS, i as CREATE_METHOD_DEFAULTS, n as okRequest, o as isRecord, r as parseEmptyResponse, t as ResourceClient } from "./resource-client-Wi4Mwqy5.mjs";
2
+ import { t as isDateTimeString } from "./is-date-time-string-Ds8Ew-Xa.mjs";
3
+ import { a as IDEMPOTENT_METHOD_DEFAULTS, i as CREATE_METHOD_DEFAULTS, n as okRequest, r as parseEmptyResponse, s as isRecord, t as ResourceClient } from "./resource-client-opC6BUkL.mjs";
4
4
  //#region src/domains/cloud-v2/memory-store-queues/builders.ts
5
5
  /**
6
6
  * Builds a `POST` request for the Open Cloud
@@ -15,4 +15,4 @@ function toBlob(value) {
15
15
  //#endregion
16
16
  export { toBlob as t };
17
17
 
18
- //# sourceMappingURL=to-blob-1BtHsDGK.mjs.map
18
+ //# sourceMappingURL=to-blob-DHN7UoM8.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-blob-1BtHsDGK.mjs","names":[],"sources":["../src/internal/utils/to-blob.ts"],"sourcesContent":["/**\n * Wraps a binary value as a {@link Blob}, copying `Uint8Array` input into a\n * fresh `Blob` so the originating buffer cannot be mutated between request\n * build and send. `Blob` input is returned as-is so MIME-type metadata is\n * preserved.\n *\n * @param value - Binary data to convert.\n * @returns The supplied `Blob`, or a new `Blob` wrapping a defensive copy.\n */\nexport function toBlob(value: Blob | Uint8Array): Blob {\n\tif (value instanceof Blob) {\n\t\treturn value;\n\t}\n\n\treturn new Blob([new Uint8Array(value)]);\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,OAAO,OAAgC;AACtD,KAAI,iBAAiB,KACpB,QAAO;AAGR,QAAO,IAAI,KAAK,CAAC,IAAI,WAAW,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"to-blob-DHN7UoM8.mjs","names":[],"sources":["../src/internal/utils/to-blob.ts"],"sourcesContent":["/**\n * Wraps a binary value as a {@link Blob}, copying `Uint8Array` input into a\n * fresh `Blob` so the originating buffer cannot be mutated between request\n * build and send. `Blob` input is returned as-is so MIME-type metadata is\n * preserved.\n *\n * @param value - Binary data to convert.\n * @returns The supplied `Blob`, or a new `Blob` wrapping a defensive copy.\n */\nexport function toBlob(value: Blob | Uint8Array): Blob {\n\tif (value instanceof Blob) {\n\t\treturn value;\n\t}\n\n\treturn new Blob([new Uint8Array(value)]);\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,OAAO,OAAgC;AACtD,KAAI,iBAAiB,KACpB,QAAO;AAGR,QAAO,IAAI,KAAK,CAAC,IAAI,WAAW,MAAM,CAAC,CAAC"}
@@ -211,4 +211,4 @@ type RequestOptions = Partial<Pick<OpenCloudClientOptions, "apiKey" | "baseUrl"
211
211
  type HttpRequestBody = FormData | Record<string, unknown> | Uint8Array<ArrayBuffer> | undefined;
212
212
  //#endregion
213
213
  export { OpenCloudHooks as a, Page as c, OpenCloudError as d, OpenCloudClientOptions as i, Result as l, HttpRequest as n, RequestConfig as o, HttpResponse as r, RequestOptions as s, HttpClient as t, SleepFunc as u };
214
- //# sourceMappingURL=types-Cp8w8uwA.d.mts.map
214
+ //# sourceMappingURL=types-DUzm6maA.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-Cp8w8uwA.d.mts","names":[],"sources":["../src/errors/base.ts","../src/internal/utils/sleep.ts","../src/types.ts","../src/client/types.ts"],"mappings":";;AAMA;;;;;cAAa,cAAA,SAAuB,KAAA;EAAA,kBACV,IAAA;AAAA;;;;KCNd,SAAA,IAAa,EAAA,aAAe,OAAA;;;;ADKxC;;;;;;;;ACLA;;;;;;;;ACiCA;;;;;;;;;;;;;;;;;KAAY,MAAA,QAAc,KAAA;EAAW,IAAA,EAAM,CAAA;EAAG,OAAA;AAAA;EAAoB,GAAA,EAAK,CAAA;EAAG,OAAA;AAAA;;;;;;;ACzB1E;;;;;;;;;;;;;;;;;AAkBA;;;UDmCiB,IAAA;;WAEP,KAAA,EAAO,aAAA,CAAc,CAAA;;WAErB,aAAA;AAAA;;;;;;UCzDO,WAAA;;WAEP,IAAA,GAAO,eAAA;EFVL;;;;;EAAA,SEgBF,OAAA,GAAU,QAAA,CAAS,MAAA;;WAEnB,MAAA;EDeE;EAAA,SCbF,GAAA;AAAA;;;;UAMO,YAAA;;;;;;WAMP,IAAA;;WAEA,OAAA,EAAS,QAAA,CAAS,MAAA;;WAElB,MAAA;AAAA;ADyBV;;;AAAA,UCnBiB,aAAA;;WAEP,MAAA;;WAEA,OAAA;;WAEA,OAAA;AAAA;;;;AAxCV;UA+CiB,UAAA;;EAEhB,OAAA,CACC,OAAA,EAAS,WAAA,EACT,MAAA,EAAQ,aAAA,GACN,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,cAAA;AAAA;;;;;UAOhB,cAAA;;WAEP,WAAA,IAAe,MAAA;;WAEf,SAAA,IAAa,OAAA,EAAS,WAAA;;WAEtB,OAAA,IAAW,OAAA,UAAiB,KAAA,EAAO,cAAA;AAAA;AA/C7C;;;;AAAA,UAsDi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;;EAEhB,OAAA,CACC,OAAA,EAAS,WAAA,EACT,MAAA,EAAQ,aAAA,GACN,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,cAAA;AAAA;;;;;UAOhB,cAAA;;WAEP,WAAA,IAAe,MAAA;;WAEf,SAAA,IAAa,OAAA,EAAS,WAAA;;WAEtB,OAAA,IAAW,OAAA,UAAiB,KAAA,EAAO,cAAA;AAAA;AA/C7C;;;;AAAA,UAsDiB,sBAAA;;WAEP,MAAA;;WAEA,OAAA;;WAEA,KAAA,GAAQ,cAAA;EA5ClB;;;;;;;EAAA,SAoDU,UAAA,GAAa,UAAA;EA9Cb;EAAA,SAgDA,UAAA;EAzCO;;;;;EAAA,SA+CP,iBAAA,GAAoB,aAAA;;WAEpB,UAAA,IAAc,OAAA;;;;;;;WAOd,KAAA,GAAQ,SAAA;;WAER,OAAA;AAAA;;;;AA9CV;;KAsDY,cAAA,GAAiB,OAAA,CAC5B,IAAA,CACC,sBAAA;;;;;;;;;;;;KAgBG,eAAA,GAAkB,QAAA,GAAW,MAAA,oBAA0B,UAAA,CAAW,WAAA"}
@@ -1,5 +1,5 @@
1
- import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, s as RequestOptions } from "./types-Cp8w8uwA.mjs";
2
- import { i as RobloxLocale, r as RobloxLanguageCode } from "./data.generated-BtkDGH8C.mjs";
1
+ import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, s as RequestOptions } from "./types-DUzm6maA.mjs";
2
+ import { i as RobloxLocale, r as RobloxLanguageCode } from "./data.generated-DOaDx6J0.mjs";
3
3
 
4
4
  //#region src/domains/cloud-v2/universes/types.d.ts
5
5
  /**
@@ -1,8 +1,8 @@
1
1
  import { i as ApiError } from "./rate-limit-CKfuhxT1.mjs";
2
- import { t as ValidationError } from "./validation-b7KAoEio.mjs";
3
- import { t as toBlob } from "./to-blob-1BtHsDGK.mjs";
4
- import { t as isDateTimeString } from "./is-date-time-string-Cuf1TaSC.mjs";
5
- import { a as IDEMPOTENT_METHOD_DEFAULTS, i as CREATE_METHOD_DEFAULTS, n as okRequest, o as isRecord, r as parseEmptyResponse, t as ResourceClient } from "./resource-client-Wi4Mwqy5.mjs";
2
+ import { t as ValidationError } from "./validation-VImVHzxg.mjs";
3
+ import { t as toBlob } from "./to-blob-DHN7UoM8.mjs";
4
+ import { t as isDateTimeString } from "./is-date-time-string-Ds8Ew-Xa.mjs";
5
+ import { a as IDEMPOTENT_METHOD_DEFAULTS, i as CREATE_METHOD_DEFAULTS, n as okRequest, r as parseEmptyResponse, s as isRecord, t as ResourceClient } from "./resource-client-opC6BUkL.mjs";
6
6
  //#region src/domains/cloud-v2/universes/builders.ts
7
7
  /**
8
8
  * Dodges `unicorn/no-null` while still emitting a literal `null` onto
@@ -35,4 +35,4 @@ var ValidationError = class extends OpenCloudError {
35
35
  //#endregion
36
36
  export { ValidationError as t };
37
37
 
38
- //# sourceMappingURL=validation-b7KAoEio.mjs.map
38
+ //# sourceMappingURL=validation-VImVHzxg.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation-b7KAoEio.mjs","names":[],"sources":["../src/errors/validation.ts"],"sourcesContent":["import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Closed discriminator for a {@link ValidationError}. Consumers can\n * exhaustively `switch` over this union so TypeScript will refuse to compile\n * if a new variant is added without a handler.\n */\nexport type ValidationErrorCode =\n\t| \"empty_body\"\n\t| \"empty_image_ids\"\n\t| \"empty_update\"\n\t| \"format_mismatch\"\n\t| \"incomplete_ref\"\n\t| \"invalid_image_id\";\n\n/**\n * Options for constructing a {@link ValidationError}.\n */\nexport interface ValidationErrorOptions extends ErrorOptions {\n\t/** Machine-readable discriminator identifying the validation failure. */\n\tcode: ValidationErrorCode;\n}\n\n/**\n * Thrown locally when caller-supplied input is rejected before any HTTP\n * round-trip. The `code` discriminator lets consumers branch on local-input\n * errors separately from server-side errors.\n *\n * @example\n *\n * ```ts\n * import { ValidationError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new ValidationError(\"Place body is empty\", {\n * code: \"empty_body\",\n * });\n *\n * expect(error).toBeInstanceOf(ValidationError);\n * expect(error.code).toBe(\"empty_body\");\n * ```\n */\nexport class ValidationError extends OpenCloudError {\n\tpublic readonly code: ValidationErrorCode;\n\tpublic override readonly name: string = \"ValidationError\";\n\n\t/**\n\t * Creates a new ValidationError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the validation failure code.\n\t */\n\tconstructor(message: string, options: ValidationErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.code = options.code;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,kBAAb,cAAqC,eAAe;CACnD;CACA,OAAwC;;;;;;;CAQxC,YAAY,SAAiB,SAAiC;AAC7D,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO,QAAQ"}
1
+ {"version":3,"file":"validation-VImVHzxg.mjs","names":[],"sources":["../src/errors/validation.ts"],"sourcesContent":["import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Closed discriminator for a {@link ValidationError}. Consumers can\n * exhaustively `switch` over this union so TypeScript will refuse to compile\n * if a new variant is added without a handler.\n */\nexport type ValidationErrorCode =\n\t| \"empty_body\"\n\t| \"empty_image_ids\"\n\t| \"empty_update\"\n\t| \"format_mismatch\"\n\t| \"incomplete_ref\"\n\t| \"invalid_image_id\";\n\n/**\n * Options for constructing a {@link ValidationError}.\n */\nexport interface ValidationErrorOptions extends ErrorOptions {\n\t/** Machine-readable discriminator identifying the validation failure. */\n\tcode: ValidationErrorCode;\n}\n\n/**\n * Thrown locally when caller-supplied input is rejected before any HTTP\n * round-trip. The `code` discriminator lets consumers branch on local-input\n * errors separately from server-side errors.\n *\n * @example\n *\n * ```ts\n * import { ValidationError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new ValidationError(\"Place body is empty\", {\n * code: \"empty_body\",\n * });\n *\n * expect(error).toBeInstanceOf(ValidationError);\n * expect(error.code).toBe(\"empty_body\");\n * ```\n */\nexport class ValidationError extends OpenCloudError {\n\tpublic readonly code: ValidationErrorCode;\n\tpublic override readonly name: string = \"ValidationError\";\n\n\t/**\n\t * Creates a new ValidationError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the validation failure code.\n\t */\n\tconstructor(message: string, options: ValidationErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.code = options.code;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,kBAAb,cAAqC,eAAe;CACnD;CACA,OAAwC;;;;;;;CAQxC,YAAY,SAAiB,SAAiC;AAC7D,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock-rbx/ocale",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "Roblox Open Cloud API client",
5
5
  "keywords": [
6
6
  "api",