@0xinsider/sdk 0.14.0-bootstrap.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/LICENSE +21 -0
- package/README.md +674 -0
- package/dist/client.d.ts +1652 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +2127 -0
- package/dist/client.js.map +1 -0
- package/dist/data-quality.d.ts +74 -0
- package/dist/data-quality.d.ts.map +1 -0
- package/dist/data-quality.js +68 -0
- package/dist/data-quality.js.map +1 -0
- package/dist/errors.d.ts +400 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +700 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/pagination.d.ts +196 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +208 -0
- package/dist/pagination.js.map +1 -0
- package/dist/provenance.d.ts +8 -0
- package/dist/provenance.d.ts.map +1 -0
- package/dist/provenance.js +15 -0
- package/dist/provenance.js.map +1 -0
- package/dist/retry.d.ts +68 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +125 -0
- package/dist/retry.js.map +1 -0
- package/dist/schema.d.ts +4910 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +7 -0
- package/dist/schema.js.map +1 -0
- package/dist/stream.d.ts +509 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +932 -0
- package/dist/stream.js.map +1 -0
- package/dist/webhooks.d.ts +314 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +153 -0
- package/dist/webhooks.js.map +1 -0
- package/package.json +64 -0
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed error hierarchy for the 0xinsider API V1 error envelope.
|
|
3
|
+
*
|
|
4
|
+
* The V1 contract returns a stable error shape on every non-2xx response
|
|
5
|
+
* (`web/public/api/v1/openapi.json` -> components.schemas.ApiError):
|
|
6
|
+
*
|
|
7
|
+
* {
|
|
8
|
+
* "object": "error",
|
|
9
|
+
* "error": { "code": <ApiErrorCode>, "message": string, "doc_url"?, "param"? },
|
|
10
|
+
* "meta": { "request_id": string, "cached": boolean, "cost": number, ... }
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* Some upstream/proxy failures return a flat body `{ code, message }` without
|
|
14
|
+
* the `object: "error"` wrapper; both shapes are normalized here.
|
|
15
|
+
*
|
|
16
|
+
* The canonical `code` set is the `ApiError.error.code` enum in the OpenAPI
|
|
17
|
+
* spec. The client maps each error to the most specific subclass -- dispatching on `reason` first (it is strictly more specific), then `code` so callers can
|
|
18
|
+
* `instanceof` the specific failure, and falls back to the base
|
|
19
|
+
* `OxinsiderApiError` for unknown codes or non-JSON bodies.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Canonical error codes the API can return. Source of truth:
|
|
23
|
+
* `components.schemas.ApiError.properties.error.properties.code.enum`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const API_ERROR_CODES: readonly ["bad_request", "invalid_api_key", "subscription_required", "forbidden", "not_found", "account_locked", "rate_limited", "rate_limit_unavailable", "internal_error", "insufficient_scope", "request_timeout"];
|
|
26
|
+
export type ApiErrorCode = (typeof API_ERROR_CODES)[number];
|
|
27
|
+
/**
|
|
28
|
+
* The specific, actionable cause behind a `code`. Source of truth:
|
|
29
|
+
* `components.schemas.ApiError.properties.error.properties.reason.enum`.
|
|
30
|
+
*
|
|
31
|
+
* Additive (#7209): `code` keeps its published values, so this never changes what
|
|
32
|
+
* an existing `code` means. It tells you what to DO, where the code alone could
|
|
33
|
+
* not: `pick_not_released` is "not YET" (sleep until `retryAt`), not "does not
|
|
34
|
+
* exist"; `unknown_endpoint` is a wrong PATH (do not retry); `trader_not_tracked`
|
|
35
|
+
* is a wallet we do not capture (stop asking for it); `cursor_expired` means
|
|
36
|
+
* re-request page 1; `read_model_warming` is endpoint-local unavailability,
|
|
37
|
+
* not rate limiting. Retry only that route after the supplied interval; do not
|
|
38
|
+
* infer dependency health from the reason.
|
|
39
|
+
*/
|
|
40
|
+
export declare const API_ERROR_REASONS: readonly ["cursor_expired", "unknown_endpoint", "pick_not_released", "trader_not_tracked", "read_model_warming", "database_unavailable", "request_accounting_unavailable", "idempotency_in_progress", "webhook_delivery_in_progress", "webhook_secret_rotation_not_prepared", "webhook_secret_rotation_overlap_active", "sandbox_api_key", "api_key_in_query", "subscription_inactive", "monthly_quota_exceeded", "invalid_query", "unknown_query_parameter", "invalid_path", "invalid_body", "unsupported_media_type", "payload_too_large", "method_not_allowed", "ip_rate_limited", "ip_throttled", "export_expired", "freshness_ceiling_unsatisfied"];
|
|
41
|
+
export type ApiErrorReason = (typeof API_ERROR_REASONS)[number];
|
|
42
|
+
/** Details returned when a trader freshness ceiling cannot be met. */
|
|
43
|
+
export interface FreshnessFailure {
|
|
44
|
+
max_age_s: number;
|
|
45
|
+
actual_age_s?: number;
|
|
46
|
+
as_of?: string;
|
|
47
|
+
data_quality_status: "fresh" | "partial" | "unknown" | "untracked" | "unavailable";
|
|
48
|
+
}
|
|
49
|
+
/** Parsed `error` object from the V1 error envelope. */
|
|
50
|
+
export interface ApiErrorBody {
|
|
51
|
+
code?: string;
|
|
52
|
+
message?: string;
|
|
53
|
+
doc_url?: string | null;
|
|
54
|
+
param?: string | null;
|
|
55
|
+
/** The specific cause behind `code`, when there is a more specific one (#7209). */
|
|
56
|
+
reason?: string | null;
|
|
57
|
+
/** RFC3339 instant before which retrying cannot succeed (#7209). Always future. */
|
|
58
|
+
retry_at?: string | null;
|
|
59
|
+
/** Requested and measured ages for `freshness_ceiling_unsatisfied`. */
|
|
60
|
+
freshness?: FreshnessFailure | null;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
}
|
|
63
|
+
/** Response `meta` carried alongside an error envelope. */
|
|
64
|
+
export interface ApiErrorMeta {
|
|
65
|
+
request_id?: string;
|
|
66
|
+
cached?: boolean;
|
|
67
|
+
cost?: number;
|
|
68
|
+
[key: string]: unknown;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The SDK's deadline (`timeoutMs`) expired during the request, body read, or
|
|
72
|
+
* retry backoff. Caller cancellation preserves the caller's exact reason.
|
|
73
|
+
* Not an `OxinsiderApiError`: there is no status, body, or request id.
|
|
74
|
+
*/
|
|
75
|
+
export declare class RequestTimeoutError extends Error {
|
|
76
|
+
readonly operationId: string;
|
|
77
|
+
readonly timeoutMs: number;
|
|
78
|
+
constructor(operationId: string, timeoutMs: number);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* An owned JSON/text response failed while its body was being read.
|
|
82
|
+
* Headers may have arrived successfully; no body, URL or credential is copied.
|
|
83
|
+
* The native read failure is retained as cause. Client deadlines and caller
|
|
84
|
+
* abort reasons take precedence, and this failure does not trigger a retry.
|
|
85
|
+
*/
|
|
86
|
+
export declare class ResponseBodyReadError extends Error {
|
|
87
|
+
readonly responseStatus: number;
|
|
88
|
+
readonly phase: "response_body";
|
|
89
|
+
constructor(responseStatus: number, cause: unknown);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The export object was read, but its streamed bytes did not match the
|
|
93
|
+
* immutable manifest returned by the status route. The partial file must be
|
|
94
|
+
* discarded before requesting a fresh download.
|
|
95
|
+
*/
|
|
96
|
+
export declare class ExportIntegrityError extends Error {
|
|
97
|
+
readonly jobId: number;
|
|
98
|
+
readonly expectedSha256: string;
|
|
99
|
+
readonly actualSha256: string | null;
|
|
100
|
+
readonly expectedSizeBytes: number;
|
|
101
|
+
readonly actualSizeBytes: number;
|
|
102
|
+
readonly cause: unknown;
|
|
103
|
+
constructor(jobId: number, expectedSha256: string, actualSha256: string | null, expectedSizeBytes: number, actualSizeBytes: number, cause?: unknown);
|
|
104
|
+
}
|
|
105
|
+
/** Received HTTP metadata; it never changes the response body or retry eligibility. */
|
|
106
|
+
export interface ApiErrorTransportMetadata {
|
|
107
|
+
readonly requestId?: string | null;
|
|
108
|
+
readonly retryAfterSeconds?: number | null;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Base class for every error thrown by the SDK on a non-2xx API response.
|
|
112
|
+
* Subclasses below specialize by documented `code`.
|
|
113
|
+
*/
|
|
114
|
+
export declare class OxinsiderApiError extends Error {
|
|
115
|
+
/** HTTP status code of the failing response. */
|
|
116
|
+
readonly status: number;
|
|
117
|
+
/** Documented error code, when the body carried one. */
|
|
118
|
+
readonly code: ApiErrorCode | string | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* The specific, actionable cause behind `code`, or `null` when the response carried
|
|
121
|
+
* no reason the SDK recognizes (#7209).
|
|
122
|
+
*
|
|
123
|
+
* Declared on the BASE class, not only on the five reason subclasses, so the thing an
|
|
124
|
+
* SDK user actually writes type-checks:
|
|
125
|
+
*
|
|
126
|
+
* catch (e) { if (e instanceof OxinsiderApiError && e.reason === "pick_not_released") ... }
|
|
127
|
+
*
|
|
128
|
+
* With `reason` living only on the subclasses, that read was a type error, and the only
|
|
129
|
+
* way to branch on the cause was an `instanceof` ladder over all five -- which defeats
|
|
130
|
+
* the point of shipping a reason at all. The subclasses narrow this to their own literal.
|
|
131
|
+
*
|
|
132
|
+
* The raw wire value always stays on `error.reason`, so a reason NEWER than this SDK is
|
|
133
|
+
* never destroyed -- it is simply not typed yet, and reads as `null` here.
|
|
134
|
+
*
|
|
135
|
+
* Read from the wire for EVERY class (#16547): a `SubscriptionRequiredError` carries
|
|
136
|
+
* `subscription_inactive`, a `RateLimitedError` carries `monthly_quota_exceeded`,
|
|
137
|
+
* `ip_rate_limited` or `ip_throttled`, and a `BadRequestError` carries `invalid_body`,
|
|
138
|
+
* `payload_too_large` and the rest. Until then only the subclasses that pin a literal
|
|
139
|
+
* carried a value and every other known reason read `null`.
|
|
140
|
+
*/
|
|
141
|
+
readonly reason: ApiErrorReason | null;
|
|
142
|
+
/**
|
|
143
|
+
* When retrying can first succeed, or `null` when the error is terminal.
|
|
144
|
+
*
|
|
145
|
+
* On the BASE class for exactly the reason `reason` is, and the backend says so in its
|
|
146
|
+
* own contract (`ApiErrorBody::retry_at`): the field is "generic on purpose ... so
|
|
147
|
+
* clients key on ONE field across the whole API rather than a per-endpoint zoo". With
|
|
148
|
+
* `retryAt` living only on the three retryable subclasses,
|
|
149
|
+
*
|
|
150
|
+
* catch (e) { if (e instanceof OxinsiderApiError && e.retryAt) scheduleRetry(e.retryAt) }
|
|
151
|
+
*
|
|
152
|
+
* was a type error -- the same defect the `reason` hoist above exists to fix, left in
|
|
153
|
+
* place one field over.
|
|
154
|
+
*
|
|
155
|
+
* Parsed from the wire on every error, so it is present whenever the API sends it and
|
|
156
|
+
* `null` when it does not. A terminal error (`cursor_expired`, `trader_not_tracked`)
|
|
157
|
+
* has no `retry_at`, and `null` is the honest answer: do not retry this.
|
|
158
|
+
*
|
|
159
|
+
* DO NOT BLOCK A WORKER THREAD ON IT. On `pick_not_released` this can be 13-14 hours
|
|
160
|
+
* out (a full day on a skipped day). Schedule the retry; do not sleep.
|
|
161
|
+
*/
|
|
162
|
+
readonly retryAt: Date | null;
|
|
163
|
+
/** Parsed `error` object (`{ code, message, doc_url?, param? }`), or null. */
|
|
164
|
+
readonly error: ApiErrorBody | null;
|
|
165
|
+
/** Response `meta` (`request_id`, `cost`, ...), or null. */
|
|
166
|
+
readonly meta: ApiErrorMeta | null;
|
|
167
|
+
/** Body `meta.request_id`, or the received `X-Request-ID` when absent. */
|
|
168
|
+
readonly requestId: string | undefined;
|
|
169
|
+
/** Parsed `Retry-After` guidance, independent of whether this request can be retried. */
|
|
170
|
+
readonly retryAfterSeconds: number | null;
|
|
171
|
+
/** Raw, unparsed body for debugging. */
|
|
172
|
+
readonly body: unknown;
|
|
173
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
174
|
+
}
|
|
175
|
+
/** 400 - the request was malformed; see `param` for the offending field. */
|
|
176
|
+
export declare class BadRequestError extends OxinsiderApiError {
|
|
177
|
+
readonly code: "bad_request";
|
|
178
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* 409 `reason: freshness_ceiling_unsatisfied` - a trader response did not
|
|
182
|
+
* satisfy the caller's opt-in whole-response age ceiling. The server does not
|
|
183
|
+
* refresh or bypass its normal read, so the caller may use the details to decide
|
|
184
|
+
* whether to accept the body or try again later.
|
|
185
|
+
*/
|
|
186
|
+
export declare class FreshnessCeilingUnsatisfiedError extends BadRequestError {
|
|
187
|
+
readonly reason: "freshness_ceiling_unsatisfied";
|
|
188
|
+
readonly freshness: FreshnessFailure | null;
|
|
189
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* 400 `reason: unknown_query_parameter` - strict validation rejected a query
|
|
193
|
+
* name the operation does not publish. Remove or correct the name, or leave
|
|
194
|
+
* `strictQuery` unset while migrating a caller.
|
|
195
|
+
*/
|
|
196
|
+
export declare class UnknownQueryParameterError extends BadRequestError {
|
|
197
|
+
readonly reason: "unknown_query_parameter";
|
|
198
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
199
|
+
}
|
|
200
|
+
/** 401 - the `oxi_sk_*` API key is missing, malformed, or revoked. */
|
|
201
|
+
export declare class InvalidApiKeyError extends OxinsiderApiError {
|
|
202
|
+
readonly code: "invalid_api_key";
|
|
203
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 401 `reason: sandbox_api_key` - the credential is a sandbox key (`oxi_sk_test_`)
|
|
207
|
+
* from `POST /api/v1/agents/register` (#13959). Only the sandbox server accepts
|
|
208
|
+
* it: call `https://0xinsider.com/sandbox/api/v1` with it, or use a live key or
|
|
209
|
+
* OAuth access token. Retrying here will not help.
|
|
210
|
+
*/
|
|
211
|
+
export declare class SandboxApiKeyError extends InvalidApiKeyError {
|
|
212
|
+
readonly reason: "sandbox_api_key";
|
|
213
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* 401 `reason: api_key_in_query` - the key was sent as a `?token=` query
|
|
217
|
+
* parameter (#14123). No route reads a key from the URL, so the key itself was
|
|
218
|
+
* not checked: resend it as `Authorization: Bearer`. This client always sends
|
|
219
|
+
* the header, so seeing this means a URL was built by hand.
|
|
220
|
+
*/
|
|
221
|
+
export declare class ApiKeyInQueryError extends InvalidApiKeyError {
|
|
222
|
+
readonly reason: "api_key_in_query";
|
|
223
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* 402 - the key is valid but the account has no active Pro subscription.
|
|
227
|
+
*
|
|
228
|
+
* Permanent until a person reactivates (`reason: subscription_inactive`,
|
|
229
|
+
* #14283): there is no `Retry-After`, and a retry on a schedule never clears
|
|
230
|
+
* it. Stop the loop and surface `reactivationUrl` to your own user. The key
|
|
231
|
+
* and its settings are unchanged and work again the moment Pro is active;
|
|
232
|
+
* the owner is emailed once per lapse.
|
|
233
|
+
*/
|
|
234
|
+
export declare class SubscriptionRequiredError extends OxinsiderApiError {
|
|
235
|
+
readonly code: "subscription_required";
|
|
236
|
+
/** Where the account reactivates Pro. */
|
|
237
|
+
readonly reactivationUrl = "https://0xinsider.com/billing";
|
|
238
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
239
|
+
}
|
|
240
|
+
/** 403 - the key is authenticated but not allowed to access this resource. */
|
|
241
|
+
export declare class ForbiddenError extends OxinsiderApiError {
|
|
242
|
+
readonly code: "forbidden";
|
|
243
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
244
|
+
}
|
|
245
|
+
/** 404 - the requested resource does not exist. */
|
|
246
|
+
export declare class NotFoundError extends OxinsiderApiError {
|
|
247
|
+
readonly code: "not_found";
|
|
248
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
249
|
+
}
|
|
250
|
+
/** 403 - the account is locked; contact support. */
|
|
251
|
+
export declare class AccountLockedError extends OxinsiderApiError {
|
|
252
|
+
readonly code: "account_locked";
|
|
253
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* 429 - the per-key rate limit was exceeded. `retryAfterSeconds` is read from
|
|
257
|
+
* the standard `Retry-After` response header when present.
|
|
258
|
+
*/
|
|
259
|
+
export declare class RateLimitedError extends OxinsiderApiError {
|
|
260
|
+
readonly code: "rate_limited";
|
|
261
|
+
constructor(status: number, body: unknown, retryAfterSeconds: number | null, transport?: ApiErrorTransportMetadata);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* 408 `request_timeout` (#16146) - the server did not finish the request
|
|
265
|
+
* inside its 30-second timeout. Distinct from `RequestTimeoutError`, which is
|
|
266
|
+
* this client's own deadline with no response at all.
|
|
267
|
+
*
|
|
268
|
+
* `retryAfterSeconds` is set only on a safe method (GET, HEAD): the server
|
|
269
|
+
* gives a mutation no hint, because it may have completed. Check its state
|
|
270
|
+
* before repeating it, and reuse its Idempotency-Key.
|
|
271
|
+
*/
|
|
272
|
+
export declare class ServerTimeoutError extends OxinsiderApiError {
|
|
273
|
+
readonly code: "request_timeout";
|
|
274
|
+
constructor(status: number, body: unknown, retryAfterSeconds: number | null, transport?: ApiErrorTransportMetadata);
|
|
275
|
+
}
|
|
276
|
+
/** 503 - the rate-limit/admission backend was briefly unavailable; retry. */
|
|
277
|
+
export declare class RateLimitUnavailableError extends OxinsiderApiError {
|
|
278
|
+
readonly code: "rate_limit_unavailable";
|
|
279
|
+
constructor(status: number, body: unknown, retryAfterSeconds: number | null, transport?: ApiErrorTransportMetadata);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* 404 `reason: pick_not_released` - no Pick of the Day is published for the
|
|
283
|
+
* current product day (#7209).
|
|
284
|
+
*
|
|
285
|
+
* This is NOT "the endpoint is broken" and NOT "the resource does not exist".
|
|
286
|
+
* Each selected pick releases about an hour before its own provider kickoff, inside
|
|
287
|
+
* the daily operating window, 11:00 UTC to 23:00 America/New_York (#7226, #7709,
|
|
288
|
+
* #16207) -- there is no fixed publish clock time. The product day rolls at midnight America/New_York, so the
|
|
289
|
+
* endpoint legitimately 404s from that roll until the day's release (a span that
|
|
290
|
+
* varies with the pick's kickoff), and for the full product day on a skipped day.
|
|
291
|
+
*
|
|
292
|
+
* DO NOT POLL. Sleep for `retryAfterSeconds` (or until `retryAt`) and request
|
|
293
|
+
* once. Blind polling through this window was 91.8% of all logged v1 API errors.
|
|
294
|
+
*/
|
|
295
|
+
export declare class PickNotReleasedError extends NotFoundError {
|
|
296
|
+
readonly reason: "pick_not_released";
|
|
297
|
+
constructor(status: number, body: unknown, retryAfterSeconds: number | null, transport?: ApiErrorTransportMetadata);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* 503 `reason: read_model_warming` - endpoint-local read-model unavailability (#7209).
|
|
301
|
+
*
|
|
302
|
+
* This is not rate limiting. Retry only this route after the supplied interval;
|
|
303
|
+
* the exact cause is endpoint-specific, so do not infer dependency health from
|
|
304
|
+
* this reason.
|
|
305
|
+
*/
|
|
306
|
+
export declare class ReadModelWarmingError extends RateLimitUnavailableError {
|
|
307
|
+
readonly reason: "read_model_warming";
|
|
308
|
+
constructor(status: number, body: unknown, retryAfterSeconds: number | null, transport?: ApiErrorTransportMetadata);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* 503 `reason: database_unavailable` - the API's database or its connection
|
|
312
|
+
* pool is temporarily unreachable (#10737). A connection-class failure, not a
|
|
313
|
+
* query fault, and not rate limiting: back off for `retryAfterSeconds`, then
|
|
314
|
+
* retry the same request.
|
|
315
|
+
*/
|
|
316
|
+
export declare class DatabaseUnavailableError extends RateLimitUnavailableError {
|
|
317
|
+
readonly reason: "database_unavailable";
|
|
318
|
+
constructor(status: number, body: unknown, retryAfterSeconds: number | null, transport?: ApiErrorTransportMetadata);
|
|
319
|
+
}
|
|
320
|
+
/** 503 - accounting capacity was unavailable before the handler ran. */
|
|
321
|
+
export declare class RequestAccountingUnavailableError extends RateLimitUnavailableError {
|
|
322
|
+
readonly reason: "request_accounting_unavailable";
|
|
323
|
+
constructor(status: number, body: unknown, retryAfterSeconds: number | null, transport?: ApiErrorTransportMetadata);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* 400 `reason: cursor_expired` - the pagination cursor was invalidated by an
|
|
327
|
+
* upstream data change (#7209). Recovery is mechanical: re-request the first page
|
|
328
|
+
* and continue. This is NOT a bad parameter -- do not stop retrying.
|
|
329
|
+
*/
|
|
330
|
+
export declare class CursorExpiredError extends BadRequestError {
|
|
331
|
+
readonly reason: "cursor_expired";
|
|
332
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* 409 `reason: idempotency_in_progress` - the same idempotent mutation is still
|
|
336
|
+
* running. Retain the exact `Idempotency-Key` and body and retry shortly; do NOT
|
|
337
|
+
* mint a new mutation. The wire carries code `bad_request` at HTTP 409, so this
|
|
338
|
+
* refines `BadRequestError` -- a consumer catching `BadRequestError` still matches.
|
|
339
|
+
*/
|
|
340
|
+
export declare class IdempotencyInProgressError extends BadRequestError {
|
|
341
|
+
readonly reason: "idempotency_in_progress";
|
|
342
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* 409 `reason: webhook_delivery_in_progress` - a webhook endpoint's URL and
|
|
346
|
+
* signing secret are frozen while a delivery is in flight. Retry the
|
|
347
|
+
* configuration change after that delivery completes. The wire carries code
|
|
348
|
+
* `bad_request` at HTTP 409, so this refines `BadRequestError`.
|
|
349
|
+
*/
|
|
350
|
+
export declare class WebhookDeliveryInProgressError extends BadRequestError {
|
|
351
|
+
readonly reason: "webhook_delivery_in_progress";
|
|
352
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* 404 `reason: unknown_endpoint` - the PATH is not a route on this API (#7209).
|
|
356
|
+
* Read `GET /api/v1` for the route index. Retrying will not help.
|
|
357
|
+
*/
|
|
358
|
+
export declare class UnknownEndpointError extends NotFoundError {
|
|
359
|
+
readonly reason: "unknown_endpoint";
|
|
360
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* 404 `reason: trader_not_tracked` - the wallet is real and the URL is right, but
|
|
364
|
+
* the trader is outside the HOT/WARM sync tiers so we do not capture this data
|
|
365
|
+
* for them (#7209). Stop asking for this wallet; do not hunt for a different URL.
|
|
366
|
+
*/
|
|
367
|
+
export declare class TraderNotTrackedError extends NotFoundError {
|
|
368
|
+
readonly reason: "trader_not_tracked";
|
|
369
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* A 2xx response whose body does not match the contract this client relies
|
|
373
|
+
* on (#16246): a list operation answering without a list envelope, or with a
|
|
374
|
+
* `has_more` that is not a boolean or a `next_cursor` that is not a string.
|
|
375
|
+
* `code` is `invalid_response`, a client-side code that the API never sends;
|
|
376
|
+
* `received` is the body as parsed. Not retried: the same request would
|
|
377
|
+
* return the same body. Report it with `requestId` when the body carried one.
|
|
378
|
+
*/
|
|
379
|
+
export declare class InvalidResponseError extends OxinsiderApiError {
|
|
380
|
+
readonly code: "invalid_response";
|
|
381
|
+
/** The response body as received, for diagnosis. */
|
|
382
|
+
readonly received: unknown;
|
|
383
|
+
constructor(status: number, message: string, received: unknown);
|
|
384
|
+
}
|
|
385
|
+
/** 5xx - an unexpected server-side error; retry only when the request is safe to replay. */
|
|
386
|
+
export declare class InternalServerError extends OxinsiderApiError {
|
|
387
|
+
readonly code: "internal_error";
|
|
388
|
+
constructor(status: number, body: unknown, transport?: ApiErrorTransportMetadata);
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Construct the most specific `OxinsiderApiError` subclass for a failed
|
|
392
|
+
* response. Dispatch is by `error.reason` FIRST -- strictly more specific than the code,
|
|
393
|
+
* because the reason names the CAUSE where the code names only the class -- then by
|
|
394
|
+
* `error.code`, then a status-code heuristic, falling back to the base class for anything
|
|
395
|
+
* unrecognized so an unknown code is never silently dropped.
|
|
396
|
+
*/
|
|
397
|
+
export declare function errorFromResponse(status: number, body: unknown, retryAfterSeconds?: number | null, transport?: Pick<ApiErrorTransportMetadata, "requestId">): OxinsiderApiError;
|
|
398
|
+
/** Pull the `error` object out of an envelope or a flat error body. */
|
|
399
|
+
export declare function extractApiErrorBody(body: unknown): ApiErrorBody | null;
|
|
400
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe,YAC1B,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,wBAAwB,EACxB,gBAAgB,EAEhB,oBAAoB,EAGpB,iBAAiB,CACT,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,YAC5B,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,gCAAgC,EAKhC,yBAAyB,EACzB,8B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