@bedrock-rbx/ocale 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/assets.d.mts +64 -0
- package/dist/assets.d.mts.map +1 -0
- package/dist/assets.mjs +301 -0
- package/dist/assets.mjs.map +1 -0
- package/dist/badge-insufficient-funds-BLFvQZt1.mjs +91 -0
- package/dist/badge-insufficient-funds-BLFvQZt1.mjs.map +1 -0
- package/dist/badges.d.mts +136 -17
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +375 -99
- package/dist/badges.mjs.map +1 -1
- package/dist/{capacity-admission-hycCFkTo.d.mts → capacity-admission-Ce2V9QNb.d.mts} +2 -10
- package/dist/capacity-admission-Ce2V9QNb.d.mts.map +1 -0
- package/dist/{data.generated-D_vpa5-g.d.mts → data.generated-B4Fztv_7.d.mts} +1 -3
- package/dist/{data.generated-D_vpa5-g.d.mts.map → data.generated-B4Fztv_7.d.mts.map} +1 -1
- package/dist/developer-products.d.mts +29 -11
- package/dist/developer-products.d.mts.map +1 -1
- package/dist/developer-products.mjs +104 -18
- package/dist/developer-products.mjs.map +1 -1
- package/dist/game-passes.d.mts +2 -10
- package/dist/game-passes.d.mts.map +1 -1
- package/dist/game-passes.mjs +12 -18
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +58 -39
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +9 -12
- package/dist/index.mjs.map +1 -1
- package/dist/is-date-time-string-C91G44SI.mjs +19 -0
- package/dist/is-date-time-string-C91G44SI.mjs.map +1 -0
- package/dist/locales.d.mts +1 -3
- package/dist/locales.d.mts.map +1 -1
- package/dist/locales.mjs +2 -4
- package/dist/locales.mjs.map +1 -1
- package/dist/luau-execution.d.mts +2 -8
- package/dist/luau-execution.d.mts.map +1 -1
- package/dist/luau-execution.mjs +7 -11
- package/dist/luau-execution.mjs.map +1 -1
- package/dist/{network-error-iVSng5MT.mjs → network-error-P4An7nUB.mjs} +5 -9
- package/dist/{network-error-iVSng5MT.mjs.map → network-error-P4An7nUB.mjs.map} +1 -1
- package/dist/places.d.mts +57 -9
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +127 -21
- package/dist/places.mjs.map +1 -1
- package/dist/{poll-timeout-DzztDymd.mjs → poll-timeout-BCxgN97O.mjs} +4 -6
- package/dist/{poll-timeout-DzztDymd.mjs.map → poll-timeout-BCxgN97O.mjs.map} +1 -1
- package/dist/{polling-helpers-DfF5dspc.mjs → polling-helpers-BtEYR5dN.mjs} +19 -30
- package/dist/polling-helpers-BtEYR5dN.mjs.map +1 -0
- package/dist/{price-information-DEkEQ8Pq.mjs → price-information--d6GZAcp.mjs} +3 -4
- package/dist/{price-information-DEkEQ8Pq.mjs.map → price-information--d6GZAcp.mjs.map} +1 -1
- package/dist/{resource-client-BCKukheG.d.mts → resource-client-CF8SPsV8.d.mts} +3 -9
- package/dist/resource-client-CF8SPsV8.d.mts.map +1 -0
- package/dist/{resource-client-CaIVr-go.mjs → resource-client-Cm_bPcCs.mjs} +23 -59
- package/dist/resource-client-Cm_bPcCs.mjs.map +1 -0
- package/dist/{retry-C2oHesDx.d.mts → retry-DYxm_eBU.d.mts} +2 -6
- package/dist/retry-DYxm_eBU.d.mts.map +1 -0
- package/dist/{retry-CMRDvAR4.mjs → retry-Dv5TsY9O.mjs} +50 -52
- package/dist/retry-Dv5TsY9O.mjs.map +1 -0
- package/dist/{signatures-JF-7Psce.mjs → signatures-CtJ7jfVN.mjs} +2 -3
- package/dist/{signatures-JF-7Psce.mjs.map → signatures-CtJ7jfVN.mjs.map} +1 -1
- package/dist/storage.d.mts +2 -12
- package/dist/storage.d.mts.map +1 -1
- package/dist/storage.mjs +12 -20
- package/dist/storage.mjs.map +1 -1
- package/dist/testing.d.mts +2 -54
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +16 -30
- package/dist/testing.mjs.map +1 -1
- package/dist/{to-blob-RPqMBuft.mjs → to-blob-Bqu7bmlE.mjs} +2 -3
- package/dist/{to-blob-RPqMBuft.mjs.map → to-blob-Bqu7bmlE.mjs.map} +1 -1
- package/dist/{types-CdMr_J1M.d.mts → types-Z4abDJfK.d.mts} +1 -9
- package/dist/types-Z4abDJfK.d.mts.map +1 -0
- package/dist/universes.d.mts +4 -18
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +27 -47
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-964VNlbp.mjs → validation-kaTLLAD1.mjs} +3 -4
- package/dist/{validation-964VNlbp.mjs.map → validation-kaTLLAD1.mjs.map} +1 -1
- package/dist/{wire-DJqupefn.d.mts → wire-DDG87I-d.d.mts} +1 -3
- package/dist/wire-DDG87I-d.d.mts.map +1 -0
- package/package.json +8 -7
- package/dist/badge-cost-mismatch-DrlvhlQc.mjs +0 -47
- package/dist/badge-cost-mismatch-DrlvhlQc.mjs.map +0 -1
- package/dist/capacity-admission-hycCFkTo.d.mts.map +0 -1
- package/dist/polling-helpers-DfF5dspc.mjs.map +0 -1
- package/dist/resource-client-BCKukheG.d.mts.map +0 -1
- package/dist/resource-client-CaIVr-go.mjs.map +0 -1
- package/dist/retry-C2oHesDx.d.mts.map +0 -1
- package/dist/retry-CMRDvAR4.mjs.map +0 -1
- package/dist/types-CdMr_J1M.d.mts.map +0 -1
- package/dist/wire-DJqupefn.d.mts.map +0 -1
package/dist/places.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"places.mjs","names":["SECONDS_PER_MINUTE"],"sources":["../src/domains/cloud-v2/places/builders.ts","../src/domains/cloud-v2/places/operations.ts","../src/domains/cloud-v2/places/parsers.ts","../src/domains/universes/places/builders.ts","../src/domains/universes/places/operations.ts","../src/domains/universes/places/parsers.ts","../src/resources/places/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport type { OpenCloudError } from \"../../../errors/base.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport { okRequest } from \"../../../internal/resource-client.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { GetPlaceParameters, UpdatePlaceParameters } from \"./types.ts\";\n\nconst NON_UPDATABLE_KEYS: ReadonlySet<string> = new Set([\"placeId\", \"universeId\"]);\n\n/**\n * Build a read-only lookup of a place's configuration, including its root flag.\n *\n * @param parameters - Owning universe and place identifiers.\n * @returns A read-only request carrying both identifiers in the URL.\n */\nexport function buildGetRequest(\n\tparameters: GetPlaceParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest({\n\t\tmethod: \"GET\",\n\t\turl: `/cloud/v2/universes/${parameters.universeId}/places/${parameters.placeId}`,\n\t});\n}\n\n/**\n * Builds a `PATCH` request for the Open Cloud \"update place\" endpoint.\n * Derives the `updateMask` query string from the keys present on\n * `parameters` (excluding the identifiers) and emits a JSON body\n * containing those same fields.\n *\n * @param parameters - The universe and place identifiers plus the fields\n * to update.\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when no updatable fields were supplied.\n */\nexport function buildUpdateRequest(\n\tparameters: UpdatePlaceParameters,\n): Result<HttpRequest, ValidationError> {\n\tconst fieldKeys = extractUpdateFieldKeys(parameters);\n\n\tif (fieldKeys.length === 0) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Update must include at least one field\", {\n\t\t\t\tcode: \"empty_update\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst body = Object.fromEntries(\n\t\tfieldKeys.map((key): readonly [string, unknown] => [key, Reflect.get(parameters, key)]),\n\t);\n\tconst updateMask = fieldKeys.join(\",\");\n\tconst { placeId, universeId } = parameters;\n\treturn {\n\t\tdata: {\n\t\t\tbody,\n\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t\tmethod: \"PATCH\",\n\t\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}?updateMask=${updateMask}`,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction extractUpdateFieldKeys(parameters: UpdatePlaceParameters): ReadonlyArray<string> {\n\treturn Object.keys(parameters).filter((key) => !NON_UPDATABLE_KEYS.has(key));\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst UPDATE_PER_MINUTE = 100;\nconst SECONDS_PER_MINUTE = 60;\n\n/** Read quota from the Cloud_GetPlace operation: 100 requests per minute. */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / SECONDS_PER_MINUTE,\n\toperationKey: \"places.get\",\n});\n\n/**\n * Per-second request ceiling for updating a place, from the Open Cloud\n * OpenAPI schema (100 requests per minute per API key owner). Keyed\n * independently from the publish operation so publish and update do\n * not share a queue; upstream quota accounting is not documented as\n * shared and the conservative default is fewer cross-method\n * contention surprises.\n */\nexport const UPDATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: UPDATE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"places.update\",\n});\n\n/**\n * Scopes required to update a place's metadata, sourced from\n * `x-roblox-scopes` on the `Cloud_UpdatePlace` operation in the vendored\n * OpenAPI schema.\n */\nexport const UPDATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place:write\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport { isDateTimeString } from \"../../../internal/utils/is-date-time-string.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { Place } from \"./types.ts\";\nimport type { PlaceWire } from \"./wire.ts\";\n\nconst MALFORMED_PLACE_MESSAGE = \"Malformed place response\";\n\nconst PLACE_PATH_PATTERN = /^universes\\/(\\d+)\\/places\\/(\\d+)$/;\n\ninterface ToPlaceArgs {\n\treadonly id: string;\n\treadonly body: PlaceWire;\n\treadonly universeId: string;\n}\n\n/**\n * Parses a successful Open Cloud `Place` response body into the public\n * {@link Place} shape.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link Place}, or an\n * {@link UnexpectedResponseError} when the body does not match the wire\n * schema.\n */\nexport function parsePlaceResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<Place, UnexpectedResponseError> {\n\tif (!isPlaceWire(body)) {\n\t\treturn malformedPlace(statusCode, body);\n\t}\n\n\tconst match = PLACE_PATH_PATTERN.exec(body.path);\n\tconst universeId = match?.[1];\n\tconst id = match?.[2];\n\tif (id === undefined || universeId === undefined) {\n\t\treturn malformedPlace(statusCode, body);\n\t}\n\n\treturn { data: toPlace({ id, body, universeId }), success: true };\n}\n\nfunction malformedPlace(statusCode: number, body: unknown): Result<Place, UnexpectedResponseError> {\n\treturn {\n\t\terr: new UnexpectedResponseError(MALFORMED_PLACE_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n\nfunction toPlace({ id, body, universeId }: ToPlaceArgs): Place {\n\treturn {\n\t\tid,\n\t\tcreatedAt: new Date(body.createTime),\n\t\tdescription: body.description,\n\t\tdisplayName: body.displayName,\n\t\troot: body.root ?? false,\n\t\tserverSize: body.serverSize ?? undefined,\n\t\tuniverseId,\n\t\tuniverseRuntimeCreation: body.universeRuntimeCreation ?? false,\n\t\tupdatedAt: new Date(body.updateTime),\n\t};\n}\n\nfunction hasValidPlaceRequired(body: Record<string, unknown>): boolean {\n\treturn (\n\t\ttypeof body[\"path\"] === \"string\" &&\n\t\tisDateTimeString(body[\"createTime\"]) &&\n\t\tisDateTimeString(body[\"updateTime\"]) &&\n\t\ttypeof body[\"displayName\"] === \"string\" &&\n\t\ttypeof body[\"description\"] === \"string\"\n\t);\n}\n\nfunction isOptionalBoolean(value: unknown): boolean {\n\treturn value === undefined || value === null || typeof value === \"boolean\";\n}\n\nfunction hasValidPlaceOptional(body: Record<string, unknown>): boolean {\n\tconst serverSize = body[\"serverSize\"] ?? undefined;\n\treturn (\n\t\t(serverSize === undefined || typeof serverSize === \"number\") &&\n\t\tisOptionalBoolean(body[\"root\"]) &&\n\t\tisOptionalBoolean(body[\"universeRuntimeCreation\"])\n\t);\n}\n\nfunction isPlaceWire(body: unknown): body is PlaceWire {\n\treturn isRecord(body) && hasValidPlaceRequired(body) && hasValidPlaceOptional(body);\n}\n","import type { HttpRequest } from \"../../../client/types.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport { matchesSignature, RBXL_SIGNATURE, RBXLX_SIGNATURE } from \"./signatures.ts\";\nimport type { PublishParameters } from \"./types.ts\";\n\n/**\n * Whether a publish call writes a live (`Published`) or draft (`Saved`)\n * version. Surfaces only as the `versionType` query string on the\n * underlying HTTP request.\n */\ntype VersionType = \"Published\" | \"Saved\";\n\nconst CONTENT_TYPE_BY_FORMAT: Readonly<Record<PublishParameters[\"format\"], string>> = {\n\trbxl: \"application/octet-stream\",\n\trbxlx: \"application/xml\",\n};\n\n/**\n * Builds a `POST` request for the Open Cloud \"publish place version\"\n * endpoint. Performs two local validations before producing any\n * {@link HttpRequest}: a non-empty body check and a magic-byte check\n * that the bytes' actual format matches `parameters.format`.\n *\n * @param parameters - Universe and place identifiers, the place file\n * bytes, and the declared `format` of those bytes.\n * @param versionType - `\"Published\"` for `publish()`, `\"Saved\"` for\n * `save()`; baked into the `?versionType=` query string.\n * @returns A success result wrapping the request on success, or a\n * {@link ValidationError} when the body is empty or its magic bytes\n * disagree with `parameters.format`.\n */\nexport function buildPublishRequest(\n\t{ body, format, placeId, universeId }: PublishParameters,\n\tversionType: VersionType,\n): Result<HttpRequest, ValidationError> {\n\tconst validationError = validateBody(body, format);\n\tif (validationError !== undefined) {\n\t\treturn { err: validationError, success: false };\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbody,\n\t\t\theaders: { \"content-type\": CONTENT_TYPE_BY_FORMAT[format] },\n\t\t\tmethod: \"POST\",\n\t\t\turl: `/universes/v1/${universeId}/places/${placeId}/versions?versionType=${versionType}`,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\n/**\n * Checks a place body against the format its caller declared: non-empty, and\n * carrying the magic bytes of `format`. Emptiness is checked first so a\n * zero-byte body reports `empty_body` rather than a signature mismatch.\n *\n * @param body - The raw place file bytes.\n * @param format - The format the caller declared the bytes to be in.\n * @returns The {@link ValidationError} to fail with, or `undefined` when the\n * body is usable.\n */\nfunction validateBody(\n\tbody: PublishParameters[\"body\"],\n\tformat: PublishParameters[\"format\"],\n): undefined | ValidationError {\n\tif (body.length === 0) {\n\t\treturn new ValidationError(\"Place body is empty\", { code: \"empty_body\" });\n\t}\n\n\tconst expectedSignature = format === \"rbxl\" ? RBXL_SIGNATURE : RBXLX_SIGNATURE;\n\tif (!matchesSignature(body, expectedSignature)) {\n\t\treturn new ValidationError(`Place body does not match the declared \"${format}\" format`, {\n\t\t\tcode: \"format_mismatch\",\n\t\t});\n\t}\n\n\treturn undefined;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst PUBLISH_PER_MINUTE = 30;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for publishing or saving a place version,\n * from the Open Cloud OpenAPI schema (30 requests per minute, which works\n * out to `0.5` per second and is also the burst the server allows). The\n * publish and save methods both reference this constant so that a single\n * per-API-key queue serves both, matching Roblox's server-side accounting\n * which counts both call types against the same per-minute quota.\n */\nexport const PUBLISH_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: PUBLISH_PER_MINUTE,\n\tmaxPerSecond: PUBLISH_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"places.publishVersion\",\n});\n\n/**\n * Scopes required to publish or save a place version, sourced from\n * `x-roblox-scopes` on the `Places_CreatePlaceVersionApiKey` operation\n * in the vendored OpenAPI schema.\n */\nexport const PUBLISH_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe-places:write\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { PlaceVersion } from \"./types.ts\";\nimport type { PlaceVersionWire } from \"./wire.ts\";\n\n/**\n * Parses a successful publish-version response into the public\n * {@link PlaceVersion} shape. The Roblox endpoint sometimes returns the\n * JSON-shaped body under a `text/plain` `Content-Type`, so the body may\n * arrive either pre-decoded as a JSON object or still in its raw string\n * form; both are accepted here.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link PlaceVersion}, or\n * an {@link UnexpectedResponseError} when the body is malformed or its\n * `versionNumber` field is missing/wrong-typed.\n */\nexport function parsePublishResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<PlaceVersion, UnexpectedResponseError> {\n\tconst decodeResult = decodeBody(body, statusCode);\n\tif (!decodeResult.success) {\n\t\treturn decodeResult;\n\t}\n\n\tif (!isPlaceVersionWire(decodeResult.data)) {\n\t\treturn {\n\t\t\terr: new UnexpectedResponseError(\"Malformed publish response\", {\n\t\t\t\tdetails: toJsonDetails(body),\n\t\t\t\tstatusCode,\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn {\n\t\tdata: { versionNumber: decodeResult.data.versionNumber },\n\t\tsuccess: true,\n\t};\n}\n\nfunction decodeBody(body: unknown, statusCode: number): Result<unknown, UnexpectedResponseError> {\n\tif (typeof body !== \"string\") {\n\t\treturn { data: body, success: true };\n\t}\n\n\ttry {\n\t\treturn { data: JSON.parse(body), success: true };\n\t} catch (err) {\n\t\treturn {\n\t\t\terr: new UnexpectedResponseError(\"Malformed publish response\", {\n\t\t\t\tcause: err,\n\t\t\t\tdetails: body,\n\t\t\t\tstatusCode,\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n}\n\nfunction isPlaceVersionWire(value: unknown): value is PlaceVersionWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn typeof value[\"versionNumber\"] === \"number\";\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport { LIST_LOGS_SPEC } from \"../../domains/cloud-v2/luau-execution-task-logs/specs.ts\";\nimport type {\n\tListLogsParameters,\n\tLogPage,\n} from \"../../domains/cloud-v2/luau-execution-task-logs/types.ts\";\nimport { GET_SPEC } from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport { buildGetRequest, buildUpdateRequest } from \"../../domains/cloud-v2/places/builders.ts\";\nimport {\n\tGET_OPERATION_LIMIT,\n\tUPDATE_OPERATION_LIMIT,\n\tUPDATE_REQUIRED_SCOPES,\n} from \"../../domains/cloud-v2/places/operations.ts\";\nimport { parsePlaceResponse } from \"../../domains/cloud-v2/places/parsers.ts\";\nimport type {\n\tGetPlaceParameters,\n\tPlace,\n\tUpdatePlaceParameters,\n} from \"../../domains/cloud-v2/places/types.ts\";\nimport { buildPublishRequest } from \"../../domains/universes/places/builders.ts\";\nimport {\n\tPUBLISH_OPERATION_LIMIT,\n\tPUBLISH_REQUIRED_SCOPES,\n} from \"../../domains/universes/places/operations.ts\";\nimport { parsePublishResponse } from \"../../domains/universes/places/parsers.ts\";\nimport type { PlaceVersion, PublishParameters } from \"../../domains/universes/places/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { UPLOAD_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport { ResourceClient, type ResourceMethodSpec } from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\nimport {\n\ttype LuauExecutionRunOptions,\n\ttype LuauExecutionSubmitOptions,\n\tsubmitWithCapacityAsync,\n} from \"../luau-execution/capacity-admission.ts\";\nimport { buildPollDependencies, submitAndPollAsync } from \"../luau-execution/polling-helpers.ts\";\nimport {\n\tpollUntilDoneCoreAsync,\n\ttype PollUntilDoneOptions,\n\twithBudgetRequestTimeout,\n} from \"../luau-execution/polling.ts\";\n\n/**\n * Operation Group exposed by {@link PlacesClient} as the\n * `luauExecution` namespace. Provides `submit` to queue a Luau script,\n * `get` to fetch a task's current state, and `listLogs` to retrieve\n * structured log messages. Shares the same dispatch wiring as the\n * top-level `LuauExecutionClient` exposed at\n * `@bedrock-rbx/ocale/luau-execution`.\n *\n * @since 0.1.0\n */\nexport interface LuauExecutionHandle {\n\t/**\n\t * Fetches the current state of a previously-submitted Luau\n\t * execution task. Uses idempotent retry semantics for both 429 and\n\t * 5xx.\n\t *\n\t * @param parameters - The task ref plus an optional `view` selector.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tget(\n\t\tparameters: GetParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Lists one page of structured log messages produced by a\n\t * previously-submitted Luau execution task. Messages from multiple\n\t * server-side chunks are flattened into a single ordered array.\n\t * Uses idempotent retry semantics for both 429 and 5xx.\n\t *\n\t * @param parameters - The task ref and optional pagination controls\n\t * (`pageSize`, `pageToken`).\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link LogPage} or\n\t * the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tlistLogs(\n\t\tparameters: ListLogsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LogPage, OpenCloudError>>;\n\t/**\n\t * Polls `get` with `view=BASIC` on a configurable backoff schedule until\n\t * the task reaches a terminal state, the wall-clock budget is exhausted,\n\t * or the supplied `AbortSignal` fires. Returns the terminal task on\n\t * success. The budget also bounds an in-flight\n\t * request through its request deadline, so a hanging request ends with\n\t * `PollTimeoutError` at the budget.\n\t *\n\t * @param ref - Reference to the task to poll, typically returned by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask},\n\t * or an error if aborted, timed out, or the transport fails.\n\t */\n\tpollUntilDone(\n\t\tref: LuauExecutionTaskRef,\n\t\toptions?: PollUntilDoneOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script and polls `get` with `view=BASIC` until the\n\t * task reaches a terminal state, the wall-clock budget is exhausted,\n\t * or the supplied `AbortSignal` fires. Combines `submit` and\n\t * `pollUntilDone` in one call. The budget opens before the submit\n\t * and covers it, and bounds each in-flight request through its request\n\t * deadline.\n\t *\n\t * @param parameters - The same input accepted by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal\n\t * {@link LuauExecutionTask}, or an error if submit fails, the task\n\t * is aborted, timed out, or the transport fails.\n\t */\n\trunUntilDone(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: LuauExecutionRunOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script for execution against a place. Dispatches\n\t * to the head-version URL when `versionId` is omitted, or to the\n\t * specific-version URL when one is supplied. Both URL shapes share\n\t * one rate-limit queue and one required-scope set.\n\t *\n\t * @param parameters - The universe and place identifiers, the\n\t * script to run, an optional `versionId`, and any other writable\n\t * submit fields.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tsubmit(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: LuauExecutionSubmitOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n}\n\nfunction makePublishSpec(\n\tversionType: \"Published\" | \"Saved\",\n): ResourceMethodSpec<PublishParameters, PlaceVersion> {\n\treturn Object.freeze({\n\t\tapiKeyOnly: true,\n\t\tbuildRequest: (parameters: PublishParameters) => {\n\t\t\treturn buildPublishRequest(parameters, versionType);\n\t\t},\n\t\tmethodDefaults: UPLOAD_METHOD_DEFAULTS,\n\t\tmethodKind: \"create\",\n\t\toperationLimit: PUBLISH_OPERATION_LIMIT,\n\t\tparse: parsePublishResponse,\n\t\trequiredScopes: PUBLISH_REQUIRED_SCOPES,\n\t});\n}\n\nconst PUBLISH_SPEC = makePublishSpec(\"Published\");\nconst SAVE_SPEC = makePublishSpec(\"Saved\");\n\nconst GET_PLACE_SPEC: ResourceMethodSpec<GetPlaceParameters, Place> = Object.freeze({\n\tbuildRequest: buildGetRequest,\n\tmethodDefaults: {},\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parsePlaceResponse,\n});\n\nconst UPDATE_SPEC: ResourceMethodSpec<UpdatePlaceParameters, Place> = Object.freeze({\n\tbuildRequest: buildUpdateRequest,\n\tmethodDefaults: {},\n\tmethodKind: \"idempotent\",\n\toperationLimit: UPDATE_OPERATION_LIMIT,\n\tparse: parsePlaceResponse,\n\trequiredScopes: UPDATE_REQUIRED_SCOPES,\n});\n\n/**\n * Public client for the Roblox Open Cloud `Place` resource. Covers\n * place-version publishing (`publish`, `save`), place-configuration\n * updates (`update`), and the Luau execution Operation Group\n * (`luauExecution.submit`, `luauExecution.get`). Every method returns\n * a {@link Result} so callers handle failure explicitly; no thrown\n * {@link OpenCloudError} ever escapes the client.\n *\n * Publishing or saving a 5xx-failed place version is not retried\n * automatically: Roblox does not support idempotency keys, so a retry\n * could publish a duplicate version unnoticed. Callers that *can* detect\n * duplicates externally may opt back into 5xx retry per-call by passing\n * `retryableStatuses` on the second argument. The `update` method, by\n * contrast, is idempotent and retries both 429 and 5xx automatically.\n *\n * Failures that never reached Open Cloud *are* retried: transient transport\n * errors, and responses served by an edge gateway rather than the API. Neither\n * can have created a version, so neither risks the duplicate a 5xx does.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { PlacesClient } from \"@bedrock-rbx/ocale/places\";\n *\n * const client = new PlacesClient({ credential: { apiKey: \"your-key\", kind: \"apiKey\" } });\n * expect(client).toBeInstanceOf(PlacesClient);\n * ```\n */\nexport class PlacesClient {\n\treadonly #inner: ResourceClient;\n\n\tpublic readonly luauExecution: LuauExecutionHandle;\n\n\t/**\n\t * Creates a new {@link PlacesClient}. Configuration is frozen on\n\t * construction; per-request overrides are accepted on each method.\n\t *\n\t * @param options - Client-level configuration including the API key.\n\t */\n\tconstructor(options: OpenCloudClientOptions) {\n\t\tthis.#inner = new ResourceClient(options);\n\t\tthis.luauExecution = createLuauExecutionHandle(this.#inner);\n\t}\n\n\t/**\n\t * Reads a place's configuration, including whether it is the universe's\n\t * root.\n\t *\n\t * @since 0.4.0\n\t * @param parameters - Owning universe and place identifiers.\n\t * @param options - Per-request overrides.\n\t * @returns The parsed place or the Open Cloud failure.\n\t */\n\tpublic async get(\n\t\tparameters: GetPlaceParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Place, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: GET_PLACE_SPEC });\n\t}\n\n\t/**\n\t * Publishes a new live version of a place.\n\t *\n\t * No default request timeout applies to this upload; pass `options.timeout`\n\t * to set a per-call deadline.\n\t *\n\t * @param parameters - Universe and place identifiers, the place file\n\t * bytes, and their declared `format`.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link PlaceVersion}\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async publish(\n\t\tparameters: PublishParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<PlaceVersion, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: PUBLISH_SPEC });\n\t}\n\n\t/**\n\t * Saves a new draft version of a place. Identical to {@link publish}\n\t * except the resulting version is not made live; consumers can list or\n\t * promote it later. Shares a single per-API-key rate-limit queue with\n\t * `publish` because Roblox attributes both calls to the same per-minute\n\t * quota.\n\t *\n\t * No default request timeout applies to this upload; pass `options.timeout`\n\t * to set a per-call deadline.\n\t *\n\t * @param parameters - Universe and place identifiers, the place file\n\t * bytes, and their declared `format`.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link PlaceVersion}\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async save(\n\t\tparameters: PublishParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<PlaceVersion, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: SAVE_SPEC });\n\t}\n\n\t/**\n\t * Partially updates a place's configuration. The fields supplied on\n\t * `parameters` (excluding the identifiers) are forwarded to the\n\t * server via a Google-style `updateMask`; unmentioned fields are\n\t * left untouched. The universe's root place is the canonical place\n\t * to update when changing a universe's description or display name:\n\t * both are derived server-side from the root place.\n\t *\n\t * @param parameters - The universe and place identifiers and the\n\t * fields to update. At least one writable field must be supplied.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link Place} or\n\t * the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async update(\n\t\tparameters: UpdatePlaceParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Place, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: UPDATE_SPEC });\n\t}\n}\n\nfunction createLuauExecutionHandle(inner: ResourceClient): LuauExecutionHandle {\n\treturn {\n\t\tasync get(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: GET_SPEC });\n\t\t},\n\t\tasync listLogs(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: LIST_LOGS_SPEC });\n\t\t},\n\t\tasync pollUntilDone(ref, options = {}) {\n\t\t\tconst resolved = withBudgetRequestTimeout(options);\n\t\t\treturn pollUntilDoneCoreAsync(\n\t\t\t\tbuildPollDependencies(inner, { options: resolved, ref }),\n\t\t\t\tresolved,\n\t\t\t);\n\t\t},\n\t\tasync runUntilDone(parameters, options = {}) {\n\t\t\treturn submitAndPollAsync(inner, {\n\t\t\t\toptions: withBudgetRequestTimeout(options),\n\t\t\t\tparameters,\n\t\t\t});\n\t\t},\n\t\tasync submit(parameters, options) {\n\t\t\treturn submitWithCapacityAsync({ inner, options, parameters });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;AAOA,MAAM,qCAA0C,IAAI,IAAI,CAAC,WAAW,YAAY,CAAC;;;;;;;AAQjF,SAAgB,gBACf,YACsC;CACtC,OAAO,UAAU;EAChB,QAAQ;EACR,KAAK,uBAAuB,WAAW,WAAW,UAAU,WAAW;CACxE,CAAC;AACF;;;;;;;;;;;;AAaA,SAAgB,mBACf,YACuC;CACvC,MAAM,YAAY,uBAAuB,UAAU;CAEnD,IAAI,UAAU,WAAW,GACxB,OAAO;EACN,KAAK,IAAI,gBAAgB,0CAA0C,EAClE,MAAM,eACP,CAAC;EACD,SAAS;CACV;CAGD,MAAM,OAAO,OAAO,YACnB,UAAU,KAAK,QAAoC,CAAC,KAAK,QAAQ,IAAI,YAAY,GAAG,CAAC,CAAC,CACvF;CACA,MAAM,aAAa,UAAU,KAAK,GAAG;CACrC,MAAM,EAAE,SAAS,eAAe;CAChC,OAAO;EACN,MAAM;GACL;GACA,SAAS,EAAE,gBAAgB,mBAAmB;GAC9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AAsB,OAAO;IAAE,SAAS;IAAU;GAAI,CAAC,GACvD,QACD;EACD;EACA,MAAM,aAAa,YAAY,UAAU,CAAC,GAAG;GAC5C,OAAO,mBAAmB,OAAO;IAChC,SAAS,yBAAyB,OAAO;IACzC;GACD,CAAC;EACF;EACA,MAAM,OAAO,YAAY,SAAS;GACjC,OAAO,wBAAwB;IAAE;IAAO;IAAS;GAAW,CAAC;EAC9D;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"places.mjs","names":["SECONDS_PER_MINUTE","isPlaceWire"],"sources":["../src/domains/cloud-v2/places/builders.ts","../src/domains/cloud-v2/places/operations.ts","../src/domains/cloud-v2/places/parsers.ts","../src/domains/develop/places/builders.ts","../src/domains/develop/places/operations.ts","../src/domains/develop/places/parsers.ts","../src/domains/universes/places/builders.ts","../src/domains/universes/places/operations.ts","../src/domains/universes/places/parsers.ts","../src/resources/places/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport type { OpenCloudError } from \"../../../errors/base.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport { okRequest } from \"../../../internal/resource-client.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { GetPlaceParameters, UpdatePlaceParameters } from \"./types.ts\";\n\nconst NON_UPDATABLE_KEYS: ReadonlySet<string> = new Set([\"placeId\", \"universeId\"]);\n\n/**\n * Build a read-only lookup of a place's configuration, including its root flag.\n *\n * @param parameters - Owning universe and place identifiers.\n * @returns A read-only request carrying both identifiers in the URL.\n */\nexport function buildGetRequest(\n\tparameters: GetPlaceParameters,\n): Result<HttpRequest, OpenCloudError> {\n\treturn okRequest({\n\t\tmethod: \"GET\",\n\t\turl: `/cloud/v2/universes/${parameters.universeId}/places/${parameters.placeId}`,\n\t});\n}\n\n/**\n * Builds a `PATCH` request for the Open Cloud \"update place\" endpoint.\n * Derives the `updateMask` query string from the keys present on\n * `parameters` (excluding the identifiers) and emits a JSON body\n * containing those same fields.\n *\n * @param parameters - The universe and place identifiers plus the fields\n * to update.\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when no updatable fields were supplied.\n */\nexport function buildUpdateRequest(\n\tparameters: UpdatePlaceParameters,\n): Result<HttpRequest, ValidationError> {\n\tconst fieldKeys = extractUpdateFieldKeys(parameters);\n\n\tif (fieldKeys.length === 0) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Update must include at least one field\", {\n\t\t\t\tcode: \"empty_update\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst body = Object.fromEntries(\n\t\tfieldKeys.map((key): readonly [string, unknown] => [key, Reflect.get(parameters, key)]),\n\t);\n\tconst updateMask = fieldKeys.join(\",\");\n\tconst { placeId, universeId } = parameters;\n\treturn {\n\t\tdata: {\n\t\t\tbody,\n\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t\tmethod: \"PATCH\",\n\t\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}?updateMask=${updateMask}`,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction extractUpdateFieldKeys(parameters: UpdatePlaceParameters): ReadonlyArray<string> {\n\treturn Object.keys(parameters).filter((key) => !NON_UPDATABLE_KEYS.has(key));\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst UPDATE_PER_MINUTE = 100;\nconst SECONDS_PER_MINUTE = 60;\n\n/** Read quota from the Cloud_GetPlace operation: 100 requests per minute. */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 100 / SECONDS_PER_MINUTE,\n\toperationKey: \"places.get\",\n});\n\n/**\n * Per-second request ceiling for updating a place, from the Open Cloud\n * OpenAPI schema (100 requests per minute per API key owner). Keyed\n * independently from the publish operation so publish and update do\n * not share a queue; upstream quota accounting is not documented as\n * shared and the conservative default is fewer cross-method\n * contention surprises.\n */\nexport const UPDATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: UPDATE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"places.update\",\n});\n\n/**\n * Scopes required to update a place's metadata, sourced from\n * `x-roblox-scopes` on the `Cloud_UpdatePlace` operation in the vendored\n * OpenAPI schema.\n */\nexport const UPDATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place:write\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport { isDateTimeString } from \"../../../internal/utils/is-date-time-string.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { Place } from \"./types.ts\";\nimport type { PlaceWire } from \"./wire.ts\";\n\nconst MALFORMED_PLACE_MESSAGE = \"Malformed place response\";\n\nconst PLACE_PATH_PATTERN = /^universes\\/(\\d+)\\/places\\/(\\d+)$/;\n\ninterface ToPlaceArgs {\n\treadonly id: string;\n\treadonly body: PlaceWire;\n\treadonly universeId: string;\n}\n\n/**\n * Parses a successful Open Cloud `Place` response body into the public\n * {@link Place} shape.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link Place}, or an\n * {@link UnexpectedResponseError} when the body does not match the wire\n * schema.\n */\nexport function parsePlaceResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<Place, UnexpectedResponseError> {\n\tif (!isPlaceWire(body)) {\n\t\treturn malformedPlace(statusCode, body);\n\t}\n\n\tconst match = PLACE_PATH_PATTERN.exec(body.path);\n\tconst universeId = match?.[1];\n\tconst id = match?.[2];\n\tif (id === undefined || universeId === undefined) {\n\t\treturn malformedPlace(statusCode, body);\n\t}\n\n\treturn { data: toPlace({ id, body, universeId }), success: true };\n}\n\nfunction malformedPlace(statusCode: number, body: unknown): Result<Place, UnexpectedResponseError> {\n\treturn {\n\t\terr: new UnexpectedResponseError(MALFORMED_PLACE_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n\nfunction toPlace({ id, body, universeId }: ToPlaceArgs): Place {\n\treturn {\n\t\tid,\n\t\tcreatedAt: new Date(body.createTime),\n\t\tdescription: body.description,\n\t\tdisplayName: body.displayName,\n\t\troot: body.root ?? false,\n\t\tserverSize: body.serverSize ?? undefined,\n\t\tuniverseId,\n\t\tuniverseRuntimeCreation: body.universeRuntimeCreation ?? false,\n\t\tupdatedAt: new Date(body.updateTime),\n\t};\n}\n\nfunction hasValidPlaceRequired(body: Record<string, unknown>): boolean {\n\treturn (\n\t\ttypeof body[\"path\"] === \"string\" &&\n\t\tisDateTimeString(body[\"createTime\"]) &&\n\t\tisDateTimeString(body[\"updateTime\"]) &&\n\t\ttypeof body[\"displayName\"] === \"string\" &&\n\t\ttypeof body[\"description\"] === \"string\"\n\t);\n}\n\nfunction isOptionalBoolean(value: unknown): boolean {\n\treturn value === undefined || value === null || typeof value === \"boolean\";\n}\n\nfunction hasValidPlaceOptional(body: Record<string, unknown>): boolean {\n\tconst serverSize = body[\"serverSize\"] ?? undefined;\n\treturn (\n\t\t(serverSize === undefined || typeof serverSize === \"number\") &&\n\t\tisOptionalBoolean(body[\"root\"]) &&\n\t\tisOptionalBoolean(body[\"universeRuntimeCreation\"])\n\t);\n}\n\nfunction isPlaceWire(body: unknown): body is PlaceWire {\n\treturn isRecord(body) && hasValidPlaceRequired(body) && hasValidPlaceOptional(body);\n}\n","import type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport type { ListPlacesParameters } from \"./types.ts\";\n\n/**\n * Builds the `GET` request listing one page of a universe's places. Maps\n * `pageSize` to `limit` and `pageToken` to `cursor`, each only when defined.\n *\n * @param parameters - Universe ID plus optional pagination fields.\n * @returns A pure {@link HttpRequest} describing the list call.\n */\nexport function buildListPlacesRequest(parameters: ListPlacesParameters): HttpRequest {\n\tconst query = new URLSearchParams();\n\tif (parameters.pageSize !== undefined) {\n\t\tquery.append(\"limit\", String(parameters.pageSize));\n\t}\n\n\tif (parameters.pageToken !== undefined) {\n\t\tquery.append(\"cursor\", parameters.pageToken);\n\t}\n\n\tconst queryString = query.toString();\n\tconst base = `/v1/universes/${parameters.universeId}/places`;\n\treturn { method: \"GET\", url: queryString === \"\" ? base : `${base}?${queryString}` };\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/** Origin of the unauthenticated develop places endpoint. */\nexport const LIST_PLACES_BASE_URL = \"https://develop.roblox.com\";\n\n/**\n * Per-second ceiling for listing places. Not published in the OpenAPI spec;\n * observed 2026-11-09 on 200 and 400 responses as\n * `x-ratelimit-limit: 10000, 10000;w=60` (10000 requests per 60 seconds).\n * The window is fixed: a 429's `retry-after` is shorter than the window,\n * which reopens only at `x-ratelimit-reset`.\n */\nexport const LIST_PLACES_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 10_000 / 60,\n\toperationKey: \"places.list\",\n});\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Page, Result } from \"../../../types.ts\";\nimport type { PlaceSummary } from \"./types.ts\";\n\ninterface PlaceWire {\n\treadonly id: number;\n\treadonly name: string;\n\treadonly description: string;\n\treadonly universeId: number;\n}\n\n/**\n * Parses one page of a universe's places. Numeric IDs become strings and a\n * `null` next cursor becomes `undefined`.\n *\n * @param response - The HTTP response to parse.\n * @returns The parsed page or an `UnexpectedResponseError` when the body is\n * malformed.\n */\nexport function parsePlacesListResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<Page<PlaceSummary>, UnexpectedResponseError> {\n\tif (!isRecord(body) || !Array.isArray(body[\"data\"])) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst nextPageToken = body[\"nextPageCursor\"] ?? undefined;\n\tif (nextPageToken !== undefined && typeof nextPageToken !== \"string\") {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst items: Array<PlaceSummary> = [];\n\tconst places = body[\"data\"];\n\tfor (const item of places) {\n\t\tif (!isPlaceWire(item)) {\n\t\t\treturn malformed(statusCode, body);\n\t\t}\n\n\t\titems.push({\n\t\t\tid: String(item.id),\n\t\t\tname: item.name,\n\t\t\tdescription: item.description,\n\t\t\tuniverseId: String(item.universeId),\n\t\t});\n\t}\n\n\treturn { data: { items, nextPageToken }, success: true };\n}\n\nfunction isPlaceWire(value: unknown): value is PlaceWire {\n\treturn (\n\t\tisRecord(value) &&\n\t\tNumber.isSafeInteger(value[\"id\"]) &&\n\t\tNumber.isSafeInteger(value[\"universeId\"]) &&\n\t\ttypeof value[\"name\"] === \"string\" &&\n\t\ttypeof value[\"description\"] === \"string\"\n\t);\n}\n\nfunction malformed(\n\tstatusCode: number,\n\tbody: unknown,\n): Result<Page<PlaceSummary>, UnexpectedResponseError> {\n\treturn {\n\t\terr: new UnexpectedResponseError(\"Malformed places list response\", {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n","import type { HttpRequest } from \"../../../client/types.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport { matchesSignature, RBXL_SIGNATURE, RBXLX_SIGNATURE } from \"./signatures.ts\";\nimport type { PublishParameters } from \"./types.ts\";\n\n/**\n * Whether a publish call writes a live (`Published`) or draft (`Saved`)\n * version. Surfaces only as the `versionType` query string on the\n * underlying HTTP request.\n */\ntype VersionType = \"Published\" | \"Saved\";\n\nconst CONTENT_TYPE_BY_FORMAT: Readonly<Record<PublishParameters[\"format\"], string>> = {\n\trbxl: \"application/octet-stream\",\n\trbxlx: \"application/xml\",\n};\n\n/**\n * Builds a `POST` request for the Open Cloud \"publish place version\"\n * endpoint. Performs two local validations before producing any\n * {@link HttpRequest}: a non-empty body check and a magic-byte check\n * that the bytes' actual format matches `parameters.format`.\n *\n * @param parameters - Universe and place identifiers, the place file\n * bytes, and the declared `format` of those bytes.\n * @param versionType - `\"Published\"` for `publish()`, `\"Saved\"` for\n * `save()`; baked into the `?versionType=` query string.\n * @returns A success result wrapping the request on success, or a\n * {@link ValidationError} when the body is empty or its magic bytes\n * disagree with `parameters.format`.\n */\nexport function buildPublishRequest(\n\t{ body, format, placeId, universeId }: PublishParameters,\n\tversionType: VersionType,\n): Result<HttpRequest, ValidationError> {\n\tconst validationError = validateBody(body, format);\n\tif (validationError !== undefined) {\n\t\treturn { err: validationError, success: false };\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbody,\n\t\t\theaders: { \"content-type\": CONTENT_TYPE_BY_FORMAT[format] },\n\t\t\tmethod: \"POST\",\n\t\t\turl: `/universes/v1/${universeId}/places/${placeId}/versions?versionType=${versionType}`,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\n/**\n * Checks a place body against the format its caller declared: non-empty, and\n * carrying the magic bytes of `format`. Emptiness is checked first so a\n * zero-byte body reports `empty_body` rather than a signature mismatch.\n *\n * @param body - The raw place file bytes.\n * @param format - The format the caller declared the bytes to be in.\n * @returns The {@link ValidationError} to fail with, or `undefined` when the\n * body is usable.\n */\nfunction validateBody(\n\tbody: PublishParameters[\"body\"],\n\tformat: PublishParameters[\"format\"],\n): undefined | ValidationError {\n\tif (body.length === 0) {\n\t\treturn new ValidationError(\"Place body is empty\", { code: \"empty_body\" });\n\t}\n\n\tconst expectedSignature = format === \"rbxl\" ? RBXL_SIGNATURE : RBXLX_SIGNATURE;\n\tif (!matchesSignature(body, expectedSignature)) {\n\t\treturn new ValidationError(`Place body does not match the declared \"${format}\" format`, {\n\t\t\tcode: \"format_mismatch\",\n\t\t});\n\t}\n\n\treturn undefined;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst PUBLISH_PER_MINUTE = 30;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for publishing or saving a place version,\n * from the Open Cloud OpenAPI schema (30 requests per minute, which works\n * out to `0.5` per second and is also the burst the server allows). The\n * publish and save methods both reference this constant so that a single\n * per-API-key queue serves both, matching Roblox's server-side accounting\n * which counts both call types against the same per-minute quota.\n */\nexport const PUBLISH_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: PUBLISH_PER_MINUTE,\n\tmaxPerSecond: PUBLISH_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"places.publishVersion\",\n});\n\n/**\n * Scopes required to publish or save a place version, sourced from\n * `x-roblox-scopes` on the `Places_CreatePlaceVersionApiKey` operation\n * in the vendored OpenAPI schema.\n */\nexport const PUBLISH_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe-places:write\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { PlaceVersion } from \"./types.ts\";\nimport type { PlaceVersionWire } from \"./wire.ts\";\n\n/**\n * Parses a successful publish-version response into the public\n * {@link PlaceVersion} shape. The Roblox endpoint sometimes returns the\n * JSON-shaped body under a `text/plain` `Content-Type`, so the body may\n * arrive either pre-decoded as a JSON object or still in its raw string\n * form; both are accepted here.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link PlaceVersion}, or\n * an {@link UnexpectedResponseError} when the body is malformed or its\n * `versionNumber` field is missing/wrong-typed.\n */\nexport function parsePublishResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<PlaceVersion, UnexpectedResponseError> {\n\tconst decodeResult = decodeBody(body, statusCode);\n\tif (!decodeResult.success) {\n\t\treturn decodeResult;\n\t}\n\n\tif (!isPlaceVersionWire(decodeResult.data)) {\n\t\treturn {\n\t\t\terr: new UnexpectedResponseError(\"Malformed publish response\", {\n\t\t\t\tdetails: toJsonDetails(body),\n\t\t\t\tstatusCode,\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn {\n\t\tdata: { versionNumber: decodeResult.data.versionNumber },\n\t\tsuccess: true,\n\t};\n}\n\nfunction decodeBody(body: unknown, statusCode: number): Result<unknown, UnexpectedResponseError> {\n\tif (typeof body !== \"string\") {\n\t\treturn { data: body, success: true };\n\t}\n\n\ttry {\n\t\treturn { data: JSON.parse(body), success: true };\n\t} catch (err) {\n\t\treturn {\n\t\t\terr: new UnexpectedResponseError(\"Malformed publish response\", {\n\t\t\t\tcause: err,\n\t\t\t\tdetails: body,\n\t\t\t\tstatusCode,\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n}\n\nfunction isPlaceVersionWire(value: unknown): value is PlaceVersionWire {\n\tif (!isRecord(value)) {\n\t\treturn false;\n\t}\n\n\treturn typeof value[\"versionNumber\"] === \"number\";\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport { LIST_LOGS_SPEC } from \"../../domains/cloud-v2/luau-execution-task-logs/specs.ts\";\nimport type {\n\tListLogsParameters,\n\tLogPage,\n} from \"../../domains/cloud-v2/luau-execution-task-logs/types.ts\";\nimport { GET_SPEC } from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport { buildGetRequest, buildUpdateRequest } from \"../../domains/cloud-v2/places/builders.ts\";\nimport {\n\tGET_OPERATION_LIMIT,\n\tUPDATE_OPERATION_LIMIT,\n\tUPDATE_REQUIRED_SCOPES,\n} from \"../../domains/cloud-v2/places/operations.ts\";\nimport { parsePlaceResponse } from \"../../domains/cloud-v2/places/parsers.ts\";\nimport type {\n\tGetPlaceParameters,\n\tPlace,\n\tUpdatePlaceParameters,\n} from \"../../domains/cloud-v2/places/types.ts\";\nimport { buildListPlacesRequest } from \"../../domains/develop/places/builders.ts\";\nimport {\n\tLIST_PLACES_BASE_URL,\n\tLIST_PLACES_OPERATION_LIMIT,\n} from \"../../domains/develop/places/operations.ts\";\nimport { parsePlacesListResponse } from \"../../domains/develop/places/parsers.ts\";\nimport type { ListPlacesParameters, PlaceSummary } from \"../../domains/develop/places/types.ts\";\nimport { buildPublishRequest } from \"../../domains/universes/places/builders.ts\";\nimport {\n\tPUBLISH_OPERATION_LIMIT,\n\tPUBLISH_REQUIRED_SCOPES,\n} from \"../../domains/universes/places/operations.ts\";\nimport { parsePublishResponse } from \"../../domains/universes/places/parsers.ts\";\nimport type { PlaceVersion, PublishParameters } from \"../../domains/universes/places/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { waitForQuotaReset } from \"../../internal/http/retry-guidance.ts\";\nimport { IDEMPOTENT_METHOD_DEFAULTS, UPLOAD_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport {\n\tokRequest,\n\tResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { Page, Result } from \"../../types.ts\";\nimport {\n\ttype LuauExecutionRunOptions,\n\ttype LuauExecutionSubmitOptions,\n\tsubmitWithCapacityAsync,\n} from \"../luau-execution/capacity-admission.ts\";\nimport { buildPollDependencies, submitAndPollAsync } from \"../luau-execution/polling-helpers.ts\";\nimport {\n\tpollUntilDoneCoreAsync,\n\ttype PollUntilDoneOptions,\n\twithBudgetRequestTimeout,\n} from \"../luau-execution/polling.ts\";\n\n/**\n * Operation Group exposed by {@link PlacesClient} as the\n * `luauExecution` namespace. Provides `submit` to queue a Luau script,\n * `get` to fetch a task's current state, and `listLogs` to retrieve\n * structured log messages. Shares the same dispatch wiring as the\n * top-level `LuauExecutionClient` exposed at\n * `@bedrock-rbx/ocale/luau-execution`.\n *\n * @since 0.1.0\n */\nexport interface LuauExecutionHandle {\n\t/**\n\t * Fetches the current state of a previously-submitted Luau\n\t * execution task. Uses idempotent retry semantics for both 429 and\n\t * 5xx.\n\t *\n\t * @param parameters - The task ref plus an optional `view` selector.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tget(\n\t\tparameters: GetParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Lists one page of structured log messages produced by a\n\t * previously-submitted Luau execution task. Messages from multiple\n\t * server-side chunks are flattened into a single ordered array.\n\t * Uses idempotent retry semantics for both 429 and 5xx.\n\t *\n\t * @param parameters - The task ref and optional pagination controls\n\t * (`pageSize`, `pageToken`).\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link LogPage} or\n\t * the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tlistLogs(\n\t\tparameters: ListLogsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LogPage, OpenCloudError>>;\n\t/**\n\t * Polls `get` with `view=BASIC` on a configurable backoff schedule until\n\t * the task reaches a terminal state, the wall-clock budget is exhausted,\n\t * or the supplied `AbortSignal` fires. Returns the terminal task on\n\t * success. The budget also bounds an in-flight\n\t * request through its request deadline, so a hanging request ends with\n\t * `PollTimeoutError` at the budget.\n\t *\n\t * @param ref - Reference to the task to poll, typically returned by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask},\n\t * or an error if aborted, timed out, or the transport fails.\n\t */\n\tpollUntilDone(\n\t\tref: LuauExecutionTaskRef,\n\t\toptions?: PollUntilDoneOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script and polls `get` with `view=BASIC` until the\n\t * task reaches a terminal state, the wall-clock budget is exhausted,\n\t * or the supplied `AbortSignal` fires. Combines `submit` and\n\t * `pollUntilDone` in one call. The budget opens before the submit\n\t * and covers it, and bounds each in-flight request through its request\n\t * deadline.\n\t *\n\t * @param parameters - The same input accepted by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal\n\t * {@link LuauExecutionTask}, or an error if submit fails, the task\n\t * is aborted, timed out, or the transport fails.\n\t */\n\trunUntilDone(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: LuauExecutionRunOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script for execution against a place. Dispatches\n\t * to the head-version URL when `versionId` is omitted, or to the\n\t * specific-version URL when one is supplied. Both URL shapes share\n\t * one rate-limit queue and one required-scope set.\n\t *\n\t * @param parameters - The universe and place identifiers, the\n\t * script to run, an optional `versionId`, and any other writable\n\t * submit fields.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tsubmit(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: LuauExecutionSubmitOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n}\n\nfunction makePublishSpec(\n\tversionType: \"Published\" | \"Saved\",\n): ResourceMethodSpec<PublishParameters, PlaceVersion> {\n\treturn Object.freeze({\n\t\tapiKeyOnly: true,\n\t\tbuildRequest: (parameters: PublishParameters) => {\n\t\t\treturn buildPublishRequest(parameters, versionType);\n\t\t},\n\t\tmethodDefaults: UPLOAD_METHOD_DEFAULTS,\n\t\tmethodKind: \"create\",\n\t\toperationLimit: PUBLISH_OPERATION_LIMIT,\n\t\tparse: parsePublishResponse,\n\t\trequiredScopes: PUBLISH_REQUIRED_SCOPES,\n\t});\n}\n\nconst PUBLISH_SPEC = makePublishSpec(\"Published\");\nconst SAVE_SPEC = makePublishSpec(\"Saved\");\n\nconst GET_PLACE_SPEC: ResourceMethodSpec<GetPlaceParameters, Place> = Object.freeze({\n\tbuildRequest: buildGetRequest,\n\tmethodDefaults: {},\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parsePlaceResponse,\n});\n\nconst LIST_PLACES_SPEC: ResourceMethodSpec<\n\tListPlacesParameters,\n\tPage<PlaceSummary>\n> = Object.freeze({\n\tbuildRequest: (parameters: ListPlacesParameters) => {\n\t\treturn okRequest(buildListPlacesRequest(parameters));\n\t},\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: LIST_PLACES_OPERATION_LIMIT,\n\tparse: parsePlacesListResponse,\n\tunauthenticatedBaseUrl: LIST_PLACES_BASE_URL,\n});\n\nconst UPDATE_SPEC: ResourceMethodSpec<UpdatePlaceParameters, Place> = Object.freeze({\n\tbuildRequest: buildUpdateRequest,\n\tmethodDefaults: {},\n\tmethodKind: \"idempotent\",\n\toperationLimit: UPDATE_OPERATION_LIMIT,\n\tparse: parsePlaceResponse,\n\trequiredScopes: UPDATE_REQUIRED_SCOPES,\n});\n\n/**\n * Public client for the Roblox Open Cloud `Place` resource. Covers\n * place-version publishing (`publish`, `save`), place-configuration\n * updates (`update`), and the Luau execution Operation Group\n * (`luauExecution.submit`, `luauExecution.get`). Every method returns\n * a {@link Result} so callers handle failure explicitly; no thrown\n * {@link OpenCloudError} ever escapes the client.\n *\n * Publishing or saving a 5xx-failed place version is not retried\n * automatically: Roblox does not support idempotency keys, so a retry\n * could publish a duplicate version unnoticed. Callers that *can* detect\n * duplicates externally may opt back into 5xx retry per-call by passing\n * `retryableStatuses` on the second argument. The `update` method, by\n * contrast, is idempotent and retries both 429 and 5xx automatically.\n *\n * Failures that never reached Open Cloud *are* retried: transient transport\n * errors, and responses served by an edge gateway rather than the API. Neither\n * can have created a version, so neither risks the duplicate a 5xx does.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { PlacesClient } from \"@bedrock-rbx/ocale/places\";\n *\n * const client = new PlacesClient({ credential: { apiKey: \"your-key\", kind: \"apiKey\" } });\n * expect(client).toBeInstanceOf(PlacesClient);\n * ```\n */\nexport class PlacesClient {\n\treadonly #inner: ResourceClient;\n\n\tpublic readonly luauExecution: LuauExecutionHandle;\n\n\t/**\n\t * Creates a new {@link PlacesClient}. Configuration is frozen on\n\t * construction; per-request overrides are accepted on each method.\n\t *\n\t * @param options - Client-level configuration including the API key.\n\t */\n\tconstructor(options: OpenCloudClientOptions) {\n\t\tthis.#inner = new ResourceClient(options);\n\t\tthis.luauExecution = createLuauExecutionHandle(this.#inner);\n\t}\n\n\t/**\n\t * Reads a place's configuration, including whether it is the universe's\n\t * root.\n\t *\n\t * @since 0.4.0\n\t * @param parameters - Owning universe and place identifiers.\n\t * @param options - Per-request overrides.\n\t * @returns The parsed place or the Open Cloud failure.\n\t */\n\tpublic async get(\n\t\tparameters: GetPlaceParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Place, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: GET_PLACE_SPEC });\n\t}\n\n\t/**\n\t * Lists one page of the places of a universe. Omit `pageToken` for the\n\t * first page, then pass the returned `nextPageToken` until it is\n\t * undefined. An unknown universe yields an empty page.\n\t *\n\t * The read is unauthenticated: it sends no credential and is served from\n\t * `https://develop.roblox.com`, so the client `baseUrl` does not apply.\n\t * `pageSize` accepts only 10, 25, 50 or 100 and defaults to 10.\n\t * Roblox allows 10000 reads per caller in a fixed 60-second window. A 429\n\t * waits until the reported `x-ratelimit-reset` before it retries.\n\t *\n\t * @since 0.5.0\n\t * @param parameters - Universe ID and optional pagination fields.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the page of {@link PlaceSummary}\n\t * items, or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async list(\n\t\tparameters: ListPlacesParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Page<PlaceSummary>, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({\n\t\t\toptions,\n\t\t\tparameters,\n\t\t\trefineError: waitForQuotaReset,\n\t\t\tspec: LIST_PLACES_SPEC,\n\t\t});\n\t}\n\n\t/**\n\t * Publishes a new live version of a place.\n\t *\n\t * No default request timeout applies to this upload; pass `options.timeout`\n\t * to set a per-call deadline.\n\t *\n\t * @param parameters - Universe and place identifiers, the place file\n\t * bytes, and their declared `format`.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link PlaceVersion}\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async publish(\n\t\tparameters: PublishParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<PlaceVersion, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: PUBLISH_SPEC });\n\t}\n\n\t/**\n\t * Saves a new draft version of a place. Identical to {@link publish}\n\t * except the resulting version is not made live; consumers can list or\n\t * promote it later. Shares a single per-API-key rate-limit queue with\n\t * `publish` because Roblox attributes both calls to the same per-minute\n\t * quota.\n\t *\n\t * No default request timeout applies to this upload; pass `options.timeout`\n\t * to set a per-call deadline.\n\t *\n\t * @param parameters - Universe and place identifiers, the place file\n\t * bytes, and their declared `format`.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link PlaceVersion}\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async save(\n\t\tparameters: PublishParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<PlaceVersion, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: SAVE_SPEC });\n\t}\n\n\t/**\n\t * Partially updates a place's configuration. The fields supplied on\n\t * `parameters` (excluding the identifiers) are forwarded to the\n\t * server via a Google-style `updateMask`; unmentioned fields are\n\t * left untouched. The universe's root place is the canonical place\n\t * to update when changing a universe's description or display name:\n\t * both are derived server-side from the root place.\n\t *\n\t * @param parameters - The universe and place identifiers and the\n\t * fields to update. At least one writable field must be supplied.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link Place} or\n\t * the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async update(\n\t\tparameters: UpdatePlaceParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Place, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: UPDATE_SPEC });\n\t}\n}\n\nfunction createLuauExecutionHandle(inner: ResourceClient): LuauExecutionHandle {\n\treturn {\n\t\tasync get(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: GET_SPEC });\n\t\t},\n\t\tasync listLogs(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: LIST_LOGS_SPEC });\n\t\t},\n\t\tasync pollUntilDone(ref, options = {}) {\n\t\t\tconst resolved = withBudgetRequestTimeout(options);\n\t\t\treturn pollUntilDoneCoreAsync(\n\t\t\t\tbuildPollDependencies(inner, { options: resolved, ref }),\n\t\t\t\tresolved,\n\t\t\t);\n\t\t},\n\t\tasync runUntilDone(parameters, options = {}) {\n\t\t\treturn submitAndPollAsync(inner, {\n\t\t\t\toptions: withBudgetRequestTimeout(options),\n\t\t\t\tparameters,\n\t\t\t});\n\t\t},\n\t\tasync submit(parameters, options) {\n\t\t\treturn submitWithCapacityAsync({ inner, options, parameters });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;AAOA,MAAM,qCAA0C,IAAI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Y,SAAS;GACjC,OAAO,wBAAwB;IAAE;IAAO;IAAS;GAAW,CAAC;EAC9D;CACD;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as OpenCloudError } from "./network-error-
|
|
2
|
-
|
|
1
|
+
import { s as OpenCloudError } from "./network-error-P4An7nUB.mjs";
|
|
2
|
+
// src/errors/poll-aborted.ts
|
|
3
3
|
/**
|
|
4
4
|
* Returned when `pollUntilDone` is interrupted by an `AbortSignal` before
|
|
5
5
|
* a terminal task state is reached. The `reason` field mirrors
|
|
@@ -35,8 +35,7 @@ var PollAbortedError = class extends OpenCloudError {
|
|
|
35
35
|
this.reason = options.reason;
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
//#region src/errors/poll-timeout.ts
|
|
38
|
+
// src/errors/poll-timeout.ts
|
|
40
39
|
/**
|
|
41
40
|
* Returned when `pollUntilDone` exhausts its wall-clock budget without
|
|
42
41
|
* observing a terminal task state. Carries the last task polled so callers
|
|
@@ -77,7 +76,6 @@ var PollTimeoutError = class extends OpenCloudError {
|
|
|
77
76
|
this.timeoutMs = options.timeoutMs;
|
|
78
77
|
}
|
|
79
78
|
};
|
|
80
|
-
//#endregion
|
|
81
79
|
export { PollAbortedError as n, PollTimeoutError as t };
|
|
82
80
|
|
|
83
|
-
//# sourceMappingURL=poll-timeout-
|
|
81
|
+
//# sourceMappingURL=poll-timeout-BCxgN97O.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poll-timeout-
|
|
1
|
+
{"version":3,"file":"poll-timeout-BCxgN97O.mjs","names":[],"sources":["../src/errors/poll-aborted.ts","../src/errors/poll-timeout.ts"],"sourcesContent":["import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Options for constructing a {@link PollAbortedError}.\n *\n * @since 0.1.0\n */\nexport interface PollAbortedErrorOptions extends ErrorOptions {\n\t/** Whatever `AbortSignal.reason` was at the moment of abort. */\n\treadonly reason?: unknown;\n}\n\n/**\n * Returned when `pollUntilDone` is interrupted by an `AbortSignal` before\n * a terminal task state is reached. The `reason` field mirrors\n * `AbortSignal.reason` so callers can distinguish intentional cancellation\n * from unexpected abort sources.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { PollAbortedError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new PollAbortedError(\"polling was aborted\", {\n * reason: \"user cancelled\",\n * });\n *\n * expect(error).toBeInstanceOf(PollAbortedError);\n * expect(error.reason).toBe(\"user cancelled\");\n * ```\n */\nexport class PollAbortedError extends OpenCloudError {\n\tpublic override readonly name: string = \"PollAbortedError\";\n\tpublic readonly reason?: unknown;\n\n\t/**\n\t * Creates a new PollAbortedError.\n\t *\n\t * @param message - Human-readable description of the abort.\n\t * @param options - Error options including the abort reason.\n\t */\n\tconstructor(message: string, options: PollAbortedErrorOptions = {}) {\n\t\tsuper(message, options);\n\t\tthis.reason = options.reason;\n\t}\n}\n","import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Options for {@link PollTimeoutError}. The `T` type parameter captures the\n * resource-specific task variant the caller polled for; defaults to `unknown`\n * so the class can be reused by future Resources without forcing a parallel\n * hierarchy.\n *\n * @since 0.1.0\n *\n * @template T - Resource-specific task type being polled.\n */\nexport interface PollTimeoutErrorOptions<T = unknown> extends ErrorOptions {\n\t/** Last task observed before the timeout budget was exhausted. */\n\treadonly lastObservedTask?: T | undefined;\n\t/** Total wall-clock budget supplied by the caller, in ms. */\n\treadonly timeoutMs: number;\n}\n\n/**\n * Returned when `pollUntilDone` exhausts its wall-clock budget without\n * observing a terminal task state. Carries the last task polled so callers\n * can inspect state and decide whether to retry with a fresh budget.\n *\n * @since 0.1.0\n *\n * @template T - Resource-specific task type being polled.\n *\n * @example\n *\n * ```ts\n * import { PollTimeoutError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new PollTimeoutError(\"polling timed out after 5 s\", {\n * lastObservedTask: { state: \"PROCESSING\" as const },\n * timeoutMs: 5000,\n * });\n *\n * expect(error).toBeInstanceOf(PollTimeoutError);\n * expect(error.timeoutMs).toBe(5000);\n * expect(error.lastObservedTask).toStrictEqual({ state: \"PROCESSING\" });\n * ```\n */\nexport class PollTimeoutError<T = unknown> extends OpenCloudError {\n\tpublic readonly lastObservedTask: T | undefined;\n\tpublic override readonly name: string = \"PollTimeoutError\";\n\tpublic readonly timeoutMs: number;\n\n\t/**\n\t * Creates a new PollTimeoutError.\n\t *\n\t * @param message - Human-readable description of the timeout.\n\t * @param options - Error options including the budget and last-observed task.\n\t */\n\tconstructor(message: string, options: PollTimeoutErrorOptions<T>) {\n\t\tsuper(message, options);\n\t\tthis.lastObservedTask = options.lastObservedTask;\n\t\tthis.timeoutMs = options.timeoutMs;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAa,mBAAb,cAAsC,eAAe;CACpD,OAAwC;CACxC;;;;;;;CAQA,YAAY,SAAiB,UAAmC,CAAC,GAAG;EACnE,MAAM,SAAS,OAAO;EACtB,KAAK,SAAS,QAAQ;CACvB;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;ACJA,IAAa,mBAAb,cAAmD,eAAe;CACjE;CACA,OAAwC;CACxC;;;;;;;CAQA,YAAY,SAAiB,SAAqC;EACjE,MAAM,SAAS,OAAO;EACtB,KAAK,mBAAmB,QAAQ;EAChC,KAAK,YAAY,QAAQ;CAC1B;AACD"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { n as RateLimitError, s as OpenCloudError, t as NetworkError } from "./network-error-
|
|
2
|
-
import {
|
|
3
|
-
import { n as PollAbortedError, t as PollTimeoutError } from "./poll-timeout-
|
|
4
|
-
import { t as ValidationError } from "./validation-
|
|
5
|
-
import { a as waitDeadlineFailure,
|
|
6
|
-
|
|
1
|
+
import { n as RateLimitError, s as OpenCloudError, t as NetworkError } from "./network-error-P4An7nUB.mjs";
|
|
2
|
+
import { E as raceWithAbortAsync, N as isRecord, T as ABORTED, a as TRANSIENT_TRANSPORT_CODES, g as RequestDeadlineExceededError, m as UnexpectedResponseError, p as findErrorCode, r as IDEMPOTENT_METHOD_DEFAULTS, t as CREATE_METHOD_DEFAULTS } from "./retry-Dv5TsY9O.mjs";
|
|
3
|
+
import { n as PollAbortedError, t as PollTimeoutError } from "./poll-timeout-BCxgN97O.mjs";
|
|
4
|
+
import { t as ValidationError } from "./validation-kaTLLAD1.mjs";
|
|
5
|
+
import { a as waitDeadlineFailure, n as okRequest, o as observeAdmissionWaitAsync, s as toJsonDetails } from "./resource-client-Cm_bPcCs.mjs";
|
|
6
|
+
import { t as isDateTimeString } from "./is-date-time-string-C91G44SI.mjs";
|
|
7
|
+
// src/resources/luau-execution/capacity-error.ts
|
|
7
8
|
const UUID_PATTERN = "[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}";
|
|
8
9
|
/**
|
|
9
10
|
* A Luau task submission refused because validated tasks occupy the target
|
|
@@ -112,8 +113,7 @@ function capacityBlockersFrom(error, parameters) {
|
|
|
112
113
|
const message = capacityMessage(error.details);
|
|
113
114
|
return message === void 0 ? [] : blockerRefsFrom(message, parameters);
|
|
114
115
|
}
|
|
115
|
-
|
|
116
|
-
//#region src/domains/cloud-v2/luau-execution-task-logs/builders.ts
|
|
116
|
+
// src/domains/cloud-v2/luau-execution-task-logs/builders.ts
|
|
117
117
|
/**
|
|
118
118
|
* Builds a `GET` request for the Open Cloud "list Luau execution session
|
|
119
119
|
* task logs" endpoint. The endpoint requires the maximal x-aep-resource
|
|
@@ -155,8 +155,7 @@ function buildQuery(pageSize, pageToken) {
|
|
|
155
155
|
if (pageToken !== void 0) query.append("pageToken", pageToken);
|
|
156
156
|
return query;
|
|
157
157
|
}
|
|
158
|
-
|
|
159
|
-
//#region src/domains/cloud-v2/luau-execution-task-logs/operations.ts
|
|
158
|
+
// src/domains/cloud-v2/luau-execution-task-logs/operations.ts
|
|
160
159
|
const LIST_LOGS_PER_MINUTE = 45;
|
|
161
160
|
/**
|
|
162
161
|
* Per-second request ceiling for listing Luau execution task logs,
|
|
@@ -178,8 +177,7 @@ const LIST_LOGS_OPERATION_LIMIT = Object.freeze({
|
|
|
178
177
|
* minimum-privilege scope for this read-only operation.
|
|
179
178
|
*/
|
|
180
179
|
const LIST_LOGS_REQUIRED_SCOPES = Object.freeze(["universe.place.luau-execution-session:read"]);
|
|
181
|
-
|
|
182
|
-
//#region src/domains/cloud-v2/luau-execution-task-logs/parsers.ts
|
|
180
|
+
// src/domains/cloud-v2/luau-execution-task-logs/parsers.ts
|
|
183
181
|
const MALFORMED_LOGS_MESSAGE = "Malformed list-luau-execution-task-logs response";
|
|
184
182
|
/**
|
|
185
183
|
* Parses a successful Open Cloud list-luau-execution-task-logs response
|
|
@@ -262,8 +260,7 @@ function malformed$1(statusCode, body) {
|
|
|
262
260
|
success: false
|
|
263
261
|
};
|
|
264
262
|
}
|
|
265
|
-
|
|
266
|
-
//#region src/domains/cloud-v2/luau-execution-task-logs/specs.ts
|
|
263
|
+
// src/domains/cloud-v2/luau-execution-task-logs/specs.ts
|
|
267
264
|
function makeSpec$1(spec) {
|
|
268
265
|
return Object.freeze({
|
|
269
266
|
...spec,
|
|
@@ -284,8 +281,7 @@ const LIST_LOGS_SPEC = makeSpec$1({
|
|
|
284
281
|
parse: parseListLogsResponse,
|
|
285
282
|
requiredScopes: LIST_LOGS_REQUIRED_SCOPES
|
|
286
283
|
});
|
|
287
|
-
|
|
288
|
-
//#region src/domains/cloud-v2/luau-execution-tasks/builders.ts
|
|
284
|
+
// src/domains/cloud-v2/luau-execution-tasks/builders.ts
|
|
289
285
|
const JSON_HEADERS = { "content-type": "application/json" };
|
|
290
286
|
/**
|
|
291
287
|
* Builds a `POST` request for the Open Cloud "create Luau execution
|
|
@@ -366,8 +362,7 @@ function buildSubmitBody({ binaryInput, enableBinaryOutput: shouldEnableBinaryOu
|
|
|
366
362
|
if (shouldEnableBinaryOutput !== void 0) body["enableBinaryOutput"] = shouldEnableBinaryOutput;
|
|
367
363
|
return body;
|
|
368
364
|
}
|
|
369
|
-
|
|
370
|
-
//#region src/domains/cloud-v2/luau-execution-tasks/operations.ts
|
|
365
|
+
// src/domains/cloud-v2/luau-execution-tasks/operations.ts
|
|
371
366
|
const SUBMIT_AT_HEAD_PER_MINUTE = 5;
|
|
372
367
|
const SUBMIT_AT_VERSION_PER_MINUTE = 5;
|
|
373
368
|
const GET_PER_MINUTE = 200;
|
|
@@ -427,8 +422,7 @@ const SUBMIT_REQUIRED_SCOPES = Object.freeze(["universe.place.luau-execution-ses
|
|
|
427
422
|
* the minimum-privilege requirement for this method.
|
|
428
423
|
*/
|
|
429
424
|
const GET_REQUIRED_SCOPES = Object.freeze(["universe.place.luau-execution-session:read"]);
|
|
430
|
-
|
|
431
|
-
//#region src/domains/cloud-v2/luau-execution-tasks/parsers.ts
|
|
425
|
+
// src/domains/cloud-v2/luau-execution-tasks/parsers.ts
|
|
432
426
|
const MALFORMED_TASK_MESSAGE = "Malformed luau-execution-session-task response";
|
|
433
427
|
const PATH_PATTERN = /^universes\/(\d+)\/places\/(\d+)(?:\/versions\/(\d+))?(?:\/luau-execution-sessions\/([^/]+)\/tasks\/([^/]+)|\/luau-execution-session-tasks\/([^/]+))$/;
|
|
434
428
|
/**
|
|
@@ -597,8 +591,7 @@ function parseTaskRef(path) {
|
|
|
597
591
|
versionId
|
|
598
592
|
};
|
|
599
593
|
}
|
|
600
|
-
|
|
601
|
-
//#region src/domains/cloud-v2/luau-execution-tasks/specs.ts
|
|
594
|
+
// src/domains/cloud-v2/luau-execution-tasks/specs.ts
|
|
602
595
|
function makeSpec(spec) {
|
|
603
596
|
return Object.freeze({
|
|
604
597
|
...spec,
|
|
@@ -959,8 +952,7 @@ async function fetchOnceAsync(dependencies, { budget, signal }) {
|
|
|
959
952
|
task: fetchResult.data
|
|
960
953
|
};
|
|
961
954
|
}
|
|
962
|
-
|
|
963
|
-
//#region src/resources/luau-execution/submit-once.ts
|
|
955
|
+
// src/resources/luau-execution/submit-once.ts
|
|
964
956
|
/**
|
|
965
957
|
* Submits a Luau task once. A 429 naming tasks that occupy the place never
|
|
966
958
|
* locks the submit operation out, whether or not the caller opted into
|
|
@@ -988,8 +980,7 @@ async function submitOnceAsync({ inner, options, parameters, refineError }) {
|
|
|
988
980
|
spec: SUBMIT_HEAD_SPEC
|
|
989
981
|
});
|
|
990
982
|
}
|
|
991
|
-
|
|
992
|
-
//#region src/resources/luau-execution/capacity-admission.ts
|
|
983
|
+
// src/resources/luau-execution/capacity-admission.ts
|
|
993
984
|
const MAX_CAPACITY_WAIT_MS = 2147483647;
|
|
994
985
|
/**
|
|
995
986
|
* Submits through capacity admission when the caller opts in.
|
|
@@ -1178,8 +1169,7 @@ async function admitWithinCapacityAsync({ capacityError, options, submitCall, wa
|
|
|
1178
1169
|
clearTimeout(timer);
|
|
1179
1170
|
}
|
|
1180
1171
|
}
|
|
1181
|
-
|
|
1182
|
-
//#region src/resources/luau-execution/polling-helpers.ts
|
|
1172
|
+
// src/resources/luau-execution/polling-helpers.ts
|
|
1183
1173
|
/**
|
|
1184
1174
|
* Builds the {@link PollDependencies} bundle used by {@link
|
|
1185
1175
|
* pollUntilDoneCoreAsync}, closing over the supplied {@link ResourceClient},
|
|
@@ -1257,7 +1247,6 @@ function withRequestDeadline(options, deadlineMs) {
|
|
|
1257
1247
|
deadlineMs
|
|
1258
1248
|
};
|
|
1259
1249
|
}
|
|
1260
|
-
//#endregion
|
|
1261
1250
|
export { pollUntilDoneCoreAsync as a, LIST_LOGS_SPEC as c, defaultPollDelay as i, LuauExecutionCapacityError as l, submitAndPollAsync as n, withBudgetRequestTimeout as o, submitWithCapacityAsync as r, GET_SPEC as s, buildPollDependencies as t };
|
|
1262
1251
|
|
|
1263
|
-
//# sourceMappingURL=polling-helpers-
|
|
1252
|
+
//# sourceMappingURL=polling-helpers-BtEYR5dN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polling-helpers-BtEYR5dN.mjs","names":["SECONDS_PER_MINUTE","malformed","makeSpec"],"sources":["../src/resources/luau-execution/capacity-error.ts","../src/domains/cloud-v2/luau-execution-task-logs/builders.ts","../src/domains/cloud-v2/luau-execution-task-logs/operations.ts","../src/domains/cloud-v2/luau-execution-task-logs/parsers.ts","../src/domains/cloud-v2/luau-execution-task-logs/specs.ts","../src/domains/cloud-v2/luau-execution-tasks/builders.ts","../src/domains/cloud-v2/luau-execution-tasks/operations.ts","../src/domains/cloud-v2/luau-execution-tasks/parsers.ts","../src/domains/cloud-v2/luau-execution-tasks/specs.ts","../src/resources/luau-execution/polling.ts","../src/resources/luau-execution/submit-once.ts","../src/resources/luau-execution/capacity-admission.ts","../src/resources/luau-execution/polling-helpers.ts"],"sourcesContent":["import type {\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport { OpenCloudError } from \"../../errors/base.ts\";\nimport { RateLimitError } from \"../../errors/rate-limit.ts\";\n\nconst UUID_PATTERN = \"[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\";\n\n/**\n * A Luau task submission refused because validated tasks occupy the target\n * place's execution capacity.\n *\n * @example\n *\n * ```ts\n * import { LuauExecutionCapacityError } from \"@bedrock-rbx/ocale/luau-execution\";\n *\n * const error = new LuauExecutionCapacityError([{\n * placeId: \"456\",\n * sessionId: \"11111111-1111-4111-8111-111111111111\",\n * taskId: \"22222222-2222-4222-8222-222222222222\",\n * universeId: \"123\",\n * versionId: \"789\",\n * }]);\n * expect(error.blockers).toHaveLength(1);\n * ```\n *\n * @since 0.3.2\n */\nexport class LuauExecutionCapacityError extends OpenCloudError {\n\t/** Validated task references reported as occupying the target place. */\n\tpublic readonly blockers: ReadonlyArray<LuauExecutionTaskRef>;\n\tpublic override readonly name = \"LuauExecutionCapacityError\";\n\n\t/**\n\t * Creates a capacity failure from validated blocker references.\n\t *\n\t * @param blockers - Tasks reported as occupying the submitted place.\n\t */\n\tconstructor(blockers: ReadonlyArray<LuauExecutionTaskRef>) {\n\t\tsuper(\"Luau execution capacity is occupied\", { code: \"RESOURCE_EXHAUSTED\" });\n\t\tthis.blockers = Object.freeze(blockers.map((blocker) => Object.freeze({ ...blocker })));\n\t}\n}\n\n/**\n * Builds the identity key shared by capacity blocker collections.\n *\n * @param ref - Luau task reference to identify.\n * @returns The version, session, and task identity components.\n */\nexport function luauTaskRefKey(ref: LuauExecutionTaskRef): string {\n\treturn `${ref.versionId}/${ref.sessionId}/${ref.taskId}`;\n}\n\n/**\n * Converts a positively identified Luau capacity response into its typed\n * error.\n *\n * @param error - The response error to inspect.\n * @param parameters - The submitted target used to validate blocker refs.\n * @returns A typed capacity error, or `undefined` without positive evidence.\n */\nexport function capacityErrorFrom(\n\terror: OpenCloudError,\n\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n): LuauExecutionCapacityError | undefined {\n\tconst blockers = capacityBlockersFrom(error, parameters);\n\treturn blockers.length === 0 ? undefined : new LuauExecutionCapacityError(blockers);\n}\n\n/**\n * Checks whether a response error positively names tasks occupying the\n * submitted place. Such a 429 clears when those tasks end, not at its\n * guided wait, so it never locks the submit operation out.\n *\n * @param error - The response error to inspect.\n * @param parameters - The submitted target used to validate blocker refs.\n * @returns Whether the error names at least one validated blocker.\n */\nexport function namesCapacityBlockers(\n\terror: OpenCloudError,\n\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n): boolean {\n\treturn capacityBlockersFrom(error, parameters).length > 0;\n}\n\nfunction capacityMessage(details: JSONValue | undefined): string | undefined {\n\tif (details === null || typeof details !== \"object\" || Array.isArray(details)) {\n\t\treturn undefined;\n\t}\n\n\tconst code = Reflect.get(details, \"code\");\n\tconst message = Reflect.get(details, \"message\");\n\treturn code === \"RESOURCE_EXHAUSTED\" && typeof message === \"string\" ? message : undefined;\n}\n\nfunction escapeRegExp(value: string): string {\n\treturn value.replace(/[.*+?^${}()|[\\]\\\\]/gu, \"\\\\$&\");\n}\n\nfunction compareTaskRefs(left: LuauExecutionTaskRef, right: LuauExecutionTaskRef): number {\n\treturn luauTaskRefKey(left).localeCompare(luauTaskRefKey(right));\n}\n\nfunction blockerRefsFrom(\n\tmessage: string,\n\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n): ReadonlyArray<LuauExecutionTaskRef> {\n\tconst universeId = escapeRegExp(parameters.universeId);\n\tconst placeId = escapeRegExp(parameters.placeId);\n\tconst pattern = new RegExp(\n\t\t`universes/(${universeId})/places/(${placeId})/versions/([1-9][0-9]*)/luau-execution-sessions/(${UUID_PATTERN})/tasks/(${UUID_PATTERN})(?=$|[^A-Za-z0-9_-])`,\n\t\t\"giu\",\n\t);\n\tconst unique = new Map<string, LuauExecutionTaskRef>();\n\tfor (const match of message.matchAll(pattern)) {\n\t\tconst matchedUniverseId = String(match[1]);\n\t\tconst matchedPlaceId = String(match[2]);\n\t\tconst versionId = String(match[3]);\n\t\tconst sessionId = String(match[4]);\n\t\tconst taskId = String(match[5]);\n\n\t\tconst ref = Object.freeze({\n\t\t\tplaceId: matchedPlaceId,\n\t\t\tsessionId,\n\t\t\ttaskId,\n\t\t\tuniverseId: matchedUniverseId,\n\t\t\tversionId,\n\t\t});\n\t\tunique.set(luauTaskRefKey(ref), ref);\n\t}\n\n\treturn Object.freeze([...unique.values()].toSorted(compareTaskRefs));\n}\n\nfunction capacityBlockersFrom(\n\terror: OpenCloudError,\n\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n): ReadonlyArray<LuauExecutionTaskRef> {\n\tif (!(error instanceof RateLimitError) || error.code !== \"RESOURCE_EXHAUSTED\") {\n\t\treturn [];\n\t}\n\n\tconst message = capacityMessage(error.details);\n\treturn message === undefined ? [] : blockerRefsFrom(message, parameters);\n}\n","import type { HttpRequest } from \"../../../client/types.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { ListLogsParameters } from \"./types.ts\";\n\n/**\n * Builds a `GET` request for the Open Cloud \"list Luau execution session\n * task logs\" endpoint. The endpoint requires the maximal x-aep-resource\n * path shape (universe, place, version, session, task), so the supplied\n * ref must include `versionId` and `sessionId`; refs extracted from the\n * narrower path formats are rejected with a {@link ValidationError}.\n *\n * The `view` query parameter is hard-coded to `STRUCTURED` so callers\n * always receive typed structured messages. No public `view` parameter\n * is exposed.\n *\n * @param parameters - Task ref, and optional `pageSize` and `pageToken`\n * pagination controls.\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when the ref is missing `versionId` or\n * `sessionId`.\n */\nexport function buildListLogsRequest({\n\tpageSize,\n\tpageToken,\n\tref,\n}: ListLogsParameters): Result<HttpRequest, ValidationError> {\n\tconst { placeId, sessionId, taskId, universeId, versionId } = ref;\n\n\tif (versionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing versionId; cannot list logs\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tif (sessionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing sessionId; cannot list logs\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst base = `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-sessions/${sessionId}/tasks/${taskId}/logs`;\n\tconst url = `${base}?${buildQuery(pageSize, pageToken).toString()}`;\n\treturn { data: { method: \"GET\", url }, success: true };\n}\n\nfunction buildQuery(pageSize: number | undefined, pageToken: string | undefined): URLSearchParams {\n\tconst query = new URLSearchParams({ view: \"STRUCTURED\" });\n\n\tif (pageSize !== undefined) {\n\t\tquery.append(\"maxPageSize\", String(pageSize));\n\t}\n\n\tif (pageToken !== undefined) {\n\t\tquery.append(\"pageToken\", pageToken);\n\t}\n\n\treturn query;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst LIST_LOGS_PER_MINUTE = 45;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for listing Luau execution task logs,\n * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_ListLuauExecutionSessionTaskLogs` operation (45 requests per\n * minute per API key owner), which is also the burst the server allows.\n */\nexport const LIST_LOGS_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: LIST_LOGS_PER_MINUTE,\n\tmaxPerSecond: LIST_LOGS_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-task-logs.list\",\n});\n\n/**\n * Scopes required to list Luau execution task logs, sourced from\n * `x-roblox-scopes` on the list-logs operation in the vendored OpenAPI\n * schema. Surfaced via the `requiredScopes` field of the per-method\n * spec so a 401 or 403 ApiError is upgraded to a `PermissionError`\n * naming the missing scope. Only `:read` is required as the\n * minimum-privilege scope for this read-only operation.\n */\nexport const LIST_LOGS_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:read\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { LogMessage, LogPage } from \"./types.ts\";\nimport type { LogChunkWire, LogMessageWire } from \"./wire.ts\";\n\nconst MALFORMED_LOGS_MESSAGE = \"Malformed list-luau-execution-task-logs response\";\n\n/**\n * Parses a successful Open Cloud list-luau-execution-task-logs response\n * body into the public {@link LogPage} shape. Chunks are flattened into\n * a single ordered array of {@link LogMessage} values.\n *\n * The SDK requests STRUCTURED view, so both the chunk list and each\n * chunk's message array must be present. Explicit empty arrays are valid;\n * missing arrays reject the page rather than silently losing log output.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link LogPage}, or an\n * {@link UnexpectedResponseError} when the body does not match a supported\n * shape.\n */\nexport function parseListLogsResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<LogPage, UnexpectedResponseError> {\n\tif (!isRecord(body)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst rawChunks = body[\"luauExecutionSessionTaskLogs\"];\n\tif (!isLogChunks(rawChunks)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst rawToken = body[\"nextPageToken\"];\n\tif (rawToken !== undefined && typeof rawToken !== \"string\") {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst messages: Array<LogMessage> = [];\n\tfor (const chunk of rawChunks) {\n\t\tfor (const wireMessage of chunk.structuredMessages) {\n\t\t\tmessages.push({\n\t\t\t\tcreateTime: wireMessage.createTime,\n\t\t\t\tmessage: wireMessage.message,\n\t\t\t\tmessageType: wireMessage.messageType,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn {\n\t\tdata: { messages, nextPageToken: rawToken },\n\t\tsuccess: true,\n\t};\n}\n\nfunction isAcceptedMessageType(value: unknown): value is LogMessageWire[\"messageType\"] {\n\treturn (\n\t\tvalue === \"MESSAGE_TYPE_UNSPECIFIED\" ||\n\t\tvalue === \"OUTPUT\" ||\n\t\tvalue === \"INFO\" ||\n\t\tvalue === \"WARNING\" ||\n\t\tvalue === \"ERROR\"\n\t);\n}\n\nfunction isLogMessageWire(value: unknown): value is LogMessageWire {\n\treturn (\n\t\tisRecord(value) &&\n\t\ttypeof value[\"createTime\"] === \"string\" &&\n\t\ttypeof value[\"message\"] === \"string\" &&\n\t\tisAcceptedMessageType(value[\"messageType\"])\n\t);\n}\n\n/**\n * Requires an explicit message array: captured no-print tasks return `[]`.\n * Missing or null messages do not establish that a chunk has no output.\n *\n * @param value - The chunk's untrusted `structuredMessages` field.\n * @returns Whether the field is an array containing only valid messages.\n */\nfunction isStructuredMessages(value: unknown): value is ReadonlyArray<LogMessageWire> {\n\treturn Array.isArray(value) && value.every((item) => isLogMessageWire(item));\n}\n\n/**\n * Validates a chunk for the STRUCTURED view always requested by the SDK.\n * The schema also describes FLAT chunks that omit `structuredMessages`;\n * accepting those here would silently discard their output.\n *\n * @param value - An untrusted entry in the response's chunk list.\n * @returns Whether the chunk contains a valid structured message array.\n */\nfunction isLogChunkWire(value: unknown): value is LogChunkWire {\n\treturn isRecord(value) && isStructuredMessages(value[\"structuredMessages\"]);\n}\n\n/**\n * Requires an explicit chunk list, including `[]` for an empty page.\n * Validates every chunk before flattening so one malformed chunk rejects\n * the whole page instead of returning a partial log list.\n *\n * @param value - The untrusted `luauExecutionSessionTaskLogs` field.\n * @returns Whether the field is an array containing only valid chunks.\n */\nfunction isLogChunks(value: unknown): value is ReadonlyArray<LogChunkWire> {\n\treturn Array.isArray(value) && value.every((item) => isLogChunkWire(item));\n}\n\nfunction malformed(statusCode: number, body: unknown): Result<LogPage, UnexpectedResponseError> {\n\treturn {\n\t\terr: new UnexpectedResponseError(MALFORMED_LOGS_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n","import { IDEMPOTENT_METHOD_DEFAULTS } from \"../../../internal/http/retry.ts\";\nimport type { ResourceMethodSpec } from \"../../../internal/resource-client.ts\";\nimport { buildListLogsRequest } from \"./builders.ts\";\nimport { LIST_LOGS_OPERATION_LIMIT, LIST_LOGS_REQUIRED_SCOPES } from \"./operations.ts\";\nimport { parseListLogsResponse } from \"./parsers.ts\";\nimport type { ListLogsParameters, LogPage } from \"./types.ts\";\n\nfunction makeSpec<P>(spec: ResourceMethodSpec<P, LogPage>): ResourceMethodSpec<P, LogPage> {\n\treturn Object.freeze({ ...spec, apiKeyOnly: true });\n}\n\n/**\n * Per-method dispatch spec for listing the structured log messages\n * produced by a Luau execution task. Frozen at module scope so both\n * the top-level `LuauExecutionClient` and the `luauExecution` Operation\n * Group on `PlacesClient` share the same instance reference.\n */\nexport const LIST_LOGS_SPEC = makeSpec<ListLogsParameters>({\n\tbuildRequest: buildListLogsRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: LIST_LOGS_OPERATION_LIMIT,\n\tparse: parseListLogsResponse,\n\trequiredScopes: LIST_LOGS_REQUIRED_SCOPES,\n});\n","import type { HttpRequest } from \"../../../client/types.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { GetParameters, SubmitAtHeadParameters, SubmitAtVersionParameters } from \"./types.ts\";\n\ninterface SubmitBodyInput {\n\treadonly binaryInput?: string | undefined;\n\treadonly enableBinaryOutput?: boolean | undefined;\n\treadonly script: string;\n\treadonly timeoutSeconds?: number;\n}\n\nconst JSON_HEADERS: Readonly<Record<string, string>> = { \"content-type\": \"application/json\" };\n\n/**\n * Builds a `POST` request for the Open Cloud \"create Luau execution\n * session task\" endpoint, targeting the place's head version. Serializes\n * `timeoutSeconds` into the wire's duration string format (`\"<n>s\"`)\n * when supplied.\n *\n * @param parameters - Universe and place identifiers, the script body,\n * and an optional `timeoutSeconds`.\n * @returns A pure {@link HttpRequest} describing the submit call.\n */\nexport function buildSubmitAtHeadRequest(parameters: SubmitAtHeadParameters): HttpRequest {\n\tconst { placeId, universeId } = parameters;\n\treturn {\n\t\tbody: buildSubmitBody(parameters),\n\t\theaders: JSON_HEADERS,\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}/luau-execution-session-tasks`,\n\t};\n}\n\n/**\n * Builds a `POST` request for the Open Cloud \"create Luau execution\n * session task\" endpoint, targeting a specific place version. Differs\n * from {@link buildSubmitAtHeadRequest} only in URL shape: the path\n * includes the `versions/{versionId}` segment so the script runs\n * against that exact place version instead of the live head.\n *\n * @param parameters - Universe, place, and version identifiers, the\n * script body, and an optional `timeoutSeconds`.\n * @returns A pure {@link HttpRequest} describing the submit call.\n */\nexport function buildSubmitAtVersionRequest(parameters: SubmitAtVersionParameters): HttpRequest {\n\tconst { placeId, universeId, versionId } = parameters;\n\treturn {\n\t\tbody: buildSubmitBody(parameters),\n\t\theaders: JSON_HEADERS,\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-session-tasks`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the Open Cloud \"read Luau execution session\n * task\" endpoint. The endpoint accepts only the maximal x-aep-resource\n * path shape (universe, place, version, session, task), so the supplied\n * ref must include `versionId` and `sessionId`; refs extracted from the\n * narrower path formats are rejected with a {@link ValidationError}.\n *\n * @param parameters - Task ref and optional view selector. When `view`\n * is omitted, no `?view=` query is sent and the server applies its\n * own default (`BASIC`).\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when the ref is missing `versionId` or\n * `sessionId`.\n */\nexport function buildGetRequest({\n\tref,\n\tview,\n}: GetParameters): Result<HttpRequest, ValidationError> {\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({\n\tbinaryInput,\n\tenableBinaryOutput: shouldEnableBinaryOutput,\n\tscript,\n\ttimeoutSeconds,\n}: SubmitBodyInput): Record<string, unknown> {\n\tconst body: Record<string, unknown> = { script };\n\tif (timeoutSeconds !== undefined) {\n\t\tbody[\"timeout\"] = `${timeoutSeconds}s`;\n\t}\n\n\tif (binaryInput !== undefined) {\n\t\tbody[\"binaryInput\"] = binaryInput;\n\t}\n\n\tif (shouldEnableBinaryOutput !== undefined) {\n\t\tbody[\"enableBinaryOutput\"] = shouldEnableBinaryOutput;\n\t}\n\n\treturn body;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst SUBMIT_AT_HEAD_PER_MINUTE = 5;\nconst SUBMIT_AT_VERSION_PER_MINUTE = 5;\nconst GET_PER_MINUTE = 200;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for submitting a Luau execution task at a\n * place's head version, sourced from\n * `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_CreateLuauExecutionSessionTask__Using_Universes` operation\n * (5 requests per minute per API key owner), which is also the burst\n * the server allows.\n */\nexport const SUBMIT_HEAD_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: SUBMIT_AT_HEAD_PER_MINUTE,\n\tmaxPerSecond: SUBMIT_AT_HEAD_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.submit\",\n});\n\n/**\n * Per-second request ceiling for submitting a Luau execution task at a\n * specific place version, sourced from\n * `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_CreateLuauExecutionSessionTask__Using_Universes_Places`\n * operation (5 requests per minute per API key owner), which is also\n * the burst the server allows. Carries its own operation key so the\n * version-pinned URL shape is paced from its own quota: the server\n * meters the two shapes in separate buckets whose ceilings are\n * additive, and pinned traffic does not consume head budget. The two\n * ceilings are equal (5 each), but equal is not shared.\n */\nexport const SUBMIT_VERSION_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: SUBMIT_AT_VERSION_PER_MINUTE,\n\tmaxPerSecond: SUBMIT_AT_VERSION_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.submit-at-version\",\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 { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport { isDateTimeString } from \"../../../internal/utils/is-date-time-string.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { LuauExecutionTask, LuauExecutionTaskRef } from \"./types.ts\";\nimport type {\n\tLuauExecutionTaskErrorWire,\n\tLuauExecutionTaskOutputWire,\n\tLuauExecutionTaskWire,\n} from \"./wire.ts\";\n\nconst MALFORMED_TASK_MESSAGE = \"Malformed luau-execution-session-task response\";\n\n// Matches any of the four x-aep-resource path formats for a luau\n// execution session task.\n//\n// Capture groups:\n// 1. universeId\n// 2. placeId\n// 3. versionId (when `/versions/{v}/` segment is present, else undefined)\n// 4. sessionId (when `/luau-execution-sessions/{s}/tasks/...` branch matched)\n// 5. taskId (when `/luau-execution-sessions/.../tasks/{t}` branch matched)\n// 6. taskId (when `/luau-execution-session-tasks/{t}` branch matched)\nconst PATH_PATTERN =\n\t/^universes\\/(\\d+)\\/places\\/(\\d+)(?:\\/versions\\/(\\d+))?(?:\\/luau-execution-sessions\\/([^/]+)\\/tasks\\/([^/]+)|\\/luau-execution-session-tasks\\/([^/]+))$/;\n\ntype InProgressWireState = Exclude<LuauExecutionTaskWire[\"state\"], \"COMPLETE\" | \"FAILED\">;\n\ninterface ParseVariantArgs {\n\treadonly body: LuauExecutionTaskWire;\n\treadonly createdAt: Date | undefined;\n\treadonly ref: LuauExecutionTaskRef;\n\treadonly statusCode: number;\n\treadonly timeoutSeconds: number | undefined;\n\treadonly updatedAt: Date | 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 UnexpectedResponseError} when the body or path do not match a\n * supported shape.\n */\nexport function parseLuauExecutionTaskResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<LuauExecutionTask, UnexpectedResponseError> {\n\tif (!isLuauExecutionTaskWire(body)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst ref = parseTaskRef(body.path);\n\tif (ref === undefined) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst timeoutSeconds = parseTimeoutSeconds(body.timeout);\n\tconst createdAt = parseOptionalDate(body.createTime);\n\tconst updatedAt = parseOptionalDate(body.updateTime);\n\n\tif (body.state === \"COMPLETE\") {\n\t\treturn parseCompleteTask({ body, createdAt, ref, statusCode, timeoutSeconds, updatedAt });\n\t}\n\n\tif (body.state === \"FAILED\") {\n\t\treturn parseFailedTask({ body, createdAt, ref, statusCode, timeoutSeconds, updatedAt });\n\t}\n\n\treturn parseInProgressTask({\n\t\tbody,\n\t\tcreatedAt,\n\t\tref,\n\t\tstate: body.state,\n\t\tstatusCode,\n\t\ttimeoutSeconds,\n\t\tupdatedAt,\n\t});\n}\n\nfunction isAcceptedWireState(state: unknown): state is LuauExecutionTaskWire[\"state\"] {\n\treturn (\n\t\tstate === \"STATE_UNSPECIFIED\" ||\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 === \"ERROR_CODE_UNSPECIFIED\" ||\n\t\tcode === \"SCRIPT_ERROR\" ||\n\t\tcode === \"DEADLINE_EXCEEDED\" ||\n\t\tcode === \"OUTPUT_SIZE_LIMIT_EXCEEDED\" ||\n\t\tcode === \"INTERNAL_ERROR\"\n\t);\n}\n\nfunction isErrorWire(value: unknown): value is LuauExecutionTaskErrorWire {\n\treturn (\n\t\tisRecord(value) && isErrorWireCode(value[\"code\"]) && typeof value[\"message\"] === \"string\"\n\t);\n}\n\nfunction isOptionalErrorWire(value: unknown): value is LuauExecutionTaskErrorWire | undefined {\n\treturn value === undefined || isErrorWire(value);\n}\n\nfunction isOutputWire(value: unknown): value is LuauExecutionTaskOutputWire {\n\treturn isRecord(value) && Array.isArray(value[\"results\"]);\n}\n\nfunction isOptionalOutputWire(value: unknown): value is LuauExecutionTaskOutputWire | undefined {\n\treturn value === undefined || isOutputWire(value);\n}\n\nfunction isOptionalString(value: unknown): value is string | undefined {\n\treturn value === undefined || typeof value === \"string\";\n}\n\nfunction isOptionalBoolean(value: unknown): value is boolean | undefined {\n\treturn value === undefined || typeof value === \"boolean\";\n}\n\nfunction isOptionalDateTimeString(value: unknown): value is string | undefined {\n\treturn value === undefined || isDateTimeString(value);\n}\n\nfunction isLuauExecutionTaskWire(body: unknown): body is LuauExecutionTaskWire {\n\treturn (\n\t\tisRecord(body) &&\n\t\ttypeof body[\"path\"] === \"string\" &&\n\t\tisOptionalDateTimeString(body[\"createTime\"]) &&\n\t\tisOptionalDateTimeString(body[\"updateTime\"]) &&\n\t\tisAcceptedWireState(body[\"state\"]) &&\n\t\ttypeof body[\"user\"] === \"string\" &&\n\t\tisOptionalOutputWire(body[\"output\"]) &&\n\t\tisOptionalErrorWire(body[\"error\"]) &&\n\t\tisOptionalDurationWire(body[\"timeout\"]) &&\n\t\tisOptionalString(body[\"binaryInput\"]) &&\n\t\tisOptionalBoolean(body[\"enableBinaryOutput\"]) &&\n\t\tisOptionalString(body[\"binaryOutputUri\"])\n\t);\n}\n\nfunction parseOptionalDate(value: string | undefined): Date | undefined {\n\treturn value === undefined ? undefined : new Date(value);\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(\n\tstatusCode: number,\n\tbody: unknown,\n): Result<LuauExecutionTask, UnexpectedResponseError> {\n\treturn {\n\t\terr: new UnexpectedResponseError(MALFORMED_TASK_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n\nfunction parseInProgressTask({\n\tbody,\n\tcreatedAt,\n\tref,\n\tstate,\n\ttimeoutSeconds,\n\tupdatedAt,\n}: ParseVariantArgs & { readonly state: InProgressWireState }): Result<\n\tLuauExecutionTask,\n\tUnexpectedResponseError\n> {\n\treturn {\n\t\tdata: {\n\t\t\tbinaryInput: body.binaryInput,\n\t\t\tbinaryOutputUri: body.binaryOutputUri,\n\t\t\tcreatedAt,\n\t\t\tenableBinaryOutput: body.enableBinaryOutput,\n\t\t\tref,\n\t\t\tstate,\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt,\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseCompleteTask({\n\tbody,\n\tcreatedAt,\n\tref,\n\tstatusCode,\n\ttimeoutSeconds,\n\tupdatedAt,\n}: ParseVariantArgs): Result<LuauExecutionTask, UnexpectedResponseError> {\n\tif (body.output === undefined) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbinaryInput: body.binaryInput,\n\t\t\tbinaryOutputUri: body.binaryOutputUri,\n\t\t\tcreatedAt,\n\t\t\tenableBinaryOutput: body.enableBinaryOutput,\n\t\t\toutput: { results: body.output.results },\n\t\t\tref,\n\t\t\tstate: \"COMPLETE\",\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt,\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseFailedTask({\n\tbody,\n\tcreatedAt,\n\tref,\n\tstatusCode,\n\ttimeoutSeconds,\n\tupdatedAt,\n}: ParseVariantArgs): Result<LuauExecutionTask, UnexpectedResponseError> {\n\tif (body.error === undefined) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbinaryInput: body.binaryInput,\n\t\t\tbinaryOutputUri: body.binaryOutputUri,\n\t\t\tcreatedAt,\n\t\t\tenableBinaryOutput: body.enableBinaryOutput,\n\t\t\terror: { code: body.error.code, message: body.error.message },\n\t\t\tref,\n\t\t\tstate: \"FAILED\",\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt,\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_HEAD_OPERATION_LIMIT,\n\tSUBMIT_REQUIRED_SCOPES,\n\tSUBMIT_VERSION_OPERATION_LIMIT,\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, apiKeyOnly: true });\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_HEAD_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 required scope set with {@link\n * SUBMIT_HEAD_SPEC} but carries its own rate-limit queue: the server\n * meters the version-pinned URL shape in a bucket separate from the\n * head shape's.\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_VERSION_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: SUBMIT_REQUIRED_SCOPES,\n});\n\n/**\n * Per-method dispatch spec for fetching a Luau execution task. Uses\n * idempotent retry semantics (429 and 5xx both retried) so reads\n * recover transparently from transient server errors.\n */\nexport const GET_SPEC = makeSpec<GetParameters>({\n\tbuildRequest: buildGetRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: GET_REQUIRED_SCOPES,\n});\n","import type { RequestOptions } from \"../../client/types.ts\";\nimport type { LuauExecutionTask } from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { NetworkError } from \"../../errors/network-error.ts\";\nimport { PollAbortedError } from \"../../errors/poll-aborted.ts\";\nimport { PollTimeoutError } from \"../../errors/poll-timeout.ts\";\nimport { RequestDeadlineExceededError } from \"../../errors/request-deadline-exceeded.ts\";\nimport { MAX_ABORT_TIMEOUT_MS } from \"../../internal/http/request-deadline.ts\";\nimport { TRANSIENT_TRANSPORT_CODES } from \"../../internal/http/retry.ts\";\nimport { ABORTED, raceWithAbortAsync } from \"../../internal/utils/abort.ts\";\nimport { findErrorCode } from \"../../internal/utils/find-error-code.ts\";\nimport type { SleepFunc } from \"../../internal/utils/sleep.ts\";\nimport type { Result } from \"../../types.ts\";\n\n/** Default total polling budget in milliseconds (5 minutes). */\nexport const DEFAULT_POLL_TIMEOUT_MS = 300_000;\n\n/** One step of the default poll-cadence schedule. */\ninterface PollDelayTier {\n\t/** Delay in ms to wait between polls while within this tier. */\n\treadonly delayMs: number;\n\t/**\n\t * Upper elapsed-time bound (exclusive) at which this tier stops applying.\n\t */\n\treadonly untilMs: number;\n}\n\n/** Steady-state delay once elapsed time reaches the final tier bound. */\nconst STEADY_POLL_DELAY_MS = 5_000;\n\n/**\n * Fast-to-slow poll-cadence tiers keyed on elapsed wall-clock time. Elapsed\n * times at or beyond the last `untilMs` fall through to\n * {@link STEADY_POLL_DELAY_MS}.\n */\nconst DEFAULT_POLL_TIERS: ReadonlyArray<PollDelayTier> = [\n\t{ delayMs: 500, untilMs: 20_000 },\n\t{ delayMs: 1_000, untilMs: 60_000 },\n];\n\n/**\n * Default poll cadence as a function of elapsed wall-clock time since\n * polling began. Polls quickly while a task is young so short runs resolve\n * snappily, then eases off so a long run leaves rate-limit headroom for\n * newer tasks: 0-20s is 500ms, 20-60s is 1000ms, 60s+ is 5000ms.\n *\n * @since 0.1.0\n *\n * @example\n * ```ts\n * import { defaultPollDelay } from \"@bedrock-rbx/ocale/luau-execution\";\n *\n * expect(defaultPollDelay(0)).toBe(500);\n * expect(defaultPollDelay(30_000)).toBe(1000);\n * expect(defaultPollDelay(120_000)).toBe(5000);\n * ```\n *\n * @param elapsedMs - Milliseconds elapsed since polling started.\n * @returns The delay in milliseconds to wait before the next poll.\n */\nexport function defaultPollDelay(elapsedMs: number): number {\n\tconst tier = DEFAULT_POLL_TIERS.find((candidate) => elapsedMs < candidate.untilMs);\n\treturn tier?.delayMs ?? STEADY_POLL_DELAY_MS;\n}\n\n/**\n * Default number of consecutive transport failures tolerated before the poll\n * loop gives up. With per-request retries already absorbing isolated blips,\n * three consecutive loop-level failures signals a genuinely unreachable\n * endpoint, so it bails in seconds rather than spinning out the wall-clock\n * budget.\n */\nexport const DEFAULT_POLL_FAILURE_CAP = 3;\n\n/**\n * Injected dependencies for the deep-module polling loop. The `fetch`\n * callback is pre-bound by the wiring layer and closes over the task ref\n * and request options, keeping the core loop narrow.\n */\nexport interface PollDependencies {\n\t/**\n\t * Returns the current task or an error. Called on each loop iteration with\n\t * the absolute request deadline (epoch ms) that bounds the request, or\n\t * `undefined` when nothing bounds it.\n\t */\n\treadonly fetch: (\n\t\tdeadlineMs: number | undefined,\n\t) => Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/** Returns the current wall-clock time in ms. */\n\treadonly now: () => number;\n\t/** Injectable sleep for deterministic tests. */\n\treadonly sleep: SleepFunc;\n\t/**\n\t * Time the budget opened, when an earlier step (a submit) already spent\n\t * part of it. Defaults to `now()` at loop start.\n\t */\n\treadonly startedAt?: number;\n}\n\n/** The opened poll budget: its window and the deadline each request gets. */\nexport interface PollBudget {\n\t/** Absolute end of the budget, as epoch ms. May be infinite. */\n\treadonly budgetDeadlineMs: number;\n\t/** Deadline to pass to each request, or `undefined` when unbounded. */\n\treadonly requestDeadlineMs: number | undefined;\n\t/** Total budget in ms. */\n\treadonly timeoutMs: number;\n}\n\n/**\n * Public options accepted by `pollUntilDone` and `runUntilDone` on both client\n * surfaces.\n *\n * @since 0.1.0\n */\nexport type PollUntilDoneOptions = PollOptions & RequestOptions;\n\n/** Caller-supplied polling-loop options; all fields optional. */\ninterface PollOptions {\n\t/**\n\t * Consecutive transient transport failures tolerated before the loop gives\n\t * up. Defaults to {@link DEFAULT_POLL_FAILURE_CAP}. A successful poll\n\t * resets the count.\n\t */\n\treadonly maxConsecutivePollFailures?: number;\n\t/**\n\t * Returns the sleep duration given ms elapsed since polling started.\n\t * Defaults to {@link defaultPollDelay}.\n\t */\n\treadonly pollDelay?: (elapsedMs: number) => number;\n\t/**\n\t * When aborted, the loop returns {@link PollAbortedError} rather than\n\t * continuing.\n\t */\n\treadonly signal?: AbortSignal;\n\t/**\n\t * Total wall-clock budget in ms before the loop returns {@link\n\t * PollTimeoutError}. It also bounds each in-flight request through the\n\t * request deadline (the earlier of the budget end and any `deadlineMs`),\n\t * so a hanging request ends at the budget. For `runUntilDone` the budget\n\t * opens before the submit and covers it too.\n\t */\n\treadonly timeoutMs?: number;\n}\n\n/** Core loop options: the poll options plus the caller's request deadline. */\ntype CorePollOptions = Pick<RequestOptions, \"deadlineMs\"> & PollOptions;\n\ninterface ResolvedPollOptions {\n\treadonly maxFailures: number;\n\treadonly pollDelay: (elapsedMs: number) => number;\n\treadonly signal: AbortSignal | undefined;\n}\n\ninterface SleepWithAbortOptions {\n\treadonly ms: number;\n\treadonly signal: AbortSignal | undefined;\n\treadonly sleep: SleepFunc;\n}\n\ntype FetchOutcome =\n\t| { readonly error: NetworkError; readonly kind: \"transient\" }\n\t| { readonly error: OpenCloudError; readonly kind: \"failed\" }\n\t| { readonly kind: \"aborted\" }\n\t| { readonly kind: \"pending\"; readonly task: LuauExecutionTask }\n\t| { readonly kind: \"terminal\"; readonly task: LuauExecutionTask };\n\n/** Mutable-per-iteration loop state threaded through {@link applyOutcome}. */\ninterface LoopState {\n\treadonly consecutiveFailures: number;\n\treadonly lastTask: LuauExecutionTask | undefined;\n}\n\ntype LoopAction =\n\t| { readonly kind: \"continue\"; readonly state: LoopState }\n\t| { readonly kind: \"return\"; readonly result: Result<LuauExecutionTask, OpenCloudError> };\n\n/** Per-iteration inputs to {@link applyOutcome}. */\ninterface OutcomeContext {\n\treadonly budget: PollBudget;\n\treadonly maxFailures: number;\n\treadonly signal: AbortSignal | undefined;\n\treadonly state: LoopState;\n}\n\n/**\n * Opens the poll budget at `startedAt`. Each request gets the earlier of the\n * budget deadline and the caller's own `deadlineMs`. A non-finite budget\n * passes only the caller's deadline, since the transport rejects a\n * non-finite one.\n *\n * @param startedAt - Time the budget opened, as epoch ms.\n * @param options - The caller's `timeoutMs` and `deadlineMs`.\n * @returns The budget window and the per-request deadline.\n */\nexport function openPollBudget(\n\tstartedAt: number,\n\toptions: Pick<PollUntilDoneOptions, \"deadlineMs\" | \"timeoutMs\">,\n): PollBudget {\n\tconst timeoutMs = options.timeoutMs ?? DEFAULT_POLL_TIMEOUT_MS;\n\tconst budgetDeadlineMs = startedAt + timeoutMs;\n\tconst callerDeadlineMs = options.deadlineMs;\n\tif (!Number.isFinite(budgetDeadlineMs)) {\n\t\treturn { budgetDeadlineMs, requestDeadlineMs: callerDeadlineMs, timeoutMs };\n\t}\n\n\tconst requestDeadlineMs =\n\t\tcallerDeadlineMs === undefined\n\t\t\t? budgetDeadlineMs\n\t\t\t: Math.min(callerDeadlineMs, budgetDeadlineMs);\n\treturn { budgetDeadlineMs, requestDeadlineMs, timeoutMs };\n}\n\n/**\n * Maps a request failure caused by the budget deadline to\n * {@link PollTimeoutError}. Any other failure, including one from the\n * caller's own earlier deadline, is returned unchanged. A caller abort wins\n * over the budget, so the failure is also returned unchanged when the\n * caller's signal has fired.\n *\n * @param error - The failure a submit or poll request returned.\n * @param context - The opened budget, the last task observed, if any, and\n * the caller's signal.\n * @returns The poll timeout, or the original error.\n */\nexport function budgetFailure(\n\terror: OpenCloudError,\n\tcontext: {\n\t\tbudget: PollBudget;\n\t\tlastTask: LuauExecutionTask | undefined;\n\t\tsignal: AbortSignal | undefined;\n\t},\n): OpenCloudError {\n\tif (!isBudgetDeadline(error, context.budget) || context.signal?.aborted === true) {\n\t\treturn error;\n\t}\n\n\treturn makeTimeout(context.lastTask, { cause: error, timeoutMs: context.budget.timeoutMs });\n}\n\n/**\n * Defaults the per-request `timeout` to the effective poll budget when the\n * caller has not set one. A luau-execution submit and each poll `get` normally\n * answer in well under a second (the submit endpoint enqueues the task without\n * waiting for it to run), so the only job of a per-request deadline here is to\n * bound a black-hole connection. Leaving these requests on the client-wide 30s\n * default (tuned for snappy CRUD) turns a slow-but-alive backend into a\n * self-abort, an error the retry layer never retries by construction, before\n * the loop's wall-clock budget is ever consulted. Deriving the deadline from\n * `timeoutMs` keeps a single request alive exactly as long as the caller\n * already agreed to wait for the whole operation, so the backend can answer or\n * surface a retryable status instead. A budget longer than a timer can hold,\n * such as `Infinity`, is capped at the longest delay the transport accepts.\n *\n * @template TOptions - The concrete polling option shape to preserve.\n * @param options - The caller's poll and per-request options.\n * @returns The options with `timeout` filled from the budget when it was unset.\n */\nexport function withBudgetRequestTimeout<TOptions extends PollUntilDoneOptions>(\n\toptions: TOptions,\n): TOptions & { readonly timeout: number } {\n\tconst budgetMs = options.timeoutMs ?? DEFAULT_POLL_TIMEOUT_MS;\n\tconst timeout = options.timeout ?? Math.min(budgetMs, MAX_ABORT_TIMEOUT_MS);\n\treturn { ...options, timeout };\n}\n\n/**\n * Reports whether a Luau task can no longer change execution state.\n *\n * @param task - Task whose state should be classified.\n * @returns Whether the task is complete, failed, or cancelled.\n */\nexport function isTerminalTask(task: LuauExecutionTask): boolean {\n\treturn task.state === \"COMPLETE\" || task.state === \"FAILED\" || task.state === \"CANCELLED\";\n}\n\n/**\n * Core polling loop. Calls `deps.fetch()` repeatedly, sleeping\n * `pollDelay(elapsedMs)` ms between iterations, until a terminal state\n * is observed, the wall-clock budget is exhausted, or an `AbortSignal`\n * fires. A transient transport failure ({@link NetworkError}) is tolerated\n * and the loop continues, giving up only after `maxConsecutivePollFailures`\n * consecutive failures; any other failure aborts immediately, since an API\n * response (a 404 for a vanished task, a 403) means there is nothing left to\n * poll. A successful poll resets the failure count.\n *\n * @param deps - Injected fetch, now, and sleep callbacks.\n * @param options - Optional poll delay, timeout, failure cap, and abort signal.\n * @returns The terminal task, or an error if aborted, timed out, or the transport keeps failing.\n */\nexport async function pollUntilDoneCoreAsync(\n\tdeps: PollDependencies,\n\toptions: CorePollOptions = {},\n): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst { maxFailures, pollDelay, signal } = resolvePollOptions(options);\n\tif (signal?.aborted === true) {\n\t\treturn abortedResult(signal);\n\t}\n\n\tconst startedAt = deps.startedAt ?? deps.now();\n\tconst budget = openPollBudget(startedAt, options);\n\tlet state: LoopState = { consecutiveFailures: 0, lastTask: undefined };\n\tfor (;;) {\n\t\tconst elapsedMs = deps.now() - startedAt;\n\t\tif (elapsedMs >= budget.timeoutMs) {\n\t\t\treturn { err: makeTimeout(state.lastTask, budget), success: false };\n\t\t}\n\n\t\tconst outcome = await fetchOnceAsync(deps, { budget, signal });\n\t\tconst action = applyOutcome(outcome, { budget, maxFailures, signal, state });\n\t\tif (action.kind === \"return\") {\n\t\t\treturn action.result;\n\t\t}\n\n\t\t({ state } = action);\n\t\tconst sleepWasAborted = await sleepWithAbortAsync({\n\t\t\tms: pollDelay(elapsedMs),\n\t\t\tsignal,\n\t\t\tsleep: deps.sleep,\n\t\t});\n\t\tif (sleepWasAborted) {\n\t\t\treturn abortedResult(signal);\n\t\t}\n\t}\n}\n\n/**\n * Describes why the budget ended. A wait the transport refused up front\n * (one that carries `waitMs`) ends the poll before `timeoutMs` has elapsed,\n * so its message reports the budget left rather than an elapsed timeout.\n *\n * @param cause - The budget deadline failure, if a request reported one.\n * @param timeoutMs - The total poll budget in ms.\n * @returns The elapsed-timeout wording, or the budget left and the refused wait.\n */\nfunction timeoutMessage(\n\tcause: RequestDeadlineExceededError | undefined,\n\ttimeoutMs: number,\n): string {\n\tif (cause?.waitMs === undefined) {\n\t\treturn `Polling timed out after ${timeoutMs} ms`;\n\t}\n\n\treturn `Polling stopped with ${cause.remainingMs} ms of the ${timeoutMs} ms budget left: a required ${cause.waitMs} ms wait would exceed it`;\n}\n\nfunction makeTimeout(\n\ttask: LuauExecutionTask | undefined,\n\t{ cause, timeoutMs }: { cause?: RequestDeadlineExceededError; timeoutMs: number },\n): PollTimeoutError<LuauExecutionTask> {\n\treturn new PollTimeoutError(timeoutMessage(cause, timeoutMs), {\n\t\t...(cause === undefined ? {} : { cause }),\n\t\tlastObservedTask: task,\n\t\ttimeoutMs,\n\t});\n}\n\nfunction isBudgetDeadline(\n\terror: OpenCloudError,\n\tbudget: PollBudget,\n): error is RequestDeadlineExceededError {\n\treturn (\n\t\terror instanceof RequestDeadlineExceededError &&\n\t\terror.deadlineMs === budget.budgetDeadlineMs\n\t);\n}\n\nfunction resolvePollOptions(options: PollOptions): ResolvedPollOptions {\n\treturn {\n\t\tmaxFailures: options.maxConsecutivePollFailures ?? DEFAULT_POLL_FAILURE_CAP,\n\t\tpollDelay: options.pollDelay ?? defaultPollDelay,\n\t\tsignal: options.signal,\n\t};\n}\n\nfunction makeAborted(signal: AbortSignal | undefined): PollAbortedError {\n\treturn new PollAbortedError(\"Polling was aborted\", { reason: signal?.reason });\n}\n\nfunction abortedResult(signal: AbortSignal | undefined): Result<LuauExecutionTask, OpenCloudError> {\n\treturn { err: makeAborted(signal), success: false };\n}\n\n/**\n * Maps a single fetch outcome to the next loop action. Terminal, failed, and\n * aborted outcomes return immediately; a transient transport failure advances\n * the consecutive-failure count and returns once it reaches `maxFailures`; a\n * pending task resets the count and continues.\n *\n * @param outcome - The classified result of one poll fetch.\n * @param context - The loop state, failure cap, and abort signal.\n * @returns Whether to return a final Result or continue with updated state.\n */\nfunction applyOutcome(\n\toutcome: FetchOutcome,\n\t{ budget, maxFailures, signal, state }: OutcomeContext,\n): LoopAction {\n\tswitch (outcome.kind) {\n\t\tcase \"aborted\": {\n\t\t\treturn { kind: \"return\", result: abortedResult(signal) };\n\t\t}\n\t\tcase \"failed\": {\n\t\t\tif (signal?.aborted === true && isBudgetDeadline(outcome.error, budget)) {\n\t\t\t\treturn { kind: \"return\", result: abortedResult(signal) };\n\t\t\t}\n\n\t\t\tconst err = budgetFailure(outcome.error, { budget, lastTask: state.lastTask, signal });\n\t\t\treturn { kind: \"return\", result: { err, success: false } };\n\t\t}\n\t\tcase \"pending\": {\n\t\t\treturn { kind: \"continue\", state: { consecutiveFailures: 0, lastTask: outcome.task } };\n\t\t}\n\t\tcase \"terminal\": {\n\t\t\treturn { kind: \"return\", result: { data: outcome.task, success: true } };\n\t\t}\n\t\tcase \"transient\": {\n\t\t\tconst consecutiveFailures = state.consecutiveFailures + 1;\n\t\t\tif (consecutiveFailures >= maxFailures) {\n\t\t\t\treturn { kind: \"return\", result: { err: outcome.error, success: false } };\n\t\t\t}\n\n\t\t\treturn { kind: \"continue\", state: { consecutiveFailures, lastTask: state.lastTask } };\n\t\t}\n\t}\n}\n\nasync function sleepWithAbortAsync({ ms, signal, sleep }: SleepWithAbortOptions): Promise<boolean> {\n\treturn (await raceWithAbortAsync(async () => sleep(ms, signal), signal)) === ABORTED;\n}\n\n/**\n * A failed poll is worth re-polling only when it is a `NetworkError` carrying\n * a known transient transport code. A self-aborted request timeout has no\n * `code`, and an API response (4xx/5xx) is authoritative, so both abort the\n * loop rather than being re-polled. Transient-ness is classified against the\n * canonical `TRANSIENT_TRANSPORT_CODES` set; this is the loop's own tolerance\n * dimension, distinct from the per-request `retryableTransportCodes` override\n * (which governs request-level retries inside each poll). Loop tolerance is\n * bounded separately by `maxConsecutivePollFailures`.\n *\n * A 2xx whose body would not parse is deliberately not re-polled here: it is\n * recovered a layer down, by the request-level retry that\n * `RESPONSE_UNPARSEABLE` puts in every idempotent policy. Reaching this\n * function means that retry budget is already spent, and a fourth read of the\n * same body is not a different answer.\n *\n * @param error - The error returned by a failed poll.\n * @returns `true` when the loop should tolerate and re-poll.\n */\nfunction isTransientTransport(error: OpenCloudError): error is NetworkError {\n\tif (!(error instanceof NetworkError)) {\n\t\treturn false;\n\t}\n\n\tconst code = findErrorCode(error);\n\treturn code !== undefined && TRANSIENT_TRANSPORT_CODES.includes(code);\n}\n\nasync function fetchOnceAsync(\n\tdependencies: PollDependencies,\n\t{ budget, signal }: { budget: PollBudget; signal: AbortSignal | undefined },\n): Promise<FetchOutcome> {\n\tconst fetchResult = await raceWithAbortAsync(\n\t\tasync () => dependencies.fetch(budget.requestDeadlineMs),\n\t\tsignal,\n\t);\n\tif (fetchResult === ABORTED) {\n\t\treturn { kind: \"aborted\" };\n\t}\n\n\tif (!fetchResult.success) {\n\t\treturn isTransientTransport(fetchResult.err)\n\t\t\t? { error: fetchResult.err, kind: \"transient\" }\n\t\t\t: { error: fetchResult.err, kind: \"failed\" };\n\t}\n\n\treturn isTerminalTask(fetchResult.data)\n\t\t? { kind: \"terminal\", task: fetchResult.data }\n\t\t: { kind: \"pending\", task: fetchResult.data };\n}\n","import type { RequestOptions } from \"../../client/types.ts\";\nimport {\n\tSUBMIT_HEAD_SPEC,\n\tSUBMIT_VERSION_SPEC,\n} from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tLuauExecutionTask,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport type { ResourceClient } from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { namesCapacityBlockers } from \"./capacity-error.ts\";\n\n/** One Luau task submission attempt through the resource client. */\nexport interface SubmitOnceCall {\n\t/** The resource client the submit runs through. */\n\treadonly inner: ResourceClient;\n\t/** Per-request options for the attempt. */\n\treadonly options: RequestOptions;\n\t/** The submitted target. */\n\treadonly parameters: SubmitAtHeadParameters | SubmitAtVersionParameters;\n\t/** Optionally refines a transport error with capacity evidence. */\n\treadonly refineError?: ((error: OpenCloudError) => OpenCloudError) | undefined;\n}\n\n/**\n * Submits a Luau task once. A 429 naming tasks that occupy the place never\n * locks the submit operation out, whether or not the caller opted into\n * capacity admission: it clears when those tasks end.\n *\n * @param call - Resource client, submit parameters, options, and refinement.\n * @returns The submitted task or the failure the attempt produced.\n */\nexport async function submitOnceAsync({\n\tinner,\n\toptions,\n\tparameters,\n\trefineError,\n}: SubmitOnceCall): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tfunction exemptsLockout(error: OpenCloudError): boolean {\n\t\treturn namesCapacityBlockers(error, parameters);\n\t}\n\n\tconst call = { exemptsLockout, options, refineError };\n\treturn \"versionId\" in parameters\n\t\t? inner.executeAsync({ ...call, parameters, spec: SUBMIT_VERSION_SPEC })\n\t\t: inner.executeAsync({ ...call, parameters, spec: SUBMIT_HEAD_SPEC });\n}\n","import type { RequestOptions } from \"../../client/types.ts\";\nimport { GET_SPEC } from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { observeAdmissionWaitAsync } from \"../../internal/http/admission-wait.ts\";\nimport { waitDeadlineFailure } from \"../../internal/http/request-deadline.ts\";\nimport type { ResourceClient } from \"../../internal/resource-client.ts\";\nimport { raceWithAbortAsync } from \"../../internal/utils/abort.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { capacityErrorFrom, LuauExecutionCapacityError, luauTaskRefKey } from \"./capacity-error.ts\";\nimport { defaultPollDelay, isTerminalTask, type PollUntilDoneOptions } from \"./polling.ts\";\nimport { submitOnceAsync, type SubmitOnceCall } from \"./submit-once.ts\";\n\nconst MAX_CAPACITY_WAIT_MS = 2_147_483_647;\n\n/**\n * Per-request options for submitting a Luau execution task.\n *\n * @example\n *\n * ```ts\n * import type { LuauExecutionSubmitOptions } from \"@bedrock-rbx/ocale/luau-execution\";\n *\n * const options: LuauExecutionSubmitOptions = { capacityWaitMs: 60_000 };\n * expect(options.capacityWaitMs).toBe(60_000);\n * ```\n *\n * @since 0.3.2\n */\nexport interface LuauExecutionSubmitOptions extends RequestOptions {\n\t/**\n\t * Maximum milliseconds to spend waiting for occupied place capacity, from 1\n\t * through 2,147,483,647. Supplying this value opts the submission into\n\t * capacity-aware admission.\n\t */\n\treadonly capacityWaitMs?: number;\n}\n\n/**\n * Per-request capacity and polling options for submitting and awaiting a Luau\n * execution task.\n *\n * @since 0.3.2\n */\nexport type LuauExecutionRunOptions = LuauExecutionSubmitOptions & PollUntilDoneOptions;\n\ninterface CapacitySubmitCall {\n\treadonly inner: ResourceClient;\n\treadonly options: LuauExecutionSubmitOptions | undefined;\n\treadonly parameters: SubmitAtHeadParameters | SubmitAtVersionParameters;\n}\n\ninterface ObserveBlockersCall {\n\treadonly blockers: ReadonlyArray<LuauExecutionTaskRef>;\n\treadonly inner: ResourceClient;\n\treadonly options: RequestOptions;\n}\n\ninterface CapacityWaitCall extends ObserveBlockersCall {\n\treadonly capacityError: LuauExecutionCapacityError;\n\treadonly deadlineAt: number;\n\treadonly startedAt: number;\n}\n\ninterface CapacityAdmissionCall {\n\treadonly callerSignal: AbortSignal | undefined;\n\treadonly capacityError: LuauExecutionCapacityError;\n\treadonly deadlineAt: number;\n\treadonly options: RequestOptions;\n\treadonly startedAt: number;\n\treadonly submitCall: SubmitOnceCall;\n}\n\ninterface CapacitySleepCall {\n\treadonly inner: ResourceClient;\n\treadonly options: RequestOptions;\n\treadonly waitMs: number;\n}\n\ninterface CapacityRetryCall {\n\treadonly callerSignal: AbortSignal | undefined;\n\treadonly current: LuauExecutionCapacityError;\n\treadonly options: RequestOptions;\n\treadonly submitCall: SubmitOnceCall;\n}\n\ntype CapacityRetryDecision =\n\t| { readonly capacityError: LuauExecutionCapacityError; readonly continue: true }\n\t| {\n\t\t\treadonly continue: false;\n\t\t\treadonly result: Result<LuauExecutionTask, OpenCloudError>;\n\t };\n\n/**\n * Submits through capacity admission when the caller opts in.\n *\n * @param call - Resource client, submit parameters, and per-request options.\n * @returns The submitted task or the failure that stopped admission.\n */\nexport async function submitWithCapacityAsync({\n\tinner,\n\toptions,\n\tparameters,\n}: CapacitySubmitCall): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst { capacityWaitMs, ...requestOptions } = options ?? {};\n\tif (capacityWaitMs === undefined) {\n\t\treturn submitOnceAsync({ inner, options: requestOptions, parameters });\n\t}\n\n\tfunction refineError(error: OpenCloudError): OpenCloudError {\n\t\treturn capacityErrorFrom(error, parameters) ?? error;\n\t}\n\n\tconst submitCall = { inner, options: requestOptions, parameters, refineError };\n\tconst first = await submitOnceAsync(submitCall);\n\tif (!isCapacityFailure(first)) {\n\t\treturn first;\n\t}\n\n\tif (\n\t\t!Number.isFinite(capacityWaitMs) ||\n\t\tcapacityWaitMs < 1 ||\n\t\tcapacityWaitMs > MAX_CAPACITY_WAIT_MS\n\t) {\n\t\treturn first;\n\t}\n\n\treturn admitWithinCapacityAsync({\n\t\tcapacityError: first.err,\n\t\toptions: requestOptions,\n\t\tsubmitCall,\n\t\twaitMs: capacityWaitMs,\n\t});\n}\n\nfunction isCapacityFailure(\n\tresult: Result<LuauExecutionTask, OpenCloudError>,\n): result is { readonly err: LuauExecutionCapacityError; readonly success: false } {\n\treturn !result.success && result.err instanceof LuauExecutionCapacityError;\n}\n\nfunction capacityBoundAborted(\n\toptions: RequestOptions,\n\tcallerSignal: AbortSignal | undefined,\n): boolean {\n\treturn options.signal?.aborted === true && callerSignal?.aborted !== true;\n}\n\nasync function observeBlockersAsync({\n\tblockers,\n\tinner,\n\toptions,\n}: ObserveBlockersCall): Promise<Result<LuauExecutionTaskRef | undefined, OpenCloudError>> {\n\tfor (const blocker of blockers) {\n\t\tconst observed = await inner.executeAsync({\n\t\t\toptions,\n\t\t\tparameters: { ref: blocker, view: \"BASIC\" as const },\n\t\t\tspec: GET_SPEC,\n\t\t});\n\t\tif (!observed.success) {\n\t\t\treturn observed;\n\t\t}\n\n\t\tif (isTerminalTask(observed.data)) {\n\t\t\treturn { data: blocker, success: true };\n\t\t}\n\t}\n\n\treturn { data: undefined, success: true };\n}\n\nasync function sleepForCapacityAsync({ inner, options, waitMs }: CapacitySleepCall): Promise<void> {\n\tawait observeAdmissionWaitAsync({\n\t\tdurationMs: waitMs,\n\t\tobserver: options.onAdmissionWait,\n\t\treason: \"operation-capacity\",\n\t\twaitAsync: async () => {\n\t\t\treturn raceWithAbortAsync(\n\t\t\t\tasync () => inner.sleep(waitMs, options.signal),\n\t\t\t\toptions.signal,\n\t\t\t);\n\t\t},\n\t});\n}\n\nasync function observeWithinCapacityAsync({\n\tblockers,\n\tcapacityError,\n\tdeadlineAt,\n\tinner,\n\toptions,\n\tstartedAt,\n}: CapacityWaitCall): Promise<Result<LuauExecutionTaskRef, OpenCloudError>> {\n\twhile (Date.now() < deadlineAt) {\n\t\tconst observed = await observeBlockersAsync({ blockers, inner, options });\n\t\tif (!observed.success) {\n\t\t\treturn observed;\n\t\t}\n\n\t\tif (observed.data !== undefined) {\n\t\t\treturn { data: observed.data, success: true };\n\t\t}\n\n\t\tconst elapsedMs = Date.now() - startedAt;\n\t\tconst pollWaitMs = defaultPollDelay(elapsedMs);\n\t\tconst deadlineFailure = waitDeadlineFailure({\n\t\t\tcause: capacityError,\n\t\t\tdeadlineMs: options.deadlineMs,\n\t\t\twaitMs: pollWaitMs,\n\t\t\twaitReason: \"operation-capacity\",\n\t\t});\n\t\tif (deadlineFailure !== undefined) {\n\t\t\treturn { err: deadlineFailure, success: false };\n\t\t}\n\n\t\tconst waitMs = Math.min(pollWaitMs, deadlineAt - Date.now());\n\t\tawait sleepForCapacityAsync({ inner, options, waitMs });\n\t}\n\n\treturn { err: capacityError, success: false };\n}\n\nfunction hasSameBlockers(\n\tleft: LuauExecutionCapacityError,\n\tright: LuauExecutionCapacityError,\n): boolean {\n\tif (left.blockers.length !== right.blockers.length) {\n\t\treturn false;\n\t}\n\n\tconst rightKeys = new Set(right.blockers.map(luauTaskRefKey));\n\treturn left.blockers.every((blocker) => rightKeys.has(luauTaskRefKey(blocker)));\n}\n\nasync function retryAfterCapacityAsync({\n\tcallerSignal,\n\tcurrent,\n\toptions,\n\tsubmitCall,\n}: CapacityRetryCall): Promise<CapacityRetryDecision> {\n\tconst retried = await submitOnceAsync(submitCall);\n\tif (!retried.success && capacityBoundAborted(options, callerSignal)) {\n\t\treturn { continue: false, result: { err: current, success: false } };\n\t}\n\n\tif (!isCapacityFailure(retried) || hasSameBlockers(current, retried.err)) {\n\t\treturn { continue: false, result: retried };\n\t}\n\n\treturn { capacityError: retried.err, continue: true };\n}\n\nasync function runCapacityAdmissionAsync({\n\tcallerSignal,\n\tcapacityError,\n\tdeadlineAt,\n\toptions,\n\tstartedAt,\n\tsubmitCall,\n}: CapacityAdmissionCall): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst cleared = new Set<string>();\n\tlet current = capacityError;\n\twhile (true) {\n\t\tconst pending = current.blockers.filter((blocker) => !cleared.has(luauTaskRefKey(blocker)));\n\t\tif (pending.length === 0) {\n\t\t\treturn { err: current, success: false };\n\t\t}\n\n\t\tconst observed = await observeWithinCapacityAsync({\n\t\t\tblockers: pending,\n\t\t\tcapacityError: current,\n\t\t\tdeadlineAt,\n\t\t\tinner: submitCall.inner,\n\t\t\toptions,\n\t\t\tstartedAt,\n\t\t});\n\t\tif (!observed.success) {\n\t\t\treturn capacityBoundAborted(options, callerSignal)\n\t\t\t\t? { err: current, success: false }\n\t\t\t\t: observed;\n\t\t}\n\n\t\tcleared.add(luauTaskRefKey(observed.data));\n\t\tconst retry = await retryAfterCapacityAsync({ callerSignal, current, options, submitCall });\n\t\tif (!retry.continue) {\n\t\t\treturn retry.result;\n\t\t}\n\n\t\tcurrent = retry.capacityError;\n\t}\n}\n\nasync function admitWithinCapacityAsync({\n\tcapacityError,\n\toptions,\n\tsubmitCall,\n\twaitMs,\n}: {\n\treadonly capacityError: LuauExecutionCapacityError;\n\treadonly options: RequestOptions;\n\treadonly submitCall: SubmitOnceCall;\n\treadonly waitMs: number;\n}): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst deadline = new AbortController();\n\tconst timer = setTimeout(() => {\n\t\tdeadline.abort();\n\t}, waitMs);\n\tconst signal =\n\t\toptions.signal === undefined\n\t\t\t? deadline.signal\n\t\t\t: AbortSignal.any([options.signal, deadline.signal]);\n\tconst startedAt = Date.now();\n\ttry {\n\t\treturn await runCapacityAdmissionAsync({\n\t\t\tcallerSignal: options.signal,\n\t\t\tcapacityError,\n\t\t\tdeadlineAt: startedAt + waitMs,\n\t\t\toptions: { ...options, signal },\n\t\t\tstartedAt,\n\t\t\tsubmitCall: { ...submitCall, options: { ...submitCall.options, signal } },\n\t\t});\n\t} finally {\n\t\tclearTimeout(timer);\n\t}\n}\n","import { GET_SPEC } from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport type { ResourceClient } from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { type LuauExecutionRunOptions, submitWithCapacityAsync } from \"./capacity-admission.ts\";\nimport {\n\tbudgetFailure,\n\topenPollBudget,\n\ttype PollDependencies,\n\tpollUntilDoneCoreAsync,\n\ttype PollUntilDoneOptions,\n} from \"./polling.ts\";\n\n/**\n * Builds the {@link PollDependencies} bundle used by {@link\n * pollUntilDoneCoreAsync}, closing over the supplied {@link ResourceClient},\n * task ref, and per-request options so the core loop stays narrow.\n *\n * @param inner - The {@link ResourceClient} that issues each `tasks.get` call.\n * @param args - The polling options and the task ref to fetch on every iteration.\n * @returns A {@link PollDependencies} bundle wiring `fetch`, `now`, and `sleep`.\n */\nexport function buildPollDependencies(\n\tinner: ResourceClient,\n\targs: { options: PollUntilDoneOptions; ref: LuauExecutionTaskRef },\n): PollDependencies {\n\treturn {\n\t\tfetch: async (deadlineMs) => {\n\t\t\treturn inner.executeAsync({\n\t\t\t\toptions: withRequestDeadline(args.options, deadlineMs),\n\t\t\t\tparameters: { ref: args.ref, view: \"BASIC\" },\n\t\t\t\tspec: GET_SPEC,\n\t\t\t});\n\t\t},\n\t\tnow: Date.now,\n\t\tsleep: inner.sleep,\n\t};\n}\n\n/**\n * Submits a Luau execution task and polls it to a terminal state. Dispatches\n * to the head-version or specific-version submit spec based on the presence of\n * `versionId`, then delegates to {@link pollUntilDoneCoreAsync}. The poll\n * budget opens before the submit, so `timeoutMs` covers the submit and the\n * polling together; a submit cut off by the budget returns\n * `PollTimeoutError` with no task.\n *\n * @param inner - The {@link ResourceClient} that issues submit and poll calls.\n * @param args - The polling options and submit parameters.\n * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask}, or\n * the {@link OpenCloudError} that caused submit or polling to fail.\n */\nexport async function submitAndPollAsync(\n\tinner: ResourceClient,\n\t{\n\t\toptions,\n\t\tparameters,\n\t}: {\n\t\toptions: LuauExecutionRunOptions;\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters;\n\t},\n): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst startedAt = Date.now();\n\tconst budget = openPollBudget(startedAt, options);\n\tconst submitResult = await submitWithCapacityAsync({\n\t\tinner,\n\t\toptions: withRequestDeadline(options, budget.requestDeadlineMs),\n\t\tparameters,\n\t});\n\tif (!submitResult.success) {\n\t\treturn {\n\t\t\terr: budgetFailure(submitResult.err, {\n\t\t\t\tbudget,\n\t\t\t\tlastTask: undefined,\n\t\t\t\tsignal: options.signal,\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn pollUntilDoneCoreAsync(\n\t\t{ ...buildPollDependencies(inner, { options, ref: submitResult.data.ref }), startedAt },\n\t\toptions,\n\t);\n}\n\n/**\n * Applies the budget's request deadline. It already folds in the caller's own\n * `deadlineMs`, so it is `undefined` only when the caller set none either.\n *\n * @template TOptions - The concrete option shape to preserve.\n * @param options - The caller's options.\n * @param deadlineMs - The request deadline from the opened budget.\n * @returns The options with `deadlineMs` set to the request deadline.\n */\nfunction withRequestDeadline<TOptions extends PollUntilDoneOptions>(\n\toptions: TOptions,\n\tdeadlineMs: number | undefined,\n): TOptions {\n\treturn { ...options, deadlineMs };\n}\n"],"mappings":";;;;;;;AAQA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;KAAE,KAAK,KAAK;KAAK,MAAM;IAAQ;IAC3C,MAAM;GACP,CAAC;EACF;EACA,KAAK,KAAK;EACV,OAAO,MAAM;CACd;AACD;;;;;;;;;;;;;;AAeA,eAAsB,mBACrB,OACA,EACC,SACA,cAKoD;CACrD,MAAM,YAAY,KAAK,IAAI;CAC3B,MAAM,SAAS,eAAe,WAAW,OAAO;CAChD,MAAM,eAAe,MAAM,wBAAwB;EAClD;EACA,SAAS,oBAAoB,SAAS,OAAO,iBAAiB;EAC9D;CACD,CAAC;CACD,IAAI,CAAC,aAAa,SACjB,OAAO;EACN,KAAK,cAAc,aAAa,KAAK;GACpC;GACA,UAAU,KAAA;GACV,QAAQ,QAAQ;EACjB,CAAC;EACD,SAAS;CACV;CAGD,OAAO,uBACN;EAAE,GAAG,sBAAsB,OAAO;GAAE;GAAS,KAAK,aAAa,KAAK;EAAI,CAAC;EAAG;CAAU,GACtF,OACD;AACD;;;;;;;;;;AAWA,SAAS,oBACR,SACA,YACW;CACX,OAAO;EAAE,GAAG;EAAS;CAAW;AACjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { N as isRecord } from "./retry-Dv5TsY9O.mjs";
|
|
2
|
+
// src/internal/price-information.ts
|
|
3
3
|
/**
|
|
4
4
|
* Narrows `value` to {@link PriceInformationLike} for a given feature literal
|
|
5
5
|
* union by delegating per-element validation to the supplied `isFeature`
|
|
@@ -36,7 +36,6 @@ function copyPriceInformation(wire) {
|
|
|
36
36
|
enabledFeatures: [...wire.enabledFeatures]
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { isPriceInformationLike as n, copyPriceInformation as t };
|
|
41
40
|
|
|
42
|
-
//# sourceMappingURL=price-information
|
|
41
|
+
//# sourceMappingURL=price-information--d6GZAcp.mjs.map
|