@bedrock-rbx/ocale 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/assets.d.mts +64 -0
- package/dist/assets.d.mts.map +1 -0
- package/dist/assets.mjs +301 -0
- package/dist/assets.mjs.map +1 -0
- package/dist/badge-insufficient-funds-BLFvQZt1.mjs +91 -0
- package/dist/badge-insufficient-funds-BLFvQZt1.mjs.map +1 -0
- package/dist/badges.d.mts +136 -17
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +375 -99
- package/dist/badges.mjs.map +1 -1
- package/dist/{capacity-admission-hycCFkTo.d.mts → capacity-admission-Ce2V9QNb.d.mts} +2 -10
- package/dist/capacity-admission-Ce2V9QNb.d.mts.map +1 -0
- package/dist/{data.generated-D_vpa5-g.d.mts → data.generated-B4Fztv_7.d.mts} +1 -3
- package/dist/{data.generated-D_vpa5-g.d.mts.map → data.generated-B4Fztv_7.d.mts.map} +1 -1
- package/dist/developer-products.d.mts +29 -11
- package/dist/developer-products.d.mts.map +1 -1
- package/dist/developer-products.mjs +104 -18
- package/dist/developer-products.mjs.map +1 -1
- package/dist/game-passes.d.mts +2 -10
- package/dist/game-passes.d.mts.map +1 -1
- package/dist/game-passes.mjs +12 -18
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +58 -39
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +9 -12
- package/dist/index.mjs.map +1 -1
- package/dist/is-date-time-string-C91G44SI.mjs +19 -0
- package/dist/is-date-time-string-C91G44SI.mjs.map +1 -0
- package/dist/locales.d.mts +1 -3
- package/dist/locales.d.mts.map +1 -1
- package/dist/locales.mjs +2 -4
- package/dist/locales.mjs.map +1 -1
- package/dist/luau-execution.d.mts +2 -8
- package/dist/luau-execution.d.mts.map +1 -1
- package/dist/luau-execution.mjs +7 -11
- package/dist/luau-execution.mjs.map +1 -1
- package/dist/{network-error-iVSng5MT.mjs → network-error-P4An7nUB.mjs} +5 -9
- package/dist/{network-error-iVSng5MT.mjs.map → network-error-P4An7nUB.mjs.map} +1 -1
- package/dist/places.d.mts +57 -9
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +127 -21
- package/dist/places.mjs.map +1 -1
- package/dist/{poll-timeout-DzztDymd.mjs → poll-timeout-BCxgN97O.mjs} +4 -6
- package/dist/{poll-timeout-DzztDymd.mjs.map → poll-timeout-BCxgN97O.mjs.map} +1 -1
- package/dist/{polling-helpers-DfF5dspc.mjs → polling-helpers-BtEYR5dN.mjs} +19 -30
- package/dist/polling-helpers-BtEYR5dN.mjs.map +1 -0
- package/dist/{price-information-DEkEQ8Pq.mjs → price-information--d6GZAcp.mjs} +3 -4
- package/dist/{price-information-DEkEQ8Pq.mjs.map → price-information--d6GZAcp.mjs.map} +1 -1
- package/dist/{resource-client-BCKukheG.d.mts → resource-client-CF8SPsV8.d.mts} +3 -9
- package/dist/resource-client-CF8SPsV8.d.mts.map +1 -0
- package/dist/{resource-client-CaIVr-go.mjs → resource-client-Cm_bPcCs.mjs} +23 -59
- package/dist/resource-client-Cm_bPcCs.mjs.map +1 -0
- package/dist/{retry-C2oHesDx.d.mts → retry-DYxm_eBU.d.mts} +2 -6
- package/dist/retry-DYxm_eBU.d.mts.map +1 -0
- package/dist/{retry-CMRDvAR4.mjs → retry-Dv5TsY9O.mjs} +50 -52
- package/dist/retry-Dv5TsY9O.mjs.map +1 -0
- package/dist/{signatures-JF-7Psce.mjs → signatures-CtJ7jfVN.mjs} +2 -3
- package/dist/{signatures-JF-7Psce.mjs.map → signatures-CtJ7jfVN.mjs.map} +1 -1
- package/dist/storage.d.mts +2 -12
- package/dist/storage.d.mts.map +1 -1
- package/dist/storage.mjs +12 -20
- package/dist/storage.mjs.map +1 -1
- package/dist/testing.d.mts +2 -54
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +16 -30
- package/dist/testing.mjs.map +1 -1
- package/dist/{to-blob-RPqMBuft.mjs → to-blob-Bqu7bmlE.mjs} +2 -3
- package/dist/{to-blob-RPqMBuft.mjs.map → to-blob-Bqu7bmlE.mjs.map} +1 -1
- package/dist/{types-CdMr_J1M.d.mts → types-Z4abDJfK.d.mts} +1 -9
- package/dist/types-Z4abDJfK.d.mts.map +1 -0
- package/dist/universes.d.mts +4 -18
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +27 -47
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-964VNlbp.mjs → validation-kaTLLAD1.mjs} +3 -4
- package/dist/{validation-964VNlbp.mjs.map → validation-kaTLLAD1.mjs.map} +1 -1
- package/dist/{wire-DJqupefn.d.mts → wire-DDG87I-d.d.mts} +1 -3
- package/dist/wire-DDG87I-d.d.mts.map +1 -0
- package/package.json +8 -7
- package/dist/badge-cost-mismatch-DrlvhlQc.mjs +0 -47
- package/dist/badge-cost-mismatch-DrlvhlQc.mjs.map +0 -1
- package/dist/capacity-admission-hycCFkTo.d.mts.map +0 -1
- package/dist/polling-helpers-DfF5dspc.mjs.map +0 -1
- package/dist/resource-client-BCKukheG.d.mts.map +0 -1
- package/dist/resource-client-CaIVr-go.mjs.map +0 -1
- package/dist/retry-C2oHesDx.d.mts.map +0 -1
- package/dist/retry-CMRDvAR4.mjs.map +0 -1
- package/dist/types-CdMr_J1M.d.mts.map +0 -1
- package/dist/wire-DJqupefn.d.mts.map +0 -1
package/dist/badges.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badges.mjs","names":["buildUpdateRequest","buildUploadIconRequest","buildUpdateRequest","buildLocaleNameDescRequest","buildLocaleUploadIconRequest"],"sources":["../src/domains/badges/badges/builders.ts","../src/domains/badges/badges/operations.ts","../src/domains/badges/badges/parsers.ts","../src/domains/badges/free-quota/operations.ts","../src/domains/game-internationalization/badge-icon/builders.ts","../src/domains/game-internationalization/badge-name-description/builders.ts","../src/domains/game-internationalization/badge-name-description/operations.ts","../src/domains/publish/badge-icon/builders.ts","../src/domains/publish/badge-icon/operations.ts","../src/domains/publish/badge-icon/parsers.ts","../src/resources/badges/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type { BadgePaymentSource, CreateBadgeParameters, UpdateBadgeParameters } from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the legacy \"create badge\" endpoint.\n *\n * @param parameters - Fields describing the new badge; optional values\n * omitted here are left off the multipart payload entirely.\n * @returns A pure {@link HttpRequest} describing the create call.\n */\nexport function buildCreateRequest(parameters: CreateBadgeParameters): HttpRequest {\n\tconst body = new FormData();\n\tbody.append(\"name\", parameters.name);\n\tbody.append(\"files\", toBlob(parameters.icon));\n\tif (parameters.description !== undefined) {\n\t\tbody.append(\"description\", parameters.description);\n\t}\n\n\tif (parameters.isActive !== undefined) {\n\t\tbody.append(\"isActive\", String(parameters.isActive));\n\t}\n\n\tif (parameters.expectedCost !== undefined) {\n\t\tbody.append(\"expectedCost\", String(parameters.expectedCost));\n\t}\n\n\tif (parameters.paymentSource !== undefined) {\n\t\tbody.append(\"paymentSourceType\", toPaymentSourceWire(parameters.paymentSource));\n\t}\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\turl: `/legacy-badges/v1/universes/${parameters.universeId}/badges`,\n\t};\n}\n\n/**\n * Builds a `PATCH` request for the legacy \"update badge\" endpoint. Every\n * field on `parameters` except the identifier is optional; omitted fields\n * are not appended to the JSON body so the server leaves them unchanged.\n *\n * @param parameters - Identifier plus fields to update.\n * @returns A pure {@link HttpRequest} describing the update call.\n */\nexport function buildUpdateRequest(parameters: UpdateBadgeParameters): HttpRequest {\n\tconst body: Record<string, boolean | string> = {};\n\tif (parameters.name !== undefined) {\n\t\tbody[\"name\"] = parameters.name;\n\t}\n\n\tif (parameters.description !== undefined) {\n\t\tbody[\"description\"] = parameters.description;\n\t}\n\n\tif (parameters.enabled !== undefined) {\n\t\tbody[\"enabled\"] = parameters.enabled;\n\t}\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"PATCH\",\n\t\turl: `/legacy-badges/v1/badges/${parameters.badgeId}`,\n\t};\n}\n\nfunction toPaymentSourceWire(source: BadgePaymentSource): \"1\" | \"2\" {\n\treturn source === \"User\" ? \"1\" : \"2\";\n}\n","import { ApiError } from \"../../../errors/api-error.ts\";\nimport { BadgeCostMismatchError } from \"../../../errors/badge-cost-mismatch.ts\";\nimport type { OpenCloudError } from \"../../../errors/base.ts\";\nimport type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/** Body error code Roblox sends when a create's expected cost is wrong. */\nconst COST_MISMATCH_CODE = \"18\";\n\n/**\n * Per-second request ceiling for creating a badge, sourced from\n * `x-roblox-rate-limits` on the legacy badges create operation in the\n * vendored OpenAPI schema (100 per minute, per API key owner).\n */\nexport const CREATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"badges.create\",\n});\n\n/**\n * Per-second request ceiling for updating a badge, sourced from\n * `x-roblox-rate-limits` on the legacy badges update operation in the\n * vendored OpenAPI schema. Keyed independently from\n * {@link CREATE_OPERATION_LIMIT} so create and update do not share a\n * queue, since Roblox does not document the per-minute quota as shared\n * between the POST and PATCH endpoints.\n */\nexport const UPDATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"badges.update\",\n});\n\n/**\n * Scopes the API key or OAuth token must carry to create a badge,\n * sourced from `x-roblox-scopes` on the legacy badges create operation\n * in the vendored OpenAPI schema. The trailing\n * `:manage-and-spend-robux` reflects that badge creation may charge a\n * Robux fee.\n */\nexport const CREATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-universe.badge:manage-and-spend-robux\",\n]);\n\n/**\n * Scopes the API key or OAuth token must carry to update a badge,\n * sourced from `x-roblox-scopes` on the legacy badges update operation\n * in the vendored OpenAPI schema.\n */\nexport const UPDATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-universe.badge:write\",\n]);\n\n/**\n * Builds the refinement that turns a create refused with body code `18` into\n * a {@link BadgeCostMismatchError}, whatever its status. Every other error\n * passes through unchanged.\n *\n * @param expectedCost - The `expectedCost` the create sent, if any.\n * @returns The refinement for one create call.\n */\nexport function refineCreateError(\n\texpectedCost: number | undefined,\n): (error: OpenCloudError) => OpenCloudError {\n\treturn (error) => {\n\t\tif (!(error instanceof ApiError) || error.code !== COST_MISMATCH_CODE) {\n\t\t\treturn error;\n\t\t}\n\n\t\treturn new BadgeCostMismatchError(error.message, {\n\t\t\tcause: error,\n\t\t\tcode: error.code,\n\t\t\texpectedCost,\n\t\t\tstatusCode: error.statusCode,\n\t\t});\n\t};\n}\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.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 { Badge, BadgeAwarder, BadgeStatistics } from \"./types.ts\";\nimport type { BadgeAwarderWire, BadgeResponseV2Wire, BadgeStatisticsWire } from \"./wire.ts\";\n\n/**\n * Parses a successful Badges API response into the public `Badge` shape,\n * returning a `Result` so callers can handle malformed payloads without\n * exceptions.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * The status code is included on the returned `UnexpectedResponseError` when\n * validation fails; the headers are available for future parsers that need\n * them.\n * @returns A success result wrapping the converted `Badge`, or an\n * `UnexpectedResponseError` when the body does not match the wire schema.\n */\nexport function parseBadgeResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<Badge, UnexpectedResponseError> {\n\tif (!isBadgeResponseV2Wire(body)) {\n\t\treturn {\n\t\t\terr: new UnexpectedResponseError(\"Malformed badge 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: {\n\t\t\tid: String(body.id),\n\t\t\tname: body.name,\n\t\t\tawarder: copyAwarder(body.awarder),\n\t\t\tcreatedAt: new Date(body.created),\n\t\t\tdescription: body.description,\n\t\t\tdisplayDescription: body.displayDescription,\n\t\t\tdisplayIconImageId:\n\t\t\t\tbody.displayIconImageId === 0 ? undefined : String(body.displayIconImageId),\n\t\t\tdisplayName: body.displayName,\n\t\t\tenabled: body.enabled,\n\t\t\ticonImageId: body.iconImageId === 0 ? undefined : String(body.iconImageId),\n\t\t\tstatistics: copyStatistics(body.statistics),\n\t\t\tupdatedAt: new Date(body.updated),\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction copyAwarder(awarder: BadgeAwarderWire): BadgeAwarder {\n\treturn { id: String(awarder.id), name: awarder.name, type: awarder.type };\n}\n\nfunction copyStatistics(statistics: BadgeStatisticsWire): BadgeStatistics {\n\treturn {\n\t\tawardedCount: statistics.awardedCount,\n\t\tpastDayAwardedCount: statistics.pastDayAwardedCount,\n\t\twinRatePercentage: statistics.winRatePercentage,\n\t};\n}\n\nfunction hasRequiredPrimitiveFields(body: Record<string, unknown>): boolean {\n\treturn (\n\t\ttypeof body[\"id\"] === \"number\" &&\n\t\ttypeof body[\"name\"] === \"string\" &&\n\t\ttypeof body[\"description\"] === \"string\" &&\n\t\ttypeof body[\"displayName\"] === \"string\" &&\n\t\ttypeof body[\"displayDescription\"] === \"string\" &&\n\t\ttypeof body[\"enabled\"] === \"boolean\" &&\n\t\ttypeof body[\"iconImageId\"] === \"number\" &&\n\t\ttypeof body[\"displayIconImageId\"] === \"number\" &&\n\t\tisDateTimeString(body[\"created\"]) &&\n\t\tisDateTimeString(body[\"updated\"])\n\t);\n}\n\nfunction isBadgeAwarderWire(value: unknown): value is BadgeAwarderWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttypeof value[\"id\"] === \"number\" &&\n\t\t(value[\"name\"] === undefined || typeof value[\"name\"] === \"string\") &&\n\t\tvalue[\"type\"] === \"Place\"\n\t);\n}\n\nfunction isBadgeStatisticsWire(value: unknown): value is BadgeStatisticsWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttypeof value[\"awardedCount\"] === \"number\" &&\n\t\ttypeof value[\"pastDayAwardedCount\"] === \"number\" &&\n\t\ttypeof value[\"winRatePercentage\"] === \"number\"\n\t);\n}\n\nfunction isBadgeResponseV2Wire(body: unknown): body is BadgeResponseV2Wire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\tif (!hasRequiredPrimitiveFields(body)) {\n\t\treturn false;\n\t}\n\n\tif (!isBadgeAwarderWire(body[\"awarder\"])) {\n\t\treturn false;\n\t}\n\n\tif (!isBadgeStatisticsWire(body[\"statistics\"])) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n","import type { HttpRequest, HttpResponse } from \"../../../client/types.ts\";\nimport type { OpenCloudError } from \"../../../errors/base.ts\";\nimport { RateLimitError } from \"../../../errors/rate-limit.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\nimport { parseQuotaResetSeconds } from \"../../../internal/http/retry-guidance.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { GetFreeBadgeQuotaParameters } from \"./types.ts\";\n\n/** Origin of the unauthenticated free badge quota endpoint. */\nexport const FREE_QUOTA_BASE_URL = \"https://badges.roblox.com\";\n\n/**\n * Per-second request ceiling for reading the free badge quota. Roblox\n * reports 60 requests per 60 seconds, per caller.\n */\nexport const FREE_QUOTA_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 1,\n\toperationKey: \"badges.free-quota\",\n});\n\n/**\n * Builds the `GET` request for the free badge quota of a universe.\n *\n * @param parameters - The universe to read.\n * @returns A pure {@link HttpRequest} describing the read.\n */\nexport function buildFreeQuotaRequest({ universeId }: GetFreeBadgeQuotaParameters): HttpRequest {\n\treturn { method: \"GET\", url: `/v1/universes/${universeId}/free-badges-quota` };\n}\n\n/**\n * Parses the free badge quota body, a bare non-negative integer.\n *\n * @param response - The full {@link HttpResponse}.\n * @returns The free badges left today, or an `UnexpectedResponseError` when\n * the body is not a count.\n */\nexport function parseFreeQuotaResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<number, UnexpectedResponseError> {\n\tif (!isCount(body)) {\n\t\treturn {\n\t\t\terr: new UnexpectedResponseError(\"Malformed free badge quota 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 { data: body, success: true };\n}\n\n/**\n * Points a free badge quota 429 at `x-ratelimit-reset`. The endpoint's\n * `retry-after` is shorter than its window, which reopens only at the reset.\n * Any other error, or a 429 without a reset, passes through unchanged.\n *\n * @param error - The transport error of one attempt.\n * @returns The error with its wait set to the reported reset.\n */\nexport function waitForQuotaReset(error: OpenCloudError): OpenCloudError {\n\tif (!(error instanceof RateLimitError)) {\n\t\treturn error;\n\t}\n\n\tconst resetSeconds = parseQuotaResetSeconds(error.responseHeaders?.[\"x-ratelimit-reset\"]);\n\tif (resetSeconds === undefined) {\n\t\treturn error;\n\t}\n\n\treturn new RateLimitError(error.message, {\n\t\tcause: error.cause,\n\t\tcode: error.code,\n\t\tdetails: error.details,\n\t\tremaining: error.remaining,\n\t\tresponseHeaders: error.responseHeaders,\n\t\tretryAfterSeconds: resetSeconds,\n\t\tsource: error.source,\n\t\tstatusCode: error.statusCode,\n\t});\n}\n\nfunction isCount(value: unknown): value is number {\n\treturn Number.isSafeInteger(value) && Number(value) >= 0;\n}\n","import type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type { UploadBadgeIconLocalizationParameters } from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the localized \"upload badge icon\" endpoint. A\n * successful upload replaces any existing icon for the same\n * `(badgeId, languageCode)` pair.\n *\n * @param parameters - Badge and language identifiers plus the image bytes\n * to upload.\n * @returns A pure {@link HttpRequest} describing the upload call.\n */\nexport function buildUploadIconRequest(\n\tparameters: UploadBadgeIconLocalizationParameters,\n): HttpRequest {\n\tconst body = new FormData();\n\tbody.append(\"Files\", toBlob(parameters.image));\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\turl: `/legacy-game-internationalization/v1/badges/${parameters.badgeId}/icons/language-codes/${parameters.languageCode}`,\n\t};\n}\n","import type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport type { UpdateBadgeNameDescriptionParameters } from \"./types.ts\";\n\n/**\n * Builds a `PATCH` request for the localized \"update badge name/description\"\n * endpoint. Either `name`, `description`, or both may be supplied; omitted\n * fields are not included in the JSON body so the server leaves the existing\n * value for that locale untouched.\n *\n * @param parameters - Badge and language identifiers plus the optional\n * replacement values.\n * @returns A pure {@link HttpRequest} describing the update call.\n */\nexport function buildUpdateRequest(parameters: UpdateBadgeNameDescriptionParameters): HttpRequest {\n\tconst body: Record<string, string> = {};\n\tif (parameters.name !== undefined) {\n\t\tbody[\"name\"] = parameters.name;\n\t}\n\n\tif (parameters.description !== undefined) {\n\t\tbody[\"description\"] = parameters.description;\n\t}\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"PATCH\",\n\t\turl: `/legacy-game-internationalization/v1/badges/${parameters.badgeId}/name-description/language-codes/${parameters.languageCode}`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/**\n * Per-second request ceiling for badge localization Operations, from each\n * operation's `x-roblox-rate-limits.perApiKeyOwner` in the vendored schema\n * (100 requests per minute). This family's key stays separate from other\n * game-internationalization families: the #587 probe measured independent\n * reported 100/minute counters, including on rejected requests. Successful\n * writes may have additional service limits; see\n * `docs/spikes/game-internationalization-rate-limits/README.md`.\n */\nexport const LOCALIZATION_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"badge-localization\",\n});\n\n/**\n * Scopes required for every badge localization operation, sourced from\n * `x-roblox-scopes` on the legacy `gameinternationalization` badge\n * endpoints in the vendored OpenAPI schema.\n */\nexport const LOCALIZATION_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-badge:manage\",\n]);\n","import type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type { UploadBadgeIconParameters } from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the legacy \"upload badge icon\" endpoint. A\n * successful upload replaces any existing source-language icon on the\n * badge.\n *\n * @param parameters - Badge identifier plus the image bytes to upload.\n * @returns A pure {@link HttpRequest} describing the upload call.\n */\nexport function buildUploadIconRequest(parameters: UploadBadgeIconParameters): HttpRequest {\n\tconst body = new FormData();\n\tbody.append(\"Files\", toBlob(parameters.icon));\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\turl: `/legacy-publish/v1/badges/${parameters.badgeId}/icon`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/**\n * Per-second request ceiling for uploading a badge icon, sourced from\n * `x-roblox-rate-limits` on the legacy badge icon upload operation in\n * the vendored OpenAPI schema (100 per minute, per API key owner). Keyed\n * separately from the badges create and update buckets because Roblox\n * does not document the legacy-publish quota as shared with the\n * legacy-badges quota.\n */\nexport const UPLOAD_ICON_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"badges.upload-icon\",\n});\n\n/**\n * Scopes the API key or OAuth token must carry to upload a badge icon,\n * sourced from `x-roblox-scopes` on the legacy badge icon upload\n * operation in the vendored OpenAPI schema.\n */\nexport const UPLOAD_ICON_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-badge:manage\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.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 { UploadedBadgeIcon } from \"./types.ts\";\n\n/**\n * Parses a badge icon upload response, whose `targetId` is the asset ID of\n * the uploaded icon.\n *\n * @param response - The full {@link HttpResponse}.\n * @returns The uploaded icon, or an `UnexpectedResponseError` when the body\n * names no positive integer asset ID.\n */\nexport function parseUploadIconResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<UploadedBadgeIcon, UnexpectedResponseError> {\n\tconst targetId = isRecord(body) ? body[\"targetId\"] : undefined;\n\tif (!isAssetId(targetId)) {\n\t\treturn {\n\t\t\terr: new UnexpectedResponseError(\"Malformed badge icon 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 { data: { iconImageId: String(targetId) }, success: true };\n}\n\nfunction isAssetId(value: unknown): value is number {\n\treturn Number.isSafeInteger(value) && Number(value) > 0;\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport { buildCreateRequest, buildUpdateRequest } from \"../../domains/badges/badges/builders.ts\";\nimport {\n\tCREATE_OPERATION_LIMIT,\n\tCREATE_REQUIRED_SCOPES,\n\trefineCreateError,\n\tUPDATE_OPERATION_LIMIT,\n\tUPDATE_REQUIRED_SCOPES,\n} from \"../../domains/badges/badges/operations.ts\";\nimport { parseBadgeResponse } from \"../../domains/badges/badges/parsers.ts\";\nimport type {\n\tBadge,\n\tCreateBadgeParameters,\n\tUpdateBadgeParameters,\n} from \"../../domains/badges/badges/types.ts\";\nimport {\n\tbuildFreeQuotaRequest,\n\tFREE_QUOTA_BASE_URL,\n\tFREE_QUOTA_OPERATION_LIMIT,\n\tparseFreeQuotaResponse,\n\twaitForQuotaReset,\n} from \"../../domains/badges/free-quota/operations.ts\";\nimport type { GetFreeBadgeQuotaParameters } from \"../../domains/badges/free-quota/types.ts\";\nimport { buildUploadIconRequest as buildLocaleUploadIconRequest } from \"../../domains/game-internationalization/badge-icon/builders.ts\";\nimport type { UploadBadgeIconLocalizationParameters } from \"../../domains/game-internationalization/badge-icon/types.ts\";\nimport { buildUpdateRequest as buildLocaleNameDescRequest } from \"../../domains/game-internationalization/badge-name-description/builders.ts\";\nimport {\n\tLOCALIZATION_OPERATION_LIMIT,\n\tLOCALIZATION_REQUIRED_SCOPES,\n} from \"../../domains/game-internationalization/badge-name-description/operations.ts\";\nimport type { UpdateBadgeNameDescriptionParameters } from \"../../domains/game-internationalization/badge-name-description/types.ts\";\nimport { buildUploadIconRequest } from \"../../domains/publish/badge-icon/builders.ts\";\nimport {\n\tUPLOAD_ICON_OPERATION_LIMIT,\n\tUPLOAD_ICON_REQUIRED_SCOPES,\n} from \"../../domains/publish/badge-icon/operations.ts\";\nimport { parseUploadIconResponse } from \"../../domains/publish/badge-icon/parsers.ts\";\nimport type {\n\tUploadBadgeIconParameters,\n\tUploadedBadgeIcon,\n} from \"../../domains/publish/badge-icon/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { CREATE_METHOD_DEFAULTS, IDEMPOTENT_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport {\n\tokRequest,\n\tparseEmptyResponse,\n\tResourceClient,\n\ttype ResourceMethodSpec,\n} 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 CREATE_SPEC = makeSpec<CreateBadgeParameters, Badge>({\n\tbuildRequest: (parameters) => okRequest(buildCreateRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: CREATE_OPERATION_LIMIT,\n\tparse: parseBadgeResponse,\n\trequiredScopes: CREATE_REQUIRED_SCOPES,\n});\n\nconst UPDATE_SPEC = makeSpec<UpdateBadgeParameters, undefined>({\n\tbuildRequest: (parameters) => okRequest(buildUpdateRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: UPDATE_OPERATION_LIMIT,\n\tparse: parseEmptyResponse,\n\trequiredScopes: UPDATE_REQUIRED_SCOPES,\n});\n\nconst FREE_QUOTA_SPEC = makeSpec<GetFreeBadgeQuotaParameters, number>({\n\tbuildRequest: (parameters) => okRequest(buildFreeQuotaRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: FREE_QUOTA_OPERATION_LIMIT,\n\tparse: parseFreeQuotaResponse,\n\tunauthenticatedBaseUrl: FREE_QUOTA_BASE_URL,\n});\n\nconst UPLOAD_ICON_SPEC = makeSpec<UploadBadgeIconParameters, UploadedBadgeIcon>({\n\tbuildRequest: (parameters) => okRequest(buildUploadIconRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: UPLOAD_ICON_OPERATION_LIMIT,\n\tparse: parseUploadIconResponse,\n\trequiredScopes: UPLOAD_ICON_REQUIRED_SCOPES,\n});\n\nconst UPDATE_NAME_DESCRIPTION_SPEC = makeSpec<UpdateBadgeNameDescriptionParameters, undefined>({\n\tbuildRequest: (parameters) => okRequest(buildLocaleNameDescRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: LOCALIZATION_OPERATION_LIMIT,\n\tparse: parseEmptyResponse,\n\trequiredScopes: LOCALIZATION_REQUIRED_SCOPES,\n});\n\nconst UPLOAD_LOCALIZED_ICON_SPEC = makeSpec<UploadBadgeIconLocalizationParameters, undefined>({\n\tbuildRequest: (parameters) => okRequest(buildLocaleUploadIconRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: LOCALIZATION_OPERATION_LIMIT,\n\tparse: parseEmptyResponse,\n\trequiredScopes: LOCALIZATION_REQUIRED_SCOPES,\n});\n\ninterface BadgeLocalizationHandle {\n\t/**\n\t * Updates the per-locale display name and/or description registered against\n\t * a badge. Either `name`, `description`, or both may be supplied; omitted\n\t * fields are not forwarded so the server leaves the existing value for\n\t * that locale untouched. Mirrors the upstream `200 OK` echo body as\n\t * `undefined` data.\n\t *\n\t * @param parameters - Badge and language identifiers plus the optional\n\t * replacement values.\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\tupdateNameDescription: (\n\t\tparameters: UpdateBadgeNameDescriptionParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n\t/**\n\t * Uploads or replaces the per-locale icon for a badge. A subsequent\n\t * upload for the same `(badgeId, languageCode)` pair replaces the\n\t * existing icon for that locale. Does not retry on 5xx so a duplicate\n\t * upload cannot be created if the server fails mid-write. Source-language\n\t * icons remain on {@link BadgesClient.uploadIcon}.\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 - Badge and language identifiers plus the image bytes\n\t * to upload.\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\tuploadIcon: (\n\t\tparameters: UploadBadgeIconLocalizationParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n}\n\n/**\n * Public client for the Roblox Open Cloud Badges API. Covers programmatic\n * badge creation under a universe, partial updates of badge configuration\n * (`name`, `description`, `enabled`), and source-language icon uploads.\n *\n * Wires the request builders, the injected\n * {@link OpenCloudClientOptions.httpClient}, and response parsers into a\n * single ergonomic surface. Every method returns a {@link Result} so\n * callers handle failure explicitly; no thrown {@link OpenCloudError}\n * ever escapes the client.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { BadgesClient } from \"@bedrock-rbx/ocale/badges\";\n *\n * const client = new BadgesClient({ credential: { apiKey: \"your-key\", kind: \"apiKey\" } });\n * expect(client).toBeInstanceOf(BadgesClient);\n * ```\n */\nexport class BadgesClient {\n\treadonly #inner: ResourceClient;\n\n\t/**\n\t * Operation Group exposing per-locale localization Operations\n\t * (`updateNameDescription`, `uploadIcon`) backed by the\n\t * `legacy-game-internationalization` domain. Source-language values\n\t * remain on {@link BadgesClient.update} and\n\t * {@link BadgesClient.uploadIcon}; methods on this group set per-locale\n\t * overlays on top. Shares the parent client's HTTP, rate-limit, and\n\t * retry plumbing.\n\t */\n\tpublic readonly localization: BadgeLocalizationHandle;\n\n\t/**\n\t * Creates a new {@link BadgesClient}. Configuration is frozen on\n\t * construction; per-request overrides are accepted on each 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.localization = createLocalizationHandle(this.#inner);\n\t}\n\n\t/**\n\t * Creates a new badge under the supplied universe.\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 * A create whose `expectedCost` differs from the actual cost fails with a\n\t * `BadgeCostMismatchError` and is not charged; with `expectedCost: 0`\n\t * that means the universe's free badge quota is spent for today.\n\t *\n\t * @param parameters - Creation fields including the universe, name, and\n\t * icon image.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed {@link Badge} or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async create(\n\t\tparameters: CreateBadgeParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Badge, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({\n\t\t\toptions,\n\t\t\tparameters,\n\t\t\trefineError: refineCreateError(parameters.expectedCost),\n\t\t\tspec: CREATE_SPEC,\n\t\t});\n\t}\n\n\t/**\n\t * Reads how many badges the universe can still create free of charge\n\t * today. Each create within the quota lowers it by one. The quota resets\n\t * daily at 00:00 UTC. Roblox answers for any universe ID, existing or not.\n\t *\n\t * The read is unauthenticated: it sends no credential and is served from\n\t * `https://badges.roblox.com`, so the client `baseUrl` does not apply.\n\t * Roblox allows 60 reads per minute per caller. A 429 waits until the\n\t * reported `x-ratelimit-reset` before it retries.\n\t *\n\t * @since 0.4.0\n\t * @param parameters - The universe to read.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the free badges left today, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async getFreeQuota(\n\t\tparameters: GetFreeBadgeQuotaParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<number, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({\n\t\t\toptions,\n\t\t\tparameters,\n\t\t\trefineError: waitForQuotaReset,\n\t\t\tspec: FREE_QUOTA_SPEC,\n\t\t});\n\t}\n\n\t/**\n\t * Partially updates a badge's configuration. Mirrors the upstream\n\t * `200 OK` empty response: a successful update yields `undefined`\n\t * data. Only fields explicitly provided are forwarded to the server,\n\t * so omitted fields keep their current values.\n\t *\n\t * @param parameters - Identifier plus the fields to update.\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 update(\n\t\tparameters: UpdateBadgeParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<undefined, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: UPDATE_SPEC });\n\t}\n\n\t/**\n\t * Uploads or replaces the source-language icon registered against a\n\t * badge. A subsequent upload for the same badge replaces the\n\t * existing source icon. Does not retry on 5xx so a duplicate icon\n\t * upload cannot be created if the server fails mid-write.\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 - Identifier plus the image bytes to upload.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the uploaded icon's asset ID, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async uploadIcon(\n\t\tparameters: UploadBadgeIconParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<UploadedBadgeIcon, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: UPLOAD_ICON_SPEC });\n\t}\n}\n\nfunction createLocalizationHandle(inner: ResourceClient): BadgeLocalizationHandle {\n\treturn {\n\t\tasync updateNameDescription(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: UPDATE_NAME_DESCRIPTION_SPEC });\n\t\t},\n\t\tasync uploadIcon(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: UPLOAD_LOCALIZED_ICON_SPEC });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,mBAAmB,YAAgD;CAClF,MAAM,OAAO,IAAI,SAAS;CAC1B,KAAK,OAAO,QAAQ,WAAW,IAAI;CACnC,KAAK,OAAO,SAAS,OAAO,WAAW,IAAI,CAAC;CAC5C,IAAI,WAAW,gBAAgB,KAAA,GAC9B,KAAK,OAAO,eAAe,WAAW,WAAW;CAGlD,IAAI,WAAW,aAAa,KAAA,GAC3B,KAAK,OAAO,YAAY,OAAO,WAAW,QAAQ,CAAC;CAGpD,IAAI,WAAW,iBAAiB,KAAA,GAC/B,KAAK,OAAO,gBAAgB,OAAO,WAAW,YAAY,CAAC;CAG5D,IAAI,WAAW,kBAAkB,KAAA,GAChC,KAAK,OAAO,qBAAqB,oBAAoB,WAAW,aAAa,CAAC;CAG/E,OAAO;EACN;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O,KAAK,OAAO,aAAa;GAC/B;GACA;GACA,aAAa,kBAAkB,WAAW,YAAY;GACtD,MAAM;EACP,CAAC;CACF;;;;;;;;;;;;;;;;;CAkBA,MAAa,aACZ,YACA,SAC0C;EAC1C,OAAO,KAAK,OAAO,aAAa;GAC/B;GACA;GACA,aAAa;GACb,MAAM;EACP,CAAC;CACF;;;;;;;;;;;;CAaA,MAAa,OACZ,YACA,SAC6C;EAC7C,OAAO,KAAK,OAAO,aAAa;GAAE;GAAS;GAAY,MAAM;EAAY,CAAC;CAC3E;;;;;;;;;;;;;;;CAgBA,MAAa,WACZ,YACA,SACqD;EACrD,OAAO,KAAK,OAAO,aAAa;GAAE;GAAS;GAAY,MAAM;EAAiB,CAAC;CAChF;AACD;AAEA,SAAS,yBAAyB,OAAgD;CACjF,OAAO;EACN,MAAM,sBAAsB,YAAY,SAAS;GAChD,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAA6B,CAAC;EACtF;EACA,MAAM,WAAW,YAAY,SAAS;GACrC,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAA2B,CAAC;EACpF;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"badges.mjs","names":["buildUpdateRequest","buildUploadIconRequest","buildUpdateRequest","buildLocaleNameDescRequest","buildLocaleUploadIconRequest"],"sources":["../src/domains/badges/badges/builders.ts","../src/domains/badges/free-quota/operations.ts","../src/domains/badges/badges/operations.ts","../src/domains/badges/badges/parsers.ts","../src/domains/badges/metadata/operations.ts","../src/domains/game-internationalization/badge-icon/builders.ts","../src/domains/game-internationalization/badge-name-description/builders.ts","../src/domains/game-internationalization/badge-name-description/operations.ts","../src/domains/publish/badge-icon/builders.ts","../src/domains/publish/badge-icon/operations.ts","../src/domains/publish/badge-icon/parsers.ts","../src/resources/badges/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type {\n\tBadgePaymentSource,\n\tCreateBadgeParameters,\n\tGetBadgeParameters,\n\tListBadgesParameters,\n\tUpdateBadgeParameters,\n} from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the legacy \"create badge\" endpoint.\n *\n * @param parameters - Fields describing the new badge; optional values\n * omitted here are left off the multipart payload entirely.\n * @returns A pure {@link HttpRequest} describing the create call.\n */\nexport function buildCreateRequest(parameters: CreateBadgeParameters): HttpRequest {\n\tconst body = new FormData();\n\tbody.append(\"name\", parameters.name);\n\tif (parameters.icon !== undefined) {\n\t\t// Roblox answers 500 InternalServerError when the file part has no name.\n\t\tbody.append(\"files\", toBlob(parameters.icon), \"icon\");\n\t}\n\n\tif (parameters.description !== undefined) {\n\t\tbody.append(\"description\", parameters.description);\n\t}\n\n\tif (parameters.isActive !== undefined) {\n\t\tbody.append(\"isActive\", String(parameters.isActive));\n\t}\n\n\tif (parameters.expectedCost !== undefined) {\n\t\tbody.append(\"expectedCost\", String(parameters.expectedCost));\n\t}\n\n\tif (parameters.paymentSource !== undefined) {\n\t\tbody.append(\"paymentSourceType\", toPaymentSourceWire(parameters.paymentSource));\n\t}\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\turl: `/legacy-badges/v1/universes/${parameters.universeId}/badges`,\n\t};\n}\n\n/**\n * Builds a `PATCH` request for the legacy \"update badge\" endpoint. Every\n * field on `parameters` except the identifier is optional; omitted fields\n * are not appended to the JSON body so the server leaves them unchanged.\n *\n * @param parameters - Identifier plus fields to update.\n * @returns A pure {@link HttpRequest} describing the update call.\n */\nexport function buildUpdateRequest(parameters: UpdateBadgeParameters): HttpRequest {\n\tconst body: Record<string, boolean | string> = {};\n\tif (parameters.name !== undefined) {\n\t\tbody[\"name\"] = parameters.name;\n\t}\n\n\tif (parameters.description !== undefined) {\n\t\tbody[\"description\"] = parameters.description;\n\t}\n\n\tif (parameters.enabled !== undefined) {\n\t\tbody[\"enabled\"] = parameters.enabled;\n\t}\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"PATCH\",\n\t\turl: `/legacy-badges/v1/badges/${parameters.badgeId}`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the unauthenticated \"get badge\" endpoint.\n *\n * @param parameters - The badge to read.\n * @returns A pure {@link HttpRequest} describing the read.\n */\nexport function buildGetRequest({ badgeId }: GetBadgeParameters): HttpRequest {\n\treturn { method: \"GET\", url: `/v1/badges/${badgeId}` };\n}\n\n/**\n * Builds a `GET` request for the unauthenticated \"list universe badges\"\n * endpoint. `pageSize` goes out as `limit` and `pageToken` as `cursor`, each\n * only when defined, so the server applies its own defaults otherwise.\n *\n * @param parameters - Universe identifier plus optional paging fields.\n * @returns A pure {@link HttpRequest} describing the list call.\n */\nexport function buildListRequest(parameters: ListBadgesParameters): HttpRequest {\n\tconst query = new URLSearchParams();\n\tif (parameters.pageSize !== undefined) {\n\t\tquery.append(\"limit\", String(parameters.pageSize));\n\t}\n\n\tif (parameters.pageToken !== undefined) {\n\t\tquery.append(\"cursor\", parameters.pageToken);\n\t}\n\n\tconst queryString = query.toString();\n\tconst base = `/v1/universes/${parameters.universeId}/badges`;\n\treturn { method: \"GET\", url: queryString === \"\" ? base : `${base}?${queryString}` };\n}\n\nfunction toPaymentSourceWire(source: BadgePaymentSource): \"1\" | \"2\" {\n\treturn source === \"User\" ? \"1\" : \"2\";\n}\n","import type { HttpRequest, HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { GetFreeBadgeQuotaParameters } from \"./types.ts\";\n\n/** Origin of the unauthenticated free badge quota endpoint. */\nexport const FREE_QUOTA_BASE_URL = \"https://badges.roblox.com\";\n\n/**\n * Per-second request ceiling for reading the free badge quota. Roblox\n * reports 60 requests per 60 seconds, per caller.\n */\nexport const FREE_QUOTA_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 1,\n\toperationKey: \"badges.free-quota\",\n});\n\n/**\n * Builds the `GET` request for the free badge quota of a universe.\n *\n * @param parameters - The universe to read.\n * @returns A pure {@link HttpRequest} describing the read.\n */\nexport function buildFreeQuotaRequest({ universeId }: GetFreeBadgeQuotaParameters): HttpRequest {\n\treturn { method: \"GET\", url: `/v1/universes/${universeId}/free-badges-quota` };\n}\n\n/**\n * Parses the free badge quota body, a bare non-negative integer.\n *\n * @param response - The full {@link HttpResponse}.\n * @returns The free badges left today, or an `UnexpectedResponseError` when\n * the body is not a count.\n */\nexport function parseFreeQuotaResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<number, UnexpectedResponseError> {\n\tif (!isCount(body)) {\n\t\treturn {\n\t\t\terr: new UnexpectedResponseError(\"Malformed free badge quota 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 { data: body, success: true };\n}\n\nfunction isCount(value: unknown): value is number {\n\treturn Number.isSafeInteger(value) && Number(value) >= 0;\n}\n","import { ApiError } from \"../../../errors/api-error.ts\";\nimport { BadgeCostMismatchError } from \"../../../errors/badge-cost-mismatch.ts\";\nimport { BadgeGroupSpendPermissionError } from \"../../../errors/badge-group-spend-permission.ts\";\nimport { BadgeInsufficientFundsError } from \"../../../errors/badge-insufficient-funds.ts\";\nimport type { OpenCloudError } from \"../../../errors/base.ts\";\nimport type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\nimport { FREE_QUOTA_BASE_URL } from \"../free-quota/operations.ts\";\n\n/** Body error code Roblox sends when a create's expected cost is wrong. */\nconst COST_MISMATCH_CODE = \"18\";\n\n/** Body error code Roblox sends when the payer cannot afford a create. */\nconst INSUFFICIENT_FUNDS_CODE = \"17\";\n\n/** Body error code Roblox sends when the caller may not spend group funds. */\nconst GROUP_SPEND_PERMISSION_CODE = \"28\";\n\n/**\n * Per-second request ceiling for creating a badge, sourced from\n * `x-roblox-rate-limits` on the legacy badges create operation in the\n * vendored OpenAPI schema (100 per minute, per API key owner).\n */\nexport const CREATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"badges.create\",\n});\n\n/**\n * Per-second request ceiling for updating a badge, sourced from\n * `x-roblox-rate-limits` on the legacy badges update operation in the\n * vendored OpenAPI schema. Keyed independently from\n * {@link CREATE_OPERATION_LIMIT} so create and update do not share a\n * queue, since Roblox does not document the per-minute quota as shared\n * between the POST and PATCH endpoints.\n */\nexport const UPDATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"badges.update\",\n});\n\n/**\n * Origin of the unauthenticated badge read endpoints, shared with the free\n * quota read.\n */\nexport const READ_BASE_URL = FREE_QUOTA_BASE_URL;\n\n/**\n * Per-second request ceiling for reading one badge. Roblox reports 600\n * requests per 60 seconds, per caller.\n */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 600 / 60,\n\toperationKey: \"badges.get\",\n});\n\n/**\n * Per-second request ceiling for listing the badges of a universe. Roblox\n * reports 100 requests per 60 seconds, per caller.\n */\nexport const LIST_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"badges.list\",\n});\n\n/**\n * Scopes the API key or OAuth token must carry to create a badge,\n * sourced from `x-roblox-scopes` on the legacy badges create operation\n * in the vendored OpenAPI schema. The trailing\n * `:manage-and-spend-robux` reflects that badge creation may charge a\n * Robux fee.\n */\nexport const CREATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-universe.badge:manage-and-spend-robux\",\n]);\n\n/**\n * Scopes the API key or OAuth token must carry to update a badge,\n * sourced from `x-roblox-scopes` on the legacy badges update operation\n * in the vendored OpenAPI schema.\n */\nexport const UPDATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-universe.badge:write\",\n]);\n\n/**\n * Builds the refinement that turns a create refused for a cost or payment\n * reason into a typed error, whatever its status: body code `18` becomes a\n * {@link BadgeCostMismatchError}, code `17` a\n * {@link BadgeInsufficientFundsError}, and code `28` a\n * {@link BadgeGroupSpendPermissionError}. Every other error passes through\n * unchanged.\n *\n * @param expectedCost - The `expectedCost` the create sent, if any.\n * @returns The refinement for one create call.\n */\nexport function refineCreateError(\n\texpectedCost: number | undefined,\n): (error: OpenCloudError) => OpenCloudError {\n\treturn (error) => {\n\t\tif (!(error instanceof ApiError)) {\n\t\t\treturn error;\n\t\t}\n\n\t\tconst options = { cause: error, code: error.code, statusCode: error.statusCode };\n\t\tif (error.code === COST_MISMATCH_CODE) {\n\t\t\treturn new BadgeCostMismatchError(error.message, { ...options, expectedCost });\n\t\t}\n\n\t\tif (error.code === INSUFFICIENT_FUNDS_CODE) {\n\t\t\treturn new BadgeInsufficientFundsError(error.message, options);\n\t\t}\n\n\t\tif (error.code === GROUP_SPEND_PERMISSION_CODE) {\n\t\t\treturn new BadgeGroupSpendPermissionError(error.message, options);\n\t\t}\n\n\t\treturn error;\n\t};\n}\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.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 { Page, Result } from \"../../../types.ts\";\nimport type {\n\tBadge,\n\tBadgeAwarder,\n\tBadgeAwardingUniverse,\n\tBadgeDetails,\n\tBadgeStatistics,\n} from \"./types.ts\";\nimport type {\n\tBadgeAwarderWire,\n\tBadgeAwardingUniverseWire,\n\tBadgeResponseV2Wire,\n\tBadgeResponseWire,\n\tBadgeStatisticsWire,\n} from \"./wire.ts\";\n\n/**\n * Parses a successful Badges API response into the public `Badge` shape,\n * returning a `Result` so callers can handle malformed payloads without\n * exceptions.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * The status code is included on the returned `UnexpectedResponseError` when\n * validation fails; the headers are available for future parsers that need\n * them.\n * @returns A success result wrapping the converted `Badge`, or an\n * `UnexpectedResponseError` when the body does not match the wire schema.\n */\nexport function parseBadgeResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<Badge, UnexpectedResponseError> {\n\tif (!isBadgeResponseV2Wire(body)) {\n\t\treturn malformedBadge(statusCode, body);\n\t}\n\n\treturn {\n\t\tdata: { ...copySharedFields(body), awarder: copyAwarder(body.awarder) },\n\t\tsuccess: true,\n\t};\n}\n\n/**\n * Parses the body of the unauthenticated badge read endpoints into the public\n * `BadgeDetails` shape.\n *\n * @param response - The full {@link HttpResponse}.\n * @returns A success result wrapping the converted `BadgeDetails`, or an\n * `UnexpectedResponseError` when the body does not match the wire schema.\n */\nexport function parseBadgeDetailsResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<BadgeDetails, UnexpectedResponseError> {\n\tif (!isBadgeResponseWire(body)) {\n\t\treturn malformedBadge(statusCode, body);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\t...copySharedFields(body),\n\t\t\tawardingUniverse: copyAwardingUniverse(body.awardingUniverse),\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\n/**\n * Parses a badge list page, keeping its cursor and converting each item with\n * the same validation as a single badge read. A JSON `null` cursor becomes\n * `undefined`.\n *\n * @param response - The HTTP response to parse.\n * @returns The parsed page or an unexpected response error.\n */\nexport function parseBadgesListResponse(\n\tresponse: HttpResponse,\n): Result<Page<BadgeDetails>, UnexpectedResponseError> {\n\tconst { body, status: statusCode } = response;\n\tif (!isRecord(body) || !Array.isArray(body[\"data\"])) {\n\t\treturn malformedBadgesList(statusCode, body);\n\t}\n\n\tconst nextPageToken = body[\"nextPageCursor\"] ?? undefined;\n\tif (nextPageToken !== undefined && typeof nextPageToken !== \"string\") {\n\t\treturn malformedBadgesList(statusCode, body);\n\t}\n\n\tconst items: Array<BadgeDetails> = [];\n\tconst badges = body[\"data\"];\n\tfor (const item of badges) {\n\t\tconst parsed = parseBadgeDetailsResponse({ ...response, body: item });\n\t\tif (!parsed.success) {\n\t\t\treturn malformedBadgesList(statusCode, body);\n\t\t}\n\n\t\titems.push(parsed.data);\n\t}\n\n\treturn { data: { items, nextPageToken }, success: true };\n}\n\nfunction copyStatistics(statistics: BadgeStatisticsWire): BadgeStatistics {\n\treturn {\n\t\tawardedCount: statistics.awardedCount,\n\t\tpastDayAwardedCount: statistics.pastDayAwardedCount,\n\t\twinRatePercentage: statistics.winRatePercentage,\n\t};\n}\n\nfunction copySharedFields(\n\tbody: BadgeResponseV2Wire | BadgeResponseWire,\n): Pick<Badge, Exclude<keyof Badge, \"awarder\">> {\n\treturn {\n\t\tid: String(body.id),\n\t\tname: body.name,\n\t\tcreatedAt: new Date(body.created),\n\t\tdescription: body.description,\n\t\tdisplayDescription: body.displayDescription,\n\t\tdisplayIconImageId:\n\t\t\tbody.displayIconImageId === 0 ? undefined : String(body.displayIconImageId),\n\t\tdisplayName: body.displayName,\n\t\tenabled: body.enabled,\n\t\ticonImageId: body.iconImageId === 0 ? undefined : String(body.iconImageId),\n\t\tstatistics: copyStatistics(body.statistics),\n\t\tupdatedAt: new Date(body.updated),\n\t};\n}\n\nfunction copyAwarder(awarder: BadgeAwarderWire): BadgeAwarder {\n\treturn { id: String(awarder.id), name: awarder.name, type: awarder.type };\n}\n\nfunction hasRequiredPrimitiveFields(body: Record<string, unknown>): boolean {\n\treturn (\n\t\ttypeof body[\"id\"] === \"number\" &&\n\t\ttypeof body[\"name\"] === \"string\" &&\n\t\ttypeof body[\"description\"] === \"string\" &&\n\t\ttypeof body[\"displayName\"] === \"string\" &&\n\t\ttypeof body[\"displayDescription\"] === \"string\" &&\n\t\ttypeof body[\"enabled\"] === \"boolean\" &&\n\t\ttypeof body[\"iconImageId\"] === \"number\" &&\n\t\ttypeof body[\"displayIconImageId\"] === \"number\" &&\n\t\tisDateTimeString(body[\"created\"]) &&\n\t\tisDateTimeString(body[\"updated\"])\n\t);\n}\n\nfunction isBadgeAwarderWire(value: unknown): value is BadgeAwarderWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttypeof value[\"id\"] === \"number\" &&\n\t\t(value[\"name\"] === undefined || typeof value[\"name\"] === \"string\") &&\n\t\tvalue[\"type\"] === \"Place\"\n\t);\n}\n\nfunction isBadgeStatisticsWire(value: unknown): value is BadgeStatisticsWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttypeof value[\"awardedCount\"] === \"number\" &&\n\t\ttypeof value[\"pastDayAwardedCount\"] === \"number\" &&\n\t\ttypeof value[\"winRatePercentage\"] === \"number\"\n\t);\n}\n\nfunction isBadgeResponseV2Wire(body: unknown): body is BadgeResponseV2Wire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\tif (!hasRequiredPrimitiveFields(body)) {\n\t\treturn false;\n\t}\n\n\tif (!isBadgeAwarderWire(body[\"awarder\"])) {\n\t\treturn false;\n\t}\n\n\tif (!isBadgeStatisticsWire(body[\"statistics\"])) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nfunction malformedBadge(\n\tstatusCode: number,\n\tbody: unknown,\n): { readonly err: UnexpectedResponseError; readonly success: false } {\n\treturn {\n\t\terr: new UnexpectedResponseError(\"Malformed badge response\", {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n\nfunction copyAwardingUniverse(universe: BadgeAwardingUniverseWire): BadgeAwardingUniverse {\n\treturn {\n\t\tid: String(universe.id),\n\t\tname: universe.name,\n\t\trootPlaceId: String(universe.rootPlaceId),\n\t};\n}\n\nfunction isBadgeAwardingUniverseWire(value: unknown): value is BadgeAwardingUniverseWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttypeof value[\"id\"] === \"number\" &&\n\t\ttypeof value[\"name\"] === \"string\" &&\n\t\ttypeof value[\"rootPlaceId\"] === \"number\"\n\t);\n}\n\nfunction isBadgeResponseWire(body: unknown): body is BadgeResponseWire {\n\treturn (\n\t\tisRecord(body) &&\n\t\thasRequiredPrimitiveFields(body) &&\n\t\tisBadgeStatisticsWire(body[\"statistics\"]) &&\n\t\tisBadgeAwardingUniverseWire(body[\"awardingUniverse\"])\n\t);\n}\n\nfunction malformedBadgesList(\n\tstatusCode: number,\n\tbody: unknown,\n): Result<Page<BadgeDetails>, UnexpectedResponseError> {\n\treturn {\n\t\terr: new UnexpectedResponseError(\"Malformed badges list response\", {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n","import type { HttpRequest, HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\n\n/** Origin of the unauthenticated badge metadata endpoint. */\nexport const METADATA_BASE_URL = \"https://badges.roblox.com\";\n\n/**\n * Per-second request ceiling for reading the badge metadata. The vendored\n * spec declares no limit; Roblox reports 100 requests per 60 seconds, per\n * caller.\n */\nexport const METADATA_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"badges.metadata\",\n});\n\n/**\n * Builds the `GET` request for the badge metadata.\n *\n * @returns A pure {@link HttpRequest} describing the read.\n */\nexport function buildMetadataRequest(): HttpRequest {\n\treturn { method: \"GET\", url: \"/v1/badges/metadata\" };\n}\n\n/**\n * Parses the badge metadata body down to its `badgeCreationPrice`.\n *\n * @param response - The full {@link HttpResponse}.\n * @returns The badge creation price in Robux, or an\n * `UnexpectedResponseError` when the body carries no valid price.\n */\nexport function parseCreationPriceResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<number, UnexpectedResponseError> {\n\tconst price = isRecord(body) ? body[\"badgeCreationPrice\"] : undefined;\n\tif (!isPrice(price)) {\n\t\treturn {\n\t\t\terr: new UnexpectedResponseError(\"Malformed badge metadata 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 { data: price, success: true };\n}\n\nfunction isPrice(value: unknown): value is number {\n\treturn Number.isSafeInteger(value) && Number(value) >= 0;\n}\n","import type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type { UploadBadgeIconLocalizationParameters } from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the localized \"upload badge icon\" endpoint. A\n * successful upload replaces any existing icon for the same\n * `(badgeId, languageCode)` pair.\n *\n * @param parameters - Badge and language identifiers plus the image bytes\n * to upload.\n * @returns A pure {@link HttpRequest} describing the upload call.\n */\nexport function buildUploadIconRequest(\n\tparameters: UploadBadgeIconLocalizationParameters,\n): HttpRequest {\n\tconst body = new FormData();\n\tbody.append(\"Files\", toBlob(parameters.image));\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\turl: `/legacy-game-internationalization/v1/badges/${parameters.badgeId}/icons/language-codes/${parameters.languageCode}`,\n\t};\n}\n","import type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport type { UpdateBadgeNameDescriptionParameters } from \"./types.ts\";\n\n/**\n * Builds a `PATCH` request for the localized \"update badge name/description\"\n * endpoint. Either `name`, `description`, or both may be supplied; omitted\n * fields are not included in the JSON body so the server leaves the existing\n * value for that locale untouched.\n *\n * @param parameters - Badge and language identifiers plus the optional\n * replacement values.\n * @returns A pure {@link HttpRequest} describing the update call.\n */\nexport function buildUpdateRequest(parameters: UpdateBadgeNameDescriptionParameters): HttpRequest {\n\tconst body: Record<string, string> = {};\n\tif (parameters.name !== undefined) {\n\t\tbody[\"name\"] = parameters.name;\n\t}\n\n\tif (parameters.description !== undefined) {\n\t\tbody[\"description\"] = parameters.description;\n\t}\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"PATCH\",\n\t\turl: `/legacy-game-internationalization/v1/badges/${parameters.badgeId}/name-description/language-codes/${parameters.languageCode}`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/**\n * Per-second request ceiling for badge localization Operations, from each\n * operation's `x-roblox-rate-limits.perApiKeyOwner` in the vendored schema\n * (100 requests per minute). This family's key stays separate from other\n * game-internationalization families: the #587 probe measured independent\n * reported 100/minute counters, including on rejected requests. Successful\n * writes may have additional service limits; see\n * `docs/spikes/game-internationalization-rate-limits/README.md`.\n */\nexport const LOCALIZATION_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"badge-localization\",\n});\n\n/**\n * Scopes required for every badge localization operation, sourced from\n * `x-roblox-scopes` on the legacy `gameinternationalization` badge\n * endpoints in the vendored OpenAPI schema.\n */\nexport const LOCALIZATION_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-badge:manage\",\n]);\n","import type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type { UploadBadgeIconParameters } from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the legacy \"upload badge icon\" endpoint. A\n * successful upload replaces any existing source-language icon on the\n * badge.\n *\n * @param parameters - Badge identifier plus the image bytes to upload.\n * @returns A pure {@link HttpRequest} describing the upload call.\n */\nexport function buildUploadIconRequest(parameters: UploadBadgeIconParameters): HttpRequest {\n\tconst body = new FormData();\n\t// Roblox answers 400 \"File not present in request.\" when the file part has\n\t// no name.\n\tbody.append(\"Files\", toBlob(parameters.icon), \"icon\");\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\turl: `/legacy-publish/v1/badges/${parameters.badgeId}/icon`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/**\n * Per-second request ceiling for uploading a badge icon, sourced from\n * `x-roblox-rate-limits` on the legacy badge icon upload operation in\n * the vendored OpenAPI schema (100 per minute, per API key owner). Keyed\n * separately from the badges create and update buckets because Roblox\n * does not document the legacy-publish quota as shared with the\n * legacy-badges quota.\n */\nexport const UPLOAD_ICON_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / 60,\n\toperationKey: \"badges.upload-icon\",\n});\n\n/**\n * Scopes the API key or OAuth token must carry to upload a badge icon,\n * sourced from `x-roblox-scopes` on the legacy badge icon upload\n * operation in the vendored OpenAPI schema.\n */\nexport const UPLOAD_ICON_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"legacy-badge:manage\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.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 { UploadedBadgeIcon } from \"./types.ts\";\n\n/**\n * Parses a badge icon upload response, whose `targetId` is the asset ID of\n * the uploaded icon.\n *\n * @param response - The full {@link HttpResponse}.\n * @returns The uploaded icon, or an `UnexpectedResponseError` when the body\n * names no positive integer asset ID.\n */\nexport function parseUploadIconResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<UploadedBadgeIcon, UnexpectedResponseError> {\n\tconst targetId = isRecord(body) ? body[\"targetId\"] : undefined;\n\tif (!isAssetId(targetId)) {\n\t\treturn {\n\t\t\terr: new UnexpectedResponseError(\"Malformed badge icon 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 { data: { iconImageId: String(targetId) }, success: true };\n}\n\nfunction isAssetId(value: unknown): value is number {\n\treturn Number.isSafeInteger(value) && Number(value) > 0;\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport {\n\tbuildCreateRequest,\n\tbuildGetRequest,\n\tbuildListRequest,\n\tbuildUpdateRequest,\n} from \"../../domains/badges/badges/builders.ts\";\nimport {\n\tCREATE_OPERATION_LIMIT,\n\tCREATE_REQUIRED_SCOPES,\n\tGET_OPERATION_LIMIT,\n\tLIST_OPERATION_LIMIT,\n\tREAD_BASE_URL,\n\trefineCreateError,\n\tUPDATE_OPERATION_LIMIT,\n\tUPDATE_REQUIRED_SCOPES,\n} from \"../../domains/badges/badges/operations.ts\";\nimport {\n\tparseBadgeDetailsResponse,\n\tparseBadgeResponse,\n\tparseBadgesListResponse,\n} from \"../../domains/badges/badges/parsers.ts\";\nimport type {\n\tBadge,\n\tBadgeDetails,\n\tCreateBadgeParameters,\n\tGetBadgeParameters,\n\tListBadgesParameters,\n\tUpdateBadgeParameters,\n} from \"../../domains/badges/badges/types.ts\";\nimport {\n\tbuildFreeQuotaRequest,\n\tFREE_QUOTA_BASE_URL,\n\tFREE_QUOTA_OPERATION_LIMIT,\n\tparseFreeQuotaResponse,\n} from \"../../domains/badges/free-quota/operations.ts\";\nimport type { GetFreeBadgeQuotaParameters } from \"../../domains/badges/free-quota/types.ts\";\nimport {\n\tbuildMetadataRequest,\n\tMETADATA_BASE_URL,\n\tMETADATA_OPERATION_LIMIT,\n\tparseCreationPriceResponse,\n} from \"../../domains/badges/metadata/operations.ts\";\nimport { buildUploadIconRequest as buildLocaleUploadIconRequest } from \"../../domains/game-internationalization/badge-icon/builders.ts\";\nimport type { UploadBadgeIconLocalizationParameters } from \"../../domains/game-internationalization/badge-icon/types.ts\";\nimport { buildUpdateRequest as buildLocaleNameDescRequest } from \"../../domains/game-internationalization/badge-name-description/builders.ts\";\nimport {\n\tLOCALIZATION_OPERATION_LIMIT,\n\tLOCALIZATION_REQUIRED_SCOPES,\n} from \"../../domains/game-internationalization/badge-name-description/operations.ts\";\nimport type { UpdateBadgeNameDescriptionParameters } from \"../../domains/game-internationalization/badge-name-description/types.ts\";\nimport { buildUploadIconRequest } from \"../../domains/publish/badge-icon/builders.ts\";\nimport {\n\tUPLOAD_ICON_OPERATION_LIMIT,\n\tUPLOAD_ICON_REQUIRED_SCOPES,\n} from \"../../domains/publish/badge-icon/operations.ts\";\nimport { parseUploadIconResponse } from \"../../domains/publish/badge-icon/parsers.ts\";\nimport type {\n\tUploadBadgeIconParameters,\n\tUploadedBadgeIcon,\n} from \"../../domains/publish/badge-icon/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { waitForQuotaReset } from \"../../internal/http/retry-guidance.ts\";\nimport { CREATE_METHOD_DEFAULTS, IDEMPOTENT_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport {\n\tokRequest,\n\tparseEmptyResponse,\n\tResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { Page, Result } from \"../../types.ts\";\n\nfunction makeSpec<P, R>(spec: ResourceMethodSpec<P, R>): ResourceMethodSpec<P, R> {\n\treturn Object.freeze(spec);\n}\n\nconst CREATE_SPEC = makeSpec<CreateBadgeParameters, Badge>({\n\tbuildRequest: (parameters) => okRequest(buildCreateRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: CREATE_OPERATION_LIMIT,\n\tparse: parseBadgeResponse,\n\trequiredScopes: CREATE_REQUIRED_SCOPES,\n});\n\nconst UPDATE_SPEC = makeSpec<UpdateBadgeParameters, undefined>({\n\tbuildRequest: (parameters) => okRequest(buildUpdateRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: UPDATE_OPERATION_LIMIT,\n\tparse: parseEmptyResponse,\n\trequiredScopes: UPDATE_REQUIRED_SCOPES,\n});\n\nconst GET_SPEC = makeSpec<GetBadgeParameters, BadgeDetails>({\n\tbuildRequest: (parameters) => okRequest(buildGetRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parseBadgeDetailsResponse,\n\tunauthenticatedBaseUrl: READ_BASE_URL,\n});\n\nconst LIST_SPEC = makeSpec<ListBadgesParameters, Page<BadgeDetails>>({\n\tbuildRequest: (parameters) => okRequest(buildListRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: LIST_OPERATION_LIMIT,\n\tparse: parseBadgesListResponse,\n\tunauthenticatedBaseUrl: READ_BASE_URL,\n});\n\nconst FREE_QUOTA_SPEC = makeSpec<GetFreeBadgeQuotaParameters, number>({\n\tbuildRequest: (parameters) => okRequest(buildFreeQuotaRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: FREE_QUOTA_OPERATION_LIMIT,\n\tparse: parseFreeQuotaResponse,\n\tunauthenticatedBaseUrl: FREE_QUOTA_BASE_URL,\n});\n\nconst CREATION_PRICE_SPEC = makeSpec<undefined, number>({\n\tbuildRequest: () => okRequest(buildMetadataRequest()),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: METADATA_OPERATION_LIMIT,\n\tparse: parseCreationPriceResponse,\n\tunauthenticatedBaseUrl: METADATA_BASE_URL,\n});\n\nconst UPLOAD_ICON_SPEC = makeSpec<UploadBadgeIconParameters, UploadedBadgeIcon>({\n\tbuildRequest: (parameters) => okRequest(buildUploadIconRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: UPLOAD_ICON_OPERATION_LIMIT,\n\tparse: parseUploadIconResponse,\n\trequiredScopes: UPLOAD_ICON_REQUIRED_SCOPES,\n});\n\nconst UPDATE_NAME_DESCRIPTION_SPEC = makeSpec<UpdateBadgeNameDescriptionParameters, undefined>({\n\tbuildRequest: (parameters) => okRequest(buildLocaleNameDescRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: LOCALIZATION_OPERATION_LIMIT,\n\tparse: parseEmptyResponse,\n\trequiredScopes: LOCALIZATION_REQUIRED_SCOPES,\n});\n\nconst UPLOAD_LOCALIZED_ICON_SPEC = makeSpec<UploadBadgeIconLocalizationParameters, undefined>({\n\tbuildRequest: (parameters) => okRequest(buildLocaleUploadIconRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: LOCALIZATION_OPERATION_LIMIT,\n\tparse: parseEmptyResponse,\n\trequiredScopes: LOCALIZATION_REQUIRED_SCOPES,\n});\n\ninterface BadgeLocalizationHandle {\n\t/**\n\t * Updates the per-locale display name and/or description registered against\n\t * a badge. Either `name`, `description`, or both may be supplied; omitted\n\t * fields are not forwarded so the server leaves the existing value for\n\t * that locale untouched. Mirrors the upstream `200 OK` echo body as\n\t * `undefined` data.\n\t *\n\t * @param parameters - Badge and language identifiers plus the optional\n\t * replacement values.\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\tupdateNameDescription: (\n\t\tparameters: UpdateBadgeNameDescriptionParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n\t/**\n\t * Uploads or replaces the per-locale icon for a badge. A subsequent\n\t * upload for the same `(badgeId, languageCode)` pair replaces the\n\t * existing icon for that locale. Does not retry on 5xx so a duplicate\n\t * upload cannot be created if the server fails mid-write. Source-language\n\t * icons remain on {@link BadgesClient.uploadIcon}.\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 - Badge and language identifiers plus the image bytes\n\t * to upload.\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\tuploadIcon: (\n\t\tparameters: UploadBadgeIconLocalizationParameters,\n\t\toptions?: RequestOptions,\n\t) => Promise<Result<undefined, OpenCloudError>>;\n}\n\n/**\n * Public client for the Roblox Open Cloud Badges API. Covers programmatic\n * badge creation under a universe, partial updates of badge configuration\n * (`name`, `description`, `enabled`), and source-language icon uploads.\n *\n * Wires the request builders, the injected\n * {@link OpenCloudClientOptions.httpClient}, and response parsers into a\n * single ergonomic surface. Every method returns a {@link Result} so\n * callers handle failure explicitly; no thrown {@link OpenCloudError}\n * ever escapes the client.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { BadgesClient } from \"@bedrock-rbx/ocale/badges\";\n *\n * const client = new BadgesClient({ credential: { apiKey: \"your-key\", kind: \"apiKey\" } });\n * expect(client).toBeInstanceOf(BadgesClient);\n * ```\n */\nexport class BadgesClient {\n\treadonly #inner: ResourceClient;\n\n\t/**\n\t * Operation Group exposing per-locale localization Operations\n\t * (`updateNameDescription`, `uploadIcon`) backed by the\n\t * `legacy-game-internationalization` domain. Source-language values\n\t * remain on {@link BadgesClient.update} and\n\t * {@link BadgesClient.uploadIcon}; methods on this group set per-locale\n\t * overlays on top. Shares the parent client's HTTP, rate-limit, and\n\t * retry plumbing.\n\t */\n\tpublic readonly localization: BadgeLocalizationHandle;\n\n\t/**\n\t * Creates a new {@link BadgesClient}. Configuration is frozen on\n\t * construction; per-request overrides are accepted on each 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.localization = createLocalizationHandle(this.#inner);\n\t}\n\n\t/**\n\t * Creates a new badge under the supplied universe.\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 * A create whose `expectedCost` differs from the actual cost fails with a\n\t * `BadgeCostMismatchError` and is not charged; with `expectedCost: 0`\n\t * that means the universe's free badge quota is spent for today.\n\t *\n\t * @param parameters - Creation fields including the universe, name, and\n\t * icon image.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed {@link Badge} or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async create(\n\t\tparameters: CreateBadgeParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Badge, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({\n\t\t\toptions,\n\t\t\tparameters,\n\t\t\trefineError: refineCreateError(parameters.expectedCost),\n\t\t\tspec: CREATE_SPEC,\n\t\t});\n\t}\n\n\t/**\n\t * Reads one badge, enabled or disabled. A disabled badge comes back with\n\t * `enabled: false`; {@link BadgesClient.list} does not return it.\n\t *\n\t * The read is unauthenticated: it sends no credential and is served from\n\t * `https://badges.roblox.com`, so the client `baseUrl` does not apply.\n\t * Roblox allows 600 reads per minute per caller.\n\t *\n\t * @since 0.5.0\n\t * @param parameters - The badge to read.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed {@link BadgeDetails}, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async get(\n\t\tparameters: GetBadgeParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<BadgeDetails, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: GET_SPEC });\n\t}\n\n\t/**\n\t * Reads the list price in Robux of one badge create beyond the free\n\t * quota. The price is the same for every universe; it is not the cost\n\t * of the next create, which is free while\n\t * {@link BadgesClient.getFreeQuota} is above zero. Pass the price as\n\t * `expectedCost` on {@link BadgesClient.create} to pay for a create.\n\t *\n\t * The read is unauthenticated: it sends no credential and is served from\n\t * `https://badges.roblox.com`, so the client `baseUrl` does not apply.\n\t * Roblox allows 100 reads per minute per caller.\n\t *\n\t * @since 0.5.0\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the badge creation price in Robux,\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * import { BadgesClient } from \"@bedrock-rbx/ocale/badges\";\n\t *\n\t * const client = new BadgesClient({\n\t * \tcredential: { kind: \"none\" },\n\t * \thttpClient: {\n\t * \t\trequest: async () => ({\n\t * \t\t\tdata: { body: { badgeCreationPrice: 100 }, headers: {}, status: 200 },\n\t * \t\t\tsuccess: true,\n\t * \t\t}),\n\t * \t},\n\t * });\n\t *\n\t * return client.getCreationPrice().then((price) => {\n\t * \texpect(price).toStrictEqual({ data: 100, success: true });\n\t * });\n\t * ```\n\t */\n\tpublic async getCreationPrice(\n\t\toptions?: RequestOptions,\n\t): Promise<Result<number, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({\n\t\t\toptions,\n\t\t\tparameters: undefined,\n\t\t\tspec: CREATION_PRICE_SPEC,\n\t\t});\n\t}\n\n\t/**\n\t * Reads how many badges the universe can still create free of charge\n\t * today. Each create within the quota lowers it by one. The quota resets\n\t * daily at 00:00 UTC. Roblox answers for any universe ID, existing or not.\n\t *\n\t * The read is unauthenticated: it sends no credential and is served from\n\t * `https://badges.roblox.com`, so the client `baseUrl` does not apply.\n\t * Roblox allows 60 reads per minute per caller. A 429 waits until the\n\t * reported `x-ratelimit-reset` before it retries.\n\t *\n\t * @since 0.4.0\n\t * @param parameters - The universe to read.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the free badges left today, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async getFreeQuota(\n\t\tparameters: GetFreeBadgeQuotaParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<number, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({\n\t\t\toptions,\n\t\t\tparameters,\n\t\t\trefineError: waitForQuotaReset,\n\t\t\tspec: FREE_QUOTA_SPEC,\n\t\t});\n\t}\n\n\t/**\n\t * Lists one page of a universe's enabled badges. Omit\n\t * `pageToken` for the first page, then pass the returned `nextPageToken`\n\t * until it is undefined.\n\t *\n\t * This list hides disabled badges. A badge leaves the list as soon as\n\t * it is disabled, but {@link BadgesClient.get} still returns it, with\n\t * `enabled: false`. Use {@link BadgesClient.get} to see a disabled badge,\n\t * for example a tracked badge that someone disabled. A page can hold\n\t * fewer items than `pageSize` and still have a next page, so page until\n\t * `nextPageToken` is undefined.\n\t *\n\t * The read is unauthenticated: it sends no credential and is served from\n\t * `https://badges.roblox.com`, so the client `baseUrl` does not apply.\n\t * Roblox allows 100 pages per minute per caller.\n\t *\n\t * @since 0.5.0\n\t * @param parameters - Universe ID and optional paging fields.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the badge page, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async list(\n\t\tparameters: ListBadgesParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Page<BadgeDetails>, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: LIST_SPEC });\n\t}\n\n\t/**\n\t * Partially updates a badge's configuration. Mirrors the upstream\n\t * `200 OK` empty response: a successful update yields `undefined`\n\t * data. Only fields explicitly provided are forwarded to the server,\n\t * so omitted fields keep their current values.\n\t *\n\t * @param parameters - Identifier plus the fields to update.\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 update(\n\t\tparameters: UpdateBadgeParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<undefined, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: UPDATE_SPEC });\n\t}\n\n\t/**\n\t * Uploads or replaces the source-language icon registered against a\n\t * badge. A subsequent upload for the same badge replaces the\n\t * existing source icon. Does not retry on 5xx so a duplicate icon\n\t * upload cannot be created if the server fails mid-write.\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 - Identifier plus the image bytes to upload.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the uploaded icon's asset ID, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async uploadIcon(\n\t\tparameters: UploadBadgeIconParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<UploadedBadgeIcon, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: UPLOAD_ICON_SPEC });\n\t}\n}\n\nfunction createLocalizationHandle(inner: ResourceClient): BadgeLocalizationHandle {\n\treturn {\n\t\tasync updateNameDescription(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: UPDATE_NAME_DESCRIPTION_SPEC });\n\t\t},\n\t\tasync uploadIcon(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: UPLOAD_LOCALIZED_ICON_SPEC });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,mBAAmB,YAAgD;CAClF,MAAM,OAAO,IAAI,SAAS;CAC1B,KAAK,OAAO,QAAQ,WAAW,IAAI;CACnC,IAAI,WAAW,SAAS,KAAA,GAEvB,KAAK,OAAO,SAAS,OAAO,WAAW,IAAI,GAAG,MAAM;CAGrD,IAAI,WAAW,gBAAgB,KAAA,GAC9B,KAAK,OAAO,eAAe,WAAW,WAAW;CAGlD,IAAI,WAAW,aAAa,KAAA,GAC3B,KAAK,OAAO,YAAY,OAAO,WAAW,QAAQ,CAAC;CAGpD,IAAI,WAAW,iBAAiB,KAAA,GAC/B,KAAK,OAAO,gBAAgB,OAAO,WAAW,YAAY,CAAC;CAG5D,IAAI,WAAW,kBAAkB,KAAA,GAChC,KAAK,OAAO,qBAAqB,oBAAoB,WAAW,aAAa,CAAC;CAG/E,OAAO;EACN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;;;;;;;CAaA,MAAa,OACZ,YACA,SAC6C;EAC7C,OAAO,KAAK,OAAO,aAAa;GAAE;GAAS;GAAY,MAAM;EAAY,CAAC;CAC3E;;;;;;;;;;;;;;;CAgBA,MAAa,WACZ,YACA,SACqD;EACrD,OAAO,KAAK,OAAO,aAAa;GAAE;GAAS;GAAY,MAAM;EAAiB,CAAC;CAChF;AACD;AAEA,SAAS,yBAAyB,OAAgD;CACjF,OAAO;EACN,MAAM,sBAAsB,YAAY,SAAS;GAChD,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAA6B,CAAC;EACtF;EACA,MAAM,WAAW,YAAY,SAAS;GACrC,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAA2B,CAAC;EACpF;CACD;AACD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { d as RequestOptions } from "./types-
|
|
2
|
-
//#region src/domains/cloud-v2/luau-execution-tasks/types.d.ts
|
|
1
|
+
import { d as RequestOptions } from "./types-Z4abDJfK.mjs";
|
|
3
2
|
/**
|
|
4
3
|
* Caller-supplied input for submitting a Luau Execution task against a
|
|
5
4
|
* place's head version. Submitting against a specific place version uses
|
|
@@ -203,8 +202,6 @@ interface LuauExecutionTaskBase {
|
|
|
203
202
|
*/
|
|
204
203
|
readonly user: string;
|
|
205
204
|
}
|
|
206
|
-
//#endregion
|
|
207
|
-
//#region src/domains/cloud-v2/luau-execution-task-logs/types.d.ts
|
|
208
205
|
/**
|
|
209
206
|
* Caller-supplied input for listing the structured log messages produced
|
|
210
207
|
* by a previously-submitted Luau execution task.
|
|
@@ -262,8 +259,6 @@ interface LogPage {
|
|
|
262
259
|
*/
|
|
263
260
|
readonly nextPageToken?: string | undefined;
|
|
264
261
|
}
|
|
265
|
-
//#endregion
|
|
266
|
-
//#region src/resources/luau-execution/polling.d.ts
|
|
267
262
|
/**
|
|
268
263
|
* Default poll cadence as a function of elapsed wall-clock time since
|
|
269
264
|
* polling began. Polls quickly while a task is young so short runs resolve
|
|
@@ -319,8 +314,6 @@ interface PollOptions {
|
|
|
319
314
|
*/
|
|
320
315
|
readonly timeoutMs?: number;
|
|
321
316
|
}
|
|
322
|
-
//#endregion
|
|
323
|
-
//#region src/resources/luau-execution/capacity-admission.d.ts
|
|
324
317
|
/**
|
|
325
318
|
* Per-request options for submitting a Luau execution task.
|
|
326
319
|
*
|
|
@@ -350,6 +343,5 @@ interface LuauExecutionSubmitOptions extends RequestOptions {
|
|
|
350
343
|
* @since 0.3.2
|
|
351
344
|
*/
|
|
352
345
|
type LuauExecutionRunOptions = LuauExecutionSubmitOptions & PollUntilDoneOptions;
|
|
353
|
-
//#endregion
|
|
354
346
|
export { ListLogsParameters as a, CompleteTask as c, InProgressTask as d, LuauExecutionTask as f, SubmitAtVersionParameters as h, defaultPollDelay as i, FailedTask as l, SubmitAtHeadParameters as m, LuauExecutionSubmitOptions as n, LogMessage as o, LuauExecutionTaskRef as p, PollUntilDoneOptions as r, LogPage as s, LuauExecutionRunOptions as t, GetParameters as u };
|
|
355
|
-
//# sourceMappingURL=capacity-admission-
|
|
347
|
+
//# sourceMappingURL=capacity-admission-Ce2V9QNb.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capacity-admission-Ce2V9QNb.d.mts","names":[],"sources":["../src/domains/cloud-v2/luau-execution-tasks/types.ts","../src/domains/cloud-v2/luau-execution-task-logs/types.ts","../src/resources/luau-execution/polling.ts","../src/resources/luau-execution/capacity-admission.ts"],"mappings":";;;;;;;;UAOiB;;;;;WAKP;;WAEA;;WAEA;;WAEA;;;;;WAKA;;WAEA;;;;;;;;;UAUO;;;;;WAKP;;WAEA;;WAEA;;WAEA;;;;;WAKA;;WAEA;;WAEA;;;;;;;;;;;UAYO;;WAEP;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;;;UASO;;WAEP,KAAK;;;;;;WAML;;;;;;;;;;;UAYO,uBAAuB;;;;;WAK9B;;;;;;;;;;UAWO,qBAAqB;;;;;;WAM5B;aAAmB,SAAS,cAAc;;;WAE1C;;;;;;;;;;UAWO,mBAAmB;;WAE1B;;;;;;;;aAQC;;aAOA;;;WAGD;;;;;;;;KASE,oBAAoB,eAAe,aAAa;;;;;;UAOlD;;;;;WAKA;;;;;;WAMA;;;;;WAKA,YAAY;;WAEZ;;WAEA,KAAK;;;;;;WAML;;;;;WAKA,YAAY;;;;WAIZ;;;;;;;;UC1MO;;;;;;WAMP;;;;;WAKA;;WAEA,KAAK;;;;;;;;;UAUE;;WAEP;;WAEA;;;;;;WAMA;;;;;;;;;;UAWO;;WAEP,UAAU,cAAc;;;;;WAKxB;;;;;;;;;;;;;;;;;;;;;;iBCDM,iBAAiB;;;;;;;KAuDrB,uBAAuB,cAAc;;UAGvC;;;;;;WAMA;;;;;WAKA,aAAa;;;;;WAKb,SAAS;;;;;;;;WAQT;;;;;;;;;;;;;;;;UC5GO,mCAAmC;;;;;;WAM1C;;;;;;;;KASE,0BAA0B,6BAA6B"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/locales/data.generated.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* One row in the vendored Roblox creator-locale list.
|
|
4
3
|
*
|
|
@@ -488,6 +487,5 @@ type RobloxLocale = (typeof ROBLOX_CREATOR_LOCALES)[number]["locale"];
|
|
|
488
487
|
* @since 0.1.0
|
|
489
488
|
*/
|
|
490
489
|
type RobloxLanguageCode = (typeof ROBLOX_CREATOR_LOCALES)[number]["languageCode"];
|
|
491
|
-
//#endregion
|
|
492
490
|
export { RobloxLocale as i, RobloxCreatorLocale as n, RobloxLanguageCode as r, ROBLOX_CREATOR_LOCALES as t };
|
|
493
|
-
//# sourceMappingURL=data.generated-
|
|
491
|
+
//# sourceMappingURL=data.generated-B4Fztv_7.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.generated-
|
|
1
|
+
{"version":3,"file":"data.generated-B4Fztv_7.d.mts","names":[],"sources":["../src/locales/data.generated.ts"],"mappings":";;;;;UAQiB;WACP;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;;;;;cAUG;WAEX;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;;;;;KAWU,uBAAuB;;;;;;;;KASvB,6BAA6B"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region src/domains/developer-products/products/types.d.ts
|
|
1
|
+
import { i as RobloxLocale, r as RobloxLanguageCode } from "./data.generated-B4Fztv_7.mjs";
|
|
2
|
+
import { c as OpenCloudClientOptions, d as RequestOptions, g as OpenCloudError, m as Result, p as Page } from "./types-Z4abDJfK.mjs";
|
|
4
3
|
/**
|
|
5
4
|
* Pricing feature flags that can be enabled on a developer product. Values
|
|
6
5
|
* mirror the Open Cloud `DeveloperProducts.PricingFeature` enum.
|
|
@@ -115,8 +114,22 @@ interface UpdateDeveloperProductParameters {
|
|
|
115
114
|
/** Stringified ID of the universe that owns the developer product. */
|
|
116
115
|
readonly universeId: string;
|
|
117
116
|
}
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Parameters for listing developer products in a universe. Pass the returned
|
|
119
|
+
* `nextPageToken` as `pageToken` until it is undefined.
|
|
120
|
+
*
|
|
121
|
+
* @since 0.5.0
|
|
122
|
+
*/
|
|
123
|
+
interface ListDeveloperProductsParameters {
|
|
124
|
+
/**
|
|
125
|
+
* Optional page size; defaults to 50, maximum 400 (observed 2026-11-09).
|
|
126
|
+
*/
|
|
127
|
+
readonly pageSize?: number;
|
|
128
|
+
/** Cursor returned by the previous page. */
|
|
129
|
+
readonly pageToken?: string;
|
|
130
|
+
/** Stringified universe ID. */
|
|
131
|
+
readonly universeId: string;
|
|
132
|
+
}
|
|
120
133
|
/**
|
|
121
134
|
* Parameters for uploading or replacing the per-locale icon registered
|
|
122
135
|
* against a developer product. A subsequent upload for the same
|
|
@@ -137,8 +150,6 @@ interface UploadDeveloperProductIconParameters {
|
|
|
137
150
|
/** Stringified ID of the developer product whose icon is being uploaded. */
|
|
138
151
|
readonly productId: string;
|
|
139
152
|
}
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region src/domains/game-internationalization/developer-product-name-description/types.d.ts
|
|
142
153
|
/**
|
|
143
154
|
* Parameters for updating the per-locale name and/or description registered
|
|
144
155
|
* against a developer product. Both `name` and `description` are optional;
|
|
@@ -164,8 +175,6 @@ interface UpdateDeveloperProductNameDescriptionParameters {
|
|
|
164
175
|
*/
|
|
165
176
|
readonly productId: string;
|
|
166
177
|
}
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region src/resources/developer-products/client.d.ts
|
|
169
178
|
interface DeveloperProductLocalizationHandle {
|
|
170
179
|
/**
|
|
171
180
|
* Updates the per-locale display name and/or description registered against
|
|
@@ -278,6 +287,16 @@ export declare class DeveloperProductsClient {
|
|
|
278
287
|
* the {@link OpenCloudError} that caused the request to fail.
|
|
279
288
|
*/
|
|
280
289
|
get(parameters: GetDeveloperProductParameters, options?: RequestOptions): Promise<Result<DeveloperProduct, OpenCloudError>>;
|
|
290
|
+
/**
|
|
291
|
+
* Lists one page of developer products. Omit `pageToken` for the first
|
|
292
|
+
* page, then pass the returned `nextPageToken` until it is undefined.
|
|
293
|
+
*
|
|
294
|
+
* @param parameters - Universe ID and optional pagination fields.
|
|
295
|
+
* @param options - Optional per-request overrides.
|
|
296
|
+
* @returns A result containing the product page or the request error.
|
|
297
|
+
* @since 0.5.0
|
|
298
|
+
*/
|
|
299
|
+
list(parameters: ListDeveloperProductsParameters, options?: RequestOptions): Promise<Result<Page<DeveloperProduct>, OpenCloudError>>;
|
|
281
300
|
/**
|
|
282
301
|
* Partially updates an existing developer product. Mirrors the upstream
|
|
283
302
|
* `204 No Content` response: a successful update yields `undefined` data.
|
|
@@ -297,6 +316,5 @@ export declare class DeveloperProductsClient {
|
|
|
297
316
|
*/
|
|
298
317
|
update(parameters: UpdateDeveloperProductParameters, options?: RequestOptions): Promise<Result<undefined, OpenCloudError>>;
|
|
299
318
|
}
|
|
300
|
-
|
|
301
|
-
export type { CreateDeveloperProductParameters, DeveloperProduct, DeveloperProductPrice, DeveloperProductPricingFeature, GetDeveloperProductParameters, UpdateDeveloperProductNameDescriptionParameters, UpdateDeveloperProductParameters, UploadDeveloperProductIconParameters };
|
|
319
|
+
export type { CreateDeveloperProductParameters, DeveloperProduct, DeveloperProductPrice, DeveloperProductPricingFeature, GetDeveloperProductParameters, ListDeveloperProductsParameters, UpdateDeveloperProductNameDescriptionParameters, UpdateDeveloperProductParameters, UploadDeveloperProductIconParameters };
|
|
302
320
|
//# sourceMappingURL=developer-products.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"developer-products.d.mts","names":[],"sources":["../src/domains/developer-products/products/types.ts","../src/domains/game-internationalization/developer-product-icon/types.ts","../src/domains/game-internationalization/developer-product-name-description/types.ts","../src/resources/developer-products/client.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"developer-products.d.mts","names":[],"sources":["../src/domains/developer-products/products/types.ts","../src/domains/game-internationalization/developer-product-icon/types.ts","../src/domains/game-internationalization/developer-product-name-description/types.ts","../src/resources/developer-products/client.ts"],"mappings":";;;;;;;;KAMY;;;;;;UAWK;;WAEP;;WAEA,iBAAiB,cAAc;;;;;;;;;UAUxB;;;;;WAKP;;WAEA;;;;WAIA,WAAW;;WAEX;;;;WAIA;;WAEA;;WAEA;;WAEA;;WAEA,OAAO;;WAEP;;WAEA,WAAW;;;;;;;UAQJ;;WAEP;;WAEA;;WAEA,YAAY,OAAO;;WAEnB;;WAEA;;WAEA;;WAEA;;;;;;;UAQO;;WAEP;;WAEA;;;;;;;;;;UAWO;;WAEP;;WAEA;;WAEA,YAAY,OAAO;;WAEnB;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;;;UASO;;;;WAIP;;WAEA;;WAEA;;;;;;;;;;UChIO;;WAEP,OAAO,OAAO;;;;;;WAMd,cAAc,qBAAqB;;WAEnC;;;;;;;;;;UCVO;;WAEP;;WAEA;;;;;;WAMA,cAAc,qBAAqB;;;;;WAKnC;;UCmFA;;;;;;;;;;;;;;EAcT,wBACC,YAAY,iDACZ,UAAU,mBACN,QAAQ,kBAAkB;;;;;;;;;;;;;;;;EAgB/B,aACC,YAAY,sCACZ,UAAU,mBACN,QAAQ,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA2CnB;;;;;;;;;;WAWI,cAAc;;;;;;;EAQ9B,YAAY,SAAS;;;;;;;;;;;;EAgBrB,OACC,YAAY,kCACZ,UAAU,iBACR,QAAQ,OAAO,kBAAkB;;;;;;;;;;EAapC,IACC,YAAY,+BACZ,UAAU,iBACR,QAAQ,OAAO,kBAAkB;;;;;;;;;;EAapC,KACC,YAAY,iCACZ,UAAU,iBACR,QAAQ,OAAO,KAAK,mBAAmB;;;;;;;;;;;;;;;;;;EAqB1C,OACC,YAAY,kCACZ,UAAU,iBACR,QAAQ,kBAAkB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { t as toBlob } from "./to-blob-Bqu7bmlE.mjs";
|
|
2
|
+
import { N as isRecord, m as UnexpectedResponseError, r as IDEMPOTENT_METHOD_DEFAULTS, t as CREATE_METHOD_DEFAULTS } from "./retry-Dv5TsY9O.mjs";
|
|
3
|
+
import { n as isPriceInformationLike, t as copyPriceInformation } from "./price-information--d6GZAcp.mjs";
|
|
4
|
+
import { t as isDateTimeString } from "./is-date-time-string-C91G44SI.mjs";
|
|
5
|
+
import { n as okRequest, r as parseEmptyResponse, s as toJsonDetails, t as ResourceClient } from "./resource-client-Cm_bPcCs.mjs";
|
|
6
|
+
// src/domains/developer-products/products/builders.ts
|
|
6
7
|
/**
|
|
7
8
|
* Builds a `GET` request for the Open Cloud "read developer product"
|
|
8
9
|
* endpoint.
|
|
@@ -62,8 +63,26 @@ function buildUpdateRequest$1(parameters) {
|
|
|
62
63
|
url: `/developer-products/v2/universes/${parameters.universeId}/developer-products/${parameters.productId}`
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Builds a `GET` request for the Open Cloud "list developer products" endpoint.
|
|
68
|
+
* Optional `pageSize` and `pageToken` are appended to the query string only
|
|
69
|
+
* when defined so the server applies its own defaults for omitted fields.
|
|
70
|
+
*
|
|
71
|
+
* @param parameters - Universe identifier plus optional pagination cursors.
|
|
72
|
+
* @returns A pure {@link HttpRequest} describing the list call.
|
|
73
|
+
*/
|
|
74
|
+
function buildListRequest(parameters) {
|
|
75
|
+
const query = new URLSearchParams();
|
|
76
|
+
if (parameters.pageSize !== void 0) query.append("pageSize", String(parameters.pageSize));
|
|
77
|
+
if (parameters.pageToken !== void 0) query.append("pageToken", parameters.pageToken);
|
|
78
|
+
const queryString = query.toString();
|
|
79
|
+
const base = `/developer-products/v2/universes/${parameters.universeId}/developer-products/creator`;
|
|
80
|
+
return {
|
|
81
|
+
method: "GET",
|
|
82
|
+
url: queryString === "" ? base : `${base}?${queryString}`
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// src/domains/developer-products/products/operations.ts
|
|
67
86
|
/**
|
|
68
87
|
* Per-second request ceiling for reading a single developer product, from
|
|
69
88
|
* the Open Cloud OpenAPI schema.
|
|
@@ -106,8 +125,17 @@ const GET_REQUIRED_SCOPES = Object.freeze(["developer-product:read"]);
|
|
|
106
125
|
* OpenAPI schema.
|
|
107
126
|
*/
|
|
108
127
|
const WRITE_REQUIRED_SCOPES = Object.freeze(["developer-product:write"]);
|
|
109
|
-
|
|
110
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Per-second ceiling from
|
|
130
|
+
* DeveloperProducts_ListDeveloperProductConfigsByUniverseV2.
|
|
131
|
+
*/
|
|
132
|
+
const LIST_OPERATION_LIMIT = Object.freeze({
|
|
133
|
+
maxPerSecond: 10,
|
|
134
|
+
operationKey: "developer-products.list"
|
|
135
|
+
});
|
|
136
|
+
/** Read scope required by the list operation. */
|
|
137
|
+
const LIST_REQUIRED_SCOPES = Object.freeze(["developer-product:read"]);
|
|
138
|
+
// src/domains/developer-products/products/parsers.ts
|
|
111
139
|
/**
|
|
112
140
|
* Parses a successful Developer Products API response into the public
|
|
113
141
|
* `DeveloperProduct` shape, returning a `Result` so callers can handle
|
|
@@ -141,6 +169,36 @@ function parseDeveloperProductResponse({ body, status: statusCode }) {
|
|
|
141
169
|
success: true
|
|
142
170
|
};
|
|
143
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Parses a developer product page, preserving its cursor and converting items
|
|
174
|
+
* with the same validation as a single-product response.
|
|
175
|
+
*
|
|
176
|
+
* @param response - The HTTP response to parse.
|
|
177
|
+
* @returns The parsed page or an unexpected response error.
|
|
178
|
+
*/
|
|
179
|
+
function parseProductsListResponse(response) {
|
|
180
|
+
const { body, status: statusCode } = response;
|
|
181
|
+
if (!isRecord(body) || !Array.isArray(body["developerProducts"])) return malformedDeveloperProductsList(statusCode, body);
|
|
182
|
+
const nextPageToken = body["nextPageToken"] ?? void 0;
|
|
183
|
+
if (nextPageToken !== void 0 && typeof nextPageToken !== "string") return malformedDeveloperProductsList(statusCode, body);
|
|
184
|
+
const items = [];
|
|
185
|
+
const products = body["developerProducts"];
|
|
186
|
+
for (const item of products) {
|
|
187
|
+
const parsed = parseDeveloperProductResponse({
|
|
188
|
+
...response,
|
|
189
|
+
body: item
|
|
190
|
+
});
|
|
191
|
+
if (!parsed.success) return malformedDeveloperProductsList(statusCode, body);
|
|
192
|
+
items.push(parsed.data);
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
data: {
|
|
196
|
+
items,
|
|
197
|
+
nextPageToken
|
|
198
|
+
},
|
|
199
|
+
success: true
|
|
200
|
+
};
|
|
201
|
+
}
|
|
144
202
|
function malformedDeveloperProduct(statusCode, body) {
|
|
145
203
|
return {
|
|
146
204
|
err: new UnexpectedResponseError("Malformed developer product response", {
|
|
@@ -165,8 +223,16 @@ function isDeveloperProductConfigV2(body) {
|
|
|
165
223
|
if (price !== void 0 && !isPriceInformationLike(price, isPricingFeatureWire)) return false;
|
|
166
224
|
return true;
|
|
167
225
|
}
|
|
168
|
-
|
|
169
|
-
|
|
226
|
+
function malformedDeveloperProductsList(statusCode, body) {
|
|
227
|
+
return {
|
|
228
|
+
err: new UnexpectedResponseError("Malformed developer products list response", {
|
|
229
|
+
details: toJsonDetails(body),
|
|
230
|
+
statusCode
|
|
231
|
+
}),
|
|
232
|
+
success: false
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
// src/domains/game-internationalization/developer-product-icon/builders.ts
|
|
170
236
|
/**
|
|
171
237
|
* Builds a `POST` request for the localized "upload developer-product icon"
|
|
172
238
|
* endpoint. A successful upload replaces any existing icon for the same
|
|
@@ -185,8 +251,7 @@ function buildUploadIconRequest(parameters) {
|
|
|
185
251
|
url: `/legacy-game-internationalization/v1/developer-products/${parameters.productId}/icons/language-codes/${parameters.languageCode}`
|
|
186
252
|
};
|
|
187
253
|
}
|
|
188
|
-
|
|
189
|
-
//#region src/domains/game-internationalization/developer-product-name-description/builders.ts
|
|
254
|
+
// src/domains/game-internationalization/developer-product-name-description/builders.ts
|
|
190
255
|
/**
|
|
191
256
|
* Builds a `PATCH` request for the localized "update developer-product
|
|
192
257
|
* name/description" endpoint. Either `name`, `description`, or both may be
|
|
@@ -207,8 +272,7 @@ function buildUpdateRequest(parameters) {
|
|
|
207
272
|
url: `/legacy-game-internationalization/v1/developer-products/${parameters.productId}/name-description/language-codes/${parameters.languageCode}`
|
|
208
273
|
};
|
|
209
274
|
}
|
|
210
|
-
|
|
211
|
-
//#region src/domains/game-internationalization/developer-product-name-description/operations.ts
|
|
275
|
+
// src/domains/game-internationalization/developer-product-name-description/operations.ts
|
|
212
276
|
/**
|
|
213
277
|
* Per-second request ceiling for developer-product localization Operations,
|
|
214
278
|
* from each operation's `x-roblox-rate-limits.perApiKeyOwner` in the vendored
|
|
@@ -228,8 +292,7 @@ const LOCALIZATION_OPERATION_LIMIT = Object.freeze({
|
|
|
228
292
|
* developer-product endpoints in the vendored OpenAPI schema.
|
|
229
293
|
*/
|
|
230
294
|
const LOCALIZATION_REQUIRED_SCOPES = Object.freeze(["legacy-developer-product:manage"]);
|
|
231
|
-
|
|
232
|
-
//#region src/resources/developer-products/client.ts
|
|
295
|
+
// src/resources/developer-products/client.ts
|
|
233
296
|
function makeSpec(spec) {
|
|
234
297
|
return Object.freeze(spec);
|
|
235
298
|
}
|
|
@@ -249,6 +312,14 @@ const GET_SPEC = makeSpec({
|
|
|
249
312
|
parse: parseDeveloperProductResponse,
|
|
250
313
|
requiredScopes: GET_REQUIRED_SCOPES
|
|
251
314
|
});
|
|
315
|
+
const LIST_SPEC = makeSpec({
|
|
316
|
+
buildRequest: (parameters) => okRequest(buildListRequest(parameters)),
|
|
317
|
+
methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
|
|
318
|
+
methodKind: "idempotent",
|
|
319
|
+
operationLimit: LIST_OPERATION_LIMIT,
|
|
320
|
+
parse: parseProductsListResponse,
|
|
321
|
+
requiredScopes: LIST_REQUIRED_SCOPES
|
|
322
|
+
});
|
|
252
323
|
const UPDATE_SPEC = makeSpec({
|
|
253
324
|
buildRequest: (parameters) => okRequest(buildUpdateRequest$1(parameters)),
|
|
254
325
|
methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
|
|
@@ -369,6 +440,22 @@ var DeveloperProductsClient = class {
|
|
|
369
440
|
});
|
|
370
441
|
}
|
|
371
442
|
/**
|
|
443
|
+
* Lists one page of developer products. Omit `pageToken` for the first
|
|
444
|
+
* page, then pass the returned `nextPageToken` until it is undefined.
|
|
445
|
+
*
|
|
446
|
+
* @param parameters - Universe ID and optional pagination fields.
|
|
447
|
+
* @param options - Optional per-request overrides.
|
|
448
|
+
* @returns A result containing the product page or the request error.
|
|
449
|
+
* @since 0.5.0
|
|
450
|
+
*/
|
|
451
|
+
async list(parameters, options) {
|
|
452
|
+
return this.#inner.executeAsync({
|
|
453
|
+
options,
|
|
454
|
+
parameters,
|
|
455
|
+
spec: LIST_SPEC
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
372
459
|
* Partially updates an existing developer product. Mirrors the upstream
|
|
373
460
|
* `204 No Content` response: a successful update yields `undefined` data.
|
|
374
461
|
* Callers that need the post-update state (for example to observe a
|
|
@@ -411,7 +498,6 @@ function createLocalizationHandle(inner) {
|
|
|
411
498
|
}
|
|
412
499
|
};
|
|
413
500
|
}
|
|
414
|
-
//#endregion
|
|
415
501
|
export { DeveloperProductsClient };
|
|
416
502
|
|
|
417
503
|
//# sourceMappingURL=developer-products.mjs.map
|