@bedrock-rbx/ocale 0.1.0-beta.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -0
- package/dist/badges.d.mts +33 -2
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +16 -4
- package/dist/badges.mjs.map +1 -1
- package/dist/{data.generated-Cb6g6asv.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 +32 -8
- 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 +30 -6
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +21 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -5
- 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 +22 -3
- package/dist/luau-execution.d.mts.map +1 -1
- package/dist/luau-execution.mjs +29 -13
- package/dist/luau-execution.mjs.map +1 -1
- package/dist/places.d.mts +20 -2
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +34 -14
- package/dist/places.mjs.map +1 -1
- package/dist/{poll-timeout-Dg_QFEqi.mjs → poll-timeout-C0nmJzOd.mjs} +6 -2
- package/dist/poll-timeout-C0nmJzOd.mjs.map +1 -0
- package/dist/{polling-helpers-CS00apdU.mjs → polling-helpers-BcycDhDm.mjs} +225 -78
- package/dist/polling-helpers-BcycDhDm.mjs.map +1 -0
- package/dist/{polling-BMrYajok.d.mts → polling-rj0dGREg.d.mts} +73 -14
- package/dist/polling-rj0dGREg.d.mts.map +1 -0
- package/dist/{price-information-DIrvwCmd.mjs → price-information-DK83Wul1.mjs} +2 -2
- package/dist/{price-information-DIrvwCmd.mjs.map → price-information-DK83Wul1.mjs.map} +1 -1
- package/dist/{rate-limit-D1q2Js-z.mjs → rate-limit-Co9i28qi.mjs} +30 -2
- package/dist/rate-limit-Co9i28qi.mjs.map +1 -0
- package/dist/{resource-client-D6Efj9fU.mjs → resource-client-C_D--PYX.mjs} +328 -243
- package/dist/resource-client-C_D--PYX.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-B5Fojgn0.mjs → signatures-JF-7Psce.mjs} +1 -1
- package/dist/{signatures-B5Fojgn0.mjs.map → signatures-JF-7Psce.mjs.map} +1 -1
- package/dist/storage.d.mts +30 -27
- package/dist/storage.d.mts.map +1 -1
- package/dist/storage.mjs +46 -31
- package/dist/storage.mjs.map +1 -1
- package/dist/testing.d.mts +24 -9
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +2 -2
- package/dist/testing.mjs.map +1 -1
- package/dist/{to-blob-B27VhoRp.mjs → to-blob-RPqMBuft.mjs} +1 -1
- package/dist/{to-blob-B27VhoRp.mjs.map → to-blob-RPqMBuft.mjs.map} +1 -1
- package/dist/{types-CwtZT1ek.d.mts → types-CRiJg5EQ.d.mts} +46 -4
- package/dist/types-CRiJg5EQ.d.mts.map +1 -0
- package/dist/universes.d.mts +47 -5
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +31 -15
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-DkL5KQqz.mjs → validation-9oU6qNNQ.mjs} +4 -2
- package/dist/validation-9oU6qNNQ.mjs.map +1 -0
- package/dist/{wire-CeL6W_V7.d.mts → wire-D3K-a-UP.d.mts} +3 -1
- package/dist/wire-D3K-a-UP.d.mts.map +1 -0
- package/package.json +7 -6
- package/dist/data.generated-Cb6g6asv.d.mts.map +0 -1
- package/dist/permission-error-DOVtNq3A.mjs +0 -46
- package/dist/permission-error-DOVtNq3A.mjs.map +0 -1
- package/dist/poll-timeout-Dg_QFEqi.mjs.map +0 -1
- package/dist/polling-BMrYajok.d.mts.map +0 -1
- package/dist/polling-helpers-CS00apdU.mjs.map +0 -1
- package/dist/rate-limit-BYuizHoD.d.mts +0 -92
- package/dist/rate-limit-BYuizHoD.d.mts.map +0 -1
- package/dist/rate-limit-D1q2Js-z.mjs.map +0 -1
- package/dist/resource-client-D6Efj9fU.mjs.map +0 -1
- package/dist/types-CwtZT1ek.d.mts.map +0 -1
- package/dist/validation-DkL5KQqz.mjs.map +0 -1
- package/dist/wire-CeL6W_V7.d.mts.map +0 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { d as OpenCloudError } from "./types-CRiJg5EQ.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/api-error.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for constructing an {@link ApiError}.
|
|
6
|
+
*
|
|
7
|
+
* @since 0.1.0
|
|
8
|
+
*/
|
|
9
|
+
interface ApiErrorOptions extends ErrorOptions {
|
|
10
|
+
/** Optional machine-readable error code from the API. */
|
|
11
|
+
code?: string | undefined;
|
|
12
|
+
/** Parsed response body, when present. */
|
|
13
|
+
details?: JSONValue | undefined;
|
|
14
|
+
/** HTTP status code from the API response. */
|
|
15
|
+
statusCode: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Thrown when the Roblox Open Cloud API returns a non-2xx response
|
|
19
|
+
* that is not a rate limit (429).
|
|
20
|
+
*
|
|
21
|
+
* @since 0.1.0
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { ApiError } from "@bedrock-rbx/ocale";
|
|
27
|
+
*
|
|
28
|
+
* const error = new ApiError("HTTP 404: Pass not found (code NotFound)", {
|
|
29
|
+
* code: "NotFound",
|
|
30
|
+
* details: { errorCode: "NotFound", message: "Pass not found" },
|
|
31
|
+
* statusCode: 404,
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* expect(error).toBeInstanceOf(ApiError);
|
|
35
|
+
* expect(error.statusCode).toBe(404);
|
|
36
|
+
* expect(error.code).toBe("NotFound");
|
|
37
|
+
* expect(error.details).toEqual({
|
|
38
|
+
* errorCode: "NotFound",
|
|
39
|
+
* message: "Pass not found",
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare class ApiError extends OpenCloudError {
|
|
44
|
+
readonly code: string | undefined;
|
|
45
|
+
readonly details: JSONValue | undefined;
|
|
46
|
+
override readonly name: string;
|
|
47
|
+
readonly statusCode: number;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new ApiError.
|
|
50
|
+
*
|
|
51
|
+
* @param message - Human-readable error description.
|
|
52
|
+
* @param options - Error options including status code, optional error
|
|
53
|
+
* code, and the parsed response body when present.
|
|
54
|
+
*/
|
|
55
|
+
constructor(message: string, options: ApiErrorOptions);
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/errors/network-error.d.ts
|
|
59
|
+
/**
|
|
60
|
+
* Options for constructing a {@link NetworkError}.
|
|
61
|
+
*
|
|
62
|
+
* @since 0.1.0
|
|
63
|
+
*/
|
|
64
|
+
interface NetworkErrorOptions extends ErrorOptions {
|
|
65
|
+
/** HTTP method of the request that failed. */
|
|
66
|
+
method?: string | undefined;
|
|
67
|
+
/** Fully-qualified URL of the request that failed. */
|
|
68
|
+
url?: string | undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Thrown when a network-level failure prevents the request from reaching
|
|
72
|
+
* the Roblox Open Cloud API (e.g., DNS resolution failure, connection reset).
|
|
73
|
+
* The `method` and `url` name the failing call so a transport failure that
|
|
74
|
+
* survives every retry can be diagnosed; the underlying transport error is
|
|
75
|
+
* carried on `cause`.
|
|
76
|
+
*
|
|
77
|
+
* @since 0.1.0
|
|
78
|
+
*/
|
|
79
|
+
declare class NetworkError extends OpenCloudError {
|
|
80
|
+
readonly method: string | undefined;
|
|
81
|
+
override readonly name: string;
|
|
82
|
+
readonly url: string | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Creates a new NetworkError.
|
|
85
|
+
*
|
|
86
|
+
* @param message - Human-readable error description.
|
|
87
|
+
* @param options - Error options including the optional `cause` and the
|
|
88
|
+
* `method` / `url` of the request that failed.
|
|
89
|
+
*/
|
|
90
|
+
constructor(message: string, options?: NetworkErrorOptions);
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/errors/rate-limit.d.ts
|
|
94
|
+
/**
|
|
95
|
+
* Options for constructing a {@link RateLimitError}.
|
|
96
|
+
*
|
|
97
|
+
* @since 0.1.0
|
|
98
|
+
*/
|
|
99
|
+
interface RateLimitErrorOptions extends ErrorOptions {
|
|
100
|
+
/**
|
|
101
|
+
* Requests still allowed in the throttled window, read from
|
|
102
|
+
* `x-ratelimit-remaining` (the most-constrained window). `undefined` when
|
|
103
|
+
* the header is absent or carries no finite numeric token; parsed
|
|
104
|
+
* independently of `x-ratelimit-reset`, so a valid value survives a
|
|
105
|
+
* non-numeric reset. Typically `0` on a genuine 429.
|
|
106
|
+
*/
|
|
107
|
+
remaining?: number | undefined;
|
|
108
|
+
/** Seconds to wait before retrying the request. */
|
|
109
|
+
retryAfterSeconds: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Thrown when the Roblox Open Cloud API returns a 429 Too Many Requests response.
|
|
113
|
+
* Contains the server-suggested retry delay.
|
|
114
|
+
*
|
|
115
|
+
* @since 0.1.0
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
*
|
|
119
|
+
* ```ts
|
|
120
|
+
* import { RateLimitError } from "@bedrock-rbx/ocale";
|
|
121
|
+
*
|
|
122
|
+
* const error = new RateLimitError("Too many requests", {
|
|
123
|
+
* retryAfterSeconds: 30,
|
|
124
|
+
* });
|
|
125
|
+
*
|
|
126
|
+
* expect(error).toBeInstanceOf(RateLimitError);
|
|
127
|
+
* expect(error.retryAfterSeconds).toBe(30);
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
declare class RateLimitError extends OpenCloudError {
|
|
131
|
+
override readonly name = "RateLimitError";
|
|
132
|
+
/** Requests left in the throttled window, or `undefined` if not reported. */
|
|
133
|
+
readonly remaining: number | undefined;
|
|
134
|
+
readonly retryAfterSeconds: number;
|
|
135
|
+
/**
|
|
136
|
+
* Creates a new RateLimitError.
|
|
137
|
+
*
|
|
138
|
+
* @param message - Human-readable error description.
|
|
139
|
+
* @param options - Error options including the retry delay.
|
|
140
|
+
*/
|
|
141
|
+
constructor(message: string, options: RateLimitErrorOptions);
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/internal/http/retry.d.ts
|
|
145
|
+
/**
|
|
146
|
+
* Fully-resolved retry config shape that {@link mergeConfig} and
|
|
147
|
+
* {@link shouldRetry} operate on. Fields are required because this represents
|
|
148
|
+
* the post-defaulting, internal view; callers should supply every field (or
|
|
149
|
+
* resolve them via a test factory / client constructor). The partial,
|
|
150
|
+
* user-facing type lives on client construction options; method defaults and
|
|
151
|
+
* per-request overrides use `Partial<RetryResolvable>`.
|
|
152
|
+
*/
|
|
153
|
+
interface RetryResolvable {
|
|
154
|
+
/** Roblox Open Cloud API key. */
|
|
155
|
+
readonly apiKey: string;
|
|
156
|
+
/** Base URL for the Open Cloud API. */
|
|
157
|
+
readonly baseUrl: string;
|
|
158
|
+
/** Maximum retry attempts before giving up. */
|
|
159
|
+
readonly maxRetries: number;
|
|
160
|
+
/** Status codes that are eligible for retry. */
|
|
161
|
+
readonly retryableStatuses: ReadonlyArray<number>;
|
|
162
|
+
/**
|
|
163
|
+
* Node-style transport error codes ({@link findErrorCode}) eligible for
|
|
164
|
+
* retry when surfaced as a {@link NetworkError}. Empty for create
|
|
165
|
+
* operations by default; consumers opt a create in via a per-request
|
|
166
|
+
* override.
|
|
167
|
+
*/
|
|
168
|
+
readonly retryableTransportCodes: ReadonlyArray<string>;
|
|
169
|
+
/** Fallback delay function when no server hint is available. */
|
|
170
|
+
readonly retryDelay: (attempt: number) => number;
|
|
171
|
+
/** Per-request timeout in milliseconds. */
|
|
172
|
+
readonly timeout: number;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Transient transport error codes that are safe to retry for idempotent
|
|
176
|
+
* operations. Connection resets, timeouts, and DNS hiccups are recoverable on
|
|
177
|
+
* a retry. A self-aborted request timeout carries no OS-level `code`, so
|
|
178
|
+
* {@link shouldRetry} folds it into this set as `ETIMEDOUT` (via
|
|
179
|
+
* {@link isTimeoutAbort}) for idempotent methods; create methods retry no
|
|
180
|
+
* transport codes and so still never re-issue a timed-out write.
|
|
181
|
+
*
|
|
182
|
+
* @since 0.1.0
|
|
183
|
+
*/
|
|
184
|
+
declare const TRANSIENT_TRANSPORT_CODES: ReadonlyArray<string>;
|
|
185
|
+
/** Kind of HTTP method the merge is being performed for. */
|
|
186
|
+
type MethodKind = "create" | "idempotent";
|
|
187
|
+
//#endregion
|
|
188
|
+
export { RateLimitErrorOptions as a, ApiError as c, RateLimitError as i, ApiErrorOptions as l, RetryResolvable as n, NetworkError as o, TRANSIENT_TRANSPORT_CODES as r, NetworkErrorOptions as s, MethodKind as t };
|
|
189
|
+
//# sourceMappingURL=retry-r1TXe5Zd.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-r1TXe5Zd.d.mts","names":[],"sources":["../src/errors/api-error.ts","../src/errors/network-error.ts","../src/errors/rate-limit.ts","../src/internal/http/retry.ts"],"mappings":";;;;;AAOA;;;UAAiB,eAAA,SAAwB,YAAA;;EAExC,IAAA;;EAEA,OAAA,GAAU,SAAA;;EAEV,UAAA;AAAA;AA6BD;;;;;;;;;;;;;;;;;;;AAauC;;;;AChDvC;;;ADmCA,cAAa,QAAA,SAAiB,cAAA;EAAA,SACb,IAAA;EAAA,SACA,OAAA,EAAS,SAAA;EAAA,kBACA,IAAA;EAAA,SACT,UAAA;ECnChB;AAYD;;;;;;EDgCC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,eAAA;AAAA;;;;;AAhDvC;;;UCAiB,mBAAA,SAA4B,YAAA;;EAE5C,MAAA;;EAEA,GAAA;AAAA;;ADEA;AA6BD;;;;;;;cCnBa,YAAA,SAAqB,cAAA;EAAA,SACjB,MAAA;EAAA,kBACS,IAAA;EAAA,SACT,GAAA;;;;;;;;EAShB,WAAA,CAAY,OAAA,UAAiB,OAAA,GAAU,mBAAA;AAAA;;;;;AD5BxC;;;UEAiB,qBAAA,SAA8B,YAAA;;;;;;;AFM9C;EEEA,SAAA;EF2BY;EEzBZ,iBAAA;AAAA;;;;;;;;;;;;;;;;AFsCsC;;;;cEhB1B,cAAA,SAAuB,cAAA;EAAA,kBACV,IAAA;;WAET,SAAA;EAAA,SACA,iBAAA;;;;ADhChB;AAYD;;EC4BC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,qBAAA;AAAA;;;AF5CvC;;;;;;;;AAAA,UGMiB,eAAA;EHAhB;EAAA,SGES,MAAA;EH2BV;EAAA,SGzBU,OAAA;;WAEA,UAAA;;WAEA,iBAAA,EAAmB,aAAA;EHqBC;;;;;;EAAA,SGdpB,uBAAA,EAAyB,aAAA;;WAEzB,UAAA,GAAa,OAAA;;WAEb,OAAA;AAAA;;AHuB6B;;;;AChDvC;;;;;cEsCa,yBAAA,EAA2B,aAAA;;KAsC5B,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signatures-
|
|
1
|
+
{"version":3,"file":"signatures-JF-7Psce.mjs","names":[],"sources":["../src/domains/universes/places/signatures.ts"],"sourcesContent":["/**\n * Magic-byte prefix every Roblox binary place file (`.rbxl`) starts with.\n * The first 8 bytes spell out `<roblox!` in ASCII; the remaining 6 bytes\n * (`\\x89\\xff\\r\\n\\x1a\\n`) are the binary-format marker that distinguishes a\n * binary place file from the XML form (`.rbxlx`), whose ASCII-only header\n * begins with `<roblox `.\n */\nexport const RBXL_SIGNATURE: Readonly<Uint8Array<ArrayBuffer>> = new Uint8Array([\n\t0x3c, 0x72, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x21, 0x89, 0xff, 0x0d, 0x0a, 0x1a, 0x0a,\n]);\n\n/**\n * Magic-byte prefix every Roblox XML place file (`.rbxlx`) starts with.\n * Equivalent to the ASCII string `<roblox ` (note the trailing space): a\n * well-formed rbxlx file opens with `<roblox` followed by attributes, while\n * an rbxl file uses `<roblox!` (exclamation mark) as the eighth byte. The\n * trailing space is what proves the file is the XML variant rather than\n * the binary one.\n */\nexport const RBXLX_SIGNATURE: Readonly<Uint8Array<ArrayBuffer>> = new Uint8Array([\n\t0x3c, 0x72, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x20,\n]);\n\n/**\n * Reports whether `body` begins with `signature`. A pure byte-prefix check\n * with no allocation; used by the place builder to disambiguate `.rbxl` and\n * `.rbxlx` payloads against their declared `format`.\n *\n * @param body - The caller-supplied place file bytes.\n * @param signature - One of the frozen signature constants from this module.\n * @returns `true` if every byte of `signature` matches `body[0..signature.length]`.\n */\nexport function matchesSignature(\n\tbody: Uint8Array,\n\tsignature: Readonly<Uint8Array<ArrayBuffer>>,\n): boolean {\n\tfor (const [index, expected] of signature.entries()) {\n\t\tif (body[index] !== expected) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,iBAAoD,IAAI,WAAW;CAC/E;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAC/E,CAAC;;;;;;;;;AAUD,MAAa,kBAAqD,IAAI,WAAW;CAChF;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAC3C,CAAC;;;;;;;;;;AAWD,SAAgB,iBACf,MACA,WACU;CACV,KAAK,MAAM,CAAC,OAAO,aAAa,UAAU,QAAQ,GACjD,IAAI,KAAK,WAAW,UACnB,OAAO;CAIT,OAAO;AACR"}
|
package/dist/storage.d.mts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, n as HttpRequest, r as HttpResponse, s as RequestOptions, u as SleepFunc } from "./types-
|
|
1
|
+
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, n as HttpRequest, r as HttpResponse, s as RequestOptions, u as SleepFunc } from "./types-CRiJg5EQ.mjs";
|
|
2
|
+
import { n as RetryResolvable, t as MethodKind } from "./retry-r1TXe5Zd.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/domains/cloud-v2/memory-store-queues/types.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* Caller-supplied input for the `enqueue` method on `StorageClient.queues`.
|
|
6
7
|
* Mirrors `Cloud_CreateMemoryStoreQueueItem` on the Open Cloud API.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.1.0
|
|
7
10
|
*/
|
|
8
11
|
interface EnqueueQueueItemParameters {
|
|
9
12
|
/**
|
|
@@ -34,6 +37,8 @@ interface EnqueueQueueItemParameters {
|
|
|
34
37
|
* Parsed representation of a memory-store queue item, as returned by the
|
|
35
38
|
* Open Cloud `Cloud_CreateMemoryStoreQueueItem` and (inside the array)
|
|
36
39
|
* `Cloud_ReadMemoryStoreQueueItems` endpoints.
|
|
40
|
+
*
|
|
41
|
+
* @since 0.1.0
|
|
37
42
|
*/
|
|
38
43
|
interface QueueItem {
|
|
39
44
|
/** Server-generated item identifier, parsed from the wire `path`. */
|
|
@@ -55,6 +60,8 @@ interface QueueItem {
|
|
|
55
60
|
/**
|
|
56
61
|
* Caller-supplied input for the `dequeue` method on
|
|
57
62
|
* `StorageClient.queues`. Mirrors `Cloud_ReadMemoryStoreQueueItems`.
|
|
63
|
+
*
|
|
64
|
+
* @since 0.1.0
|
|
58
65
|
*/
|
|
59
66
|
interface DequeueQueueItemsParameters {
|
|
60
67
|
/**
|
|
@@ -84,6 +91,8 @@ interface DequeueQueueItemsParameters {
|
|
|
84
91
|
* response. The `readId` value must be passed to a subsequent
|
|
85
92
|
* `discard` call to acknowledge the items; otherwise the items reappear
|
|
86
93
|
* once the invisibility window elapses.
|
|
94
|
+
*
|
|
95
|
+
* @since 0.1.0
|
|
87
96
|
*/
|
|
88
97
|
interface DequeueResult {
|
|
89
98
|
/** Items dequeued from the front of the queue, in dequeue order. */
|
|
@@ -100,6 +109,8 @@ interface DequeueResult {
|
|
|
100
109
|
* Acknowledging a `readId` removes the dequeued batch from the queue
|
|
101
110
|
* permanently; without `discard`, the items reappear once their
|
|
102
111
|
* invisibility window elapses.
|
|
112
|
+
*
|
|
113
|
+
* @since 0.1.0
|
|
103
114
|
*/
|
|
104
115
|
interface DiscardQueueItemsParameters {
|
|
105
116
|
/** Stringified queue identifier. */
|
|
@@ -116,6 +127,8 @@ interface DiscardQueueItemsParameters {
|
|
|
116
127
|
* server contract requires at most one of `stringSortKey` or
|
|
117
128
|
* `numericSortKey`; the union surfaces that constraint at the type
|
|
118
129
|
* level so callers cannot accidentally set both.
|
|
130
|
+
*
|
|
131
|
+
* @since 0.1.0
|
|
119
132
|
*/
|
|
120
133
|
type SortKey = {
|
|
121
134
|
readonly kind: "numeric";
|
|
@@ -128,6 +141,8 @@ type SortKey = {
|
|
|
128
141
|
* Caller-supplied input for the `create` method on
|
|
129
142
|
* `StorageClient.sortedMaps`. Mirrors
|
|
130
143
|
* `Cloud_CreateMemoryStoreSortedMapItem` on the Open Cloud API.
|
|
144
|
+
*
|
|
145
|
+
* @since 0.1.0
|
|
131
146
|
*/
|
|
132
147
|
interface CreateSortedMapItemParameters {
|
|
133
148
|
/**
|
|
@@ -159,6 +174,8 @@ interface CreateSortedMapItemParameters {
|
|
|
159
174
|
* `Cloud_ListMemoryStoreSortedMapItems` on the Open Cloud API. All
|
|
160
175
|
* paging and filtering parameters are optional; omitting them returns
|
|
161
176
|
* up to one item server-side (`maxPageSize` defaults to `1`).
|
|
177
|
+
*
|
|
178
|
+
* @since 0.1.0
|
|
162
179
|
*/
|
|
163
180
|
interface ListSortedMapItemsParameters {
|
|
164
181
|
/**
|
|
@@ -190,6 +207,8 @@ interface ListSortedMapItemsParameters {
|
|
|
190
207
|
/**
|
|
191
208
|
* Parsed representation of a sorted-map item, as returned by every
|
|
192
209
|
* sorted-map operation that yields a single item.
|
|
210
|
+
*
|
|
211
|
+
* @since 0.1.0
|
|
193
212
|
*/
|
|
194
213
|
interface SortedMapItem {
|
|
195
214
|
/** Item identifier, parsed from the wire `path`. */
|
|
@@ -221,6 +240,8 @@ interface SortedMapItem {
|
|
|
221
240
|
/**
|
|
222
241
|
* Parsed result of a successful `Cloud_ListMemoryStoreSortedMapItems`
|
|
223
242
|
* response.
|
|
243
|
+
*
|
|
244
|
+
* @since 0.1.0
|
|
224
245
|
*/
|
|
225
246
|
interface ListSortedMapItemsResult {
|
|
226
247
|
/** Items returned in the current page, ordered per `orderBy`. */
|
|
@@ -235,6 +256,8 @@ interface ListSortedMapItemsResult {
|
|
|
235
256
|
* Caller-supplied input for the `delete` method on
|
|
236
257
|
* `StorageClient.sortedMaps`. Mirrors
|
|
237
258
|
* `Cloud_DeleteMemoryStoreSortedMapItem` on the Open Cloud API.
|
|
259
|
+
*
|
|
260
|
+
* @since 0.1.0
|
|
238
261
|
*/
|
|
239
262
|
interface DeleteSortedMapItemParameters {
|
|
240
263
|
/** Caller-supplied item identifier. URL-encoded by the builder. */
|
|
@@ -248,6 +271,8 @@ interface DeleteSortedMapItemParameters {
|
|
|
248
271
|
* Caller-supplied input for the `get` method on
|
|
249
272
|
* `StorageClient.sortedMaps`. Mirrors
|
|
250
273
|
* `Cloud_GetMemoryStoreSortedMapItem` on the Open Cloud API.
|
|
274
|
+
*
|
|
275
|
+
* @since 0.1.0
|
|
251
276
|
*/
|
|
252
277
|
interface GetSortedMapItemParameters {
|
|
253
278
|
/** Caller-supplied item identifier. URL-encoded by the builder. */
|
|
@@ -263,6 +288,8 @@ interface GetSortedMapItemParameters {
|
|
|
263
288
|
* `Cloud_UpdateMemoryStoreSortedMapItem` on the Open Cloud API. Body
|
|
264
289
|
* fields (`value`, `ttl`, `sortKey`) are optional under PATCH
|
|
265
290
|
* semantics; omitted fields are left unchanged on the server.
|
|
291
|
+
*
|
|
292
|
+
* @since 0.1.0
|
|
266
293
|
*/
|
|
267
294
|
interface UpdateSortedMapItemParameters {
|
|
268
295
|
/**
|
|
@@ -308,32 +335,6 @@ interface OperationLimit {
|
|
|
308
335
|
readonly operationKey: string;
|
|
309
336
|
}
|
|
310
337
|
//#endregion
|
|
311
|
-
//#region src/internal/http/retry.d.ts
|
|
312
|
-
/**
|
|
313
|
-
* Fully-resolved retry config shape that {@link mergeConfig} and
|
|
314
|
-
* {@link shouldRetry} operate on. Fields are required because this represents
|
|
315
|
-
* the post-defaulting, internal view — callers should supply every field (or
|
|
316
|
-
* resolve them via a test factory / client constructor). The partial,
|
|
317
|
-
* user-facing type lives on client construction options; method defaults and
|
|
318
|
-
* per-request overrides use `Partial<RetryResolvable>`.
|
|
319
|
-
*/
|
|
320
|
-
interface RetryResolvable {
|
|
321
|
-
/** Roblox Open Cloud API key. */
|
|
322
|
-
readonly apiKey: string;
|
|
323
|
-
/** Base URL for the Open Cloud API. */
|
|
324
|
-
readonly baseUrl: string;
|
|
325
|
-
/** Maximum retry attempts before giving up. */
|
|
326
|
-
readonly maxRetries: number;
|
|
327
|
-
/** Status codes that are eligible for retry. */
|
|
328
|
-
readonly retryableStatuses: ReadonlyArray<number>;
|
|
329
|
-
/** Fallback delay function when no server hint is available. */
|
|
330
|
-
readonly retryDelay: (attempt: number) => number;
|
|
331
|
-
/** Per-request timeout in milliseconds. */
|
|
332
|
-
readonly timeout: number;
|
|
333
|
-
}
|
|
334
|
-
/** Kind of HTTP method the merge is being performed for. */
|
|
335
|
-
type MethodKind = "create" | "idempotent";
|
|
336
|
-
//#endregion
|
|
337
338
|
//#region src/internal/resource-client.d.ts
|
|
338
339
|
/**
|
|
339
340
|
* Describes a single resource method's shape for dispatch through
|
|
@@ -635,6 +636,8 @@ declare class MemoryStoreSortedMapsGroup {
|
|
|
635
636
|
* Every method returns a `Result` so callers handle failure
|
|
636
637
|
* explicitly; no thrown error ever escapes the client.
|
|
637
638
|
*
|
|
639
|
+
* @since 0.1.0
|
|
640
|
+
*
|
|
638
641
|
* @example
|
|
639
642
|
*
|
|
640
643
|
* ```ts
|
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/domains/cloud-v2/memory-store-sorted-maps/types.ts","../src/internal/http/rate-limit-queue.ts","../src/internal/
|
|
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;;;;;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nB;EMfT,WAAA,CAAY,OAAA,EAAS,sBAAA;AAAA"}
|
package/dist/storage.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { r as ApiError } from "./rate-limit-
|
|
2
|
-
import {
|
|
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-C_D--PYX.mjs";
|
|
3
4
|
//#region src/domains/cloud-v2/memory-store-queues/builders.ts
|
|
4
5
|
/**
|
|
5
6
|
* Builds a `POST` request for the Open Cloud
|
|
@@ -138,7 +139,7 @@ const MALFORMED_DEQUEUE_MESSAGE = "Malformed memory-store dequeue response";
|
|
|
138
139
|
*/
|
|
139
140
|
function parseQueueItemResponse(response) {
|
|
140
141
|
const item = wireBodyToQueueItem(response.body);
|
|
141
|
-
if (item === void 0) return malformedQueueItem(response.status);
|
|
142
|
+
if (item === void 0) return malformedQueueItem(response.status, response.body);
|
|
142
143
|
return {
|
|
143
144
|
data: item,
|
|
144
145
|
success: true
|
|
@@ -157,11 +158,12 @@ function parseQueueItemResponse(response) {
|
|
|
157
158
|
*/
|
|
158
159
|
function parseDequeueResponse(response) {
|
|
159
160
|
const { body, status: statusCode } = response;
|
|
160
|
-
if (!isRecord(body)) return malformedDequeue(statusCode);
|
|
161
|
+
if (!isRecord(body)) return malformedDequeue(statusCode, body);
|
|
161
162
|
const { id, queueItems } = body;
|
|
162
|
-
if (typeof id !== "string"
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
if (typeof id !== "string") return malformedDequeue(statusCode, body);
|
|
164
|
+
if (queueItems !== void 0 && queueItems !== null && !Array.isArray(queueItems)) return malformedDequeue(statusCode, body);
|
|
165
|
+
const items = (queueItems ?? []).map(wireBodyToQueueItem);
|
|
166
|
+
if (!items.every(isQueueItem)) return malformedDequeue(statusCode, body);
|
|
165
167
|
return {
|
|
166
168
|
data: {
|
|
167
169
|
items,
|
|
@@ -191,18 +193,24 @@ function wireBodyToQueueItem(body) {
|
|
|
191
193
|
universeId
|
|
192
194
|
};
|
|
193
195
|
}
|
|
194
|
-
function malformedQueueItem(statusCode) {
|
|
196
|
+
function malformedQueueItem(statusCode, body) {
|
|
195
197
|
return {
|
|
196
|
-
err: new ApiError(MALFORMED_QUEUE_ITEM_MESSAGE, {
|
|
198
|
+
err: new ApiError(MALFORMED_QUEUE_ITEM_MESSAGE, {
|
|
199
|
+
details: body,
|
|
200
|
+
statusCode
|
|
201
|
+
}),
|
|
197
202
|
success: false
|
|
198
203
|
};
|
|
199
204
|
}
|
|
200
205
|
function isQueueItem(item) {
|
|
201
206
|
return item !== void 0;
|
|
202
207
|
}
|
|
203
|
-
function malformedDequeue(statusCode) {
|
|
208
|
+
function malformedDequeue(statusCode, body) {
|
|
204
209
|
return {
|
|
205
|
-
err: new ApiError(MALFORMED_DEQUEUE_MESSAGE, {
|
|
210
|
+
err: new ApiError(MALFORMED_DEQUEUE_MESSAGE, {
|
|
211
|
+
details: body,
|
|
212
|
+
statusCode
|
|
213
|
+
}),
|
|
206
214
|
success: false
|
|
207
215
|
};
|
|
208
216
|
}
|
|
@@ -538,7 +546,7 @@ const UPDATE_OPERATION_LIMIT = Object.freeze({
|
|
|
538
546
|
const UPDATE_REQUIRED_SCOPES = Object.freeze([WRITE_SCOPE]);
|
|
539
547
|
//#endregion
|
|
540
548
|
//#region src/domains/cloud-v2/memory-store-sorted-maps/parsers.ts
|
|
541
|
-
const PATH_PATTERN = /^cloud\/v2\/universes\/(\d+)\/memory-
|
|
549
|
+
const PATH_PATTERN = /^cloud\/v2\/universes\/(\d+)\/memory-stores?\/sorted-maps\/([^/]+)\/items\/([^/]+)$/;
|
|
542
550
|
const MALFORMED_MESSAGE = "Malformed memory-store sorted-map item response";
|
|
543
551
|
const MALFORMED_LIST_MESSAGE = "Malformed memory-store sorted-map list response";
|
|
544
552
|
/**
|
|
@@ -552,7 +560,7 @@ const MALFORMED_LIST_MESSAGE = "Malformed memory-store sorted-map list response"
|
|
|
552
560
|
*/
|
|
553
561
|
function parseSortedMapItemResponse(response) {
|
|
554
562
|
const item = wireBodyToSortedMapItem(response.body);
|
|
555
|
-
if (item === void 0) return malformedSortedMapItem(response.status);
|
|
563
|
+
if (item === void 0) return malformedSortedMapItem(response.status, response.body);
|
|
556
564
|
return {
|
|
557
565
|
data: item,
|
|
558
566
|
success: true
|
|
@@ -561,10 +569,9 @@ function parseSortedMapItemResponse(response) {
|
|
|
561
569
|
/**
|
|
562
570
|
* Parses a successful `Cloud_ListMemoryStoreSortedMapItems` response
|
|
563
571
|
* body into the public {@link ListSortedMapItemsResult} shape. Each
|
|
564
|
-
* item in the `
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
* whole response.
|
|
572
|
+
* item in the `items` array is validated through the same
|
|
573
|
+
* path-and-shape checks as {@link parseSortedMapItemResponse}; a
|
|
574
|
+
* malformed entry rejects the whole response.
|
|
568
575
|
*
|
|
569
576
|
* @param response - The full {@link HttpResponse} from the Open Cloud API.
|
|
570
577
|
* @returns A success result wrapping the parsed
|
|
@@ -573,16 +580,17 @@ function parseSortedMapItemResponse(response) {
|
|
|
573
580
|
*/
|
|
574
581
|
function parseListResponse(response) {
|
|
575
582
|
const { body, status: statusCode } = response;
|
|
576
|
-
if (!isRecord(body)) return malformedList(statusCode);
|
|
577
|
-
const {
|
|
578
|
-
if (!Array.isArray(
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
583
|
+
if (!isRecord(body)) return malformedList(statusCode, body);
|
|
584
|
+
const { items: rawItemsField, nextPageToken } = body;
|
|
585
|
+
if (rawItemsField !== void 0 && rawItemsField !== null && !Array.isArray(rawItemsField)) return malformedList(statusCode, body);
|
|
586
|
+
const normalizedToken = nextPageToken ?? void 0;
|
|
587
|
+
if (normalizedToken !== void 0 && typeof normalizedToken !== "string") return malformedList(statusCode, body);
|
|
588
|
+
const items = (rawItemsField ?? []).map(wireBodyToSortedMapItem);
|
|
589
|
+
if (!items.every(isSortedMapItem)) return malformedList(statusCode, body);
|
|
582
590
|
return {
|
|
583
591
|
data: {
|
|
584
592
|
items,
|
|
585
|
-
nextPageToken
|
|
593
|
+
nextPageToken: normalizedToken
|
|
586
594
|
},
|
|
587
595
|
success: true
|
|
588
596
|
};
|
|
@@ -610,12 +618,11 @@ function wireBodyToSortedMapItem(body) {
|
|
|
610
618
|
const match = PATH_PATTERN.exec(body.path);
|
|
611
619
|
const universeId = match?.[1];
|
|
612
620
|
const mapId = match?.[2];
|
|
613
|
-
|
|
614
|
-
if (universeId === void 0 || mapId === void 0 || id === void 0) return;
|
|
621
|
+
if (universeId === void 0 || mapId === void 0) return;
|
|
615
622
|
const sortKey = extractSortKey(body);
|
|
616
623
|
if (sortKey === "conflict") return;
|
|
617
624
|
return {
|
|
618
|
-
id,
|
|
625
|
+
id: body.id,
|
|
619
626
|
etag: body.etag,
|
|
620
627
|
expiresAt: new Date(body.expireTime),
|
|
621
628
|
mapId,
|
|
@@ -624,18 +631,24 @@ function wireBodyToSortedMapItem(body) {
|
|
|
624
631
|
value: body.value
|
|
625
632
|
};
|
|
626
633
|
}
|
|
627
|
-
function malformedSortedMapItem(statusCode) {
|
|
634
|
+
function malformedSortedMapItem(statusCode, body) {
|
|
628
635
|
return {
|
|
629
|
-
err: new ApiError(MALFORMED_MESSAGE, {
|
|
636
|
+
err: new ApiError(MALFORMED_MESSAGE, {
|
|
637
|
+
details: body,
|
|
638
|
+
statusCode
|
|
639
|
+
}),
|
|
630
640
|
success: false
|
|
631
641
|
};
|
|
632
642
|
}
|
|
633
643
|
function isSortedMapItem(item) {
|
|
634
644
|
return item !== void 0;
|
|
635
645
|
}
|
|
636
|
-
function malformedList(statusCode) {
|
|
646
|
+
function malformedList(statusCode, body) {
|
|
637
647
|
return {
|
|
638
|
-
err: new ApiError(MALFORMED_LIST_MESSAGE, {
|
|
648
|
+
err: new ApiError(MALFORMED_LIST_MESSAGE, {
|
|
649
|
+
details: body,
|
|
650
|
+
statusCode
|
|
651
|
+
}),
|
|
639
652
|
success: false
|
|
640
653
|
};
|
|
641
654
|
}
|
|
@@ -824,6 +837,8 @@ var MemoryStoreSortedMapsGroup = class {
|
|
|
824
837
|
* Every method returns a `Result` so callers handle failure
|
|
825
838
|
* explicitly; no thrown error ever escapes the client.
|
|
826
839
|
*
|
|
840
|
+
* @since 0.1.0
|
|
841
|
+
*
|
|
827
842
|
* @example
|
|
828
843
|
*
|
|
829
844
|
* ```ts
|