@indra211/exios 2.0.1 → 3.1.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 +182 -0
- package/dist/index.cjs +640 -16
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +216 -10
- package/dist/index.js +641 -16
- package/dist/index.node.cjs +640 -16
- package/dist/index.node.js +641 -16
- package/package.json +8 -3
package/dist/index.node.js
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
// src/core/redact.ts
|
|
2
|
+
var REDACTED = "[REDACTED]";
|
|
3
|
+
var SENSITIVE_HEADERS = /* @__PURE__ */ new Set([
|
|
4
|
+
"authorization",
|
|
5
|
+
"proxy-authorization",
|
|
6
|
+
"cookie",
|
|
7
|
+
"set-cookie",
|
|
8
|
+
"x-api-key",
|
|
9
|
+
"x-auth-token",
|
|
10
|
+
"x-xsrf-token",
|
|
11
|
+
"x-csrf-token"
|
|
12
|
+
]);
|
|
13
|
+
function redactHeaders(headers) {
|
|
14
|
+
if (!headers || typeof headers !== "object") return headers;
|
|
15
|
+
const out = {};
|
|
16
|
+
for (const [k, v] of Object.entries(headers))
|
|
17
|
+
out[k] = SENSITIVE_HEADERS.has(k.toLowerCase()) ? REDACTED : v;
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
20
|
+
function redactConfig(config) {
|
|
21
|
+
if (!config || typeof config !== "object") return config;
|
|
22
|
+
const c = { ...config };
|
|
23
|
+
if (c.headers && typeof c.headers === "object") c.headers = redactHeaders(c.headers);
|
|
24
|
+
if (c.auth) c.auth = { username: c.auth.username, password: REDACTED };
|
|
25
|
+
if (c.proxy && typeof c.proxy === "object" && c.proxy.auth)
|
|
26
|
+
c.proxy = { ...c.proxy, auth: { username: c.proxy.auth.username, password: REDACTED } };
|
|
27
|
+
if (c.data !== void 0) c.data = REDACTED;
|
|
28
|
+
return c;
|
|
29
|
+
}
|
|
30
|
+
|
|
1
31
|
// src/errors/ExiosError.ts
|
|
2
32
|
var ExiosError = class _ExiosError extends Error {
|
|
3
33
|
static ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
|
@@ -27,13 +57,14 @@ var ExiosError = class _ExiosError extends Error {
|
|
|
27
57
|
this.response = response;
|
|
28
58
|
this.status = response?.status;
|
|
29
59
|
}
|
|
60
|
+
/** Log-safe: credentials, sensitive headers (Authorization, Cookie, API keys) and the body are redacted. */
|
|
30
61
|
toJSON() {
|
|
31
62
|
return {
|
|
32
63
|
message: this.message,
|
|
33
64
|
name: this.name,
|
|
34
65
|
code: this.code,
|
|
35
66
|
status: this.status,
|
|
36
|
-
config: this.config,
|
|
67
|
+
config: redactConfig(this.config),
|
|
37
68
|
meta: this.meta,
|
|
38
69
|
stack: this.stack
|
|
39
70
|
};
|
|
@@ -133,8 +164,8 @@ function serializeParams(params, opts2 = {}) {
|
|
|
133
164
|
return parts.join("&");
|
|
134
165
|
}
|
|
135
166
|
function buildURL(url, params, serializer) {
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
167
|
+
const hash2 = url.indexOf("#");
|
|
168
|
+
if (hash2 !== -1) url = url.slice(0, hash2);
|
|
138
169
|
if (params === void 0 || params === null) return url;
|
|
139
170
|
let serialized;
|
|
140
171
|
if (typeof serializer === "function") serialized = serializer(params);
|
|
@@ -1707,14 +1738,16 @@ function defaultIsFailure(o) {
|
|
|
1707
1738
|
return status >= 500 || status === 408 || status === 429;
|
|
1708
1739
|
}
|
|
1709
1740
|
var CircuitBreaker = class {
|
|
1710
|
-
constructor(key, cfg, now = Date.now) {
|
|
1741
|
+
constructor(key, cfg, now = Date.now, onTransition) {
|
|
1711
1742
|
this.key = key;
|
|
1712
1743
|
this.cfg = cfg;
|
|
1713
1744
|
this.now = now;
|
|
1745
|
+
this.onTransition = onTransition;
|
|
1714
1746
|
}
|
|
1715
1747
|
key;
|
|
1716
1748
|
cfg;
|
|
1717
1749
|
now;
|
|
1750
|
+
onTransition;
|
|
1718
1751
|
_state = "closed";
|
|
1719
1752
|
epoch = 0;
|
|
1720
1753
|
openedAt = 0;
|
|
@@ -1818,22 +1851,25 @@ var CircuitBreaker = class {
|
|
|
1818
1851
|
this.cfg.onStateChange?.(this.key, from, to);
|
|
1819
1852
|
} catch {
|
|
1820
1853
|
}
|
|
1854
|
+
this.onTransition?.(this.key, from, to);
|
|
1821
1855
|
}
|
|
1822
1856
|
};
|
|
1823
1857
|
var BreakerRegistry = class {
|
|
1824
|
-
constructor(getConfig, now = Date.now) {
|
|
1858
|
+
constructor(getConfig, now = Date.now, onTransition) {
|
|
1825
1859
|
this.getConfig = getConfig;
|
|
1826
1860
|
this.now = now;
|
|
1861
|
+
this.onTransition = onTransition;
|
|
1827
1862
|
}
|
|
1828
1863
|
getConfig;
|
|
1829
1864
|
now;
|
|
1865
|
+
onTransition;
|
|
1830
1866
|
breakers = /* @__PURE__ */ new Map();
|
|
1831
1867
|
get(key) {
|
|
1832
1868
|
const cfg = this.getConfig();
|
|
1833
1869
|
if (cfg === false) return null;
|
|
1834
1870
|
let b = this.breakers.get(key);
|
|
1835
1871
|
if (!b) {
|
|
1836
|
-
b = new CircuitBreaker(key, cfg, this.now);
|
|
1872
|
+
b = new CircuitBreaker(key, cfg, this.now, this.onTransition);
|
|
1837
1873
|
this.breakers.set(key, b);
|
|
1838
1874
|
}
|
|
1839
1875
|
return b;
|
|
@@ -1938,6 +1974,7 @@ async function runWithRetry(attempt, cfg, config, hooks) {
|
|
|
1938
1974
|
cancelBody(outcome.response?.data);
|
|
1939
1975
|
if (hooks.signal?.aborted) throw abortError(hooks.signal);
|
|
1940
1976
|
cfg.onRetry?.({ ...outcome, attempt: attempts, delayMs: delay });
|
|
1977
|
+
hooks.onRetry?.({ ...outcome, attempt: attempts, delayMs: delay });
|
|
1941
1978
|
await sleep(delay, hooks.signal);
|
|
1942
1979
|
hooks.beforeRetry?.();
|
|
1943
1980
|
}
|
|
@@ -1959,7 +1996,7 @@ function defaultBreakerKey(config) {
|
|
|
1959
1996
|
return full;
|
|
1960
1997
|
}
|
|
1961
1998
|
}
|
|
1962
|
-
async function dispatchRequest(config, registry2) {
|
|
1999
|
+
async function dispatchRequest(config, registry2, observer) {
|
|
1963
2000
|
const token = config.cancelToken;
|
|
1964
2001
|
if (token) {
|
|
1965
2002
|
if (token.reason) {
|
|
@@ -1976,7 +2013,8 @@ async function dispatchRequest(config, registry2) {
|
|
|
1976
2013
|
try {
|
|
1977
2014
|
const response = await dispatchRequest(
|
|
1978
2015
|
{ ...config, signal: joined.signal, cancelToken: void 0 },
|
|
1979
|
-
registry2
|
|
2016
|
+
registry2,
|
|
2017
|
+
observer
|
|
1980
2018
|
);
|
|
1981
2019
|
if (isOneShotBody(response.data)) {
|
|
1982
2020
|
response.data = whenBodyDone(response.data, release);
|
|
@@ -1995,6 +2033,7 @@ async function dispatchRequest(config, registry2) {
|
|
|
1995
2033
|
const breaker = bcfg === false ? null : registry2.get(bcfg.key ? bcfg.key(config) : defaultBreakerKey(config));
|
|
1996
2034
|
const ticket = breaker?.acquire(config);
|
|
1997
2035
|
let attempts = 0;
|
|
2036
|
+
let responseTimeMs;
|
|
1998
2037
|
try {
|
|
1999
2038
|
let adapter;
|
|
2000
2039
|
try {
|
|
@@ -2007,15 +2046,31 @@ async function dispatchRequest(config, registry2) {
|
|
|
2007
2046
|
try {
|
|
2008
2047
|
result = await runWithRetry(
|
|
2009
2048
|
() => {
|
|
2010
|
-
attempts
|
|
2011
|
-
|
|
2049
|
+
const n = ++attempts;
|
|
2050
|
+
const t0 = Date.now();
|
|
2051
|
+
const failed = (e) => {
|
|
2052
|
+
responseTimeMs = Date.now() - t0;
|
|
2053
|
+
if (isExiosError(e)) observer?.onAttemptError?.(n, e);
|
|
2054
|
+
throw e;
|
|
2055
|
+
};
|
|
2056
|
+
let result2;
|
|
2057
|
+
try {
|
|
2058
|
+
result2 = Promise.resolve(adapter(config));
|
|
2059
|
+
} catch (e) {
|
|
2060
|
+
return failed(e);
|
|
2061
|
+
}
|
|
2062
|
+
return result2.then((r) => {
|
|
2063
|
+
responseTimeMs = Date.now() - t0;
|
|
2064
|
+
return r;
|
|
2065
|
+
}, failed);
|
|
2012
2066
|
},
|
|
2013
2067
|
ticket?.probe ? false : config.retry,
|
|
2014
2068
|
// half-open probes get exactly one attempt
|
|
2015
2069
|
config,
|
|
2016
2070
|
{
|
|
2017
2071
|
signal: config.signal,
|
|
2018
|
-
beforeRetry: breaker && ticket ? () => breaker.check(ticket) : void 0
|
|
2072
|
+
beforeRetry: breaker && ticket ? () => breaker.check(ticket) : void 0,
|
|
2073
|
+
onRetry: observer?.onRetry
|
|
2019
2074
|
}
|
|
2020
2075
|
);
|
|
2021
2076
|
} catch (e) {
|
|
@@ -2034,6 +2089,7 @@ async function dispatchRequest(config, registry2) {
|
|
|
2034
2089
|
if (outcome.error) throw outcome.error;
|
|
2035
2090
|
const response = outcome.response;
|
|
2036
2091
|
response.meta.attempts = attempts;
|
|
2092
|
+
if (responseTimeMs !== void 0) response.meta.responseTimeMs = responseTimeMs;
|
|
2037
2093
|
const { status } = response;
|
|
2038
2094
|
if (config.validateStatus && !config.validateStatus(status)) {
|
|
2039
2095
|
const err = new ExiosError(
|
|
@@ -2052,6 +2108,53 @@ async function dispatchRequest(config, registry2) {
|
|
|
2052
2108
|
}
|
|
2053
2109
|
}
|
|
2054
2110
|
|
|
2111
|
+
// src/core/events.ts
|
|
2112
|
+
var EventHub = class {
|
|
2113
|
+
listeners = /* @__PURE__ */ new Map();
|
|
2114
|
+
on(name, listener) {
|
|
2115
|
+
if (typeof listener !== "function")
|
|
2116
|
+
throw new TypeError(`exios: listener for "${name}" must be a function`);
|
|
2117
|
+
let set = this.listeners.get(name);
|
|
2118
|
+
if (!set) this.listeners.set(name, set = /* @__PURE__ */ new Set());
|
|
2119
|
+
set.add(listener);
|
|
2120
|
+
return () => this.off(name, listener);
|
|
2121
|
+
}
|
|
2122
|
+
once(name, listener) {
|
|
2123
|
+
const off = this.on(name, (e) => {
|
|
2124
|
+
off();
|
|
2125
|
+
listener(e);
|
|
2126
|
+
});
|
|
2127
|
+
return off;
|
|
2128
|
+
}
|
|
2129
|
+
off(name, listener) {
|
|
2130
|
+
const set = this.listeners.get(name);
|
|
2131
|
+
if (!set) return;
|
|
2132
|
+
if (listener === void 0) set.clear();
|
|
2133
|
+
else set.delete(listener);
|
|
2134
|
+
if (set.size === 0) this.listeners.delete(name);
|
|
2135
|
+
}
|
|
2136
|
+
has(name) {
|
|
2137
|
+
return this.listeners.has(name);
|
|
2138
|
+
}
|
|
2139
|
+
listenerCount(name) {
|
|
2140
|
+
return this.listeners.get(name)?.size ?? 0;
|
|
2141
|
+
}
|
|
2142
|
+
/** Build the payload only when someone listens: `emit('x', () => ({ ... }))`. */
|
|
2143
|
+
emit(name, payload) {
|
|
2144
|
+
const set = this.listeners.get(name);
|
|
2145
|
+
if (!set) return;
|
|
2146
|
+
const event = payload();
|
|
2147
|
+
for (const l of [...set]) {
|
|
2148
|
+
try {
|
|
2149
|
+
l(event);
|
|
2150
|
+
} catch (err) {
|
|
2151
|
+
if (typeof console !== "undefined")
|
|
2152
|
+
console.error(`[exios] "${name}" listener threw:`, err);
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
};
|
|
2157
|
+
|
|
2055
2158
|
// src/core/InterceptorManager.ts
|
|
2056
2159
|
var InterceptorManager = class {
|
|
2057
2160
|
handlers = [];
|
|
@@ -2182,7 +2285,14 @@ var isPlainObject3 = (v) => {
|
|
|
2182
2285
|
return p === Object.prototype || p === null;
|
|
2183
2286
|
};
|
|
2184
2287
|
var isBucket = (k) => HEADER_BUCKETS.includes(k.toLowerCase());
|
|
2185
|
-
var SHALLOW_MERGE = /* @__PURE__ */ new Set([
|
|
2288
|
+
var SHALLOW_MERGE = /* @__PURE__ */ new Set([
|
|
2289
|
+
"auth",
|
|
2290
|
+
"transitional",
|
|
2291
|
+
"fetchOptions",
|
|
2292
|
+
"metadata",
|
|
2293
|
+
"cache",
|
|
2294
|
+
"dedupe"
|
|
2295
|
+
]);
|
|
2186
2296
|
function setCI(target, k, v) {
|
|
2187
2297
|
const lk = k.toLowerCase();
|
|
2188
2298
|
for (const existing of Object.keys(target)) {
|
|
@@ -2288,7 +2398,231 @@ function assertRequestBreaker(b) {
|
|
|
2288
2398
|
}
|
|
2289
2399
|
}
|
|
2290
2400
|
|
|
2401
|
+
// src/core/dedupe.ts
|
|
2402
|
+
var InflightRequests = class {
|
|
2403
|
+
flights = /* @__PURE__ */ new Map();
|
|
2404
|
+
get size() {
|
|
2405
|
+
return this.flights.size;
|
|
2406
|
+
}
|
|
2407
|
+
/**
|
|
2408
|
+
* Join the flight for `key`, starting it with `start(signal)` when there is none. `start` receives a
|
|
2409
|
+
* signal owned by the flight, never a caller's. Resolves with `leader: true` for the caller that started it.
|
|
2410
|
+
*/
|
|
2411
|
+
join(key, config, start) {
|
|
2412
|
+
const token = config.cancelToken;
|
|
2413
|
+
if (token?.reason) {
|
|
2414
|
+
token.reason.config ??= config;
|
|
2415
|
+
return Promise.reject(token.reason);
|
|
2416
|
+
}
|
|
2417
|
+
const tokenSignal = token?.toAbortSignal();
|
|
2418
|
+
const signals = [config.signal, tokenSignal].filter((s) => !!s);
|
|
2419
|
+
const aborted = signals.find((s) => s.aborted);
|
|
2420
|
+
if (aborted) {
|
|
2421
|
+
tokenSignal?.unsubscribe();
|
|
2422
|
+
return Promise.reject(abortError(aborted, config));
|
|
2423
|
+
}
|
|
2424
|
+
let flight = this.flights.get(key);
|
|
2425
|
+
const leader = !flight;
|
|
2426
|
+
if (!flight) {
|
|
2427
|
+
const controller = new AbortController();
|
|
2428
|
+
const f2 = { controller, subscribers: 0, promise: void 0 };
|
|
2429
|
+
f2.promise = start(controller.signal).finally(() => {
|
|
2430
|
+
if (this.flights.get(key) === f2) this.flights.delete(key);
|
|
2431
|
+
});
|
|
2432
|
+
this.flights.set(key, f2);
|
|
2433
|
+
flight = f2;
|
|
2434
|
+
}
|
|
2435
|
+
const f = flight;
|
|
2436
|
+
f.subscribers++;
|
|
2437
|
+
return new Promise((resolve, reject) => {
|
|
2438
|
+
let settled = false;
|
|
2439
|
+
const detach = () => {
|
|
2440
|
+
settled = true;
|
|
2441
|
+
for (const s of signals) s.removeEventListener("abort", onAbort);
|
|
2442
|
+
tokenSignal?.unsubscribe();
|
|
2443
|
+
};
|
|
2444
|
+
const onAbort = (ev) => {
|
|
2445
|
+
if (settled) return;
|
|
2446
|
+
detach();
|
|
2447
|
+
const reason = abortError(ev.target, config);
|
|
2448
|
+
reject(reason);
|
|
2449
|
+
if (--f.subscribers === 0) {
|
|
2450
|
+
if (this.flights.get(key) === f) this.flights.delete(key);
|
|
2451
|
+
f.controller.abort(reason);
|
|
2452
|
+
}
|
|
2453
|
+
};
|
|
2454
|
+
for (const s of signals) s.addEventListener("abort", onAbort, { once: true });
|
|
2455
|
+
f.promise.then(
|
|
2456
|
+
(response) => {
|
|
2457
|
+
if (settled) return;
|
|
2458
|
+
detach();
|
|
2459
|
+
f.subscribers--;
|
|
2460
|
+
resolve({ response, leader });
|
|
2461
|
+
},
|
|
2462
|
+
(err) => {
|
|
2463
|
+
if (settled) return;
|
|
2464
|
+
detach();
|
|
2465
|
+
f.subscribers--;
|
|
2466
|
+
reject(err);
|
|
2467
|
+
}
|
|
2468
|
+
);
|
|
2469
|
+
});
|
|
2470
|
+
}
|
|
2471
|
+
};
|
|
2472
|
+
|
|
2473
|
+
// src/core/requestCache.ts
|
|
2474
|
+
var SAFE_METHODS = Object.freeze(["get", "head"]);
|
|
2475
|
+
var MemoryCache = class {
|
|
2476
|
+
map = /* @__PURE__ */ new Map();
|
|
2477
|
+
maxEntries;
|
|
2478
|
+
constructor(options = {}) {
|
|
2479
|
+
const max = options.maxEntries ?? 100;
|
|
2480
|
+
if (!Number.isInteger(max) || max < 1) bad("maxEntries", max, "an integer >= 1");
|
|
2481
|
+
this.maxEntries = max;
|
|
2482
|
+
}
|
|
2483
|
+
get size() {
|
|
2484
|
+
return this.map.size;
|
|
2485
|
+
}
|
|
2486
|
+
get(key) {
|
|
2487
|
+
const entry = this.map.get(key);
|
|
2488
|
+
if (!entry) return void 0;
|
|
2489
|
+
this.map.delete(key);
|
|
2490
|
+
if (entry.expiresAt <= Date.now()) return void 0;
|
|
2491
|
+
this.map.set(key, entry);
|
|
2492
|
+
return entry;
|
|
2493
|
+
}
|
|
2494
|
+
set(key, entry) {
|
|
2495
|
+
this.map.delete(key);
|
|
2496
|
+
this.map.set(key, entry);
|
|
2497
|
+
while (this.map.size > this.maxEntries)
|
|
2498
|
+
this.map.delete(this.map.keys().next().value);
|
|
2499
|
+
}
|
|
2500
|
+
delete(key) {
|
|
2501
|
+
this.map.delete(key);
|
|
2502
|
+
}
|
|
2503
|
+
clear() {
|
|
2504
|
+
this.map.clear();
|
|
2505
|
+
}
|
|
2506
|
+
keys() {
|
|
2507
|
+
return [...this.map.keys()];
|
|
2508
|
+
}
|
|
2509
|
+
};
|
|
2510
|
+
function hash(str) {
|
|
2511
|
+
let h1 = 3735928559;
|
|
2512
|
+
let h2 = 1103547991;
|
|
2513
|
+
for (let i = 0; i < str.length; i++) {
|
|
2514
|
+
const ch = str.charCodeAt(i);
|
|
2515
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
2516
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
2517
|
+
}
|
|
2518
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
2519
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
2520
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36);
|
|
2521
|
+
}
|
|
2522
|
+
var CACHE_DIRECTIVE_HEADERS = /* @__PURE__ */ new Set(["cache-control", "pragma"]);
|
|
2523
|
+
function requestTarget(config) {
|
|
2524
|
+
const url = buildURL(
|
|
2525
|
+
buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls),
|
|
2526
|
+
config.params,
|
|
2527
|
+
config.paramsSerializer
|
|
2528
|
+
);
|
|
2529
|
+
return `${(config.method ?? "get").toUpperCase()} ${url}`;
|
|
2530
|
+
}
|
|
2531
|
+
function defaultRequestKey(config) {
|
|
2532
|
+
const skip = config.correlationIdHeader?.toLowerCase();
|
|
2533
|
+
const parts = [];
|
|
2534
|
+
for (const k of Object.keys(config.headers).sort())
|
|
2535
|
+
if (k !== skip && !CACHE_DIRECTIVE_HEADERS.has(k)) parts.push(`${k}:${config.headers[k]}`);
|
|
2536
|
+
if (config.auth) parts.push(`auth:${config.auth.username}:${config.auth.password}`);
|
|
2537
|
+
parts.push(`rt:${config.responseType ?? ""}`);
|
|
2538
|
+
return `${requestTarget(config)} #${hash(parts.join("\n"))}`;
|
|
2539
|
+
}
|
|
2540
|
+
function keyURL(key) {
|
|
2541
|
+
const sp = key.indexOf(" ");
|
|
2542
|
+
const h = key.lastIndexOf(" #");
|
|
2543
|
+
return sp > 0 && h > sp ? key.slice(sp + 1, h) : void 0;
|
|
2544
|
+
}
|
|
2545
|
+
function keyFor(config, opts2) {
|
|
2546
|
+
if (!opts2.methods.includes(config.method)) return void 0;
|
|
2547
|
+
if (config.responseType === "stream") return void 0;
|
|
2548
|
+
if (opts2.key) return opts2.key(config);
|
|
2549
|
+
if (config.data !== void 0) return void 0;
|
|
2550
|
+
return defaultRequestKey(config);
|
|
2551
|
+
}
|
|
2552
|
+
function checkMethods(name, m) {
|
|
2553
|
+
if (!Array.isArray(m)) bad(name, m, "an array");
|
|
2554
|
+
return m.map((x) => String(x).toLowerCase());
|
|
2555
|
+
}
|
|
2556
|
+
function resolveDedupe(v) {
|
|
2557
|
+
if (v === void 0 || v === false) return false;
|
|
2558
|
+
if (v === true) return { methods: [...SAFE_METHODS] };
|
|
2559
|
+
if (typeof v !== "object" || v === null) bad("dedupe", v, "a boolean or an object");
|
|
2560
|
+
if (v.key !== void 0 && typeof v.key !== "function") bad("dedupe.key", v.key, "a function");
|
|
2561
|
+
return { methods: checkMethods("dedupe.methods", v.methods ?? SAFE_METHODS), key: v.key };
|
|
2562
|
+
}
|
|
2563
|
+
function resolveCache(v) {
|
|
2564
|
+
if (v === void 0 || v === false) return false;
|
|
2565
|
+
const o = v === true ? {} : v;
|
|
2566
|
+
if (typeof o !== "object" || o === null) bad("cache", v, "a boolean or an object");
|
|
2567
|
+
const ttl = o.ttl ?? 6e4;
|
|
2568
|
+
if (typeof ttl !== "number" || !(ttl > 0) || !Number.isFinite(ttl))
|
|
2569
|
+
bad("cache.ttl", ttl, "a finite number > 0");
|
|
2570
|
+
if (o.key !== void 0 && typeof o.key !== "function") bad("cache.key", o.key, "a function");
|
|
2571
|
+
const p = o.provider;
|
|
2572
|
+
if (p !== void 0 && (typeof p !== "object" || p === null || typeof p.get !== "function" || typeof p.set !== "function"))
|
|
2573
|
+
bad("cache.provider", p, "an object with get/set/delete/clear");
|
|
2574
|
+
return {
|
|
2575
|
+
ttl,
|
|
2576
|
+
methods: checkMethods("cache.methods", o.methods ?? SAFE_METHODS),
|
|
2577
|
+
key: o.key,
|
|
2578
|
+
provider: p,
|
|
2579
|
+
respectCacheControl: o.respectCacheControl ?? true
|
|
2580
|
+
};
|
|
2581
|
+
}
|
|
2582
|
+
function parseCacheControl(value) {
|
|
2583
|
+
const out = /* @__PURE__ */ new Map();
|
|
2584
|
+
const raw = Array.isArray(value) ? value.join(",") : value;
|
|
2585
|
+
if (typeof raw !== "string") return out;
|
|
2586
|
+
for (const part of raw.split(",")) {
|
|
2587
|
+
const [k, v] = part.split("=", 2).map((s) => s.trim());
|
|
2588
|
+
if (k) out.set(k.toLowerCase(), v === void 0 ? true : v.replace(/^"|"$/g, ""));
|
|
2589
|
+
}
|
|
2590
|
+
return out;
|
|
2591
|
+
}
|
|
2592
|
+
function cloneData(data) {
|
|
2593
|
+
if (data === null || typeof data !== "object") return { ok: true, value: data };
|
|
2594
|
+
if (typeof structuredClone !== "function") return { ok: false, value: data };
|
|
2595
|
+
try {
|
|
2596
|
+
return { ok: true, value: structuredClone(data) };
|
|
2597
|
+
} catch {
|
|
2598
|
+
return { ok: false, value: data };
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
function reportCacheError(op, err) {
|
|
2602
|
+
if (typeof console !== "undefined") console.error(`[exios] cache provider ${op} failed:`, err);
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
// src/core/requestId.ts
|
|
2606
|
+
var seq = 0;
|
|
2607
|
+
function createRequestId() {
|
|
2608
|
+
const c = globalThis.crypto;
|
|
2609
|
+
if (typeof c?.randomUUID === "function") {
|
|
2610
|
+
try {
|
|
2611
|
+
return c.randomUUID();
|
|
2612
|
+
} catch {
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
seq = (seq + 1) % Number.MAX_SAFE_INTEGER;
|
|
2616
|
+
return `${Date.now().toString(36)}-${seq.toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2291
2619
|
// src/core/Exios.ts
|
|
2620
|
+
var CIRCUIT_EVENTS = {
|
|
2621
|
+
open: "circuitOpen",
|
|
2622
|
+
"half-open": "circuitHalfOpen",
|
|
2623
|
+
closed: "circuitClose"
|
|
2624
|
+
};
|
|
2625
|
+
var TIMEOUT_CODES = /* @__PURE__ */ new Set(["ECONNABORTED", "ETIMEDOUT"]);
|
|
2292
2626
|
var isThenable = (v) => typeof v === "object" && v !== null && typeof v.then === "function";
|
|
2293
2627
|
var Exios = class {
|
|
2294
2628
|
defaults;
|
|
@@ -2298,15 +2632,71 @@ var Exios = class {
|
|
|
2298
2632
|
};
|
|
2299
2633
|
breaker;
|
|
2300
2634
|
registry;
|
|
2635
|
+
events = new EventHub();
|
|
2636
|
+
memoryCache = new MemoryCache();
|
|
2637
|
+
inflight = new InflightRequests();
|
|
2638
|
+
/** The instance cache: `defaults.cache.provider`, or the built-in in-memory cache. */
|
|
2639
|
+
cache;
|
|
2301
2640
|
constructor(defaults) {
|
|
2302
2641
|
this.defaults = defaults;
|
|
2303
2642
|
this.registry = new BreakerRegistry(
|
|
2304
|
-
() => resolveBreaker(this.defaults.breaker)
|
|
2643
|
+
() => resolveBreaker(this.defaults.breaker),
|
|
2644
|
+
Date.now,
|
|
2645
|
+
(key, from, to) => this.events.emit(CIRCUIT_EVENTS[to], () => ({
|
|
2646
|
+
key,
|
|
2647
|
+
from,
|
|
2648
|
+
to,
|
|
2649
|
+
timestamp: Date.now()
|
|
2650
|
+
}))
|
|
2305
2651
|
);
|
|
2306
2652
|
this.breaker = {
|
|
2307
2653
|
state: (key) => this.registry.state(key),
|
|
2308
2654
|
reset: (key) => this.registry.reset(key)
|
|
2309
2655
|
};
|
|
2656
|
+
const provider = () => {
|
|
2657
|
+
const c = this.defaults.cache;
|
|
2658
|
+
return typeof c === "object" && c?.provider || this.memoryCache;
|
|
2659
|
+
};
|
|
2660
|
+
this.cache = {
|
|
2661
|
+
clear: async () => {
|
|
2662
|
+
await provider().clear();
|
|
2663
|
+
},
|
|
2664
|
+
delete: async (key) => {
|
|
2665
|
+
await provider().delete(key);
|
|
2666
|
+
},
|
|
2667
|
+
key: (cfg = {}) => {
|
|
2668
|
+
const resolved = finalizeConfig(resolveConfig(mergeConfig(this.defaults, cfg)));
|
|
2669
|
+
const c = resolveCache(resolved.cache) || resolveCache(true);
|
|
2670
|
+
return c ? keyFor(resolved, c) : void 0;
|
|
2671
|
+
},
|
|
2672
|
+
invalidate: async (match) => {
|
|
2673
|
+
const p = provider();
|
|
2674
|
+
if (typeof p.keys !== "function")
|
|
2675
|
+
throw new ExiosError(
|
|
2676
|
+
"cache.invalidate needs a cache provider with keys()",
|
|
2677
|
+
ExiosError.ERR_NOT_SUPPORT
|
|
2678
|
+
);
|
|
2679
|
+
let test;
|
|
2680
|
+
if (typeof match === "function") test = match;
|
|
2681
|
+
else if (match instanceof RegExp) test = (k) => match.test(k);
|
|
2682
|
+
else {
|
|
2683
|
+
const target = requestTarget({ ...this.defaults, url: match, params: void 0 });
|
|
2684
|
+
const prefix = target.slice(target.indexOf(" ") + 1);
|
|
2685
|
+
test = (k) => {
|
|
2686
|
+
const u = keyURL(k);
|
|
2687
|
+
return u !== void 0 && (u === prefix || u.startsWith(prefix + "/") || u.startsWith(prefix + "?"));
|
|
2688
|
+
};
|
|
2689
|
+
}
|
|
2690
|
+
let n = 0;
|
|
2691
|
+
for (const k of [...await p.keys()]) {
|
|
2692
|
+
if (test(k)) {
|
|
2693
|
+
await p.delete(k);
|
|
2694
|
+
n++;
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
return n;
|
|
2698
|
+
}
|
|
2699
|
+
};
|
|
2310
2700
|
}
|
|
2311
2701
|
async request(configOrUrl, config) {
|
|
2312
2702
|
const cfg = typeof configOrUrl === "string" ? { ...config, url: configOrUrl } : { ...configOrUrl };
|
|
@@ -2319,7 +2709,7 @@ var Exios = class {
|
|
|
2319
2709
|
synchronous = synchronous && h.synchronous;
|
|
2320
2710
|
requestChain.unshift(h);
|
|
2321
2711
|
});
|
|
2322
|
-
const dispatch = (c) =>
|
|
2712
|
+
const dispatch = (c) => this.dispatch(finalizeConfig(c));
|
|
2323
2713
|
let promise;
|
|
2324
2714
|
if (synchronous) {
|
|
2325
2715
|
promise = this.runSync(requestChain, resolved, dispatch);
|
|
@@ -2337,6 +2727,232 @@ var Exios = class {
|
|
|
2337
2727
|
});
|
|
2338
2728
|
return promise;
|
|
2339
2729
|
}
|
|
2730
|
+
/** Subscribe to a lifecycle event; returns a function that unsubscribes. */
|
|
2731
|
+
on(name, listener) {
|
|
2732
|
+
return this.events.on(name, listener);
|
|
2733
|
+
}
|
|
2734
|
+
/** Like `on`, but the listener runs at most once. */
|
|
2735
|
+
once(name, listener) {
|
|
2736
|
+
return this.events.once(name, listener);
|
|
2737
|
+
}
|
|
2738
|
+
/** Remove one listener, or every listener of `name` when `listener` is omitted. */
|
|
2739
|
+
off(name, listener) {
|
|
2740
|
+
this.events.off(name, listener);
|
|
2741
|
+
}
|
|
2742
|
+
/**
|
|
2743
|
+
* After request interceptors: ids → cache read → dedupe → network → cache write.
|
|
2744
|
+
* Cache hits and deduplicated followers make no network request and emit no lifecycle events.
|
|
2745
|
+
*/
|
|
2746
|
+
async dispatch(config) {
|
|
2747
|
+
const start = Date.now();
|
|
2748
|
+
config.requestId ??= createRequestId();
|
|
2749
|
+
const totalTimeout = config.totalTimeout ?? 0;
|
|
2750
|
+
if (typeof totalTimeout !== "number" || !(totalTimeout >= 0) || !Number.isFinite(totalTimeout))
|
|
2751
|
+
bad("totalTimeout", totalTimeout, "a non-negative finite number");
|
|
2752
|
+
const cacheCfg = resolveCache(config.cache);
|
|
2753
|
+
const dedupeCfg = resolveDedupe(config.dedupe);
|
|
2754
|
+
const cacheKey = cacheCfg ? keyFor(config, cacheCfg) : void 0;
|
|
2755
|
+
const dedupeKey = dedupeCfg ? keyFor(config, dedupeCfg) : void 0;
|
|
2756
|
+
const provider = cacheCfg ? cacheCfg.provider ?? this.memoryCache : void 0;
|
|
2757
|
+
const reqCC = cacheCfg && cacheCfg.respectCacheControl ? parseCacheControl(config.headers["cache-control"]) : void 0;
|
|
2758
|
+
if (cacheKey !== void 0 && provider && !reqCC?.has("no-cache") && !reqCC?.has("no-store")) {
|
|
2759
|
+
let entry;
|
|
2760
|
+
try {
|
|
2761
|
+
entry = await provider.get(cacheKey);
|
|
2762
|
+
} catch (e) {
|
|
2763
|
+
reportCacheError("get", e);
|
|
2764
|
+
}
|
|
2765
|
+
if (entry && entry.expiresAt > Date.now()) {
|
|
2766
|
+
const copy2 = cloneData(entry.data);
|
|
2767
|
+
return this.localResponse(config, start, {
|
|
2768
|
+
data: copy2.value,
|
|
2769
|
+
status: entry.status,
|
|
2770
|
+
statusText: entry.statusText,
|
|
2771
|
+
headers: { ...entry.headers },
|
|
2772
|
+
request: null,
|
|
2773
|
+
meta: { attempts: 0, cached: true }
|
|
2774
|
+
});
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
const header = config.correlationIdHeader?.toLowerCase();
|
|
2778
|
+
if (header && config.headers[header] === void 0)
|
|
2779
|
+
config.headers = { ...config.headers, [header]: config.correlationId ?? config.requestId };
|
|
2780
|
+
const network = async (c) => {
|
|
2781
|
+
const response2 = await this.network(c, start, totalTimeout);
|
|
2782
|
+
if (cacheKey !== void 0 && provider && cacheCfg && !reqCC?.has("no-store"))
|
|
2783
|
+
this.store(provider, cacheKey, response2, cacheCfg);
|
|
2784
|
+
return response2;
|
|
2785
|
+
};
|
|
2786
|
+
if (dedupeKey === void 0) return network(config);
|
|
2787
|
+
const { response, leader } = await this.inflight.join(
|
|
2788
|
+
dedupeKey,
|
|
2789
|
+
config,
|
|
2790
|
+
(signal) => network({ ...config, signal, cancelToken: void 0 })
|
|
2791
|
+
);
|
|
2792
|
+
if (leader) return response;
|
|
2793
|
+
const copy = cloneData(response.data);
|
|
2794
|
+
return this.localResponse(config, start, {
|
|
2795
|
+
...response,
|
|
2796
|
+
data: copy.value,
|
|
2797
|
+
headers: { ...response.headers },
|
|
2798
|
+
meta: { attempts: response.meta.attempts, deduped: true }
|
|
2799
|
+
});
|
|
2800
|
+
}
|
|
2801
|
+
/** A response made without a network request of its own (cache hit, deduplicated follower). */
|
|
2802
|
+
localResponse(config, start, r) {
|
|
2803
|
+
r.meta.requestId = config.requestId;
|
|
2804
|
+
if (config.correlationId !== void 0) r.meta.correlationId = config.correlationId;
|
|
2805
|
+
r.meta.durationMs = Date.now() - start;
|
|
2806
|
+
return { ...r, config };
|
|
2807
|
+
}
|
|
2808
|
+
/** Store a successful response; provider failures are reported, never thrown. */
|
|
2809
|
+
store(provider, key, response, cfg) {
|
|
2810
|
+
if (response.status < 200 || response.status >= 300) return;
|
|
2811
|
+
let ttl = cfg.ttl;
|
|
2812
|
+
if (cfg.respectCacheControl) {
|
|
2813
|
+
const cc = parseCacheControl(response.headers["cache-control"]);
|
|
2814
|
+
if (cc.has("no-store") || cc.has("no-cache")) return;
|
|
2815
|
+
const maxAge = Number(cc.get("max-age"));
|
|
2816
|
+
if (cc.has("max-age") && Number.isFinite(maxAge)) ttl = Math.min(ttl, maxAge * 1e3);
|
|
2817
|
+
}
|
|
2818
|
+
if (ttl <= 0) return;
|
|
2819
|
+
const copy = cloneData(response.data);
|
|
2820
|
+
if (!copy.ok) return;
|
|
2821
|
+
const now = Date.now();
|
|
2822
|
+
try {
|
|
2823
|
+
const r = provider.set(key, {
|
|
2824
|
+
status: response.status,
|
|
2825
|
+
statusText: response.statusText,
|
|
2826
|
+
headers: { ...response.headers },
|
|
2827
|
+
data: copy.value,
|
|
2828
|
+
storedAt: now,
|
|
2829
|
+
expiresAt: now + ttl
|
|
2830
|
+
});
|
|
2831
|
+
if (isThenable(r)) Promise.resolve(r).catch((e) => reportCacheError("set", e));
|
|
2832
|
+
} catch (e) {
|
|
2833
|
+
reportCacheError("set", e);
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
/** totalTimeout, timing, error context and lifecycle events around dispatchRequest. */
|
|
2837
|
+
async network(config, start, totalTimeout) {
|
|
2838
|
+
const requestId = config.requestId;
|
|
2839
|
+
const { correlationId, metadata } = config;
|
|
2840
|
+
const hub = this.events;
|
|
2841
|
+
const url = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
2842
|
+
const base = () => ({
|
|
2843
|
+
requestId,
|
|
2844
|
+
correlationId,
|
|
2845
|
+
method: config.method,
|
|
2846
|
+
url,
|
|
2847
|
+
config,
|
|
2848
|
+
metadata,
|
|
2849
|
+
timestamp: Date.now()
|
|
2850
|
+
});
|
|
2851
|
+
const observer = {
|
|
2852
|
+
onRetry: (o) => hub.emit("retry", () => ({
|
|
2853
|
+
...base(),
|
|
2854
|
+
attempt: o.attempt,
|
|
2855
|
+
delayMs: o.delayMs,
|
|
2856
|
+
error: o.error,
|
|
2857
|
+
status: o.response?.status ?? o.error?.response?.status
|
|
2858
|
+
})),
|
|
2859
|
+
onAttemptError: (attempt, error) => {
|
|
2860
|
+
if (TIMEOUT_CODES.has(error.code ?? ""))
|
|
2861
|
+
hub.emit("timeout", () => ({
|
|
2862
|
+
...base(),
|
|
2863
|
+
kind: "attempt",
|
|
2864
|
+
attempt,
|
|
2865
|
+
timeoutMs: config.timeout ?? 0,
|
|
2866
|
+
error
|
|
2867
|
+
}));
|
|
2868
|
+
}
|
|
2869
|
+
};
|
|
2870
|
+
let timer;
|
|
2871
|
+
let totalFired = false;
|
|
2872
|
+
let joined;
|
|
2873
|
+
let dispatchConfig = config;
|
|
2874
|
+
if (totalTimeout > 0) {
|
|
2875
|
+
const ac = new AbortController();
|
|
2876
|
+
timer = setTimeout(() => {
|
|
2877
|
+
totalFired = true;
|
|
2878
|
+
ac.abort(new Error("totalTimeout"));
|
|
2879
|
+
}, totalTimeout);
|
|
2880
|
+
joined = combineSignals(config.signal, ac.signal);
|
|
2881
|
+
dispatchConfig = { ...config, signal: joined.signal };
|
|
2882
|
+
}
|
|
2883
|
+
let deferCleanup = false;
|
|
2884
|
+
hub.emit("request", base);
|
|
2885
|
+
try {
|
|
2886
|
+
let response;
|
|
2887
|
+
try {
|
|
2888
|
+
response = await dispatchRequest(dispatchConfig, this.registry, observer);
|
|
2889
|
+
} catch (e) {
|
|
2890
|
+
if (!totalFired || config.signal?.aborted || !isCancel(e)) throw e;
|
|
2891
|
+
const err = new ExiosError(
|
|
2892
|
+
`total timeout of ${totalTimeout}ms exceeded`,
|
|
2893
|
+
config.transitional?.clarifyTimeoutError ? ExiosError.ETIMEDOUT : ExiosError.ECONNABORTED,
|
|
2894
|
+
config,
|
|
2895
|
+
e.request
|
|
2896
|
+
);
|
|
2897
|
+
err.cause = e;
|
|
2898
|
+
err.meta.attempts = e.meta.attempts;
|
|
2899
|
+
hub.emit("timeout", () => ({
|
|
2900
|
+
...base(),
|
|
2901
|
+
kind: "total",
|
|
2902
|
+
attempt: err.meta.attempts,
|
|
2903
|
+
timeoutMs: totalTimeout,
|
|
2904
|
+
error: err
|
|
2905
|
+
}));
|
|
2906
|
+
throw err;
|
|
2907
|
+
}
|
|
2908
|
+
if (joined && isOneShotBody(response.data)) {
|
|
2909
|
+
response.data = whenBodyDone(response.data, joined.cleanup);
|
|
2910
|
+
deferCleanup = true;
|
|
2911
|
+
}
|
|
2912
|
+
const durationMs = Date.now() - start;
|
|
2913
|
+
const meta = response.meta;
|
|
2914
|
+
meta.requestId = requestId;
|
|
2915
|
+
if (correlationId !== void 0) meta.correlationId = correlationId;
|
|
2916
|
+
meta.durationMs = durationMs;
|
|
2917
|
+
hub.emit("response", () => ({
|
|
2918
|
+
...base(),
|
|
2919
|
+
response,
|
|
2920
|
+
status: response.status,
|
|
2921
|
+
attempts: meta.attempts,
|
|
2922
|
+
durationMs,
|
|
2923
|
+
responseTimeMs: meta.responseTimeMs ?? durationMs
|
|
2924
|
+
}));
|
|
2925
|
+
return response;
|
|
2926
|
+
} catch (e) {
|
|
2927
|
+
const durationMs = Date.now() - start;
|
|
2928
|
+
let attempts = 0;
|
|
2929
|
+
if (isExiosError(e)) {
|
|
2930
|
+
const meta = e.meta;
|
|
2931
|
+
meta.requestId ??= requestId;
|
|
2932
|
+
if (correlationId !== void 0) meta.correlationId ??= correlationId;
|
|
2933
|
+
meta.method ??= config.method;
|
|
2934
|
+
meta.url ??= url;
|
|
2935
|
+
meta.durationMs ??= durationMs;
|
|
2936
|
+
attempts = meta.attempts;
|
|
2937
|
+
}
|
|
2938
|
+
if (isCancel(e)) {
|
|
2939
|
+
hub.emit("canceled", () => ({ ...base(), error: e, attempts, durationMs }));
|
|
2940
|
+
} else {
|
|
2941
|
+
hub.emit("error", () => ({
|
|
2942
|
+
...base(),
|
|
2943
|
+
error: e,
|
|
2944
|
+
code: isExiosError(e) ? e.code : void 0,
|
|
2945
|
+
status: isExiosError(e) ? e.status ?? e.response?.status : void 0,
|
|
2946
|
+
attempts,
|
|
2947
|
+
durationMs
|
|
2948
|
+
}));
|
|
2949
|
+
}
|
|
2950
|
+
throw e;
|
|
2951
|
+
} finally {
|
|
2952
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
2953
|
+
if (joined && !deferCleanup) joined.cleanup();
|
|
2954
|
+
}
|
|
2955
|
+
}
|
|
2340
2956
|
/** Runs every request interceptor in this tick with promise-chain semantics, then dispatches. */
|
|
2341
2957
|
runSync(chain, config, dispatch) {
|
|
2342
2958
|
let value = config;
|
|
@@ -2414,6 +3030,9 @@ var Exios = class {
|
|
|
2414
3030
|
};
|
|
2415
3031
|
var METHODS = [
|
|
2416
3032
|
"request",
|
|
3033
|
+
"on",
|
|
3034
|
+
"once",
|
|
3035
|
+
"off",
|
|
2417
3036
|
"getUri",
|
|
2418
3037
|
"get",
|
|
2419
3038
|
"delete",
|
|
@@ -2444,7 +3063,10 @@ function detachDefaults(d) {
|
|
|
2444
3063
|
"transitional",
|
|
2445
3064
|
"fetchOptions",
|
|
2446
3065
|
"auth",
|
|
2447
|
-
"breaker"
|
|
3066
|
+
"breaker",
|
|
3067
|
+
"metadata",
|
|
3068
|
+
"cache",
|
|
3069
|
+
"dedupe"
|
|
2448
3070
|
]) {
|
|
2449
3071
|
if (isPlainObject4(out[k])) out[k] = { ...out[k] };
|
|
2450
3072
|
}
|
|
@@ -2474,6 +3096,7 @@ function createInstance(defaults) {
|
|
|
2474
3096
|
});
|
|
2475
3097
|
instance.interceptors = context.interceptors;
|
|
2476
3098
|
instance.breaker = context.breaker;
|
|
3099
|
+
instance.cache = context.cache;
|
|
2477
3100
|
instance.create = (cfg) => createInstance(detachDefaults(mergeConfig(context.defaults, cfg)));
|
|
2478
3101
|
return instance;
|
|
2479
3102
|
}
|
|
@@ -2489,7 +3112,8 @@ var statics = {
|
|
|
2489
3112
|
isExiosError,
|
|
2490
3113
|
isCancel,
|
|
2491
3114
|
mergeConfig,
|
|
2492
|
-
toFormData
|
|
3115
|
+
toFormData,
|
|
3116
|
+
MemoryCache
|
|
2493
3117
|
};
|
|
2494
3118
|
var exios = Object.assign(
|
|
2495
3119
|
createInstance(createDefaults()),
|
|
@@ -2506,6 +3130,7 @@ export {
|
|
|
2506
3130
|
CanceledError,
|
|
2507
3131
|
CircuitOpenError,
|
|
2508
3132
|
ExiosError,
|
|
3133
|
+
MemoryCache,
|
|
2509
3134
|
create,
|
|
2510
3135
|
node_default as default,
|
|
2511
3136
|
isCancel,
|