@bedrock-rbx/ocale 0.1.0-beta.1 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/badges.d.mts +86 -3
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +114 -6
- package/dist/badges.mjs.map +1 -1
- package/dist/data.generated-DOaDx6J0.d.mts +485 -0
- package/dist/data.generated-DOaDx6J0.d.mts.map +1 -0
- package/dist/developer-products.d.mts +14 -5
- package/dist/developer-products.d.mts.map +1 -1
- package/dist/developer-products.mjs +6 -5
- package/dist/developer-products.mjs.map +1 -1
- package/dist/game-passes.d.mts +83 -2
- package/dist/game-passes.d.mts.map +1 -1
- package/dist/game-passes.mjs +112 -5
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +75 -64
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/is-date-time-string-Ds8Ew-Xa.mjs +19 -0
- package/dist/is-date-time-string-Ds8Ew-Xa.mjs.map +1 -0
- package/dist/locales.d.mts +2 -0
- package/dist/locales.mjs +512 -0
- package/dist/locales.mjs.map +1 -0
- package/dist/luau-execution.d.mts +149 -0
- package/dist/luau-execution.d.mts.map +1 -0
- package/dist/luau-execution.mjs +164 -0
- package/dist/luau-execution.mjs.map +1 -0
- package/dist/places.d.mts +87 -8
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +58 -13
- package/dist/places.mjs.map +1 -1
- package/dist/poll-timeout-BdUcWv52.mjs +79 -0
- package/dist/poll-timeout-BdUcWv52.mjs.map +1 -0
- package/dist/polling-Cc50rgl6.d.mts +253 -0
- package/dist/polling-Cc50rgl6.d.mts.map +1 -0
- package/dist/polling-helpers-BVkmr6C7.mjs +636 -0
- package/dist/polling-helpers-BVkmr6C7.mjs.map +1 -0
- package/dist/{price-information-CmpscMc4.mjs → price-information-DFf89abd.mjs} +2 -2
- package/dist/{price-information-CmpscMc4.mjs.map → price-information-DFf89abd.mjs.map} +1 -1
- package/dist/rate-limit-BSbFNSGT.d.mts +92 -0
- package/dist/rate-limit-BSbFNSGT.d.mts.map +1 -0
- package/dist/{rate-limit-BBU_4xnZ.mjs → rate-limit-CKfuhxT1.mjs} +11 -3
- package/dist/rate-limit-CKfuhxT1.mjs.map +1 -0
- package/dist/{resource-client-CaS_j3yg.mjs → resource-client-opC6BUkL.mjs} +78 -15
- package/dist/resource-client-opC6BUkL.mjs.map +1 -0
- package/dist/storage.d.mts +380 -0
- package/dist/storage.d.mts.map +1 -0
- package/dist/storage.mjs +371 -0
- package/dist/storage.mjs.map +1 -0
- package/dist/{to-blob-1BtHsDGK.mjs → to-blob-DHN7UoM8.mjs} +1 -1
- package/dist/{to-blob-1BtHsDGK.mjs.map → to-blob-DHN7UoM8.mjs.map} +1 -1
- package/dist/{types-YCTsM8Qd.d.mts → types-DUzm6maA.d.mts} +1 -1
- package/dist/{types-YCTsM8Qd.d.mts.map → types-DUzm6maA.d.mts.map} +1 -1
- package/dist/universes.d.mts +37 -12
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +6 -5
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-CTZzJhmd.mjs → validation-VImVHzxg.mjs} +2 -2
- package/dist/validation-VImVHzxg.mjs.map +1 -0
- package/package.json +7 -3
- package/dist/rate-limit-BBU_4xnZ.mjs.map +0 -1
- package/dist/resource-client-CaS_j3yg.mjs.map +0 -1
- package/dist/validation-CTZzJhmd.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,47 +1,6 @@
|
|
|
1
|
-
import { a as OpenCloudHooks, c as Page, d as OpenCloudError, i as OpenCloudClientOptions, l as Result, n as HttpRequest, o as RequestConfig, r as HttpResponse, s as RequestOptions, t as HttpClient, u as SleepFunc } from "./types-
|
|
1
|
+
import { a as OpenCloudHooks, c as Page, d as OpenCloudError, i as OpenCloudClientOptions, l as Result, n as HttpRequest, o as RequestConfig, r as HttpResponse, s as RequestOptions, t as HttpClient, u as SleepFunc } from "./types-DUzm6maA.mjs";
|
|
2
|
+
import { i as ApiErrorOptions, n as RateLimitErrorOptions, r as ApiError, t as RateLimitError } from "./rate-limit-BSbFNSGT.mjs";
|
|
2
3
|
|
|
3
|
-
//#region src/errors/api-error.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Options for constructing an {@link ApiError}.
|
|
6
|
-
*/
|
|
7
|
-
interface ApiErrorOptions extends ErrorOptions {
|
|
8
|
-
/** Optional machine-readable error code from the API. */
|
|
9
|
-
code?: string | undefined;
|
|
10
|
-
/** HTTP status code from the API response. */
|
|
11
|
-
statusCode: number;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Thrown when the Roblox Open Cloud API returns a non-2xx response
|
|
15
|
-
* that is not a rate limit (429).
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* ```ts
|
|
20
|
-
* import { ApiError } from "@bedrock-rbx/ocale";
|
|
21
|
-
*
|
|
22
|
-
* const error = new ApiError("Game pass not found", {
|
|
23
|
-
* code: "NotFound",
|
|
24
|
-
* statusCode: 404,
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* expect(error).toBeInstanceOf(ApiError);
|
|
28
|
-
* expect(error.statusCode).toBe(404);
|
|
29
|
-
* expect(error.code).toBe("NotFound");
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
declare class ApiError extends OpenCloudError {
|
|
33
|
-
readonly code: string | undefined;
|
|
34
|
-
override readonly name: string;
|
|
35
|
-
readonly statusCode: number;
|
|
36
|
-
/**
|
|
37
|
-
* Creates a new ApiError.
|
|
38
|
-
*
|
|
39
|
-
* @param message - Human-readable error description.
|
|
40
|
-
* @param options - Error options including status code and optional error code.
|
|
41
|
-
*/
|
|
42
|
-
constructor(message: string, options: ApiErrorOptions);
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
4
|
//#region src/errors/network-error.d.ts
|
|
46
5
|
/**
|
|
47
6
|
* Thrown when a network-level failure prevents the request from reaching
|
|
@@ -106,41 +65,93 @@ declare class PermissionError extends ApiError {
|
|
|
106
65
|
constructor(message: string, options: PermissionErrorOptions);
|
|
107
66
|
}
|
|
108
67
|
//#endregion
|
|
109
|
-
//#region src/errors/
|
|
68
|
+
//#region src/errors/poll-aborted.d.ts
|
|
110
69
|
/**
|
|
111
|
-
* Options for constructing a {@link
|
|
70
|
+
* Options for constructing a {@link PollAbortedError}.
|
|
112
71
|
*/
|
|
113
|
-
interface
|
|
114
|
-
/**
|
|
115
|
-
|
|
72
|
+
interface PollAbortedErrorOptions extends ErrorOptions {
|
|
73
|
+
/** Whatever `AbortSignal.reason` was at the moment of abort. */
|
|
74
|
+
readonly reason?: unknown;
|
|
116
75
|
}
|
|
117
76
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
77
|
+
* Returned when `pollUntilDone` is interrupted by an `AbortSignal` before
|
|
78
|
+
* a terminal task state is reached. The `reason` field mirrors
|
|
79
|
+
* `AbortSignal.reason` so callers can distinguish intentional cancellation
|
|
80
|
+
* from unexpected abort sources.
|
|
120
81
|
*
|
|
121
82
|
* @example
|
|
122
83
|
*
|
|
123
84
|
* ```ts
|
|
124
|
-
* import {
|
|
85
|
+
* import { PollAbortedError } from "@bedrock-rbx/ocale";
|
|
125
86
|
*
|
|
126
|
-
* const error = new
|
|
127
|
-
*
|
|
87
|
+
* const error = new PollAbortedError("polling was aborted", {
|
|
88
|
+
* reason: "user cancelled",
|
|
128
89
|
* });
|
|
129
90
|
*
|
|
130
|
-
* expect(error).toBeInstanceOf(
|
|
131
|
-
* expect(error.
|
|
91
|
+
* expect(error).toBeInstanceOf(PollAbortedError);
|
|
92
|
+
* expect(error.reason).toBe("user cancelled");
|
|
132
93
|
* ```
|
|
133
94
|
*/
|
|
134
|
-
declare class
|
|
135
|
-
override readonly name
|
|
136
|
-
readonly
|
|
95
|
+
declare class PollAbortedError extends OpenCloudError {
|
|
96
|
+
override readonly name: string;
|
|
97
|
+
readonly reason?: unknown;
|
|
137
98
|
/**
|
|
138
|
-
* Creates a new
|
|
99
|
+
* Creates a new PollAbortedError.
|
|
139
100
|
*
|
|
140
|
-
* @param message - Human-readable
|
|
141
|
-
* @param options - Error options including the
|
|
101
|
+
* @param message - Human-readable description of the abort.
|
|
102
|
+
* @param options - Error options including the abort reason.
|
|
103
|
+
*/
|
|
104
|
+
constructor(message: string, options?: PollAbortedErrorOptions);
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/errors/poll-timeout.d.ts
|
|
108
|
+
/**
|
|
109
|
+
* Options for {@link PollTimeoutError}. The `T` type parameter captures the
|
|
110
|
+
* resource-specific task variant the caller polled for; defaults to `unknown`
|
|
111
|
+
* so the class can be reused by future Resources without forcing a parallel
|
|
112
|
+
* hierarchy.
|
|
113
|
+
*
|
|
114
|
+
* @template T - Resource-specific task type being polled.
|
|
115
|
+
*/
|
|
116
|
+
interface PollTimeoutErrorOptions<T = unknown> extends ErrorOptions {
|
|
117
|
+
/** Last task observed before the timeout budget was exhausted. */
|
|
118
|
+
readonly lastObservedTask?: T | undefined;
|
|
119
|
+
/** Total wall-clock budget supplied by the caller, in ms. */
|
|
120
|
+
readonly timeoutMs: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Returned when `pollUntilDone` exhausts its wall-clock budget without
|
|
124
|
+
* observing a terminal task state. Carries the last task polled so callers
|
|
125
|
+
* can inspect state and decide whether to retry with a fresh budget.
|
|
126
|
+
*
|
|
127
|
+
* @template T - Resource-specific task type being polled.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
*
|
|
131
|
+
* ```ts
|
|
132
|
+
* import { PollTimeoutError } from "@bedrock-rbx/ocale";
|
|
133
|
+
*
|
|
134
|
+
* const error = new PollTimeoutError("polling timed out after 5 s", {
|
|
135
|
+
* lastObservedTask: { state: "PROCESSING" as const },
|
|
136
|
+
* timeoutMs: 5000,
|
|
137
|
+
* });
|
|
138
|
+
*
|
|
139
|
+
* expect(error).toBeInstanceOf(PollTimeoutError);
|
|
140
|
+
* expect(error.timeoutMs).toBe(5000);
|
|
141
|
+
* expect(error.lastObservedTask).toStrictEqual({ state: "PROCESSING" });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
declare class PollTimeoutError<T = unknown> extends OpenCloudError {
|
|
145
|
+
readonly lastObservedTask: T | undefined;
|
|
146
|
+
override readonly name: string;
|
|
147
|
+
readonly timeoutMs: number;
|
|
148
|
+
/**
|
|
149
|
+
* Creates a new PollTimeoutError.
|
|
150
|
+
*
|
|
151
|
+
* @param message - Human-readable description of the timeout.
|
|
152
|
+
* @param options - Error options including the budget and last-observed task.
|
|
142
153
|
*/
|
|
143
|
-
constructor(message: string, options:
|
|
154
|
+
constructor(message: string, options: PollTimeoutErrorOptions<T>);
|
|
144
155
|
}
|
|
145
156
|
//#endregion
|
|
146
157
|
//#region src/errors/validation.d.ts
|
|
@@ -149,7 +160,7 @@ declare class RateLimitError extends OpenCloudError {
|
|
|
149
160
|
* exhaustively `switch` over this union so TypeScript will refuse to compile
|
|
150
161
|
* if a new variant is added without a handler.
|
|
151
162
|
*/
|
|
152
|
-
type ValidationErrorCode = "empty_body" | "empty_image_ids" | "empty_update" | "format_mismatch" | "invalid_image_id";
|
|
163
|
+
type ValidationErrorCode = "empty_body" | "empty_image_ids" | "empty_update" | "format_mismatch" | "incomplete_ref" | "invalid_image_id";
|
|
153
164
|
/**
|
|
154
165
|
* Options for constructing a {@link ValidationError}.
|
|
155
166
|
*/
|
|
@@ -187,5 +198,5 @@ declare class ValidationError extends OpenCloudError {
|
|
|
187
198
|
constructor(message: string, options: ValidationErrorOptions);
|
|
188
199
|
}
|
|
189
200
|
//#endregion
|
|
190
|
-
export { ApiError, type ApiErrorOptions, type HttpClient, type HttpRequest, type HttpResponse, NetworkError, type OpenCloudClientOptions, OpenCloudError, type OpenCloudHooks, type Page, PermissionError, type PermissionErrorOptions, RateLimitError, type RateLimitErrorOptions, type RequestConfig, type RequestOptions, type Result, type SleepFunc, ValidationError, type ValidationErrorCode, type ValidationErrorOptions };
|
|
201
|
+
export { ApiError, type ApiErrorOptions, type HttpClient, type HttpRequest, type HttpResponse, NetworkError, type OpenCloudClientOptions, OpenCloudError, type OpenCloudHooks, type Page, PermissionError, type PermissionErrorOptions, PollAbortedError, type PollAbortedErrorOptions, PollTimeoutError, type PollTimeoutErrorOptions, RateLimitError, type RateLimitErrorOptions, type RequestConfig, type RequestOptions, type Result, type SleepFunc, ValidationError, type ValidationErrorCode, type ValidationErrorOptions };
|
|
191
202
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors/network-error.ts","../src/errors/permission-error.ts","../src/errors/poll-aborted.ts","../src/errors/poll-timeout.ts","../src/errors/validation.ts"],"mappings":";;;;;;;AAMA;cAAa,YAAA,SAAqB,cAAA;EAAA,kBACR,IAAA;AAAA;;;;;;UCFT,sBAAA,SAA+B,eAAA;EDCnC;;;;;ECKZ,YAAA;;AAND;;;;EAYC,cAAA,EAAgB,aAAA;AAAA;;;;;AA0BjB;;;;;;;;;;;;;;;;;;;cAAa,eAAA,SAAwB,QAAA;EAAA,kBACX,IAAA;EAAA,SACT,YAAA;EAAA,SACA,cAAA,EAAgB,aAAA;ECzChB;;;;AAwBjB;;;ED0BC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,sBAAA;AAAA;;;;;;UClDtB,uBAAA,SAAgC,YAAA;EFCpC;EAAA,SECH,MAAA;AAAA;;;;;ADFV;;;;;;;;;;AAsCA;;;;;cCda,gBAAA,SAAyB,cAAA;EAAA,kBACZ,IAAA;EAAA,SACT,MAAA;;;;;;;EAQhB,WAAA,CAAY,OAAA,UAAiB,OAAA,GAAS,uBAAA;AAAA;;;;;;AFjCvC;;;;;UGIiB,uBAAA,sBAA6C,YAAA;;WAEpD,gBAAA,GAAmB,CAAA;EFP7B;EAAA,SESU,SAAA;AAAA;;;;;;;;AF6BV;;;;;;;;;;;;;;;cEJa,gBAAA,sBAAsC,cAAA;EAAA,SAClC,gBAAA,EAAkB,CAAA;EAAA,kBACT,IAAA;EAAA,SACT,SAAA;;;;ADrCjB;;;EC6CC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,uBAAA,CAAwB,CAAA;AAAA;;;;;;AH5C/D;;KICY,mBAAA;;;;UAWK,sBAAA,SAA+B,YAAA;;EAE/C,IAAA,EAAM,mBAAA;AAAA;;;;;;;;;AHuBP;;;;;;;;;;cGFa,eAAA,SAAwB,cAAA;EAAA,SACpB,IAAA,EAAM,mBAAA;EAAA,kBACG,IAAA;;;;;;;EAQzB,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,sBAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { a as OpenCloudError, i as ApiError, n as PermissionError, r as NetworkError, t as RateLimitError } from "./rate-limit-
|
|
2
|
-
import { t as
|
|
3
|
-
|
|
1
|
+
import { a as OpenCloudError, i as ApiError, n as PermissionError, r as NetworkError, t as RateLimitError } from "./rate-limit-CKfuhxT1.mjs";
|
|
2
|
+
import { n as PollAbortedError, t as PollTimeoutError } from "./poll-timeout-BdUcWv52.mjs";
|
|
3
|
+
import { t as ValidationError } from "./validation-VImVHzxg.mjs";
|
|
4
|
+
export { ApiError, NetworkError, OpenCloudError, PermissionError, PollAbortedError, PollTimeoutError, RateLimitError, ValidationError };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/internal/utils/is-date-time-string.ts
|
|
2
|
+
/**
|
|
3
|
+
* Narrows `value` to a string that parses to a real {@link Date} via the
|
|
4
|
+
* `Date(string)` constructor. Used by resource parsers to gate
|
|
5
|
+
* `format: date-time` wire fields before handing them to `new Date(...)`,
|
|
6
|
+
* which silently produces an `Invalid Date` for invalid input.
|
|
7
|
+
*
|
|
8
|
+
* @param value - The unknown wire value to validate.
|
|
9
|
+
* @returns `true` when `value` is a string and `new Date(value).getTime()`
|
|
10
|
+
* is not `NaN`.
|
|
11
|
+
*/
|
|
12
|
+
function isDateTimeString(value) {
|
|
13
|
+
if (typeof value !== "string") return false;
|
|
14
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { isDateTimeString as t };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=is-date-time-string-Ds8Ew-Xa.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-date-time-string-Ds8Ew-Xa.mjs","names":[],"sources":["../src/internal/utils/is-date-time-string.ts"],"sourcesContent":["/**\n * Narrows `value` to a string that parses to a real {@link Date} via the\n * `Date(string)` constructor. Used by resource parsers to gate\n * `format: date-time` wire fields before handing them to `new Date(...)`,\n * which silently produces an `Invalid Date` for invalid input.\n *\n * @param value - The unknown wire value to validate.\n * @returns `true` when `value` is a string and `new Date(value).getTime()`\n * is not `NaN`.\n */\nexport function isDateTimeString(value: unknown): value is string {\n\tif (typeof value !== \"string\") {\n\t\treturn false;\n\t}\n\n\treturn !Number.isNaN(new Date(value).getTime());\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,iBAAiB,OAAiC;AACjE,KAAI,OAAO,UAAU,SACpB,QAAO;AAGR,QAAO,CAAC,OAAO,MAAM,IAAI,KAAK,MAAM,CAAC,SAAS,CAAC"}
|