@bedrock-rbx/ocale 0.1.0-beta.1 → 0.1.0-beta.2
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/dist/badges.d.mts +86 -3
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +113 -5
- package/dist/badges.mjs.map +1 -1
- package/dist/data.generated-BtkDGH8C.d.mts +485 -0
- package/dist/data.generated-BtkDGH8C.d.mts.map +1 -0
- package/dist/developer-products.d.mts +14 -5
- package/dist/developer-products.d.mts.map +1 -1
- package/dist/developer-products.mjs +5 -4
- package/dist/developer-products.mjs.map +1 -1
- package/dist/game-passes.d.mts +83 -2
- package/dist/game-passes.d.mts.map +1 -1
- package/dist/game-passes.mjs +111 -4
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +3 -81
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/is-date-time-string-Cuf1TaSC.mjs +19 -0
- package/dist/is-date-time-string-Cuf1TaSC.mjs.map +1 -0
- package/dist/locales.d.mts +2 -0
- package/dist/locales.mjs +512 -0
- package/dist/locales.mjs.map +1 -0
- package/dist/luau-execution.d.mts +62 -0
- package/dist/luau-execution.d.mts.map +1 -0
- package/dist/luau-execution.mjs +52 -0
- package/dist/luau-execution.mjs.map +1 -0
- package/dist/places.d.mts +47 -8
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +39 -13
- package/dist/places.mjs.map +1 -1
- package/dist/{price-information-CmpscMc4.mjs → price-information-s7DY0GV2.mjs} +2 -2
- package/dist/{price-information-CmpscMc4.mjs.map → price-information-s7DY0GV2.mjs.map} +1 -1
- package/dist/{rate-limit-BBU_4xnZ.mjs → rate-limit-CKfuhxT1.mjs} +11 -3
- package/dist/rate-limit-CKfuhxT1.mjs.map +1 -0
- package/dist/rate-limit-DzHBFwps.d.mts +92 -0
- package/dist/rate-limit-DzHBFwps.d.mts.map +1 -0
- package/dist/{resource-client-CaS_j3yg.mjs → resource-client-Wi4Mwqy5.mjs} +69 -14
- package/dist/resource-client-Wi4Mwqy5.mjs.map +1 -0
- package/dist/specs-Co6qYp_E.mjs +309 -0
- package/dist/specs-Co6qYp_E.mjs.map +1 -0
- package/dist/storage.d.mts +374 -0
- package/dist/storage.d.mts.map +1 -0
- package/dist/storage.mjs +371 -0
- package/dist/storage.mjs.map +1 -0
- package/dist/types-BZ0959rh.d.mts +149 -0
- package/dist/types-BZ0959rh.d.mts.map +1 -0
- package/dist/{types-YCTsM8Qd.d.mts → types-Cp8w8uwA.d.mts} +1 -1
- package/dist/{types-YCTsM8Qd.d.mts.map → types-Cp8w8uwA.d.mts.map} +1 -1
- package/dist/universes.d.mts +37 -12
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +5 -4
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-CTZzJhmd.mjs → validation-b7KAoEio.mjs} +2 -2
- package/dist/validation-b7KAoEio.mjs.map +1 -0
- package/package.json +7 -3
- package/dist/rate-limit-BBU_4xnZ.mjs.map +0 -1
- package/dist/resource-client-CaS_j3yg.mjs.map +0 -1
- package/dist/validation-CTZzJhmd.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specs-Co6qYp_E.mjs","names":[],"sources":["../src/domains/cloud-v2/luau-execution-tasks/builders.ts","../src/domains/cloud-v2/luau-execution-tasks/operations.ts","../src/domains/cloud-v2/luau-execution-tasks/parsers.ts","../src/domains/cloud-v2/luau-execution-tasks/specs.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { GetParameters, SubmitAtHeadParameters, SubmitAtVersionParameters } from \"./types.ts\";\n\ninterface SubmitBodyInput {\n\treadonly script: string;\n\treadonly timeoutSeconds?: number;\n}\n\nconst JSON_HEADERS: Readonly<Record<string, string>> = { \"content-type\": \"application/json\" };\n\n/**\n * Builds a `POST` request for the Open Cloud \"create Luau execution\n * session task\" endpoint, targeting the place's head version. Serializes\n * `timeoutSeconds` into the wire's duration string format (`\"<n>s\"`)\n * when supplied.\n *\n * @param parameters - Universe and place identifiers, the script body,\n * and an optional `timeoutSeconds`.\n * @returns A pure {@link HttpRequest} describing the submit call.\n */\nexport function buildSubmitAtHeadRequest(parameters: SubmitAtHeadParameters): HttpRequest {\n\tconst { placeId, universeId } = parameters;\n\treturn {\n\t\tbody: buildSubmitBody(parameters),\n\t\theaders: JSON_HEADERS,\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}/luau-execution-session-tasks`,\n\t};\n}\n\n/**\n * Builds a `POST` request for the Open Cloud \"create Luau execution\n * session task\" endpoint, targeting a specific place version. Differs\n * from {@link buildSubmitAtHeadRequest} only in URL shape: the path\n * includes the `versions/{versionId}` segment so the script runs\n * against that exact place version instead of the live head.\n *\n * @param parameters - Universe, place, and version identifiers, the\n * script body, and an optional `timeoutSeconds`.\n * @returns A pure {@link HttpRequest} describing the submit call.\n */\nexport function buildSubmitAtVersionRequest(parameters: SubmitAtVersionParameters): HttpRequest {\n\tconst { placeId, universeId, versionId } = parameters;\n\treturn {\n\t\tbody: buildSubmitBody(parameters),\n\t\theaders: JSON_HEADERS,\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-session-tasks`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the Open Cloud \"read Luau execution session\n * task\" endpoint. The endpoint accepts only the maximal x-aep-resource\n * path shape (universe, place, version, session, task), so the supplied\n * ref must include `versionId` and `sessionId`; refs extracted from the\n * narrower path formats are rejected with a {@link ValidationError}.\n *\n * @param parameters - Task ref and optional view selector. When `view`\n * is omitted, no `?view=` query is sent and the server applies its\n * own default (`BASIC`).\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when the ref is missing `versionId` or\n * `sessionId`.\n */\nexport function buildGetRequest(parameters: GetParameters): Result<HttpRequest, ValidationError> {\n\tconst { ref, view } = parameters;\n\tconst { placeId, sessionId, taskId, universeId, versionId } = ref;\n\n\tif (versionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing versionId; cannot GET\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tif (sessionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing sessionId; cannot GET\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst base = `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-sessions/${sessionId}/tasks/${taskId}`;\n\tconst url = view === undefined ? base : `${base}?view=${view}`;\n\treturn { data: { method: \"GET\", url }, success: true };\n}\n\nfunction buildSubmitBody(parameters: SubmitBodyInput): Record<string, unknown> {\n\tconst { script, timeoutSeconds } = parameters;\n\treturn timeoutSeconds === undefined ? { script } : { script, timeout: `${timeoutSeconds}s` };\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst SUBMIT_PER_MINUTE = 40;\nconst GET_PER_MINUTE = 200;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for submitting a Luau execution task,\n * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_CreateLuauExecutionSessionTask__Using_Universes` operation\n * (40 requests per minute per API key owner). The two URL shapes\n * (head and version) share this queue because Roblox attributes both\n * to the same per-minute quota.\n */\nexport const SUBMIT_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: SUBMIT_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.submit\",\n});\n\n/**\n * Per-second request ceiling for fetching a Luau execution task,\n * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_GetLuauExecutionSessionTask` operation (200 requests per\n * minute per API key owner).\n */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: GET_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.get\",\n});\n\n/**\n * Scopes required to submit a Luau execution task, sourced from\n * `x-roblox-scopes` on the create operation in the vendored OpenAPI\n * schema. Surfaced via the `requiredScopes` field of the per-method\n * spec so a 401 or 403 ApiError is upgraded to a `PermissionError`\n * naming the missing scope.\n */\nexport const SUBMIT_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:write\",\n]);\n\n/**\n * Scopes required to fetch a Luau execution task, sourced from\n * `x-roblox-scopes` on the get operation. The `:write` scope also\n * grants read in upstream auth, but we surface only `:read` here as\n * the minimum-privilege requirement for this method.\n */\nexport const GET_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:read\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { LuauExecutionTask, LuauExecutionTaskRef } from \"./types.ts\";\nimport type {\n\tLuauExecutionTaskErrorWire,\n\tLuauExecutionTaskOutputWire,\n\tLuauExecutionTaskWire,\n} from \"./wire.ts\";\n\nconst MALFORMED_TASK_MESSAGE = \"Malformed luau-execution-session-task response\";\n\n// Matches any of the four x-aep-resource path formats for a luau\n// execution session task.\n//\n// Capture groups:\n// 1. universeId\n// 2. placeId\n// 3. versionId (when `/versions/{v}/` segment is present, else undefined)\n// 4. sessionId (when `/luau-execution-sessions/{s}/tasks/...` branch matched)\n// 5. taskId (when `/luau-execution-sessions/.../tasks/{t}` branch matched)\n// 6. taskId (when `/luau-execution-session-tasks/{t}` branch matched)\nconst PATH_PATTERN =\n\t/^universes\\/(\\d+)\\/places\\/(\\d+)(?:\\/versions\\/(\\d+))?(?:\\/luau-execution-sessions\\/([^/]+)\\/tasks\\/([^/]+)|\\/luau-execution-session-tasks\\/([^/]+))$/;\n\ninterface ParseVariantArgs {\n\treadonly body: LuauExecutionTaskWire;\n\treadonly ref: LuauExecutionTaskRef;\n\treadonly statusCode: number;\n\treadonly timeoutSeconds: number | undefined;\n}\n\n/**\n * Parses a successful Open Cloud `LuauExecutionSessionTask` response\n * body into the public {@link LuauExecutionTask} discriminated union.\n * Handles every supported task state (in-progress, COMPLETE, FAILED)\n * across all four x-aep-resource path shapes the server returns.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud\n * API.\n * @returns A success result wrapping the parsed task, or an\n * {@link ApiError} when the body or path do not match a supported\n * shape.\n */\nexport function parseLuauExecutionTaskResponse(\n\tresponse: HttpResponse,\n): Result<LuauExecutionTask, ApiError> {\n\tconst { body, status: statusCode } = response;\n\tif (!isLuauExecutionTaskWire(body)) {\n\t\treturn malformed(statusCode);\n\t}\n\n\tconst ref = parseTaskRef(body.path);\n\tif (ref === undefined) {\n\t\treturn malformed(statusCode);\n\t}\n\n\tconst timeoutSeconds = parseTimeoutSeconds(body.timeout);\n\n\tif (body.state === \"COMPLETE\") {\n\t\treturn parseCompleteTask({ body, ref, statusCode, timeoutSeconds });\n\t}\n\n\tif (body.state === \"FAILED\") {\n\t\treturn parseFailedTask({ body, ref, statusCode, timeoutSeconds });\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tcreatedAt: new Date(body.createTime),\n\t\t\tref,\n\t\t\tstate: body.state,\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt: new Date(body.updateTime),\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction isAcceptedWireState(\n\tstate: unknown,\n): state is \"CANCELLED\" | \"COMPLETE\" | \"FAILED\" | \"PROCESSING\" | \"QUEUED\" {\n\treturn (\n\t\tstate === \"QUEUED\" ||\n\t\tstate === \"PROCESSING\" ||\n\t\tstate === \"CANCELLED\" ||\n\t\tstate === \"COMPLETE\" ||\n\t\tstate === \"FAILED\"\n\t);\n}\n\nfunction isErrorWireCode(code: unknown): code is LuauExecutionTaskErrorWire[\"code\"] {\n\treturn (\n\t\tcode === \"SCRIPT_ERROR\" ||\n\t\tcode === \"DEADLINE_EXCEEDED\" ||\n\t\tcode === \"OUTPUT_SIZE_LIMIT_EXCEEDED\" ||\n\t\tcode === \"INTERNAL_ERROR\"\n\t);\n}\n\nfunction isErrorWire(value: unknown): value is LuauExecutionTaskErrorWire {\n\treturn (\n\t\tisRecord(value) && isErrorWireCode(value[\"code\"]) && typeof value[\"message\"] === \"string\"\n\t);\n}\n\nfunction isOptionalErrorWire(value: unknown): value is LuauExecutionTaskErrorWire | undefined {\n\treturn value === undefined || isErrorWire(value);\n}\n\nfunction isOutputWire(value: unknown): value is LuauExecutionTaskOutputWire {\n\treturn isRecord(value) && Array.isArray(value[\"results\"]);\n}\n\nfunction isOptionalOutputWire(value: unknown): value is LuauExecutionTaskOutputWire | undefined {\n\treturn value === undefined || isOutputWire(value);\n}\n\nfunction isLuauExecutionTaskWire(body: unknown): body is LuauExecutionTaskWire {\n\treturn (\n\t\tisRecord(body) &&\n\t\ttypeof body[\"path\"] === \"string\" &&\n\t\ttypeof body[\"createTime\"] === \"string\" &&\n\t\ttypeof body[\"updateTime\"] === \"string\" &&\n\t\tisAcceptedWireState(body[\"state\"]) &&\n\t\ttypeof body[\"user\"] === \"string\" &&\n\t\tisOptionalOutputWire(body[\"output\"]) &&\n\t\tisOptionalErrorWire(body[\"error\"]) &&\n\t\tisOptionalDurationWire(body[\"timeout\"])\n\t);\n}\n\nconst DURATION_PATTERN = /^(\\d+)s$/;\n\nfunction isOptionalDurationWire(value: unknown): value is string | undefined {\n\treturn value === undefined || (typeof value === \"string\" && DURATION_PATTERN.test(value));\n}\n\nfunction parseTimeoutSeconds(value: string | undefined): number | undefined {\n\tif (value === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst match = DURATION_PATTERN.exec(value);\n\tconst seconds = match?.[1];\n\tif (seconds === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn Number.parseInt(seconds, 10);\n}\n\nfunction malformed(statusCode: number): Result<LuauExecutionTask, ApiError> {\n\treturn { err: new ApiError(MALFORMED_TASK_MESSAGE, { statusCode }), success: false };\n}\n\nfunction parseCompleteTask(args: ParseVariantArgs): Result<LuauExecutionTask, ApiError> {\n\tconst { body, ref, statusCode, timeoutSeconds } = args;\n\tif (body.output === undefined) {\n\t\treturn malformed(statusCode);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tcreatedAt: new Date(body.createTime),\n\t\t\toutput: { results: body.output.results },\n\t\t\tref,\n\t\t\tstate: \"COMPLETE\",\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt: new Date(body.updateTime),\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseFailedTask(args: ParseVariantArgs): Result<LuauExecutionTask, ApiError> {\n\tconst { body, ref, statusCode, timeoutSeconds } = args;\n\tif (body.error === undefined) {\n\t\treturn malformed(statusCode);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tcreatedAt: new Date(body.createTime),\n\t\t\terror: { code: body.error.code, message: body.error.message },\n\t\t\tref,\n\t\t\tstate: \"FAILED\",\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt: new Date(body.updateTime),\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseTaskRef(path: string): LuauExecutionTaskRef | undefined {\n\tconst match = PATH_PATTERN.exec(path);\n\tif (match === null) {\n\t\treturn undefined;\n\t}\n\n\tconst [, universeId, placeId, versionId, sessionId, sessionTaskId, plainTaskId] = match;\n\tconst taskId = sessionTaskId ?? plainTaskId;\n\tif (universeId === undefined || placeId === undefined || taskId === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn { placeId, sessionId, taskId, universeId, versionId };\n}\n","import {\n\tCREATE_METHOD_DEFAULTS,\n\tIDEMPOTENT_METHOD_DEFAULTS,\n} from \"../../../internal/http/retry.ts\";\nimport { okRequest, type ResourceMethodSpec } from \"../../../internal/resource-client.ts\";\nimport {\n\tbuildGetRequest,\n\tbuildSubmitAtHeadRequest,\n\tbuildSubmitAtVersionRequest,\n} from \"./builders.ts\";\nimport {\n\tGET_OPERATION_LIMIT,\n\tGET_REQUIRED_SCOPES,\n\tSUBMIT_OPERATION_LIMIT,\n\tSUBMIT_REQUIRED_SCOPES,\n} from \"./operations.ts\";\nimport { parseLuauExecutionTaskResponse } from \"./parsers.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"./types.ts\";\n\nfunction makeSpec<P>(\n\tspec: ResourceMethodSpec<P, LuauExecutionTask>,\n): ResourceMethodSpec<P, LuauExecutionTask> {\n\treturn Object.freeze(spec);\n}\n\n/**\n * Per-method dispatch spec for submitting a Luau execution task at a\n * place's head version. Frozen at module scope so both the top-level\n * `LuauExecutionClient` and the `luauExecution` Operation Group on\n * `PlacesClient` share the same instance reference.\n */\nexport const SUBMIT_HEAD_SPEC = makeSpec<SubmitAtHeadParameters>({\n\tbuildRequest: (parameters) => okRequest(buildSubmitAtHeadRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: SUBMIT_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: SUBMIT_REQUIRED_SCOPES,\n});\n\n/**\n * Per-method dispatch spec for submitting a Luau execution task at a\n * specific place version. Shares the rate-limit queue and required\n * scope set with {@link SUBMIT_HEAD_SPEC} because Roblox attributes\n * both URL shapes to one per-minute quota.\n */\nexport const SUBMIT_VERSION_SPEC = makeSpec<SubmitAtVersionParameters>({\n\tbuildRequest: (parameters) => okRequest(buildSubmitAtVersionRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: SUBMIT_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: SUBMIT_REQUIRED_SCOPES,\n});\n\n/**\n * Per-method dispatch spec for fetching a Luau execution task. Uses\n * idempotent retry semantics (429 and 5xx both retried) so reads\n * recover transparently from transient server errors.\n */\nexport const GET_SPEC = makeSpec<GetParameters>({\n\tbuildRequest: buildGetRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: GET_REQUIRED_SCOPES,\n});\n"],"mappings":";;;;AAUA,MAAM,eAAiD,EAAE,gBAAgB,oBAAoB;;;;;;;;;;;AAY7F,SAAgB,yBAAyB,YAAiD;CACzF,MAAM,EAAE,SAAS,eAAe;AAChC,QAAO;EACN,MAAM,gBAAgB,WAAW;EACjC,SAAS;EACT,QAAQ;EACR,KAAK,uBAAuB,WAAW,UAAU,QAAQ;EACzD;;;;;;;;;;;;;AAcF,SAAgB,4BAA4B,YAAoD;CAC/F,MAAM,EAAE,SAAS,YAAY,cAAc;AAC3C,QAAO;EACN,MAAM,gBAAgB,WAAW;EACjC,SAAS;EACT,QAAQ;EACR,KAAK,uBAAuB,WAAW,UAAU,QAAQ,YAAY,UAAU;EAC/E;;;;;;;;;;;;;;;;AAiBF,SAAgB,gBAAgB,YAAiE;CAChG,MAAM,EAAE,KAAK,SAAS;CACtB,MAAM,EAAE,SAAS,WAAW,QAAQ,YAAY,cAAc;AAE9D,KAAI,cAAc,KAAA,EACjB,QAAO;EACN,KAAK,IAAI,gBAAgB,6CAA6C,EACrE,MAAM,kBACN,CAAC;EACF,SAAS;EACT;AAGF,KAAI,cAAc,KAAA,EACjB,QAAO;EACN,KAAK,IAAI,gBAAgB,6CAA6C,EACrE,MAAM,kBACN,CAAC;EACF,SAAS;EACT;CAGF,MAAM,OAAO,uBAAuB,WAAW,UAAU,QAAQ,Y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4B,WAAW,CAAC;CAChF,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,OAAO;CACP,gBAAgB;CAChB,CAAC;;;;;;AAOF,MAAa,WAAW,SAAwB;CAC/C,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,OAAO;CACP,gBAAgB;CAChB,CAAC"}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, n as HttpRequest, r as HttpResponse, s as RequestOptions } from "./types-Cp8w8uwA.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/domains/cloud-v2/memory-store-queues/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Caller-supplied input for the `enqueue` method on `StorageClient.queues`.
|
|
6
|
+
* Mirrors `Cloud_CreateMemoryStoreQueueItem` on the Open Cloud API.
|
|
7
|
+
*/
|
|
8
|
+
interface EnqueueQueueItemParameters {
|
|
9
|
+
/**
|
|
10
|
+
* Opaque queue payload. Round-trips as JSON, including nested `null`
|
|
11
|
+
* values inside objects and arrays. The top-level value cannot be
|
|
12
|
+
* `null`: the server rejects null payloads with a 400, so the type
|
|
13
|
+
* forbids it at compile time.
|
|
14
|
+
*/
|
|
15
|
+
readonly data: Exclude<JSONValue, null>;
|
|
16
|
+
/**
|
|
17
|
+
* Optional priority. Higher values are dequeued first; equal priorities
|
|
18
|
+
* preserve insertion order. Omitted entries are inserted at the back of
|
|
19
|
+
* the queue.
|
|
20
|
+
*/
|
|
21
|
+
readonly priority?: number;
|
|
22
|
+
/** Stringified queue identifier; the queue is auto-created on first use. */
|
|
23
|
+
readonly queueId: string;
|
|
24
|
+
/**
|
|
25
|
+
* Optional time-to-live in seconds. After this many seconds the item is
|
|
26
|
+
* automatically removed from the queue. Omitted entries inherit the
|
|
27
|
+
* server-default TTL.
|
|
28
|
+
*/
|
|
29
|
+
readonly ttl?: number;
|
|
30
|
+
/** Stringified ID of the universe that owns the queue. */
|
|
31
|
+
readonly universeId: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Parsed representation of a memory-store queue item, as returned by the
|
|
35
|
+
* Open Cloud `Cloud_CreateMemoryStoreQueueItem` and (inside the array)
|
|
36
|
+
* `Cloud_ReadMemoryStoreQueueItems` endpoints.
|
|
37
|
+
*/
|
|
38
|
+
interface QueueItem {
|
|
39
|
+
/** Server-generated item identifier, parsed from the wire `path`. */
|
|
40
|
+
readonly id: string;
|
|
41
|
+
/**
|
|
42
|
+
* Opaque queue payload. Nested `null` values inside the JSON shape are
|
|
43
|
+
* preserved verbatim; only the top level is constrained.
|
|
44
|
+
*/
|
|
45
|
+
readonly data: Exclude<JSONValue, null>;
|
|
46
|
+
/** Timestamp at which the server removes the item from the queue. */
|
|
47
|
+
readonly expiresAt: Date;
|
|
48
|
+
/** Priority recorded on the item, or `undefined` when none was set. */
|
|
49
|
+
readonly priority: number | undefined;
|
|
50
|
+
/** Stringified queue identifier, parsed from the wire `path`. */
|
|
51
|
+
readonly queueId: string;
|
|
52
|
+
/** Stringified universe identifier, parsed from the wire `path`. */
|
|
53
|
+
readonly universeId: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Caller-supplied input for the `dequeue` method on
|
|
57
|
+
* `StorageClient.queues`. Mirrors `Cloud_ReadMemoryStoreQueueItems`.
|
|
58
|
+
*/
|
|
59
|
+
interface DequeueQueueItemsParameters {
|
|
60
|
+
/**
|
|
61
|
+
* If `true`, the server returns 404 when fewer than `count` items
|
|
62
|
+
* are available. Defaults to `false`, in which case the server
|
|
63
|
+
* returns whatever subset is currently at the front of the queue.
|
|
64
|
+
*/
|
|
65
|
+
readonly allOrNothing?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Number of items to read from the front of the queue. Defaults to
|
|
68
|
+
* `1`; values above `200` are clamped server-side.
|
|
69
|
+
*/
|
|
70
|
+
readonly count?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Number of seconds the dequeued items remain invisible to
|
|
73
|
+
* subsequent reads. Items not acknowledged via `discard` reappear
|
|
74
|
+
* once the window elapses. Defaults to `30` seconds server-side.
|
|
75
|
+
*/
|
|
76
|
+
readonly invisibilityWindow?: number;
|
|
77
|
+
/** Stringified queue identifier. */
|
|
78
|
+
readonly queueId: string;
|
|
79
|
+
/** Stringified ID of the universe that owns the queue. */
|
|
80
|
+
readonly universeId: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Parsed result of a successful `Cloud_ReadMemoryStoreQueueItems`
|
|
84
|
+
* response. The `readId` value must be passed to a subsequent
|
|
85
|
+
* `discard` call to acknowledge the items; otherwise the items reappear
|
|
86
|
+
* once the invisibility window elapses.
|
|
87
|
+
*/
|
|
88
|
+
interface DequeueResult {
|
|
89
|
+
/** Items dequeued from the front of the queue, in dequeue order. */
|
|
90
|
+
readonly items: ReadonlyArray<QueueItem>;
|
|
91
|
+
/**
|
|
92
|
+
* Identifier of the dequeue operation. Pass this to `discard` to
|
|
93
|
+
* remove the items from the queue permanently.
|
|
94
|
+
*/
|
|
95
|
+
readonly readId: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Caller-supplied input for the `discard` method on
|
|
99
|
+
* `StorageClient.queues`. Mirrors `Cloud_DiscardMemoryStoreQueueItems`.
|
|
100
|
+
* Acknowledging a `readId` removes the dequeued batch from the queue
|
|
101
|
+
* permanently; without `discard`, the items reappear once their
|
|
102
|
+
* invisibility window elapses.
|
|
103
|
+
*/
|
|
104
|
+
interface DiscardQueueItemsParameters {
|
|
105
|
+
/** Stringified queue identifier. */
|
|
106
|
+
readonly queueId: string;
|
|
107
|
+
/** Identifier returned by a prior `dequeue` call. */
|
|
108
|
+
readonly readId: string;
|
|
109
|
+
/** Stringified ID of the universe that owns the queue. */
|
|
110
|
+
readonly universeId: string;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/internal/http/rate-limit-queue.d.ts
|
|
114
|
+
/**
|
|
115
|
+
* Identifies and bounds a single Roblox Open Cloud operation for rate
|
|
116
|
+
* limiting, e.g. `{ operationKey: "game-passes.create", maxPerSecond: 5 }`.
|
|
117
|
+
*/
|
|
118
|
+
interface OperationLimit {
|
|
119
|
+
/** Maximum sustained request rate in requests per second. */
|
|
120
|
+
readonly maxPerSecond: number;
|
|
121
|
+
/**
|
|
122
|
+
* Stable identifier for the operation (e.g. "game-passes.create"). Not
|
|
123
|
+
* consumed by the queue itself; callers use it to key per-operation
|
|
124
|
+
* queues in a registry (see GamePassesClient).
|
|
125
|
+
*/
|
|
126
|
+
readonly operationKey: string;
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/internal/http/retry.d.ts
|
|
130
|
+
/**
|
|
131
|
+
* Fully-resolved retry config shape that {@link mergeConfig} and
|
|
132
|
+
* {@link shouldRetry} operate on. Fields are required because this represents
|
|
133
|
+
* the post-defaulting, internal view — callers should supply every field (or
|
|
134
|
+
* resolve them via a test factory / client constructor). The partial,
|
|
135
|
+
* user-facing type lives on client construction options; method defaults and
|
|
136
|
+
* per-request overrides use `Partial<RetryResolvable>`.
|
|
137
|
+
*/
|
|
138
|
+
interface RetryResolvable {
|
|
139
|
+
/** Roblox Open Cloud API key. */
|
|
140
|
+
readonly apiKey: string;
|
|
141
|
+
/** Base URL for the Open Cloud API. */
|
|
142
|
+
readonly baseUrl: string;
|
|
143
|
+
/** Maximum retry attempts before giving up. */
|
|
144
|
+
readonly maxRetries: number;
|
|
145
|
+
/** Status codes that are eligible for retry. */
|
|
146
|
+
readonly retryableStatuses: ReadonlyArray<number>;
|
|
147
|
+
/** Fallback delay function when no server hint is available. */
|
|
148
|
+
readonly retryDelay: (attempt: number) => number;
|
|
149
|
+
/** Per-request timeout in milliseconds. */
|
|
150
|
+
readonly timeout: number;
|
|
151
|
+
}
|
|
152
|
+
/** Kind of HTTP method the merge is being performed for. */
|
|
153
|
+
type MethodKind = "create" | "idempotent";
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/internal/resource-client.d.ts
|
|
156
|
+
/**
|
|
157
|
+
* Describes a single resource method's shape for dispatch through
|
|
158
|
+
* `ResourceClient.execute`. Each resource client declares one module-level
|
|
159
|
+
* constant per public method; that constant binds the four resource-specific
|
|
160
|
+
* values (request builder, response parser, retry-policy method kind,
|
|
161
|
+
* operation-level rate limit) and flows through `execute` uniformly.
|
|
162
|
+
*
|
|
163
|
+
* @template P - The resource-specific parameter shape the builder
|
|
164
|
+
* accepts.
|
|
165
|
+
* @template T - The resource-specific parsed success type the parser
|
|
166
|
+
* produces.
|
|
167
|
+
*/
|
|
168
|
+
interface ResourceMethodSpec<P, T> {
|
|
169
|
+
/**
|
|
170
|
+
* Builds the pure {@link HttpRequest} for a single call. Returns a
|
|
171
|
+
* {@link Result} so a builder can short-circuit with a local error
|
|
172
|
+
* (typically a {@link OpenCloudError} subclass such as `ValidationError`)
|
|
173
|
+
* before any HTTP, queue, or retry work happens. Builders that cannot
|
|
174
|
+
* fail wrap their return as `{ data: request, success: true }`.
|
|
175
|
+
*/
|
|
176
|
+
readonly buildRequest: (parameters: P) => Result<HttpRequest, OpenCloudError>;
|
|
177
|
+
/** Method-level retry defaults merged into the resolved config. */
|
|
178
|
+
readonly methodDefaults: Partial<RetryResolvable>;
|
|
179
|
+
/**
|
|
180
|
+
* Method kind, controlling merge precedence: `"create"` lets method
|
|
181
|
+
* defaults win over client config so create safety cannot be relaxed
|
|
182
|
+
* silently; `"idempotent"` lets client config win over method defaults
|
|
183
|
+
* so consumers can loosen retry globally.
|
|
184
|
+
*/
|
|
185
|
+
readonly methodKind: MethodKind;
|
|
186
|
+
/** Operation-level rate limit, keyed into the client's per-key queue map. */
|
|
187
|
+
readonly operationLimit: OperationLimit;
|
|
188
|
+
/**
|
|
189
|
+
* Converts the full {@link HttpResponse} into the resource-specific
|
|
190
|
+
* parsed shape. Takes the whole response (body, status, headers) so
|
|
191
|
+
* future parsers can read headers without widening the signature.
|
|
192
|
+
*/
|
|
193
|
+
readonly parse: (response: HttpResponse) => Result<T, OpenCloudError>;
|
|
194
|
+
/**
|
|
195
|
+
* Open Cloud scopes the API key or OAuth token must carry for this
|
|
196
|
+
* method, sourced from the vendored OpenAPI schema's `x-roblox-scopes`.
|
|
197
|
+
* When set, a 401 or 403 ApiError from the upstream call is upgraded to
|
|
198
|
+
* a {@link PermissionError} carrying these scopes alongside
|
|
199
|
+
* {@link OperationLimit.operationKey}, so callers can name the missing
|
|
200
|
+
* scope instead of just the HTTP status. Optional so test specs and
|
|
201
|
+
* not-yet-wired resources can opt out.
|
|
202
|
+
*/
|
|
203
|
+
readonly requiredScopes?: ReadonlyArray<string>;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Single-argument bundle consumed by `ResourceClient.execute`: the per-method
|
|
207
|
+
* spec, the resource-specific parameters, and optional per-request config
|
|
208
|
+
* overrides.
|
|
209
|
+
*
|
|
210
|
+
* @template P - The resource-specific parameter shape the builder accepts.
|
|
211
|
+
* @template T - The resource-specific parsed success type the parser produces.
|
|
212
|
+
*/
|
|
213
|
+
interface ExecuteCall<P, T> {
|
|
214
|
+
/** Optional per-request config overrides. */
|
|
215
|
+
readonly options?: RequestOptions | undefined;
|
|
216
|
+
/** Resource-specific request parameters. */
|
|
217
|
+
readonly parameters: P;
|
|
218
|
+
/** Per-method binding of builder, parser, method kind, and operation limit. */
|
|
219
|
+
readonly spec: ResourceMethodSpec<P, T>;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Wraps an infallible request build as a {@link Result}-returning
|
|
223
|
+
* `buildRequest` callback compatible with {@link ResourceMethodSpec}.
|
|
224
|
+
* Use from a resource client whose builder cannot fail; resource clients
|
|
225
|
+
* with local validation should construct the {@link Result} directly.
|
|
226
|
+
*
|
|
227
|
+
* @param request - The pre-built {@link HttpRequest}.
|
|
228
|
+
* @returns A success Result wrapping the request.
|
|
229
|
+
*/
|
|
230
|
+
/**
|
|
231
|
+
* Internal orchestrator shared by every Open Cloud resource client. Holds
|
|
232
|
+
* the frozen client config, observability hooks, injected HTTP client and
|
|
233
|
+
* sleep, and the per-effective-key rate-limit queue registry. Resource
|
|
234
|
+
* classes compose one instance and dispatch every public method through
|
|
235
|
+
* {@link ResourceClient.execute} with a per-method {@link ResourceMethodSpec}.
|
|
236
|
+
* Not exported from any package subpath; reachable only via sibling
|
|
237
|
+
* `src/resources/**` modules in this package.
|
|
238
|
+
*/
|
|
239
|
+
declare class ResourceClient {
|
|
240
|
+
#private;
|
|
241
|
+
/**
|
|
242
|
+
* Creates a new {@link ResourceClient}. Resolves the injected HTTP
|
|
243
|
+
* client and sleep (defaulting to fetch + `setTimeout`) and freezes the
|
|
244
|
+
* merged client config so subsequent calls cannot mutate it.
|
|
245
|
+
*
|
|
246
|
+
* @param options - Client-level configuration including the API key
|
|
247
|
+
* and optional construction-time test seams.
|
|
248
|
+
*/
|
|
249
|
+
constructor(options: OpenCloudClientOptions);
|
|
250
|
+
/**
|
|
251
|
+
* Dispatches a single resource-method call. Merges the frozen client
|
|
252
|
+
* config with the method's `methodDefaults` and the caller's optional
|
|
253
|
+
* per-request `options`, routes through the effective-apiKey rate-limit
|
|
254
|
+
* queue, runs the retry loop, and finally parses the response with the
|
|
255
|
+
* spec's parser.
|
|
256
|
+
*
|
|
257
|
+
* @param call - The per-method spec, resource-specific parameters, and
|
|
258
|
+
* optional per-request overrides.
|
|
259
|
+
* @returns The parsed success payload or the {@link OpenCloudError} that
|
|
260
|
+
* caused the request to fail. Never throws.
|
|
261
|
+
*/
|
|
262
|
+
execute<P, T>(call: ExecuteCall<P, T>): Promise<Result<T, OpenCloudError>>;
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/resources/storage/queues-group.d.ts
|
|
266
|
+
/**
|
|
267
|
+
* Operation Group on `StorageClient` that exposes the memory-store
|
|
268
|
+
* queue endpoints. Queues are FIFO collections of opaque JSON values
|
|
269
|
+
* with optional priority and TTL; consumers enqueue items, dequeue
|
|
270
|
+
* them in batches, and acknowledge processed batches with a read
|
|
271
|
+
* identifier.
|
|
272
|
+
*/
|
|
273
|
+
declare class MemoryStoreQueuesGroup {
|
|
274
|
+
#private;
|
|
275
|
+
/**
|
|
276
|
+
* Wraps the shared {@link ResourceClient} so the Operation Group
|
|
277
|
+
* routes calls through the same retry, hooks, and rate-limit queues
|
|
278
|
+
* as the rest of the parent client.
|
|
279
|
+
*
|
|
280
|
+
* @param inner - The shared {@link ResourceClient} owned by the
|
|
281
|
+
* parent client.
|
|
282
|
+
*/
|
|
283
|
+
constructor(inner: ResourceClient);
|
|
284
|
+
/**
|
|
285
|
+
* Dequeues up to `count` items from the front of the queue. Items
|
|
286
|
+
* returned become invisible to subsequent reads for
|
|
287
|
+
* `invisibilityWindow` seconds (default 30 server-side); they
|
|
288
|
+
* reappear once the window elapses unless acknowledged via
|
|
289
|
+
* `discard` with the returned `readId`.
|
|
290
|
+
*
|
|
291
|
+
* On 5xx, dequeue does not retry: the server may have set
|
|
292
|
+
* invisibility on a batch before the response failed, so a retry
|
|
293
|
+
* would return a *different* batch and the first one is lost until
|
|
294
|
+
* the window expires. Callers that can detect duplicates externally
|
|
295
|
+
* may opt back into 5xx retry per call by passing `retryableStatuses`
|
|
296
|
+
* on `options`.
|
|
297
|
+
*
|
|
298
|
+
* @param parameters - Universe and queue identifiers, plus optional
|
|
299
|
+
* `count`, `allOrNothing`, and `invisibilityWindow`.
|
|
300
|
+
* @param options - Optional per-request overrides.
|
|
301
|
+
* @returns A {@link Result} wrapping the parsed {@link DequeueResult}
|
|
302
|
+
* or the {@link OpenCloudError} that caused the request to fail.
|
|
303
|
+
*/
|
|
304
|
+
dequeue(parameters: DequeueQueueItemsParameters, options?: RequestOptions): Promise<Result<DequeueResult, OpenCloudError>>;
|
|
305
|
+
/**
|
|
306
|
+
* Acknowledges a dequeued batch of items, removing them from the
|
|
307
|
+
* queue permanently. Pass the `readId` returned from the prior
|
|
308
|
+
* `dequeue` call. Without `discard`, the items reappear once the
|
|
309
|
+
* invisibility window elapses.
|
|
310
|
+
*
|
|
311
|
+
* The call is idempotent: a second `discard` with the same `readId`
|
|
312
|
+
* is a no-op once the batch has been acknowledged. The retry policy
|
|
313
|
+
* therefore retries both 429 and 5xx.
|
|
314
|
+
*
|
|
315
|
+
* @param parameters - Universe and queue identifiers, plus the
|
|
316
|
+
* `readId` returned from a prior dequeue.
|
|
317
|
+
* @param options - Optional per-request overrides.
|
|
318
|
+
* @returns A {@link Result} wrapping `undefined` on success (the
|
|
319
|
+
* server returns an empty body) or the {@link OpenCloudError}
|
|
320
|
+
* that caused the request to fail.
|
|
321
|
+
*/
|
|
322
|
+
discard(parameters: DiscardQueueItemsParameters, options?: RequestOptions): Promise<Result<undefined, OpenCloudError>>;
|
|
323
|
+
/**
|
|
324
|
+
* Enqueues a single item onto a memory-store queue. The queue is
|
|
325
|
+
* auto-created on first use; the queue identifier is any string the
|
|
326
|
+
* caller picks. Items with higher `priority` values are dequeued
|
|
327
|
+
* first; equal priorities preserve insertion order. Items expire
|
|
328
|
+
* and are removed automatically after `ttl` seconds, or after a
|
|
329
|
+
* server-default lifetime when omitted.
|
|
330
|
+
*
|
|
331
|
+
* @param parameters - Universe and queue identifiers, the opaque
|
|
332
|
+
* payload, and optional `priority` and `ttl`.
|
|
333
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
334
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
335
|
+
* @returns A {@link Result} wrapping the parsed {@link QueueItem} or
|
|
336
|
+
* the {@link OpenCloudError} that caused the request to fail.
|
|
337
|
+
*/
|
|
338
|
+
enqueue(parameters: EnqueueQueueItemParameters, options?: RequestOptions): Promise<Result<QueueItem, OpenCloudError>>;
|
|
339
|
+
}
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/resources/storage/client.d.ts
|
|
342
|
+
/**
|
|
343
|
+
* Public client for the Roblox Open Cloud `Data and memory stores`
|
|
344
|
+
* Feature. Today it covers memory-store queues via the
|
|
345
|
+
* {@link StorageClient.queues} Operation Group; future Operation
|
|
346
|
+
* Groups for sorted maps and data stores slot in as siblings on the
|
|
347
|
+
* same client.
|
|
348
|
+
*
|
|
349
|
+
* Every method returns a `Result` so callers handle failure
|
|
350
|
+
* explicitly; no thrown error ever escapes the client.
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
*
|
|
354
|
+
* ```ts
|
|
355
|
+
* import { StorageClient } from "@bedrock-rbx/ocale/storage";
|
|
356
|
+
*
|
|
357
|
+
* const client = new StorageClient({ apiKey: "your-key" });
|
|
358
|
+
* expect(client).toBeInstanceOf(StorageClient);
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
declare class StorageClient {
|
|
362
|
+
/** Memory-store queue Operation Group. */
|
|
363
|
+
readonly queues: MemoryStoreQueuesGroup;
|
|
364
|
+
/**
|
|
365
|
+
* Creates a new {@link StorageClient}. Configuration is frozen on
|
|
366
|
+
* construction; per-request overrides are accepted on each method.
|
|
367
|
+
*
|
|
368
|
+
* @param options - Client-level configuration including the API key.
|
|
369
|
+
*/
|
|
370
|
+
constructor(options: OpenCloudClientOptions);
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
export { type DequeueQueueItemsParameters, type DequeueResult, type DiscardQueueItemsParameters, type EnqueueQueueItemParameters, type QueueItem, StorageClient };
|
|
374
|
+
//# sourceMappingURL=storage.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.mts","names":[],"sources":["../src/domains/cloud-v2/memory-store-queues/types.ts","../src/internal/http/rate-limit-queue.ts","../src/internal/http/retry.ts","../src/internal/resource-client.ts","../src/resources/storage/queues-group.ts","../src/resources/storage/client.ts"],"mappings":";;;;;;AAIA;UAAiB,0BAAA;;;;;;;WAOP,IAAA,EAAM,OAAA,CAAQ,SAAA;;;;;AAwBxB;WAlBU,QAAA;;WAEA,OAAA;;;;;;WAMA,GAAA;;WAEA,UAAA;AAAA;;;;;;UAQO,SAAA;EAsBjB;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