@bedrock-rbx/ocale 0.3.4-beta.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +9 -5
  2. package/dist/badge-cost-mismatch-DrlvhlQc.mjs +47 -0
  3. package/dist/badge-cost-mismatch-DrlvhlQc.mjs.map +1 -0
  4. package/dist/badges.d.mts +228 -184
  5. package/dist/badges.d.mts.map +1 -1
  6. package/dist/badges.mjs +176 -18
  7. package/dist/badges.mjs.map +1 -1
  8. package/dist/capacity-admission-hycCFkTo.d.mts +355 -0
  9. package/dist/capacity-admission-hycCFkTo.d.mts.map +1 -0
  10. package/dist/{data.generated-B2ceLfSn.d.mts → data.generated-D_vpa5-g.d.mts} +23 -23
  11. package/dist/data.generated-D_vpa5-g.d.mts.map +1 -0
  12. package/dist/developer-products.d.mts +181 -186
  13. package/dist/developer-products.d.mts.map +1 -1
  14. package/dist/developer-products.mjs +24 -24
  15. package/dist/developer-products.mjs.map +1 -1
  16. package/dist/game-passes.d.mts +206 -203
  17. package/dist/game-passes.d.mts.map +1 -1
  18. package/dist/game-passes.mjs +26 -21
  19. package/dist/game-passes.mjs.map +1 -1
  20. package/dist/index.d.mts +924 -306
  21. package/dist/index.d.mts.map +1 -1
  22. package/dist/index.mjs +325 -10
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/locales.d.mts +30 -2
  25. package/dist/locales.d.mts.map +1 -0
  26. package/dist/locales.mjs +24 -1
  27. package/dist/locales.mjs.map +1 -1
  28. package/dist/luau-execution.d.mts +154 -151
  29. package/dist/luau-execution.d.mts.map +1 -1
  30. package/dist/luau-execution.mjs +11 -8
  31. package/dist/luau-execution.mjs.map +1 -1
  32. package/dist/{network-error-DR9FX5hb.mjs → network-error-iVSng5MT.mjs} +44 -6
  33. package/dist/network-error-iVSng5MT.mjs.map +1 -0
  34. package/dist/places.d.mts +204 -180
  35. package/dist/places.d.mts.map +1 -1
  36. package/dist/places.mjs +66 -20
  37. package/dist/places.mjs.map +1 -1
  38. package/dist/{poll-timeout-3PXLsabj.mjs → poll-timeout-DzztDymd.mjs} +2 -2
  39. package/dist/{poll-timeout-3PXLsabj.mjs.map → poll-timeout-DzztDymd.mjs.map} +1 -1
  40. package/dist/{polling-helpers-sKTsqEc1.mjs → polling-helpers-DfF5dspc.mjs} +249 -83
  41. package/dist/polling-helpers-DfF5dspc.mjs.map +1 -0
  42. package/dist/{price-information-hWXV6DAI.mjs → price-information-DEkEQ8Pq.mjs} +2 -2
  43. package/dist/{price-information-hWXV6DAI.mjs.map → price-information-DEkEQ8Pq.mjs.map} +1 -1
  44. package/dist/resource-client-BCKukheG.d.mts +168 -0
  45. package/dist/resource-client-BCKukheG.d.mts.map +1 -0
  46. package/dist/resource-client-CaIVr-go.mjs +1419 -0
  47. package/dist/resource-client-CaIVr-go.mjs.map +1 -0
  48. package/dist/retry-C2oHesDx.d.mts +229 -0
  49. package/dist/retry-C2oHesDx.d.mts.map +1 -0
  50. package/dist/{retry-vpHMIwaU.mjs → retry-CMRDvAR4.mjs} +390 -20
  51. package/dist/retry-CMRDvAR4.mjs.map +1 -0
  52. package/dist/storage.d.mts +333 -334
  53. package/dist/storage.d.mts.map +1 -1
  54. package/dist/storage.mjs +29 -22
  55. package/dist/storage.mjs.map +1 -1
  56. package/dist/testing.d.mts +347 -360
  57. package/dist/testing.d.mts.map +1 -1
  58. package/dist/testing.mjs +3 -4
  59. package/dist/testing.mjs.map +1 -1
  60. package/dist/types-CdMr_J1M.d.mts +509 -0
  61. package/dist/types-CdMr_J1M.d.mts.map +1 -0
  62. package/dist/universes.d.mts +619 -422
  63. package/dist/universes.d.mts.map +1 -1
  64. package/dist/universes.mjs +421 -48
  65. package/dist/universes.mjs.map +1 -1
  66. package/dist/{validation-B_Zs1So2.mjs → validation-964VNlbp.mjs} +2 -2
  67. package/dist/{validation-B_Zs1So2.mjs.map → validation-964VNlbp.mjs.map} +1 -1
  68. package/dist/wire-DJqupefn.d.mts +41 -0
  69. package/dist/wire-DJqupefn.d.mts.map +1 -0
  70. package/package.json +14 -14
  71. package/dist/capacity-admission-BvnJjY0S.d.mts +0 -369
  72. package/dist/capacity-admission-BvnJjY0S.d.mts.map +0 -1
  73. package/dist/data.generated-B2ceLfSn.d.mts.map +0 -1
  74. package/dist/network-error-DR9FX5hb.mjs.map +0 -1
  75. package/dist/polling-helpers-sKTsqEc1.mjs.map +0 -1
  76. package/dist/resource-client-3cOhqZpX.mjs +0 -899
  77. package/dist/resource-client-3cOhqZpX.mjs.map +0 -1
  78. package/dist/resource-client-BivRq3JZ.d.mts +0 -164
  79. package/dist/resource-client-BivRq3JZ.d.mts.map +0 -1
  80. package/dist/retry-DXEklFrt.d.mts +0 -373
  81. package/dist/retry-DXEklFrt.d.mts.map +0 -1
  82. package/dist/retry-vpHMIwaU.mjs.map +0 -1
  83. package/dist/types-C3Egi37J.d.mts +0 -378
  84. package/dist/types-C3Egi37J.d.mts.map +0 -1
  85. package/dist/wire-D3K-a-UP.d.mts +0 -37
  86. package/dist/wire-D3K-a-UP.d.mts.map +0 -1
@@ -1,14 +1,13 @@
1
- import { f as Result, m as OpenCloudError, s as OpenCloudClientOptions, u as RequestOptions } from "./types-C3Egi37J.mjs";
2
- import { a as ListLogsParameters, c as CompleteTask, d as InProgressTask, f as LuauExecutionTask, h as SubmitAtVersionParameters, i as defaultPollDelay, l as FailedTask, m as SubmitAtHeadParameters, n as LuauExecutionSubmitOptions, o as LogMessage, p as LuauExecutionTaskRef, r as PollUntilDoneOptions, s as LogPage, t as LuauExecutionRunOptions, u as GetParameters } from "./capacity-admission-BvnJjY0S.mjs";
3
-
1
+ import { c as OpenCloudClientOptions, d as RequestOptions, g as OpenCloudError, m as Result } from "./types-CdMr_J1M.mjs";
2
+ import { a as ListLogsParameters, c as CompleteTask, d as InProgressTask, f as LuauExecutionTask, h as SubmitAtVersionParameters, i as defaultPollDelay, l as FailedTask, m as SubmitAtHeadParameters, n as LuauExecutionSubmitOptions, o as LogMessage, p as LuauExecutionTaskRef, r as PollUntilDoneOptions, s as LogPage, t as LuauExecutionRunOptions, u as GetParameters } from "./capacity-admission-hycCFkTo.mjs";
4
3
  //#region src/domains/cloud-v2/luau-execution-task-binary-inputs/types.d.ts
5
4
  /**
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
- * @since 0.1.0
11
- */
5
+ * Caller-supplied input for creating a Luau execution task binary input
6
+ * upload slot. The server returns a presigned `uploadUri` the caller uses
7
+ * to PUT the binary data.
8
+ *
9
+ * @since 0.1.0
10
+ */
12
11
  interface CreateBinaryInputParameters {
13
12
  /** Size in bytes of the binary data to be uploaded. */
14
13
  readonly size: number;
@@ -16,15 +15,15 @@ interface CreateBinaryInputParameters {
16
15
  readonly universeId: string;
17
16
  }
18
17
  /**
19
- * Public representation of a created Luau execution task binary input.
20
- * Pass `path` verbatim to `tasks.submit({ binaryInput })`.
21
- *
22
- * @since 0.1.0
23
- */
18
+ * Public representation of a created Luau execution task binary input.
19
+ * Pass `path` verbatim to `tasks.submit({ binaryInput })`.
20
+ *
21
+ * @since 0.1.0
22
+ */
24
23
  interface LuauExecutionTaskBinaryInput {
25
24
  /**
26
- * Server-emitted resource path; pass to `tasks.submit` as `binaryInput`.
27
- */
25
+ * Server-emitted resource path; pass to `tasks.submit` as `binaryInput`.
26
+ */
28
27
  readonly path: string;
29
28
  /** Presigned PUT target; perform the binary upload to this URI directly. */
30
29
  readonly uploadUri: string;
@@ -32,173 +31,177 @@ interface LuauExecutionTaskBinaryInput {
32
31
  //#endregion
33
32
  //#region src/resources/luau-execution/capacity-error.d.ts
34
33
  /**
35
- * A Luau task submission refused because validated tasks occupy the target
36
- * place's execution capacity.
37
- *
38
- * @example
39
- *
40
- * ```ts
41
- * import { LuauExecutionCapacityError } from "@bedrock-rbx/ocale/luau-execution";
42
- *
43
- * const error = new LuauExecutionCapacityError([{
44
- * placeId: "456",
45
- * sessionId: "11111111-1111-4111-8111-111111111111",
46
- * taskId: "22222222-2222-4222-8222-222222222222",
47
- * universeId: "123",
48
- * versionId: "789",
49
- * }]);
50
- * expect(error.blockers).toHaveLength(1);
51
- * ```
52
- *
53
- * @since 0.3.2
54
- */
55
- declare class LuauExecutionCapacityError extends OpenCloudError {
34
+ * A Luau task submission refused because validated tasks occupy the target
35
+ * place's execution capacity.
36
+ *
37
+ * @example
38
+ *
39
+ * ```ts
40
+ * import { LuauExecutionCapacityError } from "@bedrock-rbx/ocale/luau-execution";
41
+ *
42
+ * const error = new LuauExecutionCapacityError([{
43
+ * placeId: "456",
44
+ * sessionId: "11111111-1111-4111-8111-111111111111",
45
+ * taskId: "22222222-2222-4222-8222-222222222222",
46
+ * universeId: "123",
47
+ * versionId: "789",
48
+ * }]);
49
+ * expect(error.blockers).toHaveLength(1);
50
+ * ```
51
+ *
52
+ * @since 0.3.2
53
+ */
54
+ export declare class LuauExecutionCapacityError extends OpenCloudError {
56
55
  /** Validated task references reported as occupying the target place. */
57
56
  readonly blockers: ReadonlyArray<LuauExecutionTaskRef>;
58
57
  override readonly name = "LuauExecutionCapacityError";
59
58
  /**
60
- * Creates a capacity failure from validated blocker references.
61
- *
62
- * @param blockers - Tasks reported as occupying the submitted place.
63
- */
59
+ * Creates a capacity failure from validated blocker references.
60
+ *
61
+ * @param blockers - Tasks reported as occupying the submitted place.
62
+ */
64
63
  constructor(blockers: ReadonlyArray<LuauExecutionTaskRef>);
65
64
  }
66
65
  //#endregion
67
66
  //#region src/resources/luau-execution/client.d.ts
68
67
  /**
69
- * Operation handle for the `binaryInputs` namespace on
70
- * {@link LuauExecutionClient}. Provides `create` to allocate a presigned
71
- * upload slot for binary script inputs.
72
- *
73
- * @since 0.1.0
74
- */
68
+ * Operation handle for the `binaryInputs` namespace on
69
+ * {@link LuauExecutionClient}. Provides `create` to allocate a presigned
70
+ * upload slot for binary script inputs.
71
+ *
72
+ * @since 0.1.0
73
+ */
75
74
  interface BinaryInputsHandle {
76
75
  /**
77
- * Allocates a presigned binary input upload slot. The returned
78
- * `uploadUri` is a presigned `PUT` target; the caller uploads the
79
- * binary data directly and passes `path` to `tasks.submit` as
80
- * `binaryInput`.
81
- *
82
- * @param parameters - Universe identifier and the byte size of the
83
- * binary to upload.
84
- * @param options - Optional per-request overrides.
85
- * @returns A {@link Result} wrapping the parsed
86
- * {@link LuauExecutionTaskBinaryInput} or the {@link OpenCloudError}
87
- * that caused the request to fail.
88
- */
76
+ * Allocates a presigned binary input upload slot. The returned
77
+ * `uploadUri` is a presigned `PUT` target; the caller uploads the
78
+ * binary data directly and passes `path` to `tasks.submit` as
79
+ * `binaryInput`.
80
+ *
81
+ * @param parameters - Universe identifier and the byte size of the
82
+ * binary to upload.
83
+ * @param options - Optional per-request overrides.
84
+ * @returns A {@link Result} wrapping the parsed
85
+ * {@link LuauExecutionTaskBinaryInput} or the {@link OpenCloudError}
86
+ * that caused the request to fail.
87
+ */
89
88
  create(parameters: CreateBinaryInputParameters, options?: RequestOptions): Promise<Result<LuauExecutionTaskBinaryInput, OpenCloudError>>;
90
89
  }
91
90
  /**
92
- * Operation handle exposed by {@link LuauExecutionClient} as the
93
- * `tasks` namespace. Provides `submit` to queue a Luau script, `get`
94
- * to fetch a task's current state, and `listLogs` to retrieve
95
- * structured log messages produced by a task.
96
- *
97
- * @since 0.1.0
98
- */
91
+ * Operation handle exposed by {@link LuauExecutionClient} as the
92
+ * `tasks` namespace. Provides `submit` to queue a Luau script, `get`
93
+ * to fetch a task's current state, and `listLogs` to retrieve
94
+ * structured log messages produced by a task.
95
+ *
96
+ * @since 0.1.0
97
+ */
99
98
  interface TasksHandle {
100
99
  /**
101
- * Fetches the current state of a previously-submitted Luau
102
- * execution task. Uses idempotent retry semantics for both 429 and
103
- * 5xx.
104
- *
105
- * @param parameters - The task ref plus an optional `view` selector.
106
- * @param options - Optional per-request overrides (e.g. A different
107
- * {@link OpenCloudClientOptions.apiKey} for this call only).
108
- * @returns A {@link Result} wrapping the parsed
109
- * {@link LuauExecutionTask} or the {@link OpenCloudError} that
110
- * caused the request to fail.
111
- */
100
+ * Fetches the current state of a previously-submitted Luau
101
+ * execution task. Uses idempotent retry semantics for both 429 and
102
+ * 5xx.
103
+ *
104
+ * @param parameters - The task ref plus an optional `view` selector.
105
+ * @param options - Optional per-request overrides (e.g. A different
106
+ * {@link OpenCloudClientOptions.credential} for this call only).
107
+ * @returns A {@link Result} wrapping the parsed
108
+ * {@link LuauExecutionTask} or the {@link OpenCloudError} that
109
+ * caused the request to fail.
110
+ */
112
111
  get(parameters: GetParameters, options?: RequestOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
113
112
  /**
114
- * Lists one page of structured log messages produced by a
115
- * previously-submitted Luau execution task. Messages from multiple
116
- * server-side chunks are flattened into a single ordered array.
117
- * Uses idempotent retry semantics for both 429 and 5xx.
118
- *
119
- * @param parameters - The task ref and optional pagination controls
120
- * (`pageSize`, `pageToken`).
121
- * @param options - Optional per-request overrides (e.g. A different
122
- * {@link OpenCloudClientOptions.apiKey} for this call only).
123
- * @returns A {@link Result} wrapping the parsed {@link LogPage} or
124
- * the {@link OpenCloudError} that caused the request to fail.
125
- */
113
+ * Lists one page of structured log messages produced by a
114
+ * previously-submitted Luau execution task. Messages from multiple
115
+ * server-side chunks are flattened into a single ordered array.
116
+ * Uses idempotent retry semantics for both 429 and 5xx.
117
+ *
118
+ * @param parameters - The task ref and optional pagination controls
119
+ * (`pageSize`, `pageToken`).
120
+ * @param options - Optional per-request overrides (e.g. A different
121
+ * {@link OpenCloudClientOptions.credential} for this call only).
122
+ * @returns A {@link Result} wrapping the parsed {@link LogPage} or
123
+ * the {@link OpenCloudError} that caused the request to fail.
124
+ */
126
125
  listLogs(parameters: ListLogsParameters, options?: RequestOptions): Promise<Result<LogPage, OpenCloudError>>;
127
126
  /**
128
- * Polls `tasks.get` with `view=BASIC` on a configurable backoff schedule
129
- * until the task reaches a terminal state, the wall-clock budget is
130
- * exhausted, or the supplied `AbortSignal` fires. Returns the terminal
131
- * task on success.
132
- *
133
- * @param ref - Reference to the task to poll, typically returned by `submit`.
134
- * @param options - Polling and per-request overrides.
135
- * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask},
136
- * or an error if aborted, timed out, or the transport fails.
137
- */
127
+ * Polls `tasks.get` with `view=BASIC` on a configurable backoff schedule
128
+ * until the task reaches a terminal state, the wall-clock budget is
129
+ * exhausted, or the supplied `AbortSignal` fires. Returns the terminal
130
+ * task on success. The budget also bounds an in-flight
131
+ * request through its request deadline, so a hanging request ends with
132
+ * `PollTimeoutError` at the budget.
133
+ *
134
+ * @param ref - Reference to the task to poll, typically returned by `submit`.
135
+ * @param options - Polling and per-request overrides.
136
+ * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask},
137
+ * or an error if aborted, timed out, or the transport fails.
138
+ */
138
139
  pollUntilDone(ref: LuauExecutionTaskRef, options?: PollUntilDoneOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
139
140
  /**
140
- * Submits a Luau script and polls `tasks.get` with `view=BASIC` until
141
- * the task reaches a terminal state, the wall-clock budget is
142
- * exhausted, or the supplied `AbortSignal` fires. Combines `submit`
143
- * and `pollUntilDone` in one call.
144
- *
145
- * @param parameters - The same input accepted by `submit`.
146
- * @param options - Polling and per-request overrides.
147
- * @returns A {@link Result} wrapping the terminal
148
- * {@link LuauExecutionTask}, or an error if submit fails, the task
149
- * is aborted, timed out, or the transport fails.
150
- */
141
+ * Submits a Luau script and polls `tasks.get` with `view=BASIC` until
142
+ * the task reaches a terminal state, the wall-clock budget is
143
+ * exhausted, or the supplied `AbortSignal` fires. Combines `submit`
144
+ * and `pollUntilDone` in one call. The budget opens before the submit
145
+ * and covers it, and bounds each in-flight request through its request
146
+ * deadline.
147
+ *
148
+ * @param parameters - The same input accepted by `submit`.
149
+ * @param options - Polling and per-request overrides.
150
+ * @returns A {@link Result} wrapping the terminal
151
+ * {@link LuauExecutionTask}, or an error if submit fails, the task
152
+ * is aborted, timed out, or the transport fails.
153
+ */
151
154
  runUntilDone(parameters: SubmitAtHeadParameters | SubmitAtVersionParameters, options?: LuauExecutionRunOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
152
155
  /**
153
- * Submits a Luau script for execution against a place. Dispatches
154
- * to the head-version URL when `versionId` is omitted, or to the
155
- * specific-version URL when one is supplied. Both URL shapes share
156
- * one rate-limit queue and one required-scope set.
157
- *
158
- * @param parameters - The universe and place identifiers, the
159
- * script to run, an optional `versionId`, and any other writable
160
- * submit fields.
161
- * @param options - Optional per-request overrides (e.g. A different
162
- * {@link OpenCloudClientOptions.apiKey} for this call only).
163
- * @returns A {@link Result} wrapping the parsed
164
- * {@link LuauExecutionTask} or the {@link OpenCloudError} that
165
- * caused the request to fail.
166
- */
156
+ * Submits a Luau script for execution against a place. Dispatches
157
+ * to the head-version URL when `versionId` is omitted, or to the
158
+ * specific-version URL when one is supplied. Both URL shapes share
159
+ * one rate-limit queue and one required-scope set.
160
+ *
161
+ * @param parameters - The universe and place identifiers, the
162
+ * script to run, an optional `versionId`, and any other writable
163
+ * submit fields.
164
+ * @param options - Optional per-request overrides (e.g. A different
165
+ * {@link OpenCloudClientOptions.credential} for this call only).
166
+ * @returns A {@link Result} wrapping the parsed
167
+ * {@link LuauExecutionTask} or the {@link OpenCloudError} that
168
+ * caused the request to fail.
169
+ */
167
170
  submit(parameters: SubmitAtHeadParameters | SubmitAtVersionParameters, options?: LuauExecutionSubmitOptions): Promise<Result<LuauExecutionTask, OpenCloudError>>;
168
171
  }
169
172
  /**
170
- * Public client for the Roblox Open Cloud `LuauExecutionSessionTask`
171
- * resource. Tasks run a Luau script against a place and surface state,
172
- * output, or error through the `LuauExecutionTask` discriminated
173
- * union. Exposes `tasks.submit` for both the head version and a
174
- * specific place version, `tasks.get` for fetching task state,
175
- * `tasks.listLogs` for fetching structured log messages, and
176
- * `binaryInputs.create` for allocating presigned upload slots.
177
- *
178
- * @since 0.1.0
179
- *
180
- * @example
181
- *
182
- * ```ts
183
- * import { LuauExecutionClient } from "@bedrock-rbx/ocale/luau-execution";
184
- *
185
- * const client = new LuauExecutionClient({ apiKey: "your-key" });
186
- * expect(client).toBeInstanceOf(LuauExecutionClient);
187
- * ```
188
- */
189
- declare class LuauExecutionClient {
173
+ * Public client for the Roblox Open Cloud `LuauExecutionSessionTask`
174
+ * resource. Tasks run a Luau script against a place and surface state,
175
+ * output, or error through the `LuauExecutionTask` discriminated
176
+ * union. Exposes `tasks.submit` for both the head version and a
177
+ * specific place version, `tasks.get` for fetching task state,
178
+ * `tasks.listLogs` for fetching structured log messages, and
179
+ * `binaryInputs.create` for allocating presigned upload slots.
180
+ *
181
+ * @since 0.1.0
182
+ *
183
+ * @example
184
+ *
185
+ * ```ts
186
+ * import { LuauExecutionClient } from "@bedrock-rbx/ocale/luau-execution";
187
+ *
188
+ * const client = new LuauExecutionClient({ credential: { apiKey: "your-key", kind: "apiKey" } });
189
+ * expect(client).toBeInstanceOf(LuauExecutionClient);
190
+ * ```
191
+ */
192
+ export declare class LuauExecutionClient {
190
193
  #private;
191
194
  readonly binaryInputs: BinaryInputsHandle;
192
195
  readonly tasks: TasksHandle;
193
196
  /**
194
- * Creates a new {@link LuauExecutionClient}. Configuration is frozen
195
- * on construction; per-request overrides are accepted on each
196
- * method.
197
- *
198
- * @param options - Client-level configuration including the API key.
199
- */
197
+ * Creates a new {@link LuauExecutionClient}. Configuration is frozen
198
+ * on construction; per-request overrides are accepted on each
199
+ * method.
200
+ *
201
+ * @param options - Client-level configuration including the API key.
202
+ */
200
203
  constructor(options: OpenCloudClientOptions);
201
204
  }
202
205
  //#endregion
203
- export { type BinaryInputsHandle, type CompleteTask, type CreateBinaryInputParameters, type FailedTask, type GetParameters, type InProgressTask, type ListLogsParameters, type LogMessage, type LogPage, LuauExecutionCapacityError, LuauExecutionClient, type LuauExecutionRunOptions, type LuauExecutionSubmitOptions, type LuauExecutionTask, type LuauExecutionTaskBinaryInput, type LuauExecutionTaskRef, type PollUntilDoneOptions, type SubmitAtHeadParameters, type SubmitAtVersionParameters, type TasksHandle, defaultPollDelay };
206
+ export { type BinaryInputsHandle, type CompleteTask, type CreateBinaryInputParameters, type FailedTask, type GetParameters, type InProgressTask, type ListLogsParameters, type LogMessage, type LogPage, type LuauExecutionRunOptions, type LuauExecutionSubmitOptions, type LuauExecutionTask, type LuauExecutionTaskBinaryInput, type LuauExecutionTaskRef, type PollUntilDoneOptions, type SubmitAtHeadParameters, type SubmitAtVersionParameters, type TasksHandle, defaultPollDelay };
204
207
  //# sourceMappingURL=luau-execution.d.mts.map
@@ -1 +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/capacity-error.ts","../src/resources/luau-execution/client.ts"],"mappings":";;;;;;;;AAOA;;;UAAiB,2BAAA;EAIP;EAAA,SAFA,IAAA;EAWO;EAAA,SATP,UAAA;AAAA;AAeA;;;;ACKV;;ADLU,UANO,4BAAA;;;;WAIP,IAAA;;WAEA,SAAA;AAAA;;;;;AAnBV;;;;AAIU;AASV;;;;AAMU;;;;ACKV;;;;;;cAAa,0BAAA,SAAmC,cAAA;;WAE/B,QAAA,EAAU,aAAA,CAAc,oBAAA;EAAA,kBACf,IAAA;;;;;;EAOzB,WAAA,CAAY,QAAA,EAAU,aAAA,CAAc,oBAAA;AAAA;;;AD9B3B;AASV;;;;AAMU;;AAfA,UEwDO,kBAAA;;ADpCjB;;;;;;;;;;;;ECkDC,MAAA,CACC,UAAA,EAAY,2BAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,4BAAA,EAA8B,cAAA;AAAA;;;;;;;AD3CZ;;UCsDpB,WAAA;;AA5BjB;;;;;;;;;;;EAyCC,GAAA,CACC,UAAA,EAAY,aAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;;;;;;;;;;AA3BW;AAWjD;;;EA8BC,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,uBAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;;;;;;;;;;;;;;;;EAgBrC,MAAA,CACC,UAAA,EAAY,sBAAA,GAAyB,yBAAA,EACrC,OAAA,GAAU,0BAAA,GACR,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,cAAA;AAAA;;;;;;;;;;;;;;;;;;;;;cAuBzB,mBAAA;EAAA;WAGI,YAAA,EAAc,kBAAA;EAAA,SACd,KAAA,EAAO,WAAA;;;;;;;;EASvB,WAAA,CAAY,OAAA,EAAS,sBAAA;AAAA"}
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/capacity-error.ts","../src/resources/luau-execution/client.ts"],"mappings":";;;;;;;;;;UAOiB;;WAEP;;WAEA;;;;;;;;UASO;;;;WAIP;;WAEA;;;;;;;;;;;;;;;;;;;;;;;;;qBCKG,mCAAmC;;WAE/B,UAAU,cAAc;oBACf;;;;;;EAOzB,YAAY,UAAU,cAAc;;;;;;;;;;;UC0BpB;;;;;;;;;;;;;;EAchB,OACC,YAAY,6BACZ,UAAU,iBACR,QAAQ,OAAO,8BAA8B;;;;;;;;;;UAWhC;;;;;;;;;;;;;EAahB,IACC,YAAY,eACZ,UAAU,iBACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;EAcrC,SACC,YAAY,oBACZ,UAAU,iBACR,QAAQ,OAAO,SAAS;;;;;;;;;;;;;;EAc3B,cACC,KAAK,sBACL,UAAU,uBACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;;EAerC,aACC,YAAY,yBAAyB,2BACrC,UAAU,0BACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;;;EAgBrC,OACC,YAAY,yBAAyB,2BACrC,UAAU,6BACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;;;;;;;;;qBAuBzB;;WAGI,cAAc;WACd,OAAO;;;;;;;;EASvB,YAAY,SAAS"}
@@ -1,7 +1,6 @@
1
- import { a as ApiError } from "./network-error-DR9FX5hb.mjs";
2
- import { t as CREATE_METHOD_DEFAULTS } from "./retry-vpHMIwaU.mjs";
3
- import { n as okRequest, o as toJsonDetails, s as isRecord, t as ResourceClient } from "./resource-client-3cOhqZpX.mjs";
4
- import { a as pollUntilDoneCoreAsync, c as LIST_LOGS_SPEC, i as defaultPollDelay, l as LuauExecutionCapacityError, n as submitAndPollAsync, o as withBudgetRequestTimeout, r as submitWithCapacityAsync, s as GET_SPEC, t as buildPollDependencies } from "./polling-helpers-sKTsqEc1.mjs";
1
+ import { j as isRecord, m as UnexpectedResponseError, t as CREATE_METHOD_DEFAULTS } from "./retry-CMRDvAR4.mjs";
2
+ import { n as okRequest, s as toJsonDetails, t as ResourceClient } from "./resource-client-CaIVr-go.mjs";
3
+ import { a as pollUntilDoneCoreAsync, c as LIST_LOGS_SPEC, i as defaultPollDelay, l as LuauExecutionCapacityError, n as submitAndPollAsync, o as withBudgetRequestTimeout, r as submitWithCapacityAsync, s as GET_SPEC, t as buildPollDependencies } from "./polling-helpers-DfF5dspc.mjs";
5
4
  //#region src/domains/cloud-v2/luau-execution-task-binary-inputs/builders.ts
6
5
  /**
7
6
  * Builds a `POST` request for the Open Cloud
@@ -53,7 +52,8 @@ const MALFORMED_MESSAGE = "Malformed luau-execution-session-task-binary-input re
53
52
  *
54
53
  * @param response - The full {@link HttpResponse} from the Open Cloud API.
55
54
  * @returns A success result wrapping the parsed binary input, or an
56
- * {@link ApiError} when the body does not match the expected shape.
55
+ * {@link UnexpectedResponseError} when the body does not match the expected
56
+ * shape.
57
57
  */
58
58
  function parseBinaryInputResponse({ body, status: statusCode }) {
59
59
  if (!isRecord(body)) return malformed(statusCode, body);
@@ -69,7 +69,7 @@ function parseBinaryInputResponse({ body, status: statusCode }) {
69
69
  }
70
70
  function malformed(statusCode, body) {
71
71
  return {
72
- err: new ApiError(MALFORMED_MESSAGE, {
72
+ err: new UnexpectedResponseError(MALFORMED_MESSAGE, {
73
73
  details: toJsonDetails(body),
74
74
  statusCode
75
75
  }),
@@ -79,7 +79,10 @@ function malformed(statusCode, body) {
79
79
  //#endregion
80
80
  //#region src/resources/luau-execution/client.ts
81
81
  function makeSpec(spec) {
82
- return Object.freeze(spec);
82
+ return Object.freeze({
83
+ ...spec,
84
+ apiKeyOnly: true
85
+ });
83
86
  }
84
87
  const CREATE_BINARY_INPUT_SPEC = makeSpec({
85
88
  buildRequest: (parameters) => okRequest(buildCreateBinaryInputRequest(parameters)),
@@ -105,7 +108,7 @@ const CREATE_BINARY_INPUT_SPEC = makeSpec({
105
108
  * ```ts
106
109
  * import { LuauExecutionClient } from "@bedrock-rbx/ocale/luau-execution";
107
110
  *
108
- * const client = new LuauExecutionClient({ apiKey: "your-key" });
111
+ * const client = new LuauExecutionClient({ credential: { apiKey: "your-key", kind: "apiKey" } });
109
112
  * expect(client).toBeInstanceOf(LuauExecutionClient);
110
113
  * ```
111
114
  */
@@ -1 +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\tsize,\n\tuniverseId,\n}: CreateBinaryInputParameters): HttpRequest {\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). The whole per-minute allowance is also\n * the burst, matching the server: a probe found the sixth create within\n * one minute is the first to draw a 429.\n */\nexport const CREATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: CREATE_PER_MINUTE,\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 { toJsonDetails } from \"../../../internal/utils/to-json-details.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\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<LuauExecutionTaskBinaryInput, ApiError> {\n\tif (!isRecord(body)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tif (typeof body[\"path\"] !== \"string\" || !PATH_PATTERN.test(body[\"path\"])) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tif (typeof body[\"uploadUri\"] !== \"string\") {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\treturn {\n\t\tdata: { path: body[\"path\"], uploadUri: body[\"uploadUri\"] },\n\t\tsuccess: true,\n\t};\n}\n\nfunction malformed(\n\tstatusCode: number,\n\tbody: unknown,\n): Result<LuauExecutionTaskBinaryInput, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\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 { GET_SPEC } from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport 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 {\n\ttype LuauExecutionRunOptions,\n\ttype LuauExecutionSubmitOptions,\n\tsubmitWithCapacityAsync,\n} from \"./capacity-admission.ts\";\nimport { buildPollDependencies, submitAndPollAsync } from \"./polling-helpers.ts\";\nimport {\n\tpollUntilDoneCoreAsync,\n\ttype PollUntilDoneOptions,\n\twithBudgetRequestTimeout,\n} 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 *\n * @since 0.1.0\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 *\n * @since 0.1.0\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?: LuauExecutionRunOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script for execution against a place. Dispatches\n\t * to the head-version URL when `versionId` is omitted, or to the\n\t * specific-version URL when one is supplied. Both URL shapes share\n\t * one rate-limit queue and one required-scope set.\n\t *\n\t * @param parameters - The universe and place identifiers, the\n\t * script to run, an optional `versionId`, and any other writable\n\t * submit fields.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.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?: LuauExecutionSubmitOptions,\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 *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { LuauExecutionClient } from \"@bedrock-rbx/ocale/luau-execution\";\n *\n * const client = new LuauExecutionClient({ apiKey: \"your-key\" });\n * expect(client).toBeInstanceOf(LuauExecutionClient);\n * ```\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.executeAsync({ 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.executeAsync({ options, parameters, spec: GET_SPEC });\n\t\t},\n\t\tasync listLogs(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: LIST_LOGS_SPEC });\n\t\t},\n\t\tasync pollUntilDone(ref, options = {}) {\n\t\t\tconst resolved = withBudgetRequestTimeout(options);\n\t\t\treturn pollUntilDoneCoreAsync(\n\t\t\t\tbuildPollDependencies(inner, { options: resolved, ref }),\n\t\t\t\tresolved,\n\t\t\t);\n\t\t},\n\t\tasync runUntilDone(parameters, options = {}) {\n\t\t\treturn submitAndPollAsync(inner, {\n\t\t\t\toptions: withBudgetRequestTimeout(options),\n\t\t\t\tparameters,\n\t\t\t});\n\t\t},\n\t\tasync submit(parameters, options) {\n\t\t\treturn submitWithCapacityAsync({ inner, options, parameters });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,SAAgB,8BAA8B,EAC7C,MACA,cAC4C;CAC5C,OAAO;EACN,MAAM,EAAE,KAAK;EACb,SAAS,EAAE,gBAAgB,mBAAmB;EAC9C,QAAQ;EACR,KAAK,uBAAuB,WAAW;CACxC;AACD;;;ACpBA,MAAM,oBAAoB;;;;;;;;;AAW1B,MAAa,yBAAyC,OAAO,OAAO;CACnE,eAAe;CACf,cAAc,oBAAoB;CAClC,cAAc;AACf,CAAC;;;;;;AAOD,MAAa,yBAAgD,OAAO,OAAO,CAC1E,6CACD,CAAC;;;ACnBD,MAAM,eAAe;AAErB,MAAM,oBAAoB;;;;;;;;;;AAW1B,SAAgB,yBAAyB,EACxC,MACA,QAAQ,cACwD;CAChE,IAAI,CAAC,SAAS,IAAI,GACjB,OAAO,UAAU,YAAY,IAAI;CAGlC,IAAI,OAAO,KAAK,YAAY,YAAY,CAAC,aAAa,KAAK,KAAK,OAAO,GACtE,OAAO,UAAU,YAAY,IAAI;CAGlC,IAAI,OAAO,KAAK,iBAAiB,UAChC,OAAO,UAAU,YAAY,IAAI;CAGlC,OAAO;EACN,MAAM;GAAE,MAAM,KAAK;GAAS,WAAW,KAAK;EAAa;EACzD,SAAS;CACV;AACD;AAEA,SAAS,UACR,YACA,MACiD;CACjD,OAAO;EACN,KAAK,IAAI,SAAS,mBAAmB;GACpC,SAAS,cAAc,IAAI;GAC3B;EACD,CAAC;EACD,SAAS;CACV;AACD;;;ACTA,SAAS,SAAe,MAA0D;CACjF,OAAO,OAAO,OAAO,IAAI;AAC1B;AAEA,MAAM,2BAA2B,SAG/B;CACD,eAAe,eAAe,UAAU,8BAA8B,UAAU,CAAC;CACjF,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,OAAO;CACP,gBAAgB;AACjB,CAAC;;;;;;;;;;;;;;;;;;;;;AA+ID,IAAa,sBAAb,MAAiC;CAChC;CAEA;CACA;;;;;;;;CASA,YAAY,SAAiC;EAC5C,KAAKA,SAAS,IAAI,eAAe,OAAO;EACxC,KAAK,eAAe,yBAAyB,KAAKA,MAAM;EACxD,KAAK,QAAQ,kBAAkB,KAAKA,MAAM;CAC3C;AACD;AAEA,SAAS,yBAAyB,OAA2C;CAC5E,OAAO,EACN,MAAM,OAAO,YAAY,SAAS;EACjC,OAAO,MAAM,aAAa;GAAE;GAAS;GAAY,MAAM;EAAyB,CAAC;CAClF,EACD;AACD;AAEA,SAAS,kBAAkB,OAAoC;CAC9D,OAAO;EACN,MAAM,IAAI,YAAY,SAAS;GAC9B,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAAS,CAAC;EAClE;EACA,MAAM,SAAS,YAAY,SAAS;GACnC,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAAe,CAAC;EACxE;EACA,MAAM,cAAc,KAAK,UAAU,CAAC,GAAG;GACtC,MAAM,WAAW,yBAAyB,OAAO;GACjD,OAAO,uBACN,sBAAsB,OAAO;IAAE,SAAS;IAAU;GAAI,CAAC,GACvD,QACD;EACD;EACA,MAAM,aAAa,YAAY,UAAU,CAAC,GAAG;GAC5C,OAAO,mBAAmB,OAAO;IAChC,SAAS,yBAAyB,OAAO;IACzC;GACD,CAAC;EACF;EACA,MAAM,OAAO,YAAY,SAAS;GACjC,OAAO,wBAAwB;IAAE;IAAO;IAAS;GAAW,CAAC;EAC9D;CACD;AACD"}
1
+ {"version":3,"file":"luau-execution.mjs","names":[],"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\tsize,\n\tuniverseId,\n}: CreateBinaryInputParameters): HttpRequest {\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). The whole per-minute allowance is also\n * the burst, matching the server: a probe found the sixth create within\n * one minute is the first to draw a 429.\n */\nexport const CREATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: CREATE_PER_MINUTE,\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 { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { 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 UnexpectedResponseError} when the body does not match the expected\n * shape.\n */\nexport function parseBinaryInputResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<LuauExecutionTaskBinaryInput, UnexpectedResponseError> {\n\tif (!isRecord(body)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tif (typeof body[\"path\"] !== \"string\" || !PATH_PATTERN.test(body[\"path\"])) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tif (typeof body[\"uploadUri\"] !== \"string\") {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\treturn {\n\t\tdata: { path: body[\"path\"], uploadUri: body[\"uploadUri\"] },\n\t\tsuccess: true,\n\t};\n}\n\nfunction malformed(\n\tstatusCode: number,\n\tbody: unknown,\n): Result<LuauExecutionTaskBinaryInput, UnexpectedResponseError> {\n\treturn {\n\t\terr: new UnexpectedResponseError(MALFORMED_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\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 { GET_SPEC } from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport 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 {\n\ttype LuauExecutionRunOptions,\n\ttype LuauExecutionSubmitOptions,\n\tsubmitWithCapacityAsync,\n} from \"./capacity-admission.ts\";\nimport { buildPollDependencies, submitAndPollAsync } from \"./polling-helpers.ts\";\nimport {\n\tpollUntilDoneCoreAsync,\n\ttype PollUntilDoneOptions,\n\twithBudgetRequestTimeout,\n} from \"./polling.ts\";\n\nfunction makeSpec<P, R>(spec: ResourceMethodSpec<P, R>): ResourceMethodSpec<P, R> {\n\treturn Object.freeze({ ...spec, apiKeyOnly: true });\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 *\n * @since 0.1.0\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 *\n * @since 0.1.0\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.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tget(\n\t\tparameters: GetParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Lists one page of structured log messages produced by a\n\t * previously-submitted Luau execution task. Messages from multiple\n\t * server-side chunks are flattened into a single ordered array.\n\t * Uses idempotent retry semantics for both 429 and 5xx.\n\t *\n\t * @param parameters - The task ref and optional pagination controls\n\t * (`pageSize`, `pageToken`).\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link LogPage} or\n\t * the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tlistLogs(\n\t\tparameters: ListLogsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LogPage, OpenCloudError>>;\n\t/**\n\t * Polls `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. The budget also bounds an in-flight\n\t * request through its request deadline, so a hanging request ends with\n\t * `PollTimeoutError` at the budget.\n\t *\n\t * @param ref - Reference to the task to poll, typically returned by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask},\n\t * or an error if aborted, timed out, or the transport fails.\n\t */\n\tpollUntilDone(\n\t\tref: LuauExecutionTaskRef,\n\t\toptions?: PollUntilDoneOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script and polls `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. The budget opens before the submit\n\t * and covers it, and bounds each in-flight request through its request\n\t * deadline.\n\t *\n\t * @param parameters - The same input accepted by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal\n\t * {@link LuauExecutionTask}, or an error if submit fails, the task\n\t * is aborted, timed out, or the transport fails.\n\t */\n\trunUntilDone(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: LuauExecutionRunOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script for execution against a place. Dispatches\n\t * to the head-version URL when `versionId` is omitted, or to the\n\t * specific-version URL when one is supplied. Both URL shapes share\n\t * one rate-limit queue and one required-scope set.\n\t *\n\t * @param parameters - The universe and place identifiers, the\n\t * script to run, an optional `versionId`, and any other writable\n\t * submit fields.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tsubmit(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: LuauExecutionSubmitOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n}\n\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 *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { LuauExecutionClient } from \"@bedrock-rbx/ocale/luau-execution\";\n *\n * const client = new LuauExecutionClient({ credential: { apiKey: \"your-key\", kind: \"apiKey\" } });\n * expect(client).toBeInstanceOf(LuauExecutionClient);\n * ```\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.executeAsync({ 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.executeAsync({ options, parameters, spec: GET_SPEC });\n\t\t},\n\t\tasync listLogs(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: LIST_LOGS_SPEC });\n\t\t},\n\t\tasync pollUntilDone(ref, options = {}) {\n\t\t\tconst resolved = withBudgetRequestTimeout(options);\n\t\t\treturn pollUntilDoneCoreAsync(\n\t\t\t\tbuildPollDependencies(inner, { options: resolved, ref }),\n\t\t\t\tresolved,\n\t\t\t);\n\t\t},\n\t\tasync runUntilDone(parameters, options = {}) {\n\t\t\treturn submitAndPollAsync(inner, {\n\t\t\t\toptions: withBudgetRequestTimeout(options),\n\t\t\t\tparameters,\n\t\t\t});\n\t\t},\n\t\tasync submit(parameters, options) {\n\t\t\treturn submitWithCapacityAsync({ inner, options, parameters });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,8BAA8B,EAC7C,MACA,cAC4C;CAC5C,OAAO;EACN,MAAM,EAAE,KAAK;EACb,SAAS,EAAE,gBAAgB,mBAAmB;EAC9C,QAAQ;EACR,KAAK,uBAAuB,WAAW;CACxC;AACD;;;ACpBA,MAAM,oBAAoB;;;;;;;;;AAW1B,MAAa,yBAAyC,OAAO,OAAO;CACnE,eAAe;CACf,cAAc,oBAAoB;CAClC,cAAc;AACf,CAAC;;;;;;AAOD,MAAa,yBAAgD,OAAO,OAAO,CAC1E,6CACD,CAAC;;;ACnBD,MAAM,eAAe;AAErB,MAAM,oBAAoB;;;;;;;;;;;AAY1B,SAAgB,yBAAyB,EACxC,MACA,QAAQ,cACuE;CAC/E,IAAI,CAAC,SAAS,IAAI,GACjB,OAAO,UAAU,YAAY,IAAI;CAGlC,IAAI,OAAO,KAAK,YAAY,YAAY,CAAC,aAAa,KAAK,KAAK,OAAO,GACtE,OAAO,UAAU,YAAY,IAAI;CAGlC,IAAI,OAAO,KAAK,iBAAiB,UAChC,OAAO,UAAU,YAAY,IAAI;CAGlC,OAAO;EACN,MAAM;GAAE,MAAM,KAAK;GAAS,WAAW,KAAK;EAAa;EACzD,SAAS;CACV;AACD;AAEA,SAAS,UACR,YACA,MACgE;CAChE,OAAO;EACN,KAAK,IAAI,wBAAwB,mBAAmB;GACnD,SAAS,cAAc,IAAI;GAC3B;EACD,CAAC;EACD,SAAS;CACV;AACD;;;ACVA,SAAS,SAAe,MAA0D;CACjF,OAAO,OAAO,OAAO;EAAE,GAAG;EAAM,YAAY;CAAK,CAAC;AACnD;AAEA,MAAM,2BAA2B,SAG/B;CACD,eAAe,eAAe,UAAU,8BAA8B,UAAU,CAAC;CACjF,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,OAAO;CACP,gBAAgB;AACjB,CAAC;;;;;;;;;;;;;;;;;;;;;AAmJD,IAAa,sBAAb,MAAiC;CAChC;CAEA;CACA;;;;;;;;CASA,YAAY,SAAiC;EAC5C,KAAK,SAAS,IAAI,eAAe,OAAO;EACxC,KAAK,eAAe,yBAAyB,KAAK,MAAM;EACxD,KAAK,QAAQ,kBAAkB,KAAK,MAAM;CAC3C;AACD;AAEA,SAAS,yBAAyB,OAA2C;CAC5E,OAAO,EACN,MAAM,OAAO,YAAY,SAAS;EACjC,OAAO,MAAM,aAAa;GAAE;GAAS;GAAY,MAAM;EAAyB,CAAC;CAClF,EACD;AACD;AAEA,SAAS,kBAAkB,OAAoC;CAC9D,OAAO;EACN,MAAM,IAAI,YAAY,SAAS;GAC9B,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAAS,CAAC;EAClE;EACA,MAAM,SAAS,YAAY,SAAS;GACnC,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAAe,CAAC;EACxE;EACA,MAAM,cAAc,KAAK,UAAU,CAAC,GAAG;GACtC,MAAM,WAAW,yBAAyB,OAAO;GACjD,OAAO,uBACN,sBAAsB,OAAO;IAAE,SAAS;IAAU;GAAI,CAAC,GACvD,QACD;EACD;EACA,MAAM,aAAa,YAAY,UAAU,CAAC,GAAG;GAC5C,OAAO,mBAAmB,OAAO;IAChC,SAAS,yBAAyB,OAAO;IACzC;GACD,CAAC;EACF;EACA,MAAM,OAAO,YAAY,SAAS;GACjC,OAAO,wBAAwB;IAAE;IAAO;IAAS;GAAW,CAAC;EAC9D;CACD;AACD"}
@@ -1,4 +1,6 @@
1
1
  //#region src/errors/base.ts
2
+ const NO_PREVIOUS_ATTEMPTS = Object.freeze([]);
3
+ const PREVIOUS_ATTEMPTS = /* @__PURE__ */ new WeakMap();
2
4
  /**
3
5
  * Base error class for all Open Cloud SDK errors.
4
6
  *
@@ -42,7 +44,31 @@ var OpenCloudError = class extends Error {
42
44
  super(message, options);
43
45
  this.code = options?.code;
44
46
  }
47
+ /**
48
+ * Failures of the earlier attempts of the same logical request, oldest
49
+ * first. A failure that is this error's own `cause` is not repeated here.
50
+ * Empty when the request was not retried.
51
+ *
52
+ * @since 0.4.0
53
+ * @returns The earlier attempts' failures.
54
+ */
55
+ get previousAttempts() {
56
+ return PREVIOUS_ATTEMPTS.get(this) ?? NO_PREVIOUS_ATTEMPTS;
57
+ }
45
58
  };
59
+ /**
60
+ * Records the failures of the earlier attempts of the logical request that
61
+ * produced `error`, so they read back through
62
+ * {@link OpenCloudError.previousAttempts}.
63
+ *
64
+ * @param error - The failure the retry loop returns.
65
+ * @param attempts - Earlier attempt failures, oldest first.
66
+ * @returns The same error.
67
+ */
68
+ function recordPreviousAttempts(error, attempts) {
69
+ PREVIOUS_ATTEMPTS.set(error, Object.freeze([...attempts]));
70
+ return error;
71
+ }
46
72
  //#endregion
47
73
  //#region src/errors/api-error.ts
48
74
  /**
@@ -150,9 +176,11 @@ function requestContextOf(err) {
150
176
  /**
151
177
  * Thrown when the Roblox Open Cloud API returns a 429 Too Many Requests
152
178
  * response. Contains the server-suggested retry delay and safe,
153
- * machine-readable response evidence. Generic 429 evidence can be ambiguous:
154
- * no individual header, body code, or remaining-budget value guarantees the
155
- * upstream cause.
179
+ * machine-readable response evidence. The body code, remaining budget, and
180
+ * headers do not identify the upstream cause (for example quota vs place
181
+ * capacity). `source` names only the layer that refused the request;
182
+ * `"unknown"` means the response carried no positive evidence for either
183
+ * layer.
156
184
  *
157
185
  * @since 0.1.0
158
186
  *
@@ -169,19 +197,22 @@ function requestContextOf(err) {
169
197
  * "x-ratelimit-limit": "5, 5;w=60, 5;w=60",
170
198
  * },
171
199
  * retryAfterSeconds: 1856,
200
+ * source: "service",
172
201
  * });
173
202
  *
174
- * // Inspect the available evidence without assuming it identifies the cause.
203
+ * // `source` is a classification; the raw evidence stays available.
175
204
  * const evidence = {
176
205
  * code: error.code,
177
206
  * limit: error.responseHeaders?.["x-ratelimit-limit"],
178
207
  * retryAfter: error.responseHeaders?.["retry-after"],
208
+ * source: error.source,
179
209
  * };
180
210
  *
181
211
  * expect(evidence).toEqual({
182
212
  * code: "RESOURCE_EXHAUSTED",
183
213
  * limit: "5, 5;w=60, 5;w=60",
184
214
  * retryAfter: "1856",
215
+ * source: "service",
185
216
  * });
186
217
  * ```
187
218
  */
@@ -199,6 +230,12 @@ var RateLimitError = class extends OpenCloudError {
199
230
  /** Allowlisted raw response headers, or `undefined` if not set. */
200
231
  responseHeaders;
201
232
  retryAfterSeconds;
233
+ /**
234
+ * Which layer refused the request, or `"unknown"` without evidence.
235
+ *
236
+ * @since 0.4.0
237
+ */
238
+ source;
202
239
  /** HTTP status code that produced the error, or `undefined` if not set. */
203
240
  statusCode;
204
241
  /**
@@ -214,6 +251,7 @@ var RateLimitError = class extends OpenCloudError {
214
251
  this.responseHeaders = options.responseHeaders;
215
252
  this.details = options.details;
216
253
  this.statusCode = options.statusCode;
254
+ this.source = options.source ?? "unknown";
217
255
  }
218
256
  };
219
257
  const GUIDED_ERRORS = /* @__PURE__ */ new WeakSet();
@@ -265,6 +303,6 @@ var NetworkError = class extends OpenCloudError {
265
303
  }
266
304
  };
267
305
  //#endregion
268
- export { ApiError as a, markServerRetryGuidance as i, RateLimitError as n, requestContextOf as o, hasServerRetryGuidance as r, OpenCloudError as s, NetworkError as t };
306
+ export { ApiError as a, recordPreviousAttempts as c, markServerRetryGuidance as i, RateLimitError as n, requestContextOf as o, hasServerRetryGuidance as r, OpenCloudError as s, NetworkError as t };
269
307
 
270
- //# sourceMappingURL=network-error-DR9FX5hb.mjs.map
308
+ //# sourceMappingURL=network-error-iVSng5MT.mjs.map