@bedrock-rbx/ocale 0.1.0-beta.9 → 0.1.1
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 +182 -0
- package/dist/badges.d.mts +33 -2
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +16 -4
- package/dist/badges.mjs.map +1 -1
- package/dist/{data.generated-Cb6g6asv.d.mts → data.generated-B2ceLfSn.d.mts} +9 -1
- package/dist/data.generated-B2ceLfSn.d.mts.map +1 -0
- package/dist/developer-products.d.mts +38 -2
- package/dist/developer-products.d.mts.map +1 -1
- package/dist/developer-products.mjs +32 -8
- package/dist/developer-products.mjs.map +1 -1
- package/dist/game-passes.d.mts +40 -2
- package/dist/game-passes.d.mts.map +1 -1
- package/dist/game-passes.mjs +30 -6
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +21 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/locales.d.mts +1 -1
- package/dist/locales.mjs +2 -0
- package/dist/locales.mjs.map +1 -1
- package/dist/luau-execution.d.mts +22 -3
- package/dist/luau-execution.d.mts.map +1 -1
- package/dist/luau-execution.mjs +29 -13
- package/dist/luau-execution.mjs.map +1 -1
- package/dist/places.d.mts +20 -2
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +34 -14
- package/dist/places.mjs.map +1 -1
- package/dist/{poll-timeout-Dg_QFEqi.mjs → poll-timeout-BfxUWWCZ.mjs} +6 -2
- package/dist/poll-timeout-BfxUWWCZ.mjs.map +1 -0
- package/dist/{polling-helpers-CS00apdU.mjs → polling-helpers-DCw9LyJM.mjs} +225 -78
- package/dist/polling-helpers-DCw9LyJM.mjs.map +1 -0
- package/dist/{polling-BMrYajok.d.mts → polling-rj0dGREg.d.mts} +73 -14
- package/dist/polling-rj0dGREg.d.mts.map +1 -0
- package/dist/{price-information-DIrvwCmd.mjs → price-information-C4gC2CMZ.mjs} +2 -2
- package/dist/{price-information-DIrvwCmd.mjs.map → price-information-C4gC2CMZ.mjs.map} +1 -1
- package/dist/{rate-limit-D1q2Js-z.mjs → rate-limit-Dh2leqaB.mjs} +49 -3
- package/dist/rate-limit-Dh2leqaB.mjs.map +1 -0
- package/dist/resource-client-CIAkS2xQ.mjs +960 -0
- package/dist/resource-client-CIAkS2xQ.mjs.map +1 -0
- package/dist/retry-Bh2nNjBV.d.mts +234 -0
- package/dist/retry-Bh2nNjBV.d.mts.map +1 -0
- package/dist/retry-BvZRZDXs.mjs +380 -0
- package/dist/retry-BvZRZDXs.mjs.map +1 -0
- package/dist/{signatures-B5Fojgn0.mjs → signatures-JF-7Psce.mjs} +1 -1
- package/dist/{signatures-B5Fojgn0.mjs.map → signatures-JF-7Psce.mjs.map} +1 -1
- package/dist/storage.d.mts +30 -27
- package/dist/storage.d.mts.map +1 -1
- package/dist/storage.mjs +46 -31
- package/dist/storage.mjs.map +1 -1
- package/dist/testing.d.mts +24 -9
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +2 -2
- package/dist/testing.mjs.map +1 -1
- package/dist/{to-blob-B27VhoRp.mjs → to-blob-RPqMBuft.mjs} +1 -1
- package/dist/{to-blob-B27VhoRp.mjs.map → to-blob-RPqMBuft.mjs.map} +1 -1
- package/dist/{types-CwtZT1ek.d.mts → types-CRiJg5EQ.d.mts} +46 -4
- package/dist/types-CRiJg5EQ.d.mts.map +1 -0
- package/dist/universes.d.mts +47 -5
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +31 -15
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-DkL5KQqz.mjs → validation-xJZRa8tX.mjs} +4 -2
- package/dist/validation-xJZRa8tX.mjs.map +1 -0
- package/dist/{wire-CeL6W_V7.d.mts → wire-D3K-a-UP.d.mts} +3 -1
- package/dist/wire-D3K-a-UP.d.mts.map +1 -0
- package/package.json +6 -5
- package/dist/data.generated-Cb6g6asv.d.mts.map +0 -1
- package/dist/permission-error-DOVtNq3A.mjs +0 -46
- package/dist/permission-error-DOVtNq3A.mjs.map +0 -1
- package/dist/poll-timeout-Dg_QFEqi.mjs.map +0 -1
- package/dist/polling-BMrYajok.d.mts.map +0 -1
- package/dist/polling-helpers-CS00apdU.mjs.map +0 -1
- package/dist/rate-limit-BYuizHoD.d.mts +0 -92
- package/dist/rate-limit-BYuizHoD.d.mts.map +0 -1
- package/dist/rate-limit-D1q2Js-z.mjs.map +0 -1
- package/dist/resource-client-D6Efj9fU.mjs +0 -732
- package/dist/resource-client-D6Efj9fU.mjs.map +0 -1
- package/dist/types-CwtZT1ek.d.mts.map +0 -1
- package/dist/validation-DkL5KQqz.mjs.map +0 -1
- package/dist/wire-CeL6W_V7.d.mts.map +0 -1
package/dist/testing.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","names":[],"sources":["../tests/helpers/badges.ts","../tests/helpers/developer-products.ts","../tests/helpers/fake-http-client.ts","../tests/helpers/fake-send.ts","../tests/helpers/fake-sleep.ts","../tests/helpers/game-icon.ts","../tests/helpers/game-passes.ts","../tests/helpers/game-thumbnails.ts","../tests/helpers/luau-execution-task-binary-inputs.ts","../tests/helpers/luau-execution-task-logs.ts","../tests/helpers/luau-execution-tasks.ts","../tests/helpers/memory-store-queues.ts","../tests/helpers/places.ts","../tests/helpers/universes.ts"],"sourcesContent":["import type { BadgeResponseV2Wire } from \"#src/domains/badges/badges/wire\";\n\n/**\n * Builds a minimally-valid {@link BadgeResponseV2Wire} body. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant; useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validBadgeBody(overrides: Partial<BadgeResponseV2Wire> = {}): BadgeResponseV2Wire {\n\treturn {\n\t\tid: 12_345,\n\t\tname: \"First Goal\",\n\t\tawarder: { id: 222, name: \"Lobby\", type: 1 },\n\t\tcreated: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"Awarded on first login.\",\n\t\tdisplayDescription: \"Awarded on first login.\",\n\t\tdisplayIconImageId: 67_890,\n\t\tdisplayName: \"First Goal\",\n\t\tenabled: true,\n\t\ticonImageId: 67_890,\n\t\tstatistics: { awardedCount: 100, pastDayAwardedCount: 5, winRatePercentage: 42.5 },\n\t\tupdated: \"2024-03-20T14:45:00.000Z\",\n\t\t...overrides,\n\t};\n}\n","import type { DeveloperProductConfigV2 } from \"#src/domains/developer-products/products/wire\";\n\n/**\n * Builds a minimally-valid {@link DeveloperProductConfigV2} wire body. Pass\n * an `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant; useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validDeveloperProductBody(\n\toverrides: Partial<DeveloperProductConfigV2> = {},\n): DeveloperProductConfigV2 {\n\treturn {\n\t\tname: \"Gem Pack\",\n\t\tcreatedTimestamp: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"A premium gem pack\",\n\t\ticonImageAssetId: 67_890,\n\t\tisForSale: true,\n\t\tisImmutable: false,\n\t\tpriceInformation: { defaultPriceInRobux: 100, enabledFeatures: [] },\n\t\tproductId: 12_345,\n\t\tstorePageEnabled: true,\n\t\tuniverseId: 999,\n\t\tupdatedTimestamp: \"2024-03-20T14:45:00.000Z\",\n\t\t...overrides,\n\t};\n}\n","import { ApiError } from \"#src/errors/api-error\";\nimport type { OpenCloudError } from \"#src/errors/base\";\nimport { NetworkError } from \"#src/errors/network-error\";\nimport { RateLimitError } from \"#src/errors/rate-limit\";\nimport type {\n\tHttpClient,\n\tHttpRequest,\n\tHttpResponse,\n\tRequestConfig,\n} from \"#src/internal/http/types\";\nimport type { Result } from \"#src/types\";\n\n/**\n * A request captured by {@link FakeHttpClient} for later assertion.\n */\nexport interface CapturedRequest {\n\t/** The per-request config passed alongside the request. */\n\treadonly config: RequestConfig;\n\t/** The request passed to {@link HttpClient.request}. */\n\treadonly request: HttpRequest;\n}\n\n/**\n * A fluent fake for the {@link HttpClient} boundary. Mocks are queued in\n * FIFO order and consumed by each `request()` call. Records every\n * request and config for later assertion. Throws\n * {@link FakeHttpClientError} if the queue is empty when `request()` is\n * called — surfaces missing mocks as test setup bugs instead of silently\n * repeating the last response.\n */\nexport interface FakeHttpClient extends HttpClient {\n\t/** Queues an {@link ApiError} with the given status code and optional message/code. */\n\tmockApiError(options: { code?: string; message?: string; statusCode: number }): this;\n\t/** Queues an error Result with the given error instance. */\n\tmockError(error: OpenCloudError): this;\n\t/** Queues a {@link NetworkError}. Preserves `cause` when provided. */\n\tmockNetworkError(options?: { cause?: unknown; message?: string }): this;\n\t/** Queues a {@link RateLimitError} with the given retry hint. */\n\tmockRateLimit(options: { message?: string; retryAfterSeconds: number }): this;\n\t/** Queues a successful {@link HttpResponse}. Body defaults to `{}`; headers default to `{}`. */\n\tmockResponse(options: {\n\t\tbody?: unknown;\n\t\theaders?: Readonly<Record<string, string>>;\n\t\tstatus: number;\n\t}): this;\n\t/** Number of queued mocks that have not yet been consumed. */\n\treadonly pendingMocks: number;\n\t/** Chronological log of every `(request, config)` pair the fake received. */\n\treadonly requests: ReadonlyArray<CapturedRequest>;\n}\n\ntype ErrorResult = Result<HttpResponse, OpenCloudError> & { success: false };\n\ninterface FakeState {\n\treadonly captured: Array<CapturedRequest>;\n\tconsumed: number;\n\treadonly queue: Array<Result<HttpResponse, OpenCloudError>>;\n}\n\n/**\n * Thrown when {@link FakeHttpClient.request} is called but no mock has\n * been queued. The message names the method, url, and consumed count to\n * aid debugging of missing `.mockResponse`/`.mockError` setup.\n */\nexport class FakeHttpClientError extends Error {\n\tpublic override readonly name: string = \"FakeHttpClientError\";\n}\n\n/**\n * Creates a fluent {@link FakeHttpClient} that sits at the\n * {@link HttpClient} seam. Use for integration tests where you need to\n * assert per-request config (apiKey, baseUrl) flows through to HTTP.\n *\n * @returns A fresh fake with an empty mock queue.\n */\nexport function createFakeHttpClient(): FakeHttpClient {\n\tconst state: FakeState = { captured: [], consumed: 0, queue: [] };\n\tfunction enqueue(result: Result<HttpResponse, OpenCloudError>): FakeHttpClient {\n\t\tstate.queue.push(result);\n\t\treturn fake;\n\t}\n\n\tconst fake: FakeHttpClient = {\n\t\tmockApiError: (options) => enqueue(errorResult(buildApiError(options))),\n\t\tmockError: (error) => enqueue(errorResult(error)),\n\t\tmockNetworkError: (options) => enqueue(errorResult(buildNetworkError(options))),\n\t\tmockRateLimit: (options) => enqueue(errorResult(buildRateLimitError(options))),\n\t\tmockResponse: (options) => enqueue(successResult(options)),\n\t\tget pendingMocks() {\n\t\t\treturn state.queue.length;\n\t\t},\n\t\trequest: async (request, config) => handleRequest({ config, request, state }),\n\t\tget requests() {\n\t\t\treturn state.captured;\n\t\t},\n\t};\n\n\treturn fake;\n}\n\nfunction consumeNextMock(\n\tstate: FakeState,\n\trequest: HttpRequest,\n): Result<HttpResponse, OpenCloudError> {\n\tconst next = state.queue.shift();\n\tif (next === undefined) {\n\t\tthrow new FakeHttpClientError(\n\t\t\t`FakeHttpClient: no mock queued for ${request.method} ${request.url} (consumed ${String(state.consumed)}, pending 0)`,\n\t\t);\n\t}\n\n\tstate.consumed += 1;\n\treturn next;\n}\n\nasync function handleRequest(options: {\n\treadonly config: RequestConfig;\n\treadonly request: HttpRequest;\n\treadonly state: FakeState;\n}): Promise<Result<HttpResponse, OpenCloudError>> {\n\tconst { config, request, state } = options;\n\tstate.captured.push({ config, request });\n\treturn consumeNextMock(state, request);\n}\n\nfunction successResult(options: {\n\tbody?: unknown;\n\theaders?: Readonly<Record<string, string>>;\n\tstatus: number;\n}): Result<HttpResponse, OpenCloudError> {\n\treturn {\n\t\tdata: {\n\t\t\tbody: options.body ?? {},\n\t\t\theaders: options.headers ?? {},\n\t\t\tstatus: options.status,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction errorResult(err: OpenCloudError): ErrorResult {\n\treturn { err, success: false };\n}\n\nfunction buildApiError(options: { code?: string; message?: string; statusCode: number }): ApiError {\n\tconst message = options.message ?? \"API error\";\n\tif (options.code === undefined) {\n\t\treturn new ApiError(message, { statusCode: options.statusCode });\n\t}\n\n\treturn new ApiError(message, { code: options.code, statusCode: options.statusCode });\n}\n\nfunction buildNetworkError(\n\toptions: undefined | { cause?: unknown; message?: string },\n): NetworkError {\n\tconst message = options?.message ?? \"Network error\";\n\tif (options?.cause === undefined) {\n\t\treturn new NetworkError(message);\n\t}\n\n\treturn new NetworkError(message, { cause: options.cause });\n}\n\nfunction buildRateLimitError(options: {\n\tmessage?: string;\n\tretryAfterSeconds: number;\n}): RateLimitError {\n\treturn new RateLimitError(options.message ?? \"Rate limited\", {\n\t\tretryAfterSeconds: options.retryAfterSeconds,\n\t});\n}\n","import type { OpenCloudError } from \"#src/errors/base\";\nimport type { HttpRequest, HttpResponse } from \"#src/internal/http/types\";\nimport type { Result } from \"#src/types\";\n\n/**\n * The `send` callback shape consumed by `executeWithRetry`. A plain\n * transport function — no `RequestConfig`, no queueing, no retries.\n */\nexport type SendFunc = (request: HttpRequest) => Promise<Result<HttpResponse, OpenCloudError>>;\n\n/**\n * A scripted fake for the `send` callback. Replays responses in order\n * and records every request it receives.\n */\nexport interface FakeSend {\n\t/** Chronological log of every request the fake received. */\n\treadonly requests: ReadonlyArray<HttpRequest>;\n\t/** The scripted send callback. */\n\treadonly send: SendFunc;\n}\n\n/**\n * Creates a scripted fake for the `send` callback. Each call returns the\n * next queued response; exhausting the queue throws, which surfaces test\n * setup mistakes instead of silently repeating the last response.\n *\n * @param options - The scripted responses to replay, in order.\n * @returns A `send` callback plus a `requests` log.\n * @rejects {Error} When a call is made after all scripted responses are consumed.\n */\nexport function createFakeSend(options: {\n\treadonly responses: ReadonlyArray<Result<HttpResponse, OpenCloudError>>;\n}): FakeSend {\n\tconst requests: Array<HttpRequest> = [];\n\tlet index = 0;\n\n\tasync function send(request: HttpRequest): Promise<Result<HttpResponse, OpenCloudError>> {\n\t\trequests.push(request);\n\t\tconst response = options.responses[index];\n\t\tindex += 1;\n\n\t\tif (response === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`createFakeSend exhausted: ${String(index)} calls made, only ${String(options.responses.length)} responses scripted`,\n\t\t\t);\n\t\t}\n\n\t\treturn response;\n\t}\n\n\treturn { requests, send };\n}\n","import type { SleepFunc } from \"#src/internal/utils/sleep\";\n\n/**\n * A directly-callable sleep double that records its wait arguments without\n * delaying. Assignable to {@link SleepFunc}.\n */\nexport interface FakeSleep extends SleepFunc {\n\t/** Chronological log of every `ms` value the fake was called with. */\n\treadonly waits: ReadonlyArray<number>;\n}\n\n/**\n * Creates a {@link FakeSleep} that resolves immediately and records every\n * `ms` value it was called with.\n *\n * @returns A callable sleep function with a `waits` log attached.\n */\nexport function createFakeSleep(): FakeSleep {\n\tconst waits: Array<number> = [];\n\n\tasync function sleep(ms: number): Promise<void> {\n\t\twaits.push(ms);\n\t}\n\n\tconst fake: FakeSleep = Object.assign(sleep, {\n\t\tget waits(): ReadonlyArray<number> {\n\t\t\treturn waits;\n\t\t},\n\t});\n\n\treturn fake;\n}\n","import type {\n\tGameIconListWire,\n\tGetGameIconResponseWire,\n} from \"#src/domains/game-internationalization/game-icon/wire\";\n\n/**\n * Builds a minimally-valid {@link GetGameIconResponseWire} entry. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant.\n *\n * @param overrides - Fields to override on the default entry.\n * @returns A valid localized-icon entry with the overrides applied.\n */\nexport function validLocalizedIcon(\n\toverrides: Partial<GetGameIconResponseWire> = {},\n): GetGameIconResponseWire {\n\treturn {\n\t\timageId: \"12345\",\n\t\timageUrl: \"https://t1.rbxcdn.com/icon/12345\",\n\t\tlanguageCode: \"en_us\",\n\t\tstate: \"Approved\",\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid {@link GameIconListWire} body containing a single\n * default localized icon.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validIconListBody(overrides: Partial<GameIconListWire> = {}): GameIconListWire {\n\treturn {\n\t\tdata: [validLocalizedIcon()],\n\t\t...overrides,\n\t};\n}\n","import type { GamePassConfigV2 } from \"#src/domains/game-passes/game-passes/wire\";\n\n/**\n * Test-only wire shape for the list response. Mirrors the OpenAPI\n * schema, which marks `nextPageToken` as required and nullable, so\n * fixtures can carry the literal JSON `null` the API sends on the last\n * page without leaking `null` into the production wire type (which\n * exposes a post-normalization view of `string | undefined`).\n */\ninterface ListGamePassesWireBody {\n\treadonly gamePasses: ReadonlyArray<GamePassConfigV2>;\n\n\treadonly nextPageToken: null | string;\n}\n\n/**\n * Builds a minimally-valid {@link GamePassConfigV2} wire body. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant — useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validGamePassBody(overrides: Partial<GamePassConfigV2> = {}): GamePassConfigV2 {\n\treturn {\n\t\tname: \"Epic Pass\",\n\t\tcreatedTimestamp: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"Unlocks epic stuff\",\n\t\tgamePassId: 12_345,\n\t\ticonAssetId: 67_890,\n\t\tisForSale: true,\n\t\tpriceInformation: { defaultPriceInRobux: 100, enabledFeatures: [] },\n\t\tupdatedTimestamp: \"2024-03-20T14:45:00.000Z\",\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid wire body for the \"list game passes\" endpoint.\n * By default the page contains one game pass and `nextPageToken` is the\n * literal JSON `null` the API sends on the last page; `overrides` let\n * parser and integration tests tweak the items array or the cursor\n * without rebuilding the whole shape.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied. `nextPageToken`\n * defaults to the wire's literal `null`, which the response parser\n * normalizes to `undefined` at the boundary.\n */\nexport function validListGamePassesBody(\n\toverrides: Partial<ListGamePassesWireBody> = {},\n): ListGamePassesWireBody {\n\treturn {\n\t\tgamePasses: [validGamePassBody()],\n\t\t// eslint-disable-next-line unicorn/no-null -- API sends null on the last page; parser normalizes to undefined.\n\t\tnextPageToken: null,\n\t\t...overrides,\n\t};\n}\n","import type { GameThumbnailUploadWire } from \"#src/domains/game-internationalization/game-thumbnails/wire\";\n\n/**\n * Builds a minimally-valid {@link GameThumbnailUploadWire} body. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant; useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validThumbnailUploadBody(\n\toverrides: Partial<GameThumbnailUploadWire> = {},\n): GameThumbnailUploadWire {\n\treturn { mediaAssetId: \"67890\", ...overrides };\n}\n","import type { LuauExecutionTaskBinaryInputWire } from \"#src/domains/cloud-v2/luau-execution-task-binary-inputs/wire\";\n\n/**\n * Builds a minimally-valid {@link LuauExecutionTaskBinaryInputWire} body\n * for tests. Pass an `overrides` object to tweak fields without re-stating\n * the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validBinaryInputBody(\n\toverrides: Partial<LuauExecutionTaskBinaryInputWire> = {},\n): LuauExecutionTaskBinaryInputWire {\n\treturn {\n\t\tpath: \"universes/123/luau-execution-session-task-binary-inputs/abc\",\n\t\tuploadUri: \"https://storage.example.com/upload?token=xyz\",\n\t\t...overrides,\n\t};\n}\n","import type { ListLogsResponseWire } from \"#src/domains/cloud-v2/luau-execution-task-logs/wire\";\n\n/**\n * Builds a minimally-valid {@link ListLogsResponseWire} body containing\n * one chunk with one structured message. Pass an `overrides` object to\n * tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validLogPageBody(\n\toverrides: Partial<ListLogsResponseWire> = {},\n): ListLogsResponseWire {\n\treturn {\n\t\tluauExecutionSessionTaskLogs: [\n\t\t\t{\n\t\t\t\tstructuredMessages: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcreateTime: \"2026-01-01T00:00:00Z\",\n\t\t\t\t\t\tmessage: \"Hello from Luau\",\n\t\t\t\t\t\tmessageType: \"OUTPUT\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\t...overrides,\n\t};\n}\n","import type { LuauExecutionTaskWire } from \"#src/domains/cloud-v2/luau-execution-tasks/wire\";\n\n/**\n * Builds a minimally-valid {@link LuauExecutionTaskWire} body for an\n * in-progress task. Pass an `overrides` object to tweak fields without\n * re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validInProgressTaskBody(\n\toverrides: Partial<LuauExecutionTaskWire> = {},\n): LuauExecutionTaskWire {\n\treturn {\n\t\tcreateTime: \"2026-01-01T00:00:00Z\",\n\t\tpath: \"universes/123/places/456/luau-execution-session-tasks/task-1\",\n\t\tstate: \"QUEUED\",\n\t\tupdateTime: \"2026-01-01T00:00:30Z\",\n\t\tuser: \"user-1\",\n\t\t...overrides,\n\t};\n}\n","import type {\n\tMemoryStoreQueueItemWire,\n\tReadQueueItemsResponseWire,\n} from \"#src/domains/cloud-v2/memory-store-queues/wire\";\n\n/**\n * Builds a minimally-valid {@link MemoryStoreQueueItemWire} body. Pass\n * an `overrides` object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validQueueItemBody(\n\toverrides: Partial<MemoryStoreQueueItemWire> = {},\n): MemoryStoreQueueItemWire {\n\treturn {\n\t\tdata: \"hello\",\n\t\texpireTime: \"2026-06-21T15:08:58.4806559Z\",\n\t\tpath: \"cloud/v2/universes/123/memory-store/queues/test-queue/items/abc123\",\n\t\tpriority: 1,\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid {@link ReadQueueItemsResponseWire} body\n * carrying a single default queue item. Pass an `overrides` object to\n * change the read identifier or supply a different items array.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid dequeue response body with the overrides applied.\n */\nexport function validDequeueBody(\n\toverrides: Partial<ReadQueueItemsResponseWire> = {},\n): ReadQueueItemsResponseWire {\n\treturn {\n\t\tid: \"1a354bd5b8fe457f8e51232f8dbfe6d0\",\n\t\tqueueItems: [validQueueItemBody()],\n\t\t...overrides,\n\t};\n}\n","import type { PlaceWire } from \"#src/domains/cloud-v2/places/wire\";\nimport { RBXL_SIGNATURE, RBXLX_SIGNATURE } from \"#src/domains/universes/places/signatures\";\nimport type { PlaceVersionWire } from \"#src/domains/universes/places/wire\";\n\n/**\n * Returns a fresh, minimal `.rbxl`-formatted body whose magic bytes\n * match {@link RBXL_SIGNATURE}. Useful when integration tests don't\n * care about the file's contents past the signature.\n *\n * @returns A 14-byte rbxl body matching the binary signature.\n */\nexport function rbxlBody(): Uint8Array<ArrayBuffer> {\n\treturn new Uint8Array(RBXL_SIGNATURE);\n}\n\n/**\n * Returns a fresh, minimal `.rbxlx`-formatted body whose magic bytes\n * match {@link RBXLX_SIGNATURE}. Useful when integration tests don't\n * care about the file's contents past the signature.\n *\n * @returns An 8-byte rbxlx body matching the XML signature.\n */\nexport function rbxlxBody(): Uint8Array<ArrayBuffer> {\n\treturn new Uint8Array(RBXLX_SIGNATURE);\n}\n\n/**\n * Builds a minimally-valid {@link PlaceVersionWire} body. Pass an\n * `overrides` object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validPublishResponseBody(\n\toverrides: Partial<PlaceVersionWire> = {},\n): PlaceVersionWire {\n\treturn {\n\t\tversionNumber: 1,\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid {@link PlaceWire} body. Pass an `overrides`\n * object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validPlaceBody(overrides: Partial<PlaceWire> = {}): PlaceWire {\n\treturn {\n\t\tcreateTime: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"A sample place.\",\n\t\tdisplayName: \"Test Place\",\n\t\tpath: \"universes/123/places/456\",\n\t\troot: true,\n\t\tserverSize: 30,\n\t\tuniverseRuntimeCreation: false,\n\t\tupdateTime: \"2024-11-02T17:08:21.500Z\",\n\t\t...overrides,\n\t};\n}\n","import type { UniverseWire } from \"#src/domains/cloud-v2/universes/wire\";\n\n/**\n * Builds a minimally-valid {@link UniverseWire} body. Pass an\n * `overrides` object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validUniverseBody(overrides: Partial<UniverseWire> = {}): UniverseWire {\n\treturn {\n\t\tageRating: \"AGE_RATING_13_PLUS\",\n\t\tconsoleEnabled: false,\n\t\tcreateTime: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"A sample universe for tests.\",\n\t\tdesktopEnabled: true,\n\t\tdisplayName: \"Test Universe\",\n\t\tmobileEnabled: true,\n\t\tpath: \"universes/12345\",\n\t\trootPlace: \"universes/12345/places/98765\",\n\t\ttabletEnabled: true,\n\t\tupdateTime: \"2024-11-02T17:08:21.500Z\",\n\t\tuser: \"users/7777\",\n\t\tvisibility: \"PUBLIC\",\n\t\tvoiceChatEnabled: false,\n\t\tvrEnabled: false,\n\t\t...overrides,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,eAAe,YAA0C,EAAE,EAAuB;AACjG,QAAO;EACN,IAAI;EACJ,MAAM;EACN,SAAS;GAAE,IAAI;GAAK,MAAM;GAAS,MAAM;GAAG;EAC5C,SAAS;EACT,aAAa;EACb,oBAAoB;EACpB,oBAAoB;EACpB,aAAa;EACb,SAAS;EACT,aAAa;EACb,YAAY;GAAE,cAAc;GAAK,qBAAqB;GAAG,mBAAmB;GAAM;EAClF,SAAS;EACT,GAAG;EACH;;;;;;;;;;;;;ACfF,SAAgB,0BACf,YAA+C,EAAE,EACtB;AAC3B,QAAO;EACN,MAAM;EACN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AC,oBAAoB,CAAC;EAClC,GAAG;EACH;;;;;;;;;;;AC5BF,SAAgB,WAAoC;AACnD,QAAO,IAAI,WAAW,eAAe;;;;;;;;;AAUtC,SAAgB,YAAqC;AACpD,QAAO,IAAI,WAAW,gBAAgB;;;;;;;;;AAUvC,SAAgB,yBACf,YAAuC,EAAE,EACtB;AACnB,QAAO;EACN,eAAe;EACf,GAAG;EACH;;;;;;;;;AAUF,SAAgB,eAAe,YAAgC,EAAE,EAAa;AAC7E,QAAO;EACN,YAAY;EACZ,aAAa;EACb,aAAa;EACb,MAAM;EACN,MAAM;EACN,YAAY;EACZ,yBAAyB;EACzB,YAAY;EACZ,GAAG;EACH;;;;;;;;;;;ACnDF,SAAgB,kBAAkB,YAAmC,EAAE,EAAgB;AACtF,QAAO;EACN,WAAW;EACX,gBAAgB;EAChB,YAAY;EACZ,aAAa;EACb,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,MAAM;EACN,WAAW;EACX,eAAe;EACf,YAAY;EACZ,MAAM;EACN,YAAY;EACZ,kBAAkB;EAClB,WAAW;EACX,GAAG;EACH"}
|
|
1
|
+
{"version":3,"file":"testing.mjs","names":[],"sources":["../tests/helpers/badges.ts","../tests/helpers/developer-products.ts","../tests/helpers/fake-http-client.ts","../tests/helpers/fake-send.ts","../tests/helpers/fake-sleep.ts","../tests/helpers/game-icon.ts","../tests/helpers/game-passes.ts","../tests/helpers/game-thumbnails.ts","../tests/helpers/luau-execution-task-binary-inputs.ts","../tests/helpers/luau-execution-task-logs.ts","../tests/helpers/luau-execution-tasks.ts","../tests/helpers/memory-store-queues.ts","../tests/helpers/places.ts","../tests/helpers/universes.ts"],"sourcesContent":["import type { BadgeResponseV2Wire } from \"#src/domains/badges/badges/wire\";\n\n/**\n * Builds a minimally-valid {@link BadgeResponseV2Wire} body. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant; useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validBadgeBody(overrides: Partial<BadgeResponseV2Wire> = {}): BadgeResponseV2Wire {\n\treturn {\n\t\tid: 12_345,\n\t\tname: \"First Goal\",\n\t\tawarder: { id: 222, name: \"Lobby\", type: 1 },\n\t\tcreated: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"Awarded on first login.\",\n\t\tdisplayDescription: \"Awarded on first login.\",\n\t\tdisplayIconImageId: 67_890,\n\t\tdisplayName: \"First Goal\",\n\t\tenabled: true,\n\t\ticonImageId: 67_890,\n\t\tstatistics: { awardedCount: 100, pastDayAwardedCount: 5, winRatePercentage: 42.5 },\n\t\tupdated: \"2024-03-20T14:45:00.000Z\",\n\t\t...overrides,\n\t};\n}\n","import type { DeveloperProductConfigV2 } from \"#src/domains/developer-products/products/wire\";\n\n/**\n * Builds a minimally-valid {@link DeveloperProductConfigV2} wire body. Pass\n * an `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant; useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validDeveloperProductBody(\n\toverrides: Partial<DeveloperProductConfigV2> = {},\n): DeveloperProductConfigV2 {\n\treturn {\n\t\tname: \"Gem Pack\",\n\t\tcreatedTimestamp: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"A premium gem pack\",\n\t\ticonImageAssetId: 67_890,\n\t\tisForSale: true,\n\t\tisImmutable: false,\n\t\tpriceInformation: { defaultPriceInRobux: 100, enabledFeatures: [] },\n\t\tproductId: 12_345,\n\t\tstorePageEnabled: true,\n\t\tuniverseId: 999,\n\t\tupdatedTimestamp: \"2024-03-20T14:45:00.000Z\",\n\t\t...overrides,\n\t};\n}\n","import { ApiError } from \"#src/errors/api-error\";\nimport type { OpenCloudError } from \"#src/errors/base\";\nimport { NetworkError } from \"#src/errors/network-error\";\nimport { RateLimitError } from \"#src/errors/rate-limit\";\nimport type {\n\tHttpClient,\n\tHttpRequest,\n\tHttpResponse,\n\tRequestConfig,\n} from \"#src/internal/http/types\";\nimport type { Result } from \"#src/types\";\n\n/**\n * A request captured by {@link FakeHttpClient} for later assertion.\n */\nexport interface CapturedRequest {\n\t/** The per-request config passed alongside the request. */\n\treadonly config: RequestConfig;\n\t/** The request passed to {@link HttpClient.request}. */\n\treadonly request: HttpRequest;\n}\n\n/**\n * A fluent fake for the {@link HttpClient} boundary. Mocks are queued in\n * FIFO order and consumed by each `request()` call. Records every\n * request and config for later assertion. Throws\n * {@link FakeHttpClientError} if the queue is empty when `request()` is\n * called — surfaces missing mocks as test setup bugs instead of silently\n * repeating the last response.\n */\nexport interface FakeHttpClient extends HttpClient {\n\t/** Queues an {@link ApiError} with the given status code and optional message/code. */\n\tmockApiError(options: { code?: string; message?: string; statusCode: number }): this;\n\t/** Queues an error Result with the given error instance. */\n\tmockError(error: OpenCloudError): this;\n\t/** Queues a {@link NetworkError}. Preserves `cause` when provided. */\n\tmockNetworkError(options?: { cause?: unknown; message?: string }): this;\n\t/** Queues a {@link RateLimitError} with the given retry hint. */\n\tmockRateLimit(options: { message?: string; retryAfterSeconds: number }): this;\n\t/** Queues a successful {@link HttpResponse}. Body defaults to `{}`; headers default to `{}`. */\n\tmockResponse(options: {\n\t\tbody?: unknown;\n\t\theaders?: Readonly<Record<string, string>>;\n\t\tstatus: number;\n\t}): this;\n\t/** Number of queued mocks that have not yet been consumed. */\n\treadonly pendingMocks: number;\n\t/** Chronological log of every `(request, config)` pair the fake received. */\n\treadonly requests: ReadonlyArray<CapturedRequest>;\n}\n\ntype ErrorResult = Result<HttpResponse, OpenCloudError> & { success: false };\n\ninterface FakeState {\n\treadonly captured: Array<CapturedRequest>;\n\tconsumed: number;\n\treadonly queue: Array<Result<HttpResponse, OpenCloudError>>;\n}\n\n/**\n * Thrown when {@link FakeHttpClient.request} is called but no mock has\n * been queued. The message names the method, url, and consumed count to\n * aid debugging of missing `.mockResponse`/`.mockError` setup.\n */\nexport class FakeHttpClientError extends Error {\n\tpublic override readonly name: string = \"FakeHttpClientError\";\n}\n\n/**\n * Creates a fluent {@link FakeHttpClient} that sits at the\n * {@link HttpClient} seam. Use for integration tests where you need to\n * assert per-request config (apiKey, baseUrl) flows through to HTTP.\n *\n * @returns A fresh fake with an empty mock queue.\n */\nexport function createFakeHttpClient(): FakeHttpClient {\n\tconst state: FakeState = { captured: [], consumed: 0, queue: [] };\n\tfunction enqueue(result: Result<HttpResponse, OpenCloudError>): FakeHttpClient {\n\t\tstate.queue.push(result);\n\t\treturn fake;\n\t}\n\n\tconst fake: FakeHttpClient = {\n\t\tmockApiError: (options) => enqueue(errorResult(buildApiError(options))),\n\t\tmockError: (error) => enqueue(errorResult(error)),\n\t\tmockNetworkError: (options) => enqueue(errorResult(buildNetworkError(options))),\n\t\tmockRateLimit: (options) => enqueue(errorResult(buildRateLimitError(options))),\n\t\tmockResponse: (options) => enqueue(successResult(options)),\n\t\tget pendingMocks() {\n\t\t\treturn state.queue.length;\n\t\t},\n\t\trequest: async (request, config) => handleRequest({ config, request, state }),\n\t\tget requests() {\n\t\t\treturn state.captured;\n\t\t},\n\t};\n\n\treturn fake;\n}\n\nfunction consumeNextMock(\n\tstate: FakeState,\n\trequest: HttpRequest,\n): Result<HttpResponse, OpenCloudError> {\n\tconst next = state.queue.shift();\n\tif (next === undefined) {\n\t\tthrow new FakeHttpClientError(\n\t\t\t`FakeHttpClient: no mock queued for ${request.method} ${request.url} (consumed ${String(state.consumed)}, pending 0)`,\n\t\t);\n\t}\n\n\tstate.consumed += 1;\n\treturn next;\n}\n\nasync function handleRequest(options: {\n\treadonly config: RequestConfig;\n\treadonly request: HttpRequest;\n\treadonly state: FakeState;\n}): Promise<Result<HttpResponse, OpenCloudError>> {\n\tconst { config, request, state } = options;\n\tstate.captured.push({ config, request });\n\treturn consumeNextMock(state, request);\n}\n\nfunction successResult(options: {\n\tbody?: unknown;\n\theaders?: Readonly<Record<string, string>>;\n\tstatus: number;\n}): Result<HttpResponse, OpenCloudError> {\n\treturn {\n\t\tdata: {\n\t\t\tbody: options.body ?? {},\n\t\t\theaders: options.headers ?? {},\n\t\t\tstatus: options.status,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction errorResult(err: OpenCloudError): ErrorResult {\n\treturn { err, success: false };\n}\n\nfunction buildApiError(options: { code?: string; message?: string; statusCode: number }): ApiError {\n\tconst message = options.message ?? \"API error\";\n\tif (options.code === undefined) {\n\t\treturn new ApiError(message, { statusCode: options.statusCode });\n\t}\n\n\treturn new ApiError(message, { code: options.code, statusCode: options.statusCode });\n}\n\nfunction buildNetworkError(\n\toptions: undefined | { cause?: unknown; message?: string },\n): NetworkError {\n\tconst message = options?.message ?? \"Network error\";\n\tif (options?.cause === undefined) {\n\t\treturn new NetworkError(message);\n\t}\n\n\treturn new NetworkError(message, { cause: options.cause });\n}\n\nfunction buildRateLimitError(options: {\n\tmessage?: string;\n\tretryAfterSeconds: number;\n}): RateLimitError {\n\treturn new RateLimitError(options.message ?? \"Rate limited\", {\n\t\tretryAfterSeconds: options.retryAfterSeconds,\n\t});\n}\n","import type { OpenCloudError } from \"#src/errors/base\";\nimport type { HttpRequest, HttpResponse } from \"#src/internal/http/types\";\nimport type { Result } from \"#src/types\";\n\n/**\n * The `send` callback shape consumed by `executeWithRetry`. A plain\n * transport function — no `RequestConfig`, no queueing, no retries.\n */\nexport type SendFunc = (request: HttpRequest) => Promise<Result<HttpResponse, OpenCloudError>>;\n\n/**\n * A scripted fake for the `send` callback. Replays responses in order\n * and records every request it receives.\n */\nexport interface FakeSend {\n\t/** Chronological log of every request the fake received. */\n\treadonly requests: ReadonlyArray<HttpRequest>;\n\t/** The scripted send callback. */\n\treadonly send: SendFunc;\n}\n\n/**\n * Creates a scripted fake for the `send` callback. Each call returns the\n * next queued response; exhausting the queue throws, which surfaces test\n * setup mistakes instead of silently repeating the last response.\n *\n * @param options - The scripted responses to replay, in order.\n * @returns A `send` callback plus a `requests` log.\n * @rejects {Error} When a call is made after all scripted responses are consumed.\n */\nexport function createFakeSend(options: {\n\treadonly responses: ReadonlyArray<Result<HttpResponse, OpenCloudError>>;\n}): FakeSend {\n\tconst requests: Array<HttpRequest> = [];\n\tlet index = 0;\n\n\tasync function send(request: HttpRequest): Promise<Result<HttpResponse, OpenCloudError>> {\n\t\trequests.push(request);\n\t\tconst response = options.responses[index];\n\t\tindex += 1;\n\n\t\tif (response === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`createFakeSend exhausted: ${String(index)} calls made, only ${String(options.responses.length)} responses scripted`,\n\t\t\t);\n\t\t}\n\n\t\treturn response;\n\t}\n\n\treturn { requests, send };\n}\n","import type { SleepFunc } from \"#src/internal/utils/sleep\";\n\n/**\n * A directly-callable sleep double that records its wait arguments without\n * delaying. Assignable to {@link SleepFunc}.\n */\nexport interface FakeSleep extends SleepFunc {\n\t/** Chronological log of every `ms` value the fake was called with. */\n\treadonly waits: ReadonlyArray<number>;\n}\n\n/**\n * Creates a {@link FakeSleep} that resolves immediately and records every\n * `ms` value it was called with.\n *\n * @returns A callable sleep function with a `waits` log attached.\n */\nexport function createFakeSleep(): FakeSleep {\n\tconst waits: Array<number> = [];\n\n\tasync function sleep(ms: number): Promise<void> {\n\t\twaits.push(ms);\n\t}\n\n\tconst fake: FakeSleep = Object.assign(sleep, {\n\t\tget waits(): ReadonlyArray<number> {\n\t\t\treturn waits;\n\t\t},\n\t});\n\n\treturn fake;\n}\n","import type {\n\tGameIconListWire,\n\tGetGameIconResponseWire,\n} from \"#src/domains/game-internationalization/game-icon/wire\";\n\n/**\n * Builds a minimally-valid {@link GetGameIconResponseWire} entry. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant.\n *\n * @param overrides - Fields to override on the default entry.\n * @returns A valid localized-icon entry with the overrides applied.\n */\nexport function validLocalizedIcon(\n\toverrides: Partial<GetGameIconResponseWire> = {},\n): GetGameIconResponseWire {\n\treturn {\n\t\timageId: \"12345\",\n\t\timageUrl: \"https://t1.rbxcdn.com/icon/12345\",\n\t\tlanguageCode: \"en_us\",\n\t\tstate: \"Approved\",\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid {@link GameIconListWire} body containing a single\n * default localized icon.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validIconListBody(overrides: Partial<GameIconListWire> = {}): GameIconListWire {\n\treturn {\n\t\tdata: [validLocalizedIcon()],\n\t\t...overrides,\n\t};\n}\n","import type { GamePassConfigV2 } from \"#src/domains/game-passes/game-passes/wire\";\n\n/**\n * Test-only wire shape for the list response. Mirrors the OpenAPI\n * schema, which marks `nextPageToken` as required and nullable, so\n * fixtures can carry the literal JSON `null` the API sends on the last\n * page without leaking `null` into the production wire type (which\n * exposes a post-normalization view of `string | undefined`).\n */\ninterface ListGamePassesWireBody {\n\treadonly gamePasses: ReadonlyArray<GamePassConfigV2>;\n\n\treadonly nextPageToken: null | string;\n}\n\n/**\n * Builds a minimally-valid {@link GamePassConfigV2} wire body. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant — useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validGamePassBody(overrides: Partial<GamePassConfigV2> = {}): GamePassConfigV2 {\n\treturn {\n\t\tname: \"Epic Pass\",\n\t\tcreatedTimestamp: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"Unlocks epic stuff\",\n\t\tgamePassId: 12_345,\n\t\ticonAssetId: 67_890,\n\t\tisForSale: true,\n\t\tpriceInformation: { defaultPriceInRobux: 100, enabledFeatures: [] },\n\t\tupdatedTimestamp: \"2024-03-20T14:45:00.000Z\",\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid wire body for the \"list game passes\" endpoint.\n * By default the page contains one game pass and `nextPageToken` is the\n * literal JSON `null` the API sends on the last page; `overrides` let\n * parser and integration tests tweak the items array or the cursor\n * without rebuilding the whole shape.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied. `nextPageToken`\n * defaults to the wire's literal `null`, which the response parser\n * normalizes to `undefined` at the boundary.\n */\nexport function validListGamePassesBody(\n\toverrides: Partial<ListGamePassesWireBody> = {},\n): ListGamePassesWireBody {\n\treturn {\n\t\tgamePasses: [validGamePassBody()],\n\t\t// eslint-disable-next-line unicorn/no-null -- API sends null on the last page; parser normalizes to undefined.\n\t\tnextPageToken: null,\n\t\t...overrides,\n\t};\n}\n","import type { GameThumbnailUploadWire } from \"#src/domains/game-internationalization/game-thumbnails/wire\";\n\n/**\n * Builds a minimally-valid {@link GameThumbnailUploadWire} body. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant; useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validThumbnailUploadBody(\n\toverrides: Partial<GameThumbnailUploadWire> = {},\n): GameThumbnailUploadWire {\n\treturn { mediaAssetId: \"67890\", ...overrides };\n}\n","import type { LuauExecutionTaskBinaryInputWire } from \"#src/domains/cloud-v2/luau-execution-task-binary-inputs/wire\";\n\n/**\n * Builds a minimally-valid {@link LuauExecutionTaskBinaryInputWire} body\n * for tests. Pass an `overrides` object to tweak fields without re-stating\n * the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validBinaryInputBody(\n\toverrides: Partial<LuauExecutionTaskBinaryInputWire> = {},\n): LuauExecutionTaskBinaryInputWire {\n\treturn {\n\t\tpath: \"universes/123/luau-execution-session-task-binary-inputs/abc\",\n\t\tuploadUri: \"https://storage.example.com/upload?token=xyz\",\n\t\t...overrides,\n\t};\n}\n","import type { ListLogsResponseWire } from \"#src/domains/cloud-v2/luau-execution-task-logs/wire\";\n\n/**\n * Builds a minimally-valid {@link ListLogsResponseWire} body containing\n * one chunk with one structured message. Pass an `overrides` object to\n * tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validLogPageBody(\n\toverrides: Partial<ListLogsResponseWire> = {},\n): ListLogsResponseWire {\n\treturn {\n\t\tluauExecutionSessionTaskLogs: [\n\t\t\t{\n\t\t\t\tstructuredMessages: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcreateTime: \"2026-01-01T00:00:00Z\",\n\t\t\t\t\t\tmessage: \"Hello from Luau\",\n\t\t\t\t\t\tmessageType: \"OUTPUT\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\t...overrides,\n\t};\n}\n","import type { LuauExecutionTaskWire } from \"#src/domains/cloud-v2/luau-execution-tasks/wire\";\n\n/**\n * Builds a minimally-valid {@link LuauExecutionTaskWire} body for an\n * in-progress task. Pass an `overrides` object to tweak fields without\n * re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validInProgressTaskBody(\n\toverrides: Partial<LuauExecutionTaskWire> = {},\n): LuauExecutionTaskWire {\n\treturn {\n\t\tcreateTime: \"2026-01-01T00:00:00Z\",\n\t\tpath: \"universes/123/places/456/luau-execution-session-tasks/task-1\",\n\t\tstate: \"QUEUED\",\n\t\tupdateTime: \"2026-01-01T00:00:30Z\",\n\t\tuser: \"user-1\",\n\t\t...overrides,\n\t};\n}\n","import type {\n\tMemoryStoreQueueItemWire,\n\tReadQueueItemsResponseWire,\n} from \"#src/domains/cloud-v2/memory-store-queues/wire\";\n\n/**\n * Builds a minimally-valid {@link MemoryStoreQueueItemWire} body. Pass\n * an `overrides` object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validQueueItemBody(\n\toverrides: Partial<MemoryStoreQueueItemWire> = {},\n): MemoryStoreQueueItemWire {\n\treturn {\n\t\tdata: \"hello\",\n\t\texpireTime: \"2026-06-21T15:08:58.4806559Z\",\n\t\tpath: \"cloud/v2/universes/123/memory-store/queues/test-queue/items/abc123\",\n\t\tpriority: 1,\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid {@link ReadQueueItemsResponseWire} body\n * carrying a single default queue item. Pass an `overrides` object to\n * change the read identifier or supply a different items array.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid dequeue response body with the overrides applied.\n */\nexport function validDequeueBody(\n\toverrides: Partial<ReadQueueItemsResponseWire> = {},\n): ReadQueueItemsResponseWire {\n\treturn {\n\t\tid: \"1a354bd5b8fe457f8e51232f8dbfe6d0\",\n\t\tqueueItems: [validQueueItemBody()],\n\t\t...overrides,\n\t};\n}\n","import type { PlaceWire } from \"#src/domains/cloud-v2/places/wire\";\nimport { RBXL_SIGNATURE, RBXLX_SIGNATURE } from \"#src/domains/universes/places/signatures\";\nimport type { PlaceVersionWire } from \"#src/domains/universes/places/wire\";\n\n/**\n * Returns a fresh, minimal `.rbxl`-formatted body whose magic bytes\n * match {@link RBXL_SIGNATURE}. Useful when integration tests don't\n * care about the file's contents past the signature.\n *\n * @returns A 14-byte rbxl body matching the binary signature.\n */\nexport function rbxlBody(): Uint8Array<ArrayBuffer> {\n\treturn new Uint8Array(RBXL_SIGNATURE);\n}\n\n/**\n * Returns a fresh, minimal `.rbxlx`-formatted body whose magic bytes\n * match {@link RBXLX_SIGNATURE}. Useful when integration tests don't\n * care about the file's contents past the signature.\n *\n * @returns An 8-byte rbxlx body matching the XML signature.\n */\nexport function rbxlxBody(): Uint8Array<ArrayBuffer> {\n\treturn new Uint8Array(RBXLX_SIGNATURE);\n}\n\n/**\n * Builds a minimally-valid {@link PlaceVersionWire} body. Pass an\n * `overrides` object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validPublishResponseBody(\n\toverrides: Partial<PlaceVersionWire> = {},\n): PlaceVersionWire {\n\treturn {\n\t\tversionNumber: 1,\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid {@link PlaceWire} body. Pass an `overrides`\n * object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validPlaceBody(overrides: Partial<PlaceWire> = {}): PlaceWire {\n\treturn {\n\t\tcreateTime: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"A sample place.\",\n\t\tdisplayName: \"Test Place\",\n\t\tpath: \"universes/123/places/456\",\n\t\troot: true,\n\t\tserverSize: 30,\n\t\tuniverseRuntimeCreation: false,\n\t\tupdateTime: \"2024-11-02T17:08:21.500Z\",\n\t\t...overrides,\n\t};\n}\n","import type { UniverseWire } from \"#src/domains/cloud-v2/universes/wire\";\n\n/**\n * Builds a minimally-valid {@link UniverseWire} body. Pass an\n * `overrides` object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validUniverseBody(overrides: Partial<UniverseWire> = {}): UniverseWire {\n\treturn {\n\t\tageRating: \"AGE_RATING_13_PLUS\",\n\t\tconsoleEnabled: false,\n\t\tcreateTime: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"A sample universe for tests.\",\n\t\tdesktopEnabled: true,\n\t\tdisplayName: \"Test Universe\",\n\t\tmobileEnabled: true,\n\t\tpath: \"universes/12345\",\n\t\trootPlace: \"universes/12345/places/98765\",\n\t\ttabletEnabled: true,\n\t\tupdateTime: \"2024-11-02T17:08:21.500Z\",\n\t\tuser: \"users/7777\",\n\t\tvisibility: \"PUBLIC\",\n\t\tvoiceChatEnabled: false,\n\t\tvrEnabled: false,\n\t\t...overrides,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,eAAe,YAA0C,CAAC,GAAwB;CACjG,OAAO;EACN,IAAI;EACJ,MAAM;EACN,SAAS;GAAE,IAAI;GAAK,MAAM;GAAS,MAAM;EAAE;EAC3C,SAAS;EACT,aAAa;EACb,oBAAoB;EACpB,oBAAoB;EACpB,aAAa;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N,YAAY;EACZ,MAAM;EACN,OAAO;EACP,YAAY;EACZ,MAAM;EACN,GAAG;CACJ;AACD;;;;;;;;;;ACTA,SAAgB,mBACf,YAA+C,CAAC,GACrB;CAC3B,OAAO;EACN,MAAM;EACN,YAAY;EACZ,MAAM;EACN,UAAU;EACV,GAAG;CACJ;AACD;;;;;;;;;AAUA,SAAgB,iBACf,YAAiD,CAAC,GACrB;CAC7B,OAAO;EACN,IAAI;EACJ,YAAY,CAAC,mBAAmB,CAAC;EACjC,GAAG;CACJ;AACD;;;;;;;;;;AC7BA,SAAgB,WAAoC;CACnD,OAAO,IAAI,WAAW,cAAc;AACrC;;;;;;;;AASA,SAAgB,YAAqC;CACpD,OAAO,IAAI,WAAW,eAAe;AACtC;;;;;;;;AASA,SAAgB,yBACf,YAAuC,CAAC,GACrB;CACnB,OAAO;EACN,eAAe;EACf,GAAG;CACJ;AACD;;;;;;;;AASA,SAAgB,eAAe,YAAgC,CAAC,GAAc;CAC7E,OAAO;EACN,YAAY;EACZ,aAAa;EACb,aAAa;EACb,MAAM;EACN,MAAM;EACN,YAAY;EACZ,yBAAyB;EACzB,YAAY;EACZ,GAAG;CACJ;AACD;;;;;;;;;;ACpDA,SAAgB,kBAAkB,YAAmC,CAAC,GAAiB;CACtF,OAAO;EACN,WAAW;EACX,gBAAgB;EAChB,YAAY;EACZ,aAAa;EACb,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,MAAM;EACN,WAAW;EACX,eAAe;EACf,YAAY;EACZ,MAAM;EACN,YAAY;EACZ,kBAAkB;EAClB,WAAW;EACX,GAAG;CACJ;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-blob-
|
|
1
|
+
{"version":3,"file":"to-blob-RPqMBuft.mjs","names":[],"sources":["../src/internal/utils/to-blob.ts"],"sourcesContent":["/**\n * Wraps a binary value as a {@link Blob}, copying `Uint8Array` input into a\n * fresh `Blob` so the originating buffer cannot be mutated between request\n * build and send. `Blob` input is returned as-is so MIME-type metadata is\n * preserved.\n *\n * @param value - Binary data to convert.\n * @returns The supplied `Blob`, or a new `Blob` wrapping a defensive copy.\n */\nexport function toBlob(value: Blob | Uint8Array): Blob {\n\tif (value instanceof Blob) {\n\t\treturn value;\n\t}\n\n\treturn new Blob([new Uint8Array(value)]);\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,OAAO,OAAgC;CACtD,IAAI,iBAAiB,MACpB,OAAO;CAGR,OAAO,IAAI,KAAK,CAAC,IAAI,WAAW,KAAK,CAAC,CAAC;AACxC"}
|
|
@@ -4,13 +4,19 @@
|
|
|
4
4
|
*
|
|
5
5
|
* All specific error types (RateLimitError, ApiError, NetworkError)
|
|
6
6
|
* extend this class, enabling `instanceof OpenCloudError` checks.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.1.0
|
|
7
9
|
*/
|
|
8
10
|
declare class OpenCloudError extends Error {
|
|
9
11
|
override readonly name: string;
|
|
10
12
|
}
|
|
11
13
|
//#endregion
|
|
12
14
|
//#region src/internal/utils/sleep.d.ts
|
|
13
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Injectable sleep function signature for testing.
|
|
17
|
+
*
|
|
18
|
+
* @since 0.1.0
|
|
19
|
+
*/
|
|
14
20
|
type SleepFunc = (ms: number) => Promise<void>;
|
|
15
21
|
//#endregion
|
|
16
22
|
//#region src/types.d.ts
|
|
@@ -20,6 +26,8 @@ type SleepFunc = (ms: number) => Promise<void>;
|
|
|
20
26
|
* Every SDK client method returns `Promise<Result<T, OpenCloudError>>`.
|
|
21
27
|
* Errors are never thrown; they are returned as `{ err, success: false }`.
|
|
22
28
|
*
|
|
29
|
+
* @since 0.1.0
|
|
30
|
+
*
|
|
23
31
|
* @template T - The success value type.
|
|
24
32
|
* @template E - The error type (defaults to `Error`).
|
|
25
33
|
*
|
|
@@ -65,6 +73,8 @@ type Result<T, E = Error> = {
|
|
|
65
73
|
* `null`-vs-absent variants to `undefined` so callers only ever see one
|
|
66
74
|
* shape.
|
|
67
75
|
*
|
|
76
|
+
* @since 0.1.0
|
|
77
|
+
*
|
|
68
78
|
* @template T - The public item type for the listed resource.
|
|
69
79
|
*
|
|
70
80
|
* @example
|
|
@@ -91,6 +101,8 @@ interface Page<T> {
|
|
|
91
101
|
//#region src/client/types.d.ts
|
|
92
102
|
/**
|
|
93
103
|
* A normalized HTTP request to send to the Roblox Open Cloud API.
|
|
104
|
+
*
|
|
105
|
+
* @since 0.1.0
|
|
94
106
|
*/
|
|
95
107
|
interface HttpRequest {
|
|
96
108
|
/** The request body. */
|
|
@@ -108,6 +120,8 @@ interface HttpRequest {
|
|
|
108
120
|
}
|
|
109
121
|
/**
|
|
110
122
|
* A normalized HTTP response from the Roblox Open Cloud API.
|
|
123
|
+
*
|
|
124
|
+
* @since 0.1.0
|
|
111
125
|
*/
|
|
112
126
|
interface HttpResponse {
|
|
113
127
|
/**
|
|
@@ -123,6 +137,8 @@ interface HttpResponse {
|
|
|
123
137
|
}
|
|
124
138
|
/**
|
|
125
139
|
* Per-request configuration passed to {@link HttpClient.request}.
|
|
140
|
+
*
|
|
141
|
+
* @since 0.1.0
|
|
126
142
|
*/
|
|
127
143
|
interface RequestConfig {
|
|
128
144
|
/** The Roblox Open Cloud API key. */
|
|
@@ -135,6 +151,8 @@ interface RequestConfig {
|
|
|
135
151
|
/**
|
|
136
152
|
* HTTP transport abstraction. Implementations classify every response into
|
|
137
153
|
* a typed {@link Result}.
|
|
154
|
+
*
|
|
155
|
+
* @since 0.1.0
|
|
138
156
|
*/
|
|
139
157
|
interface HttpClient {
|
|
140
158
|
/** Sends an HTTP request and classifies the response. */
|
|
@@ -143,6 +161,8 @@ interface HttpClient {
|
|
|
143
161
|
/**
|
|
144
162
|
* Client-level observability hooks. All hooks are notification-only and
|
|
145
163
|
* fire-and-forget; they cannot alter retry behaviour.
|
|
164
|
+
*
|
|
165
|
+
* @since 0.1.0
|
|
146
166
|
*/
|
|
147
167
|
interface OpenCloudHooks {
|
|
148
168
|
/** Fired before the SDK sleeps for a computed retry or rate-limit wait. */
|
|
@@ -155,6 +175,8 @@ interface OpenCloudHooks {
|
|
|
155
175
|
/**
|
|
156
176
|
* Options accepted by every resource client constructor. Cross-cutting
|
|
157
177
|
* configuration that applies to all requests made through the client instance.
|
|
178
|
+
*
|
|
179
|
+
* @since 0.1.0
|
|
158
180
|
*/
|
|
159
181
|
interface OpenCloudClientOptions {
|
|
160
182
|
/** The Roblox Open Cloud API key used as the default for every request. */
|
|
@@ -179,6 +201,16 @@ interface OpenCloudClientOptions {
|
|
|
179
201
|
* method (e.g. `create` only retries `429`).
|
|
180
202
|
*/
|
|
181
203
|
readonly retryableStatuses?: ReadonlyArray<number>;
|
|
204
|
+
/**
|
|
205
|
+
* Node-style transport error codes eligible for retry when a request fails
|
|
206
|
+
* with a `NetworkError` (e.g. `["ECONNRESET", "ETIMEDOUT"]`).
|
|
207
|
+
* Defaults to the idempotent-method transient set. Create methods default
|
|
208
|
+
* to none and cannot be relaxed by a client-level value. Pass the exported
|
|
209
|
+
* `TRANSIENT_TRANSPORT_CODES` set (or your own subset) on a single call's
|
|
210
|
+
* {@link RequestOptions} to opt a create into transport retries when a
|
|
211
|
+
* duplicate resource is acceptable.
|
|
212
|
+
*/
|
|
213
|
+
readonly retryableTransportCodes?: ReadonlyArray<string>;
|
|
182
214
|
/** Fallback delay function used when no server hint is available. */
|
|
183
215
|
readonly retryDelay?: (attempt: number) => number;
|
|
184
216
|
/**
|
|
@@ -188,15 +220,25 @@ interface OpenCloudClientOptions {
|
|
|
188
220
|
* use the default `setTimeout`-backed sleep.
|
|
189
221
|
*/
|
|
190
222
|
readonly sleep?: SleepFunc;
|
|
191
|
-
/**
|
|
223
|
+
/**
|
|
224
|
+
* Default per-request timeout in milliseconds for JSON-bound methods,
|
|
225
|
+
* defaulting to `30_000`. Upload methods (those whose request body is
|
|
226
|
+
* `FormData` or `Uint8Array`, such as place publishes and icon uploads)
|
|
227
|
+
* have no default deadline and ignore this option: upload latency is
|
|
228
|
+
* bandwidth-bound, and the SDK cannot size a wall-clock budget without
|
|
229
|
+
* knowing payload size and link quality. Set a deadline on any single
|
|
230
|
+
* call, upload or otherwise, with `options.timeout`.
|
|
231
|
+
*/
|
|
192
232
|
readonly timeout?: number;
|
|
193
233
|
}
|
|
194
234
|
/**
|
|
195
235
|
* Per-request override shape. Any subset of the overridable client options
|
|
196
236
|
* may be supplied for a single request; omitted fields fall through to the
|
|
197
237
|
* client-level defaults.
|
|
238
|
+
*
|
|
239
|
+
* @since 0.1.0
|
|
198
240
|
*/
|
|
199
|
-
type RequestOptions = Partial<Pick<OpenCloudClientOptions, "apiKey" | "baseUrl" | "maxRetries" | "retryableStatuses" | "retryDelay" | "timeout">>;
|
|
241
|
+
type RequestOptions = Partial<Pick<OpenCloudClientOptions, "apiKey" | "baseUrl" | "maxRetries" | "retryableStatuses" | "retryableTransportCodes" | "retryDelay" | "timeout">>;
|
|
200
242
|
/**
|
|
201
243
|
* Supported request body types.
|
|
202
244
|
*
|
|
@@ -211,4 +253,4 @@ type RequestOptions = Partial<Pick<OpenCloudClientOptions, "apiKey" | "baseUrl"
|
|
|
211
253
|
type HttpRequestBody = FormData | Record<string, unknown> | Uint8Array<ArrayBuffer> | undefined;
|
|
212
254
|
//#endregion
|
|
213
255
|
export { OpenCloudHooks as a, Page as c, OpenCloudError as d, OpenCloudClientOptions as i, Result as l, HttpRequest as n, RequestConfig as o, HttpResponse as r, RequestOptions as s, HttpClient as t, SleepFunc as u };
|
|
214
|
-
//# sourceMappingURL=types-
|
|
256
|
+
//# sourceMappingURL=types-CRiJg5EQ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CRiJg5EQ.d.mts","names":[],"sources":["../src/errors/base.ts","../src/internal/utils/sleep.ts","../src/types.ts","../src/client/types.ts"],"mappings":";;AAQA;;;;AAC0B;;;cADb,cAAA,SAAuB,KAAA;EAAA,kBACV,IAAA;AAAA;;;;AAD1B;;;;KCHY,SAAA,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,aAAA;;;AA9CG;AASjC;;;;;;WA+CU,uBAAA,GAA0B,aAAA;;WAE1B,UAAA,IAAc,OAAA;;;;;;AA3CqB;WAkDnC,KAAA,GAAQ,SAAA;EAzCD;;;;;;;;;EAAA,SAmDP,OAAA;AAAA;;;;;;;;KAUE,cAAA,GAAiB,OAAA,CAC5B,IAAA,CACC,sBAAA;;;;;;;;AAZQ;AAUV;;;KAwBK,eAAA,GAAkB,QAAA,GAAW,MAAA,oBAA0B,UAAA,CAAW,WAAA"}
|
package/dist/universes.d.mts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, s as RequestOptions } from "./types-
|
|
2
|
-
import { i as RobloxLocale, r as RobloxLanguageCode } from "./data.generated-
|
|
3
|
-
import { n as GameIconState } from "./wire-
|
|
1
|
+
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, s as RequestOptions } from "./types-CRiJg5EQ.mjs";
|
|
2
|
+
import { i as RobloxLocale, r as RobloxLanguageCode } from "./data.generated-B2ceLfSn.mjs";
|
|
3
|
+
import { n as GameIconState } from "./wire-D3K-a-UP.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/cloud-v2/universes/types.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Caller-supplied input for the `get` method on `UniversesClient`.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.1.0
|
|
8
10
|
*/
|
|
9
11
|
interface GetUniverseParameters {
|
|
10
12
|
/** Stringified ID of the universe to fetch. */
|
|
@@ -12,6 +14,8 @@ interface GetUniverseParameters {
|
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* A social link that may be associated with a universe.
|
|
17
|
+
*
|
|
18
|
+
* @since 0.1.0
|
|
15
19
|
*/
|
|
16
20
|
interface SocialLink {
|
|
17
21
|
/** Display title of the link. */
|
|
@@ -19,7 +23,11 @@ interface SocialLink {
|
|
|
19
23
|
/** Destination URI. */
|
|
20
24
|
readonly uri: string;
|
|
21
25
|
}
|
|
22
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Public visibility classification.
|
|
28
|
+
*
|
|
29
|
+
* @since 0.1.0
|
|
30
|
+
*/
|
|
23
31
|
type UniverseVisibility = "private" | "public" | "unspecified";
|
|
24
32
|
/**
|
|
25
33
|
* Caller-supplied input for the `update` method on `UniversesClient`.
|
|
@@ -29,6 +37,8 @@ type UniverseVisibility = "private" | "public" | "unspecified";
|
|
|
29
37
|
* Setting a key to `undefined` clears the corresponding server-side
|
|
30
38
|
* value (applicable to `privateServerPriceRobux` and each optional
|
|
31
39
|
* social link).
|
|
40
|
+
*
|
|
41
|
+
* @since 0.1.0
|
|
32
42
|
*/
|
|
33
43
|
interface UpdateUniverseParameters {
|
|
34
44
|
/** Whether console players can join. */
|
|
@@ -64,6 +74,8 @@ interface UpdateUniverseParameters {
|
|
|
64
74
|
}
|
|
65
75
|
/**
|
|
66
76
|
* Discriminated-union representation of a universe's owner.
|
|
77
|
+
*
|
|
78
|
+
* @since 0.1.0
|
|
67
79
|
*/
|
|
68
80
|
interface UniverseOwner {
|
|
69
81
|
/**
|
|
@@ -74,10 +86,16 @@ interface UniverseOwner {
|
|
|
74
86
|
/** Whether the owner is a user or a group. */
|
|
75
87
|
readonly kind: "group" | "user";
|
|
76
88
|
}
|
|
77
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Public age-rating classification.
|
|
91
|
+
*
|
|
92
|
+
* @since 0.1.0
|
|
93
|
+
*/
|
|
78
94
|
type UniverseAgeRating = "9Plus" | "13Plus" | "17Plus" | "all" | "unspecified";
|
|
79
95
|
/**
|
|
80
96
|
* Parsed representation of a Roblox universe's configuration.
|
|
97
|
+
*
|
|
98
|
+
* @since 0.1.0
|
|
81
99
|
*/
|
|
82
100
|
interface Universe {
|
|
83
101
|
/** Stringified universe ID, extracted from the wire `path`. */
|
|
@@ -131,6 +149,8 @@ interface Universe {
|
|
|
131
149
|
//#region src/domains/game-internationalization/game-icon/types.d.ts
|
|
132
150
|
/**
|
|
133
151
|
* A localized icon entry returned by listing icons for an experience.
|
|
152
|
+
*
|
|
153
|
+
* @since 0.1.0
|
|
134
154
|
*/
|
|
135
155
|
interface ExperienceIcon {
|
|
136
156
|
/** Stringified ID of the uploaded icon image. */
|
|
@@ -150,6 +170,8 @@ interface ExperienceIcon {
|
|
|
150
170
|
* Parameters for uploading or replacing a localized experience icon. A
|
|
151
171
|
* subsequent upload for the same `(universeId, languageCode)` pair replaces
|
|
152
172
|
* the existing icon for that locale.
|
|
173
|
+
*
|
|
174
|
+
* @since 0.1.0
|
|
153
175
|
*/
|
|
154
176
|
interface UploadExperienceIconParameters {
|
|
155
177
|
/** Image bytes to upload. PNG and JPEG are accepted by the server. */
|
|
@@ -166,6 +188,8 @@ interface UploadExperienceIconParameters {
|
|
|
166
188
|
/**
|
|
167
189
|
* Parameters for deleting the localized icon registered against a universe
|
|
168
190
|
* for a given language.
|
|
191
|
+
*
|
|
192
|
+
* @since 0.1.0
|
|
169
193
|
*/
|
|
170
194
|
interface DeleteExperienceIconParameters {
|
|
171
195
|
/**
|
|
@@ -179,6 +203,8 @@ interface DeleteExperienceIconParameters {
|
|
|
179
203
|
}
|
|
180
204
|
/**
|
|
181
205
|
* Parameters for listing every localized icon registered against a universe.
|
|
206
|
+
*
|
|
207
|
+
* @since 0.1.0
|
|
182
208
|
*/
|
|
183
209
|
interface ListExperienceIconsParameters {
|
|
184
210
|
/** Stringified ID of the universe whose icons are being listed. */
|
|
@@ -188,6 +214,8 @@ interface ListExperienceIconsParameters {
|
|
|
188
214
|
//#region src/domains/game-internationalization/game-thumbnails/types.d.ts
|
|
189
215
|
/**
|
|
190
216
|
* Result of uploading a localized experience thumbnail.
|
|
217
|
+
*
|
|
218
|
+
* @since 0.1.0
|
|
191
219
|
*/
|
|
192
220
|
interface UploadedExperienceThumbnail {
|
|
193
221
|
/** Stringified media asset ID of the uploaded thumbnail. */
|
|
@@ -197,6 +225,8 @@ interface UploadedExperienceThumbnail {
|
|
|
197
225
|
* Parameters for uploading a new localized experience thumbnail. Each upload
|
|
198
226
|
* appends a new entry to the carousel; reorder via {@link ReorderExperienceThumbnailsParameters}
|
|
199
227
|
* after multiple uploads to set the display order.
|
|
228
|
+
*
|
|
229
|
+
* @since 0.1.0
|
|
200
230
|
*/
|
|
201
231
|
interface UploadExperienceThumbnailParameters {
|
|
202
232
|
/** Image bytes to upload. PNG and JPEG are accepted by the server. */
|
|
@@ -212,6 +242,8 @@ interface UploadExperienceThumbnailParameters {
|
|
|
212
242
|
}
|
|
213
243
|
/**
|
|
214
244
|
* Parameters for deleting a single thumbnail by media asset ID.
|
|
245
|
+
*
|
|
246
|
+
* @since 0.1.0
|
|
215
247
|
*/
|
|
216
248
|
interface DeleteExperienceThumbnailParameters {
|
|
217
249
|
/** Stringified media asset ID of the thumbnail to delete. */
|
|
@@ -228,6 +260,8 @@ interface DeleteExperienceThumbnailParameters {
|
|
|
228
260
|
/**
|
|
229
261
|
* Parameters for reordering the localized thumbnail carousel. The supplied
|
|
230
262
|
* `orderedImageIds` describes the new display order from first to last.
|
|
263
|
+
*
|
|
264
|
+
* @since 0.1.0
|
|
231
265
|
*/
|
|
232
266
|
interface ReorderExperienceThumbnailsParameters {
|
|
233
267
|
/**
|
|
@@ -273,6 +307,9 @@ interface UniverseIconHandle {
|
|
|
273
307
|
* subsequent upload for the same `(universeId, languageCode)` pair
|
|
274
308
|
* replaces the existing icon for that locale.
|
|
275
309
|
*
|
|
310
|
+
* No default request timeout applies to this upload; pass `options.timeout`
|
|
311
|
+
* to set a per-call deadline.
|
|
312
|
+
*
|
|
276
313
|
* @param parameters - Universe and language identifiers plus the image
|
|
277
314
|
* bytes to upload.
|
|
278
315
|
* @param options - Optional per-request overrides (e.g. A different
|
|
@@ -312,6 +349,9 @@ interface UniverseThumbnailsHandle {
|
|
|
312
349
|
* {@link UniverseThumbnailsHandle.reorder} after multiple uploads to
|
|
313
350
|
* set the display order.
|
|
314
351
|
*
|
|
352
|
+
* No default request timeout applies to this upload; pass `options.timeout`
|
|
353
|
+
* to set a per-call deadline.
|
|
354
|
+
*
|
|
315
355
|
* @param parameters - Universe and language identifiers plus the image
|
|
316
356
|
* bytes to upload.
|
|
317
357
|
* @param options - Optional per-request overrides (e.g. A different
|
|
@@ -341,6 +381,8 @@ interface UniverseThumbnailsHandle {
|
|
|
341
381
|
* {@link UniversesClient.thumbnails} Operation Groups so callers reach
|
|
342
382
|
* for one client per universe.
|
|
343
383
|
*
|
|
384
|
+
* @since 0.1.0
|
|
385
|
+
*
|
|
344
386
|
* @example
|
|
345
387
|
*
|
|
346
388
|
* ```ts
|
package/dist/universes.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universes.d.mts","names":[],"sources":["../src/domains/cloud-v2/universes/types.ts","../src/domains/game-internationalization/game-icon/types.ts","../src/domains/game-internationalization/game-thumbnails/types.ts","../src/resources/universes/client.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"universes.d.mts","names":[],"sources":["../src/domains/cloud-v2/universes/types.ts","../src/domains/game-internationalization/game-icon/types.ts","../src/domains/game-internationalization/game-thumbnails/types.ts","../src/resources/universes/client.ts"],"mappings":";;;;;;;;;;UAKiB,qBAAA;EAAA;EAAA,SAEP,UAAA;AAAA;AAAA;AAQV;;;;AARU,UAQO,UAAA;EAYjB;EAAA,SAVU,KAAA;;WAEA,GAAA;AAAA;AAqBV;;;;;AAAA,KAbY,kBAAA;;;;;;;;;;;;UAaK,wBAAA;;WAEP,cAAA;;WAEA,cAAA;;WAEA,iBAAA,GAAoB,UAAA;;WAEpB,kBAAA,GAAqB,UAAA;;WAErB,iBAAA,GAAoB,UAAA;;WAEpB,aAAA;;WAEA,uBAAA;;WAEA,qBAAA,GAAwB,UAAA;EAcJ;EAAA,SAZpB,aAAA;EAoBV;EAAA,SAlBU,gBAAA,GAAmB,UAAA;;WAEnB,iBAAA,GAAoB,UAAA;EAuBpB;EAAA,SArBA,UAAA;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6B,cAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AH3HrB;;cG4JhB,eAAA;EAAA;EFpSb;;;;;;EAAA,SE6SiB,IAAA,EAAM,kBAAA;;;;AFjSN;AAUjB;;;;;WEiSiB,UAAA,EAAY,wBAAA;;;;;;;;EAS5B,WAAA,CAAY,OAAA,EAAS,sBAAA;;;;AFhSZ;AASV;;;;;EEsSC,GAAA,CACC,UAAA,EAAY,qBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,cAAA;;;;AFjSnB;AAQV;;;;AAEU;;;;AC9DV;ECsWC,MAAA,CACC,UAAA,EAAY,wBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,cAAA;AAAA"}
|
package/dist/universes.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { r as ApiError } from "./rate-limit-
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
1
|
+
import { r as ApiError } from "./rate-limit-Dh2leqaB.mjs";
|
|
2
|
+
import { n as IDEMPOTENT_METHOD_DEFAULTS, t as CREATE_METHOD_DEFAULTS } from "./retry-BvZRZDXs.mjs";
|
|
3
|
+
import { t as ValidationError } from "./validation-xJZRa8tX.mjs";
|
|
4
|
+
import { t as toBlob } from "./to-blob-RPqMBuft.mjs";
|
|
5
|
+
import { a as isDateTimeString, i as isRecord, n as okRequest, r as parseEmptyResponse, t as ResourceClient } from "./resource-client-CIAkS2xQ.mjs";
|
|
5
6
|
//#region src/domains/cloud-v2/universes/builders.ts
|
|
6
7
|
/**
|
|
7
8
|
* Dodges `unicorn/no-null` while still emitting a literal `null` onto
|
|
@@ -106,6 +107,9 @@ const AGE_RATING_MAP = {
|
|
|
106
107
|
AGE_RATING_UNSPECIFIED: "unspecified"
|
|
107
108
|
};
|
|
108
109
|
const MALFORMED_MESSAGE = "Malformed universe response";
|
|
110
|
+
const UNIVERSE_PATH_PATTERN = /^universes\/(\d+)$/;
|
|
111
|
+
const ROOT_PLACE_PATH_PATTERN = /\/places\/(\d+)$/;
|
|
112
|
+
const OWNER_PATH_PATTERN = /^(?:users|groups)\/(\d+)$/;
|
|
109
113
|
/**
|
|
110
114
|
* Parses a successful Open Cloud `Universe` response body into the
|
|
111
115
|
* public {@link Universe} shape.
|
|
@@ -116,11 +120,11 @@ const MALFORMED_MESSAGE = "Malformed universe response";
|
|
|
116
120
|
*/
|
|
117
121
|
function parseUniverseResponse(response) {
|
|
118
122
|
const { body, status: statusCode } = response;
|
|
119
|
-
if (!isUniverseWire(body)) return malformed(statusCode);
|
|
123
|
+
if (!isUniverseWire(body)) return malformed(statusCode, body);
|
|
120
124
|
const ownerResult = resolveOwner(body);
|
|
121
|
-
if (!ownerResult.success) return malformed(statusCode);
|
|
122
|
-
const id =
|
|
123
|
-
if (id === void 0) return malformed(statusCode);
|
|
125
|
+
if (!ownerResult.success) return malformed(statusCode, body);
|
|
126
|
+
const id = UNIVERSE_PATH_PATTERN.exec(body.path)?.[1];
|
|
127
|
+
if (id === void 0) return malformed(statusCode, body);
|
|
124
128
|
return {
|
|
125
129
|
data: toUniverse({
|
|
126
130
|
id,
|
|
@@ -130,15 +134,18 @@ function parseUniverseResponse(response) {
|
|
|
130
134
|
success: true
|
|
131
135
|
};
|
|
132
136
|
}
|
|
133
|
-
function malformed(statusCode) {
|
|
137
|
+
function malformed(statusCode, body) {
|
|
134
138
|
return {
|
|
135
|
-
err: new ApiError(MALFORMED_MESSAGE, {
|
|
139
|
+
err: new ApiError(MALFORMED_MESSAGE, {
|
|
140
|
+
details: body,
|
|
141
|
+
statusCode
|
|
142
|
+
}),
|
|
136
143
|
success: false
|
|
137
144
|
};
|
|
138
145
|
}
|
|
139
146
|
function extractRootPlaceId(rootPlace) {
|
|
140
147
|
if (rootPlace === void 0) return;
|
|
141
|
-
return
|
|
148
|
+
return ROOT_PLACE_PATH_PATTERN.exec(rootPlace)?.[1];
|
|
142
149
|
}
|
|
143
150
|
function toSocialLink(wire) {
|
|
144
151
|
if (wire === void 0) return;
|
|
@@ -206,7 +213,7 @@ function isUniverseWire(body) {
|
|
|
206
213
|
return hasValidRequiredFields(body) && hasValidOptionalFields(body);
|
|
207
214
|
}
|
|
208
215
|
function extractOwnerId(resourcePath) {
|
|
209
|
-
return
|
|
216
|
+
return OWNER_PATH_PATTERN.exec(resourcePath)?.[1];
|
|
210
217
|
}
|
|
211
218
|
function resolveOwner(body) {
|
|
212
219
|
if (typeof body.user === "string") {
|
|
@@ -315,7 +322,10 @@ const ICON_REQUIRED_SCOPES = Object.freeze(["legacy-universe:manage"]);
|
|
|
315
322
|
function parseIconListResponse(response) {
|
|
316
323
|
const { body, status: statusCode } = response;
|
|
317
324
|
if (!isGameIconListWire(body)) return {
|
|
318
|
-
err: new ApiError("Malformed icon list response", {
|
|
325
|
+
err: new ApiError("Malformed icon list response", {
|
|
326
|
+
details: body,
|
|
327
|
+
statusCode
|
|
328
|
+
}),
|
|
319
329
|
success: false
|
|
320
330
|
};
|
|
321
331
|
return {
|
|
@@ -346,6 +356,7 @@ function toExperienceIcon(wire) {
|
|
|
346
356
|
}
|
|
347
357
|
//#endregion
|
|
348
358
|
//#region src/domains/game-internationalization/game-thumbnails/builders.ts
|
|
359
|
+
const POSITIVE_INTEGER_PATTERN = /^[1-9]\d*$/;
|
|
349
360
|
/**
|
|
350
361
|
* Builds a `POST` request for the localized "upload experience thumbnail"
|
|
351
362
|
* endpoint. Each successful upload appends a new entry to the carousel.
|
|
@@ -400,7 +411,7 @@ function buildReorderThumbnailsRequest(parameters) {
|
|
|
400
411
|
};
|
|
401
412
|
}
|
|
402
413
|
function parseImageId(value) {
|
|
403
|
-
if (
|
|
414
|
+
if (!POSITIVE_INTEGER_PATTERN.test(value)) return;
|
|
404
415
|
const parsed = Number(value);
|
|
405
416
|
if (!Number.isSafeInteger(parsed)) return;
|
|
406
417
|
return parsed;
|
|
@@ -461,7 +472,10 @@ const THUMBNAILS_REQUIRED_SCOPES = Object.freeze(["legacy-universe:manage"]);
|
|
|
461
472
|
function parseThumbnailUploadResponse(response) {
|
|
462
473
|
const { body, status: statusCode } = response;
|
|
463
474
|
if (!isGameThumbnailUploadWire(body)) return {
|
|
464
|
-
err: new ApiError("Malformed thumbnail upload response", {
|
|
475
|
+
err: new ApiError("Malformed thumbnail upload response", {
|
|
476
|
+
details: body,
|
|
477
|
+
statusCode
|
|
478
|
+
}),
|
|
465
479
|
success: false
|
|
466
480
|
};
|
|
467
481
|
return {
|
|
@@ -572,6 +586,8 @@ const THUMBNAIL_REORDER_SPEC = Object.freeze({
|
|
|
572
586
|
* {@link UniversesClient.thumbnails} Operation Groups so callers reach
|
|
573
587
|
* for one client per universe.
|
|
574
588
|
*
|
|
589
|
+
* @since 0.1.0
|
|
590
|
+
*
|
|
575
591
|
* @example
|
|
576
592
|
*
|
|
577
593
|
* ```ts
|