@bedrock-rbx/ocale 0.1.0-beta.2 → 0.1.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -0
- package/dist/badges.d.mts +33 -2
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +12 -4
- package/dist/badges.mjs.map +1 -1
- package/dist/{data.generated-BtkDGH8C.d.mts → data.generated-B2ceLfSn.d.mts} +9 -1
- package/dist/data.generated-B2ceLfSn.d.mts.map +1 -0
- package/dist/developer-products.d.mts +38 -2
- package/dist/developer-products.d.mts.map +1 -1
- package/dist/developer-products.mjs +22 -5
- package/dist/developer-products.mjs.map +1 -1
- package/dist/game-passes.d.mts +40 -2
- package/dist/game-passes.d.mts.map +1 -1
- package/dist/game-passes.mjs +22 -5
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +110 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/locales.d.mts +1 -1
- package/dist/locales.mjs +2 -0
- package/dist/locales.mjs.map +1 -1
- package/dist/luau-execution.d.mts +112 -6
- package/dist/luau-execution.d.mts.map +1 -1
- package/dist/luau-execution.mjs +129 -4
- package/dist/luau-execution.mjs.map +1 -1
- package/dist/places.d.mts +64 -6
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +33 -61
- package/dist/places.mjs.map +1 -1
- package/dist/poll-timeout-C0nmJzOd.mjs +83 -0
- package/dist/poll-timeout-C0nmJzOd.mjs.map +1 -0
- package/dist/polling-helpers-Cb4j4cq7.mjs +787 -0
- package/dist/polling-helpers-Cb4j4cq7.mjs.map +1 -0
- package/dist/polling-rj0dGREg.d.mts +312 -0
- package/dist/polling-rj0dGREg.d.mts.map +1 -0
- package/dist/{price-information-s7DY0GV2.mjs → price-information-Bu87sPyh.mjs} +2 -2
- package/dist/{price-information-s7DY0GV2.mjs.map → price-information-Bu87sPyh.mjs.map} +1 -1
- package/dist/{rate-limit-CKfuhxT1.mjs → rate-limit-Co9i28qi.mjs} +24 -38
- package/dist/rate-limit-Co9i28qi.mjs.map +1 -0
- package/dist/{resource-client-Wi4Mwqy5.mjs → resource-client-lE7Tg3BK.mjs} +349 -241
- package/dist/resource-client-lE7Tg3BK.mjs.map +1 -0
- package/dist/retry-CbHBw60o.mjs +380 -0
- package/dist/retry-CbHBw60o.mjs.map +1 -0
- package/dist/retry-r1TXe5Zd.d.mts +189 -0
- package/dist/retry-r1TXe5Zd.d.mts.map +1 -0
- package/dist/signatures-JF-7Psce.mjs +59 -0
- package/dist/signatures-JF-7Psce.mjs.map +1 -0
- package/dist/storage.d.mts +322 -31
- package/dist/storage.d.mts.map +1 -1
- package/dist/storage.mjs +506 -18
- package/dist/storage.mjs.map +1 -1
- package/dist/testing.d.mts +727 -0
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +457 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/{to-blob-1BtHsDGK.mjs → to-blob-RPqMBuft.mjs} +1 -1
- package/dist/{to-blob-1BtHsDGK.mjs.map → to-blob-RPqMBuft.mjs.map} +1 -1
- package/dist/{types-Cp8w8uwA.d.mts → types-CRiJg5EQ.d.mts} +46 -4
- package/dist/types-CRiJg5EQ.d.mts.map +1 -0
- package/dist/universes.d.mts +47 -10
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +7 -5
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-b7KAoEio.mjs → validation-9oU6qNNQ.mjs} +4 -2
- package/dist/validation-9oU6qNNQ.mjs.map +1 -0
- package/dist/wire-D3K-a-UP.d.mts +37 -0
- package/dist/wire-D3K-a-UP.d.mts.map +1 -0
- package/package.json +9 -7
- package/dist/data.generated-BtkDGH8C.d.mts.map +0 -1
- package/dist/is-date-time-string-Cuf1TaSC.mjs +0 -19
- package/dist/is-date-time-string-Cuf1TaSC.mjs.map +0 -1
- package/dist/rate-limit-CKfuhxT1.mjs.map +0 -1
- package/dist/rate-limit-DzHBFwps.d.mts +0 -92
- package/dist/rate-limit-DzHBFwps.d.mts.map +0 -1
- package/dist/resource-client-Wi4Mwqy5.mjs.map +0 -1
- package/dist/specs-Co6qYp_E.mjs +0 -309
- package/dist/specs-Co6qYp_E.mjs.map +0 -1
- package/dist/types-BZ0959rh.d.mts +0 -149
- package/dist/types-BZ0959rh.d.mts.map +0 -1
- package/dist/types-Cp8w8uwA.d.mts.map +0 -1
- package/dist/validation-b7KAoEio.mjs.map +0 -1
package/dist/storage.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.mts","names":[],"sources":["../src/domains/cloud-v2/memory-store-queues/types.ts","../src/
|
|
1
|
+
{"version":3,"file":"storage.d.mts","names":[],"sources":["../src/domains/cloud-v2/memory-store-queues/types.ts","../src/domains/cloud-v2/memory-store-sorted-maps/types.ts","../src/internal/http/rate-limit-queue.ts","../src/internal/resource-client.ts","../src/resources/storage/queues-group.ts","../src/resources/storage/sorted-maps-group.ts","../src/resources/storage/client.ts"],"mappings":";;;;;;;;AAMA;;UAAiB,0BAAA;EAOD;;;;;;EAAA,SAAN,IAAA,EAAM,OAAA,CAAQ,SAAA;;;AAgBd;AAUV;;WApBU,QAAA;;WAEA,OAAA;;;;;;WAMA,GAAA;;WAEA,UAAA;AAAA;;;;;AAyBA;AASV;;UAxBiB,SAAA;EAwBA;EAAA,SAtBP,EAAA;;;;;WAKA,IAAA,EAAM,OAAA,CAAQ,SAAA;EAsCd;EAAA,SApCA,SAAA,EAAW,IAAA;EA+CJ;EAAA,SA7CP,QAAA;EA+CO;EAAA,SA7CP,OAAA;;WAEA,UAAA;AAAA;;AAgDA;AAYV;;;;UAnDiB,2BAAA;;;;AAyDP;;WAnDA,YAAA;;AC7DV;;;WDkEU,KAAA;;;;;;WAMA,kBAAA;EC7DV;EAAA,SD+DU,OAAA;;WAEA,UAAA;AAAA;;;;;;;;;UAWO,aAAA;EC1CjB;EAAA,SD4CU,KAAA,EAAO,aA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/dist/storage.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { a as
|
|
1
|
+
import { r as ApiError } from "./rate-limit-Co9i28qi.mjs";
|
|
2
|
+
import { n as IDEMPOTENT_METHOD_DEFAULTS, t as CREATE_METHOD_DEFAULTS } from "./retry-CbHBw60o.mjs";
|
|
3
|
+
import { a as isDateTimeString, i as isRecord, n as okRequest, r as parseEmptyResponse, t as ResourceClient } from "./resource-client-lE7Tg3BK.mjs";
|
|
4
4
|
//#region src/domains/cloud-v2/memory-store-queues/builders.ts
|
|
5
5
|
/**
|
|
6
6
|
* Builds a `POST` request for the Open Cloud
|
|
@@ -73,7 +73,7 @@ function buildDiscardRequest(parameters) {
|
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/domains/cloud-v2/memory-store-queues/operations.ts
|
|
75
75
|
const ENQUEUE_PER_MINUTE = 1e6;
|
|
76
|
-
const SECONDS_PER_MINUTE = 60;
|
|
76
|
+
const SECONDS_PER_MINUTE$1 = 60;
|
|
77
77
|
/**
|
|
78
78
|
* Per-second request ceiling for enqueueing a memory-store queue item,
|
|
79
79
|
* from the Open Cloud OpenAPI schema (1,000,000 requests per minute per
|
|
@@ -83,7 +83,7 @@ const SECONDS_PER_MINUTE = 60;
|
|
|
83
83
|
* is fewer cross-method contention surprises.
|
|
84
84
|
*/
|
|
85
85
|
const ENQUEUE_OPERATION_LIMIT = Object.freeze({
|
|
86
|
-
maxPerSecond: ENQUEUE_PER_MINUTE / SECONDS_PER_MINUTE,
|
|
86
|
+
maxPerSecond: ENQUEUE_PER_MINUTE / SECONDS_PER_MINUTE$1,
|
|
87
87
|
operationKey: "memory-store-queues.enqueue"
|
|
88
88
|
});
|
|
89
89
|
/**
|
|
@@ -98,7 +98,7 @@ const ENQUEUE_REQUIRED_SCOPES = Object.freeze(["memory-store.queue:add"]);
|
|
|
98
98
|
* per API key owner). Keyed independently from enqueue and discard.
|
|
99
99
|
*/
|
|
100
100
|
const DEQUEUE_OPERATION_LIMIT = Object.freeze({
|
|
101
|
-
maxPerSecond: 1e6 / SECONDS_PER_MINUTE,
|
|
101
|
+
maxPerSecond: 1e6 / SECONDS_PER_MINUTE$1,
|
|
102
102
|
operationKey: "memory-store-queues.dequeue"
|
|
103
103
|
});
|
|
104
104
|
/**
|
|
@@ -114,7 +114,7 @@ const DEQUEUE_REQUIRED_SCOPES = Object.freeze(["memory-store.queue:dequeue"]);
|
|
|
114
114
|
* dequeue.
|
|
115
115
|
*/
|
|
116
116
|
const DISCARD_OPERATION_LIMIT = Object.freeze({
|
|
117
|
-
maxPerSecond: 1e6 / SECONDS_PER_MINUTE,
|
|
117
|
+
maxPerSecond: 1e6 / SECONDS_PER_MINUTE$1,
|
|
118
118
|
operationKey: "memory-store-queues.discard"
|
|
119
119
|
});
|
|
120
120
|
/**
|
|
@@ -125,7 +125,7 @@ const DISCARD_OPERATION_LIMIT = Object.freeze({
|
|
|
125
125
|
const DISCARD_REQUIRED_SCOPES = Object.freeze(["memory-store.queue:discard"]);
|
|
126
126
|
//#endregion
|
|
127
127
|
//#region src/domains/cloud-v2/memory-store-queues/parsers.ts
|
|
128
|
-
const PATH_PATTERN = /^cloud\/v2\/universes\/(\d+)\/memory-store\/queues\/([^/]+)\/items\/([^/]+)$/;
|
|
128
|
+
const PATH_PATTERN$1 = /^cloud\/v2\/universes\/(\d+)\/memory-store\/queues\/([^/]+)\/items\/([^/]+)$/;
|
|
129
129
|
const MALFORMED_QUEUE_ITEM_MESSAGE = "Malformed memory-store queue item response";
|
|
130
130
|
const MALFORMED_DEQUEUE_MESSAGE = "Malformed memory-store dequeue response";
|
|
131
131
|
/**
|
|
@@ -160,8 +160,9 @@ function parseDequeueResponse(response) {
|
|
|
160
160
|
const { body, status: statusCode } = response;
|
|
161
161
|
if (!isRecord(body)) return malformedDequeue(statusCode);
|
|
162
162
|
const { id, queueItems } = body;
|
|
163
|
-
if (typeof id !== "string"
|
|
164
|
-
|
|
163
|
+
if (typeof id !== "string") return malformedDequeue(statusCode);
|
|
164
|
+
if (queueItems !== void 0 && queueItems !== null && !Array.isArray(queueItems)) return malformedDequeue(statusCode);
|
|
165
|
+
const items = (queueItems ?? []).map(wireBodyToQueueItem);
|
|
165
166
|
if (!items.every(isQueueItem)) return malformedDequeue(statusCode);
|
|
166
167
|
return {
|
|
167
168
|
data: {
|
|
@@ -178,7 +179,7 @@ function isQueueItemWire(body) {
|
|
|
178
179
|
}
|
|
179
180
|
function wireBodyToQueueItem(body) {
|
|
180
181
|
if (!isQueueItemWire(body)) return;
|
|
181
|
-
const match = PATH_PATTERN.exec(body.path);
|
|
182
|
+
const match = PATH_PATTERN$1.exec(body.path);
|
|
182
183
|
const universeId = match?.[1];
|
|
183
184
|
const queueId = match?.[2];
|
|
184
185
|
const id = match?.[3];
|
|
@@ -209,10 +210,10 @@ function malformedDequeue(statusCode) {
|
|
|
209
210
|
}
|
|
210
211
|
//#endregion
|
|
211
212
|
//#region src/resources/storage/queues-group.ts
|
|
212
|
-
function makeSpec(spec) {
|
|
213
|
+
function makeSpec$1(spec) {
|
|
213
214
|
return Object.freeze(spec);
|
|
214
215
|
}
|
|
215
|
-
const ENQUEUE_SPEC = makeSpec({
|
|
216
|
+
const ENQUEUE_SPEC = makeSpec$1({
|
|
216
217
|
buildRequest: (parameters) => okRequest(buildEnqueueRequest(parameters)),
|
|
217
218
|
methodDefaults: CREATE_METHOD_DEFAULTS,
|
|
218
219
|
methodKind: "create",
|
|
@@ -220,7 +221,7 @@ const ENQUEUE_SPEC = makeSpec({
|
|
|
220
221
|
parse: parseQueueItemResponse,
|
|
221
222
|
requiredScopes: ENQUEUE_REQUIRED_SCOPES
|
|
222
223
|
});
|
|
223
|
-
const DEQUEUE_SPEC = makeSpec({
|
|
224
|
+
const DEQUEUE_SPEC = makeSpec$1({
|
|
224
225
|
buildRequest: (parameters) => okRequest(buildDequeueRequest(parameters)),
|
|
225
226
|
methodDefaults: CREATE_METHOD_DEFAULTS,
|
|
226
227
|
methodKind: "create",
|
|
@@ -228,7 +229,7 @@ const DEQUEUE_SPEC = makeSpec({
|
|
|
228
229
|
parse: parseDequeueResponse,
|
|
229
230
|
requiredScopes: DEQUEUE_REQUIRED_SCOPES
|
|
230
231
|
});
|
|
231
|
-
const DISCARD_SPEC = makeSpec({
|
|
232
|
+
const DISCARD_SPEC = makeSpec$1({
|
|
232
233
|
buildRequest: (parameters) => okRequest(buildDiscardRequest(parameters)),
|
|
233
234
|
methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
|
|
234
235
|
methodKind: "idempotent",
|
|
@@ -331,17 +332,501 @@ var MemoryStoreQueuesGroup = class {
|
|
|
331
332
|
}
|
|
332
333
|
};
|
|
333
334
|
//#endregion
|
|
335
|
+
//#region src/domains/cloud-v2/memory-store-sorted-maps/builders.ts
|
|
336
|
+
/**
|
|
337
|
+
* Builds a `POST` request for the Open Cloud
|
|
338
|
+
* `Cloud_CreateMemoryStoreSortedMapItem` endpoint. The caller-supplied
|
|
339
|
+
* `itemId` travels as the `id` query parameter (URL-encoded by
|
|
340
|
+
* `URLSearchParams`); the body carries `value`, the optional `ttl`
|
|
341
|
+
* (serialized as a Google protobuf `Duration` string in seconds), and
|
|
342
|
+
* one of `stringSortKey`/`numericSortKey` projected from the
|
|
343
|
+
* {@link SortKey} discriminated union.
|
|
344
|
+
*
|
|
345
|
+
* @param parameters - Universe, sorted-map, item identifiers, the
|
|
346
|
+
* value to store, and optional `sortKey` and `ttl`.
|
|
347
|
+
* @returns A pure {@link HttpRequest} describing the create call.
|
|
348
|
+
*/
|
|
349
|
+
function buildCreateRequest(parameters) {
|
|
350
|
+
const { itemId, mapId, sortKey, ttl, universeId, value } = parameters;
|
|
351
|
+
const body = { value };
|
|
352
|
+
if (ttl !== void 0) body["ttl"] = `${ttl}s`;
|
|
353
|
+
applySortKeyToBody(body, sortKey);
|
|
354
|
+
const query = new URLSearchParams({ id: itemId });
|
|
355
|
+
return {
|
|
356
|
+
body,
|
|
357
|
+
headers: { "content-type": "application/json" },
|
|
358
|
+
method: "POST",
|
|
359
|
+
url: `/cloud/v2/universes/${encodeURIComponent(universeId)}/memory-store/sorted-maps/${encodeURIComponent(mapId)}/items?${query.toString()}`
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Builds a `DELETE` request for the Open Cloud
|
|
364
|
+
* `Cloud_DeleteMemoryStoreSortedMapItem` endpoint. Every path segment
|
|
365
|
+
* (universe, sorted-map, item identifiers) is URL-encoded so callers
|
|
366
|
+
* can pass values containing reserved characters without manual
|
|
367
|
+
* escaping.
|
|
368
|
+
*
|
|
369
|
+
* @param parameters - Universe, sorted-map, and item identifiers.
|
|
370
|
+
* @returns A pure {@link HttpRequest} describing the delete call.
|
|
371
|
+
*/
|
|
372
|
+
function buildDeleteRequest(parameters) {
|
|
373
|
+
const { itemId, mapId, universeId } = parameters;
|
|
374
|
+
return {
|
|
375
|
+
method: "DELETE",
|
|
376
|
+
url: `/cloud/v2/universes/${encodeURIComponent(universeId)}/memory-store/sorted-maps/${encodeURIComponent(mapId)}/items/${encodeURIComponent(itemId)}`
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Builds a `GET` request for the Open Cloud
|
|
381
|
+
* `Cloud_GetMemoryStoreSortedMapItem` endpoint. Every path segment
|
|
382
|
+
* (universe, sorted-map, item identifiers) is URL-encoded so callers
|
|
383
|
+
* can pass values containing reserved characters without manual
|
|
384
|
+
* escaping.
|
|
385
|
+
*
|
|
386
|
+
* @param parameters - Universe, sorted-map, and item identifiers.
|
|
387
|
+
* @returns A pure {@link HttpRequest} describing the get call.
|
|
388
|
+
*/
|
|
389
|
+
function buildGetRequest(parameters) {
|
|
390
|
+
const { itemId, mapId, universeId } = parameters;
|
|
391
|
+
return {
|
|
392
|
+
method: "GET",
|
|
393
|
+
url: `/cloud/v2/universes/${encodeURIComponent(universeId)}/memory-store/sorted-maps/${encodeURIComponent(mapId)}/items/${encodeURIComponent(itemId)}`
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Builds a `GET` request for the Open Cloud
|
|
398
|
+
* `Cloud_ListMemoryStoreSortedMapItems` endpoint. Optional `filter`,
|
|
399
|
+
* `maxPageSize`, `orderBy`, and `pageToken` parameters travel as query
|
|
400
|
+
* string parameters and are omitted when unset.
|
|
401
|
+
*
|
|
402
|
+
* @param parameters - Universe and sorted-map identifiers, plus
|
|
403
|
+
* optional pagination and filter parameters.
|
|
404
|
+
* @returns A pure {@link HttpRequest} describing the list call.
|
|
405
|
+
*/
|
|
406
|
+
function buildListRequest(parameters) {
|
|
407
|
+
const { filter, mapId, maxPageSize, orderBy, pageToken, universeId } = parameters;
|
|
408
|
+
const query = new URLSearchParams();
|
|
409
|
+
if (maxPageSize !== void 0) query.append("maxPageSize", String(maxPageSize));
|
|
410
|
+
if (pageToken !== void 0) query.append("pageToken", pageToken);
|
|
411
|
+
if (orderBy !== void 0) query.append("orderBy", orderBy);
|
|
412
|
+
if (filter !== void 0) query.append("filter", filter);
|
|
413
|
+
const base = `/cloud/v2/universes/${encodeURIComponent(universeId)}/memory-store/sorted-maps/${encodeURIComponent(mapId)}/items`;
|
|
414
|
+
const queryString = query.toString();
|
|
415
|
+
return {
|
|
416
|
+
method: "GET",
|
|
417
|
+
url: queryString === "" ? base : `${base}?${queryString}`
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Builds a `PATCH` request for the Open Cloud
|
|
422
|
+
* `Cloud_UpdateMemoryStoreSortedMapItem` endpoint. Body fields are
|
|
423
|
+
* conditionally included so a partial update sends only the changed
|
|
424
|
+
* fields; the optional `allowMissing` query string drives
|
|
425
|
+
* upsert-on-missing behaviour server-side.
|
|
426
|
+
*
|
|
427
|
+
* @param parameters - Universe, sorted-map, and item identifiers,
|
|
428
|
+
* plus any subset of `value`, `ttl`, `sortKey`, and `allowMissing`.
|
|
429
|
+
* @returns A pure {@link HttpRequest} describing the update call.
|
|
430
|
+
*/
|
|
431
|
+
function buildUpdateRequest(parameters) {
|
|
432
|
+
const { allowMissing: shouldAllowMissing, itemId, mapId, universeId } = parameters;
|
|
433
|
+
const base = `/cloud/v2/universes/${encodeURIComponent(universeId)}/memory-store/sorted-maps/${encodeURIComponent(mapId)}/items/${encodeURIComponent(itemId)}`;
|
|
434
|
+
const query = new URLSearchParams();
|
|
435
|
+
if (shouldAllowMissing !== void 0) query.append("allowMissing", String(shouldAllowMissing));
|
|
436
|
+
const queryString = query.toString();
|
|
437
|
+
return {
|
|
438
|
+
body: buildUpdateBody(parameters),
|
|
439
|
+
headers: { "content-type": "application/json" },
|
|
440
|
+
method: "PATCH",
|
|
441
|
+
url: queryString === "" ? base : `${base}?${queryString}`
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
function applySortKeyToBody(body, sortKey) {
|
|
445
|
+
if (sortKey === void 0) return;
|
|
446
|
+
if (sortKey.kind === "string") {
|
|
447
|
+
body["stringSortKey"] = sortKey.value;
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
body["numericSortKey"] = sortKey.value;
|
|
451
|
+
}
|
|
452
|
+
function buildUpdateBody(parameters) {
|
|
453
|
+
const { sortKey, ttl, value } = parameters;
|
|
454
|
+
const body = {};
|
|
455
|
+
if (value !== void 0) body["value"] = value;
|
|
456
|
+
if (ttl !== void 0) body["ttl"] = `${ttl}s`;
|
|
457
|
+
applySortKeyToBody(body, sortKey);
|
|
458
|
+
return body;
|
|
459
|
+
}
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region src/domains/cloud-v2/memory-store-sorted-maps/operations.ts
|
|
462
|
+
const CREATE_PER_MINUTE = 1e6;
|
|
463
|
+
const SECONDS_PER_MINUTE = 60;
|
|
464
|
+
const WRITE_SCOPE = "memory-store.sorted-map:write";
|
|
465
|
+
/**
|
|
466
|
+
* Per-second request ceiling for creating a memory-store sorted-map
|
|
467
|
+
* item, from the Open Cloud OpenAPI schema (1,000,000 requests per
|
|
468
|
+
* minute per API key owner). Keyed independently from the get, update,
|
|
469
|
+
* delete, and list operations so the five do not share a queue.
|
|
470
|
+
*/
|
|
471
|
+
const CREATE_OPERATION_LIMIT = Object.freeze({
|
|
472
|
+
maxPerSecond: CREATE_PER_MINUTE / SECONDS_PER_MINUTE,
|
|
473
|
+
operationKey: "memory-store-sorted-maps.create"
|
|
474
|
+
});
|
|
475
|
+
/**
|
|
476
|
+
* Scopes required to create a memory-store sorted-map item, sourced
|
|
477
|
+
* from `x-roblox-scopes` on the `Cloud_CreateMemoryStoreSortedMapItem`
|
|
478
|
+
* operation in the vendored OpenAPI schema.
|
|
479
|
+
*/
|
|
480
|
+
const CREATE_REQUIRED_SCOPES = Object.freeze([WRITE_SCOPE]);
|
|
481
|
+
/**
|
|
482
|
+
* Per-second request ceiling for deleting a memory-store sorted-map
|
|
483
|
+
* item, from the Open Cloud OpenAPI schema (1,000,000 requests per
|
|
484
|
+
* minute per API key owner).
|
|
485
|
+
*/
|
|
486
|
+
const DELETE_OPERATION_LIMIT = Object.freeze({
|
|
487
|
+
maxPerSecond: 1e6 / SECONDS_PER_MINUTE,
|
|
488
|
+
operationKey: "memory-store-sorted-maps.delete"
|
|
489
|
+
});
|
|
490
|
+
/**
|
|
491
|
+
* Scopes required to delete a memory-store sorted-map item, sourced
|
|
492
|
+
* from `x-roblox-scopes` on the `Cloud_DeleteMemoryStoreSortedMapItem`
|
|
493
|
+
* operation in the vendored OpenAPI schema.
|
|
494
|
+
*/
|
|
495
|
+
const DELETE_REQUIRED_SCOPES = Object.freeze([WRITE_SCOPE]);
|
|
496
|
+
/**
|
|
497
|
+
* Per-second request ceiling for reading a memory-store sorted-map
|
|
498
|
+
* item, from the Open Cloud OpenAPI schema (1,000,000 requests per
|
|
499
|
+
* minute per API key owner).
|
|
500
|
+
*/
|
|
501
|
+
const GET_OPERATION_LIMIT = Object.freeze({
|
|
502
|
+
maxPerSecond: 1e6 / SECONDS_PER_MINUTE,
|
|
503
|
+
operationKey: "memory-store-sorted-maps.get"
|
|
504
|
+
});
|
|
505
|
+
/**
|
|
506
|
+
* Scopes required to read a memory-store sorted-map item, sourced from
|
|
507
|
+
* `x-roblox-scopes` on the `Cloud_GetMemoryStoreSortedMapItem`
|
|
508
|
+
* operation in the vendored OpenAPI schema.
|
|
509
|
+
*/
|
|
510
|
+
const GET_REQUIRED_SCOPES = Object.freeze(["memory-store.sorted-map:read"]);
|
|
511
|
+
/**
|
|
512
|
+
* Per-second request ceiling for listing memory-store sorted-map
|
|
513
|
+
* items, from the Open Cloud OpenAPI schema (1,000,000 requests per
|
|
514
|
+
* minute per API key owner).
|
|
515
|
+
*/
|
|
516
|
+
const LIST_OPERATION_LIMIT = Object.freeze({
|
|
517
|
+
maxPerSecond: 1e6 / SECONDS_PER_MINUTE,
|
|
518
|
+
operationKey: "memory-store-sorted-maps.list"
|
|
519
|
+
});
|
|
520
|
+
/**
|
|
521
|
+
* Scopes required to list memory-store sorted-map items, sourced from
|
|
522
|
+
* `x-roblox-scopes` on the `Cloud_ListMemoryStoreSortedMapItems`
|
|
523
|
+
* operation in the vendored OpenAPI schema.
|
|
524
|
+
*/
|
|
525
|
+
const LIST_REQUIRED_SCOPES = Object.freeze(["memory-store.sorted-map:read"]);
|
|
526
|
+
/**
|
|
527
|
+
* Per-second request ceiling for updating a memory-store sorted-map
|
|
528
|
+
* item, from the Open Cloud OpenAPI schema (1,000,000 requests per
|
|
529
|
+
* minute per API key owner).
|
|
530
|
+
*/
|
|
531
|
+
const UPDATE_OPERATION_LIMIT = Object.freeze({
|
|
532
|
+
maxPerSecond: 1e6 / SECONDS_PER_MINUTE,
|
|
533
|
+
operationKey: "memory-store-sorted-maps.update"
|
|
534
|
+
});
|
|
535
|
+
/**
|
|
536
|
+
* Scopes required to update a memory-store sorted-map item, sourced
|
|
537
|
+
* from `x-roblox-scopes` on the `Cloud_UpdateMemoryStoreSortedMapItem`
|
|
538
|
+
* operation in the vendored OpenAPI schema.
|
|
539
|
+
*/
|
|
540
|
+
const UPDATE_REQUIRED_SCOPES = Object.freeze([WRITE_SCOPE]);
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region src/domains/cloud-v2/memory-store-sorted-maps/parsers.ts
|
|
543
|
+
const PATH_PATTERN = /^cloud\/v2\/universes\/(\d+)\/memory-stores?\/sorted-maps\/([^/]+)\/items\/([^/]+)$/;
|
|
544
|
+
const MALFORMED_MESSAGE = "Malformed memory-store sorted-map item response";
|
|
545
|
+
const MALFORMED_LIST_MESSAGE = "Malformed memory-store sorted-map list response";
|
|
546
|
+
/**
|
|
547
|
+
* Parses a successful memory-store sorted-map item response body (the
|
|
548
|
+
* happy path for create, get, and update) into the public
|
|
549
|
+
* {@link SortedMapItem} shape.
|
|
550
|
+
*
|
|
551
|
+
* @param response - The full {@link HttpResponse} from the Open Cloud API.
|
|
552
|
+
* @returns A success result wrapping the parsed {@link SortedMapItem},
|
|
553
|
+
* or an {@link ApiError} when the body does not match the wire schema.
|
|
554
|
+
*/
|
|
555
|
+
function parseSortedMapItemResponse(response) {
|
|
556
|
+
const item = wireBodyToSortedMapItem(response.body);
|
|
557
|
+
if (item === void 0) return malformedSortedMapItem(response.status);
|
|
558
|
+
return {
|
|
559
|
+
data: item,
|
|
560
|
+
success: true
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Parses a successful `Cloud_ListMemoryStoreSortedMapItems` response
|
|
565
|
+
* body into the public {@link ListSortedMapItemsResult} shape. Each
|
|
566
|
+
* item in the `items` array is validated through the same
|
|
567
|
+
* path-and-shape checks as {@link parseSortedMapItemResponse}; a
|
|
568
|
+
* malformed entry rejects the whole response.
|
|
569
|
+
*
|
|
570
|
+
* @param response - The full {@link HttpResponse} from the Open Cloud API.
|
|
571
|
+
* @returns A success result wrapping the parsed
|
|
572
|
+
* {@link ListSortedMapItemsResult}, or an {@link ApiError} when the
|
|
573
|
+
* response shape is wrong.
|
|
574
|
+
*/
|
|
575
|
+
function parseListResponse(response) {
|
|
576
|
+
const { body, status: statusCode } = response;
|
|
577
|
+
if (!isRecord(body)) return malformedList(statusCode);
|
|
578
|
+
const { items: rawItemsField, nextPageToken } = body;
|
|
579
|
+
if (rawItemsField !== void 0 && rawItemsField !== null && !Array.isArray(rawItemsField)) return malformedList(statusCode);
|
|
580
|
+
const normalizedToken = nextPageToken ?? void 0;
|
|
581
|
+
if (normalizedToken !== void 0 && typeof normalizedToken !== "string") return malformedList(statusCode);
|
|
582
|
+
const items = (rawItemsField ?? []).map(wireBodyToSortedMapItem);
|
|
583
|
+
if (!items.every(isSortedMapItem)) return malformedList(statusCode);
|
|
584
|
+
return {
|
|
585
|
+
data: {
|
|
586
|
+
items,
|
|
587
|
+
nextPageToken: normalizedToken
|
|
588
|
+
},
|
|
589
|
+
success: true
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
function isSortedMapItemWire(body) {
|
|
593
|
+
if (!isRecord(body)) return false;
|
|
594
|
+
const { id, etag, expireTime, numericSortKey, path, stringSortKey, value } = body;
|
|
595
|
+
return typeof path === "string" && typeof etag === "string" && typeof id === "string" && isDateTimeString(expireTime) && value !== void 0 && (stringSortKey === void 0 || stringSortKey === null || typeof stringSortKey === "string") && (numericSortKey === void 0 || numericSortKey === null || typeof numericSortKey === "number");
|
|
596
|
+
}
|
|
597
|
+
function extractSortKey(body) {
|
|
598
|
+
const hasStringKey = typeof body.stringSortKey === "string";
|
|
599
|
+
const hasNumericKey = typeof body.numericSortKey === "number";
|
|
600
|
+
if (hasStringKey && hasNumericKey) return "conflict";
|
|
601
|
+
if (hasStringKey) return {
|
|
602
|
+
kind: "string",
|
|
603
|
+
value: body.stringSortKey
|
|
604
|
+
};
|
|
605
|
+
if (hasNumericKey) return {
|
|
606
|
+
kind: "numeric",
|
|
607
|
+
value: body.numericSortKey
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
function wireBodyToSortedMapItem(body) {
|
|
611
|
+
if (!isSortedMapItemWire(body)) return;
|
|
612
|
+
const match = PATH_PATTERN.exec(body.path);
|
|
613
|
+
const universeId = match?.[1];
|
|
614
|
+
const mapId = match?.[2];
|
|
615
|
+
if (universeId === void 0 || mapId === void 0) return;
|
|
616
|
+
const sortKey = extractSortKey(body);
|
|
617
|
+
if (sortKey === "conflict") return;
|
|
618
|
+
return {
|
|
619
|
+
id: body.id,
|
|
620
|
+
etag: body.etag,
|
|
621
|
+
expiresAt: new Date(body.expireTime),
|
|
622
|
+
mapId,
|
|
623
|
+
sortKey,
|
|
624
|
+
universeId,
|
|
625
|
+
value: body.value
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
function malformedSortedMapItem(statusCode) {
|
|
629
|
+
return {
|
|
630
|
+
err: new ApiError(MALFORMED_MESSAGE, { statusCode }),
|
|
631
|
+
success: false
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
function isSortedMapItem(item) {
|
|
635
|
+
return item !== void 0;
|
|
636
|
+
}
|
|
637
|
+
function malformedList(statusCode) {
|
|
638
|
+
return {
|
|
639
|
+
err: new ApiError(MALFORMED_LIST_MESSAGE, { statusCode }),
|
|
640
|
+
success: false
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region src/resources/storage/sorted-maps-group.ts
|
|
645
|
+
function makeSpec(spec) {
|
|
646
|
+
return Object.freeze(spec);
|
|
647
|
+
}
|
|
648
|
+
const CREATE_SPEC = makeSpec({
|
|
649
|
+
buildRequest: (parameters) => okRequest(buildCreateRequest(parameters)),
|
|
650
|
+
methodDefaults: CREATE_METHOD_DEFAULTS,
|
|
651
|
+
methodKind: "create",
|
|
652
|
+
operationLimit: CREATE_OPERATION_LIMIT,
|
|
653
|
+
parse: parseSortedMapItemResponse,
|
|
654
|
+
requiredScopes: CREATE_REQUIRED_SCOPES
|
|
655
|
+
});
|
|
656
|
+
const DELETE_SPEC = makeSpec({
|
|
657
|
+
buildRequest: (parameters) => okRequest(buildDeleteRequest(parameters)),
|
|
658
|
+
methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
|
|
659
|
+
methodKind: "idempotent",
|
|
660
|
+
operationLimit: DELETE_OPERATION_LIMIT,
|
|
661
|
+
parse: parseEmptyResponse,
|
|
662
|
+
requiredScopes: DELETE_REQUIRED_SCOPES
|
|
663
|
+
});
|
|
664
|
+
const GET_SPEC = makeSpec({
|
|
665
|
+
buildRequest: (parameters) => okRequest(buildGetRequest(parameters)),
|
|
666
|
+
methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
|
|
667
|
+
methodKind: "idempotent",
|
|
668
|
+
operationLimit: GET_OPERATION_LIMIT,
|
|
669
|
+
parse: parseSortedMapItemResponse,
|
|
670
|
+
requiredScopes: GET_REQUIRED_SCOPES
|
|
671
|
+
});
|
|
672
|
+
const LIST_SPEC = makeSpec({
|
|
673
|
+
buildRequest: (parameters) => okRequest(buildListRequest(parameters)),
|
|
674
|
+
methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
|
|
675
|
+
methodKind: "idempotent",
|
|
676
|
+
operationLimit: LIST_OPERATION_LIMIT,
|
|
677
|
+
parse: parseListResponse,
|
|
678
|
+
requiredScopes: LIST_REQUIRED_SCOPES
|
|
679
|
+
});
|
|
680
|
+
const UPDATE_SPEC = makeSpec({
|
|
681
|
+
buildRequest: (parameters) => okRequest(buildUpdateRequest(parameters)),
|
|
682
|
+
methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
|
|
683
|
+
methodKind: "idempotent",
|
|
684
|
+
operationLimit: UPDATE_OPERATION_LIMIT,
|
|
685
|
+
parse: parseSortedMapItemResponse,
|
|
686
|
+
requiredScopes: UPDATE_REQUIRED_SCOPES
|
|
687
|
+
});
|
|
688
|
+
/**
|
|
689
|
+
* Operation Group on `StorageClient` that exposes the memory-store
|
|
690
|
+
* sorted-map endpoints. Sorted maps are ordered collections of
|
|
691
|
+
* (id, value, sortKey) triples; consumers create, read, update, list,
|
|
692
|
+
* and delete items keyed by a caller-supplied identifier and ordered
|
|
693
|
+
* by an optional string or numeric sort key.
|
|
694
|
+
*/
|
|
695
|
+
var MemoryStoreSortedMapsGroup = class {
|
|
696
|
+
#inner;
|
|
697
|
+
/**
|
|
698
|
+
* Wraps the shared {@link ResourceClient} so the Operation Group
|
|
699
|
+
* routes calls through the same retry, hooks, and rate-limit queues
|
|
700
|
+
* as the rest of the parent client.
|
|
701
|
+
*
|
|
702
|
+
* @param inner - The shared {@link ResourceClient} owned by the
|
|
703
|
+
* parent client.
|
|
704
|
+
*/
|
|
705
|
+
constructor(inner) {
|
|
706
|
+
this.#inner = inner;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Creates a single item in a sorted map. The sorted map is
|
|
710
|
+
* auto-created on first use; the map identifier is any string the
|
|
711
|
+
* caller picks. Items are keyed by `itemId` (case-sensitive) and
|
|
712
|
+
* ordered by an optional `sortKey`. Items expire and are removed
|
|
713
|
+
* automatically after `ttl` seconds, or after a server-default
|
|
714
|
+
* lifetime when omitted.
|
|
715
|
+
*
|
|
716
|
+
* On 5xx, create does not retry: Roblox Open Cloud has no
|
|
717
|
+
* idempotency-key support, so a retry of a transient failure risks
|
|
718
|
+
* producing a duplicate item.
|
|
719
|
+
*
|
|
720
|
+
* @param parameters - Universe, sorted-map, item identifiers, the
|
|
721
|
+
* value to store, and optional `sortKey` and `ttl`.
|
|
722
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
723
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
724
|
+
* @returns A {@link Result} wrapping the parsed {@link SortedMapItem}
|
|
725
|
+
* or the {@link OpenCloudError} that caused the request to fail.
|
|
726
|
+
*/
|
|
727
|
+
async create(parameters, options) {
|
|
728
|
+
return this.#inner.execute({
|
|
729
|
+
options,
|
|
730
|
+
parameters,
|
|
731
|
+
spec: CREATE_SPEC
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Removes a single item from a sorted map. The call is idempotent:
|
|
736
|
+
* a second `delete` against the same item is a no-op once the
|
|
737
|
+
* server has dropped the row. The retry policy retries both 429
|
|
738
|
+
* and 5xx.
|
|
739
|
+
*
|
|
740
|
+
* @param parameters - Universe, sorted-map, and item identifiers.
|
|
741
|
+
* @param options - Optional per-request overrides.
|
|
742
|
+
* @returns A {@link Result} wrapping `undefined` on success or the
|
|
743
|
+
* {@link OpenCloudError} that caused the request to fail.
|
|
744
|
+
*/
|
|
745
|
+
async delete(parameters, options) {
|
|
746
|
+
return this.#inner.execute({
|
|
747
|
+
options,
|
|
748
|
+
parameters,
|
|
749
|
+
spec: DELETE_SPEC
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Reads a single item from a sorted map. Returns the parsed
|
|
754
|
+
* {@link SortedMapItem} with the server-recorded `etag` for use in
|
|
755
|
+
* subsequent conditional updates (once the SDK begins emitting
|
|
756
|
+
* `If-Match`; see the package README).
|
|
757
|
+
*
|
|
758
|
+
* @param parameters - Universe, sorted-map, and item identifiers.
|
|
759
|
+
* @param options - Optional per-request overrides.
|
|
760
|
+
* @returns A {@link Result} wrapping the parsed {@link SortedMapItem}
|
|
761
|
+
* or the {@link OpenCloudError} that caused the request to fail.
|
|
762
|
+
*/
|
|
763
|
+
async get(parameters, options) {
|
|
764
|
+
return this.#inner.execute({
|
|
765
|
+
options,
|
|
766
|
+
parameters,
|
|
767
|
+
spec: GET_SPEC
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Lists items in a sorted map. The server caps `maxPageSize` at
|
|
772
|
+
* `100` and defaults it to `1` when omitted, so callers explicitly
|
|
773
|
+
* pass `maxPageSize` to retrieve more than a single item per page.
|
|
774
|
+
* The `filter` parameter accepts a CEL expression on `id` and
|
|
775
|
+
* `sortKey` (operators `<`, `>`, `&&` only).
|
|
776
|
+
*
|
|
777
|
+
* @param parameters - Universe and sorted-map identifiers, plus
|
|
778
|
+
* optional pagination and filter parameters.
|
|
779
|
+
* @param options - Optional per-request overrides.
|
|
780
|
+
* @returns A {@link Result} wrapping the parsed
|
|
781
|
+
* {@link ListSortedMapItemsResult} or the {@link OpenCloudError}
|
|
782
|
+
* that caused the request to fail.
|
|
783
|
+
*/
|
|
784
|
+
async list(parameters, options) {
|
|
785
|
+
return this.#inner.execute({
|
|
786
|
+
options,
|
|
787
|
+
parameters,
|
|
788
|
+
spec: LIST_SPEC
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Updates a sorted-map item under PATCH semantics: omitted body
|
|
793
|
+
* fields are left unchanged on the server, supplied fields replace
|
|
794
|
+
* their existing values. Passing `allowMissing: true` creates the
|
|
795
|
+
* item when no row exists instead of returning 404.
|
|
796
|
+
*
|
|
797
|
+
* Retries 5xx because PATCH with the same body produces the same
|
|
798
|
+
* server state.
|
|
799
|
+
*
|
|
800
|
+
* @param parameters - Universe, sorted-map, and item identifiers,
|
|
801
|
+
* plus any subset of `value`, `ttl`, `sortKey`, and
|
|
802
|
+
* `allowMissing`.
|
|
803
|
+
* @param options - Optional per-request overrides.
|
|
804
|
+
* @returns A {@link Result} wrapping the parsed {@link SortedMapItem}
|
|
805
|
+
* or the {@link OpenCloudError} that caused the request to fail.
|
|
806
|
+
*/
|
|
807
|
+
async update(parameters, options) {
|
|
808
|
+
return this.#inner.execute({
|
|
809
|
+
options,
|
|
810
|
+
parameters,
|
|
811
|
+
spec: UPDATE_SPEC
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
//#endregion
|
|
334
816
|
//#region src/resources/storage/client.ts
|
|
335
817
|
/**
|
|
336
818
|
* Public client for the Roblox Open Cloud `Data and memory stores`
|
|
337
819
|
* Feature. Today it covers memory-store queues via the
|
|
338
|
-
* {@link StorageClient.queues} Operation Group
|
|
339
|
-
*
|
|
340
|
-
* same
|
|
820
|
+
* {@link StorageClient.queues} Operation Group and memory-store sorted
|
|
821
|
+
* maps via the {@link StorageClient.sortedMaps} Operation Group; a
|
|
822
|
+
* future data-stores Operation Group slots in as a sibling on the same
|
|
823
|
+
* client.
|
|
341
824
|
*
|
|
342
825
|
* Every method returns a `Result` so callers handle failure
|
|
343
826
|
* explicitly; no thrown error ever escapes the client.
|
|
344
827
|
*
|
|
828
|
+
* @since 0.1.0
|
|
829
|
+
*
|
|
345
830
|
* @example
|
|
346
831
|
*
|
|
347
832
|
* ```ts
|
|
@@ -354,6 +839,8 @@ var MemoryStoreQueuesGroup = class {
|
|
|
354
839
|
var StorageClient = class {
|
|
355
840
|
/** Memory-store queue Operation Group. */
|
|
356
841
|
queues;
|
|
842
|
+
/** Memory-store sorted-map Operation Group. */
|
|
843
|
+
sortedMaps;
|
|
357
844
|
/**
|
|
358
845
|
* Creates a new {@link StorageClient}. Configuration is frozen on
|
|
359
846
|
* construction; per-request overrides are accepted on each method.
|
|
@@ -363,6 +850,7 @@ var StorageClient = class {
|
|
|
363
850
|
constructor(options) {
|
|
364
851
|
const inner = new ResourceClient(options);
|
|
365
852
|
this.queues = new MemoryStoreQueuesGroup(inner);
|
|
853
|
+
this.sortedMaps = new MemoryStoreSortedMapsGroup(inner);
|
|
366
854
|
}
|
|
367
855
|
};
|
|
368
856
|
//#endregion
|