@bedrock-rbx/ocale 0.1.0-beta.1 → 0.1.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/badges.d.mts +86 -3
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +113 -6
- package/dist/badges.mjs.map +1 -1
- package/dist/data.generated-Cb6g6asv.d.mts +485 -0
- package/dist/data.generated-Cb6g6asv.d.mts.map +1 -0
- package/dist/developer-products.d.mts +14 -5
- package/dist/developer-products.d.mts.map +1 -1
- package/dist/developer-products.mjs +5 -5
- package/dist/developer-products.mjs.map +1 -1
- package/dist/game-passes.d.mts +83 -2
- package/dist/game-passes.d.mts.map +1 -1
- package/dist/game-passes.mjs +111 -5
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +75 -64
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/locales.d.mts +2 -0
- package/dist/locales.mjs +512 -0
- package/dist/locales.mjs.map +1 -0
- package/dist/luau-execution.d.mts +149 -0
- package/dist/luau-execution.d.mts.map +1 -0
- package/dist/luau-execution.mjs +164 -0
- package/dist/luau-execution.mjs.map +1 -0
- package/dist/permission-error-DOVtNq3A.mjs +46 -0
- package/dist/permission-error-DOVtNq3A.mjs.map +1 -0
- package/dist/places.d.mts +87 -8
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +58 -69
- package/dist/places.mjs.map +1 -1
- package/dist/poll-timeout-Dg_QFEqi.mjs +79 -0
- package/dist/poll-timeout-Dg_QFEqi.mjs.map +1 -0
- package/dist/polling-BMrYajok.d.mts +253 -0
- package/dist/polling-BMrYajok.d.mts.map +1 -0
- package/dist/polling-helpers-QGjvYq3c.mjs +650 -0
- package/dist/polling-helpers-QGjvYq3c.mjs.map +1 -0
- package/dist/{price-information-CmpscMc4.mjs → price-information-DIrvwCmd.mjs} +2 -2
- package/dist/{price-information-CmpscMc4.mjs.map → price-information-DIrvwCmd.mjs.map} +1 -1
- package/dist/rate-limit-BYuizHoD.d.mts +92 -0
- package/dist/rate-limit-BYuizHoD.d.mts.map +1 -0
- package/dist/{rate-limit-BBU_4xnZ.mjs → rate-limit-D1q2Js-z.mjs} +12 -46
- package/dist/rate-limit-D1q2Js-z.mjs.map +1 -0
- package/dist/{resource-client-CaS_j3yg.mjs → resource-client-D6Efj9fU.mjs} +95 -15
- package/dist/resource-client-D6Efj9fU.mjs.map +1 -0
- package/dist/signatures-B5Fojgn0.mjs +59 -0
- package/dist/signatures-B5Fojgn0.mjs.map +1 -0
- package/dist/storage.d.mts +662 -0
- package/dist/storage.d.mts.map +1 -0
- package/dist/storage.mjs +858 -0
- package/dist/storage.mjs.map +1 -0
- 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-B27VhoRp.mjs} +1 -1
- package/dist/{to-blob-1BtHsDGK.mjs.map → to-blob-B27VhoRp.mjs.map} +1 -1
- package/dist/{types-YCTsM8Qd.d.mts → types-CwtZT1ek.d.mts} +1 -1
- package/dist/{types-YCTsM8Qd.d.mts.map → types-CwtZT1ek.d.mts.map} +1 -1
- package/dist/universes.d.mts +38 -18
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +5 -5
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-CTZzJhmd.mjs → validation-DkL5KQqz.mjs} +2 -2
- package/dist/validation-DkL5KQqz.mjs.map +1 -0
- package/dist/wire-CeL6W_V7.d.mts +35 -0
- package/dist/wire-CeL6W_V7.d.mts.map +1 -0
- package/package.json +8 -3
- package/dist/rate-limit-BBU_4xnZ.mjs.map +0 -1
- package/dist/resource-client-CaS_j3yg.mjs.map +0 -1
- package/dist/validation-CTZzJhmd.mjs.map +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, s as RequestOptions } from "./types-CwtZT1ek.mjs";
|
|
2
|
+
import { a as CompleteTask, c as InProgressTask, d as SubmitAtHeadParameters, f as SubmitAtVersionParameters, i as LogPage, l as LuauExecutionTask, n as ListLogsParameters, o as FailedTask, r as LogMessage, s as GetParameters, t as PollUntilDoneOptions, u as LuauExecutionTaskRef } from "./polling-BMrYajok.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/domains/cloud-v2/luau-execution-task-binary-inputs/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Caller-supplied input for creating a Luau execution task binary input
|
|
7
|
+
* upload slot. The server returns a presigned `uploadUri` the caller uses
|
|
8
|
+
* to PUT the binary data.
|
|
9
|
+
*/
|
|
10
|
+
interface CreateBinaryInputParameters {
|
|
11
|
+
/** Size in bytes of the binary data to be uploaded. */
|
|
12
|
+
readonly size: number;
|
|
13
|
+
/** Stringified ID of the universe that owns the task. */
|
|
14
|
+
readonly universeId: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Public representation of a created Luau execution task binary input.
|
|
18
|
+
* Pass `path` verbatim to `tasks.submit({ binaryInput })`.
|
|
19
|
+
*/
|
|
20
|
+
interface LuauExecutionTaskBinaryInput {
|
|
21
|
+
/** Server-emitted resource path; pass to `tasks.submit` as `binaryInput`. */
|
|
22
|
+
readonly path: string;
|
|
23
|
+
/** Presigned PUT target; perform the binary upload to this URI directly. */
|
|
24
|
+
readonly uploadUri: string;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/resources/luau-execution/client.d.ts
|
|
28
|
+
/**
|
|
29
|
+
* Operation handle for the `binaryInputs` namespace on
|
|
30
|
+
* {@link LuauExecutionClient}. Provides `create` to allocate a presigned
|
|
31
|
+
* upload slot for binary script inputs.
|
|
32
|
+
*/
|
|
33
|
+
interface BinaryInputsHandle {
|
|
34
|
+
/**
|
|
35
|
+
* Allocates a presigned binary input upload slot. The returned
|
|
36
|
+
* `uploadUri` is a presigned `PUT` target; the caller uploads the
|
|
37
|
+
* binary data directly and passes `path` to `tasks.submit` as
|
|
38
|
+
* `binaryInput`.
|
|
39
|
+
*
|
|
40
|
+
* @param parameters - Universe identifier and the byte size of the
|
|
41
|
+
* binary to upload.
|
|
42
|
+
* @param options - Optional per-request overrides.
|
|
43
|
+
* @returns A {@link Result} wrapping the parsed
|
|
44
|
+
* {@link LuauExecutionTaskBinaryInput} or the {@link OpenCloudError}
|
|
45
|
+
* that caused the request to fail.
|
|
46
|
+
*/
|
|
47
|
+
create(parameters: CreateBinaryInputParameters, options?: RequestOptions): Promise<Result<LuauExecutionTaskBinaryInput, OpenCloudError>>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Operation handle exposed by {@link LuauExecutionClient} as the
|
|
51
|
+
* `tasks` namespace. Provides `submit` to queue a Luau script, `get`
|
|
52
|
+
* to fetch a task's current state, and `listLogs` to retrieve
|
|
53
|
+
* structured log messages produced by a task.
|
|
54
|
+
*/
|
|
55
|
+
interface TasksHandle {
|
|
56
|
+
/**
|
|
57
|
+
* Fetches the current state of a previously-submitted Luau
|
|
58
|
+
* execution task. Uses idempotent retry semantics for both 429 and
|
|
59
|
+
* 5xx.
|
|
60
|
+
*
|
|
61
|
+
* @param parameters - The task ref plus an optional `view` selector.
|
|
62
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
63
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
64
|
+
* @returns A {@link Result} wrapping the parsed
|
|
65
|
+
* {@link LuauExecutionTask} or the {@link OpenCloudError} that
|
|
66
|
+
* caused the request to fail.
|
|
67
|
+
*/
|
|
68
|
+
get(parameters: GetParameters, options?: RequestOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
|
|
69
|
+
/**
|
|
70
|
+
* Lists one page of structured log messages produced by a
|
|
71
|
+
* previously-submitted Luau execution task. Messages from multiple
|
|
72
|
+
* server-side chunks are flattened into a single ordered array.
|
|
73
|
+
* Uses idempotent retry semantics for both 429 and 5xx.
|
|
74
|
+
*
|
|
75
|
+
* @param parameters - The task ref and optional pagination controls
|
|
76
|
+
* (`pageSize`, `pageToken`).
|
|
77
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
78
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
79
|
+
* @returns A {@link Result} wrapping the parsed {@link LogPage} or
|
|
80
|
+
* the {@link OpenCloudError} that caused the request to fail.
|
|
81
|
+
*/
|
|
82
|
+
listLogs(parameters: ListLogsParameters, options?: RequestOptions): Promise<Result<LogPage, OpenCloudError>>;
|
|
83
|
+
/**
|
|
84
|
+
* Polls `tasks.get` with `view=BASIC` on a configurable backoff schedule
|
|
85
|
+
* until the task reaches a terminal state, the wall-clock budget is
|
|
86
|
+
* exhausted, or the supplied `AbortSignal` fires. Returns the terminal
|
|
87
|
+
* task on success.
|
|
88
|
+
*
|
|
89
|
+
* @param ref - Reference to the task to poll, typically returned by `submit`.
|
|
90
|
+
* @param options - Polling and per-request overrides.
|
|
91
|
+
* @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask},
|
|
92
|
+
* or an error if aborted, timed out, or the transport fails.
|
|
93
|
+
*/
|
|
94
|
+
pollUntilDone(ref: LuauExecutionTaskRef, options?: PollUntilDoneOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
|
|
95
|
+
/**
|
|
96
|
+
* Submits a Luau script and polls `tasks.get` with `view=BASIC` until
|
|
97
|
+
* the task reaches a terminal state, the wall-clock budget is
|
|
98
|
+
* exhausted, or the supplied `AbortSignal` fires. Combines `submit`
|
|
99
|
+
* and `pollUntilDone` in one call.
|
|
100
|
+
*
|
|
101
|
+
* @param parameters - The same input accepted by `submit`.
|
|
102
|
+
* @param options - Polling and per-request overrides.
|
|
103
|
+
* @returns A {@link Result} wrapping the terminal
|
|
104
|
+
* {@link LuauExecutionTask}, or an error if submit fails, the task
|
|
105
|
+
* is aborted, timed out, or the transport fails.
|
|
106
|
+
*/
|
|
107
|
+
runUntilDone(parameters: SubmitAtHeadParameters | SubmitAtVersionParameters, options?: PollUntilDoneOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
|
|
108
|
+
/**
|
|
109
|
+
* Submits a Luau script for execution against a place. Dispatches
|
|
110
|
+
* to the head-version URL when `versionId` is omitted, or to the
|
|
111
|
+
* specific-version URL when one is supplied. Both URL shapes share
|
|
112
|
+
* one rate-limit queue and one required-scope set.
|
|
113
|
+
*
|
|
114
|
+
* @param parameters - The universe and place identifiers, the
|
|
115
|
+
* script to run, an optional `versionId`, and any other writable
|
|
116
|
+
* submit fields.
|
|
117
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
118
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
119
|
+
* @returns A {@link Result} wrapping the parsed
|
|
120
|
+
* {@link LuauExecutionTask} or the {@link OpenCloudError} that
|
|
121
|
+
* caused the request to fail.
|
|
122
|
+
*/
|
|
123
|
+
submit(parameters: SubmitAtHeadParameters | SubmitAtVersionParameters, options?: RequestOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Public client for the Roblox Open Cloud `LuauExecutionSessionTask`
|
|
127
|
+
* resource. Tasks run a Luau script against a place and surface state,
|
|
128
|
+
* output, or error through the `LuauExecutionTask` discriminated
|
|
129
|
+
* union. Exposes `tasks.submit` for both the head version and a
|
|
130
|
+
* specific place version, `tasks.get` for fetching task state,
|
|
131
|
+
* `tasks.listLogs` for fetching structured log messages, and
|
|
132
|
+
* `binaryInputs.create` for allocating presigned upload slots.
|
|
133
|
+
*/
|
|
134
|
+
declare class LuauExecutionClient {
|
|
135
|
+
#private;
|
|
136
|
+
readonly binaryInputs: BinaryInputsHandle;
|
|
137
|
+
readonly tasks: TasksHandle;
|
|
138
|
+
/**
|
|
139
|
+
* Creates a new {@link LuauExecutionClient}. Configuration is frozen
|
|
140
|
+
* on construction; per-request overrides are accepted on each
|
|
141
|
+
* method.
|
|
142
|
+
*
|
|
143
|
+
* @param options - Client-level configuration including the API key.
|
|
144
|
+
*/
|
|
145
|
+
constructor(options: OpenCloudClientOptions);
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
export { type BinaryInputsHandle, type CompleteTask, type CreateBinaryInputParameters, type FailedTask, type GetParameters, type InProgressTask, type ListLogsParameters, type LogMessage, type LogPage, LuauExecutionClient, type LuauExecutionTask, type LuauExecutionTaskBinaryInput, type LuauExecutionTaskRef, type PollUntilDoneOptions, type SubmitAtHeadParameters, type SubmitAtVersionParameters, type TasksHandle };
|
|
149
|
+
//# sourceMappingURL=luau-execution.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"luau-execution.d.mts","names":[],"sources":["../src/domains/cloud-v2/luau-execution-task-binary-inputs/types.ts","../src/resources/luau-execution/client.ts"],"mappings":";;;;;;;;AAKA;UAAiB,2BAAA;;WAEP,IAAA;EAEA;EAAA,SAAA,UAAA;AAAA;;;;;UAOO,4BAAA;;WAEP,IAAA;EC0CO;EAAA,SDxCP,SAAA;AAAA;;;;;AAJV;;;UC4CiB,kBAAA;EDxCP;;;;ACwCV;;;;;;;;;EAcC,MAAA,CACC,UAAA,EAAY,2BAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,4BAAA,EAA8B,cAAA;AAAA;;;;;;;UAShC,WAAA;;;;;AAAjB;;;;;;;;EAaC,GAAA,CACC,UAAA,EAAY,aAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;;;;;;;;;;;;;;EAcrC,QAAA,CACC,UAAA,EAAY,kBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,OAAA,EAAS,cAAA;;;;;;;;;;;;EAY3B,aAAA,CACC,GAAA,EAAK,oBAAA,EACL,OAAA,GAAU,oBAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;;;;;;;;;;;;;EAarC,YAAA,CACC,UAAA,EAAY,sBAAA,GAAyB,yBAAA,EACrC,OAAA,GAAU,oBAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;;;;;;;;;;;;;;;;EAgBrC,MAAA,CACC,UAAA,EAAY,sBAAA,GAAyB,yBAAA,EACrC,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;AAAA;;;;;;;;;;cAYzB,mBAAA;EAAA;WAGI,YAAA,EAAc,kBAAA;EAAA,SACd,KAAA,EAAO,WAAA;;;;;;;;EASvB,WAAA,CAAY,OAAA,EAAS,sBAAA;AAAA"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { r as ApiError } from "./rate-limit-D1q2Js-z.mjs";
|
|
2
|
+
import { i as CREATE_METHOD_DEFAULTS, n as okRequest, s as isRecord, t as ResourceClient } from "./resource-client-D6Efj9fU.mjs";
|
|
3
|
+
import { a as SUBMIT_HEAD_SPEC, i as GET_SPEC, n as submitAndPoll, o as SUBMIT_VERSION_SPEC, r as pollUntilDoneCore, s as LIST_LOGS_SPEC, t as buildPollDeps } from "./polling-helpers-QGjvYq3c.mjs";
|
|
4
|
+
//#region src/domains/cloud-v2/luau-execution-task-binary-inputs/builders.ts
|
|
5
|
+
/**
|
|
6
|
+
* Builds a `POST` request for the Open Cloud
|
|
7
|
+
* `Cloud_CreateLuauExecutionSessionTaskBinaryInput` endpoint. The
|
|
8
|
+
* server responds with a presigned `uploadUri` and the resource `path`.
|
|
9
|
+
*
|
|
10
|
+
* @param parameters - Universe identifier and the byte size of the
|
|
11
|
+
* binary to be uploaded.
|
|
12
|
+
* @returns A pure {@link HttpRequest} describing the create call.
|
|
13
|
+
*/
|
|
14
|
+
function buildCreateBinaryInputRequest(parameters) {
|
|
15
|
+
const { size, universeId } = parameters;
|
|
16
|
+
return {
|
|
17
|
+
body: { size },
|
|
18
|
+
headers: { "content-type": "application/json" },
|
|
19
|
+
method: "POST",
|
|
20
|
+
url: `/cloud/v2/universes/${universeId}/luau-execution-session-task-binary-inputs`
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Per-second request ceiling for creating a Luau execution task binary
|
|
25
|
+
* input, sourced from `x-roblox-rate-limits.perApiKeyOwner` on the
|
|
26
|
+
* `Cloud_CreateLuauExecutionSessionTaskBinaryInput` operation (5 requests
|
|
27
|
+
* per minute per API key owner).
|
|
28
|
+
*/
|
|
29
|
+
const CREATE_OPERATION_LIMIT = Object.freeze({
|
|
30
|
+
maxPerSecond: 5 / 60,
|
|
31
|
+
operationKey: "luau-execution-task-binary-inputs.create"
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Scopes required to create a Luau execution task binary input, sourced
|
|
35
|
+
* from `x-roblox-scopes` on the create operation in the vendored OpenAPI
|
|
36
|
+
* schema.
|
|
37
|
+
*/
|
|
38
|
+
const CREATE_REQUIRED_SCOPES = Object.freeze(["universe.place.luau-execution-session:write"]);
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/domains/cloud-v2/luau-execution-task-binary-inputs/parsers.ts
|
|
41
|
+
const PATH_PATTERN = /^universes\/(\d+)\/luau-execution-session-task-binary-inputs\/([^/]+)$/;
|
|
42
|
+
const MALFORMED_MESSAGE = "Malformed luau-execution-session-task-binary-input response";
|
|
43
|
+
/**
|
|
44
|
+
* Parses a successful Open Cloud
|
|
45
|
+
* `Cloud_CreateLuauExecutionSessionTaskBinaryInput` response body into
|
|
46
|
+
* the public {@link LuauExecutionTaskBinaryInput}.
|
|
47
|
+
*
|
|
48
|
+
* @param response - The full {@link HttpResponse} from the Open Cloud API.
|
|
49
|
+
* @returns A success result wrapping the parsed binary input, or an
|
|
50
|
+
* {@link ApiError} when the body does not match the expected shape.
|
|
51
|
+
*/
|
|
52
|
+
function parseBinaryInputResponse(response) {
|
|
53
|
+
const { body, status: statusCode } = response;
|
|
54
|
+
if (!isRecord(body)) return malformed(statusCode);
|
|
55
|
+
if (typeof body["path"] !== "string" || !PATH_PATTERN.test(body["path"])) return malformed(statusCode);
|
|
56
|
+
if (typeof body["uploadUri"] !== "string") return malformed(statusCode);
|
|
57
|
+
return {
|
|
58
|
+
data: {
|
|
59
|
+
path: body["path"],
|
|
60
|
+
uploadUri: body["uploadUri"]
|
|
61
|
+
},
|
|
62
|
+
success: true
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function malformed(statusCode) {
|
|
66
|
+
return {
|
|
67
|
+
err: new ApiError(MALFORMED_MESSAGE, { statusCode }),
|
|
68
|
+
success: false
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/resources/luau-execution/client.ts
|
|
73
|
+
function makeSpec(spec) {
|
|
74
|
+
return Object.freeze(spec);
|
|
75
|
+
}
|
|
76
|
+
const CREATE_BINARY_INPUT_SPEC = makeSpec({
|
|
77
|
+
buildRequest: (parameters) => okRequest(buildCreateBinaryInputRequest(parameters)),
|
|
78
|
+
methodDefaults: CREATE_METHOD_DEFAULTS,
|
|
79
|
+
methodKind: "create",
|
|
80
|
+
operationLimit: CREATE_OPERATION_LIMIT,
|
|
81
|
+
parse: parseBinaryInputResponse,
|
|
82
|
+
requiredScopes: CREATE_REQUIRED_SCOPES
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* Public client for the Roblox Open Cloud `LuauExecutionSessionTask`
|
|
86
|
+
* resource. Tasks run a Luau script against a place and surface state,
|
|
87
|
+
* output, or error through the `LuauExecutionTask` discriminated
|
|
88
|
+
* union. Exposes `tasks.submit` for both the head version and a
|
|
89
|
+
* specific place version, `tasks.get` for fetching task state,
|
|
90
|
+
* `tasks.listLogs` for fetching structured log messages, and
|
|
91
|
+
* `binaryInputs.create` for allocating presigned upload slots.
|
|
92
|
+
*/
|
|
93
|
+
var LuauExecutionClient = class {
|
|
94
|
+
#inner;
|
|
95
|
+
binaryInputs;
|
|
96
|
+
tasks;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new {@link LuauExecutionClient}. Configuration is frozen
|
|
99
|
+
* on construction; per-request overrides are accepted on each
|
|
100
|
+
* method.
|
|
101
|
+
*
|
|
102
|
+
* @param options - Client-level configuration including the API key.
|
|
103
|
+
*/
|
|
104
|
+
constructor(options) {
|
|
105
|
+
this.#inner = new ResourceClient(options);
|
|
106
|
+
this.binaryInputs = createBinaryInputsHandle(this.#inner);
|
|
107
|
+
this.tasks = createTasksHandle(this.#inner);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
function createBinaryInputsHandle(inner) {
|
|
111
|
+
return { async create(parameters, options) {
|
|
112
|
+
return inner.execute({
|
|
113
|
+
options,
|
|
114
|
+
parameters,
|
|
115
|
+
spec: CREATE_BINARY_INPUT_SPEC
|
|
116
|
+
});
|
|
117
|
+
} };
|
|
118
|
+
}
|
|
119
|
+
function createTasksHandle(inner) {
|
|
120
|
+
return {
|
|
121
|
+
async get(parameters, options) {
|
|
122
|
+
return inner.execute({
|
|
123
|
+
options,
|
|
124
|
+
parameters,
|
|
125
|
+
spec: GET_SPEC
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
async listLogs(parameters, options) {
|
|
129
|
+
return inner.execute({
|
|
130
|
+
options,
|
|
131
|
+
parameters,
|
|
132
|
+
spec: LIST_LOGS_SPEC
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
async pollUntilDone(ref, options = {}) {
|
|
136
|
+
return pollUntilDoneCore(buildPollDeps(inner, {
|
|
137
|
+
options,
|
|
138
|
+
ref
|
|
139
|
+
}), options);
|
|
140
|
+
},
|
|
141
|
+
async runUntilDone(parameters, options = {}) {
|
|
142
|
+
return submitAndPoll(inner, {
|
|
143
|
+
options,
|
|
144
|
+
parameters
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
async submit(parameters, options) {
|
|
148
|
+
if ("versionId" in parameters) return inner.execute({
|
|
149
|
+
options,
|
|
150
|
+
parameters,
|
|
151
|
+
spec: SUBMIT_VERSION_SPEC
|
|
152
|
+
});
|
|
153
|
+
return inner.execute({
|
|
154
|
+
options,
|
|
155
|
+
parameters,
|
|
156
|
+
spec: SUBMIT_HEAD_SPEC
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
export { LuauExecutionClient };
|
|
163
|
+
|
|
164
|
+
//# sourceMappingURL=luau-execution.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"luau-execution.mjs","names":["#inner"],"sources":["../src/domains/cloud-v2/luau-execution-task-binary-inputs/builders.ts","../src/domains/cloud-v2/luau-execution-task-binary-inputs/operations.ts","../src/domains/cloud-v2/luau-execution-task-binary-inputs/parsers.ts","../src/resources/luau-execution/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport type { CreateBinaryInputParameters } from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the Open Cloud\n * `Cloud_CreateLuauExecutionSessionTaskBinaryInput` endpoint. The\n * server responds with a presigned `uploadUri` and the resource `path`.\n *\n * @param parameters - Universe identifier and the byte size of the\n * binary to be uploaded.\n * @returns A pure {@link HttpRequest} describing the create call.\n */\nexport function buildCreateBinaryInputRequest(\n\tparameters: CreateBinaryInputParameters,\n): HttpRequest {\n\tconst { size, universeId } = parameters;\n\treturn {\n\t\tbody: { size },\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/luau-execution-session-task-binary-inputs`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst CREATE_PER_MINUTE = 5;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for creating a Luau execution task binary\n * input, sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_CreateLuauExecutionSessionTaskBinaryInput` operation (5 requests\n * per minute per API key owner).\n */\nexport const CREATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: CREATE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-task-binary-inputs.create\",\n});\n\n/**\n * Scopes required to create a Luau execution task binary input, sourced\n * from `x-roblox-scopes` on the create operation in the vendored OpenAPI\n * schema.\n */\nexport const CREATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:write\",\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 { LuauExecutionTaskBinaryInput } from \"./types.ts\";\n\nconst PATH_PATTERN = /^universes\\/(\\d+)\\/luau-execution-session-task-binary-inputs\\/([^/]+)$/;\n\nconst MALFORMED_MESSAGE = \"Malformed luau-execution-session-task-binary-input response\";\n\n/**\n * Parses a successful Open Cloud\n * `Cloud_CreateLuauExecutionSessionTaskBinaryInput` response body into\n * the public {@link LuauExecutionTaskBinaryInput}.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed binary input, or an\n * {@link ApiError} when the body does not match the expected shape.\n */\nexport function parseBinaryInputResponse(\n\tresponse: HttpResponse,\n): Result<LuauExecutionTaskBinaryInput, ApiError> {\n\tconst { body, status: statusCode } = response;\n\n\tif (!isRecord(body)) {\n\t\treturn malformed(statusCode);\n\t}\n\n\tif (typeof body[\"path\"] !== \"string\" || !PATH_PATTERN.test(body[\"path\"])) {\n\t\treturn malformed(statusCode);\n\t}\n\n\tif (typeof body[\"uploadUri\"] !== \"string\") {\n\t\treturn malformed(statusCode);\n\t}\n\n\treturn {\n\t\tdata: { path: body[\"path\"], uploadUri: body[\"uploadUri\"] },\n\t\tsuccess: true,\n\t};\n}\n\nfunction malformed(statusCode: number): Result<LuauExecutionTaskBinaryInput, ApiError> {\n\treturn { err: new ApiError(MALFORMED_MESSAGE, { statusCode }), success: false };\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport { buildCreateBinaryInputRequest } from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/builders.ts\";\nimport {\n\tCREATE_OPERATION_LIMIT,\n\tCREATE_REQUIRED_SCOPES,\n} from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/operations.ts\";\nimport { parseBinaryInputResponse } from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/parsers.ts\";\nimport type {\n\tCreateBinaryInputParameters,\n\tLuauExecutionTaskBinaryInput,\n} from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/types.ts\";\nimport { LIST_LOGS_SPEC } from \"../../domains/cloud-v2/luau-execution-task-logs/specs.ts\";\nimport type {\n\tListLogsParameters,\n\tLogPage,\n} from \"../../domains/cloud-v2/luau-execution-task-logs/types.ts\";\nimport {\n\tGET_SPEC,\n\tSUBMIT_HEAD_SPEC,\n\tSUBMIT_VERSION_SPEC,\n} from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { CREATE_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport {\n\tokRequest,\n\tResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { buildPollDeps, submitAndPoll } from \"./polling-helpers.ts\";\nimport { pollUntilDoneCore, type PollUntilDoneOptions } from \"./polling.ts\";\n\nfunction makeSpec<P, R>(spec: ResourceMethodSpec<P, R>): ResourceMethodSpec<P, R> {\n\treturn Object.freeze(spec);\n}\n\nconst CREATE_BINARY_INPUT_SPEC = makeSpec<\n\tCreateBinaryInputParameters,\n\tLuauExecutionTaskBinaryInput\n>({\n\tbuildRequest: (parameters) => okRequest(buildCreateBinaryInputRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: CREATE_OPERATION_LIMIT,\n\tparse: parseBinaryInputResponse,\n\trequiredScopes: CREATE_REQUIRED_SCOPES,\n});\n\n/**\n * Operation handle for the `binaryInputs` namespace on\n * {@link LuauExecutionClient}. Provides `create` to allocate a presigned\n * upload slot for binary script inputs.\n */\nexport interface BinaryInputsHandle {\n\t/**\n\t * Allocates a presigned binary input upload slot. The returned\n\t * `uploadUri` is a presigned `PUT` target; the caller uploads the\n\t * binary data directly and passes `path` to `tasks.submit` as\n\t * `binaryInput`.\n\t *\n\t * @param parameters - Universe identifier and the byte size of the\n\t * binary to upload.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTaskBinaryInput} or the {@link OpenCloudError}\n\t * that caused the request to fail.\n\t */\n\tcreate(\n\t\tparameters: CreateBinaryInputParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LuauExecutionTaskBinaryInput, OpenCloudError>>;\n}\n\n/**\n * Operation handle exposed by {@link LuauExecutionClient} as the\n * `tasks` namespace. Provides `submit` to queue a Luau script, `get`\n * to fetch a task's current state, and `listLogs` to retrieve\n * structured log messages produced by a task.\n */\nexport interface TasksHandle {\n\t/**\n\t * Fetches the current state of a previously-submitted Luau\n\t * execution task. Uses idempotent retry semantics for both 429 and\n\t * 5xx.\n\t *\n\t * @param parameters - The task ref plus an optional `view` selector.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tget(\n\t\tparameters: GetParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Lists one page of structured log messages produced by a\n\t * previously-submitted Luau execution task. Messages from multiple\n\t * server-side chunks are flattened into a single ordered array.\n\t * Uses idempotent retry semantics for both 429 and 5xx.\n\t *\n\t * @param parameters - The task ref and optional pagination controls\n\t * (`pageSize`, `pageToken`).\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link LogPage} or\n\t * the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tlistLogs(\n\t\tparameters: ListLogsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LogPage, OpenCloudError>>;\n\t/**\n\t * Polls `tasks.get` with `view=BASIC` on a configurable backoff schedule\n\t * until the task reaches a terminal state, the wall-clock budget is\n\t * exhausted, or the supplied `AbortSignal` fires. Returns the terminal\n\t * task on success.\n\t *\n\t * @param ref - Reference to the task to poll, typically returned by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask},\n\t * or an error if aborted, timed out, or the transport fails.\n\t */\n\tpollUntilDone(\n\t\tref: LuauExecutionTaskRef,\n\t\toptions?: PollUntilDoneOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script and polls `tasks.get` with `view=BASIC` until\n\t * the task reaches a terminal state, the wall-clock budget is\n\t * exhausted, or the supplied `AbortSignal` fires. Combines `submit`\n\t * and `pollUntilDone` in one call.\n\t *\n\t * @param parameters - The same input accepted by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal\n\t * {@link LuauExecutionTask}, or an error if submit fails, the task\n\t * is aborted, timed out, or the transport fails.\n\t */\n\trunUntilDone(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: PollUntilDoneOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script for execution against a place. Dispatches\n\t * to the head-version URL when `versionId` is omitted, or to the\n\t * specific-version URL when one is supplied. Both URL shapes share\n\t * one rate-limit queue and one required-scope set.\n\t *\n\t * @param parameters - The universe and place identifiers, the\n\t * script to run, an optional `versionId`, and any other writable\n\t * submit fields.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tsubmit(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n}\n\n/**\n * Public client for the Roblox Open Cloud `LuauExecutionSessionTask`\n * resource. Tasks run a Luau script against a place and surface state,\n * output, or error through the `LuauExecutionTask` discriminated\n * union. Exposes `tasks.submit` for both the head version and a\n * specific place version, `tasks.get` for fetching task state,\n * `tasks.listLogs` for fetching structured log messages, and\n * `binaryInputs.create` for allocating presigned upload slots.\n */\nexport class LuauExecutionClient {\n\treadonly #inner: ResourceClient;\n\n\tpublic readonly binaryInputs: BinaryInputsHandle;\n\tpublic readonly tasks: TasksHandle;\n\n\t/**\n\t * Creates a new {@link LuauExecutionClient}. Configuration is frozen\n\t * on construction; per-request overrides are accepted on each\n\t * method.\n\t *\n\t * @param options - Client-level configuration including the API key.\n\t */\n\tconstructor(options: OpenCloudClientOptions) {\n\t\tthis.#inner = new ResourceClient(options);\n\t\tthis.binaryInputs = createBinaryInputsHandle(this.#inner);\n\t\tthis.tasks = createTasksHandle(this.#inner);\n\t}\n}\n\nfunction createBinaryInputsHandle(inner: ResourceClient): BinaryInputsHandle {\n\treturn {\n\t\tasync create(parameters, options) {\n\t\t\treturn inner.execute({ options, parameters, spec: CREATE_BINARY_INPUT_SPEC });\n\t\t},\n\t};\n}\n\nfunction createTasksHandle(inner: ResourceClient): TasksHandle {\n\treturn {\n\t\tasync get(parameters, options) {\n\t\t\treturn inner.execute({ options, parameters, spec: GET_SPEC });\n\t\t},\n\t\tasync listLogs(parameters, options) {\n\t\t\treturn inner.execute({ options, parameters, spec: LIST_LOGS_SPEC });\n\t\t},\n\t\tasync pollUntilDone(ref, options = {}) {\n\t\t\treturn pollUntilDoneCore(buildPollDeps(inner, { options, ref }), options);\n\t\t},\n\t\tasync runUntilDone(parameters, options = {}) {\n\t\t\treturn submitAndPoll(inner, { options, parameters });\n\t\t},\n\t\tasync submit(parameters, options) {\n\t\t\tif (\"versionId\" in parameters) {\n\t\t\t\treturn inner.execute({ options, parameters, spec: SUBMIT_VERSION_SPEC });\n\t\t\t}\n\n\t\t\treturn inner.execute({ options, parameters, spec: SUBMIT_HEAD_SPEC });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,8BACf,YACc;CACd,MAAM,EAAE,MAAM,eAAe;AAC7B,QAAO;EACN,MAAM,EAAE,MAAM;EACd,SAAS,EAAE,gBAAgB,oBAAoB;EAC/C,QAAQ;EACR,KAAK,uBAAuB,WAAW;EACvC;;;;;;;;ACVF,MAAa,yBAAyC,OAAO,OAAO;CACnE,cAVyB,IACC;CAU1B,cAAc;CACd,CAAC;;;;;;AAOF,MAAa,yBAAgD,OAAO,OAAO,CAC1E,8CACA,CAAC;;;ACjBF,MAAM,eAAe;AAErB,MAAM,oBAAoB;;;;;;;;;;AAW1B,SAAgB,yBACf,UACiD;CACjD,MAAM,EAAE,MAAM,QAAQ,eAAe;AAErC,KAAI,CAAC,SAAS,KAAK,CAClB,QAAO,UAAU,WAAW;AAG7B,KAAI,OAAO,KAAK,YAAY,YAAY,CAAC,aAAa,KAAK,KAAK,QAAQ,CACvE,QAAO,UAAU,WAAW;AAG7B,KAAI,OAAO,KAAK,iBAAiB,SAChC,QAAO,UAAU,WAAW;AAG7B,QAAO;EACN,MAAM;GAAE,MAAM,KAAK;GAAS,WAAW,KAAK;GAAc;EAC1D,SAAS;EACT;;AAGF,SAAS,UAAU,YAAoE;AACtF,QAAO;EAAE,KAAK,IAAI,SAAS,mBAAmB,EAAE,YAAY,CAAC;EAAE,SAAS;EAAO;;;;ACJhF,SAAS,SAAe,MAA0D;AACjF,QAAO,OAAO,OAAO,KAAK;;AAG3B,MAAM,2BAA2B,SAG/B;CACD,eAAe,eAAe,UAAU,8BAA8B,WAAW,CAAC;CAClF,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,OAAO;CACP,gBAAgB;CAChB,CAAC;;;;;;;;;;AAgIF,IAAa,sBAAb,MAAiC;CAChC;CAEA;CACA;;;;;;;;CASA,YAAY,SAAiC;AAC5C,QAAA,QAAc,IAAI,eAAe,QAAQ;AACzC,OAAK,eAAe,yBAAyB,MAAA,MAAY;AACzD,OAAK,QAAQ,kBAAkB,MAAA,MAAY;;;AAI7C,SAAS,yBAAyB,OAA2C;AAC5E,QAAO,EACN,MAAM,OAAO,YAAY,SAAS;AACjC,SAAO,MAAM,QAAQ;GAAE;GAAS;GAAY,MAAM;GAA0B,CAAC;IAE9E;;AAGF,SAAS,kBAAkB,OAAoC;AAC9D,QAAO;EACN,MAAM,IAAI,YAAY,SAAS;AAC9B,UAAO,MAAM,QAAQ;IAAE;IAAS;IAAY,MAAM;IAAU,CAAC;;EAE9D,MAAM,SAAS,YAAY,SAAS;AACnC,UAAO,MAAM,QAAQ;IAAE;IAAS;IAAY,MAAM;IAAgB,CAAC;;EAEpE,MAAM,cAAc,KAAK,UAAU,EAAE,EAAE;AACtC,UAAO,kBAAkB,cAAc,OAAO;IAAE;IAAS;IAAK,CAAC,EAAE,QAAQ;;EAE1E,MAAM,aAAa,YAAY,UAAU,EAAE,EAAE;AAC5C,UAAO,cAAc,OAAO;IAAE;IAAS;IAAY,CAAC;;EAErD,MAAM,OAAO,YAAY,SAAS;AACjC,OAAI,eAAe,WAClB,QAAO,MAAM,QAAQ;IAAE;IAAS;IAAY,MAAM;IAAqB,CAAC;AAGzE,UAAO,MAAM,QAAQ;IAAE;IAAS;IAAY,MAAM;IAAkB,CAAC;;EAEtE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { r as ApiError } from "./rate-limit-D1q2Js-z.mjs";
|
|
2
|
+
//#region src/errors/permission-error.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when the Roblox Open Cloud API returns a 401 or 403 for an operation
|
|
5
|
+
* whose required scopes are known. Subclass of {@link ApiError} carrying the
|
|
6
|
+
* scope strings the caller's credential is missing plus the operation key, so
|
|
7
|
+
* a CLI consumer can tell the user exactly which scope to grant on their API
|
|
8
|
+
* key.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { PermissionError } from "@bedrock-rbx/ocale";
|
|
14
|
+
*
|
|
15
|
+
* const error = new PermissionError("HTTP 403", {
|
|
16
|
+
* operationKey: "developer-products.create",
|
|
17
|
+
* requiredScopes: ["creator-store-product:write"],
|
|
18
|
+
* statusCode: 403,
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* expect(error).toBeInstanceOf(PermissionError);
|
|
22
|
+
* expect(error.requiredScopes).toStrictEqual(["creator-store-product:write"]);
|
|
23
|
+
* expect(error.operationKey).toBe("developer-products.create");
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
var PermissionError = class extends ApiError {
|
|
27
|
+
name = "PermissionError";
|
|
28
|
+
operationKey;
|
|
29
|
+
requiredScopes;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new PermissionError.
|
|
32
|
+
*
|
|
33
|
+
* @param message - Human-readable error description.
|
|
34
|
+
* @param options - Error options including status code, the operation key,
|
|
35
|
+
* and the scopes the caller's credential must carry.
|
|
36
|
+
*/
|
|
37
|
+
constructor(message, options) {
|
|
38
|
+
super(message, options);
|
|
39
|
+
this.operationKey = options.operationKey;
|
|
40
|
+
this.requiredScopes = options.requiredScopes;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { PermissionError as t };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=permission-error-DOVtNq3A.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-error-DOVtNq3A.mjs","names":[],"sources":["../src/errors/permission-error.ts"],"sourcesContent":["import { ApiError, type ApiErrorOptions } from \"./api-error.ts\";\n\n/**\n * Options for constructing a {@link PermissionError}.\n */\nexport interface PermissionErrorOptions extends ApiErrorOptions {\n\t/**\n\t * Stable identifier of the Open Cloud operation that returned the\n\t * permission failure (matches `OperationLimit.operationKey`, e.g.\n\t * `\"developer-products.create\"`).\n\t */\n\toperationKey: string;\n\t/**\n\t * Scope strings the API key or OAuth token must carry for the failing\n\t * operation, sourced from the vendored OpenAPI schema's `x-roblox-scopes`\n\t * for that operationId.\n\t */\n\trequiredScopes: ReadonlyArray<string>;\n}\n\n/**\n * Thrown when the Roblox Open Cloud API returns a 401 or 403 for an operation\n * whose required scopes are known. Subclass of {@link ApiError} carrying the\n * scope strings the caller's credential is missing plus the operation key, so\n * a CLI consumer can tell the user exactly which scope to grant on their API\n * key.\n *\n * @example\n *\n * ```ts\n * import { PermissionError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new PermissionError(\"HTTP 403\", {\n * operationKey: \"developer-products.create\",\n * requiredScopes: [\"creator-store-product:write\"],\n * statusCode: 403,\n * });\n *\n * expect(error).toBeInstanceOf(PermissionError);\n * expect(error.requiredScopes).toStrictEqual([\"creator-store-product:write\"]);\n * expect(error.operationKey).toBe(\"developer-products.create\");\n * ```\n */\nexport class PermissionError extends ApiError {\n\tpublic override readonly name: string = \"PermissionError\";\n\tpublic readonly operationKey: string;\n\tpublic readonly requiredScopes: ReadonlyArray<string>;\n\n\t/**\n\t * Creates a new PermissionError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including status code, the operation key,\n\t * and the scopes the caller's credential must carry.\n\t */\n\tconstructor(message: string, options: PermissionErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.operationKey = options.operationKey;\n\t\tthis.requiredScopes = options.requiredScopes;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAa,kBAAb,cAAqC,SAAS;CAC7C,OAAwC;CACxC;CACA;;;;;;;;CASA,YAAY,SAAiB,SAAiC;AAC7D,QAAM,SAAS,QAAQ;AACvB,OAAK,eAAe,QAAQ;AAC5B,OAAK,iBAAiB,QAAQ"}
|
package/dist/places.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, s as RequestOptions } from "./types-
|
|
1
|
+
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, s as RequestOptions } from "./types-CwtZT1ek.mjs";
|
|
2
|
+
import { d as SubmitAtHeadParameters, f as SubmitAtVersionParameters, i as LogPage, l as LuauExecutionTask, n as ListLogsParameters, r as LogMessage, s as GetParameters, t as PollUntilDoneOptions, u as LuauExecutionTaskRef } from "./polling-BMrYajok.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/domains/cloud-v2/places/types.d.ts
|
|
4
5
|
/**
|
|
@@ -80,13 +81,90 @@ interface PlaceVersion {
|
|
|
80
81
|
//#endregion
|
|
81
82
|
//#region src/resources/places/client.d.ts
|
|
82
83
|
/**
|
|
84
|
+
* Operation Group exposed by {@link PlacesClient} as the
|
|
85
|
+
* `luauExecution` namespace. Provides `submit` to queue a Luau script,
|
|
86
|
+
* `get` to fetch a task's current state, and `listLogs` to retrieve
|
|
87
|
+
* structured log messages. Shares the same dispatch wiring as the
|
|
88
|
+
* top-level `LuauExecutionClient` exposed at
|
|
89
|
+
* `@bedrock-rbx/ocale/luau-execution`.
|
|
90
|
+
*/
|
|
91
|
+
interface LuauExecutionHandle {
|
|
92
|
+
/**
|
|
93
|
+
* Fetches the current state of a previously-submitted Luau
|
|
94
|
+
* execution task. Uses idempotent retry semantics for both 429 and
|
|
95
|
+
* 5xx.
|
|
96
|
+
*
|
|
97
|
+
* @param parameters - The task ref plus an optional `view` selector.
|
|
98
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
99
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
100
|
+
* @returns A {@link Result} wrapping the parsed
|
|
101
|
+
* {@link LuauExecutionTask} or the {@link OpenCloudError} that
|
|
102
|
+
* caused the request to fail.
|
|
103
|
+
*/
|
|
104
|
+
get(parameters: GetParameters, options?: RequestOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
|
|
105
|
+
/**
|
|
106
|
+
* Lists one page of structured log messages produced by a
|
|
107
|
+
* previously-submitted Luau execution task. Messages from multiple
|
|
108
|
+
* server-side chunks are flattened into a single ordered array.
|
|
109
|
+
* Uses idempotent retry semantics for both 429 and 5xx.
|
|
110
|
+
*
|
|
111
|
+
* @param parameters - The task ref and optional pagination controls
|
|
112
|
+
* (`pageSize`, `pageToken`).
|
|
113
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
114
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
115
|
+
* @returns A {@link Result} wrapping the parsed {@link LogPage} or
|
|
116
|
+
* the {@link OpenCloudError} that caused the request to fail.
|
|
117
|
+
*/
|
|
118
|
+
listLogs(parameters: ListLogsParameters, options?: RequestOptions): Promise<Result<LogPage, OpenCloudError>>;
|
|
119
|
+
/**
|
|
120
|
+
* Polls `get` with `view=BASIC` on a configurable backoff schedule until
|
|
121
|
+
* the task reaches a terminal state, the wall-clock budget is exhausted,
|
|
122
|
+
* or the supplied `AbortSignal` fires. Returns the terminal task on
|
|
123
|
+
* success.
|
|
124
|
+
*
|
|
125
|
+
* @param ref - Reference to the task to poll, typically returned by `submit`.
|
|
126
|
+
* @param options - Polling and per-request overrides.
|
|
127
|
+
* @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask},
|
|
128
|
+
* or an error if aborted, timed out, or the transport fails.
|
|
129
|
+
*/
|
|
130
|
+
pollUntilDone(ref: LuauExecutionTaskRef, options?: PollUntilDoneOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
|
|
131
|
+
/**
|
|
132
|
+
* Submits a Luau script and polls `get` with `view=BASIC` until the
|
|
133
|
+
* task reaches a terminal state, the wall-clock budget is exhausted,
|
|
134
|
+
* or the supplied `AbortSignal` fires. Combines `submit` and
|
|
135
|
+
* `pollUntilDone` in one call.
|
|
136
|
+
*
|
|
137
|
+
* @param parameters - The same input accepted by `submit`.
|
|
138
|
+
* @param options - Polling and per-request overrides.
|
|
139
|
+
* @returns A {@link Result} wrapping the terminal
|
|
140
|
+
* {@link LuauExecutionTask}, or an error if submit fails, the task
|
|
141
|
+
* is aborted, timed out, or the transport fails.
|
|
142
|
+
*/
|
|
143
|
+
runUntilDone(parameters: SubmitAtHeadParameters | SubmitAtVersionParameters, options?: PollUntilDoneOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
|
|
144
|
+
/**
|
|
145
|
+
* Submits a Luau script for execution against a place. Dispatches
|
|
146
|
+
* to the head-version URL when `versionId` is omitted, or to the
|
|
147
|
+
* specific-version URL when one is supplied. Both URL shapes share
|
|
148
|
+
* one rate-limit queue and one required-scope set.
|
|
149
|
+
*
|
|
150
|
+
* @param parameters - The universe and place identifiers, the
|
|
151
|
+
* script to run, an optional `versionId`, and any other writable
|
|
152
|
+
* submit fields.
|
|
153
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
154
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
155
|
+
* @returns A {@link Result} wrapping the parsed
|
|
156
|
+
* {@link LuauExecutionTask} or the {@link OpenCloudError} that
|
|
157
|
+
* caused the request to fail.
|
|
158
|
+
*/
|
|
159
|
+
submit(parameters: SubmitAtHeadParameters | SubmitAtVersionParameters, options?: RequestOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
83
162
|
* Public client for the Roblox Open Cloud `Place` resource. Covers
|
|
84
|
-
* place-version publishing (`publish`, `save`)
|
|
85
|
-
* updates (`update`)
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* ever escapes the client.
|
|
163
|
+
* place-version publishing (`publish`, `save`), place-configuration
|
|
164
|
+
* updates (`update`), and the Luau execution Operation Group
|
|
165
|
+
* (`luauExecution.submit`, `luauExecution.get`). Every method returns
|
|
166
|
+
* a {@link Result} so callers handle failure explicitly; no thrown
|
|
167
|
+
* {@link OpenCloudError} ever escapes the client.
|
|
90
168
|
*
|
|
91
169
|
* Publishing or saving a 5xx-failed place version is not retried
|
|
92
170
|
* automatically: Roblox does not support idempotency keys, so a retry
|
|
@@ -106,6 +184,7 @@ interface PlaceVersion {
|
|
|
106
184
|
*/
|
|
107
185
|
declare class PlacesClient {
|
|
108
186
|
#private;
|
|
187
|
+
readonly luauExecution: LuauExecutionHandle;
|
|
109
188
|
/**
|
|
110
189
|
* Creates a new {@link PlacesClient}. Configuration is frozen on
|
|
111
190
|
* construction; per-request overrides are accepted on each method.
|
|
@@ -157,5 +236,5 @@ declare class PlacesClient {
|
|
|
157
236
|
update(parameters: UpdatePlaceParameters, options?: RequestOptions): Promise<Result<Place, OpenCloudError>>;
|
|
158
237
|
}
|
|
159
238
|
//#endregion
|
|
160
|
-
export { type Place, type PlaceVersion, PlacesClient, type PublishParameters, type UpdatePlaceParameters };
|
|
239
|
+
export { type ListLogsParameters, type LogMessage, type LogPage, type LuauExecutionHandle, type Place, type PlaceVersion, PlacesClient, type PublishParameters, type UpdatePlaceParameters };
|
|
161
240
|
//# sourceMappingURL=places.d.mts.map
|
package/dist/places.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"places.d.mts","names":[],"sources":["../src/domains/cloud-v2/places/types.ts","../src/domains/universes/places/types.ts","../src/resources/places/client.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"places.d.mts","names":[],"sources":["../src/domains/cloud-v2/places/types.ts","../src/domains/universes/places/types.ts","../src/resources/places/client.ts"],"mappings":";;;;;;;;AAMA;;UAAiB,qBAAA;EAAA;EAAA,SAEP,WAAA;;WAEA,WAAA;;WAEA,OAAA;;WAEA,UAAA;EASV;EAAA,SAPU,UAAA;AAAA;;;;;UAOO,KAAA;;WAEP,EAAA;;WAEA,SAAA,EAAW,IAAA;;WAEX,WAAA;;WAEA,WAAA;EAUW;EAAA,SARX,IAAA;;WAEA,UAAA;EC7BV;EAAA,SD+BU,UAAA;;WAEA,uBAAA;;WAEA,SAAA,EAAW,IAAA;AAAA;;;;;;;AAnCrB;;UCAiB,iBAAA;EDAA;EAAA,SCEP,IAAA,EAAM,UAAA,CAAW,WAAA;;;;;;;WAOjB,MAAA;EDQO;EAAA,SCNP,OAAA;EDwBW;EAAA,SCtBX,UAAA;AAAA;;;;UAMO,YAAA;;;;;;WAMP,aAAA;AAAA;;;;;;;;;;ADRV;UEwBiB,mBAAA;;;;;;;;;;;;;EAahB,GAAA,CACC,UAAA,EAAY,aAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;;;;;;ADzDtC;;;;;;;;ECuEC,QAAA,CACC,UAAA,EAAY,kBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,OAAA,EAAS,cAAA;;;;ADvD5B;;;;;;;;ECmEC,aAAA,CACC,GAAA,EAAK,oBAAA,EACL,OAAA,GAAU,oBAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;EAhDrB;;;;;;;;;;;;EA6DhB,YAAA,CACC,UAAA,EAAY,sBAAA,GAAyB,yBAAA,EACrC,OAAA,GAAU,oBAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;;;;;;;;;;;;;;;;EAgBrC,MAAA,CACC,UAAA,EAAY,sBAAA,GAAyB,yBAAA,EACrC,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;cAqDzB,YAAA;EAAA;WAGI,aAAA,EAAe,mBAAA;;;;;;;EAQ/B,WAAA,CAAY,OAAA,EAAS,sBAAA;;;;;;;;;;;EAerB,OAAA,CACC,UAAA,EAAY,iBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,cAAA;;;;;;;;;;;AA7BjC;;;;EA+CC,IAAA,CACC,UAAA,EAAY,iBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,cAAA;;;;;;;;;;;;;;;;EAmBhC,MAAA,CACC,UAAA,EAAY,qBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,KAAA,EAAO,cAAA;AAAA"}
|