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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/badges.d.mts +86 -3
  2. package/dist/badges.d.mts.map +1 -1
  3. package/dist/badges.mjs +113 -5
  4. package/dist/badges.mjs.map +1 -1
  5. package/dist/data.generated-BtkDGH8C.d.mts +485 -0
  6. package/dist/data.generated-BtkDGH8C.d.mts.map +1 -0
  7. package/dist/developer-products.d.mts +14 -5
  8. package/dist/developer-products.d.mts.map +1 -1
  9. package/dist/developer-products.mjs +5 -4
  10. package/dist/developer-products.mjs.map +1 -1
  11. package/dist/game-passes.d.mts +83 -2
  12. package/dist/game-passes.d.mts.map +1 -1
  13. package/dist/game-passes.mjs +111 -4
  14. package/dist/game-passes.mjs.map +1 -1
  15. package/dist/index.d.mts +3 -81
  16. package/dist/index.d.mts.map +1 -1
  17. package/dist/index.mjs +2 -2
  18. package/dist/is-date-time-string-Cuf1TaSC.mjs +19 -0
  19. package/dist/is-date-time-string-Cuf1TaSC.mjs.map +1 -0
  20. package/dist/locales.d.mts +2 -0
  21. package/dist/locales.mjs +512 -0
  22. package/dist/locales.mjs.map +1 -0
  23. package/dist/luau-execution.d.mts +62 -0
  24. package/dist/luau-execution.d.mts.map +1 -0
  25. package/dist/luau-execution.mjs +52 -0
  26. package/dist/luau-execution.mjs.map +1 -0
  27. package/dist/places.d.mts +47 -8
  28. package/dist/places.d.mts.map +1 -1
  29. package/dist/places.mjs +39 -13
  30. package/dist/places.mjs.map +1 -1
  31. package/dist/{price-information-CmpscMc4.mjs → price-information-s7DY0GV2.mjs} +2 -2
  32. package/dist/{price-information-CmpscMc4.mjs.map → price-information-s7DY0GV2.mjs.map} +1 -1
  33. package/dist/{rate-limit-BBU_4xnZ.mjs → rate-limit-CKfuhxT1.mjs} +11 -3
  34. package/dist/rate-limit-CKfuhxT1.mjs.map +1 -0
  35. package/dist/rate-limit-DzHBFwps.d.mts +92 -0
  36. package/dist/rate-limit-DzHBFwps.d.mts.map +1 -0
  37. package/dist/{resource-client-CaS_j3yg.mjs → resource-client-Wi4Mwqy5.mjs} +69 -14
  38. package/dist/resource-client-Wi4Mwqy5.mjs.map +1 -0
  39. package/dist/specs-Co6qYp_E.mjs +309 -0
  40. package/dist/specs-Co6qYp_E.mjs.map +1 -0
  41. package/dist/storage.d.mts +374 -0
  42. package/dist/storage.d.mts.map +1 -0
  43. package/dist/storage.mjs +371 -0
  44. package/dist/storage.mjs.map +1 -0
  45. package/dist/types-BZ0959rh.d.mts +149 -0
  46. package/dist/types-BZ0959rh.d.mts.map +1 -0
  47. package/dist/{types-YCTsM8Qd.d.mts → types-Cp8w8uwA.d.mts} +1 -1
  48. package/dist/{types-YCTsM8Qd.d.mts.map → types-Cp8w8uwA.d.mts.map} +1 -1
  49. package/dist/universes.d.mts +37 -12
  50. package/dist/universes.d.mts.map +1 -1
  51. package/dist/universes.mjs +5 -4
  52. package/dist/universes.mjs.map +1 -1
  53. package/dist/{validation-CTZzJhmd.mjs → validation-b7KAoEio.mjs} +2 -2
  54. package/dist/validation-b7KAoEio.mjs.map +1 -0
  55. package/package.json +7 -3
  56. package/dist/rate-limit-BBU_4xnZ.mjs.map +0 -1
  57. package/dist/resource-client-CaS_j3yg.mjs.map +0 -1
  58. package/dist/validation-CTZzJhmd.mjs.map +0 -1
@@ -0,0 +1,371 @@
1
+ import { i as ApiError } from "./rate-limit-CKfuhxT1.mjs";
2
+ import { t as isDateTimeString } from "./is-date-time-string-Cuf1TaSC.mjs";
3
+ import { a as IDEMPOTENT_METHOD_DEFAULTS, i as CREATE_METHOD_DEFAULTS, n as okRequest, o as isRecord, r as parseEmptyResponse, t as ResourceClient } from "./resource-client-Wi4Mwqy5.mjs";
4
+ //#region src/domains/cloud-v2/memory-store-queues/builders.ts
5
+ /**
6
+ * Builds a `POST` request for the Open Cloud
7
+ * `Cloud_CreateMemoryStoreQueueItem` endpoint. Serializes the optional
8
+ * `ttl` field as a Google protobuf `Duration` string in seconds (`"30s"`)
9
+ * to match the wire contract.
10
+ *
11
+ * @param parameters - Universe and queue identifiers, the opaque payload,
12
+ * and optional priority and TTL.
13
+ * @returns A pure {@link HttpRequest} describing the enqueue call.
14
+ */
15
+ function buildEnqueueRequest(parameters) {
16
+ const { data, priority, queueId, ttl, universeId } = parameters;
17
+ const body = { data };
18
+ if (priority !== void 0) body["priority"] = priority;
19
+ if (ttl !== void 0) body["ttl"] = `${ttl}s`;
20
+ return {
21
+ body,
22
+ headers: { "content-type": "application/json" },
23
+ method: "POST",
24
+ url: `/cloud/v2/universes/${universeId}/memory-store/queues/${queueId}/items`
25
+ };
26
+ }
27
+ /**
28
+ * Builds a `GET` request for the Open Cloud
29
+ * `Cloud_ReadMemoryStoreQueueItems` endpoint. The `:read` suffix is a
30
+ * custom-method marker; the call is HTTP `GET` despite the AIP-136
31
+ * convention that custom methods use `POST`. Parameters travel as query
32
+ * string only; there is no request body.
33
+ *
34
+ * `invisibilityWindow` is serialized as a Google protobuf `Duration`
35
+ * string in seconds (`"30s"`), matching the wire contract.
36
+ *
37
+ * @param parameters - Universe and queue identifiers, plus optional
38
+ * `count`, `allOrNothing`, and `invisibilityWindow`.
39
+ * @returns A pure {@link HttpRequest} describing the dequeue call.
40
+ */
41
+ function buildDequeueRequest(parameters) {
42
+ const query = new URLSearchParams();
43
+ if (parameters.count !== void 0) query.append("count", String(parameters.count));
44
+ if (parameters.allOrNothing !== void 0) query.append("allOrNothing", String(parameters.allOrNothing));
45
+ if (parameters.invisibilityWindow !== void 0) query.append("invisibilityWindow", `${parameters.invisibilityWindow}s`);
46
+ const queryString = query.toString();
47
+ const { queueId, universeId } = parameters;
48
+ const base = `/cloud/v2/universes/${universeId}/memory-store/queues/${queueId}/items:read`;
49
+ return {
50
+ method: "GET",
51
+ url: queryString === "" ? base : `${base}?${queryString}`
52
+ };
53
+ }
54
+ /**
55
+ * Builds a `POST` request for the Open Cloud
56
+ * `Cloud_DiscardMemoryStoreQueueItems` endpoint. The request body uses
57
+ * `{ readId }`, matching the schema (the dequeue *response* uses `id`,
58
+ * but the discard *request* matches the schema and is not patched).
59
+ *
60
+ * @param parameters - Universe and queue identifiers, plus the
61
+ * `readId` returned from a prior dequeue.
62
+ * @returns A pure {@link HttpRequest} describing the discard call.
63
+ */
64
+ function buildDiscardRequest(parameters) {
65
+ const { queueId, readId, universeId } = parameters;
66
+ return {
67
+ body: { readId },
68
+ headers: { "content-type": "application/json" },
69
+ method: "POST",
70
+ url: `/cloud/v2/universes/${universeId}/memory-store/queues/${queueId}/items:discard`
71
+ };
72
+ }
73
+ //#endregion
74
+ //#region src/domains/cloud-v2/memory-store-queues/operations.ts
75
+ const ENQUEUE_PER_MINUTE = 1e6;
76
+ const SECONDS_PER_MINUTE = 60;
77
+ /**
78
+ * Per-second request ceiling for enqueueing a memory-store queue item,
79
+ * from the Open Cloud OpenAPI schema (1,000,000 requests per minute per
80
+ * API key owner). Keyed independently from the dequeue and discard
81
+ * operations so the three do not share a queue; upstream quota
82
+ * accounting is documented per-operation, and the conservative default
83
+ * is fewer cross-method contention surprises.
84
+ */
85
+ const ENQUEUE_OPERATION_LIMIT = Object.freeze({
86
+ maxPerSecond: ENQUEUE_PER_MINUTE / SECONDS_PER_MINUTE,
87
+ operationKey: "memory-store-queues.enqueue"
88
+ });
89
+ /**
90
+ * Scopes required to enqueue a memory-store queue item, sourced from
91
+ * `x-roblox-scopes` on the `Cloud_CreateMemoryStoreQueueItem` operation
92
+ * in the vendored OpenAPI schema.
93
+ */
94
+ const ENQUEUE_REQUIRED_SCOPES = Object.freeze(["memory-store.queue:add"]);
95
+ /**
96
+ * Per-second request ceiling for dequeueing memory-store queue items,
97
+ * from the Open Cloud OpenAPI schema (1,000,000 requests per minute
98
+ * per API key owner). Keyed independently from enqueue and discard.
99
+ */
100
+ const DEQUEUE_OPERATION_LIMIT = Object.freeze({
101
+ maxPerSecond: 1e6 / SECONDS_PER_MINUTE,
102
+ operationKey: "memory-store-queues.dequeue"
103
+ });
104
+ /**
105
+ * Scopes required to dequeue memory-store queue items, sourced from
106
+ * `x-roblox-scopes` on the `Cloud_ReadMemoryStoreQueueItems` operation
107
+ * in the vendored OpenAPI schema.
108
+ */
109
+ const DEQUEUE_REQUIRED_SCOPES = Object.freeze(["memory-store.queue:dequeue"]);
110
+ /**
111
+ * Per-second request ceiling for discarding (acknowledging) memory-store
112
+ * queue items, from the Open Cloud OpenAPI schema (1,000,000 requests
113
+ * per minute per API key owner). Keyed independently from enqueue and
114
+ * dequeue.
115
+ */
116
+ const DISCARD_OPERATION_LIMIT = Object.freeze({
117
+ maxPerSecond: 1e6 / SECONDS_PER_MINUTE,
118
+ operationKey: "memory-store-queues.discard"
119
+ });
120
+ /**
121
+ * Scopes required to discard memory-store queue items, sourced from
122
+ * `x-roblox-scopes` on the `Cloud_DiscardMemoryStoreQueueItems`
123
+ * operation in the vendored OpenAPI schema.
124
+ */
125
+ const DISCARD_REQUIRED_SCOPES = Object.freeze(["memory-store.queue:discard"]);
126
+ //#endregion
127
+ //#region src/domains/cloud-v2/memory-store-queues/parsers.ts
128
+ const PATH_PATTERN = /^cloud\/v2\/universes\/(\d+)\/memory-store\/queues\/([^/]+)\/items\/([^/]+)$/;
129
+ const MALFORMED_QUEUE_ITEM_MESSAGE = "Malformed memory-store queue item response";
130
+ const MALFORMED_DEQUEUE_MESSAGE = "Malformed memory-store dequeue response";
131
+ /**
132
+ * Parses a successful memory-store queue-item response body (the
133
+ * `Cloud_CreateMemoryStoreQueueItem` happy path) into the public
134
+ * {@link QueueItem} shape.
135
+ *
136
+ * @param response - The full {@link HttpResponse} from the Open Cloud API.
137
+ * @returns A success result wrapping the parsed {@link QueueItem}, or an
138
+ * {@link ApiError} when the body does not match the wire schema.
139
+ */
140
+ function parseQueueItemResponse(response) {
141
+ const item = wireBodyToQueueItem(response.body);
142
+ if (item === void 0) return malformedQueueItem(response.status);
143
+ return {
144
+ data: item,
145
+ success: true
146
+ };
147
+ }
148
+ /**
149
+ * Parses a successful `Cloud_ReadMemoryStoreQueueItems` response body
150
+ * into the public {@link DequeueResult} shape. Each item in the
151
+ * `queueItems` array is validated through the same path-and-shape
152
+ * checks as {@link parseQueueItemResponse}; a malformed entry rejects
153
+ * the whole response.
154
+ *
155
+ * @param response - The full {@link HttpResponse} from the Open Cloud API.
156
+ * @returns A success result wrapping the parsed {@link DequeueResult},
157
+ * or an {@link ApiError} when the response shape is wrong.
158
+ */
159
+ function parseDequeueResponse(response) {
160
+ const { body, status: statusCode } = response;
161
+ if (!isRecord(body)) return malformedDequeue(statusCode);
162
+ const { id, queueItems } = body;
163
+ if (typeof id !== "string" || !Array.isArray(queueItems)) return malformedDequeue(statusCode);
164
+ const items = queueItems.map(wireBodyToQueueItem);
165
+ if (!items.every(isQueueItem)) return malformedDequeue(statusCode);
166
+ return {
167
+ data: {
168
+ items,
169
+ readId: id
170
+ },
171
+ success: true
172
+ };
173
+ }
174
+ function isQueueItemWire(body) {
175
+ if (!isRecord(body)) return false;
176
+ const { data, expireTime, path, priority } = body;
177
+ return typeof path === "string" && isDateTimeString(expireTime) && data !== void 0 && data !== null && (priority === void 0 || priority === null || typeof priority === "number");
178
+ }
179
+ function wireBodyToQueueItem(body) {
180
+ if (!isQueueItemWire(body)) return;
181
+ const match = PATH_PATTERN.exec(body.path);
182
+ const universeId = match?.[1];
183
+ const queueId = match?.[2];
184
+ const id = match?.[3];
185
+ if (universeId === void 0 || queueId === void 0 || id === void 0) return;
186
+ return {
187
+ id,
188
+ data: body.data,
189
+ expiresAt: new Date(body.expireTime),
190
+ priority: body.priority ?? void 0,
191
+ queueId,
192
+ universeId
193
+ };
194
+ }
195
+ function malformedQueueItem(statusCode) {
196
+ return {
197
+ err: new ApiError(MALFORMED_QUEUE_ITEM_MESSAGE, { statusCode }),
198
+ success: false
199
+ };
200
+ }
201
+ function isQueueItem(item) {
202
+ return item !== void 0;
203
+ }
204
+ function malformedDequeue(statusCode) {
205
+ return {
206
+ err: new ApiError(MALFORMED_DEQUEUE_MESSAGE, { statusCode }),
207
+ success: false
208
+ };
209
+ }
210
+ //#endregion
211
+ //#region src/resources/storage/queues-group.ts
212
+ function makeSpec(spec) {
213
+ return Object.freeze(spec);
214
+ }
215
+ const ENQUEUE_SPEC = makeSpec({
216
+ buildRequest: (parameters) => okRequest(buildEnqueueRequest(parameters)),
217
+ methodDefaults: CREATE_METHOD_DEFAULTS,
218
+ methodKind: "create",
219
+ operationLimit: ENQUEUE_OPERATION_LIMIT,
220
+ parse: parseQueueItemResponse,
221
+ requiredScopes: ENQUEUE_REQUIRED_SCOPES
222
+ });
223
+ const DEQUEUE_SPEC = makeSpec({
224
+ buildRequest: (parameters) => okRequest(buildDequeueRequest(parameters)),
225
+ methodDefaults: CREATE_METHOD_DEFAULTS,
226
+ methodKind: "create",
227
+ operationLimit: DEQUEUE_OPERATION_LIMIT,
228
+ parse: parseDequeueResponse,
229
+ requiredScopes: DEQUEUE_REQUIRED_SCOPES
230
+ });
231
+ const DISCARD_SPEC = makeSpec({
232
+ buildRequest: (parameters) => okRequest(buildDiscardRequest(parameters)),
233
+ methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
234
+ methodKind: "idempotent",
235
+ operationLimit: DISCARD_OPERATION_LIMIT,
236
+ parse: parseEmptyResponse,
237
+ requiredScopes: DISCARD_REQUIRED_SCOPES
238
+ });
239
+ /**
240
+ * Operation Group on `StorageClient` that exposes the memory-store
241
+ * queue endpoints. Queues are FIFO collections of opaque JSON values
242
+ * with optional priority and TTL; consumers enqueue items, dequeue
243
+ * them in batches, and acknowledge processed batches with a read
244
+ * identifier.
245
+ */
246
+ var MemoryStoreQueuesGroup = class {
247
+ #inner;
248
+ /**
249
+ * Wraps the shared {@link ResourceClient} so the Operation Group
250
+ * routes calls through the same retry, hooks, and rate-limit queues
251
+ * as the rest of the parent client.
252
+ *
253
+ * @param inner - The shared {@link ResourceClient} owned by the
254
+ * parent client.
255
+ */
256
+ constructor(inner) {
257
+ this.#inner = inner;
258
+ }
259
+ /**
260
+ * Dequeues up to `count` items from the front of the queue. Items
261
+ * returned become invisible to subsequent reads for
262
+ * `invisibilityWindow` seconds (default 30 server-side); they
263
+ * reappear once the window elapses unless acknowledged via
264
+ * `discard` with the returned `readId`.
265
+ *
266
+ * On 5xx, dequeue does not retry: the server may have set
267
+ * invisibility on a batch before the response failed, so a retry
268
+ * would return a *different* batch and the first one is lost until
269
+ * the window expires. Callers that can detect duplicates externally
270
+ * may opt back into 5xx retry per call by passing `retryableStatuses`
271
+ * on `options`.
272
+ *
273
+ * @param parameters - Universe and queue identifiers, plus optional
274
+ * `count`, `allOrNothing`, and `invisibilityWindow`.
275
+ * @param options - Optional per-request overrides.
276
+ * @returns A {@link Result} wrapping the parsed {@link DequeueResult}
277
+ * or the {@link OpenCloudError} that caused the request to fail.
278
+ */
279
+ async dequeue(parameters, options) {
280
+ return this.#inner.execute({
281
+ options,
282
+ parameters,
283
+ spec: DEQUEUE_SPEC
284
+ });
285
+ }
286
+ /**
287
+ * Acknowledges a dequeued batch of items, removing them from the
288
+ * queue permanently. Pass the `readId` returned from the prior
289
+ * `dequeue` call. Without `discard`, the items reappear once the
290
+ * invisibility window elapses.
291
+ *
292
+ * The call is idempotent: a second `discard` with the same `readId`
293
+ * is a no-op once the batch has been acknowledged. The retry policy
294
+ * therefore retries both 429 and 5xx.
295
+ *
296
+ * @param parameters - Universe and queue identifiers, plus the
297
+ * `readId` returned from a prior dequeue.
298
+ * @param options - Optional per-request overrides.
299
+ * @returns A {@link Result} wrapping `undefined` on success (the
300
+ * server returns an empty body) or the {@link OpenCloudError}
301
+ * that caused the request to fail.
302
+ */
303
+ async discard(parameters, options) {
304
+ return this.#inner.execute({
305
+ options,
306
+ parameters,
307
+ spec: DISCARD_SPEC
308
+ });
309
+ }
310
+ /**
311
+ * Enqueues a single item onto a memory-store queue. The queue is
312
+ * auto-created on first use; the queue identifier is any string the
313
+ * caller picks. Items with higher `priority` values are dequeued
314
+ * first; equal priorities preserve insertion order. Items expire
315
+ * and are removed automatically after `ttl` seconds, or after a
316
+ * server-default lifetime when omitted.
317
+ *
318
+ * @param parameters - Universe and queue identifiers, the opaque
319
+ * payload, and optional `priority` and `ttl`.
320
+ * @param options - Optional per-request overrides (e.g. A different
321
+ * {@link OpenCloudClientOptions.apiKey} for this call only).
322
+ * @returns A {@link Result} wrapping the parsed {@link QueueItem} or
323
+ * the {@link OpenCloudError} that caused the request to fail.
324
+ */
325
+ async enqueue(parameters, options) {
326
+ return this.#inner.execute({
327
+ options,
328
+ parameters,
329
+ spec: ENQUEUE_SPEC
330
+ });
331
+ }
332
+ };
333
+ //#endregion
334
+ //#region src/resources/storage/client.ts
335
+ /**
336
+ * Public client for the Roblox Open Cloud `Data and memory stores`
337
+ * Feature. Today it covers memory-store queues via the
338
+ * {@link StorageClient.queues} Operation Group; future Operation
339
+ * Groups for sorted maps and data stores slot in as siblings on the
340
+ * same client.
341
+ *
342
+ * Every method returns a `Result` so callers handle failure
343
+ * explicitly; no thrown error ever escapes the client.
344
+ *
345
+ * @example
346
+ *
347
+ * ```ts
348
+ * import { StorageClient } from "@bedrock-rbx/ocale/storage";
349
+ *
350
+ * const client = new StorageClient({ apiKey: "your-key" });
351
+ * expect(client).toBeInstanceOf(StorageClient);
352
+ * ```
353
+ */
354
+ var StorageClient = class {
355
+ /** Memory-store queue Operation Group. */
356
+ queues;
357
+ /**
358
+ * Creates a new {@link StorageClient}. Configuration is frozen on
359
+ * construction; per-request overrides are accepted on each method.
360
+ *
361
+ * @param options - Client-level configuration including the API key.
362
+ */
363
+ constructor(options) {
364
+ const inner = new ResourceClient(options);
365
+ this.queues = new MemoryStoreQueuesGroup(inner);
366
+ }
367
+ };
368
+ //#endregion
369
+ export { StorageClient };
370
+
371
+ //# sourceMappingURL=storage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.mjs","names":["#inner"],"sources":["../src/domains/cloud-v2/memory-store-queues/builders.ts","../src/domains/cloud-v2/memory-store-queues/operations.ts","../src/domains/cloud-v2/memory-store-queues/parsers.ts","../src/resources/storage/queues-group.ts","../src/resources/storage/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport type {\n\tDequeueQueueItemsParameters,\n\tDiscardQueueItemsParameters,\n\tEnqueueQueueItemParameters,\n} from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the Open Cloud\n * `Cloud_CreateMemoryStoreQueueItem` endpoint. Serializes the optional\n * `ttl` field as a Google protobuf `Duration` string in seconds (`\"30s\"`)\n * to match the wire contract.\n *\n * @param parameters - Universe and queue identifiers, the opaque payload,\n * and optional priority and TTL.\n * @returns A pure {@link HttpRequest} describing the enqueue call.\n */\nexport function buildEnqueueRequest(parameters: EnqueueQueueItemParameters): HttpRequest {\n\tconst { data, priority, queueId, ttl, universeId } = parameters;\n\tconst body: Record<string, unknown> = { data };\n\tif (priority !== undefined) {\n\t\tbody[\"priority\"] = priority;\n\t}\n\n\tif (ttl !== undefined) {\n\t\tbody[\"ttl\"] = `${ttl}s`;\n\t}\n\n\treturn {\n\t\tbody,\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/memory-store/queues/${queueId}/items`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the Open Cloud\n * `Cloud_ReadMemoryStoreQueueItems` endpoint. The `:read` suffix is a\n * custom-method marker; the call is HTTP `GET` despite the AIP-136\n * convention that custom methods use `POST`. Parameters travel as query\n * string only; there is no request body.\n *\n * `invisibilityWindow` is serialized as a Google protobuf `Duration`\n * string in seconds (`\"30s\"`), matching the wire contract.\n *\n * @param parameters - Universe and queue identifiers, plus optional\n * `count`, `allOrNothing`, and `invisibilityWindow`.\n * @returns A pure {@link HttpRequest} describing the dequeue call.\n */\nexport function buildDequeueRequest(parameters: DequeueQueueItemsParameters): HttpRequest {\n\tconst query = new URLSearchParams();\n\tif (parameters.count !== undefined) {\n\t\tquery.append(\"count\", String(parameters.count));\n\t}\n\n\tif (parameters.allOrNothing !== undefined) {\n\t\tquery.append(\"allOrNothing\", String(parameters.allOrNothing));\n\t}\n\n\tif (parameters.invisibilityWindow !== undefined) {\n\t\tquery.append(\"invisibilityWindow\", `${parameters.invisibilityWindow}s`);\n\t}\n\n\tconst queryString = query.toString();\n\tconst { queueId, universeId } = parameters;\n\tconst base = `/cloud/v2/universes/${universeId}/memory-store/queues/${queueId}/items:read`;\n\treturn {\n\t\tmethod: \"GET\",\n\t\turl: queryString === \"\" ? base : `${base}?${queryString}`,\n\t};\n}\n\n/**\n * Builds a `POST` request for the Open Cloud\n * `Cloud_DiscardMemoryStoreQueueItems` endpoint. The request body uses\n * `{ readId }`, matching the schema (the dequeue *response* uses `id`,\n * but the discard *request* matches the schema and is not patched).\n *\n * @param parameters - Universe and queue identifiers, plus the\n * `readId` returned from a prior dequeue.\n * @returns A pure {@link HttpRequest} describing the discard call.\n */\nexport function buildDiscardRequest(parameters: DiscardQueueItemsParameters): HttpRequest {\n\tconst { queueId, readId, universeId } = parameters;\n\treturn {\n\t\tbody: { readId },\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/memory-store/queues/${queueId}/items:discard`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst ENQUEUE_PER_MINUTE = 1_000_000;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for enqueueing a memory-store queue item,\n * from the Open Cloud OpenAPI schema (1,000,000 requests per minute per\n * API key owner). Keyed independently from the dequeue and discard\n * operations so the three do not share a queue; upstream quota\n * accounting is documented per-operation, and the conservative default\n * is fewer cross-method contention surprises.\n */\nexport const ENQUEUE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: ENQUEUE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-queues.enqueue\",\n});\n\n/**\n * Scopes required to enqueue a memory-store queue item, sourced from\n * `x-roblox-scopes` on the `Cloud_CreateMemoryStoreQueueItem` operation\n * in the vendored OpenAPI schema.\n */\nexport const ENQUEUE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"memory-store.queue:add\",\n]);\n\nconst DEQUEUE_PER_MINUTE = 1_000_000;\n\n/**\n * Per-second request ceiling for dequeueing memory-store queue items,\n * from the Open Cloud OpenAPI schema (1,000,000 requests per minute\n * per API key owner). Keyed independently from enqueue and discard.\n */\nexport const DEQUEUE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: DEQUEUE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-queues.dequeue\",\n});\n\n/**\n * Scopes required to dequeue memory-store queue items, sourced from\n * `x-roblox-scopes` on the `Cloud_ReadMemoryStoreQueueItems` operation\n * in the vendored OpenAPI schema.\n */\nexport const DEQUEUE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"memory-store.queue:dequeue\",\n]);\n\nconst DISCARD_PER_MINUTE = 1_000_000;\n\n/**\n * Per-second request ceiling for discarding (acknowledging) memory-store\n * queue items, from the Open Cloud OpenAPI schema (1,000,000 requests\n * per minute per API key owner). Keyed independently from enqueue and\n * dequeue.\n */\nexport const DISCARD_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: DISCARD_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-queues.discard\",\n});\n\n/**\n * Scopes required to discard memory-store queue items, sourced from\n * `x-roblox-scopes` on the `Cloud_DiscardMemoryStoreQueueItems`\n * operation in the vendored OpenAPI schema.\n */\nexport const DISCARD_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"memory-store.queue:discard\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isDateTimeString } from \"../../../internal/utils/is-date-time-string.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { DequeueResult, QueueItem } from \"./types.ts\";\nimport type { MemoryStoreQueueItemWire } from \"./wire.ts\";\n\nconst PATH_PATTERN = /^cloud\\/v2\\/universes\\/(\\d+)\\/memory-store\\/queues\\/([^/]+)\\/items\\/([^/]+)$/;\nconst MALFORMED_QUEUE_ITEM_MESSAGE = \"Malformed memory-store queue item response\";\nconst MALFORMED_DEQUEUE_MESSAGE = \"Malformed memory-store dequeue response\";\n\n/**\n * Parses a successful memory-store queue-item response body (the\n * `Cloud_CreateMemoryStoreQueueItem` happy path) into the public\n * {@link QueueItem} shape.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link QueueItem}, or an\n * {@link ApiError} when the body does not match the wire schema.\n */\nexport function parseQueueItemResponse(response: HttpResponse): Result<QueueItem, ApiError> {\n\tconst item = wireBodyToQueueItem(response.body);\n\tif (item === undefined) {\n\t\treturn malformedQueueItem(response.status);\n\t}\n\n\treturn { data: item, success: true };\n}\n\n/**\n * Parses a successful `Cloud_ReadMemoryStoreQueueItems` response body\n * into the public {@link DequeueResult} shape. Each item in the\n * `queueItems` array is validated through the same path-and-shape\n * checks as {@link parseQueueItemResponse}; a malformed entry rejects\n * the whole response.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link DequeueResult},\n * or an {@link ApiError} when the response shape is wrong.\n */\nexport function parseDequeueResponse(response: HttpResponse): Result<DequeueResult, ApiError> {\n\tconst { body, status: statusCode } = response;\n\tif (!isRecord(body)) {\n\t\treturn malformedDequeue(statusCode);\n\t}\n\n\tconst { id, queueItems } = body;\n\tif (typeof id !== \"string\" || !Array.isArray(queueItems)) {\n\t\treturn malformedDequeue(statusCode);\n\t}\n\n\tconst items = queueItems.map(wireBodyToQueueItem);\n\tif (!items.every(isQueueItem)) {\n\t\treturn malformedDequeue(statusCode);\n\t}\n\n\treturn { data: { items, readId: id }, success: true };\n}\n\nfunction isQueueItemWire(body: unknown): body is MemoryStoreQueueItemWire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\tconst { data, expireTime, path, priority } = body;\n\treturn (\n\t\ttypeof path === \"string\" &&\n\t\tisDateTimeString(expireTime) &&\n\t\tdata !== undefined &&\n\t\tdata !== null &&\n\t\t(priority === undefined || priority === null || typeof priority === \"number\")\n\t);\n}\n\nfunction wireBodyToQueueItem(body: unknown): QueueItem | undefined {\n\tif (!isQueueItemWire(body)) {\n\t\treturn undefined;\n\t}\n\n\tconst match = PATH_PATTERN.exec(body.path);\n\tconst universeId = match?.[1];\n\tconst queueId = match?.[2];\n\tconst id = match?.[3];\n\tif (universeId === undefined || queueId === undefined || id === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tid,\n\t\tdata: body.data,\n\t\texpiresAt: new Date(body.expireTime),\n\t\tpriority: body.priority ?? undefined,\n\t\tqueueId,\n\t\tuniverseId,\n\t};\n}\n\nfunction malformedQueueItem(statusCode: number): Result<QueueItem, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_QUEUE_ITEM_MESSAGE, { statusCode }),\n\t\tsuccess: false,\n\t};\n}\n\nfunction isQueueItem(item: QueueItem | undefined): item is QueueItem {\n\treturn item !== undefined;\n}\n\nfunction malformedDequeue(statusCode: number): Result<DequeueResult, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_DEQUEUE_MESSAGE, { statusCode }),\n\t\tsuccess: false,\n\t};\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport {\n\tbuildDequeueRequest,\n\tbuildDiscardRequest,\n\tbuildEnqueueRequest,\n} from \"../../domains/cloud-v2/memory-store-queues/builders.ts\";\nimport {\n\tDEQUEUE_OPERATION_LIMIT,\n\tDEQUEUE_REQUIRED_SCOPES,\n\tDISCARD_OPERATION_LIMIT,\n\tDISCARD_REQUIRED_SCOPES,\n\tENQUEUE_OPERATION_LIMIT,\n\tENQUEUE_REQUIRED_SCOPES,\n} from \"../../domains/cloud-v2/memory-store-queues/operations.ts\";\nimport {\n\tparseDequeueResponse,\n\tparseQueueItemResponse,\n} from \"../../domains/cloud-v2/memory-store-queues/parsers.ts\";\nimport type {\n\tDequeueQueueItemsParameters,\n\tDequeueResult,\n\tDiscardQueueItemsParameters,\n\tEnqueueQueueItemParameters,\n\tQueueItem,\n} from \"../../domains/cloud-v2/memory-store-queues/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { CREATE_METHOD_DEFAULTS, IDEMPOTENT_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport {\n\tokRequest,\n\tparseEmptyResponse,\n\ttype ResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\n\nfunction makeSpec<P, R>(spec: ResourceMethodSpec<P, R>): ResourceMethodSpec<P, R> {\n\treturn Object.freeze(spec);\n}\n\nconst ENQUEUE_SPEC = makeSpec<EnqueueQueueItemParameters, QueueItem>({\n\tbuildRequest: (parameters) => okRequest(buildEnqueueRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: ENQUEUE_OPERATION_LIMIT,\n\tparse: parseQueueItemResponse,\n\trequiredScopes: ENQUEUE_REQUIRED_SCOPES,\n});\n\n// Dequeue uses HTTP GET but mutates server state via the invisibility\n// window. Retrying a 5xx where the server set invisibility before\n// failing the response would lose the original batch (it stays\n// invisible until the window elapses) and return a different one. So\n// the retry policy mirrors `create`: only 429, never 5xx.\nconst DEQUEUE_SPEC = makeSpec<DequeueQueueItemsParameters, DequeueResult>({\n\tbuildRequest: (parameters) => okRequest(buildDequeueRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: DEQUEUE_OPERATION_LIMIT,\n\tparse: parseDequeueResponse,\n\trequiredScopes: DEQUEUE_REQUIRED_SCOPES,\n});\n\nconst DISCARD_SPEC = makeSpec<DiscardQueueItemsParameters, undefined>({\n\tbuildRequest: (parameters) => okRequest(buildDiscardRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: DISCARD_OPERATION_LIMIT,\n\tparse: parseEmptyResponse,\n\trequiredScopes: DISCARD_REQUIRED_SCOPES,\n});\n\n/**\n * Operation Group on `StorageClient` that exposes the memory-store\n * queue endpoints. Queues are FIFO collections of opaque JSON values\n * with optional priority and TTL; consumers enqueue items, dequeue\n * them in batches, and acknowledge processed batches with a read\n * identifier.\n */\nexport class MemoryStoreQueuesGroup {\n\treadonly #inner: ResourceClient;\n\n\t/**\n\t * Wraps the shared {@link ResourceClient} so the Operation Group\n\t * routes calls through the same retry, hooks, and rate-limit queues\n\t * as the rest of the parent client.\n\t *\n\t * @param inner - The shared {@link ResourceClient} owned by the\n\t * parent client.\n\t */\n\tconstructor(inner: ResourceClient) {\n\t\tthis.#inner = inner;\n\t}\n\n\t/**\n\t * Dequeues up to `count` items from the front of the queue. Items\n\t * returned become invisible to subsequent reads for\n\t * `invisibilityWindow` seconds (default 30 server-side); they\n\t * reappear once the window elapses unless acknowledged via\n\t * `discard` with the returned `readId`.\n\t *\n\t * On 5xx, dequeue does not retry: the server may have set\n\t * invisibility on a batch before the response failed, so a retry\n\t * would return a *different* batch and the first one is lost until\n\t * the window expires. Callers that can detect duplicates externally\n\t * may opt back into 5xx retry per call by passing `retryableStatuses`\n\t * on `options`.\n\t *\n\t * @param parameters - Universe and queue identifiers, plus optional\n\t * `count`, `allOrNothing`, and `invisibilityWindow`.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed {@link DequeueResult}\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async dequeue(\n\t\tparameters: DequeueQueueItemsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<DequeueResult, OpenCloudError>> {\n\t\treturn this.#inner.execute({ options, parameters, spec: DEQUEUE_SPEC });\n\t}\n\n\t/**\n\t * Acknowledges a dequeued batch of items, removing them from the\n\t * queue permanently. Pass the `readId` returned from the prior\n\t * `dequeue` call. Without `discard`, the items reappear once the\n\t * invisibility window elapses.\n\t *\n\t * The call is idempotent: a second `discard` with the same `readId`\n\t * is a no-op once the batch has been acknowledged. The retry policy\n\t * therefore retries both 429 and 5xx.\n\t *\n\t * @param parameters - Universe and queue identifiers, plus the\n\t * `readId` returned from a prior dequeue.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping `undefined` on success (the\n\t * server returns an empty body) or the {@link OpenCloudError}\n\t * that caused the request to fail.\n\t */\n\tpublic async discard(\n\t\tparameters: DiscardQueueItemsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<undefined, OpenCloudError>> {\n\t\treturn this.#inner.execute({ options, parameters, spec: DISCARD_SPEC });\n\t}\n\n\t/**\n\t * Enqueues a single item onto a memory-store queue. The queue is\n\t * auto-created on first use; the queue identifier is any string the\n\t * caller picks. Items with higher `priority` values are dequeued\n\t * first; equal priorities preserve insertion order. Items expire\n\t * and are removed automatically after `ttl` seconds, or after a\n\t * server-default lifetime when omitted.\n\t *\n\t * @param parameters - Universe and queue identifiers, the opaque\n\t * payload, and optional `priority` and `ttl`.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link QueueItem} or\n\t * the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async enqueue(\n\t\tparameters: EnqueueQueueItemParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<QueueItem, OpenCloudError>> {\n\t\treturn this.#inner.execute({ options, parameters, spec: ENQUEUE_SPEC });\n\t}\n}\n","import type { OpenCloudClientOptions } from \"../../client/types.ts\";\nimport { ResourceClient } from \"../../internal/resource-client.ts\";\nimport { MemoryStoreQueuesGroup } from \"./queues-group.ts\";\n\n/**\n * Public client for the Roblox Open Cloud `Data and memory stores`\n * Feature. Today it covers memory-store queues via the\n * {@link StorageClient.queues} Operation Group; future Operation\n * Groups for sorted maps and data stores slot in as siblings on the\n * same client.\n *\n * Every method returns a `Result` so callers handle failure\n * explicitly; no thrown error ever escapes the client.\n *\n * @example\n *\n * ```ts\n * import { StorageClient } from \"@bedrock-rbx/ocale/storage\";\n *\n * const client = new StorageClient({ apiKey: \"your-key\" });\n * expect(client).toBeInstanceOf(StorageClient);\n * ```\n */\nexport class StorageClient {\n\t/** Memory-store queue Operation Group. */\n\tpublic readonly queues: MemoryStoreQueuesGroup;\n\n\t/**\n\t * Creates a new {@link StorageClient}. 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\tconst inner = new ResourceClient(options);\n\t\tthis.queues = new MemoryStoreQueuesGroup(inner);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,oBAAoB,YAAqD;CACxF,MAAM,EAAE,MAAM,UAAU,SAAS,KAAK,eAAe;CACrD,MAAM,OAAgC,EAAE,MAAM;AAC9C,KAAI,aAAa,KAAA,EAChB,MAAK,cAAc;AAGpB,KAAI,QAAQ,KAAA,EACX,MAAK,SAAS,GAAG,IAAI;AAGtB,QAAO;EACN;EACA,SAAS,EAAE,gBAAgB,oBAAoB;EAC/C,QAAQ;EACR,KAAK,uBAAuB,WAAW,uBAAuB,QAAQ;EACtE;;;;;;;;;;;;;;;;AAiBF,SAAgB,oBAAoB,YAAsD;CACzF,MAAM,QAAQ,IAAI,iBAAiB;AACnC,KAAI,WAAW,UAAU,KAAA,EACxB,OAAM,OAAO,SAAS,OAAO,WAAW,MAAM,CAAC;AAGhD,KAAI,WAAW,iBAAiB,KAAA,EAC/B,OAAM,OAAO,gBAAgB,OAAO,WAAW,aAAa,CAA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.d.ts
2
+ /**
3
+ * Caller-supplied input for submitting a Luau Execution task against a
4
+ * place's head version. Submitting against a specific place version uses
5
+ * {@link SubmitAtVersionParameters} instead.
6
+ */
7
+ interface SubmitAtHeadParameters {
8
+ /** Stringified ID of the place to run the script against. */
9
+ readonly placeId: string;
10
+ /** Luau source to execute. */
11
+ readonly script: string;
12
+ /**
13
+ * Wall-clock limit in seconds. The task fails when the script does not
14
+ * complete within this duration. Server default is 5 minutes.
15
+ */
16
+ readonly timeoutSeconds?: number;
17
+ /** Stringified ID of the universe that owns the place. */
18
+ readonly universeId: string;
19
+ }
20
+ /**
21
+ * Caller-supplied input for submitting a Luau Execution task against a
22
+ * specific place version. Submitting against the head version uses
23
+ * {@link SubmitAtHeadParameters} instead.
24
+ */
25
+ interface SubmitAtVersionParameters {
26
+ /** Stringified ID of the place to run the script against. */
27
+ readonly placeId: string;
28
+ /** Luau source to execute. */
29
+ readonly script: string;
30
+ /**
31
+ * Wall-clock limit in seconds. The task fails when the script does not
32
+ * complete within this duration. Server default is 5 minutes.
33
+ */
34
+ readonly timeoutSeconds?: number;
35
+ /** Stringified ID of the universe that owns the place. */
36
+ readonly universeId: string;
37
+ /** Stringified ID of the place version the script targets. */
38
+ readonly versionId: string;
39
+ }
40
+ /**
41
+ * Five-field reference to a Luau Execution session task. The parser
42
+ * extracts this from any of the four x-aep-resource `path` formats
43
+ * returned by the server, and the get builder consumes it to construct
44
+ * the maximal GET URL. `versionId` and `sessionId` are `undefined` when
45
+ * the response `path` did not include those segments.
46
+ */
47
+ interface LuauExecutionTaskRef {
48
+ /** Stringified place ID. */
49
+ readonly placeId: string;
50
+ /** Stringified luau-execution-session ID, when carried by the path. */
51
+ readonly sessionId?: string | undefined;
52
+ /** Stringified luau-execution-session-task ID. */
53
+ readonly taskId: string;
54
+ /** Stringified universe ID. */
55
+ readonly universeId: string;
56
+ /** Stringified place version ID, when carried by the path. */
57
+ readonly versionId?: string | undefined;
58
+ }
59
+ /**
60
+ * Caller-supplied input for fetching a Luau Execution task's current
61
+ * state.
62
+ */
63
+ interface GetParameters {
64
+ /** Reference to the task to fetch, typically returned by submit. */
65
+ readonly ref: LuauExecutionTaskRef;
66
+ /**
67
+ * View controls how much of the task body the server returns. The
68
+ * server defaults to BASIC (excludes `script`) when no view is sent;
69
+ * `FULL` includes every field.
70
+ */
71
+ readonly view?: "BASIC" | "FULL";
72
+ }
73
+ /**
74
+ * Discriminated variant carrying every state in which the task has not
75
+ * yet produced output or an error: queued for execution, currently
76
+ * executing, or cancelled by the caller.
77
+ */
78
+ interface InProgressTask extends LuauExecutionTaskBase {
79
+ /** Discriminator: the task is queued, processing, or cancelled. */
80
+ readonly state: "CANCELLED" | "PROCESSING" | "QUEUED";
81
+ }
82
+ /**
83
+ * Discriminated variant carrying the script's return values. The
84
+ * server populates `output.results` with the Luau `return` values from
85
+ * the script run, serialized as JSON; entries that were not
86
+ * JSON-serializable (e.g., Roblox `Instance`s) appear as `null`.
87
+ */
88
+ interface CompleteTask extends LuauExecutionTaskBase {
89
+ /**
90
+ * JSON projection of the script's return values, in order. The total
91
+ * serialized size of this array is bounded by the server-enforced
92
+ * 4 MB output limit.
93
+ */
94
+ readonly output: {
95
+ readonly results: ReadonlyArray<JSONValue>;
96
+ };
97
+ /** Discriminator: the task ran to completion and produced output. */
98
+ readonly state: "COMPLETE";
99
+ }
100
+ /**
101
+ * Discriminated variant carrying the categorical error code and a
102
+ * human-readable message describing the failure. The
103
+ * `ERROR_CODE_UNSPECIFIED` wire sentinel is rejected by the parser, so
104
+ * `code` is narrowed here to the four substantive error categories.
105
+ */
106
+ interface FailedTask extends LuauExecutionTaskBase {
107
+ /** The categorical error code and message that caused the task to fail. */
108
+ readonly error: {
109
+ /**
110
+ * `SCRIPT_ERROR` for unhandled Luau errors, `DEADLINE_EXCEEDED`
111
+ * when the script outran its timeout, `OUTPUT_SIZE_LIMIT_EXCEEDED`
112
+ * when the return values exceeded 4 MB, or `INTERNAL_ERROR` for
113
+ * server-side faults.
114
+ */
115
+ readonly code: "DEADLINE_EXCEEDED" | "INTERNAL_ERROR" | "OUTPUT_SIZE_LIMIT_EXCEEDED" | "SCRIPT_ERROR"; /** Human-readable description of the failure. */
116
+ readonly message: string;
117
+ };
118
+ /** Discriminator: the task ran but failed before producing output. */
119
+ readonly state: "FAILED";
120
+ }
121
+ /**
122
+ * Public, discriminated representation of a Luau Execution session
123
+ * task. The variants are mutually exclusive on `state`.
124
+ */
125
+ type LuauExecutionTask = CompleteTask | FailedTask | InProgressTask;
126
+ /**
127
+ * Common fields surfaced on every {@link LuauExecutionTask} variant.
128
+ * Variant-specific fields (`output` for COMPLETE, `error` for FAILED)
129
+ * live on the variants themselves.
130
+ */
131
+ interface LuauExecutionTaskBase {
132
+ /** Timestamp when the task was created. */
133
+ readonly createdAt: Date;
134
+ /** Round-trip-safe reference to this task. */
135
+ readonly ref: LuauExecutionTaskRef;
136
+ /**
137
+ * Wall-clock execution limit in seconds, as supplied at submit time.
138
+ * Surfaces `undefined` when the request did not set a timeout (the
139
+ * server applies its 5-minute default in that case).
140
+ */
141
+ readonly timeoutSeconds?: number | undefined;
142
+ /** Timestamp of the most recent state change. */
143
+ readonly updatedAt: Date;
144
+ /** Identifier of the user that owns the API key used to create this task. */
145
+ readonly user: string;
146
+ }
147
+ //#endregion
148
+ export { LuauExecutionTask as a, SubmitAtVersionParameters as c, InProgressTask as i, FailedTask as n, LuauExecutionTaskRef as o, GetParameters as r, SubmitAtHeadParameters as s, CompleteTask as t };
149
+ //# sourceMappingURL=types-BZ0959rh.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BZ0959rh.d.mts","names":[],"sources":["../src/domains/cloud-v2/luau-execution-tasks/types.ts"],"mappings":";;AAKA;;;;UAAiB,sBAAA;;WAEP,OAAA;;WAEA,MAAA;EAOA;AAQV;;;EARU,SAFA,cAAA;;WAEA,UAAA;AAAA;;;;;AA+BV;UAvBiB,yBAAA;;WAEP,OAAA;;WAEA,MAAA;;;;;WAKA,cAAA;EA+BV;EAAA,SA7BU,UAAA;;WAEA,SAAA;AAAA;;;;;AA2CV;;;UAjCiB,oBAAA;EAmCP;EAAA,SAjCA,OAAA;EA0CO;EAAA,SAxCP,SAAA;;WAEA,MAAA;;WAEA,UAAA;EAoC4B;EAAA,SAlC5B,SAAA;AAAA;;;;;UAOO,aAAA;EAmCP;EAAA,SAjCA,GAAA,EAAK,oBAAA;EA0CE;;;;;EAAA,SApCP,IAAA;AAAA;;;;AA6DV;;UArDiB,cAAA,SAAuB,qBAAA;;WAE9B,KAAA;AAAA;;;;;;;UASO,YAAA,SAAqB,qBAAA;EA0CsB;;;;;EAAA,SApClD,MAAA;IAAA,SAAmB,OAAA,EAAS,aAAA,CAAc,SAAA;EAAA;;WAE1C,KAAA;AAAA;;;;;;;UASO,UAAA,SAAmB,qBAAA;;WAE1B,KAAA;;;;;;;aAOC,IAAA;aAMA,OAAA;EAAA;;WAGD,KAAA;AAAA;;;;;KAOE,iBAAA,GAAoB,YAAA,GAAe,UAAA,GAAa,cAAA;;;;;;UAOlD,qBAAA;;WAEA,SAAA,EAAW,IAAA;;WAEX,GAAA,EAAK,oBAAA;;;;;;WAML,cAAA;;WAEA,SAAA,EAAW,IAAA;;WAEX,IAAA;AAAA"}
@@ -211,4 +211,4 @@ type RequestOptions = Partial<Pick<OpenCloudClientOptions, "apiKey" | "baseUrl"
211
211
  type HttpRequestBody = FormData | Record<string, unknown> | Uint8Array<ArrayBuffer> | undefined;
212
212
  //#endregion
213
213
  export { OpenCloudHooks as a, Page as c, OpenCloudError as d, OpenCloudClientOptions as i, Result as l, HttpRequest as n, RequestConfig as o, HttpResponse as r, RequestOptions as s, HttpClient as t, SleepFunc as u };
214
- //# sourceMappingURL=types-YCTsM8Qd.d.mts.map
214
+ //# sourceMappingURL=types-Cp8w8uwA.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-YCTsM8Qd.d.mts","names":[],"sources":["../src/errors/base.ts","../src/internal/utils/sleep.ts","../src/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