@bedrock-rbx/ocale 0.1.0-beta.2 → 0.1.0-beta.3

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.
Files changed (49) hide show
  1. package/dist/badges.d.mts +2 -2
  2. package/dist/badges.mjs +3 -3
  3. package/dist/{data.generated-BtkDGH8C.d.mts → data.generated-DOaDx6J0.d.mts} +1 -1
  4. package/dist/{data.generated-BtkDGH8C.d.mts.map → data.generated-DOaDx6J0.d.mts.map} +1 -1
  5. package/dist/developer-products.d.mts +2 -2
  6. package/dist/developer-products.mjs +4 -4
  7. package/dist/game-passes.d.mts +2 -2
  8. package/dist/game-passes.mjs +4 -4
  9. package/dist/index.d.mts +92 -3
  10. package/dist/index.d.mts.map +1 -1
  11. package/dist/index.mjs +3 -2
  12. package/dist/{is-date-time-string-Cuf1TaSC.mjs → is-date-time-string-Ds8Ew-Xa.mjs} +1 -1
  13. package/dist/{is-date-time-string-Cuf1TaSC.mjs.map → is-date-time-string-Ds8Ew-Xa.mjs.map} +1 -1
  14. package/dist/locales.d.mts +1 -1
  15. package/dist/luau-execution.d.mts +93 -6
  16. package/dist/luau-execution.d.mts.map +1 -1
  17. package/dist/luau-execution.mjs +115 -3
  18. package/dist/luau-execution.mjs.map +1 -1
  19. package/dist/places.d.mts +46 -6
  20. package/dist/places.d.mts.map +1 -1
  21. package/dist/places.mjs +23 -4
  22. package/dist/places.mjs.map +1 -1
  23. package/dist/poll-timeout-BdUcWv52.mjs +79 -0
  24. package/dist/poll-timeout-BdUcWv52.mjs.map +1 -0
  25. package/dist/{types-BZ0959rh.d.mts → polling-Cc50rgl6.d.mts} +106 -2
  26. package/dist/polling-Cc50rgl6.d.mts.map +1 -0
  27. package/dist/polling-helpers-BVkmr6C7.mjs +636 -0
  28. package/dist/polling-helpers-BVkmr6C7.mjs.map +1 -0
  29. package/dist/{price-information-s7DY0GV2.mjs → price-information-DFf89abd.mjs} +2 -2
  30. package/dist/{price-information-s7DY0GV2.mjs.map → price-information-DFf89abd.mjs.map} +1 -1
  31. package/dist/{rate-limit-DzHBFwps.d.mts → rate-limit-BSbFNSGT.d.mts} +2 -2
  32. package/dist/{rate-limit-DzHBFwps.d.mts.map → rate-limit-BSbFNSGT.d.mts.map} +1 -1
  33. package/dist/{resource-client-Wi4Mwqy5.mjs → resource-client-opC6BUkL.mjs} +10 -2
  34. package/dist/{resource-client-Wi4Mwqy5.mjs.map → resource-client-opC6BUkL.mjs.map} +1 -1
  35. package/dist/storage.d.mts +7 -1
  36. package/dist/storage.d.mts.map +1 -1
  37. package/dist/storage.mjs +2 -2
  38. package/dist/{to-blob-1BtHsDGK.mjs → to-blob-DHN7UoM8.mjs} +1 -1
  39. package/dist/{to-blob-1BtHsDGK.mjs.map → to-blob-DHN7UoM8.mjs.map} +1 -1
  40. package/dist/{types-Cp8w8uwA.d.mts → types-DUzm6maA.d.mts} +1 -1
  41. package/dist/{types-Cp8w8uwA.d.mts.map → types-DUzm6maA.d.mts.map} +1 -1
  42. package/dist/universes.d.mts +2 -2
  43. package/dist/universes.mjs +4 -4
  44. package/dist/{validation-b7KAoEio.mjs → validation-VImVHzxg.mjs} +1 -1
  45. package/dist/{validation-b7KAoEio.mjs.map → validation-VImVHzxg.mjs.map} +1 -1
  46. package/package.json +1 -1
  47. package/dist/specs-Co6qYp_E.mjs +0 -309
  48. package/dist/specs-Co6qYp_E.mjs.map +0 -1
  49. package/dist/types-BZ0959rh.d.mts.map +0 -1
@@ -1,309 +0,0 @@
1
- import { i as ApiError } from "./rate-limit-CKfuhxT1.mjs";
2
- import { t as ValidationError } from "./validation-b7KAoEio.mjs";
3
- import { a as IDEMPOTENT_METHOD_DEFAULTS, i as CREATE_METHOD_DEFAULTS, n as okRequest, o as isRecord } from "./resource-client-Wi4Mwqy5.mjs";
4
- //#region src/domains/cloud-v2/luau-execution-tasks/builders.ts
5
- const JSON_HEADERS = { "content-type": "application/json" };
6
- /**
7
- * Builds a `POST` request for the Open Cloud "create Luau execution
8
- * session task" endpoint, targeting the place's head version. Serializes
9
- * `timeoutSeconds` into the wire's duration string format (`"<n>s"`)
10
- * when supplied.
11
- *
12
- * @param parameters - Universe and place identifiers, the script body,
13
- * and an optional `timeoutSeconds`.
14
- * @returns A pure {@link HttpRequest} describing the submit call.
15
- */
16
- function buildSubmitAtHeadRequest(parameters) {
17
- const { placeId, universeId } = parameters;
18
- return {
19
- body: buildSubmitBody(parameters),
20
- headers: JSON_HEADERS,
21
- method: "POST",
22
- url: `/cloud/v2/universes/${universeId}/places/${placeId}/luau-execution-session-tasks`
23
- };
24
- }
25
- /**
26
- * Builds a `POST` request for the Open Cloud "create Luau execution
27
- * session task" endpoint, targeting a specific place version. Differs
28
- * from {@link buildSubmitAtHeadRequest} only in URL shape: the path
29
- * includes the `versions/{versionId}` segment so the script runs
30
- * against that exact place version instead of the live head.
31
- *
32
- * @param parameters - Universe, place, and version identifiers, the
33
- * script body, and an optional `timeoutSeconds`.
34
- * @returns A pure {@link HttpRequest} describing the submit call.
35
- */
36
- function buildSubmitAtVersionRequest(parameters) {
37
- const { placeId, universeId, versionId } = parameters;
38
- return {
39
- body: buildSubmitBody(parameters),
40
- headers: JSON_HEADERS,
41
- method: "POST",
42
- url: `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-session-tasks`
43
- };
44
- }
45
- /**
46
- * Builds a `GET` request for the Open Cloud "read Luau execution session
47
- * task" endpoint. The endpoint accepts only the maximal x-aep-resource
48
- * path shape (universe, place, version, session, task), so the supplied
49
- * ref must include `versionId` and `sessionId`; refs extracted from the
50
- * narrower path formats are rejected with a {@link ValidationError}.
51
- *
52
- * @param parameters - Task ref and optional view selector. When `view`
53
- * is omitted, no `?view=` query is sent and the server applies its
54
- * own default (`BASIC`).
55
- * @returns A success result wrapping the request, or a
56
- * {@link ValidationError} when the ref is missing `versionId` or
57
- * `sessionId`.
58
- */
59
- function buildGetRequest(parameters) {
60
- const { ref, view } = parameters;
61
- const { placeId, sessionId, taskId, universeId, versionId } = ref;
62
- if (versionId === void 0) return {
63
- err: new ValidationError("Task ref is missing versionId; cannot GET", { code: "incomplete_ref" }),
64
- success: false
65
- };
66
- if (sessionId === void 0) return {
67
- err: new ValidationError("Task ref is missing sessionId; cannot GET", { code: "incomplete_ref" }),
68
- success: false
69
- };
70
- const base = `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-sessions/${sessionId}/tasks/${taskId}`;
71
- return {
72
- data: {
73
- method: "GET",
74
- url: view === void 0 ? base : `${base}?view=${view}`
75
- },
76
- success: true
77
- };
78
- }
79
- function buildSubmitBody(parameters) {
80
- const { script, timeoutSeconds } = parameters;
81
- return timeoutSeconds === void 0 ? { script } : {
82
- script,
83
- timeout: `${timeoutSeconds}s`
84
- };
85
- }
86
- //#endregion
87
- //#region src/domains/cloud-v2/luau-execution-tasks/operations.ts
88
- const SUBMIT_PER_MINUTE = 40;
89
- const GET_PER_MINUTE = 200;
90
- const SECONDS_PER_MINUTE = 60;
91
- /**
92
- * Per-second request ceiling for submitting a Luau execution task,
93
- * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the
94
- * `Cloud_CreateLuauExecutionSessionTask__Using_Universes` operation
95
- * (40 requests per minute per API key owner). The two URL shapes
96
- * (head and version) share this queue because Roblox attributes both
97
- * to the same per-minute quota.
98
- */
99
- const SUBMIT_OPERATION_LIMIT = Object.freeze({
100
- maxPerSecond: SUBMIT_PER_MINUTE / SECONDS_PER_MINUTE,
101
- operationKey: "luau-execution-tasks.submit"
102
- });
103
- /**
104
- * Per-second request ceiling for fetching a Luau execution task,
105
- * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the
106
- * `Cloud_GetLuauExecutionSessionTask` operation (200 requests per
107
- * minute per API key owner).
108
- */
109
- const GET_OPERATION_LIMIT = Object.freeze({
110
- maxPerSecond: GET_PER_MINUTE / SECONDS_PER_MINUTE,
111
- operationKey: "luau-execution-tasks.get"
112
- });
113
- /**
114
- * Scopes required to submit a Luau execution task, sourced from
115
- * `x-roblox-scopes` on the create operation in the vendored OpenAPI
116
- * schema. Surfaced via the `requiredScopes` field of the per-method
117
- * spec so a 401 or 403 ApiError is upgraded to a `PermissionError`
118
- * naming the missing scope.
119
- */
120
- const SUBMIT_REQUIRED_SCOPES = Object.freeze(["universe.place.luau-execution-session:write"]);
121
- /**
122
- * Scopes required to fetch a Luau execution task, sourced from
123
- * `x-roblox-scopes` on the get operation. The `:write` scope also
124
- * grants read in upstream auth, but we surface only `:read` here as
125
- * the minimum-privilege requirement for this method.
126
- */
127
- const GET_REQUIRED_SCOPES = Object.freeze(["universe.place.luau-execution-session:read"]);
128
- //#endregion
129
- //#region src/domains/cloud-v2/luau-execution-tasks/parsers.ts
130
- const MALFORMED_TASK_MESSAGE = "Malformed luau-execution-session-task response";
131
- const PATH_PATTERN = /^universes\/(\d+)\/places\/(\d+)(?:\/versions\/(\d+))?(?:\/luau-execution-sessions\/([^/]+)\/tasks\/([^/]+)|\/luau-execution-session-tasks\/([^/]+))$/;
132
- /**
133
- * Parses a successful Open Cloud `LuauExecutionSessionTask` response
134
- * body into the public {@link LuauExecutionTask} discriminated union.
135
- * Handles every supported task state (in-progress, COMPLETE, FAILED)
136
- * across all four x-aep-resource path shapes the server returns.
137
- *
138
- * @param response - The full {@link HttpResponse} from the Open Cloud
139
- * API.
140
- * @returns A success result wrapping the parsed task, or an
141
- * {@link ApiError} when the body or path do not match a supported
142
- * shape.
143
- */
144
- function parseLuauExecutionTaskResponse(response) {
145
- const { body, status: statusCode } = response;
146
- if (!isLuauExecutionTaskWire(body)) return malformed(statusCode);
147
- const ref = parseTaskRef(body.path);
148
- if (ref === void 0) return malformed(statusCode);
149
- const timeoutSeconds = parseTimeoutSeconds(body.timeout);
150
- if (body.state === "COMPLETE") return parseCompleteTask({
151
- body,
152
- ref,
153
- statusCode,
154
- timeoutSeconds
155
- });
156
- if (body.state === "FAILED") return parseFailedTask({
157
- body,
158
- ref,
159
- statusCode,
160
- timeoutSeconds
161
- });
162
- return {
163
- data: {
164
- createdAt: new Date(body.createTime),
165
- ref,
166
- state: body.state,
167
- timeoutSeconds,
168
- updatedAt: new Date(body.updateTime),
169
- user: body.user
170
- },
171
- success: true
172
- };
173
- }
174
- function isAcceptedWireState(state) {
175
- return state === "QUEUED" || state === "PROCESSING" || state === "CANCELLED" || state === "COMPLETE" || state === "FAILED";
176
- }
177
- function isErrorWireCode(code) {
178
- return code === "SCRIPT_ERROR" || code === "DEADLINE_EXCEEDED" || code === "OUTPUT_SIZE_LIMIT_EXCEEDED" || code === "INTERNAL_ERROR";
179
- }
180
- function isErrorWire(value) {
181
- return isRecord(value) && isErrorWireCode(value["code"]) && typeof value["message"] === "string";
182
- }
183
- function isOptionalErrorWire(value) {
184
- return value === void 0 || isErrorWire(value);
185
- }
186
- function isOutputWire(value) {
187
- return isRecord(value) && Array.isArray(value["results"]);
188
- }
189
- function isOptionalOutputWire(value) {
190
- return value === void 0 || isOutputWire(value);
191
- }
192
- function isLuauExecutionTaskWire(body) {
193
- return isRecord(body) && typeof body["path"] === "string" && typeof body["createTime"] === "string" && typeof body["updateTime"] === "string" && isAcceptedWireState(body["state"]) && typeof body["user"] === "string" && isOptionalOutputWire(body["output"]) && isOptionalErrorWire(body["error"]) && isOptionalDurationWire(body["timeout"]);
194
- }
195
- const DURATION_PATTERN = /^(\d+)s$/;
196
- function isOptionalDurationWire(value) {
197
- return value === void 0 || typeof value === "string" && DURATION_PATTERN.test(value);
198
- }
199
- function parseTimeoutSeconds(value) {
200
- if (value === void 0) return;
201
- const seconds = DURATION_PATTERN.exec(value)?.[1];
202
- if (seconds === void 0) return;
203
- return Number.parseInt(seconds, 10);
204
- }
205
- function malformed(statusCode) {
206
- return {
207
- err: new ApiError(MALFORMED_TASK_MESSAGE, { statusCode }),
208
- success: false
209
- };
210
- }
211
- function parseCompleteTask(args) {
212
- const { body, ref, statusCode, timeoutSeconds } = args;
213
- if (body.output === void 0) return malformed(statusCode);
214
- return {
215
- data: {
216
- createdAt: new Date(body.createTime),
217
- output: { results: body.output.results },
218
- ref,
219
- state: "COMPLETE",
220
- timeoutSeconds,
221
- updatedAt: new Date(body.updateTime),
222
- user: body.user
223
- },
224
- success: true
225
- };
226
- }
227
- function parseFailedTask(args) {
228
- const { body, ref, statusCode, timeoutSeconds } = args;
229
- if (body.error === void 0) return malformed(statusCode);
230
- return {
231
- data: {
232
- createdAt: new Date(body.createTime),
233
- error: {
234
- code: body.error.code,
235
- message: body.error.message
236
- },
237
- ref,
238
- state: "FAILED",
239
- timeoutSeconds,
240
- updatedAt: new Date(body.updateTime),
241
- user: body.user
242
- },
243
- success: true
244
- };
245
- }
246
- function parseTaskRef(path) {
247
- const match = PATH_PATTERN.exec(path);
248
- if (match === null) return;
249
- const [, universeId, placeId, versionId, sessionId, sessionTaskId, plainTaskId] = match;
250
- const taskId = sessionTaskId ?? plainTaskId;
251
- if (universeId === void 0 || placeId === void 0 || taskId === void 0) return;
252
- return {
253
- placeId,
254
- sessionId,
255
- taskId,
256
- universeId,
257
- versionId
258
- };
259
- }
260
- //#endregion
261
- //#region src/domains/cloud-v2/luau-execution-tasks/specs.ts
262
- function makeSpec(spec) {
263
- return Object.freeze(spec);
264
- }
265
- /**
266
- * Per-method dispatch spec for submitting a Luau execution task at a
267
- * place's head version. Frozen at module scope so both the top-level
268
- * `LuauExecutionClient` and the `luauExecution` Operation Group on
269
- * `PlacesClient` share the same instance reference.
270
- */
271
- const SUBMIT_HEAD_SPEC = makeSpec({
272
- buildRequest: (parameters) => okRequest(buildSubmitAtHeadRequest(parameters)),
273
- methodDefaults: CREATE_METHOD_DEFAULTS,
274
- methodKind: "create",
275
- operationLimit: SUBMIT_OPERATION_LIMIT,
276
- parse: parseLuauExecutionTaskResponse,
277
- requiredScopes: SUBMIT_REQUIRED_SCOPES
278
- });
279
- /**
280
- * Per-method dispatch spec for submitting a Luau execution task at a
281
- * specific place version. Shares the rate-limit queue and required
282
- * scope set with {@link SUBMIT_HEAD_SPEC} because Roblox attributes
283
- * both URL shapes to one per-minute quota.
284
- */
285
- const SUBMIT_VERSION_SPEC = makeSpec({
286
- buildRequest: (parameters) => okRequest(buildSubmitAtVersionRequest(parameters)),
287
- methodDefaults: CREATE_METHOD_DEFAULTS,
288
- methodKind: "create",
289
- operationLimit: SUBMIT_OPERATION_LIMIT,
290
- parse: parseLuauExecutionTaskResponse,
291
- requiredScopes: SUBMIT_REQUIRED_SCOPES
292
- });
293
- /**
294
- * Per-method dispatch spec for fetching a Luau execution task. Uses
295
- * idempotent retry semantics (429 and 5xx both retried) so reads
296
- * recover transparently from transient server errors.
297
- */
298
- const GET_SPEC = makeSpec({
299
- buildRequest: buildGetRequest,
300
- methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
301
- methodKind: "idempotent",
302
- operationLimit: GET_OPERATION_LIMIT,
303
- parse: parseLuauExecutionTaskResponse,
304
- requiredScopes: GET_REQUIRED_SCOPES
305
- });
306
- //#endregion
307
- export { SUBMIT_HEAD_SPEC as n, SUBMIT_VERSION_SPEC as r, GET_SPEC as t };
308
-
309
- //# sourceMappingURL=specs-Co6qYp_E.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"specs-Co6qYp_E.mjs","names":[],"sources":["../src/domains/cloud-v2/luau-execution-tasks/builders.ts","../src/domains/cloud-v2/luau-execution-tasks/operations.ts","../src/domains/cloud-v2/luau-execution-tasks/parsers.ts","../src/domains/cloud-v2/luau-execution-tasks/specs.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { GetParameters, SubmitAtHeadParameters, SubmitAtVersionParameters } from \"./types.ts\";\n\ninterface SubmitBodyInput {\n\treadonly script: string;\n\treadonly timeoutSeconds?: number;\n}\n\nconst JSON_HEADERS: Readonly<Record<string, string>> = { \"content-type\": \"application/json\" };\n\n/**\n * Builds a `POST` request for the Open Cloud \"create Luau execution\n * session task\" endpoint, targeting the place's head version. Serializes\n * `timeoutSeconds` into the wire's duration string format (`\"<n>s\"`)\n * when supplied.\n *\n * @param parameters - Universe and place identifiers, the script body,\n * and an optional `timeoutSeconds`.\n * @returns A pure {@link HttpRequest} describing the submit call.\n */\nexport function buildSubmitAtHeadRequest(parameters: SubmitAtHeadParameters): HttpRequest {\n\tconst { placeId, universeId } = parameters;\n\treturn {\n\t\tbody: buildSubmitBody(parameters),\n\t\theaders: JSON_HEADERS,\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}/luau-execution-session-tasks`,\n\t};\n}\n\n/**\n * Builds a `POST` request for the Open Cloud \"create Luau execution\n * session task\" endpoint, targeting a specific place version. Differs\n * from {@link buildSubmitAtHeadRequest} only in URL shape: the path\n * includes the `versions/{versionId}` segment so the script runs\n * against that exact place version instead of the live head.\n *\n * @param parameters - Universe, place, and version identifiers, the\n * script body, and an optional `timeoutSeconds`.\n * @returns A pure {@link HttpRequest} describing the submit call.\n */\nexport function buildSubmitAtVersionRequest(parameters: SubmitAtVersionParameters): HttpRequest {\n\tconst { placeId, universeId, versionId } = parameters;\n\treturn {\n\t\tbody: buildSubmitBody(parameters),\n\t\theaders: JSON_HEADERS,\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-session-tasks`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the Open Cloud \"read Luau execution session\n * task\" endpoint. The endpoint accepts only the maximal x-aep-resource\n * path shape (universe, place, version, session, task), so the supplied\n * ref must include `versionId` and `sessionId`; refs extracted from the\n * narrower path formats are rejected with a {@link ValidationError}.\n *\n * @param parameters - Task ref and optional view selector. When `view`\n * is omitted, no `?view=` query is sent and the server applies its\n * own default (`BASIC`).\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when the ref is missing `versionId` or\n * `sessionId`.\n */\nexport function buildGetRequest(parameters: GetParameters): Result<HttpRequest, ValidationError> {\n\tconst { ref, view } = parameters;\n\tconst { placeId, sessionId, taskId, universeId, versionId } = ref;\n\n\tif (versionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing versionId; cannot GET\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tif (sessionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing sessionId; cannot GET\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst base = `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-sessions/${sessionId}/tasks/${taskId}`;\n\tconst url = view === undefined ? base : `${base}?view=${view}`;\n\treturn { data: { method: \"GET\", url }, success: true };\n}\n\nfunction buildSubmitBody(parameters: SubmitBodyInput): Record<string, unknown> {\n\tconst { script, timeoutSeconds } = parameters;\n\treturn timeoutSeconds === undefined ? { script } : { script, timeout: `${timeoutSeconds}s` };\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst SUBMIT_PER_MINUTE = 40;\nconst GET_PER_MINUTE = 200;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for submitting a Luau execution task,\n * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_CreateLuauExecutionSessionTask__Using_Universes` operation\n * (40 requests per minute per API key owner). The two URL shapes\n * (head and version) share this queue because Roblox attributes both\n * to the same per-minute quota.\n */\nexport const SUBMIT_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: SUBMIT_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.submit\",\n});\n\n/**\n * Per-second request ceiling for fetching a Luau execution task,\n * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_GetLuauExecutionSessionTask` operation (200 requests per\n * minute per API key owner).\n */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: GET_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.get\",\n});\n\n/**\n * Scopes required to submit a Luau execution task, sourced from\n * `x-roblox-scopes` on the create operation in the vendored OpenAPI\n * schema. Surfaced via the `requiredScopes` field of the per-method\n * spec so a 401 or 403 ApiError is upgraded to a `PermissionError`\n * naming the missing scope.\n */\nexport const SUBMIT_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:write\",\n]);\n\n/**\n * Scopes required to fetch a Luau execution task, sourced from\n * `x-roblox-scopes` on the get operation. The `:write` scope also\n * grants read in upstream auth, but we surface only `:read` here as\n * the minimum-privilege requirement for this method.\n */\nexport const GET_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:read\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { LuauExecutionTask, LuauExecutionTaskRef } from \"./types.ts\";\nimport type {\n\tLuauExecutionTaskErrorWire,\n\tLuauExecutionTaskOutputWire,\n\tLuauExecutionTaskWire,\n} from \"./wire.ts\";\n\nconst MALFORMED_TASK_MESSAGE = \"Malformed luau-execution-session-task response\";\n\n// Matches any of the four x-aep-resource path formats for a luau\n// execution session task.\n//\n// Capture groups:\n// 1. universeId\n// 2. placeId\n// 3. versionId (when `/versions/{v}/` segment is present, else undefined)\n// 4. sessionId (when `/luau-execution-sessions/{s}/tasks/...` branch matched)\n// 5. taskId (when `/luau-execution-sessions/.../tasks/{t}` branch matched)\n// 6. taskId (when `/luau-execution-session-tasks/{t}` branch matched)\nconst PATH_PATTERN =\n\t/^universes\\/(\\d+)\\/places\\/(\\d+)(?:\\/versions\\/(\\d+))?(?:\\/luau-execution-sessions\\/([^/]+)\\/tasks\\/([^/]+)|\\/luau-execution-session-tasks\\/([^/]+))$/;\n\ninterface ParseVariantArgs {\n\treadonly body: LuauExecutionTaskWire;\n\treadonly ref: LuauExecutionTaskRef;\n\treadonly statusCode: number;\n\treadonly timeoutSeconds: number | undefined;\n}\n\n/**\n * Parses a successful Open Cloud `LuauExecutionSessionTask` response\n * body into the public {@link LuauExecutionTask} discriminated union.\n * Handles every supported task state (in-progress, COMPLETE, FAILED)\n * across all four x-aep-resource path shapes the server returns.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud\n * API.\n * @returns A success result wrapping the parsed task, or an\n * {@link ApiError} when the body or path do not match a supported\n * shape.\n */\nexport function parseLuauExecutionTaskResponse(\n\tresponse: HttpResponse,\n): Result<LuauExecutionTask, ApiError> {\n\tconst { body, status: statusCode } = response;\n\tif (!isLuauExecutionTaskWire(body)) {\n\t\treturn malformed(statusCode);\n\t}\n\n\tconst ref = parseTaskRef(body.path);\n\tif (ref === undefined) {\n\t\treturn malformed(statusCode);\n\t}\n\n\tconst timeoutSeconds = parseTimeoutSeconds(body.timeout);\n\n\tif (body.state === \"COMPLETE\") {\n\t\treturn parseCompleteTask({ body, ref, statusCode, timeoutSeconds });\n\t}\n\n\tif (body.state === \"FAILED\") {\n\t\treturn parseFailedTask({ body, ref, statusCode, timeoutSeconds });\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tcreatedAt: new Date(body.createTime),\n\t\t\tref,\n\t\t\tstate: body.state,\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt: new Date(body.updateTime),\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction isAcceptedWireState(\n\tstate: unknown,\n): state is \"CANCELLED\" | \"COMPLETE\" | \"FAILED\" | \"PROCESSING\" | \"QUEUED\" {\n\treturn (\n\t\tstate === \"QUEUED\" ||\n\t\tstate === \"PROCESSING\" ||\n\t\tstate === \"CANCELLED\" ||\n\t\tstate === \"COMPLETE\" ||\n\t\tstate === \"FAILED\"\n\t);\n}\n\nfunction isErrorWireCode(code: unknown): code is LuauExecutionTaskErrorWire[\"code\"] {\n\treturn (\n\t\tcode === \"SCRIPT_ERROR\" ||\n\t\tcode === \"DEADLINE_EXCEEDED\" ||\n\t\tcode === \"OUTPUT_SIZE_LIMIT_EXCEEDED\" ||\n\t\tcode === \"INTERNAL_ERROR\"\n\t);\n}\n\nfunction isErrorWire(value: unknown): value is LuauExecutionTaskErrorWire {\n\treturn (\n\t\tisRecord(value) && isErrorWireCode(value[\"code\"]) && typeof value[\"message\"] === \"string\"\n\t);\n}\n\nfunction isOptionalErrorWire(value: unknown): value is LuauExecutionTaskErrorWire | undefined {\n\treturn value === undefined || isErrorWire(value);\n}\n\nfunction isOutputWire(value: unknown): value is LuauExecutionTaskOutputWire {\n\treturn isRecord(value) && Array.isArray(value[\"results\"]);\n}\n\nfunction isOptionalOutputWire(value: unknown): value is LuauExecutionTaskOutputWire | undefined {\n\treturn value === undefined || isOutputWire(value);\n}\n\nfunction isLuauExecutionTaskWire(body: unknown): body is LuauExecutionTaskWire {\n\treturn (\n\t\tisRecord(body) &&\n\t\ttypeof body[\"path\"] === \"string\" &&\n\t\ttypeof body[\"createTime\"] === \"string\" &&\n\t\ttypeof body[\"updateTime\"] === \"string\" &&\n\t\tisAcceptedWireState(body[\"state\"]) &&\n\t\ttypeof body[\"user\"] === \"string\" &&\n\t\tisOptionalOutputWire(body[\"output\"]) &&\n\t\tisOptionalErrorWire(body[\"error\"]) &&\n\t\tisOptionalDurationWire(body[\"timeout\"])\n\t);\n}\n\nconst DURATION_PATTERN = /^(\\d+)s$/;\n\nfunction isOptionalDurationWire(value: unknown): value is string | undefined {\n\treturn value === undefined || (typeof value === \"string\" && DURATION_PATTERN.test(value));\n}\n\nfunction parseTimeoutSeconds(value: string | undefined): number | undefined {\n\tif (value === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst match = DURATION_PATTERN.exec(value);\n\tconst seconds = match?.[1];\n\tif (seconds === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn Number.parseInt(seconds, 10);\n}\n\nfunction malformed(statusCode: number): Result<LuauExecutionTask, ApiError> {\n\treturn { err: new ApiError(MALFORMED_TASK_MESSAGE, { statusCode }), success: false };\n}\n\nfunction parseCompleteTask(args: ParseVariantArgs): Result<LuauExecutionTask, ApiError> {\n\tconst { body, ref, statusCode, timeoutSeconds } = args;\n\tif (body.output === undefined) {\n\t\treturn malformed(statusCode);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tcreatedAt: new Date(body.createTime),\n\t\t\toutput: { results: body.output.results },\n\t\t\tref,\n\t\t\tstate: \"COMPLETE\",\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt: new Date(body.updateTime),\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseFailedTask(args: ParseVariantArgs): Result<LuauExecutionTask, ApiError> {\n\tconst { body, ref, statusCode, timeoutSeconds } = args;\n\tif (body.error === undefined) {\n\t\treturn malformed(statusCode);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tcreatedAt: new Date(body.createTime),\n\t\t\terror: { code: body.error.code, message: body.error.message },\n\t\t\tref,\n\t\t\tstate: \"FAILED\",\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt: new Date(body.updateTime),\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseTaskRef(path: string): LuauExecutionTaskRef | undefined {\n\tconst match = PATH_PATTERN.exec(path);\n\tif (match === null) {\n\t\treturn undefined;\n\t}\n\n\tconst [, universeId, placeId, versionId, sessionId, sessionTaskId, plainTaskId] = match;\n\tconst taskId = sessionTaskId ?? plainTaskId;\n\tif (universeId === undefined || placeId === undefined || taskId === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn { placeId, sessionId, taskId, universeId, versionId };\n}\n","import {\n\tCREATE_METHOD_DEFAULTS,\n\tIDEMPOTENT_METHOD_DEFAULTS,\n} from \"../../../internal/http/retry.ts\";\nimport { okRequest, type ResourceMethodSpec } from \"../../../internal/resource-client.ts\";\nimport {\n\tbuildGetRequest,\n\tbuildSubmitAtHeadRequest,\n\tbuildSubmitAtVersionRequest,\n} from \"./builders.ts\";\nimport {\n\tGET_OPERATION_LIMIT,\n\tGET_REQUIRED_SCOPES,\n\tSUBMIT_OPERATION_LIMIT,\n\tSUBMIT_REQUIRED_SCOPES,\n} from \"./operations.ts\";\nimport { parseLuauExecutionTaskResponse } from \"./parsers.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"./types.ts\";\n\nfunction makeSpec<P>(\n\tspec: ResourceMethodSpec<P, LuauExecutionTask>,\n): ResourceMethodSpec<P, LuauExecutionTask> {\n\treturn Object.freeze(spec);\n}\n\n/**\n * Per-method dispatch spec for submitting a Luau execution task at a\n * place's head version. Frozen at module scope so both the top-level\n * `LuauExecutionClient` and the `luauExecution` Operation Group on\n * `PlacesClient` share the same instance reference.\n */\nexport const SUBMIT_HEAD_SPEC = makeSpec<SubmitAtHeadParameters>({\n\tbuildRequest: (parameters) => okRequest(buildSubmitAtHeadRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: SUBMIT_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: SUBMIT_REQUIRED_SCOPES,\n});\n\n/**\n * Per-method dispatch spec for submitting a Luau execution task at a\n * specific place version. Shares the rate-limit queue and required\n * scope set with {@link SUBMIT_HEAD_SPEC} because Roblox attributes\n * both URL shapes to one per-minute quota.\n */\nexport const SUBMIT_VERSION_SPEC = makeSpec<SubmitAtVersionParameters>({\n\tbuildRequest: (parameters) => okRequest(buildSubmitAtVersionRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: SUBMIT_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: SUBMIT_REQUIRED_SCOPES,\n});\n\n/**\n * Per-method dispatch spec for fetching a Luau execution task. Uses\n * idempotent retry semantics (429 and 5xx both retried) so reads\n * recover transparently from transient server errors.\n */\nexport const GET_SPEC = makeSpec<GetParameters>({\n\tbuildRequest: buildGetRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: GET_REQUIRED_SCOPES,\n});\n"],"mappings":";;;;AAUA,MAAM,eAAiD,EAAE,gBAAgB,oBAAoB;;;;;;;;;;;AAY7F,SAAgB,yBAAyB,YAAiD;CACzF,MAAM,EAAE,SAAS,eAAe;AAChC,QAAO;EACN,MAAM,gBAAgB,WAAW;EACjC,SAAS;EACT,QAAQ;EACR,KAAK,uBAAuB,WAAW,UAAU,QAAQ;EACzD;;;;;;;;;;;;;AAcF,SAAgB,4BAA4B,YAAoD;CAC/F,MAAM,EAAE,SAAS,YAAY,cAAc;AAC3C,QAAO;EACN,MAAM,gBAAgB,WAAW;EACjC,SAAS;EACT,QAAQ;EACR,KAAK,uBAAuB,WAAW,UAAU,QAAQ,YAAY,UAAU;EAC/E;;;;;;;;;;;;;;;;AAiBF,SAAgB,gBAAgB,YAAiE;CAChG,MAAM,EAAE,KAAK,SAAS;CACtB,MAAM,EAAE,SAAS,WAAW,QAAQ,YAAY,cAAc;AAE9D,KAAI,cAAc,KAAA,EACjB,QAAO;EACN,KAAK,IAAI,gBAAgB,6CAA6C,EACrE,MAAM,kBACN,CAAC;EACF,SAAS;EACT;AAGF,KAAI,cAAc,KAAA,EACjB,QAAO;EACN,KAAK,IAAI,gBAAgB,6CAA6C,EACrE,MAAM,kBACN,CAAC;EACF,SAAS;EACT;CAGF,MAAM,OAAO,uBAAuB,WAAW,UAAU,QAAQ,YAAY,UAAU,2BAA2B,UAAU,SAAS;AAErI,QAAO;EAAE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