@bedrock-rbx/ocale 0.1.0-beta.2 → 0.1.0-beta.20
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 +129 -0
- package/dist/badges.d.mts +33 -2
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +12 -4
- package/dist/badges.mjs.map +1 -1
- package/dist/{data.generated-BtkDGH8C.d.mts → data.generated-B2ceLfSn.d.mts} +9 -1
- package/dist/data.generated-B2ceLfSn.d.mts.map +1 -0
- package/dist/developer-products.d.mts +38 -2
- package/dist/developer-products.d.mts.map +1 -1
- package/dist/developer-products.mjs +22 -5
- package/dist/developer-products.mjs.map +1 -1
- package/dist/game-passes.d.mts +40 -2
- package/dist/game-passes.d.mts.map +1 -1
- package/dist/game-passes.mjs +22 -5
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +110 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/locales.d.mts +1 -1
- package/dist/locales.mjs +2 -0
- package/dist/locales.mjs.map +1 -1
- package/dist/luau-execution.d.mts +112 -6
- package/dist/luau-execution.d.mts.map +1 -1
- package/dist/luau-execution.mjs +129 -4
- package/dist/luau-execution.mjs.map +1 -1
- package/dist/places.d.mts +64 -6
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +33 -61
- package/dist/places.mjs.map +1 -1
- package/dist/poll-timeout-C0nmJzOd.mjs +83 -0
- package/dist/poll-timeout-C0nmJzOd.mjs.map +1 -0
- package/dist/polling-helpers-Cb4j4cq7.mjs +787 -0
- package/dist/polling-helpers-Cb4j4cq7.mjs.map +1 -0
- package/dist/polling-rj0dGREg.d.mts +312 -0
- package/dist/polling-rj0dGREg.d.mts.map +1 -0
- package/dist/{price-information-s7DY0GV2.mjs → price-information-Bu87sPyh.mjs} +2 -2
- package/dist/{price-information-s7DY0GV2.mjs.map → price-information-Bu87sPyh.mjs.map} +1 -1
- package/dist/{rate-limit-CKfuhxT1.mjs → rate-limit-Co9i28qi.mjs} +24 -38
- package/dist/rate-limit-Co9i28qi.mjs.map +1 -0
- package/dist/{resource-client-Wi4Mwqy5.mjs → resource-client-lE7Tg3BK.mjs} +349 -241
- package/dist/resource-client-lE7Tg3BK.mjs.map +1 -0
- package/dist/retry-CbHBw60o.mjs +380 -0
- package/dist/retry-CbHBw60o.mjs.map +1 -0
- package/dist/retry-r1TXe5Zd.d.mts +189 -0
- package/dist/retry-r1TXe5Zd.d.mts.map +1 -0
- package/dist/signatures-JF-7Psce.mjs +59 -0
- package/dist/signatures-JF-7Psce.mjs.map +1 -0
- package/dist/storage.d.mts +322 -31
- package/dist/storage.d.mts.map +1 -1
- package/dist/storage.mjs +506 -18
- package/dist/storage.mjs.map +1 -1
- package/dist/testing.d.mts +727 -0
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +457 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/{to-blob-1BtHsDGK.mjs → to-blob-RPqMBuft.mjs} +1 -1
- package/dist/{to-blob-1BtHsDGK.mjs.map → to-blob-RPqMBuft.mjs.map} +1 -1
- package/dist/{types-Cp8w8uwA.d.mts → types-CRiJg5EQ.d.mts} +46 -4
- package/dist/types-CRiJg5EQ.d.mts.map +1 -0
- package/dist/universes.d.mts +47 -10
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +7 -5
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-b7KAoEio.mjs → validation-9oU6qNNQ.mjs} +4 -2
- package/dist/validation-9oU6qNNQ.mjs.map +1 -0
- package/dist/wire-D3K-a-UP.d.mts +37 -0
- package/dist/wire-D3K-a-UP.d.mts.map +1 -0
- package/package.json +9 -7
- package/dist/data.generated-BtkDGH8C.d.mts.map +0 -1
- package/dist/is-date-time-string-Cuf1TaSC.mjs +0 -19
- package/dist/is-date-time-string-Cuf1TaSC.mjs.map +0 -1
- package/dist/rate-limit-CKfuhxT1.mjs.map +0 -1
- package/dist/rate-limit-DzHBFwps.d.mts +0 -92
- package/dist/rate-limit-DzHBFwps.d.mts.map +0 -1
- package/dist/resource-client-Wi4Mwqy5.mjs.map +0 -1
- package/dist/specs-Co6qYp_E.mjs +0 -309
- package/dist/specs-Co6qYp_E.mjs.map +0 -1
- package/dist/types-BZ0959rh.d.mts +0 -149
- package/dist/types-BZ0959rh.d.mts.map +0 -1
- package/dist/types-Cp8w8uwA.d.mts.map +0 -1
- package/dist/validation-b7KAoEio.mjs.map +0 -1
package/dist/specs-Co6qYp_E.mjs
DELETED
|
@@ -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;;;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AAM;GACL,WAAW,IAAI,KAAK,KAAK,WAAW;GACpC,OAAO;IAAE,MAAM,KAAK,MAAM;IAAM,SAAS,KAAK,MAAM;IAAS;GAC7D;GACA,OAAO;GACP;GACA,WAAW,IAAI,KAAK,KAAK,WAAW;GACpC,MAAM,KAAK;GACX;EACD,SAAS;EACT;;AAGF,SAAS,aAAa,MAAgD;CACrE,MAAM,QAAQ,aAAa,KAAK,KAAK;AACrC,KAAI,UAAU,KACb;CAGD,MAAM,GAAG,YAAY,SAAS,WAAW,WAAW,eAAe,eAAe;CAClF,MAAM,SAAS,iBAAiB;AAChC,KAAI,eAAe,KAAA,KAAa,YAAY,KAAA,KAAa,WAAW,KAAA,EACnE;AAGD,QAAO;EAAE;EAAS;EAAW;EAAQ;EAAY;EAAW;;;;AC1L7D,SAAS,SACR,MAC2C;AAC3C,QAAO,OAAO,OAAO,KAAK;;;;;;;;AAS3B,MAAa,mBAAmB,SAAiC;CAChE,eAAe,eAAe,UAAU,yBAAyB,WAAW,CAAC;CAC7E,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,OAAO;CACP,gBAAgB;CAChB,CAAC;;;;;;;AAQF,MAAa,sBAAsB,SAAoC;CACtE,eAAe,eAAe,UAAU,4BAA4B,WAAW,CAAC;CAChF,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,OAAO;CACP,gBAAgB;CAChB,CAAC;;;;;;AAOF,MAAa,WAAW,SAAwB;CAC/C,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,OAAO;CACP,gBAAgB;CAChB,CAAC"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
//#region src/domains/cloud-v2/luau-execution-tasks/types.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
|
|
@@ -1 +0,0 @@
|
|
|
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;;U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AAA;ADyBV;;;AAAA,UCnBiB,aAAA;;WAEP,MAAA;;WAEA,OAAA;;WAEA,OAAA;AAAA;;;;AAxCV;UA+CiB,UAAA;;EAEhB,OAAA,CACC,OAAA,EAAS,WAAA,EACT,MAAA,EAAQ,aAAA,GACN,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,cAAA;AAAA;;;;;UAOhB,cAAA;;WAEP,WAAA,IAAe,MAAA;;WAEf,SAAA,IAAa,OAAA,EAAS,WAAA;;WAEtB,OAAA,IAAW,OAAA,UAAiB,KAAA,EAAO,cAAA;AAAA;AA/C7C;;;;AAAA,UAsDiB,sBAAA;;WAEP,MAAA;;WAEA,OAAA;;WAEA,KAAA,GAAQ,cAAA;EA5ClB;;;;;;;EAAA,SAoDU,UAAA,GAAa,UAAA;EA9Cb;EAAA,SAgDA,UAAA;EAzCO;;;;;EAAA,SA+CP,iBAAA,GAAoB,aAAA;;WAEpB,UAAA,IAAc,OAAA;;;;;;;WAOd,KAAA,GAAQ,SAAA;;WAER,OAAA;AAAA;;;;AA9CV;;KAsDY,cAAA,GAAiB,OAAA,CAC5B,IAAA,CACC,sBAAA;;;;;;;;;;;;KAgBG,eAAA,GAAkB,QAAA,GAAW,MAAA,oBAA0B,UAAA,CAAW,WAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation-b7KAoEio.mjs","names":[],"sources":["../src/errors/validation.ts"],"sourcesContent":["import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Closed discriminator for a {@link ValidationError}. Consumers can\n * exhaustively `switch` over this union so TypeScript will refuse to compile\n * if a new variant is added without a handler.\n */\nexport type ValidationErrorCode =\n\t| \"empty_body\"\n\t| \"empty_image_ids\"\n\t| \"empty_update\"\n\t| \"format_mismatch\"\n\t| \"incomplete_ref\"\n\t| \"invalid_image_id\";\n\n/**\n * Options for constructing a {@link ValidationError}.\n */\nexport interface ValidationErrorOptions extends ErrorOptions {\n\t/** Machine-readable discriminator identifying the validation failure. */\n\tcode: ValidationErrorCode;\n}\n\n/**\n * Thrown locally when caller-supplied input is rejected before any HTTP\n * round-trip. The `code` discriminator lets consumers branch on local-input\n * errors separately from server-side errors.\n *\n * @example\n *\n * ```ts\n * import { ValidationError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new ValidationError(\"Place body is empty\", {\n * code: \"empty_body\",\n * });\n *\n * expect(error).toBeInstanceOf(ValidationError);\n * expect(error.code).toBe(\"empty_body\");\n * ```\n */\nexport class ValidationError extends OpenCloudError {\n\tpublic readonly code: ValidationErrorCode;\n\tpublic override readonly name: string = \"ValidationError\";\n\n\t/**\n\t * Creates a new ValidationError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the validation failure code.\n\t */\n\tconstructor(message: string, options: ValidationErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.code = options.code;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,kBAAb,cAAqC,eAAe;CACnD;CACA,OAAwC;;;;;;;CAQxC,YAAY,SAAiB,SAAiC;AAC7D,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO,QAAQ"}
|