@bedrock-rbx/ocale 0.1.0-beta.2 → 0.1.0-beta.4
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 +2 -2
- package/dist/badges.mjs +4 -4
- package/dist/{data.generated-BtkDGH8C.d.mts → data.generated-DdwXMiv9.d.mts} +1 -1
- package/dist/{data.generated-BtkDGH8C.d.mts.map → data.generated-DdwXMiv9.d.mts.map} +1 -1
- package/dist/developer-products.d.mts +2 -2
- package/dist/developer-products.mjs +5 -5
- package/dist/game-passes.d.mts +2 -2
- package/dist/game-passes.mjs +5 -5
- package/dist/index.d.mts +92 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/{is-date-time-string-Cuf1TaSC.mjs → is-date-time-string-DL6l9mo6.mjs} +1 -1
- package/dist/{is-date-time-string-Cuf1TaSC.mjs.map → is-date-time-string-DL6l9mo6.mjs.map} +1 -1
- package/dist/locales.d.mts +1 -1
- package/dist/luau-execution.d.mts +93 -6
- package/dist/luau-execution.d.mts.map +1 -1
- package/dist/luau-execution.mjs +115 -3
- package/dist/luau-execution.mjs.map +1 -1
- package/dist/permission-error-DOVtNq3A.mjs +46 -0
- package/dist/permission-error-DOVtNq3A.mjs.map +1 -0
- package/dist/places.d.mts +46 -6
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +25 -61
- 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/{types-BZ0959rh.d.mts → polling-DDKKpz6Z.d.mts} +106 -2
- package/dist/polling-DDKKpz6Z.d.mts.map +1 -0
- package/dist/polling-helpers-DJqtcrCQ.mjs +636 -0
- package/dist/polling-helpers-DJqtcrCQ.mjs.map +1 -0
- package/dist/{price-information-s7DY0GV2.mjs → price-information-XyhlYrn8.mjs} +2 -2
- package/dist/{price-information-s7DY0GV2.mjs.map → price-information-XyhlYrn8.mjs.map} +1 -1
- package/dist/{rate-limit-DzHBFwps.d.mts → rate-limit-BHAddFXO.d.mts} +2 -2
- package/dist/{rate-limit-DzHBFwps.d.mts.map → rate-limit-BHAddFXO.d.mts.map} +1 -1
- package/dist/{rate-limit-CKfuhxT1.mjs → rate-limit-D1q2Js-z.mjs} +2 -44
- package/dist/rate-limit-D1q2Js-z.mjs.map +1 -0
- package/dist/{resource-client-Wi4Mwqy5.mjs → resource-client-D7HKNrOp.mjs} +12 -3
- package/dist/{resource-client-Wi4Mwqy5.mjs.map → resource-client-D7HKNrOp.mjs.map} +1 -1
- package/dist/signatures-9rpsTjPL.mjs +59 -0
- package/dist/signatures-9rpsTjPL.mjs.map +1 -0
- package/dist/storage.d.mts +7 -1
- package/dist/storage.d.mts.map +1 -1
- package/dist/storage.mjs +3 -3
- package/dist/testing.d.mts +497 -0
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +367 -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-Cp8w8uwA.d.mts → types-BOhSh9ug.d.mts} +1 -1
- package/dist/{types-Cp8w8uwA.d.mts.map → types-BOhSh9ug.d.mts.map} +1 -1
- package/dist/universes.d.mts +3 -8
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +5 -5
- package/dist/{validation-b7KAoEio.mjs → validation-DkL5KQqz.mjs} +2 -2
- package/dist/{validation-b7KAoEio.mjs.map → validation-DkL5KQqz.mjs.map} +1 -1
- package/dist/wire-BeIO-d1x.d.mts +35 -0
- package/dist/wire-BeIO-d1x.d.mts.map +1 -0
- package/package.json +3 -3
- package/dist/rate-limit-CKfuhxT1.mjs.map +0 -1
- package/dist/specs-Co6qYp_E.mjs +0 -309
- package/dist/specs-Co6qYp_E.mjs.map +0 -1
- package/dist/types-BZ0959rh.d.mts.map +0 -1
package/dist/testing.mjs
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { n as NetworkError, r as ApiError, t as RateLimitError } from "./rate-limit-D1q2Js-z.mjs";
|
|
2
|
+
import { n as RBXL_SIGNATURE, t as RBXLX_SIGNATURE } from "./signatures-9rpsTjPL.mjs";
|
|
3
|
+
//#region tests/helpers/badges.ts
|
|
4
|
+
/**
|
|
5
|
+
* Builds a minimally-valid {@link BadgeResponseV2Wire} body. Pass an
|
|
6
|
+
* `overrides` object to tweak individual fields while keeping everything
|
|
7
|
+
* else schema-compliant; useful for parser and integration tests that
|
|
8
|
+
* only care about one field at a time.
|
|
9
|
+
*
|
|
10
|
+
* @param overrides - Fields to override on the default body.
|
|
11
|
+
* @returns A valid wire body with the overrides applied.
|
|
12
|
+
*/
|
|
13
|
+
function validBadgeBody(overrides = {}) {
|
|
14
|
+
return {
|
|
15
|
+
id: 12345,
|
|
16
|
+
name: "First Goal",
|
|
17
|
+
awarder: {
|
|
18
|
+
id: 222,
|
|
19
|
+
name: "Lobby",
|
|
20
|
+
type: 1
|
|
21
|
+
},
|
|
22
|
+
created: "2024-01-15T10:30:00.000Z",
|
|
23
|
+
description: "Awarded on first login.",
|
|
24
|
+
displayDescription: "Awarded on first login.",
|
|
25
|
+
displayIconImageId: 67890,
|
|
26
|
+
displayName: "First Goal",
|
|
27
|
+
enabled: true,
|
|
28
|
+
iconImageId: 67890,
|
|
29
|
+
statistics: {
|
|
30
|
+
awardedCount: 100,
|
|
31
|
+
pastDayAwardedCount: 5,
|
|
32
|
+
winRatePercentage: 42.5
|
|
33
|
+
},
|
|
34
|
+
updated: "2024-03-20T14:45:00.000Z",
|
|
35
|
+
...overrides
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region tests/helpers/developer-products.ts
|
|
40
|
+
/**
|
|
41
|
+
* Builds a minimally-valid {@link DeveloperProductConfigV2} wire body. Pass
|
|
42
|
+
* an `overrides` object to tweak individual fields while keeping everything
|
|
43
|
+
* else schema-compliant; useful for parser and integration tests that
|
|
44
|
+
* only care about one field at a time.
|
|
45
|
+
*
|
|
46
|
+
* @param overrides - Fields to override on the default body.
|
|
47
|
+
* @returns A valid wire body with the overrides applied.
|
|
48
|
+
*/
|
|
49
|
+
function validDeveloperProductBody(overrides = {}) {
|
|
50
|
+
return {
|
|
51
|
+
name: "Gem Pack",
|
|
52
|
+
createdTimestamp: "2024-01-15T10:30:00.000Z",
|
|
53
|
+
description: "A premium gem pack",
|
|
54
|
+
iconImageAssetId: 67890,
|
|
55
|
+
isForSale: true,
|
|
56
|
+
isImmutable: false,
|
|
57
|
+
priceInformation: {
|
|
58
|
+
defaultPriceInRobux: 100,
|
|
59
|
+
enabledFeatures: []
|
|
60
|
+
},
|
|
61
|
+
productId: 12345,
|
|
62
|
+
storePageEnabled: true,
|
|
63
|
+
universeId: 999,
|
|
64
|
+
updatedTimestamp: "2024-03-20T14:45:00.000Z",
|
|
65
|
+
...overrides
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region tests/helpers/fake-http-client.ts
|
|
70
|
+
/**
|
|
71
|
+
* Thrown when {@link FakeHttpClient.request} is called but no mock has
|
|
72
|
+
* been queued. The message names the method, url, and consumed count to
|
|
73
|
+
* aid debugging of missing `.mockResponse`/`.mockError` setup.
|
|
74
|
+
*/
|
|
75
|
+
var FakeHttpClientError = class extends Error {
|
|
76
|
+
name = "FakeHttpClientError";
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Creates a fluent {@link FakeHttpClient} that sits at the
|
|
80
|
+
* {@link HttpClient} seam. Use for integration tests where you need to
|
|
81
|
+
* assert per-request config (apiKey, baseUrl) flows through to HTTP.
|
|
82
|
+
*
|
|
83
|
+
* @returns A fresh fake with an empty mock queue.
|
|
84
|
+
*/
|
|
85
|
+
function createFakeHttpClient() {
|
|
86
|
+
const state = {
|
|
87
|
+
captured: [],
|
|
88
|
+
consumed: 0,
|
|
89
|
+
queue: []
|
|
90
|
+
};
|
|
91
|
+
function enqueue(result) {
|
|
92
|
+
state.queue.push(result);
|
|
93
|
+
return fake;
|
|
94
|
+
}
|
|
95
|
+
const fake = {
|
|
96
|
+
mockApiError: (options) => enqueue(errorResult(buildApiError(options))),
|
|
97
|
+
mockError: (error) => enqueue(errorResult(error)),
|
|
98
|
+
mockNetworkError: (options) => enqueue(errorResult(buildNetworkError(options))),
|
|
99
|
+
mockRateLimit: (options) => enqueue(errorResult(buildRateLimitError(options))),
|
|
100
|
+
mockResponse: (options) => enqueue(successResult(options)),
|
|
101
|
+
get pendingMocks() {
|
|
102
|
+
return state.queue.length;
|
|
103
|
+
},
|
|
104
|
+
request: async (request, config) => handleRequest({
|
|
105
|
+
config,
|
|
106
|
+
request,
|
|
107
|
+
state
|
|
108
|
+
}),
|
|
109
|
+
get requests() {
|
|
110
|
+
return state.captured;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return fake;
|
|
114
|
+
}
|
|
115
|
+
function consumeNextMock(state, request) {
|
|
116
|
+
const next = state.queue.shift();
|
|
117
|
+
if (next === void 0) throw new FakeHttpClientError(`FakeHttpClient: no mock queued for ${request.method} ${request.url} (consumed ${String(state.consumed)}, pending 0)`);
|
|
118
|
+
state.consumed += 1;
|
|
119
|
+
return next;
|
|
120
|
+
}
|
|
121
|
+
async function handleRequest(options) {
|
|
122
|
+
const { config, request, state } = options;
|
|
123
|
+
state.captured.push({
|
|
124
|
+
config,
|
|
125
|
+
request
|
|
126
|
+
});
|
|
127
|
+
return consumeNextMock(state, request);
|
|
128
|
+
}
|
|
129
|
+
function successResult(options) {
|
|
130
|
+
return {
|
|
131
|
+
data: {
|
|
132
|
+
body: options.body ?? {},
|
|
133
|
+
headers: options.headers ?? {},
|
|
134
|
+
status: options.status
|
|
135
|
+
},
|
|
136
|
+
success: true
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function errorResult(err) {
|
|
140
|
+
return {
|
|
141
|
+
err,
|
|
142
|
+
success: false
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function buildApiError(options) {
|
|
146
|
+
const message = options.message ?? "API error";
|
|
147
|
+
if (options.code === void 0) return new ApiError(message, { statusCode: options.statusCode });
|
|
148
|
+
return new ApiError(message, {
|
|
149
|
+
code: options.code,
|
|
150
|
+
statusCode: options.statusCode
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function buildNetworkError(options) {
|
|
154
|
+
const message = options?.message ?? "Network error";
|
|
155
|
+
if (options?.cause === void 0) return new NetworkError(message);
|
|
156
|
+
return new NetworkError(message, { cause: options.cause });
|
|
157
|
+
}
|
|
158
|
+
function buildRateLimitError(options) {
|
|
159
|
+
return new RateLimitError(options.message ?? "Rate limited", { retryAfterSeconds: options.retryAfterSeconds });
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region tests/helpers/fake-send.ts
|
|
163
|
+
/**
|
|
164
|
+
* Creates a scripted fake for the `send` callback. Each call returns the
|
|
165
|
+
* next queued response; exhausting the queue throws, which surfaces test
|
|
166
|
+
* setup mistakes instead of silently repeating the last response.
|
|
167
|
+
*
|
|
168
|
+
* @param options - The scripted responses to replay, in order.
|
|
169
|
+
* @returns A `send` callback plus a `requests` log.
|
|
170
|
+
* @rejects {Error} When a call is made after all scripted responses are consumed.
|
|
171
|
+
*/
|
|
172
|
+
function createFakeSend(options) {
|
|
173
|
+
const requests = [];
|
|
174
|
+
let index = 0;
|
|
175
|
+
async function send(request) {
|
|
176
|
+
requests.push(request);
|
|
177
|
+
const response = options.responses[index];
|
|
178
|
+
index += 1;
|
|
179
|
+
if (response === void 0) throw new Error(`createFakeSend exhausted: ${String(index)} calls made, only ${String(options.responses.length)} responses scripted`);
|
|
180
|
+
return response;
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
requests,
|
|
184
|
+
send
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region tests/helpers/fake-sleep.ts
|
|
189
|
+
/**
|
|
190
|
+
* Creates a {@link FakeSleep} that resolves immediately and records every
|
|
191
|
+
* `ms` value it was called with.
|
|
192
|
+
*
|
|
193
|
+
* @returns A callable sleep function with a `waits` log attached.
|
|
194
|
+
*/
|
|
195
|
+
function createFakeSleep() {
|
|
196
|
+
const waits = [];
|
|
197
|
+
async function sleep(ms) {
|
|
198
|
+
waits.push(ms);
|
|
199
|
+
}
|
|
200
|
+
return Object.assign(sleep, { get waits() {
|
|
201
|
+
return waits;
|
|
202
|
+
} });
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region tests/helpers/game-icon.ts
|
|
206
|
+
/**
|
|
207
|
+
* Builds a minimally-valid {@link GetGameIconResponseWire} entry. Pass an
|
|
208
|
+
* `overrides` object to tweak individual fields while keeping everything
|
|
209
|
+
* else schema-compliant.
|
|
210
|
+
*
|
|
211
|
+
* @param overrides - Fields to override on the default entry.
|
|
212
|
+
* @returns A valid localized-icon entry with the overrides applied.
|
|
213
|
+
*/
|
|
214
|
+
function validLocalizedIcon(overrides = {}) {
|
|
215
|
+
return {
|
|
216
|
+
imageId: "12345",
|
|
217
|
+
imageUrl: "https://t1.rbxcdn.com/icon/12345",
|
|
218
|
+
languageCode: "en_us",
|
|
219
|
+
state: "Approved",
|
|
220
|
+
...overrides
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Builds a minimally-valid {@link GameIconListWire} body containing a single
|
|
225
|
+
* default localized icon.
|
|
226
|
+
*
|
|
227
|
+
* @param overrides - Fields to override on the default body.
|
|
228
|
+
* @returns A valid wire body with the overrides applied.
|
|
229
|
+
*/
|
|
230
|
+
function validIconListBody(overrides = {}) {
|
|
231
|
+
return {
|
|
232
|
+
data: [validLocalizedIcon()],
|
|
233
|
+
...overrides
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region tests/helpers/game-passes.ts
|
|
238
|
+
/**
|
|
239
|
+
* Builds a minimally-valid {@link GamePassConfigV2} wire body. Pass an
|
|
240
|
+
* `overrides` object to tweak individual fields while keeping everything
|
|
241
|
+
* else schema-compliant — useful for parser and integration tests that
|
|
242
|
+
* only care about one field at a time.
|
|
243
|
+
*
|
|
244
|
+
* @param overrides - Fields to override on the default body.
|
|
245
|
+
* @returns A valid wire body with the overrides applied.
|
|
246
|
+
*/
|
|
247
|
+
function validGamePassBody(overrides = {}) {
|
|
248
|
+
return {
|
|
249
|
+
name: "Epic Pass",
|
|
250
|
+
createdTimestamp: "2024-01-15T10:30:00.000Z",
|
|
251
|
+
description: "Unlocks epic stuff",
|
|
252
|
+
gamePassId: 12345,
|
|
253
|
+
iconAssetId: 67890,
|
|
254
|
+
isForSale: true,
|
|
255
|
+
priceInformation: {
|
|
256
|
+
defaultPriceInRobux: 100,
|
|
257
|
+
enabledFeatures: []
|
|
258
|
+
},
|
|
259
|
+
updatedTimestamp: "2024-03-20T14:45:00.000Z",
|
|
260
|
+
...overrides
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region tests/helpers/game-thumbnails.ts
|
|
265
|
+
/**
|
|
266
|
+
* Builds a minimally-valid {@link GameThumbnailUploadWire} body. Pass an
|
|
267
|
+
* `overrides` object to tweak individual fields while keeping everything
|
|
268
|
+
* else schema-compliant; useful for parser and integration tests that
|
|
269
|
+
* only care about one field at a time.
|
|
270
|
+
*
|
|
271
|
+
* @param overrides - Fields to override on the default body.
|
|
272
|
+
* @returns A valid wire body with the overrides applied.
|
|
273
|
+
*/
|
|
274
|
+
function validThumbnailUploadBody(overrides = {}) {
|
|
275
|
+
return {
|
|
276
|
+
mediaAssetId: "67890",
|
|
277
|
+
...overrides
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region tests/helpers/places.ts
|
|
282
|
+
/**
|
|
283
|
+
* Returns a fresh, minimal `.rbxl`-formatted body whose magic bytes
|
|
284
|
+
* match {@link RBXL_SIGNATURE}. Useful when integration tests don't
|
|
285
|
+
* care about the file's contents past the signature.
|
|
286
|
+
*
|
|
287
|
+
* @returns A 14-byte rbxl body matching the binary signature.
|
|
288
|
+
*/
|
|
289
|
+
function rbxlBody() {
|
|
290
|
+
return new Uint8Array(RBXL_SIGNATURE);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Returns a fresh, minimal `.rbxlx`-formatted body whose magic bytes
|
|
294
|
+
* match {@link RBXLX_SIGNATURE}. Useful when integration tests don't
|
|
295
|
+
* care about the file's contents past the signature.
|
|
296
|
+
*
|
|
297
|
+
* @returns An 8-byte rbxlx body matching the XML signature.
|
|
298
|
+
*/
|
|
299
|
+
function rbxlxBody() {
|
|
300
|
+
return new Uint8Array(RBXLX_SIGNATURE);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Builds a minimally-valid {@link PlaceVersionWire} body. Pass an
|
|
304
|
+
* `overrides` object to tweak fields without re-stating the defaults.
|
|
305
|
+
*
|
|
306
|
+
* @param overrides - Fields to override on the default body.
|
|
307
|
+
* @returns A valid wire body with the overrides applied.
|
|
308
|
+
*/
|
|
309
|
+
function validPublishResponseBody(overrides = {}) {
|
|
310
|
+
return {
|
|
311
|
+
versionNumber: 1,
|
|
312
|
+
...overrides
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Builds a minimally-valid {@link PlaceWire} body. Pass an `overrides`
|
|
317
|
+
* object to tweak fields without re-stating the defaults.
|
|
318
|
+
*
|
|
319
|
+
* @param overrides - Fields to override on the default body.
|
|
320
|
+
* @returns A valid wire body with the overrides applied.
|
|
321
|
+
*/
|
|
322
|
+
function validPlaceBody(overrides = {}) {
|
|
323
|
+
return {
|
|
324
|
+
createTime: "2024-01-15T10:30:00.000Z",
|
|
325
|
+
description: "A sample place.",
|
|
326
|
+
displayName: "Test Place",
|
|
327
|
+
path: "universes/123/places/456",
|
|
328
|
+
root: true,
|
|
329
|
+
serverSize: 30,
|
|
330
|
+
universeRuntimeCreation: false,
|
|
331
|
+
updateTime: "2024-11-02T17:08:21.500Z",
|
|
332
|
+
...overrides
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region tests/helpers/universes.ts
|
|
337
|
+
/**
|
|
338
|
+
* Builds a minimally-valid {@link UniverseWire} body. Pass an
|
|
339
|
+
* `overrides` object to tweak fields without re-stating the defaults.
|
|
340
|
+
*
|
|
341
|
+
* @param overrides - Fields to override on the default body.
|
|
342
|
+
* @returns A valid wire body with the overrides applied.
|
|
343
|
+
*/
|
|
344
|
+
function validUniverseBody(overrides = {}) {
|
|
345
|
+
return {
|
|
346
|
+
ageRating: "AGE_RATING_13_PLUS",
|
|
347
|
+
consoleEnabled: false,
|
|
348
|
+
createTime: "2024-01-15T10:30:00.000Z",
|
|
349
|
+
description: "A sample universe for tests.",
|
|
350
|
+
desktopEnabled: true,
|
|
351
|
+
displayName: "Test Universe",
|
|
352
|
+
mobileEnabled: true,
|
|
353
|
+
path: "universes/12345",
|
|
354
|
+
rootPlace: "universes/12345/places/98765",
|
|
355
|
+
tabletEnabled: true,
|
|
356
|
+
updateTime: "2024-11-02T17:08:21.500Z",
|
|
357
|
+
user: "users/7777",
|
|
358
|
+
visibility: "PUBLIC",
|
|
359
|
+
voiceChatEnabled: false,
|
|
360
|
+
vrEnabled: false,
|
|
361
|
+
...overrides
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
//#endregion
|
|
365
|
+
export { FakeHttpClientError, createFakeHttpClient, createFakeSend, createFakeSleep, rbxlBody, rbxlxBody, validBadgeBody, validDeveloperProductBody, validGamePassBody, validIconListBody, validLocalizedIcon, validPlaceBody, validPublishResponseBody, validThumbnailUploadBody, validUniverseBody };
|
|
366
|
+
|
|
367
|
+
//# sourceMappingURL=testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.mjs","names":[],"sources":["../tests/helpers/badges.ts","../tests/helpers/developer-products.ts","../tests/helpers/fake-http-client.ts","../tests/helpers/fake-send.ts","../tests/helpers/fake-sleep.ts","../tests/helpers/game-icon.ts","../tests/helpers/game-passes.ts","../tests/helpers/game-thumbnails.ts","../tests/helpers/places.ts","../tests/helpers/universes.ts"],"sourcesContent":["import type { BadgeResponseV2Wire } from \"#src/domains/badges/badges/wire\";\n\n/**\n * Builds a minimally-valid {@link BadgeResponseV2Wire} body. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant; useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validBadgeBody(overrides: Partial<BadgeResponseV2Wire> = {}): BadgeResponseV2Wire {\n\treturn {\n\t\tid: 12_345,\n\t\tname: \"First Goal\",\n\t\tawarder: { id: 222, name: \"Lobby\", type: 1 },\n\t\tcreated: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"Awarded on first login.\",\n\t\tdisplayDescription: \"Awarded on first login.\",\n\t\tdisplayIconImageId: 67_890,\n\t\tdisplayName: \"First Goal\",\n\t\tenabled: true,\n\t\ticonImageId: 67_890,\n\t\tstatistics: { awardedCount: 100, pastDayAwardedCount: 5, winRatePercentage: 42.5 },\n\t\tupdated: \"2024-03-20T14:45:00.000Z\",\n\t\t...overrides,\n\t};\n}\n","import type { DeveloperProductConfigV2 } from \"#src/domains/developer-products/products/wire\";\n\n/**\n * Builds a minimally-valid {@link DeveloperProductConfigV2} wire body. Pass\n * an `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant; useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validDeveloperProductBody(\n\toverrides: Partial<DeveloperProductConfigV2> = {},\n): DeveloperProductConfigV2 {\n\treturn {\n\t\tname: \"Gem Pack\",\n\t\tcreatedTimestamp: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"A premium gem pack\",\n\t\ticonImageAssetId: 67_890,\n\t\tisForSale: true,\n\t\tisImmutable: false,\n\t\tpriceInformation: { defaultPriceInRobux: 100, enabledFeatures: [] },\n\t\tproductId: 12_345,\n\t\tstorePageEnabled: true,\n\t\tuniverseId: 999,\n\t\tupdatedTimestamp: \"2024-03-20T14:45:00.000Z\",\n\t\t...overrides,\n\t};\n}\n","import { ApiError } from \"#src/errors/api-error\";\nimport type { OpenCloudError } from \"#src/errors/base\";\nimport { NetworkError } from \"#src/errors/network-error\";\nimport { RateLimitError } from \"#src/errors/rate-limit\";\nimport type {\n\tHttpClient,\n\tHttpRequest,\n\tHttpResponse,\n\tRequestConfig,\n} from \"#src/internal/http/types\";\nimport type { Result } from \"#src/types\";\n\n/**\n * A request captured by {@link FakeHttpClient} for later assertion.\n */\nexport interface CapturedRequest {\n\t/** The per-request config passed alongside the request. */\n\treadonly config: RequestConfig;\n\t/** The request passed to {@link HttpClient.request}. */\n\treadonly request: HttpRequest;\n}\n\n/**\n * A fluent fake for the {@link HttpClient} boundary. Mocks are queued in\n * FIFO order and consumed by each `request()` call. Records every\n * request and config for later assertion. Throws\n * {@link FakeHttpClientError} if the queue is empty when `request()` is\n * called — surfaces missing mocks as test setup bugs instead of silently\n * repeating the last response.\n */\nexport interface FakeHttpClient extends HttpClient {\n\t/** Queues an {@link ApiError} with the given status code and optional message/code. */\n\tmockApiError(options: { code?: string; message?: string; statusCode: number }): this;\n\t/** Queues an error Result with the given error instance. */\n\tmockError(error: OpenCloudError): this;\n\t/** Queues a {@link NetworkError}. Preserves `cause` when provided. */\n\tmockNetworkError(options?: { cause?: unknown; message?: string }): this;\n\t/** Queues a {@link RateLimitError} with the given retry hint. */\n\tmockRateLimit(options: { message?: string; retryAfterSeconds: number }): this;\n\t/** Queues a successful {@link HttpResponse}. Body defaults to `{}`; headers default to `{}`. */\n\tmockResponse(options: {\n\t\tbody?: unknown;\n\t\theaders?: Readonly<Record<string, string>>;\n\t\tstatus: number;\n\t}): this;\n\t/** Number of queued mocks that have not yet been consumed. */\n\treadonly pendingMocks: number;\n\t/** Chronological log of every `(request, config)` pair the fake received. */\n\treadonly requests: ReadonlyArray<CapturedRequest>;\n}\n\ntype ErrorResult = Result<HttpResponse, OpenCloudError> & { success: false };\n\ninterface FakeState {\n\treadonly captured: Array<CapturedRequest>;\n\tconsumed: number;\n\treadonly queue: Array<Result<HttpResponse, OpenCloudError>>;\n}\n\n/**\n * Thrown when {@link FakeHttpClient.request} is called but no mock has\n * been queued. The message names the method, url, and consumed count to\n * aid debugging of missing `.mockResponse`/`.mockError` setup.\n */\nexport class FakeHttpClientError extends Error {\n\tpublic override readonly name: string = \"FakeHttpClientError\";\n}\n\n/**\n * Creates a fluent {@link FakeHttpClient} that sits at the\n * {@link HttpClient} seam. Use for integration tests where you need to\n * assert per-request config (apiKey, baseUrl) flows through to HTTP.\n *\n * @returns A fresh fake with an empty mock queue.\n */\nexport function createFakeHttpClient(): FakeHttpClient {\n\tconst state: FakeState = { captured: [], consumed: 0, queue: [] };\n\tfunction enqueue(result: Result<HttpResponse, OpenCloudError>): FakeHttpClient {\n\t\tstate.queue.push(result);\n\t\treturn fake;\n\t}\n\n\tconst fake: FakeHttpClient = {\n\t\tmockApiError: (options) => enqueue(errorResult(buildApiError(options))),\n\t\tmockError: (error) => enqueue(errorResult(error)),\n\t\tmockNetworkError: (options) => enqueue(errorResult(buildNetworkError(options))),\n\t\tmockRateLimit: (options) => enqueue(errorResult(buildRateLimitError(options))),\n\t\tmockResponse: (options) => enqueue(successResult(options)),\n\t\tget pendingMocks() {\n\t\t\treturn state.queue.length;\n\t\t},\n\t\trequest: async (request, config) => handleRequest({ config, request, state }),\n\t\tget requests() {\n\t\t\treturn state.captured;\n\t\t},\n\t};\n\n\treturn fake;\n}\n\nfunction consumeNextMock(\n\tstate: FakeState,\n\trequest: HttpRequest,\n): Result<HttpResponse, OpenCloudError> {\n\tconst next = state.queue.shift();\n\tif (next === undefined) {\n\t\tthrow new FakeHttpClientError(\n\t\t\t`FakeHttpClient: no mock queued for ${request.method} ${request.url} (consumed ${String(state.consumed)}, pending 0)`,\n\t\t);\n\t}\n\n\tstate.consumed += 1;\n\treturn next;\n}\n\nasync function handleRequest(options: {\n\treadonly config: RequestConfig;\n\treadonly request: HttpRequest;\n\treadonly state: FakeState;\n}): Promise<Result<HttpResponse, OpenCloudError>> {\n\tconst { config, request, state } = options;\n\tstate.captured.push({ config, request });\n\treturn consumeNextMock(state, request);\n}\n\nfunction successResult(options: {\n\tbody?: unknown;\n\theaders?: Readonly<Record<string, string>>;\n\tstatus: number;\n}): Result<HttpResponse, OpenCloudError> {\n\treturn {\n\t\tdata: {\n\t\t\tbody: options.body ?? {},\n\t\t\theaders: options.headers ?? {},\n\t\t\tstatus: options.status,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction errorResult(err: OpenCloudError): ErrorResult {\n\treturn { err, success: false };\n}\n\nfunction buildApiError(options: { code?: string; message?: string; statusCode: number }): ApiError {\n\tconst message = options.message ?? \"API error\";\n\tif (options.code === undefined) {\n\t\treturn new ApiError(message, { statusCode: options.statusCode });\n\t}\n\n\treturn new ApiError(message, { code: options.code, statusCode: options.statusCode });\n}\n\nfunction buildNetworkError(\n\toptions: undefined | { cause?: unknown; message?: string },\n): NetworkError {\n\tconst message = options?.message ?? \"Network error\";\n\tif (options?.cause === undefined) {\n\t\treturn new NetworkError(message);\n\t}\n\n\treturn new NetworkError(message, { cause: options.cause });\n}\n\nfunction buildRateLimitError(options: {\n\tmessage?: string;\n\tretryAfterSeconds: number;\n}): RateLimitError {\n\treturn new RateLimitError(options.message ?? \"Rate limited\", {\n\t\tretryAfterSeconds: options.retryAfterSeconds,\n\t});\n}\n","import type { OpenCloudError } from \"#src/errors/base\";\nimport type { HttpRequest, HttpResponse } from \"#src/internal/http/types\";\nimport type { Result } from \"#src/types\";\n\n/**\n * The `send` callback shape consumed by `executeWithRetry`. A plain\n * transport function — no `RequestConfig`, no queueing, no retries.\n */\nexport type SendFunc = (request: HttpRequest) => Promise<Result<HttpResponse, OpenCloudError>>;\n\n/**\n * A scripted fake for the `send` callback. Replays responses in order\n * and records every request it receives.\n */\nexport interface FakeSend {\n\t/** Chronological log of every request the fake received. */\n\treadonly requests: ReadonlyArray<HttpRequest>;\n\t/** The scripted send callback. */\n\treadonly send: SendFunc;\n}\n\n/**\n * Creates a scripted fake for the `send` callback. Each call returns the\n * next queued response; exhausting the queue throws, which surfaces test\n * setup mistakes instead of silently repeating the last response.\n *\n * @param options - The scripted responses to replay, in order.\n * @returns A `send` callback plus a `requests` log.\n * @rejects {Error} When a call is made after all scripted responses are consumed.\n */\nexport function createFakeSend(options: {\n\treadonly responses: ReadonlyArray<Result<HttpResponse, OpenCloudError>>;\n}): FakeSend {\n\tconst requests: Array<HttpRequest> = [];\n\tlet index = 0;\n\n\tasync function send(request: HttpRequest): Promise<Result<HttpResponse, OpenCloudError>> {\n\t\trequests.push(request);\n\t\tconst response = options.responses[index];\n\t\tindex += 1;\n\n\t\tif (response === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`createFakeSend exhausted: ${String(index)} calls made, only ${String(options.responses.length)} responses scripted`,\n\t\t\t);\n\t\t}\n\n\t\treturn response;\n\t}\n\n\treturn { requests, send };\n}\n","import type { SleepFunc } from \"#src/internal/utils/sleep\";\n\n/**\n * A directly-callable sleep double that records its wait arguments without\n * delaying. Assignable to {@link SleepFunc}.\n */\nexport interface FakeSleep extends SleepFunc {\n\t/** Chronological log of every `ms` value the fake was called with. */\n\treadonly waits: ReadonlyArray<number>;\n}\n\n/**\n * Creates a {@link FakeSleep} that resolves immediately and records every\n * `ms` value it was called with.\n *\n * @returns A callable sleep function with a `waits` log attached.\n */\nexport function createFakeSleep(): FakeSleep {\n\tconst waits: Array<number> = [];\n\n\tasync function sleep(ms: number): Promise<void> {\n\t\twaits.push(ms);\n\t}\n\n\tconst fake: FakeSleep = Object.assign(sleep, {\n\t\tget waits(): ReadonlyArray<number> {\n\t\t\treturn waits;\n\t\t},\n\t});\n\n\treturn fake;\n}\n","import type {\n\tGameIconListWire,\n\tGetGameIconResponseWire,\n} from \"#src/domains/game-internationalization/game-icon/wire\";\n\n/**\n * Builds a minimally-valid {@link GetGameIconResponseWire} entry. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant.\n *\n * @param overrides - Fields to override on the default entry.\n * @returns A valid localized-icon entry with the overrides applied.\n */\nexport function validLocalizedIcon(\n\toverrides: Partial<GetGameIconResponseWire> = {},\n): GetGameIconResponseWire {\n\treturn {\n\t\timageId: \"12345\",\n\t\timageUrl: \"https://t1.rbxcdn.com/icon/12345\",\n\t\tlanguageCode: \"en_us\",\n\t\tstate: \"Approved\",\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid {@link GameIconListWire} body containing a single\n * default localized icon.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validIconListBody(overrides: Partial<GameIconListWire> = {}): GameIconListWire {\n\treturn {\n\t\tdata: [validLocalizedIcon()],\n\t\t...overrides,\n\t};\n}\n","import type { GamePassConfigV2 } from \"#src/domains/game-passes/game-passes/wire\";\n\n/**\n * Test-only wire shape for the list response. Mirrors the OpenAPI\n * schema, which marks `nextPageToken` as required and nullable, so\n * fixtures can carry the literal JSON `null` the API sends on the last\n * page without leaking `null` into the production wire type (which\n * exposes a post-normalization view of `string | undefined`).\n */\ninterface ListGamePassesWireBody {\n\treadonly gamePasses: ReadonlyArray<GamePassConfigV2>;\n\n\treadonly nextPageToken: null | string;\n}\n\n/**\n * Builds a minimally-valid {@link GamePassConfigV2} wire body. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant — useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validGamePassBody(overrides: Partial<GamePassConfigV2> = {}): GamePassConfigV2 {\n\treturn {\n\t\tname: \"Epic Pass\",\n\t\tcreatedTimestamp: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"Unlocks epic stuff\",\n\t\tgamePassId: 12_345,\n\t\ticonAssetId: 67_890,\n\t\tisForSale: true,\n\t\tpriceInformation: { defaultPriceInRobux: 100, enabledFeatures: [] },\n\t\tupdatedTimestamp: \"2024-03-20T14:45:00.000Z\",\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid wire body for the \"list game passes\" endpoint.\n * By default the page contains one game pass and `nextPageToken` is the\n * literal JSON `null` the API sends on the last page; `overrides` let\n * parser and integration tests tweak the items array or the cursor\n * without rebuilding the whole shape.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied. `nextPageToken`\n * defaults to the wire's literal `null`, which the response parser\n * normalizes to `undefined` at the boundary.\n */\nexport function validListGamePassesBody(\n\toverrides: Partial<ListGamePassesWireBody> = {},\n): ListGamePassesWireBody {\n\treturn {\n\t\tgamePasses: [validGamePassBody()],\n\t\t// eslint-disable-next-line unicorn/no-null -- API sends null on the last page; parser normalizes to undefined.\n\t\tnextPageToken: null,\n\t\t...overrides,\n\t};\n}\n","import type { GameThumbnailUploadWire } from \"#src/domains/game-internationalization/game-thumbnails/wire\";\n\n/**\n * Builds a minimally-valid {@link GameThumbnailUploadWire} body. Pass an\n * `overrides` object to tweak individual fields while keeping everything\n * else schema-compliant; useful for parser and integration tests that\n * only care about one field at a time.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validThumbnailUploadBody(\n\toverrides: Partial<GameThumbnailUploadWire> = {},\n): GameThumbnailUploadWire {\n\treturn { mediaAssetId: \"67890\", ...overrides };\n}\n","import type { PlaceWire } from \"#src/domains/cloud-v2/places/wire\";\nimport { RBXL_SIGNATURE, RBXLX_SIGNATURE } from \"#src/domains/universes/places/signatures\";\nimport type { PlaceVersionWire } from \"#src/domains/universes/places/wire\";\n\n/**\n * Returns a fresh, minimal `.rbxl`-formatted body whose magic bytes\n * match {@link RBXL_SIGNATURE}. Useful when integration tests don't\n * care about the file's contents past the signature.\n *\n * @returns A 14-byte rbxl body matching the binary signature.\n */\nexport function rbxlBody(): Uint8Array<ArrayBuffer> {\n\treturn new Uint8Array(RBXL_SIGNATURE);\n}\n\n/**\n * Returns a fresh, minimal `.rbxlx`-formatted body whose magic bytes\n * match {@link RBXLX_SIGNATURE}. Useful when integration tests don't\n * care about the file's contents past the signature.\n *\n * @returns An 8-byte rbxlx body matching the XML signature.\n */\nexport function rbxlxBody(): Uint8Array<ArrayBuffer> {\n\treturn new Uint8Array(RBXLX_SIGNATURE);\n}\n\n/**\n * Builds a minimally-valid {@link PlaceVersionWire} body. Pass an\n * `overrides` object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validPublishResponseBody(\n\toverrides: Partial<PlaceVersionWire> = {},\n): PlaceVersionWire {\n\treturn {\n\t\tversionNumber: 1,\n\t\t...overrides,\n\t};\n}\n\n/**\n * Builds a minimally-valid {@link PlaceWire} body. Pass an `overrides`\n * object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validPlaceBody(overrides: Partial<PlaceWire> = {}): PlaceWire {\n\treturn {\n\t\tcreateTime: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"A sample place.\",\n\t\tdisplayName: \"Test Place\",\n\t\tpath: \"universes/123/places/456\",\n\t\troot: true,\n\t\tserverSize: 30,\n\t\tuniverseRuntimeCreation: false,\n\t\tupdateTime: \"2024-11-02T17:08:21.500Z\",\n\t\t...overrides,\n\t};\n}\n","import type { UniverseWire } from \"#src/domains/cloud-v2/universes/wire\";\n\n/**\n * Builds a minimally-valid {@link UniverseWire} body. Pass an\n * `overrides` object to tweak fields without re-stating the defaults.\n *\n * @param overrides - Fields to override on the default body.\n * @returns A valid wire body with the overrides applied.\n */\nexport function validUniverseBody(overrides: Partial<UniverseWire> = {}): UniverseWire {\n\treturn {\n\t\tageRating: \"AGE_RATING_13_PLUS\",\n\t\tconsoleEnabled: false,\n\t\tcreateTime: \"2024-01-15T10:30:00.000Z\",\n\t\tdescription: \"A sample universe for tests.\",\n\t\tdesktopEnabled: true,\n\t\tdisplayName: \"Test Universe\",\n\t\tmobileEnabled: true,\n\t\tpath: \"universes/12345\",\n\t\trootPlace: \"universes/12345/places/98765\",\n\t\ttabletEnabled: true,\n\t\tupdateTime: \"2024-11-02T17:08:21.500Z\",\n\t\tuser: \"users/7777\",\n\t\tvisibility: \"PUBLIC\",\n\t\tvoiceChatEnabled: false,\n\t\tvrEnabled: false,\n\t\t...overrides,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,eAAe,YAA0C,EAAE,EAAuB;AACjG,QAAO;EACN,IAAI;EACJ,MAAM;EACN,SAAS;GAAE,IAAI;GAAK,MAAM;GAAS,MAAM;GAAG;EAC5C,SAAS;EACT,aAAa;EACb,oBAAoB;EACpB,oBAAoB;EACpB,aAAa;EACb,SAAS;EACT,aAAa;EACb,YAAY;GAAE,cAAc;GAAK,qBAAqB;GAAG,mBAAmB;GAAM;EAClF,SAAS;EACT,GAAG;EACH;;;;;;;;;;;;;ACfF,SAAgB,0BACf,YAA+C,EAAE,EACtB;AAC3B,QAAO;EACN,MAAM;EACN,kBAAkB;EAClB,aAAa;EACb,kBAAkB;EAClB,WAAW;EACX,aAAa;EACb,kBAAkB;GAAE,qBAAqB;GAAK,iBAAiB,EAAE;GAAE;EACnE,WAAW;EACX,kBAAkB;EAClB,YAAY;EACZ,kBAAkB;EAClB,GAAG;EACH;;;;;;;;;ACqCF,IAAa,sBAAb,cAAyC,MAAM;CAC9C,OAAwC;;;;;;;;;AAUzC,SAAgB,uBAAuC;CACtD,MAAM,QAAmB;EAAE,UAAU,EAAE;EAAE,UAAU;EAAG,OAAO,EAAE;EAAE;CACjE,SAA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O;EACN,MAAM;EACN,kBAAkB;EAClB,aAAa;EACb,YAAY;EACZ,aAAa;EACb,WAAW;EACX,kBAAkB;GAAE,qBAAqB;GAAK,iBAAiB,EAAE;GAAE;EACnE,kBAAkB;EAClB,GAAG;EACH;;;;;;;;;;;;;ACxBF,SAAgB,yBACf,YAA8C,EAAE,EACtB;AAC1B,QAAO;EAAE,cAAc;EAAS,GAAG;EAAW;;;;;;;;;;;ACH/C,SAAgB,WAAoC;AACnD,QAAO,IAAI,WAAW,eAAe;;;;;;;;;AAUtC,SAAgB,YAAqC;AACpD,QAAO,IAAI,WAAW,gBAAgB;;;;;;;;;AAUvC,SAAgB,yBACf,YAAuC,EAAE,EACtB;AACnB,QAAO;EACN,eAAe;EACf,GAAG;EACH;;;;;;;;;AAUF,SAAgB,eAAe,YAAgC,EAAE,EAAa;AAC7E,QAAO;EACN,YAAY;EACZ,aAAa;EACb,aAAa;EACb,MAAM;EACN,MAAM;EACN,YAAY;EACZ,yBAAyB;EACzB,YAAY;EACZ,GAAG;EACH;;;;;;;;;;;ACnDF,SAAgB,kBAAkB,YAAmC,EAAE,EAAgB;AACtF,QAAO;EACN,WAAW;EACX,gBAAgB;EAChB,YAAY;EACZ,aAAa;EACb,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,MAAM;EACN,WAAW;EACX,eAAe;EACf,YAAY;EACZ,MAAM;EACN,YAAY;EACZ,kBAAkB;EAClB,WAAW;EACX,GAAG;EACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-blob-
|
|
1
|
+
{"version":3,"file":"to-blob-B27VhoRp.mjs","names":[],"sources":["../src/internal/utils/to-blob.ts"],"sourcesContent":["/**\n * Wraps a binary value as a {@link Blob}, copying `Uint8Array` input into a\n * fresh `Blob` so the originating buffer cannot be mutated between request\n * build and send. `Blob` input is returned as-is so MIME-type metadata is\n * preserved.\n *\n * @param value - Binary data to convert.\n * @returns The supplied `Blob`, or a new `Blob` wrapping a defensive copy.\n */\nexport function toBlob(value: Blob | Uint8Array): Blob {\n\tif (value instanceof Blob) {\n\t\treturn value;\n\t}\n\n\treturn new Blob([new Uint8Array(value)]);\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,OAAO,OAAgC;AACtD,KAAI,iBAAiB,KACpB,QAAO;AAGR,QAAO,IAAI,KAAK,CAAC,IAAI,WAAW,MAAM,CAAC,CAAC"}
|
|
@@ -211,4 +211,4 @@ type RequestOptions = Partial<Pick<OpenCloudClientOptions, "apiKey" | "baseUrl"
|
|
|
211
211
|
type HttpRequestBody = FormData | Record<string, unknown> | Uint8Array<ArrayBuffer> | undefined;
|
|
212
212
|
//#endregion
|
|
213
213
|
export { OpenCloudHooks as a, Page as c, OpenCloudError as d, OpenCloudClientOptions as i, Result as l, HttpRequest as n, RequestConfig as o, HttpResponse as r, RequestOptions as s, HttpClient as t, SleepFunc as u };
|
|
214
|
-
//# sourceMappingURL=types-
|
|
214
|
+
//# sourceMappingURL=types-BOhSh9ug.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-BOhSh9ug.d.mts","names":[],"sources":["../src/errors/base.ts","../src/internal/utils/sleep.ts","../src/types.ts","../src/client/types.ts"],"mappings":";;AAMA;;;;;cAAa,cAAA,SAAuB,KAAA;EAAA,kBACV,IAAA;AAAA;;;;KCNd,SAAA,IAAa,EAAA,aAAe,OAAA;;;;ADKxC;;;;;;;;ACLA;;;;;;;;ACiCA;;;;;;;;;;;;;;;;;KAAY,MAAA,QAAc,KAAA;EAAW,IAAA,EAAM,CAAA;EAAG,OAAA;AAAA;EAAoB,GAAA,EAAK,CAAA;EAAG,OAAA;AAAA;;;;;;;ACzB1E;;;;;;;;;;;;;;;;;AAkBA;;;UDmCiB,IAAA;;WAEP,KAAA,EAAO,aAAA,CAAc,CAAA;;WAErB,aAAA;AAAA;;;;;;UCzDO,WAAA;;WAEP,IAAA,GAAO,eAAA;EFVL;;;;;EAAA,SEgBF,OAAA,GAAU,QAAA,CAAS,MAAA;;WAEnB,MAAA;EDeE;EAAA,SCbF,GAAA;AAAA;;;;UAMO,YAAA;;;;;;WAMP,IAAA;;WAEA,OAAA,EAAS,QAAA,CAAS,MAAA;;WAElB,MAAA;AAAA;ADyBV;;;AAAA,UCnBiB,aAAA;;WAEP,MAAA;;WAEA,OAAA;;WAEA,OAAA;AAAA;;;;AAxCV;UA+CiB,UAAA;;EAEhB,OAAA,CACC,OAAA,EAAS,WAAA,EACT,MAAA,EAAQ,aAAA,GACN,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,cAAA;AAAA;;;;;UAOhB,cAAA;;WAEP,WAAA,IAAe,MAAA;;WAEf,SAAA,IAAa,OAAA,EAAS,WAAA;;WAEtB,OAAA,IAAW,OAAA,UAAiB,KAAA,EAAO,cAAA;AAAA;AA/C7C;;;;AAAA,UAsDiB,sBAAA;;WAEP,MAAA;;WAEA,OAAA;;WAEA,KAAA,GAAQ,cAAA;EA5ClB;;;;;;;EAAA,SAoDU,UAAA,GAAa,UAAA;EA9Cb;EAAA,SAgDA,UAAA;EAzCO;;;;;EAAA,SA+CP,iBAAA,GAAoB,aAAA;;WAEpB,UAAA,IAAc,OAAA;;;;;;;WAOd,KAAA,GAAQ,SAAA;;WAER,OAAA;AAAA;;;;AA9CV;;KAsDY,cAAA,GAAiB,OAAA,CAC5B,IAAA,CACC,sBAAA;;;;;;;;;;;;KAgBG,eAAA,GAAkB,QAAA,GAAW,MAAA,oBAA0B,UAAA,CAAW,WAAA"}
|
package/dist/universes.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, s as RequestOptions } from "./types-
|
|
2
|
-
import { i as RobloxLocale, r as RobloxLanguageCode } from "./data.generated-
|
|
1
|
+
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, s as RequestOptions } from "./types-BOhSh9ug.mjs";
|
|
2
|
+
import { i as RobloxLocale, r as RobloxLanguageCode } from "./data.generated-DdwXMiv9.mjs";
|
|
3
|
+
import { n as GameIconState } from "./wire-BeIO-d1x.mjs";
|
|
3
4
|
|
|
4
5
|
//#region src/domains/cloud-v2/universes/types.d.ts
|
|
5
6
|
/**
|
|
@@ -127,12 +128,6 @@ interface Universe {
|
|
|
127
128
|
readonly youtubeSocialLink: SocialLink | undefined;
|
|
128
129
|
}
|
|
129
130
|
//#endregion
|
|
130
|
-
//#region src/domains/game-internationalization/game-icon/wire.d.ts
|
|
131
|
-
/**
|
|
132
|
-
* Image moderation state returned alongside each localized icon.
|
|
133
|
-
*/
|
|
134
|
-
type GameIconState = "Approved" | "Error" | "PendingReview" | "Rejected" | "UnAvailable";
|
|
135
|
-
//#endregion
|
|
136
131
|
//#region src/domains/game-internationalization/game-icon/types.d.ts
|
|
137
132
|
/**
|
|
138
133
|
* A localized icon entry returned by listing icons for an experience.
|
package/dist/universes.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universes.d.mts","names":[],"sources":["../src/domains/cloud-v2/universes/types.ts","../src/domains/game-internationalization/game-icon/
|
|
1
|
+
{"version":3,"file":"universes.d.mts","names":[],"sources":["../src/domains/cloud-v2/universes/types.ts","../src/domains/game-internationalization/game-icon/types.ts","../src/domains/game-internationalization/game-thumbnails/types.ts","../src/resources/universes/client.ts"],"mappings":";;;;;;;;UAGiB,qBAAA;;WAEP,UAAA;AAAA;;;;UAMO,UAAA;EAAA;EAAA,SAEP,KAAA;EAFO;EAAA,SAIP,GAAA;AAAA;;KAIE,kBAAA;;;AAWZ;;;;;;;UAAiB,wBAAA;;WAEP,cAAA;;WAEA,cAAA;;WAEA,iBAAA,GAAoB,UAAA;;WAEpB,kBAAA,GAAqB,UAAA;;WAErB,iBAAA,GAAoB,UAAA;;WAEpB,aAAA;;WAEA,uBAAA;;WAEA,qBAAA,GAAwB,UAAA;;WAExB,aAAA;;WAEA,gBAAA,GAAmB,UAAA;;WAEnB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5R7B;;;;;EEqSC,WAAA,CAAY,OAAA,EAAS,sBAAA;;;;;;;;;;EAerB,GAAA,CACC,UAAA,EAAY,qBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,cAAA;;;AFtS7B;;;;;;;;;;AAcA;EEySC,MAAA,CACC,UAAA,EAAY,wBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,cAAA;AAAA"}
|
package/dist/universes.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as ValidationError } from "./validation-
|
|
3
|
-
import { t as toBlob } from "./to-blob-
|
|
4
|
-
import { t as isDateTimeString } from "./is-date-time-string-
|
|
5
|
-
import { a as IDEMPOTENT_METHOD_DEFAULTS, i as CREATE_METHOD_DEFAULTS, n as okRequest,
|
|
1
|
+
import { r as ApiError } from "./rate-limit-D1q2Js-z.mjs";
|
|
2
|
+
import { t as ValidationError } from "./validation-DkL5KQqz.mjs";
|
|
3
|
+
import { t as toBlob } from "./to-blob-B27VhoRp.mjs";
|
|
4
|
+
import { t as isDateTimeString } from "./is-date-time-string-DL6l9mo6.mjs";
|
|
5
|
+
import { a as IDEMPOTENT_METHOD_DEFAULTS, i as CREATE_METHOD_DEFAULTS, n as okRequest, r as parseEmptyResponse, s as isRecord, t as ResourceClient } from "./resource-client-D7HKNrOp.mjs";
|
|
6
6
|
//#region src/domains/cloud-v2/universes/builders.ts
|
|
7
7
|
/**
|
|
8
8
|
* Dodges `unicorn/no-null` while still emitting a literal `null` onto
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as OpenCloudError } from "./rate-limit-D1q2Js-z.mjs";
|
|
2
2
|
//#region src/errors/validation.ts
|
|
3
3
|
/**
|
|
4
4
|
* Thrown locally when caller-supplied input is rejected before any HTTP
|
|
@@ -35,4 +35,4 @@ var ValidationError = class extends OpenCloudError {
|
|
|
35
35
|
//#endregion
|
|
36
36
|
export { ValidationError as t };
|
|
37
37
|
|
|
38
|
-
//# sourceMappingURL=validation-
|
|
38
|
+
//# sourceMappingURL=validation-DkL5KQqz.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-
|
|
1
|
+
{"version":3,"file":"validation-DkL5KQqz.mjs","names":[],"sources":["../src/errors/validation.ts"],"sourcesContent":["import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Closed discriminator for a {@link ValidationError}. Consumers can\n * exhaustively `switch` over this union so TypeScript will refuse to compile\n * if a new variant is added without a handler.\n */\nexport type ValidationErrorCode =\n\t| \"empty_body\"\n\t| \"empty_image_ids\"\n\t| \"empty_update\"\n\t| \"format_mismatch\"\n\t| \"incomplete_ref\"\n\t| \"invalid_image_id\";\n\n/**\n * Options for constructing a {@link ValidationError}.\n */\nexport interface ValidationErrorOptions extends ErrorOptions {\n\t/** Machine-readable discriminator identifying the validation failure. */\n\tcode: ValidationErrorCode;\n}\n\n/**\n * Thrown locally when caller-supplied input is rejected before any HTTP\n * round-trip. The `code` discriminator lets consumers branch on local-input\n * errors separately from server-side errors.\n *\n * @example\n *\n * ```ts\n * import { ValidationError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new ValidationError(\"Place body is empty\", {\n * code: \"empty_body\",\n * });\n *\n * expect(error).toBeInstanceOf(ValidationError);\n * expect(error.code).toBe(\"empty_body\");\n * ```\n */\nexport class ValidationError extends OpenCloudError {\n\tpublic readonly code: ValidationErrorCode;\n\tpublic override readonly name: string = \"ValidationError\";\n\n\t/**\n\t * Creates a new ValidationError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the validation failure code.\n\t */\n\tconstructor(message: string, options: ValidationErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.code = options.code;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,kBAAb,cAAqC,eAAe;CACnD;CACA,OAAwC;;;;;;;CAQxC,YAAY,SAAiB,SAAiC;AAC7D,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO,QAAQ"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/domains/game-internationalization/game-icon/wire.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Image moderation state returned alongside each localized icon.
|
|
4
|
+
*/
|
|
5
|
+
type GameIconState = "Approved" | "Error" | "PendingReview" | "Rejected" | "UnAvailable";
|
|
6
|
+
/**
|
|
7
|
+
* A single localized icon entry, mirroring
|
|
8
|
+
* `Roblox.GameInternationalization.Api.GetGameIconResponse` from the
|
|
9
|
+
* vendored Open Cloud spec.
|
|
10
|
+
*/
|
|
11
|
+
interface GetGameIconResponseWire {
|
|
12
|
+
/** Stringified ID of the uploaded icon image. */
|
|
13
|
+
readonly imageId: string;
|
|
14
|
+
/** CDN URL the icon can be loaded from. */
|
|
15
|
+
readonly imageUrl: string;
|
|
16
|
+
/**
|
|
17
|
+
* Roblox wire form the icon is registered against. Either the
|
|
18
|
+
* Language form (e.g. `en`, `fil`, `zh-hans`) or the Locale form
|
|
19
|
+
* (e.g. `en_us`, `pt_br`, `ar_001`).
|
|
20
|
+
*/
|
|
21
|
+
readonly languageCode: string;
|
|
22
|
+
/** Moderation state of the icon. */
|
|
23
|
+
readonly state: GameIconState;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Wire shape of `GET /v1/game-icon/games/{gameId}`, mirroring
|
|
27
|
+
* `Roblox.Web.WebAPI.Models.ApiArrayResponse_…`.
|
|
28
|
+
*/
|
|
29
|
+
interface GameIconListWire {
|
|
30
|
+
/** Localized icons in the order returned by the API. */
|
|
31
|
+
readonly data: ReadonlyArray<GetGameIconResponseWire>;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { GameIconState as n, GetGameIconResponseWire as r, GameIconListWire as t };
|
|
35
|
+
//# sourceMappingURL=wire-BeIO-d1x.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-BeIO-d1x.d.mts","names":[],"sources":["../src/domains/game-internationalization/game-icon/wire.ts"],"mappings":";;AAGA;;KAAY,aAAA;;;AAOZ;;;UAAiB,uBAAA;;WAEP,OAAA;;WAEA,QAAA;;;;AAeV;;WATU,YAAA;EAWM;EAAA,SATN,KAAA,EAAO,aAAA;AAAA;;;;;UAOA,gBAAA;;WAEP,IAAA,EAAM,aAAA,CAAc,uBAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrock-rbx/ocale",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.4",
|
|
4
4
|
"description": "Roblox Open Cloud API client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"typescript": "npm:@typescript/typescript6@6.0.1",
|
|
54
54
|
"vitest": "4.1.5",
|
|
55
55
|
"@bedrock-rbx/typescript-config": "0.0.0",
|
|
56
|
-
"@bedrock-rbx/
|
|
57
|
-
"@bedrock-rbx/
|
|
56
|
+
"@bedrock-rbx/testing": "0.0.0",
|
|
57
|
+
"@bedrock-rbx/vite-config": "0.0.0"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=24.12.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limit-CKfuhxT1.mjs","names":[],"sources":["../src/errors/base.ts","../src/errors/api-error.ts","../src/errors/network-error.ts","../src/errors/permission-error.ts","../src/errors/rate-limit.ts"],"sourcesContent":["/**\n * Base error class for all Open Cloud SDK errors.\n *\n * All specific error types (RateLimitError, ApiError, NetworkError)\n * extend this class, enabling `instanceof OpenCloudError` checks.\n */\nexport class OpenCloudError extends Error {\n\tpublic override readonly name: string = \"OpenCloudError\";\n}\n","import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Options for constructing an {@link ApiError}.\n */\nexport interface ApiErrorOptions extends ErrorOptions {\n\t/** Optional machine-readable error code from the API. */\n\tcode?: string | undefined;\n\t/** Parsed response body, when present. */\n\tdetails?: JSONValue | undefined;\n\t/** HTTP status code from the API response. */\n\tstatusCode: number;\n}\n\n/**\n * Thrown when the Roblox Open Cloud API returns a non-2xx response\n * that is not a rate limit (429).\n *\n * @example\n *\n * ```ts\n * import { ApiError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new ApiError(\"HTTP 404: Pass not found (code NotFound)\", {\n * code: \"NotFound\",\n * details: { errorCode: \"NotFound\", message: \"Pass not found\" },\n * statusCode: 404,\n * });\n *\n * expect(error).toBeInstanceOf(ApiError);\n * expect(error.statusCode).toBe(404);\n * expect(error.code).toBe(\"NotFound\");\n * expect(error.details).toEqual({\n * errorCode: \"NotFound\",\n * message: \"Pass not found\",\n * });\n * ```\n */\nexport class ApiError extends OpenCloudError {\n\tpublic readonly code: string | undefined;\n\tpublic readonly details: JSONValue | undefined;\n\tpublic override readonly name: string = \"ApiError\";\n\tpublic readonly statusCode: number;\n\n\t/**\n\t * Creates a new ApiError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including status code, optional error\n\t * code, and the parsed response body when present.\n\t */\n\tconstructor(message: string, options: ApiErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.statusCode = options.statusCode;\n\t\tthis.code = options.code;\n\t\tthis.details = options.details;\n\t}\n}\n","import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Thrown when a network-level failure prevents the request from reaching\n * the Roblox Open Cloud API (e.g., DNS resolution failure, connection timeout).\n */\nexport class NetworkError extends OpenCloudError {\n\tpublic override readonly name: string = \"NetworkError\";\n}\n","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","import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Options for constructing a {@link RateLimitError}.\n */\nexport interface RateLimitErrorOptions extends ErrorOptions {\n\t/** Seconds to wait before retrying the request. */\n\tretryAfterSeconds: number;\n}\n\n/**\n * Thrown when the Roblox Open Cloud API returns a 429 Too Many Requests response.\n * Contains the server-suggested retry delay.\n *\n * @example\n *\n * ```ts\n * import { RateLimitError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new RateLimitError(\"Too many requests\", {\n * retryAfterSeconds: 30,\n * });\n *\n * expect(error).toBeInstanceOf(RateLimitError);\n * expect(error.retryAfterSeconds).toBe(30);\n * ```\n */\nexport class RateLimitError extends OpenCloudError {\n\tpublic override readonly name = \"RateLimitError\";\n\tpublic readonly retryAfterSeconds: number;\n\n\t/**\n\t * Creates a new RateLimitError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the retry delay.\n\t */\n\tconstructor(message: string, options: RateLimitErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.retryAfterSeconds = options.retryAfterSeconds;\n\t}\n}\n"],"mappings":";;;;;;;AAMA,IAAa,iBAAb,cAAoC,MAAM;CACzC,OAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC+BzC,IAAa,WAAb,cAA8B,eAAe;CAC5C;CACA;CACA,OAAwC;CACxC;;;;;;;;CASA,YAAY,SAAiB,SAA0B;AACtD,QAAM,SAAS,QAAQ;AACvB,OAAK,aAAa,QAAQ;AAC1B,OAAK,OAAO,QAAQ;AACpB,OAAK,UAAU,QAAQ;;;;;;;;;ACjDzB,IAAa,eAAb,cAAkC,eAAe;CAChD,OAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;ACoCzC,IAAa,kBAAb,cAAqC,SAAS;CAC7C,OAAwC;CACxC;CACA;;;;;;;;CASA,YAAY,SAAiB,SAAiC;AAC7D,QAAM,SAAS,QAAQ;AACvB,OAAK,eAAe,QAAQ;AAC5B,OAAK,iBAAiB,QAAQ;;;;;;;;;;;;;;;;;;;;;;AC/BhC,IAAa,iBAAb,cAAoC,eAAe;CAClD,OAAgC;CAChC;;;;;;;CAQA,YAAY,SAAiB,SAAgC;AAC5D,QAAM,SAAS,QAAQ;AACvB,OAAK,oBAAoB,QAAQ"}
|