@net-vert/core 0.5.0 → 1.0.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/dist/index.js CHANGED
@@ -1,335 +1,469 @@
1
- import E from "localforage";
2
- import { TaskQueue as j } from "id-queue";
3
- const k = {
4
- get: (t, e) => ({
5
- url: t,
6
- method: "get",
7
- ...e,
8
- params: e == null ? void 0 : e.params
9
- }),
10
- post: (t, e, r) => ({
11
- url: t,
12
- method: "post",
13
- data: e,
14
- headers: { "Content-Type": "application/json", ...r == null ? void 0 : r.headers },
15
- ...r
16
- }),
17
- delete: (t, e) => ({
18
- url: t,
19
- method: "delete",
20
- ...e
21
- }),
22
- put: (t, e, r) => ({
23
- url: t,
24
- method: "put",
25
- data: e,
26
- headers: { "Content-Type": "application/json", ...r == null ? void 0 : r.headers },
27
- ...r
28
- }),
29
- request: (t) => t
1
+ var T = Object.defineProperty;
2
+ var q = (r, e, t) => e in r ? T(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var c = (r, e, t) => q(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { TaskQueue as O } from "id-queue";
5
+ var y = /* @__PURE__ */ ((r) => (r.GET = "get", r.POST = "post", r.PUT = "put", r.DELETE = "delete", r))(y || {}), f = /* @__PURE__ */ ((r) => (r.CACHE = "cache", r.RETRY = "retry", r.IDEMPOTENT = "idempotent", r.CONCURRENT = "concurrent", r.SYNC = "sync", r))(f || {});
6
+ const I = "default", N = {
7
+ retries: 3,
8
+ delay: 0,
9
+ retryCondition: () => !0
10
+ }, V = (r) => {
11
+ const e = { ...N, ...r };
12
+ return Object.assign(async ({ config: s, next: n }) => {
13
+ let o = 0, i;
14
+ for (; o <= e.retries; )
15
+ try {
16
+ return await n();
17
+ } catch (a) {
18
+ if (i = a, o === e.retries)
19
+ throw a;
20
+ const u = {
21
+ config: s,
22
+ lastResponse: a,
23
+ attempt: o
24
+ };
25
+ if (!e.retryCondition(u))
26
+ throw a;
27
+ o++;
28
+ const d = typeof e.delay == "function" ? e.delay(u) : e.delay;
29
+ d > 0 && await new Promise((h) => setTimeout(h, d));
30
+ }
31
+ throw i;
32
+ }, { __middlewareType: f.RETRY });
33
+ }, j = () => {
34
+ const r = /* @__PURE__ */ new Map();
35
+ return { getPromise: (o) => r.get(o), setPromise: (o, i) => {
36
+ r.set(o, i), i.finally(() => r.delete(o));
37
+ }, delPromise: (o) => r.delete(o), clearCache: () => r.clear() };
38
+ }, K = (r) => {
39
+ const { config: e } = r, { method: t, url: s, data: n } = e;
40
+ return [t, s, JSON.stringify(n)].join("|");
41
+ }, R = {
42
+ key: K
43
+ }, b = (r) => {
44
+ const e = { ...R, ...r }, t = j();
45
+ return Object.assign(({ config: n, next: o }) => {
46
+ const i = e.key({ config: n }), a = t.getPromise(i);
47
+ if (a)
48
+ return a;
49
+ const u = o();
50
+ return t.setPromise(i, u), u;
51
+ }, {
52
+ __middlewareType: f.IDEMPOTENT,
53
+ promiseCache: t
54
+ });
30
55
  };
31
- function T(t) {
32
- const e = {};
33
- return Object.keys(k).forEach(
34
- (r) => {
35
- e[r] = (...n) => {
36
- const o = k[r](...n);
37
- return t(o);
38
- };
56
+ class z {
57
+ constructor(e = 4) {
58
+ c(this, "parallelCount");
59
+ c(this, "tasks");
60
+ c(this, "runningCount");
61
+ this.parallelCount = e, this.tasks = new O(), this.runningCount = 0;
62
+ }
63
+ // 加入
64
+ add(e, t) {
65
+ return new Promise((s, n) => {
66
+ this.tasks.enqueue(e, {
67
+ task: t,
68
+ resolve: s,
69
+ reject: n
70
+ }), this._run();
71
+ });
72
+ }
73
+ // 删除
74
+ remove(e) {
75
+ this.tasks.remove(e);
76
+ }
77
+ execute(e) {
78
+ const { task: t, resolve: s, reject: n } = e;
79
+ return t().then(s).catch(n).finally(() => {
80
+ this.runningCount--, this._run();
81
+ });
82
+ }
83
+ _run() {
84
+ for (; this.runningCount < this.parallelCount && this.tasks.size > 0; ) {
85
+ const e = this.tasks.dequeue();
86
+ this.runningCount++, this.execute(e);
39
87
  }
40
- ), e;
88
+ }
41
89
  }
42
- const M = "default", z = () => `${Date.now()}_${Math.random().toString().slice(2, 8)}`, I = /* @__PURE__ */ new Map(), Z = (t, e = M) => {
43
- I.set(e, T(t));
44
- }, v = (t = M) => {
45
- const e = I.get(t);
46
- if (!e) throw new Error(`Requestor实例 ${t} 未注册`);
47
- return e;
90
+ let _ = 0;
91
+ const $ = {
92
+ parallelCount: 4,
93
+ createId: () => _++
94
+ }, J = (r) => {
95
+ const { parallelCount: e, createId: t } = { ...$, ...r }, s = new z(e);
96
+ return Object.assign(({ config: o, next: i }) => {
97
+ const a = t({ config: o });
98
+ return s.add(a, () => i());
99
+ }, { __middlewareType: f.CONCURRENT, pool: s });
48
100
  };
49
- class O {
50
- has(e) {
51
- return !!this.get(e);
101
+ class v {
102
+ constructor() {
103
+ c(this, "store", /* @__PURE__ */ new Map());
52
104
  }
53
- // 获取缓存
54
- get(e) {
55
- const r = localStorage.getItem(e);
56
- if (r)
105
+ getItem(e) {
106
+ return this.store.get(e);
107
+ }
108
+ setItem(e, t) {
109
+ return this.store.set(e, t), t;
110
+ }
111
+ removeItem(e) {
112
+ this.store.delete(e);
113
+ }
114
+ clear() {
115
+ this.store.clear();
116
+ }
117
+ length() {
118
+ return this.store.size;
119
+ }
120
+ keys() {
121
+ return Array.from(this.store.keys());
122
+ }
123
+ iterate(e) {
124
+ let t = 0;
125
+ for (const [s, n] of this.store.entries())
126
+ e(n, s, t), t++;
127
+ }
128
+ }
129
+ const p = typeof window < "u" ? window.localStorage : {};
130
+ class k {
131
+ constructor() {
132
+ }
133
+ getItem(e) {
134
+ const t = String(e), s = p.getItem(t);
135
+ if (s !== null)
57
136
  try {
58
- return JSON.parse(r);
137
+ return JSON.parse(s);
59
138
  } catch (n) {
60
- console.error("Error parsing cached data", n);
139
+ console.error(`Failed to parse value for key: ${t}`, n);
61
140
  return;
62
141
  }
63
142
  }
64
- // 设置缓存
65
- set(e, r) {
143
+ setItem(e, t) {
144
+ const s = String(e);
66
145
  try {
67
- const n = JSON.stringify(r);
68
- localStorage.setItem(e, n);
146
+ p.setItem(s, JSON.stringify(t));
69
147
  } catch (n) {
70
- console.error("Error saving data to localStorage", n);
148
+ throw console.error(`Failed to set value for key: ${s}`, n), n;
71
149
  }
72
- return r;
150
+ return t;
73
151
  }
74
- // 删除缓存
75
- remove(e) {
76
- localStorage.removeItem(e);
152
+ removeItem(e) {
153
+ const t = String(e);
154
+ p.removeItem(t);
77
155
  }
78
- // 清空所有缓存
79
156
  clear() {
80
- localStorage.clear();
157
+ p.clear();
81
158
  }
82
- }
83
- const H = new O(), U = ({ persist: t, name: e, sync: r }) => {
84
- if (t && r)
85
- return H;
86
- if (t) {
87
- const n = E.createInstance({
88
- name: e
89
- // driver: sync
90
- // ?undefined
91
- // :localforage.LOCALSTORAGE,
159
+ length() {
160
+ return p.length;
161
+ }
162
+ keys() {
163
+ const e = [];
164
+ for (let t = 0; t < p.length; t++) {
165
+ const s = p.key(t);
166
+ s && e.push(s);
167
+ }
168
+ return e;
169
+ }
170
+ iterate(e) {
171
+ this.keys().forEach((s, n) => {
172
+ const o = this.getItem(s);
173
+ o !== void 0 && e(o, s, n);
92
174
  });
93
- return {
94
- has: (o) => n.keys().then((s) => s.includes(o)),
95
- get: (o) => n.getItem(o),
96
- set: (o, s) => n.setItem(o, s),
97
- remove: (o) => n.removeItem(o),
98
- clear: () => n.clear()
99
- };
100
- } else {
101
- const n = /* @__PURE__ */ new Map();
102
- return {
103
- has: (o) => n.has(o),
104
- get: (o) => n.get(o),
105
- set: (o, s) => n.set(o, s),
106
- remove: (o) => n.delete(o),
107
- clear: () => n.clear()
108
- };
109
175
  }
110
- }, _ = () => {
111
- const t = /* @__PURE__ */ new Map();
176
+ }
177
+ function w(r, e) {
112
178
  return {
113
- getPromise: (s) => t.get(s),
114
- setPromise: (s, u) => {
115
- t.set(s, u);
116
- },
117
- delPromise: (s) => {
118
- t.delete(s);
119
- },
120
- clearCache: () => {
121
- t.clear();
122
- }
179
+ value: r,
180
+ expireAt: Date.now() + e
123
181
  };
124
- }, A = (t, e) => ({
125
- value: t,
126
- expiresAt: Date.now() + e
127
- }), x = (t) => t.expiresAt > Date.now(), J = {
128
- key: (t) => t.url,
129
- persist: !1,
130
- duration: 1 / 0,
131
- sync: !1
132
- }, S = (t) => {
133
- const e = { ...J, ...t }, { name: r, persist: n, sync: o } = e, s = U({ persist: n, name: r, sync: o }), { getPromise: u, setPromise: P, delPromise: g } = _();
134
- function l(a, h) {
135
- const { isValid: i } = e, y = s.get(a);
136
- let C = !1;
137
- if (y && x(y)) {
138
- try {
139
- C = (i == null ? void 0 : i({
140
- key: a,
141
- config: h,
142
- cachedData: y
143
- })) ?? !0;
144
- } catch (c) {
145
- console.error(`校验异常 ${a}`, c);
182
+ }
183
+ function m(r, e = Date.now()) {
184
+ return r.expireAt <= e;
185
+ }
186
+ function g(r) {
187
+ return r.value;
188
+ }
189
+ const A = (r) => {
190
+ const { config: e } = r, { method: t, url: s, data: n } = e;
191
+ return [t, s, JSON.stringify(n)].join("|");
192
+ }, F = () => !0, x = 24 * 60 * 60 * 1e3, G = {
193
+ key: A,
194
+ duration: x,
195
+ isValid: F,
196
+ persist: !1
197
+ // 默认不持久化,使用内存存储
198
+ };
199
+ class l {
200
+ // ============ 扩展方法(自动处理过期和封装)============
201
+ /**
202
+ * 获取缓存值(自动处理过期检查和解包)
203
+ * @param key 缓存键
204
+ * @returns 缓存的原始值,如果不存在或已过期返回 undefined
205
+ */
206
+ get(e) {
207
+ const t = this.getItem(e);
208
+ if (t) {
209
+ if (m(t)) {
210
+ this.removeItem(e);
211
+ return;
146
212
  }
147
- !C && s.remove(a);
213
+ return g(t);
148
214
  }
149
- return { shouldUseCache: C, cachedData: y };
150
215
  }
151
- async function d(a, h) {
152
- const { isValid: i } = e, y = await s.get(a);
153
- let C = !1;
154
- if (y && x(y)) {
155
- try {
156
- C = await (i == null ? void 0 : i({
157
- key: a,
158
- config: h,
159
- cachedData: y
160
- })) ?? !0;
161
- } catch (c) {
162
- console.error(`校验异常 ${a}`, c);
163
- }
164
- !C && s.remove(a);
165
- }
166
- return { shouldUseCache: C, cachedData: y };
216
+ /**
217
+ * 设置缓存值(自动包装为 ExpirableValue)
218
+ * @param key 缓存键
219
+ * @param value 要缓存的值
220
+ * @param duration 有效期(毫秒),默认 24 小时
221
+ */
222
+ set(e, t, s = x) {
223
+ const n = w(t, s);
224
+ this.setItem(e, n);
167
225
  }
168
- const p = {
169
- get(a, h) {
170
- function i(c, f, ...m) {
171
- const q = Reflect.apply(a[h], a, m).then(async (w) => {
172
- const R = typeof e.duration == "number" ? e.duration : e.duration({
173
- key: c,
174
- config: f,
175
- response: w
176
- });
177
- return s.set(c, A(w, R)), w;
178
- }).finally(() => {
179
- g(c);
180
- });
181
- return P(c, q), q;
182
- }
183
- return o ? (...c) => {
184
- const f = k[h](...c), m = e.key(f), q = u(m);
185
- if (q)
186
- return q;
187
- const { shouldUseCache: w, cachedData: R } = l(m, f);
188
- return w ? R.value : i(m, f, ...c);
189
- } : (...c) => {
190
- const f = k[h](...c), m = e.key(f), q = u(m);
191
- if (q)
192
- return q;
193
- const w = (async () => {
194
- try {
195
- const { shouldUseCache: R, cachedData: D } = await d(m, f);
196
- return R ? D.value : await i(m, f, ...c);
197
- } finally {
198
- g(m);
199
- }
200
- })();
201
- return P(m, w), w;
202
- };
203
- }
204
- };
205
- return {
206
- requestor: new Proxy(v(), p),
207
- store: s
208
- };
209
- }, N = (t) => {
210
- const { method: e, url: r, params: n, data: o } = t;
211
- return [e, r, JSON.stringify(n), JSON.stringify(o)].join("|");
212
- }, b = {
213
- key: N
214
- }, F = (t) => {
215
- const e = { ...b, ...t }, {
216
- requestor: r
217
- } = S({
218
- key: e.key,
219
- persist: !1
220
- });
221
- return {
222
- requestor: r
223
- };
224
- }, L = {
225
- retries: 3,
226
- delay: 0,
227
- retryCondition: () => !0
228
- }, $ = (t) => {
229
- const { retries: e, delay: r, retryCondition: n } = { ...L, ...t }, o = {
230
- get(s, u) {
231
- return (...g) => {
232
- let l = 0;
233
- const d = () => Reflect.apply(s[u], s, g).catch((p) => {
234
- if (l < e && n(p)) {
235
- l++;
236
- const a = typeof r == "function" ? r(l) : r;
237
- return new Promise((h) => {
238
- setTimeout(() => h(d()), a);
239
- });
240
- }
241
- return Promise.reject(p);
242
- });
243
- return d();
244
- };
245
- }
246
- };
247
- return {
248
- requestor: new Proxy(v(), o)
249
- };
250
- };
251
- class Q {
252
- constructor(e = 4) {
253
- this.parallelCount = e, this.tasks = new j(), this.runningCount = 0;
226
+ /**
227
+ * 删除指定缓存(别名方法,等同于 removeItem)
228
+ * @param key 缓存键
229
+ */
230
+ delete(e) {
231
+ this.removeItem(e);
254
232
  }
255
- // 加入
256
- add(e, r) {
257
- return new Promise((n, o) => {
258
- this.tasks.enqueue(e, {
259
- task: r,
260
- resolve: n,
261
- reject: o
262
- }), this._run();
263
- });
233
+ /**
234
+ * 检查缓存是否存在且未过期
235
+ * @param key 缓存键
236
+ */
237
+ has(e) {
238
+ const t = this.getItem(e);
239
+ return t ? m(t) ? (this.removeItem(e), !1) : !0 : !1;
264
240
  }
265
- // 删除
266
- remove(e) {
267
- this.tasks.remove(e);
241
+ /**
242
+ * 获取缓存数量(别名方法,等同于 length)
243
+ */
244
+ size() {
245
+ return this.length();
268
246
  }
269
- execute(e) {
270
- const { task: r, resolve: n, reject: o } = e;
271
- return r().then(n).catch(o).finally(() => {
272
- this.runningCount--, this._run();
247
+ /**
248
+ * 遍历所有有效的缓存(自动跳过已过期的,并解包值)
249
+ * @param callback 回调函数,接收解包后的值、键和索引
250
+ */
251
+ forEach(e) {
252
+ let t = 0;
253
+ this.iterate((s, n, o) => {
254
+ if (m(s))
255
+ this.removeItem(n);
256
+ else {
257
+ const i = g(s);
258
+ e(i, n, t), t++;
259
+ }
273
260
  });
274
261
  }
275
- _run() {
276
- for (; this.runningCount < this.parallelCount && this.tasks.size > 0; ) {
277
- const e = this.tasks.dequeue();
278
- this.runningCount++, this.execute(e);
279
- }
262
+ /**
263
+ * 清理所有过期的缓存
264
+ * @returns 清理的缓存数量
265
+ */
266
+ clearExpired() {
267
+ let e = 0;
268
+ return this.keys().forEach((s) => {
269
+ const n = this.getItem(s);
270
+ n && m(n) && (this.removeItem(s), e++);
271
+ }), e;
272
+ }
273
+ /**
274
+ * 更新缓存的过期时间(不改变值)
275
+ * @param key 缓存键
276
+ * @param duration 新的有效期(毫秒)
277
+ * @returns 是否更新成功
278
+ */
279
+ touch(e, t) {
280
+ const s = this.getItem(e);
281
+ if (!s) return !1;
282
+ if (m(s))
283
+ return this.removeItem(e), !1;
284
+ const n = g(s);
285
+ return this.set(e, n, t), !0;
280
286
  }
281
287
  }
282
- const W = {
283
- parallelCount: 4,
284
- retries: 0,
285
- createId: () => z()
286
- }, Y = (t) => {
287
- const e = { ...W, ...t }, { parallelCount: r, createId: n, ...o } = e, s = new Q(r), { requestor: u = null } = o.retries > 0 ? $(o) : {}, P = {
288
- get(g, l) {
289
- return (...p) => {
290
- const a = k[l](...p), h = n(a), i = () => u ? Reflect.apply(u[l], u, p) : Reflect.apply(g[l], g, p);
291
- return s.add(h, i);
292
- };
288
+ class D extends v {
289
+ constructor() {
290
+ super(...arguments);
291
+ // 继承 MemoryStorage 的所有方法:getItem, setItem, removeItem, clear, length, keys, iterate
292
+ // BaseCacheStorage 继承扩展方法
293
+ c(this, "get", l.prototype.get);
294
+ c(this, "set", l.prototype.set);
295
+ c(this, "delete", l.prototype.delete);
296
+ c(this, "has", l.prototype.has);
297
+ c(this, "size", l.prototype.size);
298
+ c(this, "forEach", l.prototype.forEach);
299
+ c(this, "clearExpired", l.prototype.clearExpired);
300
+ c(this, "touch", l.prototype.touch);
301
+ }
302
+ }
303
+ class U extends k {
304
+ constructor() {
305
+ super(...arguments);
306
+ // 继承 LocalStorage 的所有方法:getItem, setItem, removeItem, clear, length, keys, iterate
307
+ // 从 BaseCacheStorage 继承扩展方法
308
+ c(this, "get", l.prototype.get);
309
+ c(this, "set", l.prototype.set);
310
+ c(this, "delete", l.prototype.delete);
311
+ c(this, "has", l.prototype.has);
312
+ c(this, "size", l.prototype.size);
313
+ c(this, "forEach", l.prototype.forEach);
314
+ c(this, "clearExpired", l.prototype.clearExpired);
315
+ c(this, "touch", l.prototype.touch);
316
+ }
317
+ }
318
+ const B = (r) => {
319
+ const e = { ...G, ...r }, t = e.persist ? new U() : new D(), s = (o) => typeof e.duration == "function" ? e.duration(o) : e.duration;
320
+ return Object.assign(async ({ config: o, next: i }) => {
321
+ const a = e.key({ config: o }), u = t.getItem(a);
322
+ if (u) {
323
+ if (!m(u) && await e.isValid({
324
+ key: a,
325
+ config: o,
326
+ cachedData: u
327
+ }))
328
+ return g(u);
329
+ t.removeItem(a);
293
330
  }
331
+ const d = await i(), h = s({ key: a, config: o, cachedData: u, response: d }), C = w(d, h);
332
+ return t.setItem(a, C), d;
333
+ }, {
334
+ __middlewareType: f.CACHE,
335
+ storage: t
336
+ });
337
+ }, L = (r) => {
338
+ const { config: e } = r, { method: t, url: s } = e;
339
+ return [t, s].join("|");
340
+ }, M = {
341
+ suspense: !0,
342
+ key: L,
343
+ duration: 24 * 60 * 60 * 1e3,
344
+ isValid: () => !0,
345
+ persist: !1
346
+ };
347
+ function te(r) {
348
+ const e = { ...M, ...r }, t = e.persist ? new k() : new v(), s = (o) => typeof e.duration == "function" ? e.duration(o) : e.duration;
349
+ return Object.assign(({ config: o, next: i }) => {
350
+ const a = e.key({ config: o }), u = t.getItem(a);
351
+ if (u) {
352
+ if (!m(u) && e.isValid({
353
+ key: a,
354
+ config: o,
355
+ cachedData: u
356
+ }))
357
+ return g(u);
358
+ t.removeItem(a);
359
+ }
360
+ if (e.suspense)
361
+ throw (e.wrapSuspense ? e.wrapSuspense({ key: a, config: o, p: i() }) : i()).then((h) => {
362
+ const C = s({ key: a, config: o, cachedData: u, response: h });
363
+ return t.setItem(a, w(h, C)), h;
364
+ });
365
+ return i().then((d) => {
366
+ const h = s({ key: a, config: o, cachedData: u, response: d });
367
+ return t.setItem(a, w(d, h)), d;
368
+ });
369
+ }, { __middlewareType: f.SYNC });
370
+ }
371
+ const S = /* @__PURE__ */ new Map(), re = (r, e = I) => {
372
+ S.set(e, r);
373
+ }, Y = (r = I) => {
374
+ const e = S.get(r);
375
+ if (!e) throw new Error(`Requestor实例 ${String(r)} 未注册`);
376
+ return e;
377
+ }, E = {
378
+ get: (r, e) => ({
379
+ url: r,
380
+ method: y.GET,
381
+ ...e,
382
+ params: e == null ? void 0 : e.params
383
+ }),
384
+ post: (r, e, t) => ({
385
+ url: r,
386
+ method: y.POST,
387
+ data: e,
388
+ ...t
389
+ }),
390
+ delete: (r, e) => ({
391
+ url: r,
392
+ method: y.DELETE,
393
+ ...e
394
+ }),
395
+ put: (r, e, t) => ({
396
+ url: r,
397
+ method: y.PUT,
398
+ data: e,
399
+ ...t
400
+ }),
401
+ request: (r) => r
402
+ }, X = Object.keys(E);
403
+ function Z(r, e, t) {
404
+ const s = {}, n = (o) => {
405
+ if (o === e.length)
406
+ return t(r);
407
+ const i = e[o];
408
+ return i({
409
+ config: r,
410
+ ctx: s,
411
+ next: () => n(o + 1)
412
+ });
294
413
  };
295
- return {
296
- requestor: new Proxy(v(), P),
297
- concurrentPool: s
298
- };
299
- }, B = {
300
- persist: !1,
301
- sync: !0
302
- }, G = (t) => {
303
- const e = { ...B, ...t }, { ...r } = e, {
304
- requestor: n,
305
- store: o
306
- } = S(r), s = {
307
- get(u, P) {
308
- return (...l) => {
309
- try {
310
- const d = Reflect.apply(u[P], u, l);
311
- if (d instanceof Promise)
312
- throw d;
313
- return d;
314
- } catch (d) {
315
- throw d;
316
- }
414
+ return n(0);
415
+ }
416
+ function H(r, e) {
417
+ const t = {}, s = e ?? [];
418
+ return X.forEach(
419
+ (n) => {
420
+ t[n] = (...o) => {
421
+ const i = E[n](...o);
422
+ return Z(
423
+ i,
424
+ s,
425
+ r
426
+ );
317
427
  };
318
428
  }
319
- };
320
- return {
321
- requestor: new Proxy(n, s),
322
- store: o
323
- };
324
- }, K = {
325
- cacheRequestor: S,
326
- idempotencyRequestor: F,
327
- retryRequestor: $,
328
- concurrentPoolRequestor: Y,
329
- syncRequestor: G
330
- };
429
+ ), t;
430
+ }
431
+ function P(r) {
432
+ const { extensions: e, instanceKey: t } = r ?? {}, s = Y(t);
433
+ return H(
434
+ s,
435
+ e
436
+ );
437
+ }
438
+ function se(r) {
439
+ const { instanceKey: e, key: t, duration: s, isValid: n, persist: o, ...i } = r;
440
+ return P({
441
+ instanceKey: e,
442
+ extensions: [
443
+ b(i),
444
+ B({ key: t, duration: s, isValid: n, persist: o })
445
+ ]
446
+ });
447
+ }
448
+ function ne(r) {
449
+ const { instanceKey: e, parallelCount: t, createId: s, retries: n, delay: o, retryCondition: i } = r;
450
+ return P({
451
+ instanceKey: e,
452
+ extensions: [
453
+ J({ parallelCount: t, createId: s }),
454
+ V({ retries: n, delay: o, retryCondition: i })
455
+ ]
456
+ });
457
+ }
331
458
  export {
332
- Z as inject,
333
- K as requestExtender,
334
- v as useRequestor
459
+ B as cache,
460
+ J as concurrent,
461
+ se as createCachedIdempotentRequestor,
462
+ ne as createConcurrentRetryRequestor,
463
+ P as createRequestor,
464
+ b as idempotent,
465
+ re as inject,
466
+ V as retry,
467
+ te as sync,
468
+ Y as useRequestor
335
469
  };