@bedrock-rbx/ocale 0.3.2 → 0.3.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"universes.mjs","names":["#inner"],"sources":["../src/domains/cloud-v2/universes/builders.ts","../src/domains/cloud-v2/universes/operations.ts","../src/domains/cloud-v2/universes/parsers.ts","../src/domains/game-internationalization/game-icon/builders.ts","../src/domains/game-internationalization/game-icon/operations.ts","../src/domains/game-internationalization/game-icon/parsers.ts","../src/domains/game-internationalization/game-thumbnails/builders.ts","../src/domains/game-internationalization/game-thumbnails/operations.ts","../src/domains/game-internationalization/game-thumbnails/parsers.ts","../src/resources/universes/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport type { OpenCloudError } from \"../../../errors/base.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport { okRequest } from \"../../../internal/resource-client.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { GetUniverseParameters, UpdateUniverseParameters } from \"./types.ts\";\n\n/**\n * Dodges `unicorn/no-null` while still emitting a literal `null` onto\n * the wire, which the Open Cloud `Cloud_UpdateUniverse` endpoint\n * requires to clear a nullable field (for example disabling private\n * servers or removing a social link).\n */\nconst NULL_SENTINEL = JSON.parse(\"null\");\n\n/**\n * Builds a `GET` request for the Open Cloud \"get universe\" endpoint.\n *\n * @param parameters - The universe identifier.\n * @returns A success result wrapping the request; the builder cannot fail.\n */\nexport function buildGetRequest(\n\tparameters: GetUniverseParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest({\n\t\tmethod: \"GET\",\n\t\turl: `/cloud/v2/universes/${parameters.universeId}`,\n\t});\n}\n\n/**\n * Builds a `PATCH` request for the Open Cloud \"update universe\"\n * endpoint. Derives the `updateMask` query string from the keys\n * present on `parameters` and emits a JSON body containing those same\n * fields, translating `undefined` values to JSON `null` so Roblox\n * clears the corresponding server-side value.\n *\n * @param parameters - The universe identifier plus the fields to update.\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when no updatable fields were supplied.\n */\nexport function buildUpdateRequest(\n\tparameters: UpdateUniverseParameters,\n): Result<HttpRequest, ValidationError> {\n\tconst fieldKeys = extractUpdateFieldKeys(parameters);\n\n\tif (fieldKeys.length === 0) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Update must include at least one field\", {\n\t\t\t\tcode: \"empty_update\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst body: Record<string, unknown> = {};\n\tfor (const key of fieldKeys) {\n\t\tbody[key] = bodyValueFor(parameters, key);\n\t}\n\n\tconst updateMask = fieldKeys.join(\",\");\n\treturn {\n\t\tdata: {\n\t\t\tbody,\n\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t\tmethod: \"PATCH\",\n\t\t\turl: `/cloud/v2/universes/${parameters.universeId}?updateMask=${updateMask}`,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction extractUpdateFieldKeys(parameters: UpdateUniverseParameters): ReadonlyArray<string> {\n\treturn Object.keys(parameters).filter((key) => key !== \"universeId\");\n}\n\nfunction bodyValueFor(parameters: UpdateUniverseParameters, key: string): unknown {\n\tconst value = Reflect.get(parameters, key);\n\treturn value === undefined ? NULL_SENTINEL : value;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst PER_MINUTE = 100;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for reading a universe, from the Open\n * Cloud OpenAPI schema (100 requests per minute per API key owner).\n */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"universes.get\",\n});\n\n/**\n * Per-second request ceiling for updating a universe, from the Open\n * Cloud OpenAPI schema (100 requests per minute per API key owner).\n * Keyed independently from {@link GET_OPERATION_LIMIT} so reads and\n * updates do not share a queue; upstream quota accounting is not\n * documented as shared and the conservative default is fewer\n * cross-method contention surprises.\n */\nexport const UPDATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"universes.update\",\n});\n\n/**\n * Scopes required to update a universe, sourced from `x-roblox-scopes`\n * on the `Cloud_UpdateUniverse` operation in the vendored OpenAPI schema.\n * `Cloud_GetUniverse` declares no scope, so the GET method intentionally\n * does not declare `requiredScopes` and a 401/403 there surfaces as a\n * generic ApiError.\n */\nexport const UPDATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\"universe:write\"]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isDateTimeString } from \"../../../internal/utils/is-date-time-string.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type {\n\tSocialLink,\n\tUniverse,\n\tUniverseAgeRating,\n\tUniverseOwner,\n\tUniverseVisibility,\n} from \"./types.ts\";\nimport type { AgeRatingWire, SocialLinkWire, UniverseWire, VisibilityWire } from \"./wire.ts\";\n\nconst VISIBILITY_MAP: Readonly<Record<VisibilityWire, UniverseVisibility>> = {\n\tPRIVATE: \"private\",\n\tPUBLIC: \"public\",\n\tVISIBILITY_UNSPECIFIED: \"unspecified\",\n};\n\nconst AGE_RATING_MAP: Readonly<Record<AgeRatingWire, UniverseAgeRating>> = {\n\tAGE_RATING_9_PLUS: \"9Plus\",\n\tAGE_RATING_13_PLUS: \"13Plus\",\n\tAGE_RATING_17_PLUS: \"17Plus\",\n\tAGE_RATING_ALL: \"all\",\n\tAGE_RATING_UNSPECIFIED: \"unspecified\",\n};\n\nconst MALFORMED_MESSAGE = \"Malformed universe response\";\n\nconst UNIVERSE_PATH_PATTERN = /^universes\\/(\\d+)$/;\n\nconst ROOT_PLACE_PATH_PATTERN = /\\/places\\/(\\d+)$/;\n\nconst OWNER_PATH_PATTERN = /^(?:users|groups)\\/(\\d+)$/;\n\ninterface ToUniverseArgs {\n\treadonly id: string;\n\treadonly body: UniverseWire;\n\treadonly owner: UniverseOwner;\n}\n\n/**\n * Parses a successful Open Cloud `Universe` response body into the\n * public {@link Universe} shape.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link Universe}, or\n * an {@link ApiError} when the body does not match the wire schema.\n */\nexport function parseUniverseResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<Universe, ApiError> {\n\tif (!isUniverseWire(body)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst ownerResult = resolveOwner(body);\n\tif (!ownerResult.success) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst idMatch = UNIVERSE_PATH_PATTERN.exec(body.path);\n\tconst id = idMatch?.[1];\n\tif (id === undefined) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\treturn { data: toUniverse({ id, body, owner: ownerResult.data }), success: true };\n}\n\nfunction malformed(statusCode: number, body: unknown): Result<Universe, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n\nfunction extractRootPlaceId(rootPlace: string | undefined): string | undefined {\n\tif (rootPlace === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst match = ROOT_PLACE_PATH_PATTERN.exec(rootPlace);\n\treturn match?.[1];\n}\n\nfunction isSocialLinkWire(value: unknown): value is SocialLinkWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn typeof value[\"title\"] === \"string\" && typeof value[\"uri\"] === \"string\";\n}\n\nfunction toSocialLink(wire: unknown): SocialLink | undefined {\n\tif (!isSocialLinkWire(wire)) {\n\t\treturn undefined;\n\t}\n\n\treturn { title: wire.title, uri: wire.uri };\n}\n\nfunction toUniverse({ id, body, owner }: ToUniverseArgs): Universe {\n\treturn {\n\t\tid,\n\t\tageRating: AGE_RATING_MAP[body.ageRating],\n\t\tconsoleEnabled: body.consoleEnabled ?? false,\n\t\tcreatedAt: new Date(body.createTime),\n\t\tdescription: body.description,\n\t\tdesktopEnabled: body.desktopEnabled ?? false,\n\t\tdiscordSocialLink: toSocialLink(body.discordSocialLink),\n\t\tdisplayName: body.displayName,\n\t\tfacebookSocialLink: toSocialLink(body.facebookSocialLink),\n\t\tguildedSocialLink: toSocialLink(body.guildedSocialLink),\n\t\tmobileEnabled: body.mobileEnabled ?? false,\n\t\towner,\n\t\tprivateServerPriceRobux: body.privateServerPriceRobux ?? undefined,\n\t\trobloxGroupSocialLink: toSocialLink(body.robloxGroupSocialLink),\n\t\trootPlaceId: extractRootPlaceId(body.rootPlace),\n\t\ttabletEnabled: body.tabletEnabled ?? false,\n\t\ttwitchSocialLink: toSocialLink(body.twitchSocialLink),\n\t\ttwitterSocialLink: toSocialLink(body.twitterSocialLink),\n\t\tupdatedAt: new Date(body.updateTime),\n\t\tvisibility: VISIBILITY_MAP[body.visibility],\n\t\tvoiceChatEnabled: body.voiceChatEnabled ?? false,\n\t\tvrEnabled: body.vrEnabled ?? false,\n\t\tyoutubeSocialLink: toSocialLink(body.youtubeSocialLink),\n\t};\n}\n\nfunction isVisibilityWire(value: unknown): value is VisibilityWire {\n\treturn value === \"PRIVATE\" || value === \"PUBLIC\" || value === \"VISIBILITY_UNSPECIFIED\";\n}\n\nfunction isAgeRatingWire(value: unknown): value is AgeRatingWire {\n\treturn (\n\t\tvalue === \"AGE_RATING_13_PLUS\" ||\n\t\tvalue === \"AGE_RATING_17_PLUS\" ||\n\t\tvalue === \"AGE_RATING_9_PLUS\" ||\n\t\tvalue === \"AGE_RATING_ALL\" ||\n\t\tvalue === \"AGE_RATING_UNSPECIFIED\"\n\t);\n}\n\nfunction hasValidRequiredFields(body: Record<string, unknown>): boolean {\n\treturn (\n\t\ttypeof body[\"path\"] === \"string\" &&\n\t\tisDateTimeString(body[\"createTime\"]) &&\n\t\tisDateTimeString(body[\"updateTime\"]) &&\n\t\ttypeof body[\"displayName\"] === \"string\" &&\n\t\ttypeof body[\"description\"] === \"string\" &&\n\t\tisVisibilityWire(body[\"visibility\"]) &&\n\t\tisAgeRatingWire(body[\"ageRating\"])\n\t);\n}\n\nfunction isOptionalSocialLink(value: unknown): boolean {\n\treturn value === undefined || value === null || isSocialLinkWire(value);\n}\n\nfunction isOptionalBoolean(value: unknown): boolean {\n\treturn value === undefined || value === null || typeof value === \"boolean\";\n}\n\nfunction hasValidOptionalFields(body: Record<string, unknown>): boolean {\n\tconst priceField = body[\"privateServerPriceRobux\"] ?? undefined;\n\tif (priceField !== undefined && typeof priceField !== \"number\") {\n\t\treturn false;\n\t}\n\n\tconst rootPlace = body[\"rootPlace\"] ?? undefined;\n\tif (rootPlace !== undefined && typeof rootPlace !== \"string\") {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\tisOptionalBoolean(body[\"voiceChatEnabled\"]) &&\n\t\tisOptionalBoolean(body[\"desktopEnabled\"]) &&\n\t\tisOptionalBoolean(body[\"mobileEnabled\"]) &&\n\t\tisOptionalBoolean(body[\"tabletEnabled\"]) &&\n\t\tisOptionalBoolean(body[\"consoleEnabled\"]) &&\n\t\tisOptionalBoolean(body[\"vrEnabled\"]) &&\n\t\tisOptionalSocialLink(body[\"facebookSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"twitterSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"youtubeSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"twitchSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"discordSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"robloxGroupSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"guildedSocialLink\"])\n\t);\n}\n\nfunction isUniverseWire(body: unknown): body is UniverseWire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\treturn hasValidRequiredFields(body) && hasValidOptionalFields(body);\n}\n\nfunction extractOwnerId(resourcePath: string): string | undefined {\n\tconst match = OWNER_PATH_PATTERN.exec(resourcePath);\n\treturn match?.[1];\n}\n\nfunction resolveOwner(body: UniverseWire): Result<UniverseOwner, undefined> {\n\tif (typeof body.user === \"string\") {\n\t\tconst id = extractOwnerId(body.user);\n\t\tif (id !== undefined) {\n\t\t\treturn { data: { id, kind: \"user\" }, success: true };\n\t\t}\n\t}\n\n\tif (typeof body.group === \"string\") {\n\t\tconst id = extractOwnerId(body.group);\n\t\tif (id !== undefined) {\n\t\t\treturn { data: { id, kind: \"group\" }, success: true };\n\t\t}\n\t}\n\n\treturn { err: undefined, success: false };\n}\n","// The legacy `{gameId}` URL segment is in fact the universe ID; the public API\n// takes `universeId` and substitutes it into the path.\n\nimport type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type {\n\tDeleteExperienceIconParameters,\n\tListExperienceIconsParameters,\n\tUploadExperienceIconParameters,\n} from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the localized \"upload experience icon\"\n * endpoint. A successful upload replaces any existing icon for the same\n * `(universeId, languageCode)` pair.\n *\n * @param parameters - Universe and language identifiers plus the image\n * bytes to upload.\n * @returns A pure {@link HttpRequest} describing the upload call.\n */\nexport function buildUploadIconRequest(parameters: UploadExperienceIconParameters): HttpRequest {\n\tconst body = new FormData();\n\t// The legacy game-icon endpoint reads the upload from `request.files`.\n\tbody.append(\"request.files\", toBlob(parameters.image));\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\turl: `/legacy-game-internationalization/v1/game-icon/games/${parameters.universeId}/language-codes/${parameters.languageCode}`,\n\t};\n}\n\n/**\n * Builds a `DELETE` request for the localized \"delete experience icon\"\n * endpoint. Removing the source-language icon is rejected server-side;\n * deleting the icon for a non-source language clears that translation.\n *\n * @param parameters - Universe and language identifiers of the icon to\n * delete.\n * @returns A pure {@link HttpRequest} describing the delete call.\n */\nexport function buildDeleteIconRequest(parameters: DeleteExperienceIconParameters): HttpRequest {\n\treturn {\n\t\tmethod: \"DELETE\",\n\t\turl: `/legacy-game-internationalization/v1/game-icon/games/${parameters.universeId}/language-codes/${parameters.languageCode}`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the \"list experience icons\" endpoint. The\n * server returns one entry per locale that has an icon registered.\n *\n * @param parameters - Universe identifier whose icons to list.\n * @returns A pure {@link HttpRequest} describing the list call.\n */\nexport function buildListIconsRequest(parameters: ListExperienceIconsParameters): HttpRequest {\n\treturn {\n\t\tmethod: \"GET\",\n\t\turl: `/legacy-game-internationalization/v1/game-icon/games/${parameters.universeId}`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/**\n * Per-second request ceiling for every game-icon Operation bound on\n * `UniversesClient.icon`. The legacy `gameinternationalization` service caps\n * each API key at 100 requests per minute *shared across the entire service*\n * (see the `x-roblox-rate-limits` extension on every operation in the\n * vendored Open Cloud spec), so all methods queue against the same operation\n * key.\n */\nexport const ICON_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"experience-icon\",\n});\n\n/**\n * Scopes required for every game-icon operation, sourced from\n * `x-roblox-scopes` on the legacy `gameinternationalization` icon\n * endpoints in the vendored OpenAPI schema.\n */\nexport const ICON_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-universe:manage\",\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 { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { ExperienceIcon } from \"./types.ts\";\nimport type { GameIconListWire, GameIconState, GetGameIconResponseWire } from \"./wire.ts\";\n\n/**\n * Parses a successful icon-list response into a public array of\n * {@link ExperienceIcon} entries.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the converted icon list, or an\n * `ApiError` when the body does not match the wire schema.\n */\nexport function parseIconListResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<ReadonlyArray<ExperienceIcon>, ApiError> {\n\tif (!isGameIconListWire(body)) {\n\t\treturn {\n\t\t\terr: new ApiError(\"Malformed icon list response\", {\n\t\t\t\tdetails: toJsonDetails(body),\n\t\t\t\tstatusCode,\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn {\n\t\tdata: body.data.map(toExperienceIcon),\n\t\tsuccess: true,\n\t};\n}\n\nfunction isGameIconState(value: unknown): value is GameIconState {\n\treturn (\n\t\tvalue === \"Approved\" ||\n\t\tvalue === \"Error\" ||\n\t\tvalue === \"PendingReview\" ||\n\t\tvalue === \"Rejected\" ||\n\t\tvalue === \"UnAvailable\"\n\t);\n}\n\nfunction isGetGameIconResponseWire(value: unknown): value is GetGameIconResponseWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttypeof value[\"imageId\"] === \"string\" &&\n\t\ttypeof value[\"imageUrl\"] === \"string\" &&\n\t\ttypeof value[\"languageCode\"] === \"string\" &&\n\t\tisGameIconState(value[\"state\"])\n\t);\n}\n\nfunction isGameIconListWire(body: unknown): body is GameIconListWire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\tconst { data } = body;\n\tif (!Array.isArray(data)) {\n\t\treturn false;\n\t}\n\n\treturn data.every(isGetGameIconResponseWire);\n}\n\nfunction toExperienceIcon(wire: GetGameIconResponseWire): ExperienceIcon {\n\treturn {\n\t\timageId: wire.imageId,\n\t\timageUrl: wire.imageUrl,\n\t\tlanguageCode: wire.languageCode,\n\t\tstate: wire.state,\n\t};\n}\n","import { ValidationError } from \"../../../errors/validation.ts\";\nimport type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type {\n\tDeleteExperienceThumbnailParameters,\n\tReorderExperienceThumbnailsParameters,\n\tUploadExperienceThumbnailParameters,\n} from \"./types.ts\";\n\ntype ParsedIdsResult = Result<ReadonlyArray<number>, ValidationError>;\n\nconst POSITIVE_INTEGER_PATTERN = /^[1-9]\\d*$/;\n\n/**\n * Builds a `POST` request for the localized \"upload experience thumbnail\"\n * endpoint. Each successful upload appends a new entry to the carousel.\n *\n * @param parameters - Universe and language identifiers plus the image\n * bytes to upload.\n * @returns A pure {@link HttpRequest} describing the upload call.\n */\nexport function buildUploadThumbnailRequest(\n\tparameters: UploadExperienceThumbnailParameters,\n): HttpRequest {\n\tconst body = new FormData();\n\t// The legacy game-thumbnails endpoint reads the upload from\n\t// `gameThumbnailRequest.files`, distinct from game-icon's `request.files`.\n\tbody.append(\"gameThumbnailRequest.files\", toBlob(parameters.image));\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\t// The `{gameId}` URL segment in this legacy path is in fact the\n\t\t// universe ID; the package surfaces only `universeId`.\n\t\turl: `/legacy-game-internationalization/v1/game-thumbnails/games/${parameters.universeId}/language-codes/${parameters.languageCode}/image`,\n\t};\n}\n\n/**\n * Builds a `DELETE` request for the \"delete experience thumbnail\" endpoint.\n *\n * @param parameters - Universe, language, and image identifiers of the\n * thumbnail to delete.\n * @returns A pure {@link HttpRequest} describing the delete call.\n */\nexport function buildDeleteThumbnailRequest(\n\tparameters: DeleteExperienceThumbnailParameters,\n): HttpRequest {\n\treturn {\n\t\tmethod: \"DELETE\",\n\t\turl: `/legacy-game-internationalization/v1/game-thumbnails/games/${parameters.universeId}/language-codes/${parameters.languageCode}/images/${parameters.imageId}`,\n\t};\n}\n\n/**\n * Builds a `POST` request for the \"reorder experience thumbnails\" endpoint.\n * Validates each supplied image ID at the wire boundary so a typo cannot\n * silently serialize as JSON `null` and corrupt the request.\n *\n * @param parameters - Universe, language, and the desired display order.\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when `orderedImageIds` is empty or any ID is not\n * a positive integer within the safe-integer range.\n */\nexport function buildReorderThumbnailsRequest({\n\tlanguageCode,\n\torderedImageIds,\n\tuniverseId,\n}: ReorderExperienceThumbnailsParameters): Result<HttpRequest, ValidationError> {\n\tconst idsResult = parseOrderedImageIds(orderedImageIds);\n\tif (!idsResult.success) {\n\t\treturn idsResult;\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbody: { mediaAssetIds: idsResult.data },\n\t\t\tmethod: \"POST\",\n\t\t\turl: `/legacy-game-internationalization/v1/game-thumbnails/games/${universeId}/language-codes/${languageCode}/images/order`,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseImageId(value: string): number | undefined {\n\tif (!POSITIVE_INTEGER_PATTERN.test(value)) {\n\t\treturn undefined;\n\t}\n\n\tconst parsed = Number(value);\n\tif (!Number.isSafeInteger(parsed)) {\n\t\treturn undefined;\n\t}\n\n\treturn parsed;\n}\n\nfunction appendParsedId(accumulator: ParsedIdsResult, id: string): ParsedIdsResult {\n\tif (!accumulator.success) {\n\t\treturn accumulator;\n\t}\n\n\tconst parsed = parseImageId(id);\n\tif (parsed === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\n\t\t\t\t`orderedImageIds entry ${JSON.stringify(id)} is not a positive integer ID`,\n\t\t\t\t{ code: \"invalid_image_id\" },\n\t\t\t),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn { data: [...accumulator.data, parsed], success: true };\n}\n\nfunction parseOrderedImageIds(orderedImageIds: ReadonlyArray<string>): ParsedIdsResult {\n\tif (orderedImageIds.length === 0) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"orderedImageIds must contain at least one image ID\", {\n\t\t\t\tcode: \"empty_image_ids\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn orderedImageIds.reduce<ParsedIdsResult>(appendParsedId, { data: [], success: true });\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/**\n * Per-second request ceiling for every game-thumbnails Operation bound on\n * `UniversesClient.thumbnails`. The legacy `gameinternationalization`\n * service caps each API key at 100 requests per minute *shared across the\n * entire service* (see the `x-roblox-rate-limits` extension on every\n * operation in the vendored Open Cloud spec), so all methods queue against\n * the same operation key.\n */\nexport const THUMBNAILS_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"experience-thumbnails\",\n});\n\n/**\n * Scopes required for every game-thumbnails operation, sourced from\n * `x-roblox-scopes` on the legacy `gameinternationalization` thumbnail\n * endpoints in the vendored OpenAPI schema.\n */\nexport const THUMBNAILS_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-universe:manage\",\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 { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { UploadedExperienceThumbnail } from \"./types.ts\";\nimport type { GameThumbnailUploadWire } from \"./wire.ts\";\n\n/**\n * Parses a successful thumbnail-upload response into the public\n * {@link UploadedExperienceThumbnail} shape, returning a {@link Result}\n * so callers can handle malformed payloads without exceptions.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the converted upload, or an\n * `ApiError` when the body does not match the wire schema.\n */\nexport function parseThumbnailUploadResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<UploadedExperienceThumbnail, ApiError> {\n\tif (!isGameThumbnailUploadWire(body)) {\n\t\treturn {\n\t\t\terr: new ApiError(\"Malformed thumbnail upload response\", {\n\t\t\t\tdetails: toJsonDetails(body),\n\t\t\t\tstatusCode,\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn {\n\t\tdata: { mediaAssetId: body.mediaAssetId },\n\t\tsuccess: true,\n\t};\n}\n\nfunction isGameThumbnailUploadWire(body: unknown): body is GameThumbnailUploadWire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\treturn typeof body[\"mediaAssetId\"] === \"string\";\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport { buildGetRequest, buildUpdateRequest } from \"../../domains/cloud-v2/universes/builders.ts\";\nimport {\n\tGET_OPERATION_LIMIT,\n\tUPDATE_OPERATION_LIMIT,\n\tUPDATE_REQUIRED_SCOPES,\n} from \"../../domains/cloud-v2/universes/operations.ts\";\nimport { parseUniverseResponse } from \"../../domains/cloud-v2/universes/parsers.ts\";\nimport type {\n\tGetUniverseParameters,\n\tUniverse,\n\tUpdateUniverseParameters,\n} from \"../../domains/cloud-v2/universes/types.ts\";\nimport {\n\tbuildDeleteIconRequest,\n\tbuildListIconsRequest,\n\tbuildUploadIconRequest,\n} from \"../../domains/game-internationalization/game-icon/builders.ts\";\nimport {\n\tICON_OPERATION_LIMIT,\n\tICON_REQUIRED_SCOPES,\n} from \"../../domains/game-internationalization/game-icon/operations.ts\";\nimport { parseIconListResponse } from \"../../domains/game-internationalization/game-icon/parsers.ts\";\nimport type {\n\tDeleteExperienceIconParameters,\n\tExperienceIcon,\n\tListExperienceIconsParameters,\n\tUploadExperienceIconParameters,\n} from \"../../domains/game-internationalization/game-icon/types.ts\";\nimport {\n\tbuildDeleteThumbnailRequest,\n\tbuildReorderThumbnailsRequest,\n\tbuildUploadThumbnailRequest,\n} from \"../../domains/game-internationalization/game-thumbnails/builders.ts\";\nimport {\n\tTHUMBNAILS_OPERATION_LIMIT,\n\tTHUMBNAILS_REQUIRED_SCOPES,\n} from \"../../domains/game-internationalization/game-thumbnails/operations.ts\";\nimport { parseThumbnailUploadResponse } from \"../../domains/game-internationalization/game-thumbnails/parsers.ts\";\nimport type {\n\tDeleteExperienceThumbnailParameters,\n\tReorderExperienceThumbnailsParameters,\n\tUploadedExperienceThumbnail,\n\tUploadExperienceThumbnailParameters,\n} from \"../../domains/game-internationalization/game-thumbnails/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { CREATE_METHOD_DEFAULTS, IDEMPOTENT_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport type { HttpRequest } from \"../../internal/http/types.ts\";\nimport {\n\tokRequest,\n\tparseEmptyResponse,\n\tResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\n\nconst GET_SPEC: ResourceMethodSpec<GetUniverseParameters, Universe> = Object.freeze({\n\tbuildRequest: buildGetRequest,\n\tmethodDefaults: {},\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parseUniverseResponse,\n});\n\nconst UPDATE_SPEC: ResourceMethodSpec<UpdateUniverseParameters, Universe> = Object.freeze({\n\tbuildRequest: buildUpdateRequest,\n\tmethodDefaults: {},\n\tmethodKind: \"idempotent\",\n\toperationLimit: UPDATE_OPERATION_LIMIT,\n\tparse: parseUniverseResponse,\n\trequiredScopes: UPDATE_REQUIRED_SCOPES,\n});\n\nfunction buildIconUploadOkRequest(\n\tparameters: UploadExperienceIconParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest(buildUploadIconRequest(parameters));\n}\n\nfunction buildIconDeleteOkRequest(\n\tparameters: DeleteExperienceIconParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest(buildDeleteIconRequest(parameters));\n}\n\nfunction buildIconListOkRequest(\n\tparameters: ListExperienceIconsParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest(buildListIconsRequest(parameters));\n}\n\nconst ICON_UPLOAD_SPEC: ResourceMethodSpec<UploadExperienceIconParameters, undefined> =\n\tObject.freeze({\n\t\tbuildRequest: buildIconUploadOkRequest,\n\t\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\t\tmethodKind: \"create\",\n\t\toperationLimit: ICON_OPERATION_LIMIT,\n\t\tparse: parseEmptyResponse,\n\t\trequiredScopes: ICON_REQUIRED_SCOPES,\n\t});\n\nconst ICON_DELETE_SPEC: ResourceMethodSpec<DeleteExperienceIconParameters, undefined> =\n\tObject.freeze({\n\t\tbuildRequest: buildIconDeleteOkRequest,\n\t\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\t\tmethodKind: \"idempotent\",\n\t\toperationLimit: ICON_OPERATION_LIMIT,\n\t\tparse: parseEmptyResponse,\n\t\trequiredScopes: ICON_REQUIRED_SCOPES,\n\t});\n\nconst ICON_LIST_SPEC: ResourceMethodSpec<\n\tListExperienceIconsParameters,\n\tReadonlyArray<ExperienceIcon>\n> = Object.freeze({\n\tbuildRequest: buildIconListOkRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: ICON_OPERATION_LIMIT,\n\tparse: parseIconListResponse,\n\trequiredScopes: ICON_REQUIRED_SCOPES,\n});\n\nfunction buildThumbnailUploadOkRequest(\n\tparameters: UploadExperienceThumbnailParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest(buildUploadThumbnailRequest(parameters));\n}\n\nfunction buildThumbnailDeleteOkRequest(\n\tparameters: DeleteExperienceThumbnailParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest(buildDeleteThumbnailRequest(parameters));\n}\n\nconst THUMBNAIL_UPLOAD_SPEC: ResourceMethodSpec<\n\tUploadExperienceThumbnailParameters,\n\tUploadedExperienceThumbnail\n> = Object.freeze({\n\tbuildRequest: buildThumbnailUploadOkRequest,\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: THUMBNAILS_OPERATION_LIMIT,\n\tparse: parseThumbnailUploadResponse,\n\trequiredScopes: THUMBNAILS_REQUIRED_SCOPES,\n});\n\nconst THUMBNAIL_DELETE_SPEC: ResourceMethodSpec<DeleteExperienceThumbnailParameters, undefined> =\n\tObject.freeze({\n\t\tbuildRequest: buildThumbnailDeleteOkRequest,\n\t\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\t\tmethodKind: \"idempotent\",\n\t\toperationLimit: THUMBNAILS_OPERATION_LIMIT,\n\t\tparse: parseEmptyResponse,\n\t\trequiredScopes: THUMBNAILS_REQUIRED_SCOPES,\n\t});\n\nconst THUMBNAIL_REORDER_SPEC: ResourceMethodSpec<ReorderExperienceThumbnailsParameters, undefined> =\n\tObject.freeze({\n\t\tbuildRequest: buildReorderThumbnailsRequest,\n\t\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\t\tmethodKind: \"idempotent\",\n\t\toperationLimit: THUMBNAILS_OPERATION_LIMIT,\n\t\tparse: parseEmptyResponse,\n\t\trequiredScopes: THUMBNAILS_REQUIRED_SCOPES,\n\t});\n\ninterface UniverseIconHandle {\n\t/**\n\t * Deletes the localized icon registered against a universe for a given\n\t * language. Removing the source-language icon is rejected server-side;\n\t * consumers must replace it via {@link UniverseIconHandle.upload}\n\t * instead.\n\t *\n\t * @param parameters - Universe and language identifiers of the icon to\n\t * delete.\n\t * @param options - Optional per-request overrides.\n\t * @returns A success {@link Result} with no payload, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tdelete: (\n\t\tparameters: DeleteExperienceIconParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n\t/**\n\t * Lists every localized icon registered against an experience. The\n\t * server returns one entry per locale that has an icon registered.\n\t *\n\t * @param parameters - Universe identifier whose icons to list.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed array of\n\t * {@link ExperienceIcon} entries or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tlist: (\n\t\tparameters: ListExperienceIconsParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<ReadonlyArray<ExperienceIcon>, OpenCloudError>>;\n\t/**\n\t * Uploads or replaces the localized icon for an experience. A\n\t * subsequent upload for the same `(universeId, languageCode)` pair\n\t * replaces the existing icon for that locale.\n\t *\n\t * No default request timeout applies to this upload; pass `options.timeout`\n\t * to set a per-call deadline.\n\t *\n\t * @param parameters - Universe and language identifiers plus the image\n\t * bytes to upload.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A success {@link Result} with no payload, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tupload: (\n\t\tparameters: UploadExperienceIconParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n}\n\ninterface UniverseThumbnailsHandle {\n\t/**\n\t * Deletes a single thumbnail by media asset ID. Idempotent: deleting an\n\t * already-removed thumbnail surfaces the server's 404 unchanged.\n\t *\n\t * @param parameters - Universe, language, and image identifiers of the\n\t * thumbnail to delete.\n\t * @param options - Optional per-request overrides.\n\t * @returns A success {@link Result} with no payload, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tdelete: (\n\t\tparameters: DeleteExperienceThumbnailParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n\t/**\n\t * Reorders the localized thumbnail carousel. The supplied\n\t * `orderedImageIds` describes the desired display order from first to\n\t * last. Image IDs must be positive integers within the safe-integer\n\t * range; invalid input is rejected with a {@link OpenCloudError} of\n\t * kind `ValidationError` before any HTTP round-trip.\n\t *\n\t * @param parameters - Universe, language, and the desired display order.\n\t * @param options - Optional per-request overrides.\n\t * @returns A success {@link Result} with no payload, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\treorder: (\n\t\tparameters: ReorderExperienceThumbnailsParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n\t/**\n\t * Uploads a new thumbnail and appends it to the localized carousel. Use\n\t * {@link UniverseThumbnailsHandle.reorder} after multiple uploads to\n\t * set the display order.\n\t *\n\t * No default request timeout applies to this upload; pass `options.timeout`\n\t * to set a per-call deadline.\n\t *\n\t * @param parameters - Universe and language identifiers plus the image\n\t * bytes to upload.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link UploadedExperienceThumbnail} or the {@link OpenCloudError}\n\t * that caused the request to fail.\n\t */\n\tupload: (\n\t\tparameters: UploadExperienceThumbnailParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<UploadedExperienceThumbnail, OpenCloudError>>;\n}\n\n/**\n * Public client for the Roblox Open Cloud `Universe` resource. Wires\n * the request builders, the injected\n * {@link OpenCloudClientOptions.httpClient}, and the response parser\n * into a single ergonomic surface. Every method returns a\n * {@link Result} so callers handle failure explicitly; no thrown\n * {@link OpenCloudError} ever escapes the client.\n *\n * Partial updates use a Google-style `updateMask` query string derived\n * from the keys present on the update parameters. Setting a clearable\n * field (`privateServerPriceRobux` or any social link) to `undefined`\n * sends JSON `null` for that field so the server clears the\n * corresponding value.\n *\n * Localized experience-icon and experience-thumbnail Operations are\n * bound on the {@link UniversesClient.icon} and\n * {@link UniversesClient.thumbnails} Operation Groups so callers reach\n * for one client per universe.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { UniversesClient } from \"@bedrock-rbx/ocale/universes\";\n *\n * const client = new UniversesClient({ apiKey: \"your-key\" });\n * expect(client).toBeInstanceOf(UniversesClient);\n * ```\n */\nexport class UniversesClient {\n\treadonly #inner: ResourceClient;\n\n\t/**\n\t * Operation Group exposing the localized experience-icon\n\t * Operations (`upload`, `delete`, `list`) backed by the\n\t * `legacy-game-internationalization` domain. Shares the parent\n\t * client's HTTP, rate-limit, and retry plumbing.\n\t */\n\tpublic readonly icon: UniverseIconHandle;\n\t/**\n\t * Operation Group exposing the localized experience-thumbnail\n\t * Operations (`upload`, `delete`, `reorder`) backed by the\n\t * `legacy-game-internationalization` domain. No list-thumbnails\n\t * endpoint is bridged; consumers must track uploaded\n\t * `mediaAssetId`s in their own state store to reconcile against\n\t * the existing carousel. Shares the parent client's HTTP,\n\t * rate-limit, and retry plumbing.\n\t */\n\tpublic readonly thumbnails: UniverseThumbnailsHandle;\n\n\t/**\n\t * Creates a new {@link UniversesClient}. Configuration is frozen\n\t * on construction; per-request overrides are accepted on each\n\t * method.\n\t *\n\t * @param options - Client-level configuration including the API key.\n\t */\n\tconstructor(options: OpenCloudClientOptions) {\n\t\tthis.#inner = new ResourceClient(options);\n\t\tthis.icon = createIconHandle(this.#inner);\n\t\tthis.thumbnails = createThumbnailsHandle(this.#inner);\n\t}\n\n\t/**\n\t * Fetches the current configuration of a universe.\n\t *\n\t * @param parameters - The universe identifier.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link Universe}\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async get(\n\t\tparameters: GetUniverseParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Universe, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: GET_SPEC });\n\t}\n\n\t/**\n\t * Partially updates a universe's configuration. The fields\n\t * supplied on `parameters` (excluding `universeId`) are forwarded\n\t * to the server via a Google-style `updateMask`; unmentioned\n\t * fields are left untouched.\n\t *\n\t * @param parameters - The universe identifier and the fields to\n\t * update. At least one updatable field must be supplied.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link Universe}\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async update(\n\t\tparameters: UpdateUniverseParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Universe, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: UPDATE_SPEC });\n\t}\n}\n\nfunction createIconHandle(inner: ResourceClient): UniverseIconHandle {\n\treturn {\n\t\tasync delete(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: ICON_DELETE_SPEC });\n\t\t},\n\t\tasync list(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: ICON_LIST_SPEC });\n\t\t},\n\t\tasync upload(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: ICON_UPLOAD_SPEC });\n\t\t},\n\t};\n}\n\nfunction createThumbnailsHandle(inner: ResourceClient): UniverseThumbnailsHandle {\n\treturn {\n\t\tasync delete(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: THUMBNAIL_DELETE_SPEC });\n\t\t},\n\t\tasync reorder(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: THUMBNAIL_REORDER_SPEC });\n\t\t},\n\t\tasync upload(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: THUMBNAIL_UPLOAD_SPEC });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,gBAAgB,KAAK,MAAM,MAAM;;;;;;;AAQvC,SAAgB,gBACf,YACsC;CACtC,OAAO,UAAU;EAChB,QAAQ;EACR,KAAK,uBAAuB,WAAW;CACxC,CAAC;AACF;;;;;;;;;;;;AAaA,SAAgB,mBACf,YACuC;CACvC,MAAM,YAAY,uBAAuB,UAAU;CAEnD,IAAI,UAAU,WAAW,GACxB,OAAO;EACN,KAAK,IAAI,gBAAgB,0CAA0C,EAClE,MAAM,eACP,CAAC;EACD,SAAS;CACV;CAGD,MAAM,OAAgC,CAAC;CACvC,KAAK,MAAM,OAAO,WACjB,KAAK,OAAO,aAAa,YAAY,GAAG;CAGzC,MAAM,aAAa,UAAU,KAAK,GAAG;CACrC,OAAO;EACN,MAAM;GACL;GACA,SAAS,EAAE,gBAAgB,mBAAmB;GAC9C,QAAQ;GACR,KAAK,uBAAuB,WAAW,WAAW,cAAc;EACjE;EACA,SAAS;CACV;AACD;AAEA,SAAS,uBAAuB,YAA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IAAY,MAAM;GAAsB,CAAC;EAC/E;CACD;AACD"}
1
+ {"version":3,"file":"universes.mjs","names":["PER_MINUTE","SECONDS_PER_MINUTE","malformed","#inner","#inner"],"sources":["../src/internal/utils/positive-integer-id.ts","../src/domains/cloud-v2/universes/builders.ts","../src/domains/cloud-v2/universes/operations.ts","../src/domains/cloud-v2/universes/parsers.ts","../src/domains/game-internationalization/game-icon/builders.ts","../src/domains/game-internationalization/game-icon/operations.ts","../src/domains/game-internationalization/game-icon/parsers.ts","../src/domains/game-internationalization/game-thumbnails/builders.ts","../src/domains/game-internationalization/game-thumbnails/operations.ts","../src/domains/game-internationalization/game-thumbnails/parsers.ts","../src/domains/server-management/restarts/builders.ts","../src/domains/server-management/restarts/operations.ts","../src/domains/server-management/restarts/parsers.ts","../src/resources/universes/restarts-group.ts","../src/resources/universes/client.ts"],"sourcesContent":["import { ValidationError, type ValidationErrorCode } from \"../../errors/validation.ts\";\nimport type { Result } from \"../../types.ts\";\n\nconst POSITIVE_INTEGER_PATTERN = /^[1-9]\\d*$/;\n\n/**\n * Names the parameter an ID list came from, for the error it may produce.\n */\nexport interface IdListField {\n\t/** Validation code reported for an entry that is not an ID. */\n\treadonly code: ValidationErrorCode;\n\t/** Parameter name quoted in the error message. */\n\treadonly field: string;\n}\n\n/**\n * Parses stringified Roblox IDs for a wire field typed as an integer array.\n *\n * @param ids - The stringified IDs.\n * @param field - The parameter the IDs came from.\n * @returns The IDs as numbers, or a {@link ValidationError} naming the\n * first entry that is not a positive integer within the safe-integer\n * range.\n */\nexport function parsePositiveIntegerIds(\n\tids: ReadonlyArray<string>,\n\t{ code, field }: IdListField,\n): Result<ReadonlyArray<number>, ValidationError> {\n\tconst invalid = ids.find((id) => parsePositiveIntegerId(id) === undefined);\n\tif (invalid !== undefined) {\n\t\tconst message = `${field} entry ${JSON.stringify(invalid)} is not a positive integer ID`;\n\t\treturn { err: new ValidationError(message, { code }), success: false };\n\t}\n\n\treturn { data: ids.map(Number), success: true };\n}\n\nfunction parsePositiveIntegerId(value: string): number | undefined {\n\tif (!POSITIVE_INTEGER_PATTERN.test(value)) {\n\t\treturn undefined;\n\t}\n\n\tconst parsed = Number(value);\n\treturn Number.isSafeInteger(parsed) ? parsed : undefined;\n}\n","import type { HttpRequest } from \"../../../client/types.ts\";\nimport type { OpenCloudError } from \"../../../errors/base.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport { okRequest } from \"../../../internal/resource-client.ts\";\nimport { parsePositiveIntegerIds } from \"../../../internal/utils/positive-integer-id.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type {\n\tGetUniverseParameters,\n\tRestartUniverseServersParameters,\n\tUpdateUniverseParameters,\n} from \"./types.ts\";\n\n/**\n * Dodges `unicorn/no-null` while still emitting a literal `null` onto\n * the wire, which the Open Cloud `Cloud_UpdateUniverse` endpoint\n * requires to clear a nullable field (for example disabling private\n * servers or removing a social link).\n */\nconst NULL_SENTINEL = JSON.parse(\"null\");\n\n/**\n * Builds a `GET` request for the Open Cloud \"get universe\" endpoint.\n *\n * @param parameters - The universe identifier.\n * @returns A success result wrapping the request; the builder cannot fail.\n */\nexport function buildGetRequest(\n\tparameters: GetUniverseParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest({\n\t\tmethod: \"GET\",\n\t\turl: `/cloud/v2/universes/${parameters.universeId}`,\n\t});\n}\n\n/**\n * Builds a `POST` request for the Open Cloud `:restartServers` custom\n * method on a universe. A bleed-off duration also sets the wire's\n * `bleedOffServers` flag, which the server needs before it reads the\n * duration.\n *\n * @param parameters - The universe identifier and restart selection.\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when `placeIds` is empty (Roblox would read it\n * as every place) or holds an ID that is not a positive integer.\n */\nexport function buildRestartServersRequest({\n\tbleedOffDurationMinutes,\n\tplaceIds,\n\tuniverseId,\n\t...selection\n}: RestartUniverseServersParameters): Result<HttpRequest, OpenCloudError> {\n\tif (placeIds?.length === 0) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"placeIds must contain at least one place ID\", {\n\t\t\t\tcode: \"empty_place_ids\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst wirePlaceIds =\n\t\tplaceIds === undefined\n\t\t\t? undefined\n\t\t\t: parsePositiveIntegerIds(placeIds, { code: \"invalid_place_id\", field: \"placeIds\" });\n\tif (wirePlaceIds?.success === false) {\n\t\treturn wirePlaceIds;\n\t}\n\n\tconst bleedOff =\n\t\tbleedOffDurationMinutes === undefined\n\t\t\t? {}\n\t\t\t: { bleedOffDurationMinutes, bleedOffServers: true };\n\tconst places = wirePlaceIds === undefined ? {} : { placeIds: wirePlaceIds.data };\n\treturn okRequest({\n\t\tbody: { ...selection, ...bleedOff, ...places },\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}:restartServers`,\n\t});\n}\n\n/**\n * Builds a `PATCH` request for the Open Cloud \"update universe\"\n * endpoint. Derives the `updateMask` query string from the keys\n * present on `parameters` and emits a JSON body containing those same\n * fields, translating `undefined` values to JSON `null` so Roblox\n * clears the corresponding server-side value.\n *\n * @param parameters - The universe identifier plus the fields to update.\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when no updatable fields were supplied.\n */\nexport function buildUpdateRequest(\n\tparameters: UpdateUniverseParameters,\n): Result<HttpRequest, ValidationError> {\n\tconst fieldKeys = extractUpdateFieldKeys(parameters);\n\n\tif (fieldKeys.length === 0) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Update must include at least one field\", {\n\t\t\t\tcode: \"empty_update\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst body: Record<string, unknown> = {};\n\tfor (const key of fieldKeys) {\n\t\tbody[key] = bodyValueFor(parameters, key);\n\t}\n\n\tconst updateMask = fieldKeys.join(\",\");\n\treturn {\n\t\tdata: {\n\t\t\tbody,\n\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t\tmethod: \"PATCH\",\n\t\t\turl: `/cloud/v2/universes/${parameters.universeId}?updateMask=${updateMask}`,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction extractUpdateFieldKeys(parameters: UpdateUniverseParameters): ReadonlyArray<string> {\n\treturn Object.keys(parameters).filter((key) => key !== \"universeId\");\n}\n\nfunction bodyValueFor(parameters: UpdateUniverseParameters, key: string): unknown {\n\tconst value = Reflect.get(parameters, key);\n\treturn value === undefined ? NULL_SENTINEL : value;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst PER_MINUTE = 100;\nconst RESTART_SERVERS_PER_MINUTE = 30;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for reading a universe, from the Open\n * Cloud OpenAPI schema (100 requests per minute per API key owner).\n */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"universes.get\",\n});\n\n/**\n * Per-second request ceiling for updating a universe, from the Open\n * Cloud OpenAPI schema (100 requests per minute per API key owner).\n * Keyed independently from {@link GET_OPERATION_LIMIT} so reads and\n * updates do not share a queue; upstream quota accounting is not\n * documented as shared and the conservative default is fewer\n * cross-method contention surprises.\n */\nexport const UPDATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"universes.update\",\n});\n\n/**\n * Scopes required to update a universe, sourced from `x-roblox-scopes`\n * on the `Cloud_UpdateUniverse` operation in the vendored OpenAPI schema.\n * `Cloud_GetUniverse` declares no scope, so the GET method intentionally\n * does not declare `requiredScopes` and a 401/403 there surfaces as a\n * generic ApiError.\n */\nexport const UPDATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\"universe:write\"]);\n\n/**\n * Per-second request ceiling for restarting a universe's servers, from\n * `Cloud_RestartUniverseServers` in the Open Cloud OpenAPI schema (30\n * requests per minute per API key owner). The burst grants the whole\n * minute's quota up front, since the default of one token would pace a\n * sub-second limit at one call every two seconds.\n */\nexport const RESTART_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: RESTART_SERVERS_PER_MINUTE,\n\tmaxPerSecond: RESTART_SERVERS_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"universes.restartServers\",\n});\n\n/**\n * Scopes required to restart a universe's servers, sourced from\n * `x-roblox-scopes` on the `Cloud_RestartUniverseServers` operation in the\n * vendored OpenAPI schema.\n */\nexport const RESTART_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\"universe:write\"]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isDateTimeString } from \"../../../internal/utils/is-date-time-string.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type {\n\tSocialLink,\n\tUniverse,\n\tUniverseAgeRating,\n\tUniverseOwner,\n\tUniverseVisibility,\n} from \"./types.ts\";\nimport type { AgeRatingWire, SocialLinkWire, UniverseWire, VisibilityWire } from \"./wire.ts\";\n\nconst VISIBILITY_MAP: Readonly<Record<VisibilityWire, UniverseVisibility>> = {\n\tPRIVATE: \"private\",\n\tPUBLIC: \"public\",\n\tVISIBILITY_UNSPECIFIED: \"unspecified\",\n};\n\nconst AGE_RATING_MAP: Readonly<Record<AgeRatingWire, UniverseAgeRating>> = {\n\tAGE_RATING_9_PLUS: \"9Plus\",\n\tAGE_RATING_13_PLUS: \"13Plus\",\n\tAGE_RATING_17_PLUS: \"17Plus\",\n\tAGE_RATING_ALL: \"all\",\n\tAGE_RATING_UNSPECIFIED: \"unspecified\",\n};\n\nconst MALFORMED_MESSAGE = \"Malformed universe response\";\n\nconst UNIVERSE_PATH_PATTERN = /^universes\\/(\\d+)$/;\n\nconst ROOT_PLACE_PATH_PATTERN = /\\/places\\/(\\d+)$/;\n\nconst OWNER_PATH_PATTERN = /^(?:users|groups)\\/(\\d+)$/;\n\ninterface ToUniverseArgs {\n\treadonly id: string;\n\treadonly body: UniverseWire;\n\treadonly owner: UniverseOwner;\n}\n\n/**\n * Parses a successful Open Cloud `Universe` response body into the\n * public {@link Universe} shape.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link Universe}, or\n * an {@link ApiError} when the body does not match the wire schema.\n */\nexport function parseUniverseResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<Universe, ApiError> {\n\tif (!isUniverseWire(body)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst ownerResult = resolveOwner(body);\n\tif (!ownerResult.success) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst idMatch = UNIVERSE_PATH_PATTERN.exec(body.path);\n\tconst id = idMatch?.[1];\n\tif (id === undefined) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\treturn { data: toUniverse({ id, body, owner: ownerResult.data }), success: true };\n}\n\nfunction malformed(statusCode: number, body: unknown): Result<Universe, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n\nfunction extractRootPlaceId(rootPlace: string | undefined): string | undefined {\n\tif (rootPlace === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst match = ROOT_PLACE_PATH_PATTERN.exec(rootPlace);\n\treturn match?.[1];\n}\n\nfunction isSocialLinkWire(value: unknown): value is SocialLinkWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn typeof value[\"title\"] === \"string\" && typeof value[\"uri\"] === \"string\";\n}\n\nfunction toSocialLink(wire: unknown): SocialLink | undefined {\n\tif (!isSocialLinkWire(wire)) {\n\t\treturn undefined;\n\t}\n\n\treturn { title: wire.title, uri: wire.uri };\n}\n\nfunction toUniverse({ id, body, owner }: ToUniverseArgs): Universe {\n\treturn {\n\t\tid,\n\t\tageRating: AGE_RATING_MAP[body.ageRating],\n\t\tconsoleEnabled: body.consoleEnabled ?? false,\n\t\tcreatedAt: new Date(body.createTime),\n\t\tdescription: body.description,\n\t\tdesktopEnabled: body.desktopEnabled ?? false,\n\t\tdiscordSocialLink: toSocialLink(body.discordSocialLink),\n\t\tdisplayName: body.displayName,\n\t\tfacebookSocialLink: toSocialLink(body.facebookSocialLink),\n\t\tguildedSocialLink: toSocialLink(body.guildedSocialLink),\n\t\tmobileEnabled: body.mobileEnabled ?? false,\n\t\towner,\n\t\tprivateServerPriceRobux: body.privateServerPriceRobux ?? undefined,\n\t\trobloxGroupSocialLink: toSocialLink(body.robloxGroupSocialLink),\n\t\trootPlaceId: extractRootPlaceId(body.rootPlace),\n\t\ttabletEnabled: body.tabletEnabled ?? false,\n\t\ttwitchSocialLink: toSocialLink(body.twitchSocialLink),\n\t\ttwitterSocialLink: toSocialLink(body.twitterSocialLink),\n\t\tupdatedAt: new Date(body.updateTime),\n\t\tvisibility: VISIBILITY_MAP[body.visibility],\n\t\tvoiceChatEnabled: body.voiceChatEnabled ?? false,\n\t\tvrEnabled: body.vrEnabled ?? false,\n\t\tyoutubeSocialLink: toSocialLink(body.youtubeSocialLink),\n\t};\n}\n\nfunction isVisibilityWire(value: unknown): value is VisibilityWire {\n\treturn value === \"PRIVATE\" || value === \"PUBLIC\" || value === \"VISIBILITY_UNSPECIFIED\";\n}\n\nfunction isAgeRatingWire(value: unknown): value is AgeRatingWire {\n\treturn (\n\t\tvalue === \"AGE_RATING_13_PLUS\" ||\n\t\tvalue === \"AGE_RATING_17_PLUS\" ||\n\t\tvalue === \"AGE_RATING_9_PLUS\" ||\n\t\tvalue === \"AGE_RATING_ALL\" ||\n\t\tvalue === \"AGE_RATING_UNSPECIFIED\"\n\t);\n}\n\nfunction hasValidRequiredFields(body: Record<string, unknown>): boolean {\n\treturn (\n\t\ttypeof body[\"path\"] === \"string\" &&\n\t\tisDateTimeString(body[\"createTime\"]) &&\n\t\tisDateTimeString(body[\"updateTime\"]) &&\n\t\ttypeof body[\"displayName\"] === \"string\" &&\n\t\ttypeof body[\"description\"] === \"string\" &&\n\t\tisVisibilityWire(body[\"visibility\"]) &&\n\t\tisAgeRatingWire(body[\"ageRating\"])\n\t);\n}\n\nfunction isOptionalSocialLink(value: unknown): boolean {\n\treturn value === undefined || value === null || isSocialLinkWire(value);\n}\n\nfunction isOptionalBoolean(value: unknown): boolean {\n\treturn value === undefined || value === null || typeof value === \"boolean\";\n}\n\nfunction hasValidOptionalFields(body: Record<string, unknown>): boolean {\n\tconst priceField = body[\"privateServerPriceRobux\"] ?? undefined;\n\tif (priceField !== undefined && typeof priceField !== \"number\") {\n\t\treturn false;\n\t}\n\n\tconst rootPlace = body[\"rootPlace\"] ?? undefined;\n\tif (rootPlace !== undefined && typeof rootPlace !== \"string\") {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\tisOptionalBoolean(body[\"voiceChatEnabled\"]) &&\n\t\tisOptionalBoolean(body[\"desktopEnabled\"]) &&\n\t\tisOptionalBoolean(body[\"mobileEnabled\"]) &&\n\t\tisOptionalBoolean(body[\"tabletEnabled\"]) &&\n\t\tisOptionalBoolean(body[\"consoleEnabled\"]) &&\n\t\tisOptionalBoolean(body[\"vrEnabled\"]) &&\n\t\tisOptionalSocialLink(body[\"facebookSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"twitterSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"youtubeSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"twitchSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"discordSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"robloxGroupSocialLink\"]) &&\n\t\tisOptionalSocialLink(body[\"guildedSocialLink\"])\n\t);\n}\n\nfunction isUniverseWire(body: unknown): body is UniverseWire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\treturn hasValidRequiredFields(body) && hasValidOptionalFields(body);\n}\n\nfunction extractOwnerId(resourcePath: string): string | undefined {\n\tconst match = OWNER_PATH_PATTERN.exec(resourcePath);\n\treturn match?.[1];\n}\n\nfunction resolveOwner(body: UniverseWire): Result<UniverseOwner, undefined> {\n\tif (typeof body.user === \"string\") {\n\t\tconst id = extractOwnerId(body.user);\n\t\tif (id !== undefined) {\n\t\t\treturn { data: { id, kind: \"user\" }, success: true };\n\t\t}\n\t}\n\n\tif (typeof body.group === \"string\") {\n\t\tconst id = extractOwnerId(body.group);\n\t\tif (id !== undefined) {\n\t\t\treturn { data: { id, kind: \"group\" }, success: true };\n\t\t}\n\t}\n\n\treturn { err: undefined, success: false };\n}\n","// The legacy `{gameId}` URL segment is in fact the universe ID; the public API\n// takes `universeId` and substitutes it into the path.\n\nimport type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type {\n\tDeleteExperienceIconParameters,\n\tListExperienceIconsParameters,\n\tUploadExperienceIconParameters,\n} from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the localized \"upload experience icon\"\n * endpoint. A successful upload replaces any existing icon for the same\n * `(universeId, languageCode)` pair.\n *\n * @param parameters - Universe and language identifiers plus the image\n * bytes to upload.\n * @returns A pure {@link HttpRequest} describing the upload call.\n */\nexport function buildUploadIconRequest(parameters: UploadExperienceIconParameters): HttpRequest {\n\tconst body = new FormData();\n\t// The legacy game-icon endpoint reads the upload from `request.files`.\n\tbody.append(\"request.files\", toBlob(parameters.image));\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\turl: `/legacy-game-internationalization/v1/game-icon/games/${parameters.universeId}/language-codes/${parameters.languageCode}`,\n\t};\n}\n\n/**\n * Builds a `DELETE` request for the localized \"delete experience icon\"\n * endpoint. Removing the source-language icon is rejected server-side;\n * deleting the icon for a non-source language clears that translation.\n *\n * @param parameters - Universe and language identifiers of the icon to\n * delete.\n * @returns A pure {@link HttpRequest} describing the delete call.\n */\nexport function buildDeleteIconRequest(parameters: DeleteExperienceIconParameters): HttpRequest {\n\treturn {\n\t\tmethod: \"DELETE\",\n\t\turl: `/legacy-game-internationalization/v1/game-icon/games/${parameters.universeId}/language-codes/${parameters.languageCode}`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the \"list experience icons\" endpoint. The\n * server returns one entry per locale that has an icon registered.\n *\n * @param parameters - Universe identifier whose icons to list.\n * @returns A pure {@link HttpRequest} describing the list call.\n */\nexport function buildListIconsRequest(parameters: ListExperienceIconsParameters): HttpRequest {\n\treturn {\n\t\tmethod: \"GET\",\n\t\turl: `/legacy-game-internationalization/v1/game-icon/games/${parameters.universeId}`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/**\n * Per-second request ceiling for every game-icon Operation bound on\n * `UniversesClient.icon`. The legacy `gameinternationalization` service caps\n * each API key at 100 requests per minute *shared across the entire service*\n * (see the `x-roblox-rate-limits` extension on every operation in the\n * vendored Open Cloud spec), so all methods queue against the same operation\n * key.\n */\nexport const ICON_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"experience-icon\",\n});\n\n/**\n * Scopes required for every game-icon operation, sourced from\n * `x-roblox-scopes` on the legacy `gameinternationalization` icon\n * endpoints in the vendored OpenAPI schema.\n */\nexport const ICON_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-universe:manage\",\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 { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { ExperienceIcon } from \"./types.ts\";\nimport type { GameIconListWire, GameIconState, GetGameIconResponseWire } from \"./wire.ts\";\n\n/**\n * Parses a successful icon-list response into a public array of\n * {@link ExperienceIcon} entries.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the converted icon list, or an\n * `ApiError` when the body does not match the wire schema.\n */\nexport function parseIconListResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<ReadonlyArray<ExperienceIcon>, ApiError> {\n\tif (!isGameIconListWire(body)) {\n\t\treturn {\n\t\t\terr: new ApiError(\"Malformed icon list response\", {\n\t\t\t\tdetails: toJsonDetails(body),\n\t\t\t\tstatusCode,\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn {\n\t\tdata: body.data.map(toExperienceIcon),\n\t\tsuccess: true,\n\t};\n}\n\nfunction isGameIconState(value: unknown): value is GameIconState {\n\treturn (\n\t\tvalue === \"Approved\" ||\n\t\tvalue === \"Error\" ||\n\t\tvalue === \"PendingReview\" ||\n\t\tvalue === \"Rejected\" ||\n\t\tvalue === \"UnAvailable\"\n\t);\n}\n\nfunction isGetGameIconResponseWire(value: unknown): value is GetGameIconResponseWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttypeof value[\"imageId\"] === \"string\" &&\n\t\ttypeof value[\"imageUrl\"] === \"string\" &&\n\t\ttypeof value[\"languageCode\"] === \"string\" &&\n\t\tisGameIconState(value[\"state\"])\n\t);\n}\n\nfunction isGameIconListWire(body: unknown): body is GameIconListWire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\tconst { data } = body;\n\tif (!Array.isArray(data)) {\n\t\treturn false;\n\t}\n\n\treturn data.every(isGetGameIconResponseWire);\n}\n\nfunction toExperienceIcon(wire: GetGameIconResponseWire): ExperienceIcon {\n\treturn {\n\t\timageId: wire.imageId,\n\t\timageUrl: wire.imageUrl,\n\t\tlanguageCode: wire.languageCode,\n\t\tstate: wire.state,\n\t};\n}\n","import { ValidationError } from \"../../../errors/validation.ts\";\nimport type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { parsePositiveIntegerIds } from \"../../../internal/utils/positive-integer-id.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type {\n\tDeleteExperienceThumbnailParameters,\n\tReorderExperienceThumbnailsParameters,\n\tUploadExperienceThumbnailParameters,\n} from \"./types.ts\";\n\ntype ParsedIdsResult = Result<ReadonlyArray<number>, ValidationError>;\n\n/**\n * Builds a `POST` request for the localized \"upload experience thumbnail\"\n * endpoint. Each successful upload appends a new entry to the carousel.\n *\n * @param parameters - Universe and language identifiers plus the image\n * bytes to upload.\n * @returns A pure {@link HttpRequest} describing the upload call.\n */\nexport function buildUploadThumbnailRequest(\n\tparameters: UploadExperienceThumbnailParameters,\n): HttpRequest {\n\tconst body = new FormData();\n\t// The legacy game-thumbnails endpoint reads the upload from\n\t// `gameThumbnailRequest.files`, distinct from game-icon's `request.files`.\n\tbody.append(\"gameThumbnailRequest.files\", toBlob(parameters.image));\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\t// The `{gameId}` URL segment in this legacy path is in fact the\n\t\t// universe ID; the package surfaces only `universeId`.\n\t\turl: `/legacy-game-internationalization/v1/game-thumbnails/games/${parameters.universeId}/language-codes/${parameters.languageCode}/image`,\n\t};\n}\n\n/**\n * Builds a `DELETE` request for the \"delete experience thumbnail\" endpoint.\n *\n * @param parameters - Universe, language, and image identifiers of the\n * thumbnail to delete.\n * @returns A pure {@link HttpRequest} describing the delete call.\n */\nexport function buildDeleteThumbnailRequest(\n\tparameters: DeleteExperienceThumbnailParameters,\n): HttpRequest {\n\treturn {\n\t\tmethod: \"DELETE\",\n\t\turl: `/legacy-game-internationalization/v1/game-thumbnails/games/${parameters.universeId}/language-codes/${parameters.languageCode}/images/${parameters.imageId}`,\n\t};\n}\n\n/**\n * Builds a `POST` request for the \"reorder experience thumbnails\" endpoint.\n * Validates each supplied image ID at the wire boundary so a typo cannot\n * silently serialize as JSON `null` and corrupt the request.\n *\n * @param parameters - Universe, language, and the desired display order.\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when `orderedImageIds` is empty or any ID is not\n * a positive integer within the safe-integer range.\n */\nexport function buildReorderThumbnailsRequest({\n\tlanguageCode,\n\torderedImageIds,\n\tuniverseId,\n}: ReorderExperienceThumbnailsParameters): Result<HttpRequest, ValidationError> {\n\tconst idsResult = parseOrderedImageIds(orderedImageIds);\n\tif (!idsResult.success) {\n\t\treturn idsResult;\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbody: { mediaAssetIds: idsResult.data },\n\t\t\tmethod: \"POST\",\n\t\t\turl: `/legacy-game-internationalization/v1/game-thumbnails/games/${universeId}/language-codes/${languageCode}/images/order`,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseOrderedImageIds(orderedImageIds: ReadonlyArray<string>): ParsedIdsResult {\n\tif (orderedImageIds.length === 0) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"orderedImageIds must contain at least one image ID\", {\n\t\t\t\tcode: \"empty_image_ids\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn parsePositiveIntegerIds(orderedImageIds, {\n\t\tcode: \"invalid_image_id\",\n\t\tfield: \"orderedImageIds\",\n\t});\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/**\n * Per-second request ceiling for every game-thumbnails Operation bound on\n * `UniversesClient.thumbnails`. The legacy `gameinternationalization`\n * service caps each API key at 100 requests per minute *shared across the\n * entire service* (see the `x-roblox-rate-limits` extension on every\n * operation in the vendored Open Cloud spec), so all methods queue against\n * the same operation key.\n */\nexport const THUMBNAILS_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"experience-thumbnails\",\n});\n\n/**\n * Scopes required for every game-thumbnails operation, sourced from\n * `x-roblox-scopes` on the legacy `gameinternationalization` thumbnail\n * endpoints in the vendored OpenAPI schema.\n */\nexport const THUMBNAILS_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-universe:manage\",\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 { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { UploadedExperienceThumbnail } from \"./types.ts\";\nimport type { GameThumbnailUploadWire } from \"./wire.ts\";\n\n/**\n * Parses a successful thumbnail-upload response into the public\n * {@link UploadedExperienceThumbnail} shape, returning a {@link Result}\n * so callers can handle malformed payloads without exceptions.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the converted upload, or an\n * `ApiError` when the body does not match the wire schema.\n */\nexport function parseThumbnailUploadResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<UploadedExperienceThumbnail, ApiError> {\n\tif (!isGameThumbnailUploadWire(body)) {\n\t\treturn {\n\t\t\terr: new ApiError(\"Malformed thumbnail upload response\", {\n\t\t\t\tdetails: toJsonDetails(body),\n\t\t\t\tstatusCode,\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn {\n\t\tdata: { mediaAssetId: body.mediaAssetId },\n\t\tsuccess: true,\n\t};\n}\n\nfunction isGameThumbnailUploadWire(body: unknown): body is GameThumbnailUploadWire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\treturn typeof body[\"mediaAssetId\"] === \"string\";\n}\n","import type { HttpRequest } from \"../../../client/types.ts\";\nimport type { OpenCloudError } from \"../../../errors/base.ts\";\nimport { okRequest } from \"../../../internal/resource-client.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type {\n\tForecastRestartParameters,\n\tLaunchRestartParameters,\n\tListRestartsParameters,\n} from \"./types.ts\";\n\n/**\n * Builds a `GET` request for the server-management restart forecast.\n *\n * @param parameters - The universe identifier.\n * @returns A success result wrapping the request; the builder cannot fail.\n */\nexport function buildForecastRequest(\n\tparameters: ForecastRestartParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest({\n\t\tmethod: \"GET\",\n\t\turl: `/server-management/v1/universes/${parameters.universeId}/restarts:forecast`,\n\t});\n}\n\n/**\n * Builds a `POST` request that launches a server-management restart. The\n * body is never omitted: the endpoint answers 415 to a POST without one.\n *\n * @param parameters - The universe identifier and restart selection.\n * @returns A success result wrapping the request; the builder cannot fail.\n */\nexport function buildLaunchRequest({\n\tuniverseId,\n\t...selection\n}: LaunchRestartParameters): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest({\n\t\tbody: selection,\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"POST\",\n\t\turl: `/server-management/v1/universes/${universeId}/restarts`,\n\t});\n}\n\n/**\n * Builds a `GET` request that lists a universe's server-management\n * restarts.\n *\n * @param parameters - The universe identifier.\n * @returns A success result wrapping the request; the builder cannot fail.\n */\nexport function buildListRequest(\n\tparameters: ListRestartsParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest({\n\t\tmethod: \"GET\",\n\t\turl: `/server-management/v1/universes/${parameters.universeId}/restarts`,\n\t});\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst PER_MINUTE = 100;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for `Restarts_ForecastRestart`, from the\n * Open Cloud OpenAPI schema (100 requests per minute per API key owner).\n * Live headers show it metered apart from launch and list.\n */\nexport const FORECAST_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"restarts.forecast\",\n});\n\n/**\n * Scopes required to read restart forecasts and statuses, sourced from\n * `x-roblox-scopes` on `Restarts_ForecastRestart` and\n * `Restarts_ListRestartStatuses` in the vendored OpenAPI schema.\n */\nexport const READ_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\"universe:read\"]);\n\n/**\n * Per-second request ceiling for `Restarts_LaunchRestart`, from the Open\n * Cloud OpenAPI schema (100 requests per minute per API key owner).\n */\nexport const LAUNCH_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"restarts.launch\",\n});\n\n/**\n * Scopes required to launch a restart, sourced from `x-roblox-scopes` on\n * `Restarts_LaunchRestart` in the vendored OpenAPI schema.\n */\nexport const LAUNCH_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\"universe:write\"]);\n\n/**\n * Per-second request ceiling for `Restarts_ListRestartStatuses`, from the\n * Open Cloud OpenAPI schema (100 requests per minute per API key owner).\n */\nexport const LIST_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"restarts.list\",\n});\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isDateTimeString } from \"../../../internal/utils/is-date-time-string.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type {\n\tLaunchedRestart,\n\tPlaceRestartForecast,\n\tPlaceRestartStatus,\n\tRestartPlaceFilter,\n\tRestartStatus,\n} from \"./types.ts\";\nimport type {\n\tForecastRestartResponseWire,\n\tLaunchRestartResponseWire,\n\tListRestartStatusesResponseWire,\n\tPlaceFilterWire,\n\tPlaceRestartStatusWire,\n\tPlaceSummaryForGameRestartWire,\n\tRestartStatusWire,\n} from \"./wire.ts\";\n\nconst RESTART_STATES: ReadonlySet<unknown> = new Set([\"DELAYING\", \"RESTARTING\", \"SUCCEEDED\"]);\n\n/** The ID Roblox returns from a launch that matched no live server. */\nconst NIL_RESTART_ID = \"00000000-0000-0000-0000-000000000000\";\n\ninterface MalformedBody {\n\treadonly body: unknown;\n\treadonly statusCode: number;\n}\n\n/**\n * Parses a `ForecastRestartResponse` body into one\n * {@link PlaceRestartForecast} per place.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the forecasts, or an {@link ApiError}\n * when the body does not match the wire schema.\n */\nexport function parseForecastResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<ReadonlyArray<PlaceRestartForecast>, ApiError> {\n\tif (!isForecastWire(body)) {\n\t\treturn malformed(\"Malformed restart forecast response\", { body, statusCode });\n\t}\n\n\tconst forecasts = Object.entries(body.placeForecasts ?? {}).map(([placeId, summary]) => {\n\t\treturn toForecast(placeId, summary);\n\t});\n\treturn { data: forecasts, success: true };\n}\n\n/**\n * Parses a `LaunchRestartResponse` body into a {@link LaunchedRestart}.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the launched restart, or an\n * {@link ApiError} when the body does not match the wire schema.\n */\nexport function parseLaunchResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<LaunchedRestart, ApiError> {\n\tif (!isLaunchWire(body)) {\n\t\treturn malformed(\"Malformed restart launch response\", { body, statusCode });\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tid: body.id === NIL_RESTART_ID ? undefined : (body.id ?? undefined),\n\t\t\tinstancesImpacted: body.instancesImpacted,\n\t\t\tplayersImpacted: body.playersImpacted,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\n/**\n * Parses a `ListRestartStatusesResponse` body into one\n * {@link RestartStatus} per restart.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the restarts, or an {@link ApiError}\n * when the body does not match the wire schema.\n */\nexport function parseListResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<ReadonlyArray<RestartStatus>, ApiError> {\n\tif (!isListWire(body)) {\n\t\treturn malformed(\"Malformed restart list response\", { body, statusCode });\n\t}\n\n\tconst restarts = Object.entries(body.restartStatuses ?? {}).map(([id, status]) => {\n\t\treturn toRestartStatus(id, status);\n\t});\n\treturn { data: restarts, success: true };\n}\n\nfunction malformed(message: string, { body, statusCode }: MalformedBody): Result<never, ApiError> {\n\treturn {\n\t\terr: new ApiError(message, { details: toJsonDetails(body), statusCode }),\n\t\tsuccess: false,\n\t};\n}\n\nfunction toForecast(\n\tplaceId: string,\n\tsummary: PlaceSummaryForGameRestartWire,\n): PlaceRestartForecast {\n\treturn {\n\t\tinstancesImpacted: summary.instancesImpacted,\n\t\tinstancesPerVersion: summary.instancesPerVersion ?? {},\n\t\tisNotInUniverse: summary.isNotInUniverse,\n\t\tlatestPlaceVersion: summary.latestPlaceVersion ?? undefined,\n\t\tplaceId,\n\t\tplayersImpacted: summary.playersImpacted,\n\t\tplayersPerVersion: summary.playersPerVersion ?? {},\n\t\tpublishedAt: new Date(summary.publishTime),\n\t\ttotalInstances: summary.totalInstances,\n\t\ttotalPlayers: summary.totalPlayers,\n\t};\n}\n\n/**\n * Whether a nullable wire field carries no value: absent, `undefined`, or\n * JSON `null`.\n *\n * @param value - The wire value.\n * @returns `true` when the field carries no value.\n */\nfunction isAbsent(value: unknown): boolean {\n\treturn (value ?? undefined) === undefined;\n}\n\nfunction isOptional(value: unknown, isPresent: (present: unknown) => boolean): boolean {\n\treturn isAbsent(value) || isPresent(value);\n}\n\nfunction isOptionalRecordOf(value: unknown, isEntry: (entry: unknown) => boolean): boolean {\n\treturn isOptional(value, (record) => isRecord(record) && Object.values(record).every(isEntry));\n}\n\nfunction isNumber(value: unknown): boolean {\n\treturn typeof value === \"number\";\n}\n\nfunction isString(value: unknown): boolean {\n\treturn typeof value === \"string\";\n}\n\nfunction isPlaceSummaryWire(value: unknown): value is PlaceSummaryForGameRestartWire {\n\treturn (\n\t\tisRecord(value) &&\n\t\ttypeof value[\"instancesImpacted\"] === \"number\" &&\n\t\ttypeof value[\"isNotInUniverse\"] === \"boolean\" &&\n\t\ttypeof value[\"playersImpacted\"] === \"number\" &&\n\t\tisDateTimeString(value[\"publishTime\"]) &&\n\t\ttypeof value[\"totalInstances\"] === \"number\" &&\n\t\ttypeof value[\"totalPlayers\"] === \"number\" &&\n\t\tisOptional(value[\"latestPlaceVersion\"], isString) &&\n\t\tisOptionalRecordOf(value[\"instancesPerVersion\"], isNumber) &&\n\t\tisOptionalRecordOf(value[\"playersPerVersion\"], isNumber)\n\t);\n}\n\nfunction isForecastWire(body: unknown): body is ForecastRestartResponseWire {\n\treturn isRecord(body) && isOptionalRecordOf(body[\"placeForecasts\"], isPlaceSummaryWire);\n}\n\nfunction isLaunchWire(body: unknown): body is LaunchRestartResponseWire {\n\treturn (\n\t\tisRecord(body) &&\n\t\tisOptional(body[\"id\"], isString) &&\n\t\ttypeof body[\"instancesImpacted\"] === \"number\" &&\n\t\ttypeof body[\"playersImpacted\"] === \"number\"\n\t);\n}\n\nfunction toFilter(filter: PlaceFilterWire | undefined): RestartPlaceFilter | undefined {\n\tconst wire = filter ?? undefined;\n\tif (wire === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst versions = wire.versions ?? undefined;\n\tif (versions !== undefined) {\n\t\treturn { versions };\n\t}\n\n\tconst excludeCurrentVersion = wire.excludeCurrentVersion ?? undefined;\n\treturn excludeCurrentVersion === undefined ? {} : { excludeCurrentVersion };\n}\n\nfunction toPlaceStatus(placeId: string, wire: PlaceRestartStatusWire): PlaceRestartStatus {\n\treturn {\n\t\tendedAt: typeof wire.endTime === \"string\" ? new Date(wire.endTime) : undefined,\n\t\tfilter: toFilter(wire.filter),\n\t\tlatestVersion: wire.latestVersion ?? undefined,\n\t\tplaceId,\n\t\tremainingInstances: wire.remainingInstances,\n\t\tremainingPlayers: wire.remainingPlayers,\n\t\tstartedAt: new Date(wire.startTime),\n\t\tstate: wire.state,\n\t\ttotalInstances: wire.totalInstances,\n\t\ttotalPlayers: wire.totalPlayers,\n\t};\n}\n\nfunction toRestartStatus(id: string, wire: RestartStatusWire): RestartStatus {\n\tconst places = Object.entries(wire.placeRestartStatuses ?? {}).map(([placeId, status]) => {\n\t\treturn toPlaceStatus(placeId, status);\n\t});\n\treturn {\n\t\tid,\n\t\tplaces,\n\t\tscheduledAt: new Date(wire.scheduledTime),\n\t\tstartsAt: new Date(wire.startTime),\n\t};\n}\n\nfunction isVersions(value: unknown): boolean {\n\treturn Array.isArray(value) && value.every(isNumber);\n}\n\nfunction isFilterWire(value: unknown): boolean {\n\treturn (\n\t\tisRecord(value) &&\n\t\tisOptional(value[\"excludeCurrentVersion\"], (exclude) => typeof exclude === \"boolean\") &&\n\t\tisOptional(value[\"versions\"], isVersions)\n\t);\n}\n\nfunction isPlaceStatusWire(value: unknown): value is PlaceRestartStatusWire {\n\treturn (\n\t\tisRecord(value) &&\n\t\tRESTART_STATES.has(value[\"state\"]) &&\n\t\tisDateTimeString(value[\"startTime\"]) &&\n\t\tisOptional(value[\"endTime\"], isDateTimeString) &&\n\t\ttypeof value[\"totalPlayers\"] === \"number\" &&\n\t\ttypeof value[\"totalInstances\"] === \"number\" &&\n\t\ttypeof value[\"remainingPlayers\"] === \"number\" &&\n\t\ttypeof value[\"remainingInstances\"] === \"number\" &&\n\t\tisOptional(value[\"filter\"], isFilterWire) &&\n\t\tisOptional(value[\"latestVersion\"], isString)\n\t);\n}\n\nfunction isRestartStatusWire(value: unknown): value is RestartStatusWire {\n\treturn (\n\t\tisRecord(value) &&\n\t\tisDateTimeString(value[\"scheduledTime\"]) &&\n\t\tisDateTimeString(value[\"startTime\"]) &&\n\t\tisOptionalRecordOf(value[\"placeRestartStatuses\"], isPlaceStatusWire)\n\t);\n}\n\nfunction isListWire(body: unknown): body is ListRestartStatusesResponseWire {\n\treturn isRecord(body) && isOptionalRecordOf(body[\"restartStatuses\"], isRestartStatusWire);\n}\n","import type { RequestOptions } from \"../../client/types.ts\";\nimport {\n\tbuildForecastRequest,\n\tbuildLaunchRequest,\n\tbuildListRequest,\n} from \"../../domains/server-management/restarts/builders.ts\";\nimport {\n\tFORECAST_OPERATION_LIMIT,\n\tLAUNCH_OPERATION_LIMIT,\n\tLAUNCH_REQUIRED_SCOPES,\n\tLIST_OPERATION_LIMIT,\n\tREAD_REQUIRED_SCOPES,\n} from \"../../domains/server-management/restarts/operations.ts\";\nimport {\n\tparseForecastResponse,\n\tparseLaunchResponse,\n\tparseListResponse,\n} from \"../../domains/server-management/restarts/parsers.ts\";\nimport type {\n\tForecastRestartParameters,\n\tLaunchedRestart,\n\tLaunchRestartParameters,\n\tListRestartsParameters,\n\tPlaceRestartForecast,\n\tRestartStatus,\n} from \"../../domains/server-management/restarts/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { CREATE_METHOD_DEFAULTS, IDEMPOTENT_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport type { ResourceClient, ResourceMethodSpec } from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\n\nfunction makeSpec<P, R>(spec: ResourceMethodSpec<P, R>): ResourceMethodSpec<P, R> {\n\treturn Object.freeze(spec);\n}\n\nconst FORECAST_SPEC = makeSpec<ForecastRestartParameters, ReadonlyArray<PlaceRestartForecast>>({\n\tbuildRequest: buildForecastRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: FORECAST_OPERATION_LIMIT,\n\tparse: parseForecastResponse,\n\trequiredScopes: READ_REQUIRED_SCOPES,\n});\n\n// A launch is not safe to repeat: a 5xx may follow an accepted restart,\n// and Roblox answers some requests with a steady 500 (see\n// docs/spikes/restart-servers). So the retry policy mirrors `create`.\nconst LAUNCH_SPEC = makeSpec<LaunchRestartParameters, LaunchedRestart>({\n\tbuildRequest: buildLaunchRequest,\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: LAUNCH_OPERATION_LIMIT,\n\tparse: parseLaunchResponse,\n\trequiredScopes: LAUNCH_REQUIRED_SCOPES,\n});\n\nconst LIST_SPEC = makeSpec<ListRestartsParameters, ReadonlyArray<RestartStatus>>({\n\tbuildRequest: buildListRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: LIST_OPERATION_LIMIT,\n\tparse: parseListResponse,\n\trequiredScopes: READ_REQUIRED_SCOPES,\n});\n\n/**\n * Operation Group on `UniversesClient` that exposes the server-management\n * restart endpoints: preview a restart, launch one, and track it. The\n * endpoints are BETA on the Roblox side.\n */\nexport class UniverseRestartsGroup {\n\treadonly #inner: ResourceClient;\n\n\t/**\n\t * Wraps the shared {@link ResourceClient} so the Operation Group\n\t * routes calls through the same retry, hooks, and rate-limit queues\n\t * as the rest of the parent client.\n\t *\n\t * @param inner - The shared {@link ResourceClient} owned by the\n\t * parent client.\n\t */\n\tconstructor(inner: ResourceClient) {\n\t\tthis.#inner = inner;\n\t}\n\n\t/**\n\t * Reads the live servers of every active place in a universe, and how\n\t * many of them a restart of old place versions would close.\n\t *\n\t * @param parameters - The universe identifier.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping one {@link PlaceRestartForecast}\n\t * per active place (empty when no server runs), or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async forecast(\n\t\tparameters: ForecastRestartParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<ReadonlyArray<PlaceRestartForecast>, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: FORECAST_SPEC });\n\t}\n\n\t/**\n\t * Launches a restart of a universe's live servers and returns its ID,\n\t * which `list` reports while the restart runs. When no live server\n\t * matches, Roblox records no restart and `id` is `undefined`.\n\t *\n\t * @example\n\t * ```ts\n\t * import { createFakeHttpClient } from \"@bedrock-rbx/ocale/testing\";\n\t * import { UniversesClient } from \"@bedrock-rbx/ocale/universes\";\n\t *\n\t * const httpClient = createFakeHttpClient().mockResponse({\n\t * body: {\n\t * id: \"00000000-0000-0000-0000-000000000000\",\n\t * instancesImpacted: 0,\n\t * playersImpacted: 0,\n\t * },\n\t * status: 200,\n\t * });\n\t * const client = new UniversesClient({ apiKey: \"your-key\", httpClient });\n\t *\n\t * return client.restarts\n\t * .launch({ bleedOffDurationMinutes: 5, universeId: \"42\" })\n\t * .then((result) => {\n\t * expect(result).toEqual({\n\t * data: { id: undefined, instancesImpacted: 0, playersImpacted: 0 },\n\t * success: true,\n\t * });\n\t * });\n\t * ```\n\t *\n\t * @param parameters - The universe identifier.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the {@link LaunchedRestart}, or\n\t * the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async launch(\n\t\tparameters: LaunchRestartParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LaunchedRestart, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: LAUNCH_SPEC });\n\t}\n\n\t/**\n\t * Lists a universe's restarts with their progress per place. A\n\t * `:restartServers` call that selected a server appears here too, but\n\t * only `launch` returns the ID to match it by.\n\t *\n\t * @param parameters - The universe identifier.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping one {@link RestartStatus} per\n\t * restart, or the {@link OpenCloudError} that caused the request to\n\t * fail.\n\t */\n\tpublic async list(\n\t\tparameters: ListRestartsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<ReadonlyArray<RestartStatus>, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: LIST_SPEC });\n\t}\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport {\n\tbuildGetRequest,\n\tbuildRestartServersRequest,\n\tbuildUpdateRequest,\n} from \"../../domains/cloud-v2/universes/builders.ts\";\nimport {\n\tGET_OPERATION_LIMIT,\n\tRESTART_OPERATION_LIMIT,\n\tRESTART_REQUIRED_SCOPES,\n\tUPDATE_OPERATION_LIMIT,\n\tUPDATE_REQUIRED_SCOPES,\n} from \"../../domains/cloud-v2/universes/operations.ts\";\nimport { parseUniverseResponse } from \"../../domains/cloud-v2/universes/parsers.ts\";\nimport type {\n\tGetUniverseParameters,\n\tRestartUniverseServersParameters,\n\tUniverse,\n\tUpdateUniverseParameters,\n} from \"../../domains/cloud-v2/universes/types.ts\";\nimport {\n\tbuildDeleteIconRequest,\n\tbuildListIconsRequest,\n\tbuildUploadIconRequest,\n} from \"../../domains/game-internationalization/game-icon/builders.ts\";\nimport {\n\tICON_OPERATION_LIMIT,\n\tICON_REQUIRED_SCOPES,\n} from \"../../domains/game-internationalization/game-icon/operations.ts\";\nimport { parseIconListResponse } from \"../../domains/game-internationalization/game-icon/parsers.ts\";\nimport type {\n\tDeleteExperienceIconParameters,\n\tExperienceIcon,\n\tListExperienceIconsParameters,\n\tUploadExperienceIconParameters,\n} from \"../../domains/game-internationalization/game-icon/types.ts\";\nimport {\n\tbuildDeleteThumbnailRequest,\n\tbuildReorderThumbnailsRequest,\n\tbuildUploadThumbnailRequest,\n} from \"../../domains/game-internationalization/game-thumbnails/builders.ts\";\nimport {\n\tTHUMBNAILS_OPERATION_LIMIT,\n\tTHUMBNAILS_REQUIRED_SCOPES,\n} from \"../../domains/game-internationalization/game-thumbnails/operations.ts\";\nimport { parseThumbnailUploadResponse } from \"../../domains/game-internationalization/game-thumbnails/parsers.ts\";\nimport type {\n\tDeleteExperienceThumbnailParameters,\n\tReorderExperienceThumbnailsParameters,\n\tUploadedExperienceThumbnail,\n\tUploadExperienceThumbnailParameters,\n} from \"../../domains/game-internationalization/game-thumbnails/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { CREATE_METHOD_DEFAULTS, IDEMPOTENT_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport type { HttpRequest } from \"../../internal/http/types.ts\";\nimport {\n\tokRequest,\n\tparseEmptyResponse,\n\tResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { UniverseRestartsGroup } from \"./restarts-group.ts\";\n\nconst GET_SPEC: ResourceMethodSpec<GetUniverseParameters, Universe> = Object.freeze({\n\tbuildRequest: buildGetRequest,\n\tmethodDefaults: {},\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parseUniverseResponse,\n});\n\nconst UPDATE_SPEC: ResourceMethodSpec<UpdateUniverseParameters, Universe> = Object.freeze({\n\tbuildRequest: buildUpdateRequest,\n\tmethodDefaults: {},\n\tmethodKind: \"idempotent\",\n\toperationLimit: UPDATE_OPERATION_LIMIT,\n\tparse: parseUniverseResponse,\n\trequiredScopes: UPDATE_REQUIRED_SCOPES,\n});\n\nconst RESTART_SERVERS_SPEC: ResourceMethodSpec<RestartUniverseServersParameters, undefined> =\n\tObject.freeze({\n\t\tbuildRequest: buildRestartServersRequest,\n\t\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\t\tmethodKind: \"create\",\n\t\toperationLimit: RESTART_OPERATION_LIMIT,\n\t\tparse: parseEmptyResponse,\n\t\trequiredScopes: RESTART_REQUIRED_SCOPES,\n\t});\n\nfunction buildIconUploadOkRequest(\n\tparameters: UploadExperienceIconParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest(buildUploadIconRequest(parameters));\n}\n\nfunction buildIconDeleteOkRequest(\n\tparameters: DeleteExperienceIconParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest(buildDeleteIconRequest(parameters));\n}\n\nfunction buildIconListOkRequest(\n\tparameters: ListExperienceIconsParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest(buildListIconsRequest(parameters));\n}\n\nconst ICON_UPLOAD_SPEC: ResourceMethodSpec<UploadExperienceIconParameters, undefined> =\n\tObject.freeze({\n\t\tbuildRequest: buildIconUploadOkRequest,\n\t\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\t\tmethodKind: \"create\",\n\t\toperationLimit: ICON_OPERATION_LIMIT,\n\t\tparse: parseEmptyResponse,\n\t\trequiredScopes: ICON_REQUIRED_SCOPES,\n\t});\n\nconst ICON_DELETE_SPEC: ResourceMethodSpec<DeleteExperienceIconParameters, undefined> =\n\tObject.freeze({\n\t\tbuildRequest: buildIconDeleteOkRequest,\n\t\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\t\tmethodKind: \"idempotent\",\n\t\toperationLimit: ICON_OPERATION_LIMIT,\n\t\tparse: parseEmptyResponse,\n\t\trequiredScopes: ICON_REQUIRED_SCOPES,\n\t});\n\nconst ICON_LIST_SPEC: ResourceMethodSpec<\n\tListExperienceIconsParameters,\n\tReadonlyArray<ExperienceIcon>\n> = Object.freeze({\n\tbuildRequest: buildIconListOkRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: ICON_OPERATION_LIMIT,\n\tparse: parseIconListResponse,\n\trequiredScopes: ICON_REQUIRED_SCOPES,\n});\n\nfunction buildThumbnailUploadOkRequest(\n\tparameters: UploadExperienceThumbnailParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest(buildUploadThumbnailRequest(parameters));\n}\n\nfunction buildThumbnailDeleteOkRequest(\n\tparameters: DeleteExperienceThumbnailParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest(buildDeleteThumbnailRequest(parameters));\n}\n\nconst THUMBNAIL_UPLOAD_SPEC: ResourceMethodSpec<\n\tUploadExperienceThumbnailParameters,\n\tUploadedExperienceThumbnail\n> = Object.freeze({\n\tbuildRequest: buildThumbnailUploadOkRequest,\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: THUMBNAILS_OPERATION_LIMIT,\n\tparse: parseThumbnailUploadResponse,\n\trequiredScopes: THUMBNAILS_REQUIRED_SCOPES,\n});\n\nconst THUMBNAIL_DELETE_SPEC: ResourceMethodSpec<DeleteExperienceThumbnailParameters, undefined> =\n\tObject.freeze({\n\t\tbuildRequest: buildThumbnailDeleteOkRequest,\n\t\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\t\tmethodKind: \"idempotent\",\n\t\toperationLimit: THUMBNAILS_OPERATION_LIMIT,\n\t\tparse: parseEmptyResponse,\n\t\trequiredScopes: THUMBNAILS_REQUIRED_SCOPES,\n\t});\n\nconst THUMBNAIL_REORDER_SPEC: ResourceMethodSpec<ReorderExperienceThumbnailsParameters, undefined> =\n\tObject.freeze({\n\t\tbuildRequest: buildReorderThumbnailsRequest,\n\t\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\t\tmethodKind: \"idempotent\",\n\t\toperationLimit: THUMBNAILS_OPERATION_LIMIT,\n\t\tparse: parseEmptyResponse,\n\t\trequiredScopes: THUMBNAILS_REQUIRED_SCOPES,\n\t});\n\ninterface UniverseIconHandle {\n\t/**\n\t * Deletes the localized icon registered against a universe for a given\n\t * language. Removing the source-language icon is rejected server-side;\n\t * consumers must replace it via {@link UniverseIconHandle.upload}\n\t * instead.\n\t *\n\t * @param parameters - Universe and language identifiers of the icon to\n\t * delete.\n\t * @param options - Optional per-request overrides.\n\t * @returns A success {@link Result} with no payload, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tdelete: (\n\t\tparameters: DeleteExperienceIconParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n\t/**\n\t * Lists every localized icon registered against an experience. The\n\t * server returns one entry per locale that has an icon registered.\n\t *\n\t * @param parameters - Universe identifier whose icons to list.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed array of\n\t * {@link ExperienceIcon} entries or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tlist: (\n\t\tparameters: ListExperienceIconsParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<ReadonlyArray<ExperienceIcon>, OpenCloudError>>;\n\t/**\n\t * Uploads or replaces the localized icon for an experience. A\n\t * subsequent upload for the same `(universeId, languageCode)` pair\n\t * replaces the existing icon for that locale.\n\t *\n\t * No default request timeout applies to this upload; pass `options.timeout`\n\t * to set a per-call deadline.\n\t *\n\t * @param parameters - Universe and language identifiers plus the image\n\t * bytes to upload.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A success {@link Result} with no payload, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tupload: (\n\t\tparameters: UploadExperienceIconParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n}\n\ninterface UniverseThumbnailsHandle {\n\t/**\n\t * Deletes a single thumbnail by media asset ID. Idempotent: deleting an\n\t * already-removed thumbnail surfaces the server's 404 unchanged.\n\t *\n\t * @param parameters - Universe, language, and image identifiers of the\n\t * thumbnail to delete.\n\t * @param options - Optional per-request overrides.\n\t * @returns A success {@link Result} with no payload, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tdelete: (\n\t\tparameters: DeleteExperienceThumbnailParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n\t/**\n\t * Reorders the localized thumbnail carousel. The supplied\n\t * `orderedImageIds` describes the desired display order from first to\n\t * last. Image IDs must be positive integers within the safe-integer\n\t * range; invalid input is rejected with a {@link OpenCloudError} of\n\t * kind `ValidationError` before any HTTP round-trip.\n\t *\n\t * @param parameters - Universe, language, and the desired display order.\n\t * @param options - Optional per-request overrides.\n\t * @returns A success {@link Result} with no payload, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\treorder: (\n\t\tparameters: ReorderExperienceThumbnailsParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n\t/**\n\t * Uploads a new thumbnail and appends it to the localized carousel. Use\n\t * {@link UniverseThumbnailsHandle.reorder} after multiple uploads to\n\t * set the display order.\n\t *\n\t * No default request timeout applies to this upload; pass `options.timeout`\n\t * to set a per-call deadline.\n\t *\n\t * @param parameters - Universe and language identifiers plus the image\n\t * bytes to upload.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link UploadedExperienceThumbnail} or the {@link OpenCloudError}\n\t * that caused the request to fail.\n\t */\n\tupload: (\n\t\tparameters: UploadExperienceThumbnailParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<UploadedExperienceThumbnail, OpenCloudError>>;\n}\n\n/**\n * Public client for the Roblox Open Cloud `Universe` resource. Wires\n * the request builders, the injected\n * {@link OpenCloudClientOptions.httpClient}, and the response parser\n * into a single ergonomic surface. Every method returns a\n * {@link Result} so callers handle failure explicitly; no thrown\n * {@link OpenCloudError} ever escapes the client.\n *\n * Partial updates use a Google-style `updateMask` query string derived\n * from the keys present on the update parameters. Setting a clearable\n * field (`privateServerPriceRobux` or any social link) to `undefined`\n * sends JSON `null` for that field so the server clears the\n * corresponding value.\n *\n * Localized experience-icon and experience-thumbnail Operations are\n * bound on the {@link UniversesClient.icon} and\n * {@link UniversesClient.thumbnails} Operation Groups so callers reach\n * for one client per universe.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { UniversesClient } from \"@bedrock-rbx/ocale/universes\";\n *\n * const client = new UniversesClient({ apiKey: \"your-key\" });\n * expect(client).toBeInstanceOf(UniversesClient);\n * ```\n */\nexport class UniversesClient {\n\treadonly #inner: ResourceClient;\n\n\t/**\n\t * Operation Group exposing the localized experience-icon\n\t * Operations (`upload`, `delete`, `list`) backed by the\n\t * `legacy-game-internationalization` domain. Shares the parent\n\t * client's HTTP, rate-limit, and retry plumbing.\n\t */\n\tpublic readonly icon: UniverseIconHandle;\n\t/**\n\t * Operation Group exposing the server-management restart Operations\n\t * (`forecast`, `launch`, `list`). Shares the parent client's HTTP,\n\t * rate-limit, and retry plumbing.\n\t */\n\tpublic readonly restarts: UniverseRestartsGroup;\n\t/**\n\t * Operation Group exposing the localized experience-thumbnail\n\t * Operations (`upload`, `delete`, `reorder`) backed by the\n\t * `legacy-game-internationalization` domain. No list-thumbnails\n\t * endpoint is bridged; consumers must track uploaded\n\t * `mediaAssetId`s in their own state store to reconcile against\n\t * the existing carousel. Shares the parent client's HTTP,\n\t * rate-limit, and retry plumbing.\n\t */\n\tpublic readonly thumbnails: UniverseThumbnailsHandle;\n\n\t/**\n\t * Creates a new {@link UniversesClient}. Configuration is frozen\n\t * on construction; per-request overrides are accepted on each\n\t * method.\n\t *\n\t * @param options - Client-level configuration including the API key.\n\t */\n\tconstructor(options: OpenCloudClientOptions) {\n\t\tthis.#inner = new ResourceClient(options);\n\t\tthis.icon = createIconHandle(this.#inner);\n\t\tthis.restarts = new UniverseRestartsGroup(this.#inner);\n\t\tthis.thumbnails = createThumbnailsHandle(this.#inner);\n\t}\n\n\t/**\n\t * Fetches the current configuration of a universe.\n\t *\n\t * @param parameters - The universe identifier.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link Universe}\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async get(\n\t\tparameters: GetUniverseParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Universe, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: GET_SPEC });\n\t}\n\n\t/**\n\t * Restarts the live servers of a universe so players move onto the\n\t * latest published place versions.\n\t *\n\t * @param parameters - The universe identifier, plus optional place,\n\t * version, and bleed-off selection.\n\t * @param options - Optional per-request overrides.\n\t * @returns A success {@link Result} with no payload, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async restartServers(\n\t\tparameters: RestartUniverseServersParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<undefined, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: RESTART_SERVERS_SPEC });\n\t}\n\n\t/**\n\t * Partially updates a universe's configuration. The fields\n\t * supplied on `parameters` (excluding `universeId`) are forwarded\n\t * to the server via a Google-style `updateMask`; unmentioned\n\t * fields are left untouched.\n\t *\n\t * @param parameters - The universe identifier and the fields to\n\t * update. At least one updatable field must be supplied.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link Universe}\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async update(\n\t\tparameters: UpdateUniverseParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Universe, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: UPDATE_SPEC });\n\t}\n}\n\nfunction createIconHandle(inner: ResourceClient): UniverseIconHandle {\n\treturn {\n\t\tasync delete(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: ICON_DELETE_SPEC });\n\t\t},\n\t\tasync list(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: ICON_LIST_SPEC });\n\t\t},\n\t\tasync upload(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: ICON_UPLOAD_SPEC });\n\t\t},\n\t};\n}\n\nfunction createThumbnailsHandle(inner: ResourceClient): UniverseThumbnailsHandle {\n\treturn {\n\t\tasync delete(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: THUMBNAIL_DELETE_SPEC });\n\t\t},\n\t\tasync reorder(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: THUMBNAIL_REORDER_SPEC });\n\t\t},\n\t\tasync upload(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: THUMBNAIL_UPLOAD_SPEC });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;AAGA,MAAM,2BAA2B;;;;;;;;;;AAqBjC,SAAgB,wBACf,KACA,EAAE,MAAM,SACyC;CACjD,MAAM,UAAU,IAAI,MAAM,OAAO,uBAAuB,EAAE,MAAM,KAAA,CAAS;CACzE,IAAI,YAAY,KAAA,GAEf,OAAO;EAAE,KAAK,IAAI,gBA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ors/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 *\n * @since 0.1.0\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 *\n * @since 0.1.0\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 * @since 0.1.0\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 override 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":";;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,kBAAb,cAAqC,eAAe;CACnD;CACA,OAAwC;;;;;;;CAQxC,YAAY,SAAiB,SAAiC;EAC7D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO,QAAQ;CACrB;AACD"}
1
+ {"version":3,"file":"validation-B_Zs1So2.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 *\n * @since 0.1.0\n */\nexport type ValidationErrorCode =\n\t| \"empty_body\"\n\t| \"empty_image_ids\"\n\t| \"empty_place_ids\"\n\t| \"empty_update\"\n\t| \"format_mismatch\"\n\t| \"incomplete_ref\"\n\t| \"invalid_image_id\"\n\t| \"invalid_place_id\";\n\n/**\n * Options for constructing a {@link ValidationError}.\n *\n * @since 0.1.0\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 * @since 0.1.0\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 override 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":";;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAa,kBAAb,cAAqC,eAAe;CACnD;CACA,OAAwC;;;;;;;CAQxC,YAAY,SAAiB,SAAiC;EAC7D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO,QAAQ;CACrB;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock-rbx/ocale",
3
- "version": "0.3.2",
3
+ "version": "0.3.4-beta.0",
4
4
  "description": "Roblox Open Cloud API client",
5
5
  "keywords": [
6
6
  "api",
@@ -1 +0,0 @@
1
- {"version":3,"file":"retry-Cc4LcXYZ.mjs","names":["CONTENT_TYPE_HEADER","exhaustive"],"sources":["../src/internal/utils/try-catch.ts","../src/internal/http/diagnostics.ts","../src/internal/http/http1-dispatcher.ts","../src/internal/http/rate-limit-sample.ts","../src/internal/http/retry-guidance.ts","../src/internal/http/rate-limit-response.ts","../src/errors/request-aborted.ts","../src/internal/utils/abort.ts","../src/internal/http/request-signal.ts","../src/internal/http/upload-request.ts","../src/internal/http/fetch-client.ts","../src/errors/permission-error.ts","../src/errors/request-deadline-exceeded.ts","../src/errors/retry-delay-exceeded.ts","../src/internal/utils/find-error-code.ts","../src/internal/http/retry.ts"],"sourcesContent":["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 tryCatchAsync<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 { Result } from \"../../types.ts\";\n\n// Caps the raw body retained when a response cannot be parsed, so a multi-KB\n// HTML error page is not surfaced or logged whole.\nconst MAX_DETAIL_LENGTH = 500;\n\nconst CONTENT_TYPE_HEADER = \"content-type\";\n\n/**\n * The request-level context threaded from the transport into error\n * construction: which call failed and how long it was in flight.\n */\nexport interface RequestContext {\n\t/** Wall-clock time the request was in flight, in milliseconds. */\n\treadonly elapsedMs: number;\n\t/** HTTP method of the request. */\n\treadonly method: string;\n\t/** Fully-qualified URL of the request. */\n\treadonly url: string;\n}\n\n/** Inputs to {@link parseFailureError}. */\nexport interface ParseFailureArgs {\n\t/** The `SyntaxError` thrown by the failed `JSON.parse`. */\n\treadonly cause: Error;\n\t/** The request that produced the unusable response. */\n\treadonly context: RequestContext;\n\t/** The 2xx response whose body would not parse. */\n\treadonly response: Response;\n\t/** The raw body text, read once by the transport. */\n\treadonly text: string;\n}\n\n// A small allowlist of response headers worth retaining on an ApiError for\n// diagnosis and escalation to Roblox. apis.roblox.com returns `server` (e.g.\n// `public-gateway`, or `haproxy` on a load-balancer error page) and\n// `x-roblox-edge` on every response; `via`, `x-request-id`, and `cf-ray` are\n// standard proxy/CDN request-id headers kept in case an edge adds them. The\n// full header set is never retained, to avoid surfacing anything sensitive.\nconst DIAGNOSTIC_HEADER_ALLOWLIST: ReadonlySet<string> = new Set([\n\t\"cf-ray\",\n\t\"server\",\n\t\"via\",\n\t\"x-request-id\",\n]);\n\nconst DIAGNOSTIC_HEADER_PREFIX = \"x-roblox-\";\n\nconst RATE_LIMIT_HEADER_ALLOWLIST: ReadonlySet<string> = new Set([\n\t\"date\",\n\t\"retry-after\",\n\t\"x-envoy-ratelimited\",\n\t\"x-ratelimit-limit\",\n\t\"x-ratelimit-remaining\",\n\t\"x-ratelimit-reset\",\n\t\"x-retry-after-coverage\",\n]);\n\n// Only the opening tag is matched; the closing tag is located with indexOf so\n// the inner text needs no unbounded pattern, which would backtrack\n// super-linearly on a hostile error page.\nconst TITLE_OPEN_PATTERN = /<title[^>]*>/i;\nconst H1_OPEN_PATTERN = /<h1[^>]*>/i;\nconst TAG_PATTERN = /<[^<>]*>/g;\nconst WHITESPACE_PATTERN = /\\s+/g;\n\n/**\n * Extracts a one-line human summary from an HTML gateway error page, or returns\n * `undefined` when the body is not such a page. A load balancer (HAProxy-style)\n * rejects a request before it reaches Open Cloud and answers with an HTML page,\n * not a JSON Open Cloud error; dumping that HTML whole is noise. The body is\n * treated as HTML when the content-type is `text/html` or the trimmed body is\n * tag-led (`<html`/`<!doctype html`), and the summary is taken from the\n * `<title>` (falling back to the first `<h1>`), tags stripped and whitespace\n * collapsed.\n *\n * @param contentType - The response `content-type` header, if present.\n * @param rawText - The raw response body text.\n * @returns The extracted summary, or `undefined` when the body is not an HTML\n * gateway page (or carries no title/h1 text).\n */\nexport function extractGatewaySummary(\n\tcontentType: string | undefined,\n\trawText: string,\n): string | undefined {\n\tif (!isHtmlBody(contentType, rawText)) {\n\t\treturn undefined;\n\t}\n\n\treturn (\n\t\tfirstTagText(rawText, { close: \"</title>\", open: TITLE_OPEN_PATTERN }) ??\n\t\tfirstTagText(rawText, { close: \"</h1>\", open: H1_OPEN_PATTERN })\n\t);\n}\n\n/**\n * Filters a lowercased header record down to the diagnostic allowlist: a few\n * named escalation headers plus any `x-roblox-*` header. Keeps errors light and\n * avoids retaining anything sensitive from the full response header set.\n *\n * @param headers - The full header record (lowercased keys).\n * @returns A record containing only the allowlisted headers that were present.\n */\nexport function pickDiagnosticHeaders(\n\theaders: Record<string, string>,\n): Readonly<Record<string, string>> {\n\treturn pickHeaders(headers);\n}\n\n/**\n * Filters a lowercased header record to the raw evidence useful for diagnosing\n * a 429: the general diagnostic headers plus rate-limit guidance and counters.\n * Values are copied without parsing so comma-joined windows remain available.\n *\n * @param headers - The full header record (lowercased keys).\n * @returns Only allowlisted diagnostic and rate-limit headers.\n */\nexport function pickRateLimitHeaders(\n\theaders: Record<string, string>,\n): Readonly<Record<string, string>> {\n\treturn pickHeaders(headers, RATE_LIMIT_HEADER_ALLOWLIST);\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 * Projects a read body to the detail carried on an error: the parsed JSON when\n * it parsed, otherwise the raw text truncated to {@link MAX_DETAIL_LENGTH}.\n *\n * @param text - The raw response body text.\n * @param parsed - The best-effort parse result from the transport's body read.\n * @returns The parsed body, or the truncated raw text on a parse failure.\n */\nexport function bodyDetail(\n\ttext: string,\n\tparsed: Result<JSONValue | undefined>,\n): JSONValue | undefined {\n\treturn parsed.success ? parsed.data : text.slice(0, MAX_DETAIL_LENGTH);\n}\n\n/**\n * Builds the error for a 2xx response whose body could not be parsed as JSON,\n * preserving the parse `cause`, the (truncated) raw body, the declared\n * content-type, and the request that produced it so the failure can be\n * diagnosed after the fact.\n *\n * The received length is on the message rather than only on the error, because\n * `details` retains just the first {@link MAX_DETAIL_LENGTH} characters: for a\n * body that stopped mid-token the head says nothing and the length says\n * everything. A `SyntaxError` position equal to this number is a body the edge\n * cut short, not one the API mis-serialized.\n *\n * @param args - The Response, raw body text, request context, and underlying\n * parse error.\n * @returns An ApiError carrying the diagnostic context.\n */\nexport function parseFailureError({ cause, context, response, text }: ParseFailureArgs): ApiError {\n\tconst contentType = response.headers.get(CONTENT_TYPE_HEADER) ?? \"unknown\";\n\treturn new ApiError(\n\t\t`Failed to parse response body (content-type: ${contentType}, ${String(text.length)} chars read)`,\n\t\t{\n\t\t\tcause,\n\t\t\tdetails: text.slice(0, MAX_DETAIL_LENGTH),\n\t\t\telapsedMs: context.elapsedMs,\n\t\t\tmethod: context.method,\n\t\t\tresponseHeaders: pickDiagnosticHeaders(headersToRecord(response.headers)),\n\t\t\tstatusCode: response.status,\n\t\t\tunparsedBodyLength: text.length,\n\t\t\turl: context.url,\n\t\t},\n\t);\n}\n\nfunction firstTagText(html: string, tag: { close: string; open: RegExp }): string | undefined {\n\tconst open = tag.open.exec(html);\n\tif (open === null) {\n\t\treturn undefined;\n\t}\n\n\tconst start = open.index + open[0].length;\n\tconst end = html.toLowerCase().indexOf(tag.close, start);\n\tif (end === -1) {\n\t\treturn undefined;\n\t}\n\n\tconst inner = html.slice(start, end);\n\n\tconst text = inner.replace(TAG_PATTERN, \" \").replace(WHITESPACE_PATTERN, \" \").trim();\n\treturn text === \"\" ? undefined : text;\n}\n\nfunction isHtmlBody(contentType: string | undefined, rawText: string): boolean {\n\tif (contentType?.toLowerCase().includes(\"text/html\") === true) {\n\t\treturn true;\n\t}\n\n\tconst head = rawText.trimStart().toLowerCase();\n\treturn head.startsWith(\"<html\") || head.startsWith(\"<!doctype html\");\n}\n\nfunction pickHeaders(\n\theaders: Record<string, string>,\n\tadditionalAllowlist?: ReadonlySet<string>,\n): Record<string, string> {\n\tconst picked: Record<string, string> = {};\n\tfor (const [name, value] of Object.entries(headers)) {\n\t\tif (\n\t\t\tDIAGNOSTIC_HEADER_ALLOWLIST.has(name) ||\n\t\t\tname.startsWith(DIAGNOSTIC_HEADER_PREFIX) ||\n\t\t\tadditionalAllowlist?.has(name) === true\n\t\t) {\n\t\t\tpicked[name] = value;\n\t\t}\n\t}\n\n\treturn picked;\n}\n","/** The shape the global dispatcher's class is assumed to have. */\ntype AgentConstructor = new (options: { allowH2: boolean }) => object;\n\n/**\n * Well-known globals under which undici publishes its global dispatcher,\n * newest first. The suffix is undici's own contract version: it moved from\n * `.1` to `.2` in undici 8, so a future major may move it again. Both are\n * probed, and {@link createHttp1Dispatcher} degrades to `undefined` when\n * neither is present — which is also the Bun path, since Bun's `fetch` is not\n * undici-backed and never publishes these.\n */\nconst GLOBAL_DISPATCHER_KEYS: ReadonlyArray<string> = Object.freeze([\n\t\"undici.globalDispatcher.2\",\n\t\"undici.globalDispatcher.1\",\n]);\n\n/**\n * Narrow a value read off the global dispatcher to something\n * `Reflect.construct` accepts. Exported so the narrowing is unit-testable: at\n * the call site every rejected shape funnels into the same `undefined`, which\n * makes the branch unobservable from `createHttp1Dispatcher` alone.\n *\n * @param value - The candidate `constructor` read off the global dispatcher.\n * @returns Whether the value can be constructed.\n */\nexport function isAgentConstructor(value: unknown): value is AgentConstructor {\n\treturn typeof value === \"function\";\n}\n\n/**\n * Builds a request dispatcher that negotiates HTTP/1.1 only, by reusing the\n * class of the runtime's own global dispatcher.\n *\n * From Node 26 (undici 8) `fetch` offers h2 in ALPN, which defeats the\n * `connection: close` an upload sets: `connection` is a connection-specific\n * header, so an h2 transport drops it before the wire and pools every upload\n * onto one multiplexed session. One session death then fails every upload in\n * flight. Constructing the same agent with `allowH2: false` restores the\n * per-upload connection the directive was written for.\n *\n * There is no standard `fetch` option for this, so the agent is reached\n * through undici's versioned global symbol and its class rather than through\n * an import — which keeps the package dependency-free. The contract is\n * internal, so every step is guarded: an absent symbol, a non-constructible\n * value, or a constructor that throws all yield `undefined`, and the caller\n * sends the request unmodified.\n *\n * @param scope - The object to read the global dispatcher from. Defaults to\n * `globalThis`; injectable so tests need not mutate the real global.\n * @returns A dispatcher restricted to HTTP/1.1, or `undefined` when this\n * runtime offers no reachable one.\n */\nexport function createHttp1Dispatcher(scope: object = globalThis): object | undefined {\n\tfor (const key of GLOBAL_DISPATCHER_KEYS) {\n\t\tconst dispatcher = constructHttp1(Reflect.get(scope, Symbol.for(key)));\n\t\tif (dispatcher !== undefined) {\n\t\t\treturn dispatcher;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Reconstructs `agent`'s class with h2 disabled.\n *\n * Most ways `agent` can be wrong already throw: `Reflect.get` rejects a\n * primitive, `null`, and an absent key, and `Reflect.construct` rejects a\n * `constructor` that is not one, or that refuses the options. One shape gets\n * through — a plain object, whose `constructor` is `Object`, so constructing\n * it hands back the options bag. The result is therefore checked against the\n * one part of undici's surface that is public and stable: a `Dispatcher`\n * exposes `dispatch`.\n *\n * @param agent - The candidate global dispatcher; any value, since it comes\n * from an undocumented global.\n * @returns The new dispatcher, or `undefined` when `agent` is not an object\n * whose constructor accepts undici's agent options.\n */\nfunction constructHttp1(agent: unknown): object | undefined {\n\ttry {\n\t\t// No shape guard ahead of this: `Reflect.get` already rejects a\n\t\t// primitive, `null`, and an absent key, so every malformed value lands\n\t\t// in the same catch.\n\t\tconst agentClass = Reflect.get(agent, \"constructor\");\n\t\tif (!isAgentConstructor(agentClass)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst dispatcher = Reflect.construct(agentClass, [{ allowH2: false }]);\n\t\treturn typeof Reflect.get(dispatcher, \"dispatch\") === \"function\" ? dispatcher : undefined;\n\t} catch {\n\t\t// An internal contract that moved under us is not worth failing a\n\t\t// deploy over: fall back to the runtime's default transport.\n\t\treturn undefined;\n\t}\n}\n","/**\n * A point-in-time rate-limit budget reading parsed from Roblox Open Cloud\n * response headers. Both fields are non-negative integers.\n */\nexport interface RateLimitSample {\n\t/**\n\t * Requests still allowed in the current window (the most-constrained one).\n\t */\n\treadonly remaining: number;\n\t/** Seconds until the most-constrained window resets to full. */\n\treadonly resetSeconds: number;\n}\n\nconst NON_NEGATIVE_INTEGER_PATTERN = /^\\d+$/;\n\n/**\n * Reduces a comma-separated rate-limit header value (e.g. `\"0, 70000\"`) to a\n * single non-negative integer via `combine`. Tokens are trimmed; blank,\n * fractional, negative, and non-finite tokens are dropped so a stray value\n * cannot corrupt the result. Returns `undefined` when the header is absent or\n * has no valid tokens.\n *\n * @param headerValue - The raw header value, or `undefined` if missing.\n * @param combine - Pairwise reducer, `Math.min` for remaining, `Math.max` for reset.\n * @returns The reduced value, or `undefined`.\n */\nexport function reduceRateLimitTokens(\n\theaderValue: string | undefined,\n\tcombine: (a: number, b: number) => number,\n): number | undefined {\n\tif (headerValue === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst tokens = headerValue\n\t\t.split(\",\")\n\t\t.map((part) => part.trim())\n\t\t.filter((part) => NON_NEGATIVE_INTEGER_PATTERN.test(part))\n\t\t.map((part) => Number(part))\n\t\t.filter((value) => Number.isInteger(value));\n\tif (tokens.length === 0) {\n\t\treturn undefined;\n\t}\n\n\treturn tokens.reduce(combine);\n}\n\n/**\n * Parses the `x-ratelimit-remaining` and `x-ratelimit-reset` response headers\n * into a {@link RateLimitSample}. Each header may carry a comma-separated list\n * of per-window values; `remaining` takes the smallest (most constrained) and\n * `resetSeconds` takes the largest (longest wait). Returns `undefined` when\n * either header is missing or has no valid non-negative integer tokens, so a\n * caller can fall back to static pacing.\n *\n * @param headers - Response headers with lowercased keys.\n * @returns The parsed sample, or `undefined` when the budget cannot be read.\n */\nexport function parseRateLimitHeaders(\n\theaders: Readonly<Record<string, string>>,\n): RateLimitSample | undefined {\n\tconst remaining = reduceRateLimitTokens(headers[\"x-ratelimit-remaining\"], (a, b) => {\n\t\treturn Math.min(a, b);\n\t});\n\tconst resetSeconds = reduceRateLimitTokens(headers[\"x-ratelimit-reset\"], (a, b) => {\n\t\treturn Math.max(a, b);\n\t});\n\tif (remaining === undefined || resetSeconds === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn { remaining, resetSeconds };\n}\n","import { reduceRateLimitTokens } from \"./rate-limit-sample.ts\";\n\nconst ABBREVIATED_WEEKDAYS: ReadonlyArray<string> = [\n\t\"Sun\",\n\t\"Mon\",\n\t\"Tue\",\n\t\"Wed\",\n\t\"Thu\",\n\t\"Fri\",\n\t\"Sat\",\n];\nconst ANSI_DATE_PATTERN =\n\t/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d{2}) (\\d{2}):(\\d{2}):(\\d{2}) (\\d{4})$/;\nconst DELAY_SECONDS_PATTERN = /^\\d+$/;\nconst FIXED_DATE_PATTERN =\n\t/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d{2}):(\\d{2}):(\\d{2}) GMT$/;\nconst FULL_WEEKDAY_TO_ABBREVIATED: Readonly<Record<string, string>> = {\n\tFriday: \"Fri\",\n\tMonday: \"Mon\",\n\tSaturday: \"Sat\",\n\tSunday: \"Sun\",\n\tThursday: \"Thu\",\n\tTuesday: \"Tue\",\n\tWednesday: \"Wed\",\n};\nconst MONTHS: ReadonlyArray<string> = [\n\t\"Jan\",\n\t\"Feb\",\n\t\"Mar\",\n\t\"Apr\",\n\t\"May\",\n\t\"Jun\",\n\t\"Jul\",\n\t\"Aug\",\n\t\"Sep\",\n\t\"Oct\",\n\t\"Nov\",\n\t\"Dec\",\n];\nconst OBSOLETE_DATE_PATTERN =\n\t/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2}) GMT$/;\n\ninterface HttpDateParts {\n\treadonly day: number;\n\treadonly hour: number;\n\treadonly minute: number;\n\treadonly month: number;\n\treadonly second: number;\n\treadonly weekday: string;\n\treadonly year: number;\n}\n\ninterface ResolveRetryGuidanceOptions {\n\treadonly headers: Readonly<Record<string, string>>;\n\treadonly nowMs?: number;\n\treadonly remaining: number | undefined;\n}\n\n/**\n * Parses `x-ratelimit-reset` as seconds until quota replenishment. Roblox can\n * report multiple comma-separated windows; the longest valid window is the\n * earliest safe quota retry.\n *\n * @param headerValue - The raw reset value, or `undefined` if missing.\n * @returns The longest reset delay, or `undefined` when absent or invalid.\n */\nexport function parseQuotaResetSeconds(headerValue: string | undefined): number | undefined {\n\treturn reduceRateLimitTokens(headerValue, (a, b) => Math.max(a, b));\n}\n\n/**\n * Parses the standard `Retry-After` header. RFC 9110 permits either a\n * non-negative integer number of seconds or any HTTP-date form. A date is\n * rounded up so a retry never starts before the server's stated instant.\n *\n * @param headerValue - The raw `Retry-After` value, or `undefined` if missing.\n * @param nowMs - Current Unix time in milliseconds, injectable for tests.\n * @returns The delay in seconds, or `undefined` when absent or invalid.\n */\nexport function parseRetryAfterSeconds(\n\theaderValue: string | undefined,\n\tnowMs = Date.now(),\n): number | undefined {\n\tif (headerValue === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst value = headerValue.trim();\n\tif (DELAY_SECONDS_PATTERN.test(value)) {\n\t\tconst seconds = Number(value);\n\t\treturn Number.isFinite(seconds) ? seconds : undefined;\n\t}\n\n\tconst retryAt = parseHttpDate(value, nowMs);\n\treturn retryAt === undefined ? undefined : Math.max(0, Math.ceil((retryAt - nowMs) / 1000));\n}\n\n/**\n * Chooses the applicable server-directed delay for one 429 response.\n *\n * @param options - Response headers, remaining quota, and optional clock.\n * @returns The delay in seconds, or `undefined` when caller backoff applies.\n */\nexport function resolveRetryGuidance({\n\theaders,\n\tnowMs,\n\tremaining,\n}: ResolveRetryGuidanceOptions): number | undefined {\n\tconst retryAfter = parseRetryAfterSeconds(headers[\"retry-after\"], nowMs);\n\tif (remaining !== 0) {\n\t\treturn retryAfter;\n\t}\n\n\tconst quotaReset = parseQuotaResetSeconds(headers[\"x-ratelimit-reset\"]);\n\treturn quotaReset === undefined ? retryAfter : Math.max(retryAfter ?? 0, quotaReset);\n}\n\nfunction httpDateTimestamp(parts: HttpDateParts): number | undefined {\n\tif (parts.minute > 59 || parts.second > 59) {\n\t\treturn undefined;\n\t}\n\n\tconst date = new Date(0);\n\tdate.setUTCFullYear(parts.year, parts.month, parts.day);\n\tdate.setUTCHours(parts.hour, parts.minute, parts.second, 0);\n\n\tconst isExactDate =\n\t\tdate.getUTCDate() === parts.day && ABBREVIATED_WEEKDAYS[date.getUTCDay()] === parts.weekday;\n\treturn isExactDate ? date.getTime() : undefined;\n}\n\nfunction parseAnsiDate(value: string): number | undefined {\n\tconst match = ANSI_DATE_PATTERN.exec(value);\n\treturn match === null\n\t\t? undefined\n\t\t: httpDateTimestamp({\n\t\t\t\tday: Number(match[3]),\n\t\t\t\thour: Number(match[4]),\n\t\t\t\tminute: Number(match[5]),\n\t\t\t\tmonth: MONTHS.indexOf(String(match[2])),\n\t\t\t\tsecond: Number(match[6]),\n\t\t\t\tweekday: String(match[1]),\n\t\t\t\tyear: Number(match[7]),\n\t\t\t});\n}\n\nfunction parseFixedDate(value: string): number | undefined {\n\tconst match = FIXED_DATE_PATTERN.exec(value);\n\treturn match === null\n\t\t? undefined\n\t\t: httpDateTimestamp({\n\t\t\t\tday: Number(match[2]),\n\t\t\t\thour: Number(match[5]),\n\t\t\t\tminute: Number(match[6]),\n\t\t\t\tmonth: MONTHS.indexOf(String(match[3])),\n\t\t\t\tsecond: Number(match[7]),\n\t\t\t\tweekday: String(match[1]),\n\t\t\t\tyear: Number(match[4]),\n\t\t\t});\n}\n\nfunction parseObsoleteDate(value: string, nowMs: number): number | undefined {\n\tconst match = OBSOLETE_DATE_PATTERN.exec(value);\n\tif (match === null) {\n\t\treturn undefined;\n\t}\n\n\tconst currentDate = new Date(nowMs);\n\tconst currentYear = currentDate.getUTCFullYear();\n\tlet year = Math.floor(currentYear / 100) * 100 + Number(match[4]);\n\tif (year > currentYear + 50) {\n\t\tyear -= 100;\n\t}\n\n\treturn httpDateTimestamp({\n\t\tday: Number(match[2]),\n\t\thour: Number(match[5]),\n\t\tminute: Number(match[6]),\n\t\tmonth: MONTHS.indexOf(String(match[3])),\n\t\tsecond: Number(match[7]),\n\t\tweekday: String(FULL_WEEKDAY_TO_ABBREVIATED[String(match[1])]),\n\t\tyear,\n\t});\n}\n\nfunction parseHttpDate(value: string, nowMs: number): number | undefined {\n\treturn parseFixedDate(value) ?? parseObsoleteDate(value, nowMs) ?? parseAnsiDate(value);\n}\n","import { markServerRetryGuidance, RateLimitError } from \"../../errors/rate-limit.ts\";\nimport { headersToRecord, pickRateLimitHeaders } from \"./diagnostics.ts\";\nimport { reduceRateLimitTokens } from \"./rate-limit-sample.ts\";\nimport { resolveRetryGuidance } from \"./retry-guidance.ts\";\n\n/**\n * Builds a public rate-limit error from a 429 response and its already-read\n * body, retaining safe raw evidence alongside the existing parsed guidance.\n *\n * @param response - The 429 response to classify.\n * @param details - The parsed or safely truncated response body.\n * @returns A rate-limit error carrying the response evidence.\n */\nexport function createRateLimitError(\n\tresponse: Response,\n\tdetails: JSONValue | undefined,\n): RateLimitError {\n\tconst headers = headersToRecord(response.headers);\n\tconst remaining = reduceRateLimitTokens(headers[\"x-ratelimit-remaining\"], (a, b) => {\n\t\treturn Math.min(a, b);\n\t});\n\tconst guidedRetrySeconds = resolveRetryGuidance({ headers, remaining });\n\tconst error = new RateLimitError(\"Rate limited\", {\n\t\tcode: extractRateLimitErrorCode(details),\n\t\tdetails,\n\t\tremaining,\n\t\tresponseHeaders: pickRateLimitHeaders(headers),\n\t\tretryAfterSeconds: guidedRetrySeconds ?? 0,\n\t\tstatusCode: response.status,\n\t});\n\treturn guidedRetrySeconds === undefined ? error : markServerRetryGuidance(error);\n}\n\nfunction extractRateLimitErrorCode(body: unknown): string | undefined {\n\tif (body === null || typeof body !== \"object\") {\n\t\treturn undefined;\n\t}\n\n\tconst code = Reflect.get(body, \"code\");\n\treturn typeof code === \"string\" && code.trim() ? code : undefined;\n}\n","import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Options for constructing a {@link RequestAbortedError}.\n *\n * @since 0.3.1\n */\nexport interface RequestAbortedErrorOptions extends ErrorOptions {\n\t/** Whatever `AbortSignal.reason` was at the moment of cancellation. */\n\treadonly reason?: unknown;\n}\n\n/**\n * Returned when a caller's `AbortSignal` cancels an Open Cloud request.\n * The reason is preserved so intentional cancellation can be distinguished\n * from transport failures and SDK-owned request timeouts.\n *\n * @since 0.3.1\n *\n * @example\n *\n * ```ts\n * import { RequestAbortedError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new RequestAbortedError(\"Request was aborted\", {\n * reason: \"superseded\",\n * });\n *\n * expect(error).toBeInstanceOf(RequestAbortedError);\n * expect(error.reason).toBe(\"superseded\");\n * ```\n */\nexport class RequestAbortedError extends OpenCloudError {\n\tpublic override readonly name: string = \"RequestAbortedError\";\n\tpublic readonly reason?: unknown;\n\n\t/**\n\t * Creates a new RequestAbortedError.\n\t *\n\t * @param message - Human-readable description of the cancellation.\n\t * @param options - Error options including the caller's abort reason.\n\t */\n\tconstructor(message: string, options: RequestAbortedErrorOptions = {}) {\n\t\tsuper(message, options);\n\t\tthis.reason = options.reason;\n\t}\n}\n","import { RequestAbortedError } from \"../../errors/request-aborted.ts\";\n\n/**\n * Sentinel returned when an asynchronous operation loses a race with a signal.\n */\nexport const ABORTED = Symbol(\"aborted\");\n\n/**\n * Result of an operation raced against an optional caller signal.\n *\n * @template T - Value produced when the operation wins the race.\n */\nexport type AbortableResult<T> = T | typeof ABORTED;\n\n/**\n * Runs an asynchronous operation and resolves with {@link ABORTED} when the\n * supplied signal fires first. The underlying operation still receives the\n * signal separately so cancellable implementations can release their work.\n *\n * @template T - Value produced by the operation.\n * @param operation - Operation to start after the abort observer is installed.\n * @param signal - Optional caller cancellation signal.\n * @returns The operation's value, or {@link ABORTED} when cancellation wins.\n * @rejects The operation's error when it fails before cancellation.\n */\nexport async function raceWithAbortAsync<T>(\n\toperation: () => Promise<T>,\n\tsignal: AbortSignal | undefined,\n): Promise<AbortableResult<T>> {\n\tif (signal === undefined) {\n\t\treturn operation();\n\t}\n\n\tif (signal.aborted) {\n\t\treturn ABORTED;\n\t}\n\n\tconst { promise, resolve } = Promise.withResolvers<typeof ABORTED>();\n\tfunction onAbort(): void {\n\t\tresolve(ABORTED);\n\t}\n\n\tsignal.addEventListener(\"abort\", onAbort);\n\ttry {\n\t\treturn await Promise.race([operation(), promise]);\n\t} finally {\n\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t}\n}\n\n/**\n * Creates the canonical typed failure for caller-request cancellation.\n *\n * @param signal - The caller signal whose reason should be preserved.\n * @returns A cancellation error carrying the signal's reason.\n */\nexport function requestAbortedError(signal: AbortSignal | undefined): RequestAbortedError {\n\treturn new RequestAbortedError(\"Request was aborted\", { reason: signal?.reason });\n}\n","import { NetworkError } from \"../../errors/network-error.ts\";\nimport type { RequestAbortedError } from \"../../errors/request-aborted.ts\";\nimport { requestAbortedError } from \"../utils/abort.ts\";\nimport type { RequestConfig } from \"./types.ts\";\n\ninterface RequestFailureArgs {\n\treadonly cause: Error;\n\treadonly config: RequestConfig;\n\treadonly effectiveSignal: AbortSignal | null | undefined;\n\treadonly target: { readonly method: string; readonly url: string };\n}\n\n/**\n * Composes caller cancellation with Ocale's transport-attempt timeout. The\n * winning signal's reason is retained by `AbortSignal.any`, allowing failure\n * classification to distinguish cancellation from timeout.\n *\n * @param config - Transport configuration for one request.\n * @returns A caller signal, timeout signal, their composition, or `undefined`.\n */\nexport function requestSignal(config: RequestConfig): AbortSignal | undefined {\n\tif (config.timeout === undefined) {\n\t\treturn config.signal;\n\t}\n\n\tconst timeout = AbortSignal.timeout(config.timeout);\n\treturn config.signal === undefined ? timeout : AbortSignal.any([config.signal, timeout]);\n}\n\n/**\n * Classifies a fetch rejection without confusing a caller abort with the\n * transport's own timeout.\n *\n * @param args - Failure, target, request config, and effective fetch signal.\n * @returns A typed caller cancellation or network failure.\n */\nexport function requestFailure({\n\tcause,\n\tconfig,\n\teffectiveSignal,\n\ttarget,\n}: RequestFailureArgs): NetworkError | RequestAbortedError {\n\tif (\n\t\tconfig.signal?.aborted === true &&\n\t\teffectiveSignal?.aborted === true &&\n\t\tObject.is(effectiveSignal.reason, config.signal.reason)\n\t) {\n\t\treturn requestAbortedError(config.signal);\n\t}\n\n\treturn new NetworkError(\"Network request failed\", {\n\t\tcause,\n\t\tmethod: target.method,\n\t\turl: target.url,\n\t});\n}\n","import type { HttpRequest } from \"../../client/types.ts\";\n\n/**\n * Reports whether a request is an upload: its body is `FormData`\n * (multipart) or `Uint8Array` (raw binary). Upload latency is\n * bandwidth-bound rather than compute-bound, so the SDK applies no default\n * request timeout to these requests; a sensible wall-clock budget depends on\n * payload size and link quality the SDK cannot know.\n *\n * @param request - The built request to classify.\n * @returns `true` when the body is `FormData` or `Uint8Array`.\n */\nexport function isUploadRequest(request: HttpRequest): boolean {\n\treturn request.body instanceof FormData || request.body instanceof Uint8Array;\n}\n","import { ApiError } from \"../../errors/api-error.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { tryCatchAsync } from \"../utils/try-catch.ts\";\nimport {\n\tbodyDetail,\n\textractGatewaySummary,\n\theadersToRecord,\n\tparseFailureError,\n\tpickDiagnosticHeaders,\n\ttype RequestContext,\n} from \"./diagnostics.ts\";\nimport { createHttp1Dispatcher } from \"./http1-dispatcher.ts\";\nimport { createRateLimitError } from \"./rate-limit-response.ts\";\nimport { requestFailure, requestSignal } from \"./request-signal.ts\";\nimport type { HttpClient, HttpRequest, HttpResponse, RequestConfig } from \"./types.ts\";\nimport { isUploadRequest } from \"./upload-request.ts\";\n\nconst CONTENT_TYPE_HEADER = \"content-type\";\n\n// Uploads opt out of keep-alive reuse. Roblox's edge gateway discards idle\n// pooled connections faster than a pooling `fetch` expects, and a request\n// written into a discarded connection never reaches Open Cloud: it surfaces as\n// a gateway error page or a socket reset, minutes later, having done nothing.\n// An upload holds a connection far longer than a JSON call, so it is the shape\n// that loses this race. The cost is a fresh handshake and a cold congestion\n// window per upload (real for a multi-megabyte body, and paid again on each\n// retry), but cheaper than a lost write. Small, frequent calls keep pooling.\nconst CONNECTION_HEADER = \"connection\";\n\n/**\n * `RequestInit` plus undici's non-standard `dispatcher`, the only way to\n * select a transport from `fetch`. Declared locally because it is absent from\n * the DOM lib and runtimes that do not understand it ignore it.\n */\ninterface FetchOptions extends RequestInit {\n\tdispatcher?: object | undefined;\n}\n\n/**\n * Collaborators of {@link createFetchHttpClient}, bundled so the factory keeps\n * a two-argument signature as they accumulate. Both have production defaults;\n * both are overridable, which is also what makes them testable.\n */\ninterface FetchHttpClientSeams {\n\t/**\n\t * Builds the HTTP/1.1-only transport uploads use, so the\n\t * `connection: close` directive is not dropped by an h2 transport.\n\t */\n\treadonly createDispatcher?: () => object | undefined;\n\t/** Monotonic-ish clock used to measure request elapsed time. */\n\treadonly now?: () => number;\n}\n\ninterface SendRequestArgs {\n\treadonly config: RequestConfig;\n\treadonly dispatcherFor: (request: HttpRequest) => object | undefined;\n\treadonly fetchFunc: (url: string, init: RequestInit) => Promise<Response>;\n\treadonly httpRequest: HttpRequest;\n\treadonly now: () => number;\n}\n\ninterface ErrorResponseArgs {\n\treadonly context: RequestContext;\n\treadonly parsed: Result<JSONValue | undefined>;\n\treadonly rawText: string;\n\treadonly response: Response;\n}\n\ninterface ApiErrorMessageParts {\n\treadonly code: string | undefined;\n\treadonly message: string | undefined;\n\treadonly status: number;\n}\n\n/**\n * Permissively extracts a machine-readable error code from a response body.\n *\n * Three shapes are checked, in precedence order. Modern Open Cloud responses\n * use `{ errorCode: string, message: string }`; Open Cloud v2 endpoints carry\n * the canonical status in `error` (`{ error: \"NOT_FOUND\", message: string }`);\n * the legacy game-internationalization endpoints use\n * `{ errors: [{ code: number, message: string }, ...] }`. Numeric legacy codes\n * are returned as strings so callers see one consistent type.\n *\n * `error` is read only when it holds a string. A Google-style nested envelope\n * (`{ error: { code, message, status } }`) puts an object there, and coercing\n * that to a string would hand callers `\"[object Object]\"` as a status.\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\tconst v2Error = Reflect.get(body, \"error\");\n\tif (typeof v2Error === \"string\") {\n\t\treturn v2Error;\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 * 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): FetchOptions {\n\tconst headers = new Headers({\n\t\t\"x-api-key\": config.apiKey,\n\t});\n\n\tconst options: FetchOptions = {\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_HEADER, \"application/octet-stream\");\n\t\toptions.body = request.body;\n\t} else if (request.body !== undefined) {\n\t\theaders.set(CONTENT_TYPE_HEADER, \"application/json\");\n\t\toptions.body = JSON.stringify(request.body);\n\t}\n\n\tapplyRequestHeaders(headers, request);\n\n\tconst signal = requestSignal(config);\n\tif (signal !== undefined) {\n\t\toptions.signal = signal;\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 * @param seams - Injectable clock and dispatcher factory, so tests need not\n * depend on wall-clock time or on the runtime's global dispatcher.\n * @returns An HttpClient that classifies responses into typed Results.\n */\nexport function createFetchHttpClient(\n\tfetchFunc: (url: string, init: RequestInit) => Promise<Response> = fetch,\n\t{ createDispatcher = createHttp1Dispatcher, now = Date.now }: FetchHttpClientSeams = {},\n): HttpClient {\n\tconst dispatcherFor = createUploadDispatcherCache(createDispatcher);\n\n\treturn {\n\t\tasync request(httpRequest, config) {\n\t\t\treturn sendRequestAsync({ config, dispatcherFor, fetchFunc, httpRequest, now });\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\n/**\n * Merges the request's own headers onto the transport's, then applies the\n * transport-owned connection directive. `x-api-key` is skipped so a request\n * cannot override the configured credential, and the upload directive is set\n * last so a request header cannot silently re-enable pooling for an upload.\n *\n * @param headers - The headers being built for the fetch call. Mutated.\n * @param request - The request whose headers and body shape drive the merge.\n */\nfunction applyRequestHeaders(headers: Headers, request: HttpRequest): void {\n\tconst requestHeaders = request.headers ?? {};\n\tfor (const [name, value] of Object.entries(requestHeaders)) {\n\t\tif (name.toLowerCase() === \"x-api-key\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\theaders.set(name, value);\n\t}\n\n\tif (isUploadRequest(request)) {\n\t\theaders.set(CONNECTION_HEADER, \"close\");\n\t}\n}\n\nfunction failureResult(args: Parameters<typeof requestFailure>[0]): Result<never, OpenCloudError> {\n\treturn { err: requestFailure(args), success: false };\n}\n\n/**\n * Runs `send` and reports both its Result and how long it was in flight,\n * measured with `now`. Isolated so the timing start need not sit in the request\n * body ahead of the transport-failure early return.\n *\n * @param now - The clock used to bound the call.\n * @param send - A thunk that issues the fetch.\n * @returns The fetch Result and the elapsed milliseconds.\n */\nasync function timedFetchAsync(\n\tnow: () => number,\n\tsend: () => Promise<Response>,\n): Promise<{ elapsedMs: number; fetchResult: Result<Response> }> {\n\tconst start = now();\n\tconst fetchResult = await tryCatchAsync(send());\n\t// Clamp to zero: `Date.now` is wall-clock, so an NTP adjustment mid-request\n\t// could otherwise report a negative \"after -0.1s\".\n\treturn { elapsedMs: Math.max(0, now() - start), fetchResult };\n}\n\nfunction formatApiErrorMessage({ code, message, status }: ApiErrorMessageParts): string {\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(args: ErrorResponseArgs): ApiError {\n\tconst { context, rawText, response } = args;\n\tconst { status } = response;\n\tconst headers = headersToRecord(response.headers);\n\tconst requestContext = {\n\t\telapsedMs: context.elapsedMs,\n\t\tmethod: context.method,\n\t\tresponseHeaders: pickDiagnosticHeaders(headers),\n\t\tstatusCode: status,\n\t\turl: context.url,\n\t};\n\n\t// An HTML body is a load-balancer error page, not an Open Cloud response;\n\t// summarize it rather than retaining the raw HTML on `details`.\n\tconst gatewaySummary = extractGatewaySummary(headers[CONTENT_TYPE_HEADER], rawText);\n\tif (gatewaySummary !== undefined) {\n\t\treturn new ApiError(`HTTP ${status}`, { ...requestContext, gatewaySummary });\n\t}\n\n\tconst body = bodyDetail(rawText, args.parsed);\n\tconst code = extractErrorCode(body);\n\tconst message = extractErrorMessage(body);\n\treturn new ApiError(formatApiErrorMessage({ code, message, status }), {\n\t\t...requestContext,\n\t\tcode,\n\t\tdetails: body,\n\t});\n}\n\n/**\n * Parses response text as JSON, returning the underlying `SyntaxError` on\n * failure rather than throwing. The synchronous sibling of {@link\n * tryCatchAsync}.\n *\n * @param text - The raw response body text.\n * @returns A Result wrapping the parsed value, or the parse error.\n */\nfunction parseJson(text: string): Result<JSONValue> {\n\ttry {\n\t\treturn { data: JSON.parse(text), success: true };\n\t} catch (err) {\n\t\treturn { err: err instanceof Error ? err : new Error(String(err)), success: false };\n\t}\n}\n\n/**\n * Reads a response body once and parses it best-effort: an empty body is a\n * successful `undefined`, otherwise the JSON parse result (which carries the\n * `SyntaxError` on failure). Returns the raw `text` alongside so callers that\n * need the original bytes (parse-failure diagnostics) do not re-read the\n * consumed stream.\n *\n * @param response - The Response whose body to read.\n * @returns The parse result and the raw text.\n */\nasync function readResponseBodyAsync(\n\tresponse: Response,\n): Promise<{ parsed: Result<JSONValue | undefined>; text: string }> {\n\tconst text = await response.text();\n\treturn {\n\t\tparsed: text === \"\" ? { data: undefined, success: true } : parseJson(text),\n\t\ttext,\n\t};\n}\n\n/**\n * Classifies a fetch `Response` into a typed `Result`.\n *\n * The body is read once and parsed best-effort. Error responses (status >= 300)\n * never require valid JSON: an error body that is not valid JSON degrades to a\n * status-based {@link ApiError} carrying the raw text, and an HTML gateway page\n * is summarized rather than dumped. A parse failure is only fatal on a 2xx,\n * where a parseable body is part of the contract.\n *\n * @param response - The raw fetch Response to classify.\n * @param context - The request context (method, url, elapsed time) threaded\n * onto every {@link ApiError} built here, whether for an error response or\n * for a 2xx whose body would not parse.\n * @returns A Result containing an HttpResponse on success or an OpenCloudError on failure.\n */\nasync function classifyResponseAsync(\n\tresponse: Response,\n\tcontext: RequestContext,\n): Promise<Result<HttpResponse, OpenCloudError>> {\n\tconst { parsed, text } = await readResponseBodyAsync(response);\n\n\tif (response.status === 429) {\n\t\treturn { err: createRateLimitError(response, bodyDetail(text, parsed)), success: false };\n\t}\n\n\tif (response.status >= 300) {\n\t\treturn {\n\t\t\terr: createApiError({ context, parsed, rawText: text, response }),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tif (!parsed.success) {\n\t\treturn {\n\t\t\terr: parseFailureError({ cause: parsed.err, context, response, text }),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbody: parsed.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\nasync function sendRequestAsync({\n\tconfig,\n\tdispatcherFor,\n\tfetchFunc,\n\thttpRequest,\n\tnow,\n}: SendRequestArgs): Promise<Result<HttpResponse, OpenCloudError>> {\n\tconst url = buildUrl(httpRequest, config);\n\tconst options = buildFetchOptions(httpRequest, config);\n\toptions.dispatcher = dispatcherFor(httpRequest);\n\tconst target = { method: httpRequest.method, url };\n\tconst { elapsedMs, fetchResult } = await timedFetchAsync(now, async () => {\n\t\treturn fetchFunc(url, options);\n\t});\n\tif (!fetchResult.success) {\n\t\treturn failureResult({\n\t\t\tcause: fetchResult.err,\n\t\t\tconfig,\n\t\t\teffectiveSignal: options.signal,\n\t\t\ttarget,\n\t\t});\n\t}\n\n\tconst context: RequestContext = { elapsedMs, method: target.method, url: target.url };\n\tconst classified = await tryCatchAsync(classifyResponseAsync(fetchResult.data, context));\n\treturn classified.success\n\t\t? classified.data\n\t\t: failureResult({ cause: classified.err, config, effectiveSignal: options.signal, target });\n}\n\n/**\n * Wraps a dispatcher factory in the caching policy uploads need.\n *\n * Resolution happens on the first upload rather than at construction: undici\n * publishes its global dispatcher lazily, so before a process's first `fetch`\n * there is nothing to read. A resolved dispatcher is kept, and an unresolved\n * one is retried on the next upload — so a runtime that publishes late is\n * still picked up, and the first request of a process, which has no pooled\n * connection to lose, is safe either way.\n *\n * @param createDispatcher - Builds the HTTP/1.1-only transport.\n * @returns A function yielding the dispatcher for a request, or `undefined`\n * when the request is not an upload or no dispatcher is available.\n */\nfunction createUploadDispatcherCache(\n\tcreateDispatcher: () => object | undefined,\n): (request: HttpRequest) => object | undefined {\n\tlet cached: object | undefined;\n\treturn (request) => {\n\t\tif (!isUploadRequest(request)) {\n\t\t\treturn;\n\t\t}\n\n\t\tcached ??= createDispatcher();\n\t\treturn cached;\n\t};\n}\n","import { ApiError, type ApiErrorOptions } from \"./api-error.ts\";\n\n/**\n * Options for constructing a {@link PermissionError}.\n *\n * @since 0.1.0\n */\nexport interface PermissionErrorOptions extends ApiErrorOptions {\n\t/**\n\t * Stable identifier of the Open Cloud operation that returned the\n\t * permission failure (matches `OperationLimit.operationKey`, e.g.\n\t * `\"developer-products.create\"`).\n\t */\n\toperationKey: string;\n\t/**\n\t * Scope strings the API key or OAuth token must carry for the failing\n\t * operation, sourced from the vendored OpenAPI schema's `x-roblox-scopes`\n\t * for that operationId.\n\t */\n\trequiredScopes: ReadonlyArray<string>;\n}\n\n/**\n * Thrown when the Roblox Open Cloud API returns a 401 or 403 for an operation\n * whose required scopes are known. Subclass of {@link ApiError} carrying the\n * scope strings the operation requires plus the operation key, so a consumer\n * can name them when guiding the user to their API key settings.\n *\n * The scopes are what the operation needs, not a diagnosis of what the\n * credential lacks: a 403 does mean the scopes fall short, but Roblox also\n * answers 401 for a key that is invalid, disabled, or expired. Check\n * {@link ApiError.statusCode} before wording the failure as a missing scope.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { PermissionError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new PermissionError(\"HTTP 403\", {\n * operationKey: \"developer-products.create\",\n * requiredScopes: [\"creator-store-product:write\"],\n * statusCode: 403,\n * });\n *\n * expect(error).toBeInstanceOf(PermissionError);\n * expect(error.requiredScopes).toStrictEqual([\"creator-store-product:write\"]);\n * expect(error.operationKey).toBe(\"developer-products.create\");\n * ```\n */\nexport class PermissionError extends ApiError {\n\tpublic override readonly name: string = \"PermissionError\";\n\tpublic readonly operationKey: string;\n\tpublic readonly requiredScopes: ReadonlyArray<string>;\n\n\t/**\n\t * Creates a new PermissionError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including status code, the operation key,\n\t * and the scopes the caller's credential must carry.\n\t */\n\tconstructor(message: string, options: PermissionErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.operationKey = options.operationKey;\n\t\tthis.requiredScopes = options.requiredScopes;\n\t}\n}\n","import type { AdmissionWaitReason } from \"../client/types.ts\";\nimport { OpenCloudError } from \"./base.ts\";\n\n/**\n * Options for constructing a {@link RequestDeadlineExceededError}.\n *\n * @since 0.3.2\n */\nexport interface RequestDeadlineExceededErrorOptions extends ErrorOptions {\n\t/** Absolute caller-supplied deadline, as Unix epoch milliseconds. */\n\treadonly deadlineMs: number;\n\t/** Time left when the SDK refused or ended the wait. */\n\treadonly remainingMs: number;\n\t/** Intended wait duration, when it was known before waiting. */\n\treadonly waitMs?: number | undefined;\n\t/** SDK admission mechanism whose wait could not meet the deadline. */\n\treadonly waitReason?: AdmissionWaitReason | undefined;\n}\n\n/**\n * Returned when a logical request cannot complete by its absolute deadline.\n * Optional wait details identify an SDK-managed admission wait that was\n * refused. This is distinct from caller cancellation so consumers can report\n * exhausted wall-clock budget accurately.\n *\n * @since 0.3.2\n *\n * @example\n *\n * ```ts\n * import { RequestDeadlineExceededError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new RequestDeadlineExceededError(\"Request deadline elapsed\", {\n * deadlineMs: 1_000_000,\n * remainingMs: 0,\n * waitReason: \"operation-queue\",\n * });\n *\n * expect(error.remainingMs).toBe(0);\n * expect(error.waitReason).toBe(\"operation-queue\");\n * ```\n */\nexport class RequestDeadlineExceededError extends OpenCloudError {\n\t/** Absolute caller-supplied deadline, as Unix epoch milliseconds. */\n\tpublic readonly deadlineMs: number;\n\tpublic override readonly name: string = \"RequestDeadlineExceededError\";\n\t/** Time left when the SDK refused or ended the wait. */\n\tpublic readonly remainingMs: number;\n\t/** Intended wait duration, when known. */\n\tpublic readonly waitMs: number | undefined;\n\t/** SDK admission mechanism whose wait could not meet the deadline. */\n\tpublic readonly waitReason: AdmissionWaitReason | undefined;\n\n\t/**\n\t * Creates a new RequestDeadlineExceededError.\n\t *\n\t * @param message - Human-readable description of the exhausted deadline.\n\t * @param options - Deadline, remaining budget, and optional wait details.\n\t */\n\tconstructor(message: string, options: RequestDeadlineExceededErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.deadlineMs = options.deadlineMs;\n\t\tthis.remainingMs = options.remainingMs;\n\t\tthis.waitMs = options.waitMs;\n\t\tthis.waitReason = options.waitReason;\n\t}\n}\n","import { RequestDeadlineExceededError } from \"./request-deadline-exceeded.ts\";\n\n/**\n * Options for constructing a {@link RetryDelayExceededError}.\n *\n * @since 0.3.2\n */\nexport interface RetryDelayExceededErrorOptions extends ErrorOptions {\n\t/** Absolute caller-supplied deadline, as Unix epoch milliseconds. */\n\treadonly deadlineMs: number;\n\t/** Time left when the SDK refused the retry delay. */\n\treadonly remainingMs: number;\n\t/** Computed retry delay that could not fit before the deadline. */\n\treadonly retryAfterMs: number;\n}\n\n/**\n * Returned when the SDK refuses a retry delay that cannot complete before the\n * request deadline. This is distinct from cancellation so consumers can\n * report the server's stated retry time without waiting for it.\n *\n * @since 0.3.2\n *\n * @example\n *\n * ```ts\n * import { RetryDelayExceededError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new RetryDelayExceededError(\"Retry delay exceeds the request deadline\", {\n * deadlineMs: 1_000_000,\n * remainingMs: 495_000,\n * retryAfterMs: 1_856_000,\n * });\n *\n * expect(error.retryAfterMs).toBe(1_856_000);\n * expect(error.remainingMs).toBe(495_000);\n * ```\n */\nexport class RetryDelayExceededError extends RequestDeadlineExceededError {\n\tpublic override readonly name: string = \"RetryDelayExceededError\";\n\t/** Computed retry delay refused by the SDK, in milliseconds. */\n\tpublic readonly retryAfterMs: number;\n\t/** Computed retry delay refused by the SDK, in seconds. */\n\tpublic readonly retryAfterSeconds: number;\n\n\t/**\n\t * Creates a new RetryDelayExceededError.\n\t *\n\t * @param message - Human-readable description of the refused retry delay.\n\t * @param options - Refused delay, deadline budget, and original failure.\n\t */\n\tconstructor(message: string, options: RetryDelayExceededErrorOptions) {\n\t\tsuper(message, {\n\t\t\t...options,\n\t\t\twaitMs: options.retryAfterMs,\n\t\t\twaitReason: \"retry-delay\",\n\t\t});\n\t\tthis.retryAfterMs = options.retryAfterMs;\n\t\tthis.retryAfterSeconds = options.retryAfterMs / 1000;\n\t}\n}\n","/**\n * Maximum cause-chain depth walked by {@link findErrorCode}. Caps pathological\n * self-referential or deeply nested chains; transport failures surface as\n * `NetworkError → TypeError(\"fetch failed\") → OS Error{code}`, so three\n * levels is the expected shape and five leaves headroom.\n */\nconst MAX_DEPTH = 5;\n\n/**\n * Walks an error's `cause` chain and returns the first node-style string\n * `code` it finds (for example `\"ECONNRESET\"`, `\"ETIMEDOUT\"`). Native `fetch`\n * surfaces a transport reset as a `NetworkError` wrapping a\n * `TypeError(\"fetch failed\")` whose own cause carries the OS-level `code`, so\n * the code lives several links down the chain.\n *\n * @example\n *\n * ```ts\n * import { findErrorCode } from \"./find-error-code\";\n *\n * const root = Object.assign(new Error(\"read ECONNRESET\"), { code: \"ECONNRESET\" });\n * const outer = new Error(\"Network request failed\", {\n * cause: new TypeError(\"fetch failed\", { cause: root }),\n * });\n *\n * expect(findErrorCode(outer)).toBe(\"ECONNRESET\");\n * ```\n *\n * @param error - The error to inspect; typically a `NetworkError`.\n * @returns The first string `code` in the chain, or `undefined` if none.\n */\nexport function findErrorCode(error: unknown): string | undefined {\n\tlet current: unknown = error;\n\tfor (let depth = 0; depth < MAX_DEPTH && current instanceof Error; depth += 1) {\n\t\tconst code = readCode(current);\n\t\tif (code !== undefined) {\n\t\t\treturn code;\n\t\t}\n\n\t\tcurrent = current.cause;\n\t}\n\n\treturn undefined;\n}\n\nfunction readCode(error: Error): string | undefined {\n\tconst code = Reflect.get(error, \"code\");\n\treturn typeof code === \"string\" ? code : undefined;\n}\n\n/**\n * `DOMException.name` produced when an `AbortSignal.timeout` fires. This is the\n * web-standard discriminator (stable across Node and Bun, unlike the\n * runtime-specific message) and distinguishes the SDK's own request timeout\n * from a caller-supplied cancellation, which surfaces as `\"AbortError\"`.\n */\nconst TIMEOUT_ABORT_NAME = \"TimeoutError\";\n\n/**\n * Reports whether an error chain was produced by the SDK's own\n * `AbortSignal.timeout` self-abort. Such a `DOMException` carries a numeric\n * `code` (23), so {@link findErrorCode} (which only reads string codes)\n * cannot classify it; this walk keys on `name` instead. A caller-supplied\n * abort (`\"AbortError\"`) is deliberately not matched.\n *\n * @example\n *\n * ```ts\n * import { isTimeoutAbort } from \"./find-error-code\";\n *\n * const error = new Error(\"Network request failed\", {\n * cause: new DOMException(\"timed out\", \"TimeoutError\"),\n * });\n *\n * expect(isTimeoutAbort(error)).toBe(true);\n * expect(isTimeoutAbort(new DOMException(\"cancelled\", \"AbortError\"))).toBe(false);\n * ```\n *\n * @param error - The error to inspect; typically a `NetworkError`.\n * @returns `true` when a `TimeoutError` abort sits within the cause chain.\n */\nexport function isTimeoutAbort(error: unknown): boolean {\n\tlet current: unknown = error;\n\tfor (let depth = 0; depth < MAX_DEPTH && current instanceof Error; depth += 1) {\n\t\tif (Reflect.get(current, \"name\") === TIMEOUT_ABORT_NAME) {\n\t\t\treturn true;\n\t\t}\n\n\t\tcurrent = current.cause;\n\t}\n\n\treturn false;\n}\n","import { ApiError } from \"../../errors/api-error.ts\";\nimport { NetworkError } from \"../../errors/network-error.ts\";\nimport { hasServerRetryGuidance, RateLimitError } from \"../../errors/rate-limit.ts\";\nimport { findErrorCode, isTimeoutAbort } from \"../utils/find-error-code.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/**\n\t * Codes for transport-level failures eligible for retry: node-style\n\t * transport codes ({@link findErrorCode}) surfaced as a\n\t * {@link NetworkError}, plus the synthetic {@link GATEWAY_REJECTED} for a\n\t * response served by an edge gateway. Not all of them prove the request\n\t * went unprocessed — see {@link TRANSIENT_TRANSPORT_CODES}. Empty for\n\t * create operations by default; consumers opt a create in via a per-request\n\t * override.\n\t */\n\treadonly retryableTransportCodes: ReadonlyArray<string>;\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 * Transient transport error codes that are safe to retry for idempotent\n * operations. Connection resets, timeouts, and DNS hiccups are recoverable on\n * a retry. A self-aborted request timeout carries no OS-level `code`, so\n * {@link shouldRetry} folds it into this set as `ETIMEDOUT` (via\n * {@link isTimeoutAbort}) for idempotent methods; create methods retry no\n * transport codes and so still never re-issue a timed-out write.\n *\n * `ERR_HTTP2_STREAM_ERROR`, `ERR_HTTP2_SESSION_ERROR`, and `UND_ERR_INFO` are\n * the same deaths as spelled by a runtime whose `fetch` negotiates HTTP/2\n * (Node 26 and later). They differ from the socket codes in one way that\n * matters: they do not prove the request went unprocessed. `UND_ERR_INFO`\n * covers both a `GOAWAY` declaring a stream was never started and a stream\n * that was fully sent, and `UND_ERR_SOCKET` can fire once a response is\n * already streaming. Retrying them is therefore justified by the operation\n * being safe to repeat, never by the request having gone unseen — which is\n * why {@link UPLOAD_METHOD_DEFAULTS}, the one write policy that includes\n * them, documents its own grounds.\n *\n * @since 0.1.0\n */\nexport const TRANSIENT_TRANSPORT_CODES: ReadonlyArray<string> = Object.freeze([\n\t\"ECONNRESET\",\n\t\"ECONNREFUSED\",\n\t\"ETIMEDOUT\",\n\t\"EPIPE\",\n\t\"ENETUNREACH\",\n\t\"EHOSTDOWN\",\n\t\"EAI_AGAIN\",\n\t\"UND_ERR_SOCKET\",\n\t\"ERR_HTTP2_STREAM_ERROR\",\n\t\"ERR_HTTP2_SESSION_ERROR\",\n\t\"UND_ERR_INFO\",\n]);\n\n/**\n * Synthetic transport code for a response that came from an edge gateway\n * rather than Open Cloud ({@link ApiError.gatewaySummary}). Such a response\n * proves the request was rejected before any Open Cloud handler saw it, so it\n * is classified alongside {@link TRANSIENT_TRANSPORT_CODES} rather than by its\n * HTTP status: the status belongs to the gateway, not to the API, and a\n * gateway `400` says nothing about the validity of the request.\n *\n * Name it in a per-request `retryableTransportCodes` override to opt an\n * operation into (or out of) gateway-rejection retry.\n *\n * @since 0.1.2\n */\nexport const GATEWAY_REJECTED = \"GATEWAY_REJECTED\";\n\n/**\n * Synthetic transport code for a 2xx whose body could not be parsed as JSON\n * ({@link ApiError.unparsedBodyLength}). Open Cloud does not answer a success\n * status with a malformed document; what this failure describes in practice is\n * a body the edge delivered short, ending mid-token at exactly the length that\n * arrived. The next read is a fresh body and usually a whole one.\n *\n * Classifying it by transport code rather than by HTTP status is what makes it\n * recoverable at all: the status is a 200, which no `retryableStatuses` list\n * contains, so a status-keyed decision could only ever say \"do not retry\".\n *\n * Retrying is justified by the operation being safe to repeat, never by the\n * request having gone unprocessed — a 200 proves it was processed. So this code\n * is in {@link IDEMPOTENT_METHOD_DEFAULTS} only. Creates and uploads leave it\n * out: their write landed, and re-issuing it to re-read the answer would risk a\n * second resource for a response body, which is the wrong trade. A consumer who\n * can tolerate that duplicate names this code in a per-request\n * `retryableTransportCodes` override.\n *\n * @since 0.1.5\n */\nexport const RESPONSE_UNPARSEABLE = \"RESPONSE_UNPARSEABLE\";\n\n/** Method-level retry defaults, keyed by {@link MethodKind}. */\ntype MethodDefaults = Readonly<\n\tPick<RetryResolvable, \"retryableStatuses\" | \"retryableTransportCodes\">\n>;\n\n/**\n * Default retry policy for idempotent operations (read, list, update,\n * delete). Safe to retry on rate limits, transient server errors, and\n * transient transport failures.\n */\nexport const IDEMPOTENT_METHOD_DEFAULTS: MethodDefaults = Object.freeze({\n\tretryableStatuses: Object.freeze([429, 500, 502, 503, 504] as const),\n\tretryableTransportCodes: Object.freeze([...TRANSIENT_TRANSPORT_CODES, RESPONSE_UNPARSEABLE]),\n});\n\n/**\n * Default retry policy for create operations. Retries rate limits only (no\n * 5xx and no transport-error retries) to prevent duplicate resources, since\n * Roblox Open Cloud has no idempotency-key support. Consumers who can tolerate\n * a duplicate opt in per request.\n */\nexport const CREATE_METHOD_DEFAULTS: MethodDefaults = Object.freeze({\n\tretryableStatuses: Object.freeze([429] as const),\n\tretryableTransportCodes: Object.freeze([] as const),\n});\n\n/**\n * Default retry policy for upload operations (place publish and save). Keeps\n * {@link CREATE_METHOD_DEFAULTS}'s 5xx guard (a 5xx comes from Open Cloud and\n * may describe a write that partly landed), but retries transport failures:\n * {@link TRANSIENT_TRANSPORT_CODES} and {@link GATEWAY_REJECTED}.\n *\n * This is the one write policy that retries codes which do not prove the\n * request went unprocessed, and the grounds are specific to a place version:\n * Roblox dedupes identical place content, so a retry that races a publish\n * which did land returns that same version rather than creating a second one.\n * That is load-bearing, not incidental — an upload operation without content\n * dedupe would need its own allowlist.\n */\nexport const UPLOAD_METHOD_DEFAULTS: MethodDefaults = Object.freeze({\n\t...CREATE_METHOD_DEFAULTS,\n\tretryableTransportCodes: Object.freeze([...TRANSIENT_TRANSPORT_CODES, GATEWAY_REJECTED]),\n});\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 valid server\n * guidance on a {@link RateLimitError}, including an explicit zero-second\n * delay; 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 | NetworkError | RateLimitError,\n\toptions: ComputeRetryWaitMsOptions,\n): number {\n\tif (error instanceof RateLimitError && hasServerRetryGuidance(error)) {\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. {@link\n * RateLimitError} (checked against 429) and {@link ApiError} (checked against\n * its `statusCode`) are retryable when their status is in `retryableStatuses`.\n * Two {@link ApiError} shapes are the exception, both checked against\n * `retryableTransportCodes` with their status never consulted: one carrying a\n * `gatewaySummary` is checked against {@link GATEWAY_REJECTED}, and one\n * carrying an `unparsedBodyLength` — a 2xx whose body would not parse —\n * against {@link RESPONSE_UNPARSEABLE}. A {@link NetworkError} is\n * retryable when its transport code ({@link findErrorCode}) is in\n * `retryableTransportCodes`. This is how transient connection resets recover.\n * A self-aborted request timeout ({@link isTimeoutAbort}) carries no transport\n * code, so it is classified as `ETIMEDOUT`: recovered for idempotent methods,\n * never for creates (whose list is empty). All other failures 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], retryableTransportCodes: [] })).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 reset = Object.assign(new Error(\"read ECONNRESET\"), { code: \"ECONNRESET\" });\n * const error = new NetworkError(\"Network request failed\", { cause: reset });\n *\n * expect(\n * shouldRetry(error, { retryableStatuses: [], retryableTransportCodes: [\"ECONNRESET\"] }),\n * ).toBe(true);\n * ```\n *\n * @param error - The error returned by the failing request.\n * @param config - Object carrying the retry-eligible status and transport-code lists.\n * @returns `true` if the error should be retried, `false` otherwise.\n */\nexport function shouldRetry(\n\terror: unknown,\n\tconfig: {\n\t\treadonly retryableStatuses: ReadonlyArray<number>;\n\t\treadonly retryableTransportCodes: ReadonlyArray<string>;\n\t},\n): error is ApiError | NetworkError | RateLimitError {\n\tif (error instanceof RateLimitError) {\n\t\treturn config.retryableStatuses.includes(429);\n\t}\n\n\tif (error instanceof ApiError) {\n\t\tif (error.gatewaySummary !== undefined) {\n\t\t\treturn config.retryableTransportCodes.includes(GATEWAY_REJECTED);\n\t\t}\n\n\t\tif (error.unparsedBodyLength !== undefined) {\n\t\t\treturn config.retryableTransportCodes.includes(RESPONSE_UNPARSEABLE);\n\t\t}\n\n\t\treturn config.retryableStatuses.includes(error.statusCode);\n\t}\n\n\tif (error instanceof NetworkError) {\n\t\tconst code = findErrorCode(error) ?? (isTimeoutAbort(error) ? \"ETIMEDOUT\" : undefined);\n\t\treturn code !== undefined && config.retryableTransportCodes.includes(code);\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 * retryableTransportCodes: [],\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 * retryableTransportCodes: [],\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\t{ methodDefaults, methodKind, requestOptions }: MergeConfigOptions<T>,\n): T {\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"],"mappings":";;;;;;;;;AASA,eAAsB,cAAiB,SAAyC;CAC/E,IAAI;EAEH,OAAO;GAAE,MAAA,MADU;GACJ,SAAS;EAAK;CAC9B,SAAS,KAAK;EACb,OAAO;GAAE,KAAK,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;GAAG,SAAS;EAAM;CACnF;AACD;;;ACXA,MAAM,oBAAoB;AAE1B,MAAMA,wBAAsB;AAiC5B,MAAM,8BAAmD,IAAI,IAAI;CAChE;CACA;CACA;CACA;AACD,CAAC;AAED,MAAM,2BAA2B;AAEjC,MAAM,8BAAmD,IAAI,IAAI;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAKD,MAAM,qBAAqB;AAC3B,MAAM,kBAAkB;AACxB,MAAM,cAAc;AACpB,MAAM,qBAAqB;;;;;;;;;;;;;;;;AAiB3B,SAAgB,sBACf,aACA,SACqB;CACrB,IAAI,CAAC,WAAW,aAAa,OAAO,GACnC;CAGD,OACC,aAAa,SAAS;EAAE,OAAO;EAAY,MAAM;CAAmB,CAAC,KACrE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