@baukit/api-runtime 0.18.3 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/errors.d.ts +49 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +112 -0
- package/dist/errors.js.map +1 -0
- package/dist/fetch.d.ts +13 -0
- package/dist/fetch.d.ts.map +1 -0
- package/dist/fetch.js +224 -0
- package/dist/fetch.js.map +1 -0
- package/dist/headers.d.ts +5 -0
- package/dist/headers.d.ts.map +1 -0
- package/dist/headers.js +5 -0
- package/dist/headers.js.map +1 -0
- package/dist/index.d.ts +3 -52
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -400
- package/dist/index.js.map +1 -1
- package/dist/retry.d.ts +18 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +108 -0
- package/dist/retry.js.map +1 -0
- package/package.json +3 -2
- package/src/errors.ts +153 -0
- package/src/fetch.ts +325 -0
- package/src/headers.ts +5 -0
- package/src/index.ts +17 -515
- package/src/retry.ts +154 -0
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** JSON values accepted in Baukit error details. */
|
|
2
|
+
export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
3
|
+
readonly [key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
/** A validated Baukit error envelope. */
|
|
6
|
+
export interface ApiErrorEnvelope<Code extends string = string> {
|
|
7
|
+
readonly error: {
|
|
8
|
+
readonly code: Code;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
readonly requestId: string;
|
|
11
|
+
readonly details: Readonly<Record<string, JsonValue>>;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** A non-success response using Baukit's standard JSON error envelope. */
|
|
15
|
+
export declare class ApiError<Code extends string = string> extends Error {
|
|
16
|
+
readonly kind: "api";
|
|
17
|
+
readonly code: Code;
|
|
18
|
+
readonly requestId: string;
|
|
19
|
+
readonly details: Readonly<Record<string, JsonValue>>;
|
|
20
|
+
readonly status: number;
|
|
21
|
+
constructor(envelope: ApiErrorEnvelope<Code>, status: number);
|
|
22
|
+
}
|
|
23
|
+
/** A transport failure where no HTTP response was available (including CORS failures). */
|
|
24
|
+
export declare class NetworkError extends Error {
|
|
25
|
+
readonly kind: "network";
|
|
26
|
+
readonly requestId: string;
|
|
27
|
+
readonly aborted: boolean;
|
|
28
|
+
constructor(message: string, requestId: string, cause: unknown, aborted?: boolean);
|
|
29
|
+
}
|
|
30
|
+
/** A non-success HTTP response that did not contain a valid Baukit error envelope. */
|
|
31
|
+
export declare class HttpError extends Error {
|
|
32
|
+
readonly kind: "http";
|
|
33
|
+
readonly status: number;
|
|
34
|
+
readonly requestId: string | null;
|
|
35
|
+
readonly body: unknown;
|
|
36
|
+
constructor(response: Response, body: unknown);
|
|
37
|
+
}
|
|
38
|
+
/** Narrows an unknown value to an ApiError, optionally with one specific code. */
|
|
39
|
+
export declare function isApiError(value: unknown): value is ApiError;
|
|
40
|
+
export declare function isApiError<Code extends string>(value: unknown, code: Code): value is ApiError<Code>;
|
|
41
|
+
/** Narrows an unknown value to a NetworkError. */
|
|
42
|
+
export declare function isNetworkError(value: unknown): value is NetworkError;
|
|
43
|
+
/** Narrows an unknown value to an HttpError. */
|
|
44
|
+
export declare function isHttpError(value: unknown): value is HttpError;
|
|
45
|
+
/** Parses the exact Baukit error envelope shape, returning null for any other value. */
|
|
46
|
+
export declare function parseApiErrorEnvelope(value: unknown, status: number): ApiError | null;
|
|
47
|
+
/** Converts a non-success HTTP response into an ApiError or HttpError. */
|
|
48
|
+
export declare function normalizeResponseError(response: Response): Promise<ApiError | HttpError>;
|
|
49
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAIA,oDAAoD;AACpD,MAAM,MAAM,SAAS,GAC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AAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAU;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;CAQ9C;AAED,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC;AAC9D,wBAAgB,UAAU,CAAC,IAAI,SAAS,MAAM,EAC5C,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,IAAI,GACT,KAAK,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;AAK3B,kDAAkD;AAClD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED,gDAAgD;AAChD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAED,wFAAwF;AACxF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CA0BrF;AAED,0EAA0E;AAC1E,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAgB9F"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { isRecord } from '@baukit/type-guards';
|
|
2
|
+
import { REQUEST_ID_HEADER } from './headers.js';
|
|
3
|
+
/** A non-success response using Baukit's standard JSON error envelope. */
|
|
4
|
+
export class ApiError extends Error {
|
|
5
|
+
kind = 'api';
|
|
6
|
+
code;
|
|
7
|
+
requestId;
|
|
8
|
+
details;
|
|
9
|
+
status;
|
|
10
|
+
constructor(envelope, status) {
|
|
11
|
+
super(envelope.error.message);
|
|
12
|
+
this.name = 'ApiError';
|
|
13
|
+
this.code = envelope.error.code;
|
|
14
|
+
this.requestId = envelope.error.requestId;
|
|
15
|
+
this.details = envelope.error.details;
|
|
16
|
+
this.status = status;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** A transport failure where no HTTP response was available (including CORS failures). */
|
|
20
|
+
export class NetworkError extends Error {
|
|
21
|
+
kind = 'network';
|
|
22
|
+
requestId;
|
|
23
|
+
aborted;
|
|
24
|
+
constructor(message, requestId, cause, aborted = false) {
|
|
25
|
+
super(message, { cause });
|
|
26
|
+
this.name = 'NetworkError';
|
|
27
|
+
this.requestId = requestId;
|
|
28
|
+
this.aborted = aborted;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** A non-success HTTP response that did not contain a valid Baukit error envelope. */
|
|
32
|
+
export class HttpError extends Error {
|
|
33
|
+
kind = 'http';
|
|
34
|
+
status;
|
|
35
|
+
requestId;
|
|
36
|
+
body;
|
|
37
|
+
constructor(response, body) {
|
|
38
|
+
const suffix = response.statusText === '' ? '' : ` ${response.statusText}`;
|
|
39
|
+
super(`HTTP ${String(response.status)}${suffix}`);
|
|
40
|
+
this.name = 'HttpError';
|
|
41
|
+
this.status = response.status;
|
|
42
|
+
this.requestId = response.headers.get(REQUEST_ID_HEADER);
|
|
43
|
+
this.body = body;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function isApiError(value, code) {
|
|
47
|
+
return value instanceof ApiError && (code === undefined || value.code === code);
|
|
48
|
+
}
|
|
49
|
+
/** Narrows an unknown value to a NetworkError. */
|
|
50
|
+
export function isNetworkError(value) {
|
|
51
|
+
return value instanceof NetworkError;
|
|
52
|
+
}
|
|
53
|
+
/** Narrows an unknown value to an HttpError. */
|
|
54
|
+
export function isHttpError(value) {
|
|
55
|
+
return value instanceof HttpError;
|
|
56
|
+
}
|
|
57
|
+
/** Parses the exact Baukit error envelope shape, returning null for any other value. */
|
|
58
|
+
export function parseApiErrorEnvelope(value, status) {
|
|
59
|
+
if (!isRecord(value) || !isRecord(value['error'])) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const error = value['error'];
|
|
63
|
+
if (typeof error['code'] !== 'string' ||
|
|
64
|
+
typeof error['message'] !== 'string' ||
|
|
65
|
+
typeof error['requestId'] !== 'string' ||
|
|
66
|
+
!isJsonObject(error['details'])) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return new ApiError({
|
|
70
|
+
error: {
|
|
71
|
+
code: error['code'],
|
|
72
|
+
message: error['message'],
|
|
73
|
+
requestId: error['requestId'],
|
|
74
|
+
details: error['details'],
|
|
75
|
+
},
|
|
76
|
+
}, status);
|
|
77
|
+
}
|
|
78
|
+
/** Converts a non-success HTTP response into an ApiError or HttpError. */
|
|
79
|
+
export async function normalizeResponseError(response) {
|
|
80
|
+
let body;
|
|
81
|
+
try {
|
|
82
|
+
const text = await response.clone().text();
|
|
83
|
+
if (text !== '') {
|
|
84
|
+
try {
|
|
85
|
+
body = JSON.parse(text);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
body = text;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
body = undefined;
|
|
94
|
+
}
|
|
95
|
+
return parseApiErrorEnvelope(body, response.status) ?? new HttpError(response, body);
|
|
96
|
+
}
|
|
97
|
+
function isJsonObject(value) {
|
|
98
|
+
return isRecord(value) && Object.values(value).every(isJsonValue);
|
|
99
|
+
}
|
|
100
|
+
function isJsonValue(value) {
|
|
101
|
+
if (value === null ||
|
|
102
|
+
typeof value === 'string' ||
|
|
103
|
+
typeof value === 'boolean' ||
|
|
104
|
+
(typeof value === 'number' && Number.isFinite(value))) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
if (Array.isArray(value)) {
|
|
108
|
+
return value.every(isJsonValue);
|
|
109
|
+
}
|
|
110
|
+
return isJsonObject(value);
|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AAK,CAAC,WAAW,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EACrD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
package/dist/fetch.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ApiRuntimeOptions, FetchImplementation } from './index.js';
|
|
2
|
+
import { type NormalizedRetryOptions } from './retry.js';
|
|
3
|
+
export interface FetchSettings {
|
|
4
|
+
readonly baseUrl: string;
|
|
5
|
+
readonly requestConstructor: typeof Request;
|
|
6
|
+
readonly transport: FetchImplementation;
|
|
7
|
+
readonly requestIdFactory: () => string;
|
|
8
|
+
readonly retry: NormalizedRetryOptions;
|
|
9
|
+
readonly options: ApiRuntimeOptions;
|
|
10
|
+
}
|
|
11
|
+
export declare function fetchSettings(options: ApiRuntimeOptions, baseUrl: string): FetchSettings;
|
|
12
|
+
export declare function runFetch(settings: FetchSettings, input: RequestInfo | URL, init: RequestInit | undefined): Promise<Response>;
|
|
13
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EAIpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAQL,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAMpB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,kBAAkB,EAAE,OAAO,OAAO,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,MAAM,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;CACrC;AAcD,wBAAgB,aAAa,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CASxF;AAED,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,IAAI,EAAE,WAAW,GAAG,SAAS,GAC5B,OAAO,CAAC,QAAQ,CAAC,CAiBnB"}
|
package/dist/fetch.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { ApiError, HttpError, isApiError, NetworkError, normalizeResponseError } from './errors.js';
|
|
2
|
+
import { REQUEST_ID_HEADER } from './headers.js';
|
|
3
|
+
import { isAbortError, networkError, normalizeRetryOptions, retryDelay, shouldRetryMethod, shouldRetryResponse, throwIfAborted, } from './retry.js';
|
|
4
|
+
const UNAUTHORIZED_STATUS = 401;
|
|
5
|
+
const RETRY = Symbol('retry');
|
|
6
|
+
export function fetchSettings(options, baseUrl) {
|
|
7
|
+
return {
|
|
8
|
+
baseUrl,
|
|
9
|
+
requestConstructor: options.requestConstructor ?? globalThis.Request,
|
|
10
|
+
transport: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
11
|
+
requestIdFactory: options.requestIdFactory ?? createUuid,
|
|
12
|
+
retry: normalizeRetryOptions(options.retry),
|
|
13
|
+
options,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export async function runFetch(settings, input, init) {
|
|
17
|
+
const context = { ...settings, requestId: settings.requestIdFactory() };
|
|
18
|
+
const request = await prepareRequest(context, input, init);
|
|
19
|
+
const state = {
|
|
20
|
+
request,
|
|
21
|
+
replaySource: cloneRequest(request),
|
|
22
|
+
useOriginalRequest: true,
|
|
23
|
+
retries: 0,
|
|
24
|
+
unauthorizedReplayUsed: false,
|
|
25
|
+
};
|
|
26
|
+
for (;;) {
|
|
27
|
+
throwIfAborted(state.request.signal, context.requestId);
|
|
28
|
+
const outcome = await runAttempt(context, state);
|
|
29
|
+
if (outcome !== RETRY) {
|
|
30
|
+
return outcome;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function prepareRequest(context, input, init) {
|
|
35
|
+
try {
|
|
36
|
+
const request = createRequest(input, init, context.baseUrl, context.requestConstructor);
|
|
37
|
+
return await decorateRequest(context, request);
|
|
38
|
+
}
|
|
39
|
+
catch (cause) {
|
|
40
|
+
if (cause instanceof NetworkError) {
|
|
41
|
+
throw cause;
|
|
42
|
+
}
|
|
43
|
+
throw networkError(cause, context.requestId, init?.signal ?? null);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function runAttempt(context, state) {
|
|
47
|
+
try {
|
|
48
|
+
const response = await sendAttempt(context, state);
|
|
49
|
+
return await handleResponse(context, state, response);
|
|
50
|
+
}
|
|
51
|
+
catch (cause) {
|
|
52
|
+
return handleFailure(context, state, cause);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function sendAttempt(context, state) {
|
|
56
|
+
const attempt = state.useOriginalRequest ? state.request : state.replaySource?.clone();
|
|
57
|
+
if (attempt === undefined) {
|
|
58
|
+
throw new TypeError('API request body cannot be replayed');
|
|
59
|
+
}
|
|
60
|
+
state.useOriginalRequest = false;
|
|
61
|
+
const response = await context.transport(attempt);
|
|
62
|
+
throwIfAborted(state.request.signal, context.requestId);
|
|
63
|
+
return response;
|
|
64
|
+
}
|
|
65
|
+
async function handleResponse(context, state, response) {
|
|
66
|
+
if (state.replaySource !== undefined &&
|
|
67
|
+
shouldRetryResponse(state.request, response.status, state.retries, context.retry)) {
|
|
68
|
+
await backOff(context, state);
|
|
69
|
+
return RETRY;
|
|
70
|
+
}
|
|
71
|
+
if (response.ok) {
|
|
72
|
+
return response;
|
|
73
|
+
}
|
|
74
|
+
const error = await normalizeResponseError(response);
|
|
75
|
+
if (response.status !== UNAUTHORIZED_STATUS) {
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
return handleUnauthorized(context, state, { response, error });
|
|
79
|
+
}
|
|
80
|
+
async function handleUnauthorized(context, state, failure) {
|
|
81
|
+
const { options, requestId } = context;
|
|
82
|
+
const { error } = failure;
|
|
83
|
+
const unauthorizedContext = (canRetry) => ({
|
|
84
|
+
...failure,
|
|
85
|
+
request: state.replaySource?.clone() ?? state.request,
|
|
86
|
+
canRetry,
|
|
87
|
+
});
|
|
88
|
+
if (isApiError(error, 'profile_erased')) {
|
|
89
|
+
await notifyObserver(() => options.onProfileErased?.(unauthorizedContext(false)));
|
|
90
|
+
throwIfAborted(state.request.signal, requestId);
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
if (state.unauthorizedReplayUsed) {
|
|
94
|
+
if (options.onUnauthorizedExhausted !== undefined) {
|
|
95
|
+
const onExhausted = options.onUnauthorizedExhausted;
|
|
96
|
+
await notifyObserver(() => onExhausted(unauthorizedContext(false)));
|
|
97
|
+
throwIfAborted(state.request.signal, requestId);
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
if (options.onUnauthorized === undefined) {
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
const recovery = await askForRecovery(options.onUnauthorized, unauthorizedContext(state.replaySource !== undefined));
|
|
105
|
+
throwIfAborted(state.request.signal, requestId);
|
|
106
|
+
if (recovery !== 'retry-once' || state.replaySource === undefined) {
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
await replayWithFreshCredentials(context, state, state.replaySource, error);
|
|
110
|
+
return RETRY;
|
|
111
|
+
}
|
|
112
|
+
/** Observer failures must not replace the normalized API failure. */
|
|
113
|
+
async function notifyObserver(notify) {
|
|
114
|
+
try {
|
|
115
|
+
await notify();
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
// The caller rethrows the original normalized error.
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function askForRecovery(onUnauthorized, context) {
|
|
122
|
+
try {
|
|
123
|
+
const recovery = await onUnauthorized(context);
|
|
124
|
+
return recovery === 'retry-once' || recovery === 'handled' ? recovery : undefined;
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
async function replayWithFreshCredentials(context, state, replaySource, error) {
|
|
131
|
+
state.unauthorizedReplayUsed = true;
|
|
132
|
+
try {
|
|
133
|
+
state.request = await decorateRequest(context, replaySource.clone());
|
|
134
|
+
}
|
|
135
|
+
catch (cause) {
|
|
136
|
+
throwIfAborted(state.request.signal, context.requestId);
|
|
137
|
+
if (cause instanceof NetworkError) {
|
|
138
|
+
throw cause;
|
|
139
|
+
}
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
state.replaySource = cloneRequest(state.request);
|
|
143
|
+
if (state.replaySource === undefined) {
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
state.useOriginalRequest = true;
|
|
147
|
+
state.retries = 0;
|
|
148
|
+
}
|
|
149
|
+
async function handleFailure(context, state, cause) {
|
|
150
|
+
if (cause instanceof ApiError || cause instanceof HttpError) {
|
|
151
|
+
throw cause;
|
|
152
|
+
}
|
|
153
|
+
const aborted = state.request.signal.aborted || isAbortError(cause);
|
|
154
|
+
if (!aborted &&
|
|
155
|
+
state.replaySource !== undefined &&
|
|
156
|
+
shouldRetryMethod(state.request, context.retry) &&
|
|
157
|
+
state.retries < context.retry.maxRetries) {
|
|
158
|
+
await backOff(context, state);
|
|
159
|
+
return RETRY;
|
|
160
|
+
}
|
|
161
|
+
throw new NetworkError(aborted ? 'API request was aborted' : 'API network request failed', context.requestId, cause, aborted);
|
|
162
|
+
}
|
|
163
|
+
async function backOff(context, state) {
|
|
164
|
+
await retryDelay(state.retries, context.retry, state.request.signal, context.requestId);
|
|
165
|
+
state.retries += 1;
|
|
166
|
+
}
|
|
167
|
+
async function decorateRequest(context, request) {
|
|
168
|
+
const { options, requestId } = context;
|
|
169
|
+
throwIfAborted(request.signal, requestId);
|
|
170
|
+
const headers = new Headers(request.headers);
|
|
171
|
+
headers.set(REQUEST_ID_HEADER, requestId);
|
|
172
|
+
if (options.tokenProvider !== undefined) {
|
|
173
|
+
const token = await options.tokenProvider();
|
|
174
|
+
throwIfAborted(request.signal, requestId);
|
|
175
|
+
headers.delete('authorization');
|
|
176
|
+
if (token !== null) {
|
|
177
|
+
headers.set('authorization', `Bearer ${token}`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (options.traceparentProvider !== undefined) {
|
|
181
|
+
const traceparent = await options.traceparentProvider(request);
|
|
182
|
+
throwIfAborted(request.signal, requestId);
|
|
183
|
+
if (traceparent !== null) {
|
|
184
|
+
headers.set('traceparent', traceparent);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return new context.requestConstructor(request, { headers });
|
|
188
|
+
}
|
|
189
|
+
function cloneRequest(request) {
|
|
190
|
+
try {
|
|
191
|
+
return request.clone();
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function createRequest(input, init, baseUrl, requestConstructor) {
|
|
198
|
+
if (typeof input === 'string' || input instanceof URL) {
|
|
199
|
+
return new requestConstructor(new URL(input.toString(), `${baseUrl}/`), init);
|
|
200
|
+
}
|
|
201
|
+
return new requestConstructor(input, init);
|
|
202
|
+
}
|
|
203
|
+
function createUuid() {
|
|
204
|
+
// Runtime probe: React Native and older runtimes may lack `crypto` despite the DOM lib typing.
|
|
205
|
+
const runtime = globalThis;
|
|
206
|
+
const cryptoApi = runtime.crypto;
|
|
207
|
+
if (typeof cryptoApi?.randomUUID === 'function') {
|
|
208
|
+
return cryptoApi.randomUUID();
|
|
209
|
+
}
|
|
210
|
+
const bytes = new Uint8Array(16);
|
|
211
|
+
if (typeof cryptoApi?.getRandomValues === 'function') {
|
|
212
|
+
cryptoApi.getRandomValues(bytes);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
216
|
+
bytes[index] = Math.floor(Math.random() * 256);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x40;
|
|
220
|
+
bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80;
|
|
221
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
222
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQjD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,GAEf,MAAM,YAAY,CAAC;AAEpB,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAwB9B,MAAM,UAAU,aAAa,CAAC,OAA0B,EAAE,OAAe;IACvE,O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
1
|
+
/** The request ID header accepted and returned by `baukit-http`. */
|
|
2
|
+
export declare const REQUEST_ID_HEADER: "x-request-id";
|
|
3
|
+
/** The request header that carries a mutation's idempotency key. */
|
|
4
|
+
export declare const IDEMPOTENCY_KEY_HEADER: "idempotency-key";
|
|
5
|
+
//# sourceMappingURL=headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../src/headers.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,EAAG,cAAuB,CAAC;AAEzD,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,EAAG,iBAA0B,CAAC"}
|
package/dist/headers.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The request ID header accepted and returned by `baukit-http`. */
|
|
2
|
+
export const REQUEST_ID_HEADER = 'x-request-id';
|
|
3
|
+
/** The request header that carries a mutation's idempotency key. */
|
|
4
|
+
export const IDEMPOTENCY_KEY_HEADER = 'idempotency-key';
|
|
5
|
+
//# sourceMappingURL=headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../src/headers.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAuB,CAAC;AAEzD,oEAAoE;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,iBAA0B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Client, ClientOptions } from 'openapi-fetch';
|
|
2
|
+
import type { ApiError, HttpError } from './errors.js';
|
|
2
3
|
export { unverifiedDisplayIdentityHintsFromJwt, type UnverifiedDisplayIdentityFallback, type UnverifiedDisplayIdentityHints, } from './unverified-display-identity.js';
|
|
3
4
|
export { unverifiedSignInSessionFromJwt, type SignInOrganization, type SignInSession, type SignInUser, } from './sign-in-session.js';
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
/** The request header that carries a mutation's idempotency key. */
|
|
7
|
-
export declare const IDEMPOTENCY_KEY_HEADER: "idempotency-key";
|
|
5
|
+
export { IDEMPOTENCY_KEY_HEADER, REQUEST_ID_HEADER } from './headers.js';
|
|
6
|
+
export { ApiError, HttpError, isApiError, isHttpError, isNetworkError, NetworkError, normalizeResponseError, parseApiErrorEnvelope, type ApiErrorEnvelope, type JsonValue, } from './errors.js';
|
|
8
7
|
/** An explicitly selected API environment. */
|
|
9
8
|
export interface ApiEnvironmentConfig {
|
|
10
9
|
readonly baseUrl: string;
|
|
@@ -73,54 +72,6 @@ export interface ApiRuntimeOptions extends ApiEnvironmentConfig {
|
|
|
73
72
|
export interface ApiRuntime extends ApiEnvironmentConfig {
|
|
74
73
|
readonly fetch: FetchImplementation;
|
|
75
74
|
}
|
|
76
|
-
/** JSON values accepted in Baukit error details. */
|
|
77
|
-
export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
78
|
-
readonly [key: string]: JsonValue;
|
|
79
|
-
};
|
|
80
|
-
/** A validated Baukit error envelope. */
|
|
81
|
-
export interface ApiErrorEnvelope<Code extends string = string> {
|
|
82
|
-
readonly error: {
|
|
83
|
-
readonly code: Code;
|
|
84
|
-
readonly message: string;
|
|
85
|
-
readonly requestId: string;
|
|
86
|
-
readonly details: Readonly<Record<string, JsonValue>>;
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
/** A non-success response using Baukit's standard JSON error envelope. */
|
|
90
|
-
export declare class ApiError<Code extends string = string> extends Error {
|
|
91
|
-
readonly kind: "api";
|
|
92
|
-
readonly code: Code;
|
|
93
|
-
readonly requestId: string;
|
|
94
|
-
readonly details: Readonly<Record<string, JsonValue>>;
|
|
95
|
-
readonly status: number;
|
|
96
|
-
constructor(envelope: ApiErrorEnvelope<Code>, status: number);
|
|
97
|
-
}
|
|
98
|
-
/** A transport failure where no HTTP response was available (including CORS failures). */
|
|
99
|
-
export declare class NetworkError extends Error {
|
|
100
|
-
readonly kind: "network";
|
|
101
|
-
readonly requestId: string;
|
|
102
|
-
readonly aborted: boolean;
|
|
103
|
-
constructor(message: string, requestId: string, cause: unknown, aborted?: boolean);
|
|
104
|
-
}
|
|
105
|
-
/** A non-success HTTP response that did not contain a valid Baukit error envelope. */
|
|
106
|
-
export declare class HttpError extends Error {
|
|
107
|
-
readonly kind: "http";
|
|
108
|
-
readonly status: number;
|
|
109
|
-
readonly requestId: string | null;
|
|
110
|
-
readonly body: unknown;
|
|
111
|
-
constructor(response: Response, body: unknown);
|
|
112
|
-
}
|
|
113
|
-
/** Narrows an unknown value to an ApiError, optionally with one specific code. */
|
|
114
|
-
export declare function isApiError(value: unknown): value is ApiError;
|
|
115
|
-
export declare function isApiError<Code extends string>(value: unknown, code: Code): value is ApiError<Code>;
|
|
116
|
-
/** Narrows an unknown value to a NetworkError. */
|
|
117
|
-
export declare function isNetworkError(value: unknown): value is NetworkError;
|
|
118
|
-
/** Narrows an unknown value to an HttpError. */
|
|
119
|
-
export declare function isHttpError(value: unknown): value is HttpError;
|
|
120
|
-
/** Parses the exact Baukit error envelope shape, returning null for any other value. */
|
|
121
|
-
export declare function parseApiErrorEnvelope(value: unknown, status: number): ApiError | null;
|
|
122
|
-
/** Converts a non-success HTTP response into an ApiError or HttpError. */
|
|
123
|
-
export declare function normalizeResponseError(response: Response): Promise<ApiError | HttpError>;
|
|
124
75
|
/** Creates the fetch runtime used by standalone callers and generated clients. */
|
|
125
76
|
export declare function createApiRuntime(options: ApiRuntimeOptions): ApiRuntime;
|
|
126
77
|
/** Creates an `openapi-fetch` client backed by the Baukit runtime. */
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","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