@bedrock-rbx/ocale 0.3.4 → 0.5.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 +10 -5
- package/dist/assets.d.mts +64 -0
- package/dist/assets.d.mts.map +1 -0
- package/dist/assets.mjs +301 -0
- package/dist/assets.mjs.map +1 -0
- package/dist/badge-insufficient-funds-BLFvQZt1.mjs +91 -0
- package/dist/badge-insufficient-funds-BLFvQZt1.mjs.map +1 -0
- package/dist/badges.d.mts +359 -196
- package/dist/badges.d.mts.map +1 -1
- package/dist/badges.mjs +493 -59
- package/dist/badges.mjs.map +1 -1
- package/dist/capacity-admission-Ce2V9QNb.d.mts +347 -0
- package/dist/capacity-admission-Ce2V9QNb.d.mts.map +1 -0
- package/dist/{data.generated-B2ceLfSn.d.mts → data.generated-B4Fztv_7.d.mts} +23 -25
- package/dist/data.generated-B4Fztv_7.d.mts.map +1 -0
- package/dist/developer-products.d.mts +207 -194
- package/dist/developer-products.d.mts.map +1 -1
- package/dist/developer-products.mjs +125 -39
- package/dist/developer-products.mjs.map +1 -1
- package/dist/game-passes.d.mts +206 -211
- package/dist/game-passes.d.mts.map +1 -1
- package/dist/game-passes.mjs +35 -36
- package/dist/game-passes.mjs.map +1 -1
- package/dist/index.d.mts +947 -366
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +324 -12
- package/dist/index.mjs.map +1 -1
- package/dist/is-date-time-string-C91G44SI.mjs +19 -0
- package/dist/is-date-time-string-C91G44SI.mjs.map +1 -0
- package/dist/locales.d.mts +28 -2
- package/dist/locales.d.mts.map +1 -0
- package/dist/locales.mjs +24 -3
- package/dist/locales.mjs.map +1 -1
- package/dist/luau-execution.d.mts +154 -157
- package/dist/luau-execution.d.mts.map +1 -1
- package/dist/luau-execution.mjs +15 -16
- package/dist/luau-execution.mjs.map +1 -1
- package/dist/{network-error-DR9FX5hb.mjs → network-error-P4An7nUB.mjs} +48 -14
- package/dist/network-error-P4An7nUB.mjs.map +1 -0
- package/dist/places.d.mts +258 -186
- package/dist/places.d.mts.map +1 -1
- package/dist/places.mjs +187 -35
- package/dist/places.mjs.map +1 -1
- package/dist/{poll-timeout-3PXLsabj.mjs → poll-timeout-BCxgN97O.mjs} +4 -6
- package/dist/{poll-timeout-3PXLsabj.mjs.map → poll-timeout-BCxgN97O.mjs.map} +1 -1
- package/dist/{polling-helpers-CoVhsC33.mjs → polling-helpers-BtEYR5dN.mjs} +260 -105
- package/dist/polling-helpers-BtEYR5dN.mjs.map +1 -0
- package/dist/{price-information-B0tkOoAX.mjs → price-information--d6GZAcp.mjs} +3 -4
- package/dist/{price-information-B0tkOoAX.mjs.map → price-information--d6GZAcp.mjs.map} +1 -1
- package/dist/resource-client-CF8SPsV8.d.mts +162 -0
- package/dist/resource-client-CF8SPsV8.d.mts.map +1 -0
- package/dist/{resource-client-rqTMkBeR.mjs → resource-client-Cm_bPcCs.mjs} +589 -197
- package/dist/resource-client-Cm_bPcCs.mjs.map +1 -0
- package/dist/retry-DYxm_eBU.d.mts +225 -0
- package/dist/retry-DYxm_eBU.d.mts.map +1 -0
- package/dist/{retry-BlX4tUnT.mjs → retry-Dv5TsY9O.mjs} +312 -54
- package/dist/retry-Dv5TsY9O.mjs.map +1 -0
- package/dist/{signatures-JF-7Psce.mjs → signatures-CtJ7jfVN.mjs} +2 -3
- package/dist/{signatures-JF-7Psce.mjs.map → signatures-CtJ7jfVN.mjs.map} +1 -1
- package/dist/storage.d.mts +333 -344
- package/dist/storage.d.mts.map +1 -1
- package/dist/storage.mjs +39 -40
- package/dist/storage.mjs.map +1 -1
- package/dist/testing.d.mts +369 -434
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +18 -33
- package/dist/testing.mjs.map +1 -1
- package/dist/{to-blob-RPqMBuft.mjs → to-blob-Bqu7bmlE.mjs} +2 -3
- package/dist/{to-blob-RPqMBuft.mjs.map → to-blob-Bqu7bmlE.mjs.map} +1 -1
- package/dist/types-Z4abDJfK.d.mts +501 -0
- package/dist/types-Z4abDJfK.d.mts.map +1 -0
- package/dist/universes.d.mts +619 -436
- package/dist/universes.d.mts.map +1 -1
- package/dist/universes.mjs +432 -79
- package/dist/universes.mjs.map +1 -1
- package/dist/{validation-B_Zs1So2.mjs → validation-kaTLLAD1.mjs} +3 -4
- package/dist/{validation-B_Zs1So2.mjs.map → validation-kaTLLAD1.mjs.map} +1 -1
- package/dist/wire-DDG87I-d.d.mts +39 -0
- package/dist/wire-DDG87I-d.d.mts.map +1 -0
- package/package.json +15 -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
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
import { h as OpenCloudErrorOptions, m as OpenCloudError } from "./types-CvYh4SPC.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/errors/api-error.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Options for constructing an {@link ApiError}.
|
|
6
|
-
*
|
|
7
|
-
* @since 0.1.0
|
|
8
|
-
*/
|
|
9
|
-
interface ApiErrorOptions extends OpenCloudErrorOptions {
|
|
10
|
-
/** Parsed response body, when present. */
|
|
11
|
-
details?: JSONValue | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Wall-clock time the request was in flight before this error, in
|
|
14
|
-
* milliseconds. Present for errors built by the transport; a long elapsed
|
|
15
|
-
* time on an intermittent failure points at a load or timeout correlation.
|
|
16
|
-
*/
|
|
17
|
-
elapsedMs?: number | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Human-readable summary extracted from an HTML gateway error page, set
|
|
20
|
-
* when the error body was such a page (an HAProxy-style load-balancer
|
|
21
|
-
* rejection) rather than an Open Cloud response. When present, the raw HTML
|
|
22
|
-
* is not retained on {@link ApiError.details}.
|
|
23
|
-
*/
|
|
24
|
-
gatewaySummary?: string | undefined;
|
|
25
|
-
/** HTTP method of the request that produced this error. */
|
|
26
|
-
method?: string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Allowlisted response headers useful for diagnosis and escalation (request
|
|
29
|
-
* ids, edge/server identifiers). The full header set is never retained, to
|
|
30
|
-
* avoid surfacing anything sensitive and to keep errors light.
|
|
31
|
-
*/
|
|
32
|
-
responseHeaders?: Readonly<Record<string, string>> | undefined;
|
|
33
|
-
/** HTTP status code from the API response. */
|
|
34
|
-
statusCode: number;
|
|
35
|
-
/**
|
|
36
|
-
* Length, in decoded characters, of a 2xx body that could not be parsed as
|
|
37
|
-
* JSON. Set only by the transport, and only for that failure — nothing else
|
|
38
|
-
* builds an {@link ApiError} over a successful status — so its presence is
|
|
39
|
-
* also how a body-parse failure is told apart from an API rejection. The
|
|
40
|
-
* number is the diagnostic one: a body that stops mid-token at exactly the
|
|
41
|
-
* length the edge delivered is a truncated read, not malformed JSON.
|
|
42
|
-
*/
|
|
43
|
-
unparsedBodyLength?: number | undefined;
|
|
44
|
-
/** Fully-qualified URL of the request that produced this error. */
|
|
45
|
-
url?: string | undefined;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Everything in {@link ApiErrorOptions} except what the API answered ({@link
|
|
49
|
-
* ApiErrorOptions.code}, {@link ApiErrorOptions.details}, and {@link
|
|
50
|
-
* ApiErrorOptions.statusCode}): the request the transport made, how long it was
|
|
51
|
-
* in flight, and what the response carried alongside its body. Every field is
|
|
52
|
-
* required, and every one accepts `undefined` for a field the transport did not
|
|
53
|
-
* capture.
|
|
54
|
-
*
|
|
55
|
-
* @since 0.2.0
|
|
56
|
-
*/
|
|
57
|
-
type ApiRequestContext = { [K in Exclude<keyof ApiErrorOptions, "cause" | "code" | "details" | "statusCode">]-?: ApiErrorOptions[K] | undefined };
|
|
58
|
-
/**
|
|
59
|
-
* Thrown when the Roblox Open Cloud API returns a non-2xx response
|
|
60
|
-
* that is not a rate limit (429).
|
|
61
|
-
*
|
|
62
|
-
* @since 0.1.0
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
*
|
|
66
|
-
* ```ts
|
|
67
|
-
* import { ApiError } from "@bedrock-rbx/ocale";
|
|
68
|
-
*
|
|
69
|
-
* const error = new ApiError("HTTP 404: Pass not found (code NotFound)", {
|
|
70
|
-
* code: "NotFound",
|
|
71
|
-
* details: { errorCode: "NotFound", message: "Pass not found" },
|
|
72
|
-
* statusCode: 404,
|
|
73
|
-
* });
|
|
74
|
-
*
|
|
75
|
-
* expect(error).toBeInstanceOf(ApiError);
|
|
76
|
-
* expect(error.statusCode).toBe(404);
|
|
77
|
-
* expect(error.code).toBe("NotFound");
|
|
78
|
-
* expect(error.details).toEqual({
|
|
79
|
-
* errorCode: "NotFound",
|
|
80
|
-
* message: "Pass not found",
|
|
81
|
-
* });
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
declare class ApiError extends OpenCloudError {
|
|
85
|
-
readonly details: JSONValue | undefined;
|
|
86
|
-
readonly elapsedMs: number | undefined;
|
|
87
|
-
readonly gatewaySummary: string | undefined;
|
|
88
|
-
readonly method: string | undefined;
|
|
89
|
-
override readonly name: string;
|
|
90
|
-
readonly responseHeaders: Readonly<Record<string, string>> | undefined;
|
|
91
|
-
readonly statusCode: number;
|
|
92
|
-
readonly unparsedBodyLength: number | undefined;
|
|
93
|
-
readonly url: string | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Creates a new ApiError.
|
|
96
|
-
*
|
|
97
|
-
* @param message - Human-readable error description.
|
|
98
|
-
* @param options - Error options including status code, optional error
|
|
99
|
-
* code, the parsed response body when present, and the request context
|
|
100
|
-
* (method, url, elapsed time, allowlisted response headers) when built by
|
|
101
|
-
* the transport.
|
|
102
|
-
*/
|
|
103
|
-
constructor(message: string, options: ApiErrorOptions);
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Reads the request context off an {@link ApiError} so a replacement error can
|
|
107
|
-
* carry it. Spread the result into the options of the new error. {@link
|
|
108
|
-
* OpenCloudError.code}, {@link ApiError.details}, and {@link
|
|
109
|
-
* ApiError.statusCode} describe the API's answer and are left to the caller.
|
|
110
|
-
*
|
|
111
|
-
* @since 0.2.0
|
|
112
|
-
*
|
|
113
|
-
* @param err - The error to read the request context from.
|
|
114
|
-
* @returns The transport-captured fields, each undefined when unset.
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
*
|
|
118
|
-
* ```ts
|
|
119
|
-
* import { ApiError, requestContextOf } from "@bedrock-rbx/ocale";
|
|
120
|
-
*
|
|
121
|
-
* const original = new ApiError("HTTP 404", {
|
|
122
|
-
* elapsedMs: 512,
|
|
123
|
-
* method: "GET",
|
|
124
|
-
* statusCode: 404,
|
|
125
|
-
* url: "https://apis.roblox.com/cloud/v2/universes/1",
|
|
126
|
-
* });
|
|
127
|
-
*
|
|
128
|
-
* const rewrapped = new ApiError("Universe 1 was not found; adoption failed", {
|
|
129
|
-
* ...requestContextOf(original),
|
|
130
|
-
* statusCode: 404,
|
|
131
|
-
* });
|
|
132
|
-
*
|
|
133
|
-
* expect(rewrapped.method).toBe("GET");
|
|
134
|
-
* expect(rewrapped.url).toBe("https://apis.roblox.com/cloud/v2/universes/1");
|
|
135
|
-
* expect(rewrapped.elapsedMs).toBe(512);
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
declare function requestContextOf(err: ApiError): ApiRequestContext;
|
|
139
|
-
//#endregion
|
|
140
|
-
//#region src/errors/network-error.d.ts
|
|
141
|
-
/**
|
|
142
|
-
* Options for constructing a {@link NetworkError}.
|
|
143
|
-
*
|
|
144
|
-
* @since 0.1.0
|
|
145
|
-
*/
|
|
146
|
-
interface NetworkErrorOptions extends ErrorOptions {
|
|
147
|
-
/** HTTP method of the request that failed. */
|
|
148
|
-
method?: string | undefined;
|
|
149
|
-
/** Fully-qualified URL of the request that failed. */
|
|
150
|
-
url?: string | undefined;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Thrown when a network-level failure prevents the request from reaching
|
|
154
|
-
* the Roblox Open Cloud API (e.g., DNS resolution failure, connection reset).
|
|
155
|
-
* The `method` and `url` name the failing call so a transport failure that
|
|
156
|
-
* survives every retry can be diagnosed; the underlying transport error is
|
|
157
|
-
* carried on `cause`.
|
|
158
|
-
*
|
|
159
|
-
* @since 0.1.0
|
|
160
|
-
*/
|
|
161
|
-
declare class NetworkError extends OpenCloudError {
|
|
162
|
-
readonly method: string | undefined;
|
|
163
|
-
override readonly name: string;
|
|
164
|
-
readonly url: string | undefined;
|
|
165
|
-
/**
|
|
166
|
-
* Creates a new NetworkError.
|
|
167
|
-
*
|
|
168
|
-
* @param message - Human-readable error description.
|
|
169
|
-
* @param options - Error options including the optional `cause` and the
|
|
170
|
-
* `method` / `url` of the request that failed.
|
|
171
|
-
*/
|
|
172
|
-
constructor(message: string, options?: NetworkErrorOptions);
|
|
173
|
-
}
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region src/errors/rate-limit.d.ts
|
|
176
|
-
/**
|
|
177
|
-
* Options for constructing a {@link RateLimitError}.
|
|
178
|
-
*
|
|
179
|
-
* @since 0.1.0
|
|
180
|
-
*/
|
|
181
|
-
interface RateLimitErrorOptions extends OpenCloudErrorOptions {
|
|
182
|
-
/**
|
|
183
|
-
* Parsed 429 response body, when present. Holds the server's 429
|
|
184
|
-
* explanation (JSON when the body parses, otherwise the truncated raw
|
|
185
|
-
* text) so a rate limit stays diagnosable from the error alone. A literal
|
|
186
|
-
* JSON `null` remains `null`; an absent body is `undefined`.
|
|
187
|
-
*/
|
|
188
|
-
details?: JSONValue | undefined;
|
|
189
|
-
/**
|
|
190
|
-
* Requests left in the reported rate-limit window. Read from
|
|
191
|
-
* `x-ratelimit-remaining` using the smallest valid token.
|
|
192
|
-
*
|
|
193
|
-
* `undefined` when the header has no valid non-negative integer token.
|
|
194
|
-
*
|
|
195
|
-
* Parsed separately from `x-ratelimit-reset`; a valid value survives an
|
|
196
|
-
* invalid reset.
|
|
197
|
-
*
|
|
198
|
-
* This is one budget reading, not a classifier for the cause of the 429.
|
|
199
|
-
*/
|
|
200
|
-
remaining?: number | undefined;
|
|
201
|
-
/**
|
|
202
|
-
* Allowlisted response headers useful for diagnosing the 429. Values are
|
|
203
|
-
* preserved exactly as the Fetch API presents them, including comma-joined
|
|
204
|
-
* multi-window values. The full header set is never retained.
|
|
205
|
-
*/
|
|
206
|
-
responseHeaders?: Readonly<Record<string, string>> | undefined;
|
|
207
|
-
/** Seconds to wait before retrying the request. */
|
|
208
|
-
retryAfterSeconds: number;
|
|
209
|
-
/**
|
|
210
|
-
* HTTP status code that produced the error. Always `429` when minted by the
|
|
211
|
-
* SDK transport; `undefined` when constructed without one.
|
|
212
|
-
*/
|
|
213
|
-
statusCode?: number | undefined;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Thrown when the Roblox Open Cloud API returns a 429 Too Many Requests
|
|
217
|
-
* response. Contains the server-suggested retry delay and safe,
|
|
218
|
-
* machine-readable response evidence. Generic 429 evidence can be ambiguous:
|
|
219
|
-
* no individual header, body code, or remaining-budget value guarantees the
|
|
220
|
-
* upstream cause.
|
|
221
|
-
*
|
|
222
|
-
* @since 0.1.0
|
|
223
|
-
*
|
|
224
|
-
* @example
|
|
225
|
-
*
|
|
226
|
-
* ```ts
|
|
227
|
-
* import { RateLimitError } from "@bedrock-rbx/ocale";
|
|
228
|
-
*
|
|
229
|
-
* const error = new RateLimitError("Too many requests", {
|
|
230
|
-
* code: "RESOURCE_EXHAUSTED",
|
|
231
|
-
* remaining: 3,
|
|
232
|
-
* responseHeaders: {
|
|
233
|
-
* "retry-after": "1856",
|
|
234
|
-
* "x-ratelimit-limit": "5, 5;w=60, 5;w=60",
|
|
235
|
-
* },
|
|
236
|
-
* retryAfterSeconds: 1856,
|
|
237
|
-
* });
|
|
238
|
-
*
|
|
239
|
-
* // Inspect the available evidence without assuming it identifies the cause.
|
|
240
|
-
* const evidence = {
|
|
241
|
-
* code: error.code,
|
|
242
|
-
* limit: error.responseHeaders?.["x-ratelimit-limit"],
|
|
243
|
-
* retryAfter: error.responseHeaders?.["retry-after"],
|
|
244
|
-
* };
|
|
245
|
-
*
|
|
246
|
-
* expect(evidence).toEqual({
|
|
247
|
-
* code: "RESOURCE_EXHAUSTED",
|
|
248
|
-
* limit: "5, 5;w=60, 5;w=60",
|
|
249
|
-
* retryAfter: "1856",
|
|
250
|
-
* });
|
|
251
|
-
* ```
|
|
252
|
-
*/
|
|
253
|
-
declare class RateLimitError extends OpenCloudError {
|
|
254
|
-
/**
|
|
255
|
-
* Parsed 429 response body. A literal JSON `null` remains `null`; an absent
|
|
256
|
-
* body is `undefined`.
|
|
257
|
-
*/
|
|
258
|
-
readonly details: JSONValue | undefined;
|
|
259
|
-
override readonly name = "RateLimitError";
|
|
260
|
-
/**
|
|
261
|
-
* Requests left in the reported window, or `undefined` if not reported.
|
|
262
|
-
*/
|
|
263
|
-
readonly remaining: number | undefined;
|
|
264
|
-
/** Allowlisted raw response headers, or `undefined` if not set. */
|
|
265
|
-
readonly responseHeaders: Readonly<Record<string, string>> | undefined;
|
|
266
|
-
readonly retryAfterSeconds: number;
|
|
267
|
-
/** HTTP status code that produced the error, or `undefined` if not set. */
|
|
268
|
-
readonly statusCode: number | undefined;
|
|
269
|
-
/**
|
|
270
|
-
* Creates a new RateLimitError.
|
|
271
|
-
*
|
|
272
|
-
* @param message - Human-readable error description.
|
|
273
|
-
* @param options - Error options including the retry delay.
|
|
274
|
-
*/
|
|
275
|
-
constructor(message: string, options: RateLimitErrorOptions);
|
|
276
|
-
}
|
|
277
|
-
//#endregion
|
|
278
|
-
//#region src/internal/http/retry.d.ts
|
|
279
|
-
/**
|
|
280
|
-
* Fully-resolved retry config shape that {@link mergeConfig} and
|
|
281
|
-
* {@link shouldRetry} operate on. Fields are required because this represents
|
|
282
|
-
* the post-defaulting, internal view; callers should supply every field (or
|
|
283
|
-
* resolve them via a test factory / client constructor). The partial,
|
|
284
|
-
* user-facing type lives on client construction options; method defaults and
|
|
285
|
-
* per-request overrides use `Partial<RetryResolvable>`.
|
|
286
|
-
*/
|
|
287
|
-
interface RetryResolvable {
|
|
288
|
-
/** Roblox Open Cloud API key. */
|
|
289
|
-
readonly apiKey: string;
|
|
290
|
-
/** Base URL for the Open Cloud API. */
|
|
291
|
-
readonly baseUrl: string;
|
|
292
|
-
/** Maximum retry attempts before giving up. */
|
|
293
|
-
readonly maxRetries: number;
|
|
294
|
-
/** Status codes that are eligible for retry. */
|
|
295
|
-
readonly retryableStatuses: ReadonlyArray<number>;
|
|
296
|
-
/**
|
|
297
|
-
* Codes for transport-level failures eligible for retry: node-style
|
|
298
|
-
* transport codes ({@link findErrorCode}) surfaced as a
|
|
299
|
-
* {@link NetworkError}, plus the synthetic {@link GATEWAY_REJECTED} for a
|
|
300
|
-
* response served by an edge gateway. Not all of them prove the request
|
|
301
|
-
* went unprocessed — see {@link TRANSIENT_TRANSPORT_CODES}. Empty for
|
|
302
|
-
* create operations by default; consumers opt a create in via a per-request
|
|
303
|
-
* override.
|
|
304
|
-
*/
|
|
305
|
-
readonly retryableTransportCodes: ReadonlyArray<string>;
|
|
306
|
-
/** Fallback delay function when no server hint is available. */
|
|
307
|
-
readonly retryDelay: (attempt: number) => number;
|
|
308
|
-
/** Per-request timeout in milliseconds. */
|
|
309
|
-
readonly timeout: number;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Transient transport error codes that are safe to retry for idempotent
|
|
313
|
-
* operations. Connection resets, timeouts, and DNS hiccups are recoverable on
|
|
314
|
-
* a retry. A self-aborted request timeout carries no OS-level `code`, so
|
|
315
|
-
* {@link shouldRetry} folds it into this set as `ETIMEDOUT` (via
|
|
316
|
-
* {@link isTimeoutAbort}) for idempotent methods; create methods retry no
|
|
317
|
-
* transport codes and so still never re-issue a timed-out write.
|
|
318
|
-
*
|
|
319
|
-
* `ERR_HTTP2_STREAM_ERROR`, `ERR_HTTP2_SESSION_ERROR`, and `UND_ERR_INFO` are
|
|
320
|
-
* the same deaths as spelled by a runtime whose `fetch` negotiates HTTP/2
|
|
321
|
-
* (Node 26 and later). They differ from the socket codes in one way that
|
|
322
|
-
* matters: they do not prove the request went unprocessed. `UND_ERR_INFO`
|
|
323
|
-
* covers both a `GOAWAY` declaring a stream was never started and a stream
|
|
324
|
-
* that was fully sent, and `UND_ERR_SOCKET` can fire once a response is
|
|
325
|
-
* already streaming. Retrying them is therefore justified by the operation
|
|
326
|
-
* being safe to repeat, never by the request having gone unseen — which is
|
|
327
|
-
* why {@link UPLOAD_METHOD_DEFAULTS}, the one write policy that includes
|
|
328
|
-
* them, documents its own grounds.
|
|
329
|
-
*
|
|
330
|
-
* @since 0.1.0
|
|
331
|
-
*/
|
|
332
|
-
declare const TRANSIENT_TRANSPORT_CODES: ReadonlyArray<string>;
|
|
333
|
-
/**
|
|
334
|
-
* Synthetic transport code for a response that came from an edge gateway
|
|
335
|
-
* rather than Open Cloud ({@link ApiError.gatewaySummary}). Such a response
|
|
336
|
-
* proves the request was rejected before any Open Cloud handler saw it, so it
|
|
337
|
-
* is classified alongside {@link TRANSIENT_TRANSPORT_CODES} rather than by its
|
|
338
|
-
* HTTP status: the status belongs to the gateway, not to the API, and a
|
|
339
|
-
* gateway `400` says nothing about the validity of the request.
|
|
340
|
-
*
|
|
341
|
-
* Name it in a per-request `retryableTransportCodes` override to opt an
|
|
342
|
-
* operation into (or out of) gateway-rejection retry.
|
|
343
|
-
*
|
|
344
|
-
* @since 0.1.2
|
|
345
|
-
*/
|
|
346
|
-
declare const GATEWAY_REJECTED = "GATEWAY_REJECTED";
|
|
347
|
-
/**
|
|
348
|
-
* Synthetic transport code for a 2xx whose body could not be parsed as JSON
|
|
349
|
-
* ({@link ApiError.unparsedBodyLength}). Open Cloud does not answer a success
|
|
350
|
-
* status with a malformed document; what this failure describes in practice is
|
|
351
|
-
* a body the edge delivered short, ending mid-token at exactly the length that
|
|
352
|
-
* arrived. The next read is a fresh body and usually a whole one.
|
|
353
|
-
*
|
|
354
|
-
* Classifying it by transport code rather than by HTTP status is what makes it
|
|
355
|
-
* recoverable at all: the status is a 200, which no `retryableStatuses` list
|
|
356
|
-
* contains, so a status-keyed decision could only ever say "do not retry".
|
|
357
|
-
*
|
|
358
|
-
* Retrying is justified by the operation being safe to repeat, never by the
|
|
359
|
-
* request having gone unprocessed — a 200 proves it was processed. So this code
|
|
360
|
-
* is in {@link IDEMPOTENT_METHOD_DEFAULTS} only. Creates and uploads leave it
|
|
361
|
-
* out: their write landed, and re-issuing it to re-read the answer would risk a
|
|
362
|
-
* second resource for a response body, which is the wrong trade. A consumer who
|
|
363
|
-
* can tolerate that duplicate names this code in a per-request
|
|
364
|
-
* `retryableTransportCodes` override.
|
|
365
|
-
*
|
|
366
|
-
* @since 0.1.5
|
|
367
|
-
*/
|
|
368
|
-
declare const RESPONSE_UNPARSEABLE = "RESPONSE_UNPARSEABLE";
|
|
369
|
-
/** Kind of HTTP method the merge is being performed for. */
|
|
370
|
-
type MethodKind = "create" | "idempotent";
|
|
371
|
-
//#endregion
|
|
372
|
-
export { TRANSIENT_TRANSPORT_CODES as a, NetworkError as c, ApiErrorOptions as d, ApiRequestContext as f, RetryResolvable as i, NetworkErrorOptions as l, MethodKind as n, RateLimitError as o, requestContextOf as p, RESPONSE_UNPARSEABLE as r, RateLimitErrorOptions as s, GATEWAY_REJECTED as t, ApiError as u };
|
|
373
|
-
//# sourceMappingURL=retry-war_-9tb.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retry-war_-9tb.d.mts","names":[],"sources":["../src/errors/api-error.ts","../src/errors/network-error.ts","../src/errors/rate-limit.ts","../src/internal/http/retry.ts"],"mappings":";;;;;AAOA;;;UAAiB,eAAA,SAAwB,qBAAA;;EAExC,OAAA,GAAU,SAAA;;;;;;EAMV,SAAA;;;;;;;EAOA,cAAA;;EAEA,MAAA;EAmBA;AAAA;AAaD;;;EA1BC,eAAA,GAAkB,QAAA,CAAS,MAAA;;EAE3B,UAAA;;;;;;;;;EASA,kBAAA;EAiBmB;EAfnB,GAAA;AAAA;;;;;;;;;;;KAaW,iBAAA,WACL,OAAA,OAAc,eAAA,mDACjB,eAAA,CAAgB,CAAA;;;;;;;;;;;;;;;;AAkDmB;AA8CvC;;;;;;;;AAAiD;;cAlEpC,QAAA,SAAiB,cAAA;EAAA,SACb,OAAA,EAAS,SAAA;EAAA,SACT,SAAA;EAAA,SACA,cAAA;EAAA,SACA,MAAA;EAAA,kBACS,IAAA;EAAA,SACT,eAAA,EAAiB,QAAA,CAAS,MAAA;EAAA,SAC1B,UAAA;EAAA,SACA,kBAAA;EAAA,SACA,GAAA;ECtFhB;AAYD;;;;;;;;EDqFC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,eAAA;AAAA;;;;ACzEC;;;;AC5BxC;;;;;;;;;;;;;;;;;;;AAgCC;AAyCD;;;;;;iBF0EgB,gBAAA,CAAiB,GAAA,EAAK,QAAA,GAAW,iBAAA;;;;;AAnJjD;;;UCAiB,mBAAA,SAA4B,YAAA;;EAE5C,MAAA;;EAEA,GAAA;AAAA;;;;;;;;;;cAYY,YAAA,SAAqB,cAAA;EAAA,SACjB,MAAA;EAAA,kBACS,IAAA;EAAA,SACT,GAAA;EDiBhB;AAaD;;;;;;ECrBC,WAAA,CAAY,OAAA,UAAiB,OAAA,GAAU,mBAAA;AAAA;;;;;AD5BxC;;;UEAiB,qBAAA,SAA8B,qBAAA;;;;;;;EAO9C,OAAA,GAAU,SAAA;;;;;;;;;;;;EAYV,SAAA;EF8BD;;;;;EExBC,eAAA,GAAkB,QAAA,CAAS,MAAA;;EAE3B,iBAAA;EFwBmB;;;;EEnBnB,UAAA;AAAA;;AFmBmB;AA8BpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBuC;AA8CvC;;;;;;;cE1Ea,cAAA,SAAuB,cAAA;EF0Ea;;;;EAAA,SErEhC,OAAA,EAAS,SAAA;EAAA,kBACA,IAAA;;;;WAIT,SAAA;;WAEA,eAAA,EAAiB,QAAA,CAAS,MAAA;EAAA,SAC1B,iBAAA;EDtEjB;EAAA,SCwEiB,UAAA;;;;;;;EAQhB,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,qBAAA;AAAA;;;AFhGvC;;;;;;;;AAAA,UGMiB,eAAA;;WAEP,MAAA;;WAEA,OAAA;;WAEA,UAAA;;WAEA,iBAAA,EAAmB,aAAA;;;;;;AHsB5B;AAaD;;;WGzBU,uBAAA,EAAyB,aAAA;;WAEzB,UAAA,GAAa,OAAA;;WAEb,OAAA;AAAA;;;;;;;AHuBU;AA8BpB;;;;;;;;;;;;;;cG7Ba,yBAAA,EAA2B,aAAA;;;;;;;;;;;;;;cA2B3B,gBAAA;AHoEb;;;;;;;;AAAiD;;;;ACnJjD;;;;;;;;AAIC;AD+ID,cG7Ca,oBAAA;;KA+CD,UAAA"}
|