@bedrock-rbx/ocale 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/dist/badge-cost-mismatch-DrlvhlQc.mjs +47 -0
- package/dist/badge-cost-mismatch-DrlvhlQc.mjs.map +1 -0
- package/dist/badges.d.mts +228 -184
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +176 -18
- package/dist/badges.mjs.map +1 -1
- package/dist/capacity-admission-hycCFkTo.d.mts +355 -0
- package/dist/capacity-admission-hycCFkTo.d.mts.map +1 -0
- package/dist/{data.generated-B2ceLfSn.d.mts → data.generated-D_vpa5-g.d.mts} +23 -23
- package/dist/data.generated-D_vpa5-g.d.mts.map +1 -0
- package/dist/developer-products.d.mts +181 -186
- package/dist/developer-products.d.mts.map +1 -1
- package/dist/developer-products.mjs +24 -24
- package/dist/developer-products.mjs.map +1 -1
- package/dist/game-passes.d.mts +206 -203
- package/dist/game-passes.d.mts.map +1 -1
- package/dist/game-passes.mjs +26 -21
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +905 -343
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +325 -10
- package/dist/index.mjs.map +1 -1
- package/dist/locales.d.mts +30 -2
- package/dist/locales.d.mts.map +1 -0
- package/dist/locales.mjs +24 -1
- package/dist/locales.mjs.map +1 -1
- package/dist/luau-execution.d.mts +154 -151
- package/dist/luau-execution.d.mts.map +1 -1
- package/dist/luau-execution.mjs +11 -8
- package/dist/luau-execution.mjs.map +1 -1
- package/dist/{network-error-DR9FX5hb.mjs → network-error-iVSng5MT.mjs} +44 -6
- package/dist/network-error-iVSng5MT.mjs.map +1 -0
- package/dist/places.d.mts +204 -180
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +66 -20
- package/dist/places.mjs.map +1 -1
- package/dist/{poll-timeout-3PXLsabj.mjs → poll-timeout-DzztDymd.mjs} +2 -2
- package/dist/{poll-timeout-3PXLsabj.mjs.map → poll-timeout-DzztDymd.mjs.map} +1 -1
- package/dist/{polling-helpers-CoVhsC33.mjs → polling-helpers-DfF5dspc.mjs} +249 -83
- package/dist/polling-helpers-DfF5dspc.mjs.map +1 -0
- package/dist/{price-information-B0tkOoAX.mjs → price-information-DEkEQ8Pq.mjs} +2 -2
- package/dist/{price-information-B0tkOoAX.mjs.map → price-information-DEkEQ8Pq.mjs.map} +1 -1
- package/dist/resource-client-BCKukheG.d.mts +168 -0
- package/dist/resource-client-BCKukheG.d.mts.map +1 -0
- package/dist/{resource-client-rqTMkBeR.mjs → resource-client-CaIVr-go.mjs} +586 -158
- package/dist/resource-client-CaIVr-go.mjs.map +1 -0
- package/dist/retry-C2oHesDx.d.mts +229 -0
- package/dist/retry-C2oHesDx.d.mts.map +1 -0
- package/dist/{retry-BlX4tUnT.mjs → retry-CMRDvAR4.mjs} +278 -18
- package/dist/retry-CMRDvAR4.mjs.map +1 -0
- package/dist/storage.d.mts +333 -334
- package/dist/storage.d.mts.map +1 -1
- package/dist/storage.mjs +29 -22
- package/dist/storage.mjs.map +1 -1
- package/dist/testing.d.mts +347 -360
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +3 -4
- package/dist/testing.mjs.map +1 -1
- package/dist/types-CdMr_J1M.d.mts +509 -0
- package/dist/types-CdMr_J1M.d.mts.map +1 -0
- package/dist/universes.d.mts +619 -422
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +421 -48
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-B_Zs1So2.mjs → validation-964VNlbp.mjs} +2 -2
- package/dist/{validation-B_Zs1So2.mjs.map → validation-964VNlbp.mjs.map} +1 -1
- package/dist/wire-DJqupefn.d.mts +41 -0
- package/dist/wire-DJqupefn.d.mts.map +1 -0
- package/package.json +14 -14
- package/dist/capacity-admission-IDO3fcUC.d.mts +0 -369
- package/dist/capacity-admission-IDO3fcUC.d.mts.map +0 -1
- package/dist/data.generated-B2ceLfSn.d.mts.map +0 -1
- package/dist/network-error-DR9FX5hb.mjs.map +0 -1
- package/dist/polling-helpers-CoVhsC33.mjs.map +0 -1
- package/dist/resource-client-B6NeFXUv.d.mts +0 -164
- package/dist/resource-client-B6NeFXUv.d.mts.map +0 -1
- package/dist/resource-client-rqTMkBeR.mjs.map +0 -1
- package/dist/retry-BlX4tUnT.mjs.map +0 -1
- package/dist/retry-war_-9tb.d.mts +0 -373
- package/dist/retry-war_-9tb.d.mts.map +0 -1
- package/dist/types-CvYh4SPC.d.mts +0 -386
- package/dist/types-CvYh4SPC.d.mts.map +0 -1
- package/dist/wire-D3K-a-UP.d.mts +0 -37
- package/dist/wire-D3K-a-UP.d.mts.map +0 -1
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/client/fetch-http-client.ts","../src/errors/permission-error.ts","../src/errors/poll-aborted.ts","../src/errors/poll-timeout.ts","../src/errors/rate-limit-wait-refused.ts","../src/errors/request-aborted.ts","../src/errors/request-deadline-exceeded.ts","../src/errors/retry-delay-exceeded.ts","../src/errors/validation.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/client/fetch-http-client.ts","../src/client/oauth-token-refresher.ts","../src/errors/api-error.ts","../src/errors/badge-cost-mismatch.ts","../src/errors/credential-error.ts","../src/errors/credential-not-supported.ts","../src/errors/credential-rejected.ts","../src/errors/network-error.ts","../src/errors/permission-error.ts","../src/errors/poll-aborted.ts","../src/errors/poll-timeout.ts","../src/errors/rate-limit-wait-refused.ts","../src/errors/request-aborted.ts","../src/errors/request-deadline-exceeded.ts","../src/errors/retry-delay-exceeded.ts","../src/errors/token-refresh-error.ts","../src/errors/unexpected-response.ts","../src/errors/validation.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwEgB,sBAAsB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;;;;;;;;;;;;;;;;;;;;;;;qBA0BG,0BAA0B;oBACb;;WAET;;;;;;;EAQhB,YAAY,iBAAiB,SAAS;;;;;;;;;UCrCtB,uCAAuC;;EAEvD,UAAU;;EAEV;;;;;EAKA;;;;;EAKA,kBAAkB,SAAS;;EAE3B;;EAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAgCY,gCAAgC;WAC5B,SAAS;WACT;oBACS;;WAET;WACA,iBAAiB,SAAS;WAC1B;WACA;;;;;;;;;EAUhB,YAAY,iBAAiB,SAAS;;;;;;;;;;;KCpE3B;;;;;;UAeK,+BAA+B;;EAE/C,MAAM;;;;;;;;;;;;;;;;;;;;;;qBAuBM,wBAAwB;oBACX,MAAM;oBACN;;;;;;;EAQzB,YAAY,iBAAiB,SAAS"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { a as ApiError, n as RateLimitError, o as requestContextOf, s as OpenCloudError, t as NetworkError } from "./network-error-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
1
|
+
import { a as ApiError, n as RateLimitError, o as requestContextOf, s as OpenCloudError, t as NetworkError } from "./network-error-iVSng5MT.mjs";
|
|
2
|
+
import { D as RequestAbortedError, S as createFetchHttpClient$1, _ as RateLimitWaitRefusedError, a as TRANSIENT_TRANSPORT_CODES, b as CredentialNotSupportedError, g as RequestDeadlineExceededError, h as RetryDelayExceededError, i as RESPONSE_UNPARSEABLE, m as UnexpectedResponseError, n as GATEWAY_REJECTED, v as PermissionError, x as CredentialError, y as CredentialRejectedError } from "./retry-CMRDvAR4.mjs";
|
|
3
|
+
import { t as BadgeCostMismatchError } from "./badge-cost-mismatch-DrlvhlQc.mjs";
|
|
4
|
+
import { n as PollAbortedError, t as PollTimeoutError } from "./poll-timeout-DzztDymd.mjs";
|
|
5
|
+
import { t as ValidationError } from "./validation-964VNlbp.mjs";
|
|
5
6
|
//#region src/client/fetch-http-client.ts
|
|
6
7
|
/**
|
|
7
8
|
* Creates the fetch-backed HTTP transport Ocale uses by default.
|
|
@@ -10,6 +11,11 @@ import { t as ValidationError } from "./validation-B_Zs1So2.mjs";
|
|
|
10
11
|
* request-level behavior while retaining Ocale's authentication, timeout,
|
|
11
12
|
* upload, response-parsing, and error-classification semantics.
|
|
12
13
|
*
|
|
14
|
+
* Pass `fetch` to send through a wrapped or replacement `fetch`. Omit it to
|
|
15
|
+
* use the global `fetch`.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Optional transport settings.
|
|
18
|
+
* @param options.fetch - The `fetch` to send requests through.
|
|
13
19
|
* @returns Ocale's default fetch-backed HTTP transport.
|
|
14
20
|
* @since 0.3.1
|
|
15
21
|
*
|
|
@@ -26,7 +32,11 @@ import { t as ValidationError } from "./validation-B_Zs1So2.mjs";
|
|
|
26
32
|
* UniversesClient,
|
|
27
33
|
* } from "@bedrock-rbx/ocale/universes";
|
|
28
34
|
*
|
|
29
|
-
*
|
|
35
|
+
* // An injected response keeps this executable example offline.
|
|
36
|
+
* // Omit fetch in production to use the runtime's global fetch.
|
|
37
|
+
* const defaultHttpClient = createFetchHttpClient({
|
|
38
|
+
* fetch: async () => new Response(),
|
|
39
|
+
* });
|
|
30
40
|
* let observedRequests: ReadonlyArray<HttpRequest> = [];
|
|
31
41
|
* const tracedHttpClient: HttpClient = {
|
|
32
42
|
* async request(request, config) {
|
|
@@ -34,9 +44,9 @@ import { t as ValidationError } from "./validation-B_Zs1So2.mjs";
|
|
|
34
44
|
* return defaultHttpClient.request(request, config);
|
|
35
45
|
* },
|
|
36
46
|
* };
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
47
|
+
* const commonOptions = {
|
|
48
|
+
* credential: { apiKey: "your-key", kind: "apiKey" as const },
|
|
49
|
+
* };
|
|
40
50
|
* const client = new UniversesClient({
|
|
41
51
|
* ...commonOptions,
|
|
42
52
|
* httpClient: tracedHttpClient,
|
|
@@ -63,8 +73,313 @@ import { t as ValidationError } from "./validation-B_Zs1So2.mjs";
|
|
|
63
73
|
* });
|
|
64
74
|
* ```
|
|
65
75
|
*/
|
|
66
|
-
|
|
76
|
+
function createFetchHttpClient(options) {
|
|
77
|
+
return createFetchHttpClient$1(options?.fetch);
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/errors/token-refresh-error.ts
|
|
81
|
+
/**
|
|
82
|
+
* Thrown by the `getAccessToken` that `createOAuthTokenRefresher` returns
|
|
83
|
+
* when the Roblox token endpoint refuses a refresh. `code` is the OAuth
|
|
84
|
+
* `error` field of the response body (for example `invalid_grant`), or
|
|
85
|
+
* `undefined` when the body has none. A client that calls the provider
|
|
86
|
+
* returns it as the `cause` of a `CredentialError`.
|
|
87
|
+
*
|
|
88
|
+
* @since 0.4.0
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
*
|
|
92
|
+
* ```ts
|
|
93
|
+
* import { TokenRefreshError } from "@bedrock-rbx/ocale";
|
|
94
|
+
*
|
|
95
|
+
* const error = new TokenRefreshError("Token refresh refused", {
|
|
96
|
+
* code: "invalid_grant",
|
|
97
|
+
* statusCode: 400,
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* expect(error.code).toBe("invalid_grant");
|
|
101
|
+
* expect(error.statusCode).toBe(400);
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
var TokenRefreshError = class extends OpenCloudError {
|
|
105
|
+
name = "TokenRefreshError";
|
|
106
|
+
/** HTTP status of the token endpoint's response. */
|
|
107
|
+
statusCode;
|
|
108
|
+
/**
|
|
109
|
+
* Creates a new TokenRefreshError.
|
|
110
|
+
*
|
|
111
|
+
* @param message - Human-readable error description.
|
|
112
|
+
* @param options - The OAuth error code and the HTTP status.
|
|
113
|
+
*/
|
|
114
|
+
constructor(message, options) {
|
|
115
|
+
super(message, options);
|
|
116
|
+
this.statusCode = options.statusCode;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/client/oauth-token-refresher.ts
|
|
121
|
+
const TOKEN_URL = "https://apis.roblox.com/oauth/v1/token";
|
|
122
|
+
const REFRESH_BELOW_MS = 12e4;
|
|
123
|
+
const FALLBACK_MIN_MS = 6e4;
|
|
124
|
+
const EXCHANGE_TIMEOUT_MS = 3e4;
|
|
125
|
+
var OAuthTokenRefresher = class {
|
|
126
|
+
#clientId;
|
|
127
|
+
#clientSecret;
|
|
128
|
+
#onRotate;
|
|
129
|
+
#send;
|
|
130
|
+
#current;
|
|
131
|
+
#failure;
|
|
132
|
+
#inFlight;
|
|
133
|
+
#pending;
|
|
134
|
+
#refreshToken;
|
|
135
|
+
constructor(options) {
|
|
136
|
+
this.#clientId = options.clientId;
|
|
137
|
+
this.#clientSecret = options.clientSecret;
|
|
138
|
+
this.#onRotate = options.onRotate;
|
|
139
|
+
this.#refreshToken = options.refreshToken;
|
|
140
|
+
this.#send = options.fetch ?? fetch;
|
|
141
|
+
}
|
|
142
|
+
async getAccessTokenAsync(signal) {
|
|
143
|
+
if (signal.aborted) throw abortedWait(signal);
|
|
144
|
+
if (this.#failure !== void 0) throw this.#failure;
|
|
145
|
+
const cached = this.#tokenLasting(REFRESH_BELOW_MS);
|
|
146
|
+
if (cached !== void 0) return cached;
|
|
147
|
+
this.#inFlight ??= this.#refreshAsync().finally(() => {
|
|
148
|
+
this.#inFlight = void 0;
|
|
149
|
+
});
|
|
150
|
+
return waitAsync(this.#inFlight, signal);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Runs one exchange under its own time limit, apart from any caller's
|
|
154
|
+
* signal. A timeout is transient, like a network error.
|
|
155
|
+
*
|
|
156
|
+
* @returns The exchange outcome.
|
|
157
|
+
*/
|
|
158
|
+
async #exchangeAsync() {
|
|
159
|
+
const controller = new AbortController();
|
|
160
|
+
const exchange = this.#sendAsync(controller.signal);
|
|
161
|
+
let timer;
|
|
162
|
+
const timeout = new Promise((resolve) => {
|
|
163
|
+
timer = setTimeout(() => {
|
|
164
|
+
const error = new DOMException("OAuth token exchange timed out", "TimeoutError");
|
|
165
|
+
controller.abort(error);
|
|
166
|
+
resolve({
|
|
167
|
+
error,
|
|
168
|
+
kind: "transient"
|
|
169
|
+
});
|
|
170
|
+
}, EXCHANGE_TIMEOUT_MS);
|
|
171
|
+
});
|
|
172
|
+
try {
|
|
173
|
+
return await Promise.race([exchange, timeout]);
|
|
174
|
+
} finally {
|
|
175
|
+
clearTimeout(timer);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
#fallback(error) {
|
|
179
|
+
const token = this.#tokenLasting(FALLBACK_MIN_MS);
|
|
180
|
+
if (token === void 0) throw error;
|
|
181
|
+
return token;
|
|
182
|
+
}
|
|
183
|
+
#form() {
|
|
184
|
+
const form = new URLSearchParams({
|
|
185
|
+
client_id: this.#clientId,
|
|
186
|
+
grant_type: "refresh_token",
|
|
187
|
+
refresh_token: this.#refreshToken
|
|
188
|
+
});
|
|
189
|
+
if (this.#clientSecret !== void 0) form.set("client_secret", this.#clientSecret);
|
|
190
|
+
return form;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Refreshes and saves a pair. A save can finish late (a retried kept
|
|
194
|
+
* pair, or a slow `onRotate`), so when the saved token has under 60 s
|
|
195
|
+
* left it exchanges once more with the now saved refresh token.
|
|
196
|
+
*
|
|
197
|
+
* @returns An access token.
|
|
198
|
+
*/
|
|
199
|
+
async #refreshAsync() {
|
|
200
|
+
const first = await this.#rotateAsync();
|
|
201
|
+
if (first.kind === "transient") return this.#fallback(first.error);
|
|
202
|
+
if (first.pair.expiresAt - Date.now() >= FALLBACK_MIN_MS) return first.pair.accessToken;
|
|
203
|
+
const second = await this.#rotateAsync();
|
|
204
|
+
return second.kind === "transient" ? this.#fallback(second.error) : second.pair.accessToken;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Records a refusal that spent the refresh token, so it is never sent
|
|
208
|
+
* again: an `invalid_grant`, or a 2xx whose body held no usable pair.
|
|
209
|
+
*
|
|
210
|
+
* @param error - The refusal.
|
|
211
|
+
* @param accepted - Whether the endpoint answered 2xx.
|
|
212
|
+
* @returns The refusal, to throw.
|
|
213
|
+
*/
|
|
214
|
+
#refused(error, accepted) {
|
|
215
|
+
if (accepted || error.code === "invalid_grant") this.#failure = error;
|
|
216
|
+
return error;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Exchanges the refresh token unless a kept unsaved pair exists, then
|
|
220
|
+
* saves the pair and makes it current.
|
|
221
|
+
*
|
|
222
|
+
* @returns The saved pair, or the transient failure of the exchange.
|
|
223
|
+
*/
|
|
224
|
+
async #rotateAsync() {
|
|
225
|
+
if (this.#pending === void 0) {
|
|
226
|
+
const outcome = await this.#exchangeAsync();
|
|
227
|
+
if (outcome.kind === "transient") return outcome;
|
|
228
|
+
this.#pending = outcome.pair;
|
|
229
|
+
}
|
|
230
|
+
const pending = this.#pending;
|
|
231
|
+
await this.#onRotate(pending.refreshToken);
|
|
232
|
+
this.#current = pending;
|
|
233
|
+
this.#refreshToken = pending.refreshToken;
|
|
234
|
+
this.#pending = void 0;
|
|
235
|
+
return {
|
|
236
|
+
kind: "ok",
|
|
237
|
+
pair: pending
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
async #sendAsync(signal) {
|
|
241
|
+
let response;
|
|
242
|
+
try {
|
|
243
|
+
response = await this.#send(TOKEN_URL, {
|
|
244
|
+
body: this.#form().toString(),
|
|
245
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
246
|
+
method: "POST",
|
|
247
|
+
signal
|
|
248
|
+
});
|
|
249
|
+
} catch (err) {
|
|
250
|
+
return {
|
|
251
|
+
error: err,
|
|
252
|
+
kind: "transient"
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
const receivedAt = Date.now();
|
|
256
|
+
const json = await readBodyAsync(response);
|
|
257
|
+
if (response.status === 429 || response.status >= 500) return {
|
|
258
|
+
error: refusal(json, response.status),
|
|
259
|
+
kind: "transient"
|
|
260
|
+
};
|
|
261
|
+
const pair = response.ok ? toPair(json, receivedAt) : void 0;
|
|
262
|
+
if (pair === void 0) throw this.#refused(refusal(json, response.status), response.ok);
|
|
263
|
+
return {
|
|
264
|
+
kind: "ok",
|
|
265
|
+
pair
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
#tokenLasting(minimumMs) {
|
|
269
|
+
const current = this.#current;
|
|
270
|
+
return current !== void 0 && current.expiresAt - Date.now() >= minimumMs ? current.accessToken : void 0;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Creates a `getAccessToken` that keeps an OAuth access token fresh by
|
|
275
|
+
* rotating one refresh token against the Roblox token endpoint. Use it as
|
|
276
|
+
* the `getAccessToken` of an OAuth `Credential`; you write the `identity`.
|
|
277
|
+
*
|
|
278
|
+
* Use one refresher per refresh token, in one process. A refresh token is
|
|
279
|
+
* single use, so two refreshers (or two processes) sharing one will spend it
|
|
280
|
+
* twice and lose the grant. Multi-instance consumers bring their own
|
|
281
|
+
* provider.
|
|
282
|
+
*
|
|
283
|
+
* - The first call refreshes. Later calls refresh when less than 120 s
|
|
284
|
+
* remain, measured on the local clock from receipt plus `expires_in`.
|
|
285
|
+
* - The new access token is used only after `onRotate` resolves. A spent
|
|
286
|
+
* refresh token is never sent again. If the saved access token then has
|
|
287
|
+
* less than 60 s left, it exchanges once more.
|
|
288
|
+
* - A network error, 5xx or 429 returns the current token while 60 s or
|
|
289
|
+
* more remain, and throws otherwise.
|
|
290
|
+
* - Each exchange has its own 30 s limit, for the request and the body
|
|
291
|
+
* read. A timeout is handled like a network error.
|
|
292
|
+
* - Any other non-2xx, or a 2xx without a usable token pair, throws a
|
|
293
|
+
* {@link TokenRefreshError}. After `invalid_grant` or such a 2xx, every
|
|
294
|
+
* call throws it again and sends nothing.
|
|
295
|
+
* - Concurrent calls share one exchange. A caller's `signal` stops only its
|
|
296
|
+
* own wait, never the exchange.
|
|
297
|
+
*
|
|
298
|
+
* @param options - The client, the refresh token and the rotation callback.
|
|
299
|
+
* @returns A `getAccessToken` for an OAuth `Credential`.
|
|
300
|
+
* @since 0.4.0
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
*
|
|
304
|
+
* ```ts
|
|
305
|
+
* import { createOAuthTokenRefresher, type Credential } from "@bedrock-rbx/ocale";
|
|
306
|
+
*
|
|
307
|
+
* let saved = "refresh-0";
|
|
308
|
+
* const getAccessToken = createOAuthTokenRefresher({
|
|
309
|
+
* clientId: "client-id",
|
|
310
|
+
* fetch: async () =>
|
|
311
|
+
* Response.json({ access_token: "access-1", expires_in: 900, refresh_token: "refresh-1" }),
|
|
312
|
+
* onRotate: (refreshToken) => {
|
|
313
|
+
* saved = refreshToken;
|
|
314
|
+
* },
|
|
315
|
+
* refreshToken: saved,
|
|
316
|
+
* });
|
|
317
|
+
* const credential: Credential = { getAccessToken, identity: "user-1", kind: "oauth" };
|
|
318
|
+
*
|
|
319
|
+
* expect(credential.kind).toBe("oauth");
|
|
320
|
+
* return getAccessToken({ signal: new AbortController().signal }).then((token) => {
|
|
321
|
+
* expect(token).toBe("access-1");
|
|
322
|
+
* expect(saved).toBe("refresh-1");
|
|
323
|
+
* });
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
function createOAuthTokenRefresher(options) {
|
|
327
|
+
const refresher = new OAuthTokenRefresher(options);
|
|
328
|
+
return async ({ signal }) => refresher.getAccessTokenAsync(signal);
|
|
329
|
+
}
|
|
330
|
+
async function readBodyAsync(response) {
|
|
331
|
+
try {
|
|
332
|
+
return JSON.parse(await response.text());
|
|
333
|
+
} catch {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function isRecord(value) {
|
|
338
|
+
return value instanceof Object && !Array.isArray(value);
|
|
339
|
+
}
|
|
340
|
+
function toPair(body, receivedAt) {
|
|
341
|
+
if (!isRecord(body)) return;
|
|
342
|
+
const { access_token: accessToken, expires_in: expiresIn, refresh_token: refreshToken } = body;
|
|
343
|
+
if (typeof accessToken !== "string" || accessToken === "" || typeof refreshToken !== "string" || refreshToken === "" || typeof expiresIn !== "number" || !Number.isFinite(expiresIn) || expiresIn <= 0) return;
|
|
344
|
+
return {
|
|
345
|
+
accessToken,
|
|
346
|
+
expiresAt: receivedAt + expiresIn * 1e3,
|
|
347
|
+
refreshToken
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function refusal(body, statusCode) {
|
|
351
|
+
const code = isRecord(body) && typeof body["error"] === "string" ? body["error"] : void 0;
|
|
352
|
+
return new TokenRefreshError(`OAuth token refresh failed with HTTP ${statusCode}`, {
|
|
353
|
+
code,
|
|
354
|
+
statusCode
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
function abortedWait(signal) {
|
|
358
|
+
return new RequestAbortedError("Access token wait was aborted", { reason: signal.reason });
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Waits for a shared promise, but lets one caller's signal end only that
|
|
362
|
+
* caller's wait.
|
|
363
|
+
*
|
|
364
|
+
* @template T - The value type of the shared promise.
|
|
365
|
+
* @param promise - The shared promise.
|
|
366
|
+
* @param signal - The caller's signal.
|
|
367
|
+
* @returns The value of the shared promise.
|
|
368
|
+
* @rejects RequestAbortedError when the signal aborts first, or the shared
|
|
369
|
+
* promise's own error.
|
|
370
|
+
*/
|
|
371
|
+
async function waitAsync(promise, signal) {
|
|
372
|
+
return new Promise((resolve, reject) => {
|
|
373
|
+
function onAbort() {
|
|
374
|
+
reject(abortedWait(signal));
|
|
375
|
+
}
|
|
376
|
+
signal.addEventListener("abort", onAbort);
|
|
377
|
+
promise.then(resolve).catch(reject).finally(() => {
|
|
378
|
+
signal.removeEventListener("abort", onAbort);
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
}
|
|
67
382
|
//#endregion
|
|
68
|
-
export { ApiError, GATEWAY_REJECTED, NetworkError, OpenCloudError, PermissionError, PollAbortedError, PollTimeoutError, RESPONSE_UNPARSEABLE, RateLimitError, RateLimitWaitRefusedError, RequestAbortedError, RequestDeadlineExceededError, RetryDelayExceededError, TRANSIENT_TRANSPORT_CODES, ValidationError, createFetchHttpClient, requestContextOf };
|
|
383
|
+
export { ApiError, BadgeCostMismatchError, CredentialError, CredentialNotSupportedError, CredentialRejectedError, GATEWAY_REJECTED, NetworkError, OpenCloudError, PermissionError, PollAbortedError, PollTimeoutError, RESPONSE_UNPARSEABLE, RateLimitError, RateLimitWaitRefusedError, RequestAbortedError, RequestDeadlineExceededError, RetryDelayExceededError, TRANSIENT_TRANSPORT_CODES, TokenRefreshError, UnexpectedResponseError, ValidationError, createFetchHttpClient, createOAuthTokenRefresher, requestContextOf };
|
|
69
384
|
|
|
70
385
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["createInternalFetchHttpClient"],"sources":["../src/client/fetch-http-client.ts"],"sourcesContent":["import { createFetchHttpClient as createInternalFetchHttpClient } from \"../internal/http/fetch-client.ts\";\nimport type { HttpClient } from \"./types.ts\";\n\n/**\n * Creates the fetch-backed HTTP transport Ocale uses by default.\n *\n * Wrap the returned transport to add tracing, metrics, recording, or other\n * request-level behavior while retaining Ocale's authentication, timeout,\n * upload, response-parsing, and error-classification semantics.\n *\n * @returns Ocale's default fetch-backed HTTP transport.\n * @since 0.3.1\n *\n * @example\n *\n * ```ts\n * import {\n * createFetchHttpClient,\n * type HttpClient,\n * type HttpRequest,\n * } from \"@bedrock-rbx/ocale\";\n * import {\n * type DeleteExperienceIconParameters,\n * UniversesClient,\n * } from \"@bedrock-rbx/ocale/universes\";\n *\n * const defaultHttpClient = createFetchHttpClient();\n * let observedRequests: ReadonlyArray<HttpRequest> = [];\n * const tracedHttpClient: HttpClient = {\n * async request(request, config) {\n * observedRequests = [...observedRequests, request];\n * return defaultHttpClient.request(request, config);\n * },\n * };\n * // A data URL keeps this executable example offline. Production clients\n * // normally omit baseUrl and use Ocale's Roblox Open Cloud default.\n * const commonOptions = { apiKey: \"your-key\", baseUrl: \"data:,#\" };\n * const client = new UniversesClient({\n * ...commonOptions,\n * httpClient: tracedHttpClient,\n * });\n * const undecoratedClient = new UniversesClient({\n * ...commonOptions,\n * httpClient: defaultHttpClient,\n * });\n * const parameters: DeleteExperienceIconParameters = {\n * languageCode: \"en\",\n * universeId: \"42\",\n * };\n * expect(client).toBeInstanceOf(UniversesClient);\n * return Promise.all([\n * client.icon.delete(parameters),\n * undecoratedClient.icon.delete(parameters),\n * ]).then(([result, undecoratedResult]) => {\n * expect(observedRequests).toStrictEqual([{\n * method: \"DELETE\",\n * url: \"/legacy-game-internationalization/v1/game-icon/games/42/language-codes/en\",\n * }]);\n * expect(result).toStrictEqual({ data: undefined, success: true });\n * expect(result).toStrictEqual(undecoratedResult);\n * });\n * ```\n */\nexport const createFetchHttpClient: () => HttpClient = createInternalFetchHttpClient;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,MAAa,wBAA0CA"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["createInternalFetchHttpClient"],"sources":["../src/client/fetch-http-client.ts","../src/errors/token-refresh-error.ts","../src/client/oauth-token-refresher.ts"],"sourcesContent":["import { createFetchHttpClient as createInternalFetchHttpClient } from \"../internal/http/fetch-client.ts\";\nimport type { HttpClient } from \"./types.ts\";\n\n/**\n * Creates the fetch-backed HTTP transport Ocale uses by default.\n *\n * Wrap the returned transport to add tracing, metrics, recording, or other\n * request-level behavior while retaining Ocale's authentication, timeout,\n * upload, response-parsing, and error-classification semantics.\n *\n * Pass `fetch` to send through a wrapped or replacement `fetch`. Omit it to\n * use the global `fetch`.\n *\n * @param options - Optional transport settings.\n * @param options.fetch - The `fetch` to send requests through.\n * @returns Ocale's default fetch-backed HTTP transport.\n * @since 0.3.1\n *\n * @example\n *\n * ```ts\n * import {\n * createFetchHttpClient,\n * type HttpClient,\n * type HttpRequest,\n * } from \"@bedrock-rbx/ocale\";\n * import {\n * type DeleteExperienceIconParameters,\n * UniversesClient,\n * } from \"@bedrock-rbx/ocale/universes\";\n *\n * // An injected response keeps this executable example offline.\n * // Omit fetch in production to use the runtime's global fetch.\n * const defaultHttpClient = createFetchHttpClient({\n * fetch: async () => new Response(),\n * });\n * let observedRequests: ReadonlyArray<HttpRequest> = [];\n * const tracedHttpClient: HttpClient = {\n * async request(request, config) {\n * observedRequests = [...observedRequests, request];\n * return defaultHttpClient.request(request, config);\n * },\n * };\n * const commonOptions = {\n * credential: { apiKey: \"your-key\", kind: \"apiKey\" as const },\n * };\n * const client = new UniversesClient({\n * ...commonOptions,\n * httpClient: tracedHttpClient,\n * });\n * const undecoratedClient = new UniversesClient({\n * ...commonOptions,\n * httpClient: defaultHttpClient,\n * });\n * const parameters: DeleteExperienceIconParameters = {\n * languageCode: \"en\",\n * universeId: \"42\",\n * };\n * expect(client).toBeInstanceOf(UniversesClient);\n * return Promise.all([\n * client.icon.delete(parameters),\n * undecoratedClient.icon.delete(parameters),\n * ]).then(([result, undecoratedResult]) => {\n * expect(observedRequests).toStrictEqual([{\n * method: \"DELETE\",\n * url: \"/legacy-game-internationalization/v1/game-icon/games/42/language-codes/en\",\n * }]);\n * expect(result).toStrictEqual({ data: undefined, success: true });\n * expect(result).toStrictEqual(undecoratedResult);\n * });\n * ```\n */\nexport function createFetchHttpClient(options?: {\n\treadonly fetch?: (input: string, init: RequestInit) => Promise<Response>;\n}): HttpClient {\n\treturn createInternalFetchHttpClient(options?.fetch);\n}\n","import { OpenCloudError, type OpenCloudErrorOptions } from \"./base.ts\";\n\n/**\n * Options for constructing a {@link TokenRefreshError}.\n *\n * @since 0.4.0\n */\nexport interface TokenRefreshErrorOptions extends OpenCloudErrorOptions {\n\t/** HTTP status of the token endpoint's response. */\n\treadonly statusCode: number;\n}\n\n/**\n * Thrown by the `getAccessToken` that `createOAuthTokenRefresher` returns\n * when the Roblox token endpoint refuses a refresh. `code` is the OAuth\n * `error` field of the response body (for example `invalid_grant`), or\n * `undefined` when the body has none. A client that calls the provider\n * returns it as the `cause` of a `CredentialError`.\n *\n * @since 0.4.0\n *\n * @example\n *\n * ```ts\n * import { TokenRefreshError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new TokenRefreshError(\"Token refresh refused\", {\n * code: \"invalid_grant\",\n * statusCode: 400,\n * });\n *\n * expect(error.code).toBe(\"invalid_grant\");\n * expect(error.statusCode).toBe(400);\n * ```\n */\nexport class TokenRefreshError extends OpenCloudError {\n\tpublic override readonly name: string = \"TokenRefreshError\";\n\t/** HTTP status of the token endpoint's response. */\n\tpublic readonly statusCode: number;\n\n\t/**\n\t * Creates a new TokenRefreshError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - The OAuth error code and the HTTP status.\n\t */\n\tconstructor(message: string, options: TokenRefreshErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.statusCode = options.statusCode;\n\t}\n}\n","import { RequestAbortedError } from \"../errors/request-aborted.ts\";\nimport { TokenRefreshError } from \"../errors/token-refresh-error.ts\";\nimport type { Credential } from \"./types.ts\";\n\nconst TOKEN_URL = \"https://apis.roblox.com/oauth/v1/token\";\nconst REFRESH_BELOW_MS = 120_000;\nconst FALLBACK_MIN_MS = 60_000;\nconst EXCHANGE_TIMEOUT_MS = 30_000;\n\n/**\n * Options for {@link createOAuthTokenRefresher}.\n *\n * @since 0.4.0\n */\nexport interface OAuthTokenRefresherOptions {\n\t/** The OAuth app's client id. */\n\treadonly clientId: string;\n\t/**\n\t * The client secret of a confidential app. Omit it for a public app that\n\t * uses a code verifier.\n\t */\n\treadonly clientSecret?: string;\n\t/**\n\t * The `fetch` to send token requests through. Defaults to the global\n\t * `fetch`.\n\t */\n\treadonly fetch?: (input: string, init: RequestInit) => Promise<Response>;\n\t/**\n\t * Saves the new refresh token after each rotation. The new access token is\n\t * used only after it resolves. If it throws, the call throws, and the next\n\t * call retries it with the same token and does no exchange.\n\t */\n\treadonly onRotate: (refreshToken: string) => Promise<void> | void;\n\t/** The current refresh token. It is spent by the first refresh. */\n\treadonly refreshToken: string;\n}\n\ninterface TokenPair {\n\treadonly accessToken: string;\n\treadonly expiresAt: number;\n\treadonly refreshToken: string;\n}\n\ntype ExchangeOutcome =\n\t| { readonly error: unknown; readonly kind: \"transient\" }\n\t| { readonly kind: \"ok\"; readonly pair: TokenPair };\n\n/** The `getAccessToken` of an OAuth {@link Credential}. */\ntype AccessTokenProvider = Extract<Credential, { kind: \"oauth\" }>[\"getAccessToken\"];\n\ntype FetchSeam = NonNullable<OAuthTokenRefresherOptions[\"fetch\"]>;\n\nclass OAuthTokenRefresher {\n\treadonly #clientId: string;\n\treadonly #clientSecret: string | undefined;\n\treadonly #onRotate: OAuthTokenRefresherOptions[\"onRotate\"];\n\treadonly #send: FetchSeam;\n\n\t#current: TokenPair | undefined;\n\t#failure: TokenRefreshError | undefined;\n\t#inFlight: Promise<string> | undefined;\n\t#pending: TokenPair | undefined;\n\t#refreshToken: string;\n\n\tconstructor(options: OAuthTokenRefresherOptions) {\n\t\tthis.#clientId = options.clientId;\n\t\tthis.#clientSecret = options.clientSecret;\n\t\tthis.#onRotate = options.onRotate;\n\t\tthis.#refreshToken = options.refreshToken;\n\t\tthis.#send = options.fetch ?? fetch;\n\t}\n\n\tpublic async getAccessTokenAsync(signal: AbortSignal): Promise<string> {\n\t\tif (signal.aborted) {\n\t\t\tthrow abortedWait(signal);\n\t\t}\n\n\t\tif (this.#failure !== undefined) {\n\t\t\tthrow this.#failure;\n\t\t}\n\n\t\t// A kept unsaved pair only exists after a refresh, which runs below\n\t\t// the threshold, so the current token never short-circuits its save.\n\t\tconst cached = this.#tokenLasting(REFRESH_BELOW_MS);\n\t\tif (cached !== undefined) {\n\t\t\treturn cached;\n\t\t}\n\n\t\tthis.#inFlight ??= this.#refreshAsync().finally(() => {\n\t\t\tthis.#inFlight = undefined;\n\t\t});\n\t\treturn waitAsync(this.#inFlight, signal);\n\t}\n\n\t/**\n\t * Runs one exchange under its own time limit, apart from any caller's\n\t * signal. A timeout is transient, like a network error.\n\t *\n\t * @returns The exchange outcome.\n\t */\n\tasync #exchangeAsync(): Promise<ExchangeOutcome> {\n\t\tconst controller = new AbortController();\n\t\tconst exchange = this.#sendAsync(controller.signal);\n\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\tconst timeout = new Promise<ExchangeOutcome>((resolve) => {\n\t\t\ttimer = setTimeout(() => {\n\t\t\t\tconst error = new DOMException(\"OAuth token exchange timed out\", \"TimeoutError\");\n\t\t\t\tcontroller.abort(error);\n\t\t\t\tresolve({ error, kind: \"transient\" });\n\t\t\t}, EXCHANGE_TIMEOUT_MS);\n\t\t});\n\n\t\ttry {\n\t\t\treturn await Promise.race([exchange, timeout]);\n\t\t} finally {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t}\n\n\t#fallback(error: unknown): string {\n\t\tconst token = this.#tokenLasting(FALLBACK_MIN_MS);\n\t\tif (token === undefined) {\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn token;\n\t}\n\n\t#form(): URLSearchParams {\n\t\tconst form = new URLSearchParams({\n\t\t\tclient_id: this.#clientId,\n\t\t\tgrant_type: \"refresh_token\",\n\t\t\trefresh_token: this.#refreshToken,\n\t\t});\n\t\tif (this.#clientSecret !== undefined) {\n\t\t\tform.set(\"client_secret\", this.#clientSecret);\n\t\t}\n\n\t\treturn form;\n\t}\n\n\t/**\n\t * Refreshes and saves a pair. A save can finish late (a retried kept\n\t * pair, or a slow `onRotate`), so when the saved token has under 60 s\n\t * left it exchanges once more with the now saved refresh token.\n\t *\n\t * @returns An access token.\n\t */\n\tasync #refreshAsync(): Promise<string> {\n\t\tconst first = await this.#rotateAsync();\n\t\tif (first.kind === \"transient\") {\n\t\t\treturn this.#fallback(first.error);\n\t\t}\n\n\t\tif (first.pair.expiresAt - Date.now() >= FALLBACK_MIN_MS) {\n\t\t\treturn first.pair.accessToken;\n\t\t}\n\n\t\tconst second = await this.#rotateAsync();\n\t\treturn second.kind === \"transient\" ? this.#fallback(second.error) : second.pair.accessToken;\n\t}\n\n\t/**\n\t * Records a refusal that spent the refresh token, so it is never sent\n\t * again: an `invalid_grant`, or a 2xx whose body held no usable pair.\n\t *\n\t * @param error - The refusal.\n\t * @param accepted - Whether the endpoint answered 2xx.\n\t * @returns The refusal, to throw.\n\t */\n\t#refused(error: TokenRefreshError, accepted: boolean): TokenRefreshError {\n\t\tif (accepted || error.code === \"invalid_grant\") {\n\t\t\tthis.#failure = error;\n\t\t}\n\n\t\treturn error;\n\t}\n\n\t/**\n\t * Exchanges the refresh token unless a kept unsaved pair exists, then\n\t * saves the pair and makes it current.\n\t *\n\t * @returns The saved pair, or the transient failure of the exchange.\n\t */\n\tasync #rotateAsync(): Promise<ExchangeOutcome> {\n\t\tif (this.#pending === undefined) {\n\t\t\tconst outcome = await this.#exchangeAsync();\n\t\t\tif (outcome.kind === \"transient\") {\n\t\t\t\treturn outcome;\n\t\t\t}\n\n\t\t\tthis.#pending = outcome.pair;\n\t\t}\n\n\t\tconst pending = this.#pending;\n\t\tawait this.#onRotate(pending.refreshToken);\n\t\tthis.#current = pending;\n\t\tthis.#refreshToken = pending.refreshToken;\n\t\tthis.#pending = undefined;\n\t\treturn { kind: \"ok\", pair: pending };\n\t}\n\n\tasync #sendAsync(signal: AbortSignal): Promise<ExchangeOutcome> {\n\t\tlet response: Response;\n\t\ttry {\n\t\t\tresponse = await this.#send(TOKEN_URL, {\n\t\t\t\tbody: this.#form().toString(),\n\t\t\t\theaders: { \"content-type\": \"application/x-www-form-urlencoded\" },\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tsignal,\n\t\t\t});\n\t\t} catch (err) {\n\t\t\treturn { error: err, kind: \"transient\" };\n\t\t}\n\n\t\tconst receivedAt = Date.now();\n\t\tconst json = await readBodyAsync(response);\n\t\tif (response.status === 429 || response.status >= 500) {\n\t\t\treturn { error: refusal(json, response.status), kind: \"transient\" };\n\t\t}\n\n\t\tconst pair = response.ok ? toPair(json, receivedAt) : undefined;\n\t\tif (pair === undefined) {\n\t\t\tthrow this.#refused(refusal(json, response.status), response.ok);\n\t\t}\n\n\t\treturn { kind: \"ok\", pair };\n\t}\n\n\t#tokenLasting(minimumMs: number): string | undefined {\n\t\tconst current = this.#current;\n\t\treturn current !== undefined && current.expiresAt - Date.now() >= minimumMs\n\t\t\t? current.accessToken\n\t\t\t: undefined;\n\t}\n}\n\n/**\n * Creates a `getAccessToken` that keeps an OAuth access token fresh by\n * rotating one refresh token against the Roblox token endpoint. Use it as\n * the `getAccessToken` of an OAuth `Credential`; you write the `identity`.\n *\n * Use one refresher per refresh token, in one process. A refresh token is\n * single use, so two refreshers (or two processes) sharing one will spend it\n * twice and lose the grant. Multi-instance consumers bring their own\n * provider.\n *\n * - The first call refreshes. Later calls refresh when less than 120 s\n * remain, measured on the local clock from receipt plus `expires_in`.\n * - The new access token is used only after `onRotate` resolves. A spent\n * refresh token is never sent again. If the saved access token then has\n * less than 60 s left, it exchanges once more.\n * - A network error, 5xx or 429 returns the current token while 60 s or\n * more remain, and throws otherwise.\n * - Each exchange has its own 30 s limit, for the request and the body\n * read. A timeout is handled like a network error.\n * - Any other non-2xx, or a 2xx without a usable token pair, throws a\n * {@link TokenRefreshError}. After `invalid_grant` or such a 2xx, every\n * call throws it again and sends nothing.\n * - Concurrent calls share one exchange. A caller's `signal` stops only its\n * own wait, never the exchange.\n *\n * @param options - The client, the refresh token and the rotation callback.\n * @returns A `getAccessToken` for an OAuth `Credential`.\n * @since 0.4.0\n *\n * @example\n *\n * ```ts\n * import { createOAuthTokenRefresher, type Credential } from \"@bedrock-rbx/ocale\";\n *\n * let saved = \"refresh-0\";\n * const getAccessToken = createOAuthTokenRefresher({\n * clientId: \"client-id\",\n * fetch: async () =>\n * Response.json({ access_token: \"access-1\", expires_in: 900, refresh_token: \"refresh-1\" }),\n * onRotate: (refreshToken) => {\n * saved = refreshToken;\n * },\n * refreshToken: saved,\n * });\n * const credential: Credential = { getAccessToken, identity: \"user-1\", kind: \"oauth\" };\n *\n * expect(credential.kind).toBe(\"oauth\");\n * return getAccessToken({ signal: new AbortController().signal }).then((token) => {\n * expect(token).toBe(\"access-1\");\n * expect(saved).toBe(\"refresh-1\");\n * });\n * ```\n */\nexport function createOAuthTokenRefresher(\n\toptions: OAuthTokenRefresherOptions,\n): (...args: Parameters<AccessTokenProvider>) => Promise<string> {\n\tconst refresher = new OAuthTokenRefresher(options);\n\treturn async ({ signal }) => refresher.getAccessTokenAsync(signal);\n}\n\nasync function readBodyAsync(response: Response): Promise<JSONValue | undefined> {\n\ttry {\n\t\treturn JSON.parse(await response.text());\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction isRecord(value: JSONValue | undefined): value is Readonly<Record<string, JSONValue>> {\n\treturn value instanceof Object && !Array.isArray(value);\n}\n\nfunction toPair(body: JSONValue | undefined, receivedAt: number): TokenPair | undefined {\n\tif (!isRecord(body)) {\n\t\treturn undefined;\n\t}\n\n\tconst { access_token: accessToken, expires_in: expiresIn, refresh_token: refreshToken } = body;\n\tif (\n\t\ttypeof accessToken !== \"string\" ||\n\t\taccessToken === \"\" ||\n\t\ttypeof refreshToken !== \"string\" ||\n\t\trefreshToken === \"\" ||\n\t\ttypeof expiresIn !== \"number\" ||\n\t\t!Number.isFinite(expiresIn) ||\n\t\texpiresIn <= 0\n\t) {\n\t\treturn undefined;\n\t}\n\n\treturn { accessToken, expiresAt: receivedAt + expiresIn * 1000, refreshToken };\n}\n\nfunction refusal(body: JSONValue | undefined, statusCode: number): TokenRefreshError {\n\tconst code = isRecord(body) && typeof body[\"error\"] === \"string\" ? body[\"error\"] : undefined;\n\treturn new TokenRefreshError(`OAuth token refresh failed with HTTP ${statusCode}`, {\n\t\tcode,\n\t\tstatusCode,\n\t});\n}\n\nfunction abortedWait(signal: AbortSignal): RequestAbortedError {\n\treturn new RequestAbortedError(\"Access token wait was aborted\", { reason: signal.reason });\n}\n\n/**\n * Waits for a shared promise, but lets one caller's signal end only that\n * caller's wait.\n *\n * @template T - The value type of the shared promise.\n * @param promise - The shared promise.\n * @param signal - The caller's signal.\n * @returns The value of the shared promise.\n * @rejects RequestAbortedError when the signal aborts first, or the shared\n * promise's own error.\n */\nasync function waitAsync<T>(promise: Promise<T>, signal: AbortSignal): Promise<T> {\n\treturn new Promise<T>((resolve, reject) => {\n\t\tfunction onAbort(): void {\n\t\t\treject(abortedWait(signal));\n\t\t}\n\n\t\tsignal.addEventListener(\"abort\", onAbort);\n\t\tpromise\n\t\t\t.then(resolve)\n\t\t\t.catch(reject)\n\t\t\t.finally(() => {\n\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t});\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,SAAgB,sBAAsB,SAEvB;CACd,OAAOA,wBAA8B,SAAS,KAAK;AACpD;;;;;;;;;;;;;;;;;;;;;;;;;;ACzCA,IAAa,oBAAb,cAAuC,eAAe;CACrD,OAAwC;;CAExC;;;;;;;CAQA,YAAY,SAAiB,SAAmC;EAC/D,MAAM,SAAS,OAAO;EACtB,KAAK,aAAa,QAAQ;CAC3B;AACD;;;AC9CA,MAAM,YAAY;AAClB,MAAM,mBAAmB;AACzB,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AA6C5B,IAAM,sBAAN,MAA0B;CACzB;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAAqC;EAChD,KAAK,YAAY,QAAQ;EACzB,KAAK,gBAAgB,QAAQ;EAC7B,KAAK,YAAY,QAAQ;EACzB,KAAK,gBAAgB,QAAQ;EAC7B,KAAK,QAAQ,QAAQ,SAAS;CAC/B;CAEA,MAAa,oBAAoB,QAAsC;EACtE,IAAI,OAAO,SACV,MAAM,YAAY,MAAM;EAGzB,IAAI,KAAK,a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b,MAAM,MAAM,CAAC,CACb,cAAc;GACd,OAAO,oBAAoB,SAAS,OAAO;EAC5C,CAAC;CACH,CAAC;AACF"}
|
package/dist/locales.d.mts
CHANGED
|
@@ -1,2 +1,30 @@
|
|
|
1
|
-
import { i as RobloxLocale, n as RobloxCreatorLocale, r as RobloxLanguageCode, t as ROBLOX_CREATOR_LOCALES } from "./data.generated-
|
|
2
|
-
|
|
1
|
+
import { i as RobloxLocale, n as RobloxCreatorLocale, r as RobloxLanguageCode, t as ROBLOX_CREATOR_LOCALES } from "./data.generated-D_vpa5-g.mjs";
|
|
2
|
+
//#region src/locales/localization-key.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Any string Roblox accepts as a localization key: an underscore locale such
|
|
5
|
+
* as `en_us`, or a language code such as `en` or `zh-hans`.
|
|
6
|
+
*
|
|
7
|
+
* @since 0.4.0
|
|
8
|
+
*/
|
|
9
|
+
type RobloxLocalizationKey = RobloxLanguageCode | RobloxLocale;
|
|
10
|
+
/**
|
|
11
|
+
* Checks whether a string is a Roblox localization key, narrowing it to
|
|
12
|
+
* {@link RobloxLocalizationKey}. Region-qualified hyphen forms such as
|
|
13
|
+
* `en-us` are rejected (Roblox writes them as `en_us`), as are language names
|
|
14
|
+
* such as `english`.
|
|
15
|
+
*
|
|
16
|
+
* @since 0.4.0
|
|
17
|
+
* @param value - The string to check.
|
|
18
|
+
* @returns `true` when `value` is a known locale or language code.
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { isRobloxLocalizationKey } from "@bedrock-rbx/ocale/locales";
|
|
22
|
+
*
|
|
23
|
+
* expect(isRobloxLocalizationKey("pt_br")).toBe(true);
|
|
24
|
+
* expect(isRobloxLocalizationKey("en-us")).toBe(false);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function isRobloxLocalizationKey(value: string): value is RobloxLocalizationKey;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { ROBLOX_CREATOR_LOCALES, type RobloxCreatorLocale, type RobloxLanguageCode, type RobloxLocale, type RobloxLocalizationKey };
|
|
30
|
+
//# sourceMappingURL=locales.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.d.mts","names":[],"sources":["../src/locales/localization-key.ts"],"mappings":";;;;;;;;KAYY,wBAAwB,qBAAqB;;;;;;;;;;;;;;;;;;wBAuBzC,wBAAwB,gBAAgB,SAAS"}
|
package/dist/locales.mjs
CHANGED
|
@@ -509,6 +509,29 @@ const ROBLOX_CREATOR_LOCALES = [
|
|
|
509
509
|
}
|
|
510
510
|
];
|
|
511
511
|
//#endregion
|
|
512
|
-
|
|
512
|
+
//#region src/locales/localization-key.ts
|
|
513
|
+
const LOCALIZATION_KEYS = new Set(ROBLOX_CREATOR_LOCALES.flatMap((row) => [row.locale, row.languageCode]));
|
|
514
|
+
/**
|
|
515
|
+
* Checks whether a string is a Roblox localization key, narrowing it to
|
|
516
|
+
* {@link RobloxLocalizationKey}. Region-qualified hyphen forms such as
|
|
517
|
+
* `en-us` are rejected (Roblox writes them as `en_us`), as are language names
|
|
518
|
+
* such as `english`.
|
|
519
|
+
*
|
|
520
|
+
* @since 0.4.0
|
|
521
|
+
* @param value - The string to check.
|
|
522
|
+
* @returns `true` when `value` is a known locale or language code.
|
|
523
|
+
* @example
|
|
524
|
+
* ```ts
|
|
525
|
+
* import { isRobloxLocalizationKey } from "@bedrock-rbx/ocale/locales";
|
|
526
|
+
*
|
|
527
|
+
* expect(isRobloxLocalizationKey("pt_br")).toBe(true);
|
|
528
|
+
* expect(isRobloxLocalizationKey("en-us")).toBe(false);
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
531
|
+
function isRobloxLocalizationKey(value) {
|
|
532
|
+
return LOCALIZATION_KEYS.has(value);
|
|
533
|
+
}
|
|
534
|
+
//#endregion
|
|
535
|
+
export { ROBLOX_CREATOR_LOCALES, isRobloxLocalizationKey };
|
|
513
536
|
|
|
514
537
|
//# sourceMappingURL=locales.mjs.map
|
package/dist/locales.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.mjs","names":[],"sources":["../src/locales/data.generated.ts"],"sourcesContent":["// @generated by scripts/fetch-locales.ts. Do not edit by hand.\n// Source: https://locale.roblox.com/v1/locales/supported-locales-for-creators\n\n/**\n * One row in the vendored Roblox creator-locale list.\n *\n * @since 0.1.0\n */\nexport interface RobloxCreatorLocale {\n\treadonly locale: string;\n\treadonly languageCode: string;\n\treadonly name: string;\n\treadonly nativeName: string;\n\treadonly isRightToLeft: boolean;\n\treadonly isEnabledForFullExperience: boolean;\n\treadonly isEnabledForInGameUgc: boolean;\n\treadonly isEnabledForSignupAndLogin: boolean;\n}\n\n/**\n * Vendored snapshot of\n * `https://locale.roblox.com/v1/locales/supported-locales-for-creators`.\n * Refreshed by `pnpm --filter @bedrock-rbx/ocale refresh-locales`.\n *\n * @since 0.1.0\n */\nexport const ROBLOX_CREATOR_LOCALES = [\n\t{\n\t\tlocale: \"ar_001\",\n\t\tlanguageCode: \"ar\",\n\t\tname: \"Arabic\",\n\t\tnativeName: \"العربية\",\n\t\tisRightToLeft: true,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"bg_bg\",\n\t\tlanguageCode: \"bg\",\n\t\tname: \"Bulgarian\",\n\t\tnativeName: \"Български\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"bn_bd\",\n\t\tlanguageCode: \"bn\",\n\t\tname: \"Bengali\",\n\t\tnativeName: \"বাংলা\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"bs_ba\",\n\t\tlanguageCode: \"bs\",\n\t\tname: \"Bosnian\",\n\t\tnativeName: \"Босански\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"cs_cz\",\n\t\tlanguageCode: \"cs\",\n\t\tname: \"Czech\",\n\t\tnativeName: \"Čeština\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"da_dk\",\n\t\tlanguageCode: \"da\",\n\t\tname: \"Danish\",\n\t\tnativeName: \"Dansk\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"de_de\",\n\t\tlanguageCode: \"de\",\n\t\tname: \"German\",\n\t\tnativeName: \"Deutsch\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"el_gr\",\n\t\tlanguageCode: \"el\",\n\t\tname: \"Greek\",\n\t\tnativeName: \"Ελληνικά\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"en_gb\",\n\t\tlanguageCode: \"en\",\n\t\tname: \"English (United Kingdom)\",\n\t\tnativeName: \"English (United Kingdom)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"en_us\",\n\t\tlanguageCode: \"en\",\n\t\tname: \"English (United States)\",\n\t\tnativeName: \"English (United States)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"es_es\",\n\t\tlanguageCode: \"es\",\n\t\tname: \"Spanish (Spain)\",\n\t\tnativeName: \"Español (España)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"es_mx\",\n\t\tlanguageCode: \"es\",\n\t\tname: \"Spanish (Mexico)\",\n\t\tnativeName: \"Español (México)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"et_ee\",\n\t\tlanguageCode: \"et\",\n\t\tname: \"Estonian\",\n\t\tnativeName: \"Eesti\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"fi_fi\",\n\t\tlanguageCode: \"fi\",\n\t\tname: \"Finnish\",\n\t\tnativeName: \"Suomi\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"fil_ph\",\n\t\tlanguageCode: \"fil\",\n\t\tname: \"Filipino\",\n\t\tnativeName: \"Filipino\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"fr_ca\",\n\t\tlanguageCode: \"fr\",\n\t\tname: \"French (Canada)\",\n\t\tnativeName: \"Français (Canada)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"fr_fr\",\n\t\tlanguageCode: \"fr\",\n\t\tname: \"French (France)\",\n\t\tnativeName: \"Français (France)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"hi_in\",\n\t\tlanguageCode: \"hi\",\n\t\tname: \"Hindi\",\n\t\tnativeName: \"हिन्दी\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"hr_hr\",\n\t\tlanguageCode: \"hr\",\n\t\tname: \"Croatian\",\n\t\tnativeName: \"Hrvatski\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"hu_hu\",\n\t\tlanguageCode: \"hu\",\n\t\tname: \"Hungarian\",\n\t\tnativeName: \"Magyar\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"id_id\",\n\t\tlanguageCode: \"id\",\n\t\tname: \"Indonesian\",\n\t\tnativeName: \"Bahasa Indonesia\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"it_it\",\n\t\tlanguageCode: \"it\",\n\t\tname: \"Italian\",\n\t\tnativeName: \"Italiano\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"ja_jp\",\n\t\tlanguageCode: \"ja\",\n\t\tname: \"Japanese\",\n\t\tnativeName: \"日本語\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"ka_ge\",\n\t\tlanguageCode: \"ka\",\n\t\tname: \"Georgian\",\n\t\tnativeName: \"ქართული\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"kk_kz\",\n\t\tlanguageCode: \"kk\",\n\t\tname: \"Kazakh\",\n\t\tnativeName: \"Қазақ Тілі\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"km_kh\",\n\t\tlanguageCode: \"km\",\n\t\tname: \"Khmer\",\n\t\tnativeName: \"ភាសាខ្មែរ\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"ko_kr\",\n\t\tlanguageCode: \"ko\",\n\t\tname: \"Korean\",\n\t\tnativeName: \"한국어\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"lt_lt\",\n\t\tlanguageCode: \"lt\",\n\t\tname: \"Lithuanian\",\n\t\tnativeName: \"Lietuvių\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"lv_lv\",\n\t\tlanguageCode: \"lv\",\n\t\tname: \"Latvian\",\n\t\tnativeName: \"Latviešu\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"ms_my\",\n\t\tlanguageCode: \"ms\",\n\t\tname: \"Malay\",\n\t\tnativeName: \"Bahasa Melayu\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"my_mm\",\n\t\tlanguageCode: \"my\",\n\t\tname: \"Burmese\",\n\t\tnativeName: \"ဗမာစာ\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"nb_no\",\n\t\tlanguageCode: \"nb\",\n\t\tname: \"Bokmal\",\n\t\tnativeName: \"Bokmål\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"nl_nl\",\n\t\tlanguageCode: \"nl\",\n\t\tname: \"Dutch\",\n\t\tnativeName: \"Nederlands\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"pl_pl\",\n\t\tlanguageCode: \"pl\",\n\t\tname: \"Polish\",\n\t\tnativeName: \"Polski\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"pt_br\",\n\t\tlanguageCode: \"pt\",\n\t\tname: \"Portuguese (Brazil)\",\n\t\tnativeName: \"Português (Brasil)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"pt_pt\",\n\t\tlanguageCode: \"pt\",\n\t\tname: \"Portuguese (Portugal)\",\n\t\tnativeName: \"Português (Portugal)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"ro_ro\",\n\t\tlanguageCode: \"ro\",\n\t\tname: \"Romanian\",\n\t\tnativeName: \"Română\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"ru_ru\",\n\t\tlanguageCode: \"ru\",\n\t\tname: \"Russian\",\n\t\tnativeName: \"Русский\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"si_lk\",\n\t\tlanguageCode: \"si\",\n\t\tname: \"Sinhala\",\n\t\tnativeName: \"සිංහල\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"sk_sk\",\n\t\tlanguageCode: \"sk\",\n\t\tname: \"Slovak\",\n\t\tnativeName: \"Slovenčina\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"sl_sl\",\n\t\tlanguageCode: \"sl\",\n\t\tname: \"Slovenian\",\n\t\tnativeName: \"Slovenski\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"sq_al\",\n\t\tlanguageCode: \"sq\",\n\t\tname: \"Albanian\",\n\t\tnativeName: \"Shqipe\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"sr_rs\",\n\t\tlanguageCode: \"sr\",\n\t\tname: \"Serbian\",\n\t\tnativeName: \"Cрпски\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"sv_se\",\n\t\tlanguageCode: \"sv\",\n\t\tname: \"Swedish\",\n\t\tnativeName: \"Svenska\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"th_th\",\n\t\tlanguageCode: \"th\",\n\t\tname: \"Thai\",\n\t\tnativeName: \"ภาษาไทย\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"tr_tr\",\n\t\tlanguageCode: \"tr\",\n\t\tname: \"Turkish\",\n\t\tnativeName: \"Türkçe\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"uk_ua\",\n\t\tlanguageCode: \"uk\",\n\t\tname: \"Ukrainian\",\n\t\tnativeName: \"Yкраїньска\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"vi_vn\",\n\t\tlanguageCode: \"vi\",\n\t\tname: \"Vietnamese\",\n\t\tnativeName: \"Tiếng Việt\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"zh_cn\",\n\t\tlanguageCode: \"zh-hans\",\n\t\tname: \"Chinese (Simplified)\",\n\t\tnativeName: \"中文(简体)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"zh_tw\",\n\t\tlanguageCode: \"zh-hant\",\n\t\tname: \"Chinese (Traditional)\",\n\t\tnativeName: \"中文(繁體)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n] as const;\n\n/**\n * Roblox locale wire form (e.g. `en_us`, `pt_br`, `ar_001`). Used by\n * the legacy game-internationalization endpoints when\n * `languageCodeType` is `Locale`.\n *\n * @since 0.1.0\n */\nexport type RobloxLocale = (typeof ROBLOX_CREATOR_LOCALES)[number][\"locale\"];\n\n/**\n * Roblox language wire form (e.g. `en`, `fil`, `zh-hans`). Used by\n * the legacy game-internationalization endpoints when\n * `languageCodeType` is `Language`.\n *\n * @since 0.1.0\n */\nexport type RobloxLanguageCode = (typeof ROBLOX_CREATOR_LOCALES)[number][\"languageCode\"];\n"],"mappings":";;;;;;;;AA0BA,MAAa,yBAAyB;CACrC;EACC,QAAQ;EACR,cAAc;EACd,MAAM;EACN,YAAY;EACZ,eAAe;EACf,4BAA4B;EAC5B,uBAAuB;EACvB,4BAA4B;CAC7B;CACA;EACC,QAAQ;EACR,cAAc;EACd,MAAM;EACN,YAAY;EACZ,eA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ACf,4BAA4B;EAC5B,uBAAuB;EACvB,4BAA4B;CAC7B;CACA;EACC,QAAQ;EACR,cAAc;EACd,MAAM;EACN,YAAY;EACZ,eAAe;EACf,4BAA4B;EAC5B,uBAAuB;EACvB,4BAA4B;CAC7B;CACA;EACC,QAAQ;EACR,cAAc;EACd,MAAM;EACN,YAAY;EACZ,eAAe;EACf,4BAA4B;EAC5B,uBAAuB;EACvB,4BAA4B;CAC7B;CACA;EACC,QAAQ;EACR,cAAc;EACd,MAAM;EACN,YAAY;EACZ,eAAe;EACf,4BAA4B;EAC5B,uBAAuB;EACvB,4BAA4B;CAC7B;CACA;EACC,QAAQ;EACR,cAAc;EACd,MAAM;EACN,YAAY;EACZ,eAAe;EACf,4BAA4B;EAC5B,uBAAuB;EACvB,4BAA4B;CAC7B;AACD"}
|
|
1
|
+
{"version":3,"file":"locales.mjs","names":[],"sources":["../src/locales/data.generated.ts","../src/locales/localization-key.ts"],"sourcesContent":["// @generated by scripts/fetch-locales.ts. Do not edit by hand.\n// Source: https://locale.roblox.com/v1/locales/supported-locales-for-creators\n\n/**\n * One row in the vendored Roblox creator-locale list.\n *\n * @since 0.1.0\n */\nexport interface RobloxCreatorLocale {\n\treadonly locale: string;\n\treadonly languageCode: string;\n\treadonly name: string;\n\treadonly nativeName: string;\n\treadonly isRightToLeft: boolean;\n\treadonly isEnabledForFullExperience: boolean;\n\treadonly isEnabledForInGameUgc: boolean;\n\treadonly isEnabledForSignupAndLogin: boolean;\n}\n\n/**\n * Vendored snapshot of\n * `https://locale.roblox.com/v1/locales/supported-locales-for-creators`.\n * Refreshed by `pnpm --filter @bedrock-rbx/ocale refresh-locales`.\n *\n * @since 0.1.0\n */\nexport const ROBLOX_CREATOR_LOCALES = [\n\t{\n\t\tlocale: \"ar_001\",\n\t\tlanguageCode: \"ar\",\n\t\tname: \"Arabic\",\n\t\tnativeName: \"العربية\",\n\t\tisRightToLeft: true,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"bg_bg\",\n\t\tlanguageCode: \"bg\",\n\t\tname: \"Bulgarian\",\n\t\tnativeName: \"Български\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"bn_bd\",\n\t\tlanguageCode: \"bn\",\n\t\tname: \"Bengali\",\n\t\tnativeName: \"বাংলা\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"bs_ba\",\n\t\tlanguageCode: \"bs\",\n\t\tname: \"Bosnian\",\n\t\tnativeName: \"Босански\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"cs_cz\",\n\t\tlanguageCode: \"cs\",\n\t\tname: \"Czech\",\n\t\tnativeName: \"Čeština\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"da_dk\",\n\t\tlanguageCode: \"da\",\n\t\tname: \"Danish\",\n\t\tnativeName: \"Dansk\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"de_de\",\n\t\tlanguageCode: \"de\",\n\t\tname: \"German\",\n\t\tnativeName: \"Deutsch\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"el_gr\",\n\t\tlanguageCode: \"el\",\n\t\tname: \"Greek\",\n\t\tnativeName: \"Ελληνικά\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"en_gb\",\n\t\tlanguageCode: \"en\",\n\t\tname: \"English (United Kingdom)\",\n\t\tnativeName: \"English (United Kingdom)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"en_us\",\n\t\tlanguageCode: \"en\",\n\t\tname: \"English (United States)\",\n\t\tnativeName: \"English (United States)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"es_es\",\n\t\tlanguageCode: \"es\",\n\t\tname: \"Spanish (Spain)\",\n\t\tnativeName: \"Español (España)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"es_mx\",\n\t\tlanguageCode: \"es\",\n\t\tname: \"Spanish (Mexico)\",\n\t\tnativeName: \"Español (México)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"et_ee\",\n\t\tlanguageCode: \"et\",\n\t\tname: \"Estonian\",\n\t\tnativeName: \"Eesti\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"fi_fi\",\n\t\tlanguageCode: \"fi\",\n\t\tname: \"Finnish\",\n\t\tnativeName: \"Suomi\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"fil_ph\",\n\t\tlanguageCode: \"fil\",\n\t\tname: \"Filipino\",\n\t\tnativeName: \"Filipino\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"fr_ca\",\n\t\tlanguageCode: \"fr\",\n\t\tname: \"French (Canada)\",\n\t\tnativeName: \"Français (Canada)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"fr_fr\",\n\t\tlanguageCode: \"fr\",\n\t\tname: \"French (France)\",\n\t\tnativeName: \"Français (France)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"hi_in\",\n\t\tlanguageCode: \"hi\",\n\t\tname: \"Hindi\",\n\t\tnativeName: \"हिन्दी\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"hr_hr\",\n\t\tlanguageCode: \"hr\",\n\t\tname: \"Croatian\",\n\t\tnativeName: \"Hrvatski\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"hu_hu\",\n\t\tlanguageCode: \"hu\",\n\t\tname: \"Hungarian\",\n\t\tnativeName: \"Magyar\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"id_id\",\n\t\tlanguageCode: \"id\",\n\t\tname: \"Indonesian\",\n\t\tnativeName: \"Bahasa Indonesia\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"it_it\",\n\t\tlanguageCode: \"it\",\n\t\tname: \"Italian\",\n\t\tnativeName: \"Italiano\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"ja_jp\",\n\t\tlanguageCode: \"ja\",\n\t\tname: \"Japanese\",\n\t\tnativeName: \"日本語\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"ka_ge\",\n\t\tlanguageCode: \"ka\",\n\t\tname: \"Georgian\",\n\t\tnativeName: \"ქართული\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"kk_kz\",\n\t\tlanguageCode: \"kk\",\n\t\tname: \"Kazakh\",\n\t\tnativeName: \"Қазақ Тілі\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"km_kh\",\n\t\tlanguageCode: \"km\",\n\t\tname: \"Khmer\",\n\t\tnativeName: \"ភាសាខ្មែរ\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"ko_kr\",\n\t\tlanguageCode: \"ko\",\n\t\tname: \"Korean\",\n\t\tnativeName: \"한국어\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"lt_lt\",\n\t\tlanguageCode: \"lt\",\n\t\tname: \"Lithuanian\",\n\t\tnativeName: \"Lietuvių\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"lv_lv\",\n\t\tlanguageCode: \"lv\",\n\t\tname: \"Latvian\",\n\t\tnativeName: \"Latviešu\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"ms_my\",\n\t\tlanguageCode: \"ms\",\n\t\tname: \"Malay\",\n\t\tnativeName: \"Bahasa Melayu\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"my_mm\",\n\t\tlanguageCode: \"my\",\n\t\tname: \"Burmese\",\n\t\tnativeName: \"ဗမာစာ\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"nb_no\",\n\t\tlanguageCode: \"nb\",\n\t\tname: \"Bokmal\",\n\t\tnativeName: \"Bokmål\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"nl_nl\",\n\t\tlanguageCode: \"nl\",\n\t\tname: \"Dutch\",\n\t\tnativeName: \"Nederlands\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"pl_pl\",\n\t\tlanguageCode: \"pl\",\n\t\tname: \"Polish\",\n\t\tnativeName: \"Polski\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"pt_br\",\n\t\tlanguageCode: \"pt\",\n\t\tname: \"Portuguese (Brazil)\",\n\t\tnativeName: \"Português (Brasil)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"pt_pt\",\n\t\tlanguageCode: \"pt\",\n\t\tname: \"Portuguese (Portugal)\",\n\t\tnativeName: \"Português (Portugal)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"ro_ro\",\n\t\tlanguageCode: \"ro\",\n\t\tname: \"Romanian\",\n\t\tnativeName: \"Română\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"ru_ru\",\n\t\tlanguageCode: \"ru\",\n\t\tname: \"Russian\",\n\t\tnativeName: \"Русский\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"si_lk\",\n\t\tlanguageCode: \"si\",\n\t\tname: \"Sinhala\",\n\t\tnativeName: \"සිංහල\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"sk_sk\",\n\t\tlanguageCode: \"sk\",\n\t\tname: \"Slovak\",\n\t\tnativeName: \"Slovenčina\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"sl_sl\",\n\t\tlanguageCode: \"sl\",\n\t\tname: \"Slovenian\",\n\t\tnativeName: \"Slovenski\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"sq_al\",\n\t\tlanguageCode: \"sq\",\n\t\tname: \"Albanian\",\n\t\tnativeName: \"Shqipe\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"sr_rs\",\n\t\tlanguageCode: \"sr\",\n\t\tname: \"Serbian\",\n\t\tnativeName: \"Cрпски\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"sv_se\",\n\t\tlanguageCode: \"sv\",\n\t\tname: \"Swedish\",\n\t\tnativeName: \"Svenska\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"th_th\",\n\t\tlanguageCode: \"th\",\n\t\tname: \"Thai\",\n\t\tnativeName: \"ภาษาไทย\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"tr_tr\",\n\t\tlanguageCode: \"tr\",\n\t\tname: \"Turkish\",\n\t\tnativeName: \"Türkçe\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"uk_ua\",\n\t\tlanguageCode: \"uk\",\n\t\tname: \"Ukrainian\",\n\t\tnativeName: \"Yкраїньска\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: false,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: false,\n\t},\n\t{\n\t\tlocale: \"vi_vn\",\n\t\tlanguageCode: \"vi\",\n\t\tname: \"Vietnamese\",\n\t\tnativeName: \"Tiếng Việt\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"zh_cn\",\n\t\tlanguageCode: \"zh-hans\",\n\t\tname: \"Chinese (Simplified)\",\n\t\tnativeName: \"中文(简体)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n\t{\n\t\tlocale: \"zh_tw\",\n\t\tlanguageCode: \"zh-hant\",\n\t\tname: \"Chinese (Traditional)\",\n\t\tnativeName: \"中文(繁體)\",\n\t\tisRightToLeft: false,\n\t\tisEnabledForFullExperience: true,\n\t\tisEnabledForInGameUgc: true,\n\t\tisEnabledForSignupAndLogin: true,\n\t},\n] as const;\n\n/**\n * Roblox locale wire form (e.g. `en_us`, `pt_br`, `ar_001`). Used by\n * the legacy game-internationalization endpoints when\n * `languageCodeType` is `Locale`.\n *\n * @since 0.1.0\n */\nexport type RobloxLocale = (typeof ROBLOX_CREATOR_LOCALES)[number][\"locale\"];\n\n/**\n * Roblox language wire form (e.g. `en`, `fil`, `zh-hans`). Used by\n * the legacy game-internationalization endpoints when\n * `languageCodeType` is `Language`.\n *\n * @since 0.1.0\n */\nexport type RobloxLanguageCode = (typeof ROBLOX_CREATOR_LOCALES)[number][\"languageCode\"];\n","import {\n\tROBLOX_CREATOR_LOCALES,\n\ttype RobloxLanguageCode,\n\ttype RobloxLocale,\n} from \"./data.generated.ts\";\n\n/**\n * Any string Roblox accepts as a localization key: an underscore locale such\n * as `en_us`, or a language code such as `en` or `zh-hans`.\n *\n * @since 0.4.0\n */\nexport type RobloxLocalizationKey = RobloxLanguageCode | RobloxLocale;\n\nconst LOCALIZATION_KEYS: ReadonlySet<string> = new Set(\n\tROBLOX_CREATOR_LOCALES.flatMap((row) => [row.locale, row.languageCode]),\n);\n\n/**\n * Checks whether a string is a Roblox localization key, narrowing it to\n * {@link RobloxLocalizationKey}. Region-qualified hyphen forms such as\n * `en-us` are rejected (Roblox writes them as `en_us`), as are language names\n * such as `english`.\n *\n * @since 0.4.0\n * @param value - The string to check.\n * @returns `true` when `value` is a known locale or language code.\n * @example\n * ```ts\n * import { isRobloxLocalizationKey } from \"@bedrock-rbx/ocale/locales\";\n *\n * expect(isRobloxLocalizationKey(\"pt_br\")).toBe(true);\n * expect(isRobloxLocalizationKey(\"en-us\")).toBe(false);\n * ```\n */\nexport function isRobloxLocalizationKey(value: string): value is RobloxLocalizationKey {\n\treturn LOCALIZATION_KEYS.has(value);\n}\n"],"mappings":";;;;;;;;AA0BA,MAAa,yBAAyB;CACrC;EACC,QAAQ;EACR,cAAc;EACd,MAAM;EACN,YAAY;EACZ,eAAe;EACf,4BAA4B;EAC5B,uBAAuB;EACvB,4BAA4B;CAC7B;CACA;EACC,QAAQ;EACR,cAAc;EACd,MAAM;EACN,YAAY;EACZ,eAAe;EACf,4BAA4B;EAC5B,uB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