@onflay/node 0.2.1 → 1.0.0-staging-20261206080029
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/CHANGELOG.md +74 -0
- package/README.md +211 -48
- package/dist/chunk-4RUPPDC2.mjs +121 -0
- package/dist/chunk-4RUPPDC2.mjs.map +1 -0
- package/dist/chunk-63KSRMJG.mjs +47 -0
- package/dist/chunk-63KSRMJG.mjs.map +1 -0
- package/dist/chunk-7LYAEZCT.mjs +197 -0
- package/dist/chunk-7LYAEZCT.mjs.map +1 -0
- package/dist/chunk-A3TRCKHK.mjs +60 -0
- package/dist/chunk-A3TRCKHK.mjs.map +1 -0
- package/dist/chunk-AFAU2FH2.js +47 -0
- package/dist/chunk-AFAU2FH2.js.map +1 -0
- package/dist/chunk-DBE2YZWE.mjs +38 -0
- package/dist/chunk-DBE2YZWE.mjs.map +1 -0
- package/dist/chunk-EOHFYWFQ.mjs +154 -0
- package/dist/chunk-EOHFYWFQ.mjs.map +1 -0
- package/dist/chunk-I2IVHBFA.js +197 -0
- package/dist/chunk-I2IVHBFA.js.map +1 -0
- package/dist/chunk-J4MYKTPN.mjs +37 -0
- package/dist/chunk-J4MYKTPN.mjs.map +1 -0
- package/dist/chunk-JQPANXLV.mjs +37 -0
- package/dist/chunk-JQPANXLV.mjs.map +1 -0
- package/dist/chunk-JXP6V2P2.mjs +1057 -0
- package/dist/chunk-JXP6V2P2.mjs.map +1 -0
- package/dist/chunk-M52GW7GQ.js +1057 -0
- package/dist/chunk-M52GW7GQ.js.map +1 -0
- package/dist/chunk-MMMUKAI6.js +37 -0
- package/dist/chunk-MMMUKAI6.js.map +1 -0
- package/dist/chunk-NSR4UQLV.js +87 -0
- package/dist/chunk-NSR4UQLV.js.map +1 -0
- package/dist/chunk-SUONZUVK.js +154 -0
- package/dist/chunk-SUONZUVK.js.map +1 -0
- package/dist/chunk-T26CPULH.js +121 -0
- package/dist/chunk-T26CPULH.js.map +1 -0
- package/dist/chunk-V2XJ4GZU.js +38 -0
- package/dist/chunk-V2XJ4GZU.js.map +1 -0
- package/dist/chunk-W6AEPYUG.js +37 -0
- package/dist/chunk-W6AEPYUG.js.map +1 -0
- package/dist/chunk-YHQ7XIC6.js +60 -0
- package/dist/chunk-YHQ7XIC6.js.map +1 -0
- package/dist/chunk-YSXUZYUY.mjs +87 -0
- package/dist/chunk-YSXUZYUY.mjs.map +1 -0
- package/dist/index-C1KFW_9r.d.mts +3989 -0
- package/dist/index-C1KFW_9r.d.ts +3989 -0
- package/dist/index.d.mts +918 -0
- package/dist/index.d.ts +918 -26
- package/dist/index.js +2990 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2991 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/config.d.mts +59 -0
- package/dist/lib/config.d.ts +59 -0
- package/dist/lib/config.js +15 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/config.mjs +15 -0
- package/dist/lib/config.mjs.map +1 -0
- package/dist/lib/http.d.mts +51 -0
- package/dist/lib/http.d.ts +51 -0
- package/dist/lib/http.js +13 -0
- package/dist/lib/http.js.map +1 -0
- package/dist/lib/http.mjs +13 -0
- package/dist/lib/http.mjs.map +1 -0
- package/dist/lib/retries.d.mts +41 -0
- package/dist/lib/retries.d.ts +41 -0
- package/dist/lib/retries.js +16 -0
- package/dist/lib/retries.js.map +1 -0
- package/dist/lib/retries.mjs +16 -0
- package/dist/lib/retries.mjs.map +1 -0
- package/dist/lib/sdks.d.mts +61 -0
- package/dist/lib/sdks.d.ts +61 -0
- package/dist/lib/sdks.js +12 -0
- package/dist/lib/sdks.js.map +1 -0
- package/dist/lib/sdks.mjs +12 -0
- package/dist/lib/sdks.mjs.map +1 -0
- package/dist/models/components/index.d.mts +1 -0
- package/dist/models/components/index.d.ts +1 -0
- package/dist/models/components/index.js +1 -0
- package/dist/models/components/index.js.map +1 -0
- package/dist/models/components/index.mjs +1 -0
- package/dist/models/components/index.mjs.map +1 -0
- package/dist/models/errors/index.d.mts +161 -0
- package/dist/models/errors/index.d.ts +161 -0
- package/dist/models/errors/index.js +29 -0
- package/dist/models/errors/index.js.map +1 -0
- package/dist/models/errors/index.mjs +29 -0
- package/dist/models/errors/index.mjs.map +1 -0
- package/dist/models/operations/index.d.mts +769 -0
- package/dist/models/operations/index.d.ts +769 -0
- package/dist/models/operations/index.js +1 -0
- package/dist/models/operations/index.js.map +1 -0
- package/dist/models/operations/index.mjs +1 -0
- package/dist/models/operations/index.mjs.map +1 -0
- package/dist/types/index.d.mts +26 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/verify-tF2BsJK6.d.mts +325 -0
- package/dist/verify-tF2BsJK6.d.ts +325 -0
- package/dist/webhooks/express.d.mts +39 -0
- package/dist/webhooks/express.d.ts +39 -0
- package/dist/webhooks/express.js +10 -0
- package/dist/webhooks/express.js.map +1 -0
- package/dist/webhooks/express.mjs +10 -0
- package/dist/webhooks/express.mjs.map +1 -0
- package/dist/webhooks/hono.d.mts +33 -0
- package/dist/webhooks/hono.d.ts +33 -0
- package/dist/webhooks/hono.js +10 -0
- package/dist/webhooks/hono.js.map +1 -0
- package/dist/webhooks/hono.mjs +10 -0
- package/dist/webhooks/hono.mjs.map +1 -0
- package/dist/webhooks/index.d.mts +34 -0
- package/dist/webhooks/index.d.ts +34 -0
- package/dist/webhooks/index.js +75 -0
- package/dist/webhooks/index.js.map +1 -0
- package/dist/webhooks/index.mjs +75 -0
- package/dist/webhooks/index.mjs.map +1 -0
- package/dist/webhooks/next.d.mts +38 -0
- package/dist/webhooks/next.d.ts +38 -0
- package/dist/webhooks/next.js +10 -0
- package/dist/webhooks/next.js.map +1 -0
- package/dist/webhooks/next.mjs +10 -0
- package/dist/webhooks/next.mjs.map +1 -0
- package/package.json +273 -14
- package/dist/client.d.ts +0 -65
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -216
- package/dist/client.js.map +0 -1
- package/dist/errors.d.ts +0 -61
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -134
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/onflay.d.ts +0 -42
- package/dist/onflay.d.ts.map +0 -1
- package/dist/onflay.js +0 -60
- package/dist/onflay.js.map +0 -1
- package/dist/pagination.d.ts +0 -19
- package/dist/pagination.d.ts.map +0 -1
- package/dist/pagination.js +0 -61
- package/dist/pagination.js.map +0 -1
- package/dist/resources/checkout-sessions.d.ts +0 -11
- package/dist/resources/checkout-sessions.d.ts.map +0 -1
- package/dist/resources/checkout-sessions.js +0 -20
- package/dist/resources/checkout-sessions.js.map +0 -1
- package/dist/resources/customers.d.ts +0 -17
- package/dist/resources/customers.d.ts.map +0 -1
- package/dist/resources/customers.js +0 -39
- package/dist/resources/customers.js.map +0 -1
- package/dist/resources/payments.d.ts +0 -11
- package/dist/resources/payments.d.ts.map +0 -1
- package/dist/resources/payments.js +0 -27
- package/dist/resources/payments.js.map +0 -1
- package/dist/resources/prices.d.ts +0 -24
- package/dist/resources/prices.d.ts.map +0 -1
- package/dist/resources/prices.js +0 -46
- package/dist/resources/prices.js.map +0 -1
- package/dist/resources/products.d.ts +0 -18
- package/dist/resources/products.d.ts.map +0 -1
- package/dist/resources/products.js +0 -40
- package/dist/resources/products.js.map +0 -1
- package/dist/resources/subscriptions.d.ts +0 -39
- package/dist/resources/subscriptions.d.ts.map +0 -1
- package/dist/resources/subscriptions.js +0 -62
- package/dist/resources/subscriptions.js.map +0 -1
- package/dist/resources/usage.d.ts +0 -26
- package/dist/resources/usage.d.ts.map +0 -1
- package/dist/resources/usage.js +0 -43
- package/dist/resources/usage.js.map +0 -1
- package/dist/resources/webhook-endpoints.d.ts +0 -20
- package/dist/resources/webhook-endpoints.d.ts.map +0 -1
- package/dist/resources/webhook-endpoints.js +0 -47
- package/dist/resources/webhook-endpoints.js.map +0 -1
- package/dist/types/checkout-sessions.d.ts +0 -67
- package/dist/types/checkout-sessions.d.ts.map +0 -1
- package/dist/types/checkout-sessions.js +0 -3
- package/dist/types/checkout-sessions.js.map +0 -1
- package/dist/types/customers.d.ts +0 -28
- package/dist/types/customers.d.ts.map +0 -1
- package/dist/types/customers.js +0 -3
- package/dist/types/customers.js.map +0 -1
- package/dist/types/events.d.ts +0 -95
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/events.js +0 -24
- package/dist/types/events.js.map +0 -1
- package/dist/types/payments.d.ts +0 -25
- package/dist/types/payments.d.ts.map +0 -1
- package/dist/types/payments.js +0 -3
- package/dist/types/payments.js.map +0 -1
- package/dist/types/prices.d.ts +0 -57
- package/dist/types/prices.d.ts.map +0 -1
- package/dist/types/prices.js +0 -3
- package/dist/types/prices.js.map +0 -1
- package/dist/types/products.d.ts +0 -29
- package/dist/types/products.d.ts.map +0 -1
- package/dist/types/products.js +0 -3
- package/dist/types/products.js.map +0 -1
- package/dist/types/shared.d.ts +0 -34
- package/dist/types/shared.d.ts.map +0 -1
- package/dist/types/shared.js +0 -4
- package/dist/types/shared.js.map +0 -1
- package/dist/types/subscriptions.d.ts +0 -85
- package/dist/types/subscriptions.d.ts.map +0 -1
- package/dist/types/subscriptions.js +0 -3
- package/dist/types/subscriptions.js.map +0 -1
- package/dist/types/usage.d.ts +0 -35
- package/dist/types/usage.d.ts.map +0 -1
- package/dist/types/usage.js +0 -3
- package/dist/types/usage.js.map +0 -1
- package/dist/types/webhook-endpoints.d.ts +0 -48
- package/dist/types/webhook-endpoints.d.ts.map +0 -1
- package/dist/types/webhook-endpoints.js +0 -3
- package/dist/types/webhook-endpoints.js.map +0 -1
- package/dist/version.d.ts +0 -4
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -7
- package/dist/version.js.map +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { H as ApiErrorDetail$1, K as ApiFieldError$1 } from '../../index-C1KFW_9r.mjs';
|
|
2
|
+
|
|
3
|
+
/** Base class for failures to get a response at all (network, timeout, abort, invalid request). */
|
|
4
|
+
declare class HTTPClientError extends Error {
|
|
5
|
+
/** The underlying cause of the error. */
|
|
6
|
+
readonly cause: unknown;
|
|
7
|
+
name: string;
|
|
8
|
+
constructor(message: string, opts?: {
|
|
9
|
+
cause?: unknown;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** An unrecognised or unexpected error occurred while sending the request. */
|
|
13
|
+
declare class UnexpectedClientError extends HTTPClientError {
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
/** The request could not be built (for example, an invalid server URL). */
|
|
17
|
+
declare class InvalidRequestError extends HTTPClientError {
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
/** The request was aborted by the caller (`signal`). */
|
|
21
|
+
declare class RequestAbortedError extends HTTPClientError {
|
|
22
|
+
readonly name = "RequestAbortedError";
|
|
23
|
+
}
|
|
24
|
+
/** The request took longer than `timeoutMs`. Retried when `retryConnectionErrors` is on. */
|
|
25
|
+
declare class RequestTimeoutError extends HTTPClientError {
|
|
26
|
+
readonly name = "RequestTimeoutError";
|
|
27
|
+
}
|
|
28
|
+
/** The server could not be reached (DNS, refused or reset connection, TLS). Retried when `retryConnectionErrors` is on. */
|
|
29
|
+
declare class ConnectionError extends HTTPClientError {
|
|
30
|
+
readonly name = "ConnectionError";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** HTTP metadata attached to every error built from an API response. */
|
|
34
|
+
type HTTPMeta = {
|
|
35
|
+
response: Response;
|
|
36
|
+
request: Request;
|
|
37
|
+
/** Raw response body (may be an empty string). */
|
|
38
|
+
body: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Base class of every error built from an HTTP response (Speakeasy's `{Sdk}Error`).
|
|
42
|
+
* Catch it to handle any non-2xx answer from the API.
|
|
43
|
+
*/
|
|
44
|
+
declare class OnflayError extends Error {
|
|
45
|
+
/** HTTP status code. */
|
|
46
|
+
readonly statusCode: number;
|
|
47
|
+
/** Raw response body (may be an empty string). */
|
|
48
|
+
readonly body: string;
|
|
49
|
+
/** Response headers. */
|
|
50
|
+
readonly headers: Headers;
|
|
51
|
+
/** Response `Content-Type`. */
|
|
52
|
+
readonly contentType: string;
|
|
53
|
+
/** The raw `Response`. */
|
|
54
|
+
readonly rawResponse: Response;
|
|
55
|
+
constructor(message: string, httpMeta: HTTPMeta);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Fallback for an error response that does not match a documented error shape (a status
|
|
60
|
+
* code the operation does not list, or a body that is not the Onflay error envelope,
|
|
61
|
+
* e.g. an HTML 502 from a proxy). Speakeasy's default error class.
|
|
62
|
+
*/
|
|
63
|
+
declare class OnflayDefaultError extends OnflayError {
|
|
64
|
+
constructor(message: string, httpMeta: HTTPMeta);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** One failed validation rule (`error.errors[]`). */
|
|
68
|
+
type ApiFieldError = ApiFieldError$1;
|
|
69
|
+
/**
|
|
70
|
+
* The `error` object of the Onflay error envelope, with camelCase names
|
|
71
|
+
* (`doc_url` → `docUrl`, `request_id` folded into `requestId`), as a Speakeasy model.
|
|
72
|
+
*/
|
|
73
|
+
type ApiErrorDetail = {
|
|
74
|
+
/** Error class: `authentication_error`, `invalid_request`, `api_error`, `rate_limit_error`, `idempotency_error`. */
|
|
75
|
+
type: ApiErrorDetail$1['type'];
|
|
76
|
+
/** Stable machine-readable code, documented at https://docs.onflay.com/errors. */
|
|
77
|
+
code: string;
|
|
78
|
+
message: string;
|
|
79
|
+
/** One sentence saying how to fix the request. */
|
|
80
|
+
hint?: string | undefined;
|
|
81
|
+
/** Reference page for `code`. */
|
|
82
|
+
docUrl?: string | undefined;
|
|
83
|
+
/** Request field the error refers to (first invalid field for validation errors). */
|
|
84
|
+
param?: string | undefined;
|
|
85
|
+
/** Alias of `param`. */
|
|
86
|
+
field?: string | undefined;
|
|
87
|
+
/** Validation errors only: one entry per failed rule. */
|
|
88
|
+
errors?: ApiFieldError[] | undefined;
|
|
89
|
+
requestId: string;
|
|
90
|
+
};
|
|
91
|
+
/** The error envelope as sent by the API: `{ error: { type, code, message, … } }`. */
|
|
92
|
+
type ApiErrorData = {
|
|
93
|
+
error: ApiErrorDetail;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* An error response in the Onflay error envelope (every documented 4XX/5XX). The class is
|
|
97
|
+
* named after the spec's `ApiError` schema, as Speakeasy names error classes.
|
|
98
|
+
*
|
|
99
|
+
* ```ts
|
|
100
|
+
* import { ApiError } from '@onflay/node/models/errors';
|
|
101
|
+
*
|
|
102
|
+
* try {
|
|
103
|
+
* await onflay.customers.retrieve({ id: 'cus_missing' });
|
|
104
|
+
* } catch (err) {
|
|
105
|
+
* if (err instanceof ApiError) {
|
|
106
|
+
* console.log(err.statusCode, err.error.code, err.error.hint, err.error.requestId);
|
|
107
|
+
* }
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* The envelope members are also available directly on the error (`err.code`, `err.hint`, …).
|
|
112
|
+
*/
|
|
113
|
+
declare class ApiError extends OnflayError {
|
|
114
|
+
/** The envelope's `error` object (camelCase). */
|
|
115
|
+
readonly error: ApiErrorDetail;
|
|
116
|
+
/** The original data that was passed to this error instance. */
|
|
117
|
+
readonly data$: ApiErrorData;
|
|
118
|
+
constructor(err: ApiErrorData, httpMeta: HTTPMeta);
|
|
119
|
+
/** `error.type`. */
|
|
120
|
+
get type(): ApiErrorDetail['type'];
|
|
121
|
+
/** `error.code`, e.g. `not_found`. */
|
|
122
|
+
get code(): string;
|
|
123
|
+
/** `error.hint`: how to fix the request. */
|
|
124
|
+
get hint(): string | undefined;
|
|
125
|
+
/** `error.docUrl`: the code's reference page. */
|
|
126
|
+
get docUrl(): string | undefined;
|
|
127
|
+
/** `error.param`. */
|
|
128
|
+
get param(): string | undefined;
|
|
129
|
+
/** `error.requestId` (quote it to support). */
|
|
130
|
+
get requestId(): string;
|
|
131
|
+
/** `error.errors`: validation errors, one per failed rule. */
|
|
132
|
+
get errors(): ApiFieldError[] | undefined;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** A 2XX response whose body could not be read as the documented type (e.g. not JSON). */
|
|
136
|
+
declare class ResponseValidationError extends OnflayError {
|
|
137
|
+
/** The raw value that failed validation. */
|
|
138
|
+
readonly rawValue: unknown;
|
|
139
|
+
/** The raw message that failed validation. */
|
|
140
|
+
readonly rawMessage: unknown;
|
|
141
|
+
constructor(message: string, extra: HTTPMeta & {
|
|
142
|
+
rawValue: unknown;
|
|
143
|
+
rawMessage: unknown;
|
|
144
|
+
cause?: unknown;
|
|
145
|
+
});
|
|
146
|
+
/** A human-readable version of the error. */
|
|
147
|
+
pretty(): string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Input that the SDK rejects before sending (e.g. a missing required argument). */
|
|
151
|
+
declare class SDKValidationError extends Error {
|
|
152
|
+
/** The raw value that failed validation. */
|
|
153
|
+
readonly rawValue: unknown;
|
|
154
|
+
/** The raw message that failed validation. */
|
|
155
|
+
readonly rawMessage: unknown;
|
|
156
|
+
constructor(message: string, cause: unknown, rawValue: unknown);
|
|
157
|
+
/** A human-readable version of the error. */
|
|
158
|
+
pretty(): string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export { ApiError, type ApiErrorData, type ApiErrorDetail, type ApiFieldError, ConnectionError, HTTPClientError, type HTTPMeta, InvalidRequestError, OnflayDefaultError, OnflayError, RequestAbortedError, RequestTimeoutError, ResponseValidationError, SDKValidationError, UnexpectedClientError };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { H as ApiErrorDetail$1, K as ApiFieldError$1 } from '../../index-C1KFW_9r.js';
|
|
2
|
+
|
|
3
|
+
/** Base class for failures to get a response at all (network, timeout, abort, invalid request). */
|
|
4
|
+
declare class HTTPClientError extends Error {
|
|
5
|
+
/** The underlying cause of the error. */
|
|
6
|
+
readonly cause: unknown;
|
|
7
|
+
name: string;
|
|
8
|
+
constructor(message: string, opts?: {
|
|
9
|
+
cause?: unknown;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** An unrecognised or unexpected error occurred while sending the request. */
|
|
13
|
+
declare class UnexpectedClientError extends HTTPClientError {
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
/** The request could not be built (for example, an invalid server URL). */
|
|
17
|
+
declare class InvalidRequestError extends HTTPClientError {
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
/** The request was aborted by the caller (`signal`). */
|
|
21
|
+
declare class RequestAbortedError extends HTTPClientError {
|
|
22
|
+
readonly name = "RequestAbortedError";
|
|
23
|
+
}
|
|
24
|
+
/** The request took longer than `timeoutMs`. Retried when `retryConnectionErrors` is on. */
|
|
25
|
+
declare class RequestTimeoutError extends HTTPClientError {
|
|
26
|
+
readonly name = "RequestTimeoutError";
|
|
27
|
+
}
|
|
28
|
+
/** The server could not be reached (DNS, refused or reset connection, TLS). Retried when `retryConnectionErrors` is on. */
|
|
29
|
+
declare class ConnectionError extends HTTPClientError {
|
|
30
|
+
readonly name = "ConnectionError";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** HTTP metadata attached to every error built from an API response. */
|
|
34
|
+
type HTTPMeta = {
|
|
35
|
+
response: Response;
|
|
36
|
+
request: Request;
|
|
37
|
+
/** Raw response body (may be an empty string). */
|
|
38
|
+
body: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Base class of every error built from an HTTP response (Speakeasy's `{Sdk}Error`).
|
|
42
|
+
* Catch it to handle any non-2xx answer from the API.
|
|
43
|
+
*/
|
|
44
|
+
declare class OnflayError extends Error {
|
|
45
|
+
/** HTTP status code. */
|
|
46
|
+
readonly statusCode: number;
|
|
47
|
+
/** Raw response body (may be an empty string). */
|
|
48
|
+
readonly body: string;
|
|
49
|
+
/** Response headers. */
|
|
50
|
+
readonly headers: Headers;
|
|
51
|
+
/** Response `Content-Type`. */
|
|
52
|
+
readonly contentType: string;
|
|
53
|
+
/** The raw `Response`. */
|
|
54
|
+
readonly rawResponse: Response;
|
|
55
|
+
constructor(message: string, httpMeta: HTTPMeta);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Fallback for an error response that does not match a documented error shape (a status
|
|
60
|
+
* code the operation does not list, or a body that is not the Onflay error envelope,
|
|
61
|
+
* e.g. an HTML 502 from a proxy). Speakeasy's default error class.
|
|
62
|
+
*/
|
|
63
|
+
declare class OnflayDefaultError extends OnflayError {
|
|
64
|
+
constructor(message: string, httpMeta: HTTPMeta);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** One failed validation rule (`error.errors[]`). */
|
|
68
|
+
type ApiFieldError = ApiFieldError$1;
|
|
69
|
+
/**
|
|
70
|
+
* The `error` object of the Onflay error envelope, with camelCase names
|
|
71
|
+
* (`doc_url` → `docUrl`, `request_id` folded into `requestId`), as a Speakeasy model.
|
|
72
|
+
*/
|
|
73
|
+
type ApiErrorDetail = {
|
|
74
|
+
/** Error class: `authentication_error`, `invalid_request`, `api_error`, `rate_limit_error`, `idempotency_error`. */
|
|
75
|
+
type: ApiErrorDetail$1['type'];
|
|
76
|
+
/** Stable machine-readable code, documented at https://docs.onflay.com/errors. */
|
|
77
|
+
code: string;
|
|
78
|
+
message: string;
|
|
79
|
+
/** One sentence saying how to fix the request. */
|
|
80
|
+
hint?: string | undefined;
|
|
81
|
+
/** Reference page for `code`. */
|
|
82
|
+
docUrl?: string | undefined;
|
|
83
|
+
/** Request field the error refers to (first invalid field for validation errors). */
|
|
84
|
+
param?: string | undefined;
|
|
85
|
+
/** Alias of `param`. */
|
|
86
|
+
field?: string | undefined;
|
|
87
|
+
/** Validation errors only: one entry per failed rule. */
|
|
88
|
+
errors?: ApiFieldError[] | undefined;
|
|
89
|
+
requestId: string;
|
|
90
|
+
};
|
|
91
|
+
/** The error envelope as sent by the API: `{ error: { type, code, message, … } }`. */
|
|
92
|
+
type ApiErrorData = {
|
|
93
|
+
error: ApiErrorDetail;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* An error response in the Onflay error envelope (every documented 4XX/5XX). The class is
|
|
97
|
+
* named after the spec's `ApiError` schema, as Speakeasy names error classes.
|
|
98
|
+
*
|
|
99
|
+
* ```ts
|
|
100
|
+
* import { ApiError } from '@onflay/node/models/errors';
|
|
101
|
+
*
|
|
102
|
+
* try {
|
|
103
|
+
* await onflay.customers.retrieve({ id: 'cus_missing' });
|
|
104
|
+
* } catch (err) {
|
|
105
|
+
* if (err instanceof ApiError) {
|
|
106
|
+
* console.log(err.statusCode, err.error.code, err.error.hint, err.error.requestId);
|
|
107
|
+
* }
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* The envelope members are also available directly on the error (`err.code`, `err.hint`, …).
|
|
112
|
+
*/
|
|
113
|
+
declare class ApiError extends OnflayError {
|
|
114
|
+
/** The envelope's `error` object (camelCase). */
|
|
115
|
+
readonly error: ApiErrorDetail;
|
|
116
|
+
/** The original data that was passed to this error instance. */
|
|
117
|
+
readonly data$: ApiErrorData;
|
|
118
|
+
constructor(err: ApiErrorData, httpMeta: HTTPMeta);
|
|
119
|
+
/** `error.type`. */
|
|
120
|
+
get type(): ApiErrorDetail['type'];
|
|
121
|
+
/** `error.code`, e.g. `not_found`. */
|
|
122
|
+
get code(): string;
|
|
123
|
+
/** `error.hint`: how to fix the request. */
|
|
124
|
+
get hint(): string | undefined;
|
|
125
|
+
/** `error.docUrl`: the code's reference page. */
|
|
126
|
+
get docUrl(): string | undefined;
|
|
127
|
+
/** `error.param`. */
|
|
128
|
+
get param(): string | undefined;
|
|
129
|
+
/** `error.requestId` (quote it to support). */
|
|
130
|
+
get requestId(): string;
|
|
131
|
+
/** `error.errors`: validation errors, one per failed rule. */
|
|
132
|
+
get errors(): ApiFieldError[] | undefined;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** A 2XX response whose body could not be read as the documented type (e.g. not JSON). */
|
|
136
|
+
declare class ResponseValidationError extends OnflayError {
|
|
137
|
+
/** The raw value that failed validation. */
|
|
138
|
+
readonly rawValue: unknown;
|
|
139
|
+
/** The raw message that failed validation. */
|
|
140
|
+
readonly rawMessage: unknown;
|
|
141
|
+
constructor(message: string, extra: HTTPMeta & {
|
|
142
|
+
rawValue: unknown;
|
|
143
|
+
rawMessage: unknown;
|
|
144
|
+
cause?: unknown;
|
|
145
|
+
});
|
|
146
|
+
/** A human-readable version of the error. */
|
|
147
|
+
pretty(): string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Input that the SDK rejects before sending (e.g. a missing required argument). */
|
|
151
|
+
declare class SDKValidationError extends Error {
|
|
152
|
+
/** The raw value that failed validation. */
|
|
153
|
+
readonly rawValue: unknown;
|
|
154
|
+
/** The raw message that failed validation. */
|
|
155
|
+
readonly rawMessage: unknown;
|
|
156
|
+
constructor(message: string, cause: unknown, rawValue: unknown);
|
|
157
|
+
/** A human-readable version of the error. */
|
|
158
|
+
pretty(): string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export { ApiError, type ApiErrorData, type ApiErrorDetail, type ApiFieldError, ConnectionError, HTTPClientError, type HTTPMeta, InvalidRequestError, OnflayDefaultError, OnflayError, RequestAbortedError, RequestTimeoutError, ResponseValidationError, SDKValidationError, UnexpectedClientError };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkSUONZUVKjs = require('../../chunk-SUONZUVK.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkV2XJ4GZUjs = require('../../chunk-V2XJ4GZU.js');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
exports.ApiError = _chunkSUONZUVKjs.ApiError; exports.ConnectionError = _chunkV2XJ4GZUjs.ConnectionError; exports.HTTPClientError = _chunkV2XJ4GZUjs.HTTPClientError; exports.InvalidRequestError = _chunkV2XJ4GZUjs.InvalidRequestError; exports.OnflayDefaultError = _chunkSUONZUVKjs.OnflayDefaultError; exports.OnflayError = _chunkSUONZUVKjs.OnflayError; exports.RequestAbortedError = _chunkV2XJ4GZUjs.RequestAbortedError; exports.RequestTimeoutError = _chunkV2XJ4GZUjs.RequestTimeoutError; exports.ResponseValidationError = _chunkSUONZUVKjs.ResponseValidationError; exports.SDKValidationError = _chunkSUONZUVKjs.SDKValidationError; exports.UnexpectedClientError = _chunkV2XJ4GZUjs.UnexpectedClientError;
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/onflay/onflay/sdks/node/dist/models/errors/index.js"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,0DAAgC;AAChC;AACE;AACA;AACA;AACA;AACA;AACA;AACF,0DAAgC;AAChC;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6rBAAC","file":"/home/runner/work/onflay/onflay/sdks/node/dist/models/errors/index.js"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ApiError,
|
|
3
|
+
OnflayDefaultError,
|
|
4
|
+
OnflayError,
|
|
5
|
+
ResponseValidationError,
|
|
6
|
+
SDKValidationError
|
|
7
|
+
} from "../../chunk-EOHFYWFQ.mjs";
|
|
8
|
+
import {
|
|
9
|
+
ConnectionError,
|
|
10
|
+
HTTPClientError,
|
|
11
|
+
InvalidRequestError,
|
|
12
|
+
RequestAbortedError,
|
|
13
|
+
RequestTimeoutError,
|
|
14
|
+
UnexpectedClientError
|
|
15
|
+
} from "../../chunk-DBE2YZWE.mjs";
|
|
16
|
+
export {
|
|
17
|
+
ApiError,
|
|
18
|
+
ConnectionError,
|
|
19
|
+
HTTPClientError,
|
|
20
|
+
InvalidRequestError,
|
|
21
|
+
OnflayDefaultError,
|
|
22
|
+
OnflayError,
|
|
23
|
+
RequestAbortedError,
|
|
24
|
+
RequestTimeoutError,
|
|
25
|
+
ResponseValidationError,
|
|
26
|
+
SDKValidationError,
|
|
27
|
+
UnexpectedClientError
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|