@net-vert/core 1.2.0 → 1.2.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/index.js CHANGED
@@ -1,14 +1,11 @@
1
- var D = Object.defineProperty;
2
- var F = (r, e, t) => e in r ? D(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var l = (r, e, t) => F(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { TaskQueue as $ } from "id-queue";
5
- var w = /* @__PURE__ */ ((r) => (r.GET = "get", r.POST = "post", r.PUT = "put", r.DELETE = "delete", r))(w || {}), y = /* @__PURE__ */ ((r) => (r.CACHE = "cache", r.RETRY = "retry", r.IDEMPOTENT = "idempotent", r.CONCURRENT = "concurrent", r.SYNC = "sync", r))(y || {});
6
- const v = "default", E = {
1
+ import { TaskQueue as j } from "id-queue";
2
+ var f = /* @__PURE__ */ ((r) => (r.GET = "get", r.POST = "post", r.PUT = "put", r.DELETE = "delete", r))(f || {}), m = /* @__PURE__ */ ((r) => (r.CACHE = "cache", r.RETRY = "retry", r.IDEMPOTENT = "idempotent", r.CONCURRENT = "concurrent", r.SYNC = "sync", r))(m || {});
3
+ const S = "default", D = {
7
4
  retries: 3,
8
5
  delay: 0,
9
6
  retryCondition: () => !0
10
- }, T = (r) => {
11
- const e = { ...E, ...r };
7
+ }, F = (r) => {
8
+ const e = { ...D, ...r };
12
9
  return Object.assign(async ({ config: n, next: s }) => {
13
10
  let o = 0, i;
14
11
  for (; o <= e.retries; )
@@ -26,22 +23,22 @@ const v = "default", E = {
26
23
  throw a;
27
24
  o++;
28
25
  const u = typeof e.delay == "function" ? e.delay(c) : e.delay;
29
- u > 0 && await new Promise((h) => setTimeout(h, u));
26
+ u > 0 && await new Promise((l) => setTimeout(l, u));
30
27
  }
31
28
  throw i;
32
- }, { __middlewareType: y.RETRY });
33
- }, q = () => {
29
+ }, { __middlewareType: m.RETRY });
30
+ }, $ = () => {
34
31
  const r = /* @__PURE__ */ new Map();
35
32
  return { getPromise: (o) => r.get(o), setPromise: (o, i) => {
36
33
  r.set(o, i), i.finally(() => r.delete(o));
37
34
  }, delPromise: (o) => r.delete(o), clearCache: () => r.clear() };
38
- }, R = (r) => {
35
+ }, E = (r) => {
39
36
  const { config: e } = r, { method: t, url: n, data: s } = e;
40
37
  return [t, n, JSON.stringify(s)].join("|");
41
- }, B = {
42
- key: R
43
- }, _ = (r) => {
44
- const e = { ...B, ...r }, t = q();
38
+ }, T = {
39
+ key: E
40
+ }, q = (r) => {
41
+ const e = { ...T, ...r }, t = $();
45
42
  return Object.assign(({ config: s, next: o }) => {
46
43
  const i = e.key({ config: s }), a = t.getPromise(i);
47
44
  if (a)
@@ -49,16 +46,16 @@ const v = "default", E = {
49
46
  const c = o();
50
47
  return t.setPromise(i, c), c;
51
48
  }, {
52
- __middlewareType: y.IDEMPOTENT,
49
+ __middlewareType: m.IDEMPOTENT,
53
50
  promiseCache: t
54
51
  });
55
52
  };
56
- class K {
53
+ class R {
54
+ parallelCount;
55
+ tasks;
56
+ runningCount;
57
57
  constructor(e = 4) {
58
- l(this, "parallelCount");
59
- l(this, "tasks");
60
- l(this, "runningCount");
61
- this.parallelCount = e, this.tasks = new $(), this.runningCount = 0;
58
+ this.parallelCount = e, this.tasks = new j(), this.runningCount = 0;
62
59
  }
63
60
  // 加入
64
61
  add(e, t) {
@@ -87,29 +84,27 @@ class K {
87
84
  }
88
85
  }
89
86
  }
90
- let A = 0;
91
- const J = {
87
+ let B = 0;
88
+ const _ = {
92
89
  parallelCount: 4,
93
- createId: () => A++
94
- }, z = (r) => {
95
- const { parallelCount: e, createId: t } = { ...J, ...r }, n = new K(e);
90
+ createId: () => B++
91
+ }, K = (r) => {
92
+ const { parallelCount: e, createId: t } = { ..._, ...r }, n = new R(e);
96
93
  return Object.assign(({ config: o, next: i }) => {
97
94
  const a = t({ config: o });
98
95
  return n.add(a, () => i());
99
- }, { __middlewareType: y.CONCURRENT, pool: n });
100
- }, b = /* @__PURE__ */ new Map(), g = (r, e) => {
101
- b.set(e, r);
96
+ }, { __middlewareType: m.CONCURRENT, pool: n });
97
+ }, v = /* @__PURE__ */ new Map(), y = (r, e) => {
98
+ v.set(e, r);
102
99
  };
103
- function G(r) {
104
- const e = b.get(r);
100
+ function A(r) {
101
+ const e = v.get(r);
105
102
  if (!e)
106
103
  throw new Error(`Store实例 ${String(r)} 未注册`);
107
104
  return e;
108
105
  }
109
- class U {
110
- constructor() {
111
- l(this, "store", /* @__PURE__ */ new Map());
112
- }
106
+ class J {
107
+ store = /* @__PURE__ */ new Map();
113
108
  getItem(e) {
114
109
  return this.store.get(e);
115
110
  }
@@ -137,7 +132,7 @@ class U {
137
132
  e(s, n, t), t++;
138
133
  }
139
134
  }
140
- const Y = (r) => !!r && (typeof r == "object" || typeof r == "function") && typeof r.then == "function", N = (r) => typeof window < "u" ? r() : {
135
+ const z = (r) => !!r && (typeof r == "object" || typeof r == "function") && typeof r.then == "function", b = (r) => typeof window < "u" ? r() : {
141
136
  getItem() {
142
137
  return null;
143
138
  },
@@ -153,12 +148,12 @@ const Y = (r) => !!r && (typeof r == "object" || typeof r == "function") && type
153
148
  get length() {
154
149
  return 0;
155
150
  }
156
- }, d = N(() => window.localStorage);
157
- class M {
151
+ }, h = b(() => window.localStorage);
152
+ class G {
158
153
  constructor() {
159
154
  }
160
155
  getItem(e) {
161
- const t = String(e), n = d.getItem(t);
156
+ const t = String(e), n = h.getItem(t);
162
157
  if (n !== null)
163
158
  try {
164
159
  return JSON.parse(n);
@@ -170,7 +165,7 @@ class M {
170
165
  setItem(e, t) {
171
166
  const n = String(e);
172
167
  try {
173
- d.setItem(n, JSON.stringify(t));
168
+ h.setItem(n, JSON.stringify(t));
174
169
  } catch (s) {
175
170
  throw console.error(`Failed to set value for key: ${n}`, s), s;
176
171
  }
@@ -178,21 +173,21 @@ class M {
178
173
  }
179
174
  removeItem(e) {
180
175
  const t = String(e);
181
- d.removeItem(t);
176
+ h.removeItem(t);
182
177
  }
183
178
  clear() {
184
- d.clear();
179
+ h.clear();
185
180
  }
186
181
  length() {
187
- return d.length;
182
+ return h.length;
188
183
  }
189
184
  key(e) {
190
- return d.key(e);
185
+ return h.key(e);
191
186
  }
192
187
  keys() {
193
188
  const e = [];
194
- for (let t = 0; t < d.length; t++) {
195
- const n = d.key(t);
189
+ for (let t = 0; t < h.length; t++) {
190
+ const n = h.key(t);
196
191
  n && e.push(n);
197
192
  }
198
193
  return e;
@@ -204,12 +199,12 @@ class M {
204
199
  });
205
200
  }
206
201
  }
207
- const m = N(() => window.sessionStorage);
208
- class X {
202
+ const d = b(() => window.sessionStorage);
203
+ class U {
209
204
  constructor() {
210
205
  }
211
206
  getItem(e) {
212
- const t = String(e), n = m.getItem(t);
207
+ const t = String(e), n = d.getItem(t);
213
208
  if (n !== null)
214
209
  try {
215
210
  return JSON.parse(n);
@@ -221,7 +216,7 @@ class X {
221
216
  setItem(e, t) {
222
217
  const n = String(e);
223
218
  try {
224
- m.setItem(n, JSON.stringify(t));
219
+ d.setItem(n, JSON.stringify(t));
225
220
  } catch (s) {
226
221
  throw console.error(`Failed to set value for key: ${n}`, s), s;
227
222
  }
@@ -229,21 +224,21 @@ class X {
229
224
  }
230
225
  removeItem(e) {
231
226
  const t = String(e);
232
- m.removeItem(t);
227
+ d.removeItem(t);
233
228
  }
234
229
  clear() {
235
- m.clear();
230
+ d.clear();
236
231
  }
237
232
  length() {
238
- return m.length;
233
+ return d.length;
239
234
  }
240
235
  key(e) {
241
- return m.key(e);
236
+ return d.key(e);
242
237
  }
243
238
  keys() {
244
239
  const e = [];
245
- for (let t = 0; t < m.length; t++) {
246
- const n = m.key(t);
240
+ for (let t = 0; t < d.length; t++) {
241
+ const n = d.key(t);
247
242
  n && e.push(n);
248
243
  }
249
244
  return e;
@@ -255,12 +250,12 @@ class X {
255
250
  });
256
251
  }
257
252
  }
258
- class Z {
253
+ class Y {
254
+ dbName;
255
+ storeName;
256
+ dbPromise = null;
257
+ DB_VERSION = 1;
259
258
  constructor(e, t) {
260
- l(this, "dbName");
261
- l(this, "storeName");
262
- l(this, "dbPromise", null);
263
- l(this, "DB_VERSION", 1);
264
259
  this.dbName = e, this.storeName = t, this.initDB();
265
260
  }
266
261
  /**
@@ -378,17 +373,17 @@ class Z {
378
373
  }
379
374
  }
380
375
  }
381
- const f = {
376
+ const g = {
382
377
  memory: "memory",
383
378
  local: "local",
384
379
  session: "session",
385
380
  indexeddb: "indexeddb"
386
381
  };
387
- function x(r, e) {
382
+ function N(r, e) {
388
383
  Object.assign(r, e);
389
384
  }
390
- function H(r) {
391
- return x(r, {
385
+ function M(r) {
386
+ return N(r, {
392
387
  async getItemOrDefault(e, t) {
393
388
  const n = await this.getItem(e);
394
389
  return n !== null ? n : t;
@@ -404,8 +399,8 @@ function H(r) {
404
399
  }
405
400
  }), r;
406
401
  }
407
- function L(r) {
408
- return x(r, {
402
+ function X(r) {
403
+ return N(r, {
409
404
  getItemOrDefault(e, t) {
410
405
  const n = this.getItem(e);
411
406
  return n !== null ? n : t;
@@ -421,50 +416,50 @@ function L(r) {
421
416
  }
422
417
  }), r;
423
418
  }
424
- function Q(r) {
419
+ function Z(r) {
425
420
  const e = r.getItem("");
426
- return Y(e) ? H(r) : L(r);
421
+ return z(e) ? M(r) : X(r);
427
422
  }
428
- function p(r, ...e) {
429
- const t = G(r);
423
+ function w(r, ...e) {
424
+ const t = A(r);
430
425
  let n;
431
426
  try {
432
427
  n = new t(...e);
433
428
  } catch {
434
429
  n = t(...e);
435
430
  }
436
- return Q(n);
431
+ return Z(n);
437
432
  }
438
- g(U, f.memory);
439
- g(M, f.local);
440
- g(X, f.session);
441
- g(Z, f.indexeddb);
442
- function I(r, e) {
433
+ y(J, g.memory);
434
+ y(G, g.local);
435
+ y(U, g.session);
436
+ y(Y, g.indexeddb);
437
+ function C(r, e) {
443
438
  return {
444
439
  value: r,
445
440
  expireAt: Date.now() + e
446
441
  };
447
442
  }
448
- function k(r, e = Date.now()) {
443
+ function I(r, e = Date.now()) {
449
444
  return r.expireAt <= e;
450
445
  }
451
- function P(r, e = Date.now()) {
452
- return k(r, e) ? void 0 : r.value;
446
+ function x(r, e = Date.now()) {
447
+ return I(r, e) ? void 0 : r.value;
453
448
  }
454
- const W = (r) => {
449
+ const H = (r) => {
455
450
  const { config: e } = r, { method: t, url: n, data: s } = e;
456
451
  return [t, n, JSON.stringify(s)].join("|");
457
- }, ee = () => !0, S = 24 * 60 * 60 * 1e3, te = {
458
- key: W,
459
- duration: S,
460
- isValid: ee,
461
- store: f.memory
452
+ }, L = () => !0, k = 24 * 60 * 60 * 1e3, Q = {
453
+ key: H,
454
+ duration: k,
455
+ isValid: L,
456
+ store: g.memory
462
457
  // 默认不持久化,使用内存存储
463
458
  };
464
- let re = class {
459
+ let W = class {
460
+ store;
465
461
  constructor(e) {
466
- l(this, "store");
467
- return typeof e == "string" ? this.store = p(e) : (g(e.factory, e.key), this.store = p(e.key)), new Proxy(this, {
462
+ return typeof e == "string" ? this.store = w(e) : (y(e.factory, e.key), this.store = w(e.key)), new Proxy(this, {
468
463
  get(t, n) {
469
464
  if (n in t)
470
465
  return t[n];
@@ -479,8 +474,8 @@ let re = class {
479
474
  * @param value 要缓存的值
480
475
  * @param duration 过期时长(毫秒),默认 24 小时
481
476
  */
482
- setCache(e, t, n = S) {
483
- const s = I(t, n);
477
+ setCache(e, t, n = k) {
478
+ const s = C(t, n);
484
479
  this.store.setItem(e, s);
485
480
  }
486
481
  /**
@@ -491,7 +486,7 @@ let re = class {
491
486
  async getCache(e) {
492
487
  const t = await this.store.getItem(e);
493
488
  if (t)
494
- return P(t);
489
+ return x(t);
495
490
  }
496
491
  /**
497
492
  * 检查是否有有效的缓存(未过期)
@@ -500,11 +495,11 @@ let re = class {
500
495
  */
501
496
  async hasValidCache(e) {
502
497
  const t = await this.store.getItem(e);
503
- return t ? !k(t) : !1;
498
+ return t ? !I(t) : !1;
504
499
  }
505
500
  };
506
- const ne = re, se = (r) => {
507
- const e = { ...te, ...r }, t = new ne(e.store), n = (o) => typeof e.duration == "function" ? e.duration(o) : e.duration;
501
+ const ee = W, te = (r) => {
502
+ const e = { ...Q, ...r }, t = new ee(e.store), n = (o) => typeof e.duration == "function" ? e.duration(o) : e.duration;
508
503
  return Object.assign(async ({ config: o, next: i }) => {
509
504
  const a = e.key({ config: o }), c = await t.getCache(a);
510
505
  if (c) {
@@ -515,17 +510,17 @@ const ne = re, se = (r) => {
515
510
  })) return c;
516
511
  t.removeItem(a);
517
512
  }
518
- const u = await i(), h = n({ key: a, config: o, cachedData: c, response: u }), C = I(u, h);
519
- return t.setItem(a, C), u;
513
+ const u = await i(), l = n({ key: a, config: o, cachedData: c, response: u }), p = C(u, l);
514
+ return t.setItem(a, p), u;
520
515
  }, {
521
- __middlewareType: y.CACHE,
516
+ __middlewareType: m.CACHE,
522
517
  storage: t
523
518
  });
524
519
  };
525
- class oe {
520
+ class re {
521
+ store;
526
522
  constructor(e) {
527
- l(this, "store");
528
- return typeof e == "string" ? this.store = p(e) : (g(e.factory, e.key), this.store = p(e.key)), new Proxy(this, {
523
+ return typeof e == "string" ? this.store = w(e) : (y(e.factory, e.key), this.store = w(e.key)), new Proxy(this, {
529
524
  get(t, n) {
530
525
  if (n in t)
531
526
  return t[n];
@@ -540,8 +535,8 @@ class oe {
540
535
  * @param value 要缓存的值
541
536
  * @param duration 过期时长(毫秒),默认 24 小时
542
537
  */
543
- setCache(e, t, n = S) {
544
- const s = I(t, n);
538
+ setCache(e, t, n = k) {
539
+ const s = C(t, n);
545
540
  this.store.setItem(e, s);
546
541
  }
547
542
  /**
@@ -552,7 +547,7 @@ class oe {
552
547
  getCache(e) {
553
548
  const t = this.store.getItem(e);
554
549
  if (t)
555
- return P(t);
550
+ return x(t);
556
551
  }
557
552
  /**
558
553
  * 检查是否有有效的缓存(未过期)
@@ -561,21 +556,21 @@ class oe {
561
556
  */
562
557
  hasValidCache(e) {
563
558
  const t = this.store.getItem(e);
564
- return t ? !k(t) : !1;
559
+ return t ? !I(t) : !1;
565
560
  }
566
561
  }
567
- const ae = oe, ie = (r) => {
562
+ const ne = re, se = (r) => {
568
563
  const { config: e } = r, { method: t, url: n } = e;
569
564
  return [t, n].join("|");
570
- }, ce = {
565
+ }, oe = {
571
566
  suspense: !0,
572
- key: ie,
567
+ key: se,
573
568
  duration: 24 * 60 * 60 * 1e3,
574
569
  isValid: () => !0,
575
- store: f.memory
570
+ store: g.memory
576
571
  };
577
- function we(r) {
578
- const e = { ...ce, ...r }, t = new ae(e.store), n = (o) => typeof e.duration == "function" ? e.duration(o) : e.duration;
572
+ function me(r) {
573
+ const e = { ...oe, ...r }, t = new ne(e.store), n = (o) => typeof e.duration == "function" ? e.duration(o) : e.duration;
579
574
  return Object.assign(({ config: o, next: i }) => {
580
575
  const a = e.key({ config: o }), c = t.getCache(a);
581
576
  if (c) {
@@ -587,49 +582,49 @@ function we(r) {
587
582
  t.removeItem(a);
588
583
  }
589
584
  if (e.suspense)
590
- throw (e.wrapSuspense ? e.wrapSuspense({ key: a, config: o, p: i() }) : i()).then((h) => {
591
- const C = n({ key: a, config: o, cachedData: c, response: h });
592
- return t.setCache(a, h, C), h;
585
+ throw (e.wrapSuspense ? e.wrapSuspense({ key: a, config: o, p: i() }) : i()).then((l) => {
586
+ const p = n({ key: a, config: o, cachedData: c, response: l });
587
+ return t.setCache(a, l, p), l;
593
588
  });
594
589
  return i().then((u) => {
595
- const h = n({ key: a, config: o, cachedData: c, response: u });
596
- return t.setCache(a, u, h), u;
590
+ const l = n({ key: a, config: o, cachedData: c, response: u });
591
+ return t.setCache(a, u, l), u;
597
592
  });
598
- }, { __middlewareType: y.SYNC });
593
+ }, { __middlewareType: m.SYNC });
599
594
  }
600
- const V = /* @__PURE__ */ new Map(), pe = (r, e = v) => {
601
- V.set(e, r);
602
- }, ue = (r = v) => {
603
- const e = V.get(r);
595
+ const P = /* @__PURE__ */ new Map(), ye = (r, e = S) => {
596
+ P.set(e, r);
597
+ }, ae = (r = S) => {
598
+ const e = P.get(r);
604
599
  if (!e) throw new Error(`Requestor实例 ${String(r)} 未注册`);
605
600
  return e;
606
- }, O = {
601
+ }, V = {
607
602
  get: (r, e) => ({
608
603
  url: r,
609
- method: w.GET,
604
+ method: f.GET,
610
605
  ...e,
611
- params: e == null ? void 0 : e.params
606
+ params: e?.params
612
607
  }),
613
608
  post: (r, e, t) => ({
614
609
  url: r,
615
- method: w.POST,
610
+ method: f.POST,
616
611
  data: e,
617
612
  ...t
618
613
  }),
619
614
  delete: (r, e) => ({
620
615
  url: r,
621
- method: w.DELETE,
616
+ method: f.DELETE,
622
617
  ...e
623
618
  }),
624
619
  put: (r, e, t) => ({
625
620
  url: r,
626
- method: w.PUT,
621
+ method: f.PUT,
627
622
  data: e,
628
623
  ...t
629
624
  }),
630
625
  request: (r) => r
631
- }, le = Object.keys(O);
632
- function he(r, e, t) {
626
+ }, ie = Object.keys(V);
627
+ function ce(r, e, t) {
633
628
  const n = {}, s = (o) => {
634
629
  if (o === e.length)
635
630
  return t(r);
@@ -642,13 +637,13 @@ function he(r, e, t) {
642
637
  };
643
638
  return s(0);
644
639
  }
645
- function de(r, e) {
640
+ function ue(r, e) {
646
641
  const t = {}, n = e ?? [];
647
- return le.forEach(
642
+ return ie.forEach(
648
643
  (s) => {
649
644
  t[s] = (...o) => {
650
- const i = O[s](...o);
651
- return he(
645
+ const i = V[s](...o);
646
+ return ce(
652
647
  i,
653
648
  n,
654
649
  r
@@ -657,42 +652,42 @@ function de(r, e) {
657
652
  }
658
653
  ), t;
659
654
  }
660
- function j(r) {
661
- const { extensions: e, instanceKey: t } = r ?? {}, n = ue(t);
662
- return de(
655
+ function O(r) {
656
+ const { extensions: e, instanceKey: t } = r ?? {}, n = ae(t);
657
+ return ue(
663
658
  n,
664
659
  e
665
660
  );
666
661
  }
667
- function Ce(r) {
662
+ function ge(r) {
668
663
  const { instanceKey: e, key: t, duration: n, isValid: s, store: o, ...i } = r;
669
- return j({
664
+ return O({
670
665
  instanceKey: e,
671
666
  extensions: [
672
- _(i),
673
- se({ key: t, duration: n, isValid: s, store: o })
667
+ q(i),
668
+ te({ key: t, duration: n, isValid: s, store: o })
674
669
  ]
675
670
  });
676
671
  }
677
- function Ie(r) {
672
+ function fe(r) {
678
673
  const { instanceKey: e, parallelCount: t, createId: n, retries: s, delay: o, retryCondition: i } = r;
679
- return j({
674
+ return O({
680
675
  instanceKey: e,
681
676
  extensions: [
682
- z({ parallelCount: t, createId: n }),
683
- T({ retries: s, delay: o, retryCondition: i })
677
+ K({ parallelCount: t, createId: n }),
678
+ F({ retries: s, delay: o, retryCondition: i })
684
679
  ]
685
680
  });
686
681
  }
687
682
  export {
688
- se as cache,
689
- z as concurrent,
690
- Ce as createCachedIdempotentRequestor,
691
- Ie as createConcurrentRetryRequestor,
692
- j as createRequestor,
693
- _ as idempotent,
694
- pe as inject,
695
- T as retry,
696
- we as sync,
697
- ue as useRequestor
683
+ te as cache,
684
+ K as concurrent,
685
+ ge as createCachedIdempotentRequestor,
686
+ fe as createConcurrentRetryRequestor,
687
+ O as createRequestor,
688
+ q as idempotent,
689
+ ye as inject,
690
+ F as retry,
691
+ me as sync,
692
+ ae as useRequestor
698
693
  };
@@ -1 +1 @@
1
- (function(c,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("id-queue")):typeof define=="function"&&define.amd?define(["exports","id-queue"],d):(c=typeof globalThis<"u"?globalThis:c||self,d(c.netVertCore={},c.idQueue))})(this,function(c,d){"use strict";var me=Object.defineProperty;var ye=(c,d,m)=>d in c?me(c,d,{enumerable:!0,configurable:!0,writable:!0,value:m}):c[d]=m;var h=(c,d,m)=>ye(c,typeof d!="symbol"?d+"":d,m);var m=(r=>(r.GET="get",r.POST="post",r.PUT="put",r.DELETE="delete",r))(m||{}),w=(r=>(r.CACHE="cache",r.RETRY="retry",r.IDEMPOTENT="idempotent",r.CONCURRENT="concurrent",r.SYNC="sync",r))(w||{});const P="default",B={retries:3,delay:0,retryCondition:()=>!0},V=r=>{const e={...B,...r};return Object.assign(async({config:n,next:s})=>{let o=0,a;for(;o<=e.retries;)try{return await s()}catch(i){if(a=i,o===e.retries)throw i;const u={config:n,lastResponse:i,attempt:o};if(!e.retryCondition(u))throw i;o++;const l=typeof e.delay=="function"?e.delay(u):e.delay;l>0&&await new Promise(y=>setTimeout(y,l))}throw a},{__middlewareType:w.RETRY})},K=()=>{const r=new Map;return{getPromise:o=>r.get(o),setPromise:(o,a)=>{r.set(o,a),a.finally(()=>r.delete(o))},delPromise:o=>r.delete(o),clearCache:()=>r.clear()}},_={key:r=>{const{config:e}=r,{method:t,url:n,data:s}=e;return[t,n,JSON.stringify(s)].join("|")}},x=r=>{const e={..._,...r},t=K();return Object.assign(({config:s,next:o})=>{const a=e.key({config:s}),i=t.getPromise(a);if(i)return i;const u=o();return t.setPromise(a,u),u},{__middlewareType:w.IDEMPOTENT,promiseCache:t})};class A{constructor(e=4){h(this,"parallelCount");h(this,"tasks");h(this,"runningCount");this.parallelCount=e,this.tasks=new d.TaskQueue,this.runningCount=0}add(e,t){return new Promise((n,s)=>{this.tasks.enqueue(e,{task:t,resolve:n,reject:s}),this._run()})}remove(e){this.tasks.remove(e)}execute(e){const{task:t,resolve:n,reject:s}=e;return t().then(n).catch(s).finally(()=>{this.runningCount--,this._run()})}_run(){for(;this.runningCount<this.parallelCount&&this.tasks.size>0;){const e=this.tasks.dequeue();this.runningCount++,this.execute(e)}}}let J=0;const z={parallelCount:4,createId:()=>J++},O=r=>{const{parallelCount:e,createId:t}={...z,...r},n=new A(e);return Object.assign(({config:o,next:a})=>{const i=t({config:o});return n.add(i,()=>a())},{__middlewareType:w.CONCURRENT,pool:n})},q=new Map,p=(r,e)=>{q.set(e,r)};function G(r){const e=q.get(r);if(!e)throw new Error(`Store实例 ${String(r)} 未注册`);return e}class U{constructor(){h(this,"store",new Map)}getItem(e){return this.store.get(e)}setItem(e,t){return this.store.set(e,t),t}removeItem(e){this.store.delete(e)}clear(){this.store.clear()}length(){return this.store.size}key(e){return Array.from(this.store.keys())[e]}keys(){return Array.from(this.store.keys())}iterate(e){let t=0;for(const[n,s]of this.store.entries())e(s,n,t),t++}}const M=r=>!!r&&(typeof r=="object"||typeof r=="function")&&typeof r.then=="function",j=r=>typeof window<"u"?r():{getItem(){return null},setItem(){},removeItem(){},clear(){},key(){return null},get length(){return 0}},f=j(()=>window.localStorage);class Y{constructor(){}getItem(e){const t=String(e),n=f.getItem(t);if(n!==null)try{return JSON.parse(n)}catch(s){console.error(`Failed to parse value for key: ${t}`,s);return}}setItem(e,t){const n=String(e);try{f.setItem(n,JSON.stringify(t))}catch(s){throw console.error(`Failed to set value for key: ${n}`,s),s}return t}removeItem(e){const t=String(e);f.removeItem(t)}clear(){f.clear()}length(){return f.length}key(e){return f.key(e)}keys(){const e=[];for(let t=0;t<f.length;t++){const n=f.key(t);n&&e.push(n)}return e}iterate(e){this.keys().forEach((t,n)=>{const s=this.getItem(t);s!==void 0&&e(s,t,n)})}}const g=j(()=>window.sessionStorage);class X{constructor(){}getItem(e){const t=String(e),n=g.getItem(t);if(n!==null)try{return JSON.parse(n)}catch(s){console.error(`Failed to parse value for key: ${t}`,s);return}}setItem(e,t){const n=String(e);try{g.setItem(n,JSON.stringify(t))}catch(s){throw console.error(`Failed to set value for key: ${n}`,s),s}return t}removeItem(e){const t=String(e);g.removeItem(t)}clear(){g.clear()}length(){return g.length}key(e){return g.key(e)}keys(){const e=[];for(let t=0;t<g.length;t++){const n=g.key(t);n&&e.push(n)}return e}iterate(e){this.keys().forEach((t,n)=>{const s=this.getItem(t);s!==void 0&&e(s,t,n)})}}class Z{constructor(e,t){h(this,"dbName");h(this,"storeName");h(this,"dbPromise",null);h(this,"DB_VERSION",1);this.dbName=e,this.storeName=t,this.initDB()}initDB(){if(typeof window>"u"||!window.indexedDB){console.warn("IndexedDB is not available");return}this.dbPromise=new Promise((e,t)=>{const n=indexedDB.open(this.dbName,this.DB_VERSION);n.onerror=()=>{t(new Error(`Failed to open database: ${this.dbName}`))},n.onsuccess=()=>{e(n.result)},n.onupgradeneeded=s=>{const o=s.target.result;o.objectStoreNames.contains(this.storeName)||o.createObjectStore(this.storeName)}})}async getDB(){if(!this.dbPromise)throw new Error("IndexedDB is not initialized");return this.dbPromise}async withStore(e,t){const n=await this.getDB();return new Promise((s,o)=>{const a=n.transaction([this.storeName],e).objectStore(this.storeName),i=t(a);i.onsuccess=()=>{s(i.result)},i.onerror=()=>{o(i.error)}})}async getItem(e){try{const t=await this.withStore("readonly",n=>n.get(String(e)));return t===void 0?void 0:t}catch(t){console.error(`Failed to get value for key: ${String(e)}`,t);return}}async setItem(e,t){try{return await this.withStore("readwrite",n=>n.put(t,String(e))),t}catch(n){throw console.error(`Failed to set value for key: ${String(e)}`,n),n}}async removeItem(e){try{await this.withStore("readwrite",t=>t.delete(String(e)))}catch(t){throw console.error(`Failed to remove value for key: ${String(e)}`,t),t}}async clear(){try{await this.withStore("readwrite",e=>e.clear())}catch(e){throw console.error("Failed to clear storage",e),e}}async length(){try{return await this.withStore("readonly",e=>e.count())}catch(e){return console.error("Failed to get storage length",e),0}}async key(e){try{return(await this.withStore("readonly",t=>t.getAllKeys()))[e]}catch(t){console.error("Failed to get key",t);return}}async keys(){try{return await this.withStore("readonly",e=>e.getAllKeys())}catch(e){return console.error("Failed to get all keys",e),[]}}async iterate(e){try{const t=(await this.getDB()).transaction([this.storeName],"readonly").objectStore(this.storeName).openCursor();return new Promise((n,s)=>{let o=0;t.onsuccess=a=>{const i=a.target.result;if(i){const u=i.key,l=i.value;e(l,u,o),o++,i.continue()}else n()},t.onerror=()=>{s(t.error)}})}catch(t){console.error("Failed to iterate storage",t)}}}const C={memory:"memory",local:"local",session:"session",indexeddb:"indexeddb"};function R(r,e){Object.assign(r,e)}function H(r){return R(r,{async getItemOrDefault(e,t){const n=await this.getItem(e);return n!==null?n:t},async hasItem(e){return await this.getItem(e)!==null},async removeItems(e){await Promise.all(e.map(t=>this.removeItem(t)))},async getItems(e){return await Promise.all(e.map(t=>this.getItem(t)))}}),r}function L(r){return R(r,{getItemOrDefault(e,t){const n=this.getItem(e);return n!==null?n:t},hasItem(e){return this.getItem(e)!==null},removeItems(e){e.forEach(t=>this.removeItem(t))},getItems(e){return e.map(t=>this.getItem(t))}}),r}function Q(r){const e=r.getItem("");return M(e)?H(r):L(r)}function I(r,...e){const t=G(r);let n;try{n=new t(...e)}catch{n=t(...e)}return Q(n)}p(U,C.memory),p(Y,C.local),p(X,C.session),p(Z,C.indexeddb);function k(r,e){return{value:r,expireAt:Date.now()+e}}function S(r,e=Date.now()){return r.expireAt<=e}function T(r,e=Date.now()){return S(r,e)?void 0:r.value}const W=r=>{const{config:e}=r,{method:t,url:n,data:s}=e;return[t,n,JSON.stringify(s)].join("|")},ee=()=>!0,b=24*60*60*1e3,te={key:W,duration:b,isValid:ee,store:C.memory},re=class{constructor(e){h(this,"store");return typeof e=="string"?this.store=I(e):(p(e.factory,e.key),this.store=I(e.key)),new Proxy(this,{get(t,n){if(n in t)return t[n];const s=t.store[n];return typeof s=="function"?s.bind(t.store):s}})}setCache(e,t,n=b){const s=k(t,n);this.store.setItem(e,s)}async getCache(e){const t=await this.store.getItem(e);if(t)return T(t)}async hasValidCache(e){const t=await this.store.getItem(e);return t?!S(t):!1}},D=r=>{const e={...te,...r},t=new re(e.store),n=o=>typeof e.duration=="function"?e.duration(o):e.duration;return Object.assign(async({config:o,next:a})=>{const i=e.key({config:o}),u=await t.getCache(i);if(u){if(await e.isValid({key:i,config:o,cachedData:u}))return u;t.removeItem(i)}const l=await a(),y=n({key:i,config:o,cachedData:u,response:l}),N=k(l,y);return t.setItem(i,N),l},{__middlewareType:w.CACHE,storage:t})};class ne{constructor(e){h(this,"store");return typeof e=="string"?this.store=I(e):(p(e.factory,e.key),this.store=I(e.key)),new Proxy(this,{get(t,n){if(n in t)return t[n];const s=t.store[n];return typeof s=="function"?s.bind(t.store):s}})}setCache(e,t,n=b){const s=k(t,n);this.store.setItem(e,s)}getCache(e){const t=this.store.getItem(e);if(t)return T(t)}hasValidCache(e){const t=this.store.getItem(e);return t?!S(t):!1}}const se=ne,oe={suspense:!0,key:r=>{const{config:e}=r,{method:t,url:n}=e;return[t,n].join("|")},duration:24*60*60*1e3,isValid:()=>!0,store:C.memory};function ie(r){const e={...oe,...r},t=new se(e.store),n=o=>typeof e.duration=="function"?e.duration(o):e.duration;return Object.assign(({config:o,next:a})=>{const i=e.key({config:o}),u=t.getCache(i);if(u){if(e.isValid({key:i,config:o,cachedData:u}))return u;t.removeItem(i)}if(e.suspense)throw(e.wrapSuspense?e.wrapSuspense({key:i,config:o,p:a()}):a()).then(y=>{const N=n({key:i,config:o,cachedData:u,response:y});return t.setCache(i,y,N),y});return a().then(l=>{const y=n({key:i,config:o,cachedData:u,response:l});return t.setCache(i,l,y),l})},{__middlewareType:w.SYNC})}const F=new Map,ae=(r,e=P)=>{F.set(e,r)},$=(r=P)=>{const e=F.get(r);if(!e)throw new Error(`Requestor实例 ${String(r)} 未注册`);return e},E={get:(r,e)=>({url:r,method:m.GET,...e,params:e==null?void 0:e.params}),post:(r,e,t)=>({url:r,method:m.POST,data:e,...t}),delete:(r,e)=>({url:r,method:m.DELETE,...e}),put:(r,e,t)=>({url:r,method:m.PUT,data:e,...t}),request:r=>r},ce=Object.keys(E);function ue(r,e,t){const n={},s=o=>{if(o===e.length)return t(r);const a=e[o];return a({config:r,ctx:n,next:()=>s(o+1)})};return s(0)}function le(r,e){const t={},n=e??[];return ce.forEach(s=>{t[s]=(...o)=>{const a=E[s](...o);return ue(a,n,r)}}),t}function v(r){const{extensions:e,instanceKey:t}=r??{},n=$(t);return le(n,e)}function de(r){const{instanceKey:e,key:t,duration:n,isValid:s,store:o,...a}=r;return v({instanceKey:e,extensions:[x(a),D({key:t,duration:n,isValid:s,store:o})]})}function he(r){const{instanceKey:e,parallelCount:t,createId:n,retries:s,delay:o,retryCondition:a}=r;return v({instanceKey:e,extensions:[O({parallelCount:t,createId:n}),V({retries:s,delay:o,retryCondition:a})]})}c.cache=D,c.concurrent=O,c.createCachedIdempotentRequestor=de,c.createConcurrentRetryRequestor=he,c.createRequestor=v,c.idempotent=x,c.inject=ae,c.retry=V,c.sync=ie,c.useRequestor=$,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(u,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("id-queue")):typeof define=="function"&&define.amd?define(["exports","id-queue"],w):(u=typeof globalThis<"u"?globalThis:u||self,w(u.netVertCore={},u.idQueue))})(this,function(u,w){"use strict";var p=(r=>(r.GET="get",r.POST="post",r.PUT="put",r.DELETE="delete",r))(p||{}),y=(r=>(r.CACHE="cache",r.RETRY="retry",r.IDEMPOTENT="idempotent",r.CONCURRENT="concurrent",r.SYNC="sync",r))(y||{});const N="default",E={retries:3,delay:0,retryCondition:()=>!0},P=r=>{const e={...E,...r};return Object.assign(async({config:n,next:s})=>{let o=0,a;for(;o<=e.retries;)try{return await s()}catch(i){if(a=i,o===e.retries)throw i;const c={config:n,lastResponse:i,attempt:o};if(!e.retryCondition(c))throw i;o++;const l=typeof e.delay=="function"?e.delay(c):e.delay;l>0&&await new Promise(d=>setTimeout(d,l))}throw a},{__middlewareType:y.RETRY})},B=()=>{const r=new Map;return{getPromise:o=>r.get(o),setPromise:(o,a)=>{r.set(o,a),a.finally(()=>r.delete(o))},delPromise:o=>r.delete(o),clearCache:()=>r.clear()}},K={key:r=>{const{config:e}=r,{method:t,url:n,data:s}=e;return[t,n,JSON.stringify(s)].join("|")}},V=r=>{const e={...K,...r},t=B();return Object.assign(({config:s,next:o})=>{const a=e.key({config:s}),i=t.getPromise(a);if(i)return i;const c=o();return t.setPromise(a,c),c},{__middlewareType:y.IDEMPOTENT,promiseCache:t})};class _{parallelCount;tasks;runningCount;constructor(e=4){this.parallelCount=e,this.tasks=new w.TaskQueue,this.runningCount=0}add(e,t){return new Promise((n,s)=>{this.tasks.enqueue(e,{task:t,resolve:n,reject:s}),this._run()})}remove(e){this.tasks.remove(e)}execute(e){const{task:t,resolve:n,reject:s}=e;return t().then(n).catch(s).finally(()=>{this.runningCount--,this._run()})}_run(){for(;this.runningCount<this.parallelCount&&this.tasks.size>0;){const e=this.tasks.dequeue();this.runningCount++,this.execute(e)}}}let A=0;const J={parallelCount:4,createId:()=>A++},x=r=>{const{parallelCount:e,createId:t}={...J,...r},n=new _(e);return Object.assign(({config:o,next:a})=>{const i=t({config:o});return n.add(i,()=>a())},{__middlewareType:y.CONCURRENT,pool:n})},O=new Map,f=(r,e)=>{O.set(e,r)};function z(r){const e=O.get(r);if(!e)throw new Error(`Store实例 ${String(r)} 未注册`);return e}class G{store=new Map;getItem(e){return this.store.get(e)}setItem(e,t){return this.store.set(e,t),t}removeItem(e){this.store.delete(e)}clear(){this.store.clear()}length(){return this.store.size}key(e){return Array.from(this.store.keys())[e]}keys(){return Array.from(this.store.keys())}iterate(e){let t=0;for(const[n,s]of this.store.entries())e(s,n,t),t++}}const U=r=>!!r&&(typeof r=="object"||typeof r=="function")&&typeof r.then=="function",q=r=>typeof window<"u"?r():{getItem(){return null},setItem(){},removeItem(){},clear(){},key(){return null},get length(){return 0}},h=q(()=>window.localStorage);class M{constructor(){}getItem(e){const t=String(e),n=h.getItem(t);if(n!==null)try{return JSON.parse(n)}catch(s){console.error(`Failed to parse value for key: ${t}`,s);return}}setItem(e,t){const n=String(e);try{h.setItem(n,JSON.stringify(t))}catch(s){throw console.error(`Failed to set value for key: ${n}`,s),s}return t}removeItem(e){const t=String(e);h.removeItem(t)}clear(){h.clear()}length(){return h.length}key(e){return h.key(e)}keys(){const e=[];for(let t=0;t<h.length;t++){const n=h.key(t);n&&e.push(n)}return e}iterate(e){this.keys().forEach((t,n)=>{const s=this.getItem(t);s!==void 0&&e(s,t,n)})}}const m=q(()=>window.sessionStorage);class Y{constructor(){}getItem(e){const t=String(e),n=m.getItem(t);if(n!==null)try{return JSON.parse(n)}catch(s){console.error(`Failed to parse value for key: ${t}`,s);return}}setItem(e,t){const n=String(e);try{m.setItem(n,JSON.stringify(t))}catch(s){throw console.error(`Failed to set value for key: ${n}`,s),s}return t}removeItem(e){const t=String(e);m.removeItem(t)}clear(){m.clear()}length(){return m.length}key(e){return m.key(e)}keys(){const e=[];for(let t=0;t<m.length;t++){const n=m.key(t);n&&e.push(n)}return e}iterate(e){this.keys().forEach((t,n)=>{const s=this.getItem(t);s!==void 0&&e(s,t,n)})}}class X{dbName;storeName;dbPromise=null;DB_VERSION=1;constructor(e,t){this.dbName=e,this.storeName=t,this.initDB()}initDB(){if(typeof window>"u"||!window.indexedDB){console.warn("IndexedDB is not available");return}this.dbPromise=new Promise((e,t)=>{const n=indexedDB.open(this.dbName,this.DB_VERSION);n.onerror=()=>{t(new Error(`Failed to open database: ${this.dbName}`))},n.onsuccess=()=>{e(n.result)},n.onupgradeneeded=s=>{const o=s.target.result;o.objectStoreNames.contains(this.storeName)||o.createObjectStore(this.storeName)}})}async getDB(){if(!this.dbPromise)throw new Error("IndexedDB is not initialized");return this.dbPromise}async withStore(e,t){const n=await this.getDB();return new Promise((s,o)=>{const a=n.transaction([this.storeName],e).objectStore(this.storeName),i=t(a);i.onsuccess=()=>{s(i.result)},i.onerror=()=>{o(i.error)}})}async getItem(e){try{const t=await this.withStore("readonly",n=>n.get(String(e)));return t===void 0?void 0:t}catch(t){console.error(`Failed to get value for key: ${String(e)}`,t);return}}async setItem(e,t){try{return await this.withStore("readwrite",n=>n.put(t,String(e))),t}catch(n){throw console.error(`Failed to set value for key: ${String(e)}`,n),n}}async removeItem(e){try{await this.withStore("readwrite",t=>t.delete(String(e)))}catch(t){throw console.error(`Failed to remove value for key: ${String(e)}`,t),t}}async clear(){try{await this.withStore("readwrite",e=>e.clear())}catch(e){throw console.error("Failed to clear storage",e),e}}async length(){try{return await this.withStore("readonly",e=>e.count())}catch(e){return console.error("Failed to get storage length",e),0}}async key(e){try{return(await this.withStore("readonly",t=>t.getAllKeys()))[e]}catch(t){console.error("Failed to get key",t);return}}async keys(){try{return await this.withStore("readonly",e=>e.getAllKeys())}catch(e){return console.error("Failed to get all keys",e),[]}}async iterate(e){try{const t=(await this.getDB()).transaction([this.storeName],"readonly").objectStore(this.storeName).openCursor();return new Promise((n,s)=>{let o=0;t.onsuccess=a=>{const i=a.target.result;if(i){const c=i.key,l=i.value;e(l,c,o),o++,i.continue()}else n()},t.onerror=()=>{s(t.error)}})}catch(t){console.error("Failed to iterate storage",t)}}}const g={memory:"memory",local:"local",session:"session",indexeddb:"indexeddb"};function j(r,e){Object.assign(r,e)}function Z(r){return j(r,{async getItemOrDefault(e,t){const n=await this.getItem(e);return n!==null?n:t},async hasItem(e){return await this.getItem(e)!==null},async removeItems(e){await Promise.all(e.map(t=>this.removeItem(t)))},async getItems(e){return await Promise.all(e.map(t=>this.getItem(t)))}}),r}function H(r){return j(r,{getItemOrDefault(e,t){const n=this.getItem(e);return n!==null?n:t},hasItem(e){return this.getItem(e)!==null},removeItems(e){e.forEach(t=>this.removeItem(t))},getItems(e){return e.map(t=>this.getItem(t))}}),r}function L(r){const e=r.getItem("");return U(e)?Z(r):H(r)}function C(r,...e){const t=z(r);let n;try{n=new t(...e)}catch{n=t(...e)}return L(n)}f(G,g.memory),f(M,g.local),f(Y,g.session),f(X,g.indexeddb);function I(r,e){return{value:r,expireAt:Date.now()+e}}function k(r,e=Date.now()){return r.expireAt<=e}function R(r,e=Date.now()){return k(r,e)?void 0:r.value}const Q=r=>{const{config:e}=r,{method:t,url:n,data:s}=e;return[t,n,JSON.stringify(s)].join("|")},W=()=>!0,S=24*60*60*1e3,ee={key:Q,duration:S,isValid:W,store:g.memory},te=class{store;constructor(e){return typeof e=="string"?this.store=C(e):(f(e.factory,e.key),this.store=C(e.key)),new Proxy(this,{get(t,n){if(n in t)return t[n];const s=t.store[n];return typeof s=="function"?s.bind(t.store):s}})}setCache(e,t,n=S){const s=I(t,n);this.store.setItem(e,s)}async getCache(e){const t=await this.store.getItem(e);if(t)return R(t)}async hasValidCache(e){const t=await this.store.getItem(e);return t?!k(t):!1}},T=r=>{const e={...ee,...r},t=new te(e.store),n=o=>typeof e.duration=="function"?e.duration(o):e.duration;return Object.assign(async({config:o,next:a})=>{const i=e.key({config:o}),c=await t.getCache(i);if(c){if(await e.isValid({key:i,config:o,cachedData:c}))return c;t.removeItem(i)}const l=await a(),d=n({key:i,config:o,cachedData:c,response:l}),v=I(l,d);return t.setItem(i,v),l},{__middlewareType:y.CACHE,storage:t})};class re{store;constructor(e){return typeof e=="string"?this.store=C(e):(f(e.factory,e.key),this.store=C(e.key)),new Proxy(this,{get(t,n){if(n in t)return t[n];const s=t.store[n];return typeof s=="function"?s.bind(t.store):s}})}setCache(e,t,n=S){const s=I(t,n);this.store.setItem(e,s)}getCache(e){const t=this.store.getItem(e);if(t)return R(t)}hasValidCache(e){const t=this.store.getItem(e);return t?!k(t):!1}}const ne=re,se={suspense:!0,key:r=>{const{config:e}=r,{method:t,url:n}=e;return[t,n].join("|")},duration:24*60*60*1e3,isValid:()=>!0,store:g.memory};function oe(r){const e={...se,...r},t=new ne(e.store),n=o=>typeof e.duration=="function"?e.duration(o):e.duration;return Object.assign(({config:o,next:a})=>{const i=e.key({config:o}),c=t.getCache(i);if(c){if(e.isValid({key:i,config:o,cachedData:c}))return c;t.removeItem(i)}if(e.suspense)throw(e.wrapSuspense?e.wrapSuspense({key:i,config:o,p:a()}):a()).then(d=>{const v=n({key:i,config:o,cachedData:c,response:d});return t.setCache(i,d,v),d});return a().then(l=>{const d=n({key:i,config:o,cachedData:c,response:l});return t.setCache(i,l,d),l})},{__middlewareType:y.SYNC})}const D=new Map,ie=(r,e=N)=>{D.set(e,r)},F=(r=N)=>{const e=D.get(r);if(!e)throw new Error(`Requestor实例 ${String(r)} 未注册`);return e},$={get:(r,e)=>({url:r,method:p.GET,...e,params:e?.params}),post:(r,e,t)=>({url:r,method:p.POST,data:e,...t}),delete:(r,e)=>({url:r,method:p.DELETE,...e}),put:(r,e,t)=>({url:r,method:p.PUT,data:e,...t}),request:r=>r},ae=Object.keys($);function ce(r,e,t){const n={},s=o=>{if(o===e.length)return t(r);const a=e[o];return a({config:r,ctx:n,next:()=>s(o+1)})};return s(0)}function ue(r,e){const t={},n=e??[];return ae.forEach(s=>{t[s]=(...o)=>{const a=$[s](...o);return ce(a,n,r)}}),t}function b(r){const{extensions:e,instanceKey:t}=r??{},n=F(t);return ue(n,e)}function le(r){const{instanceKey:e,key:t,duration:n,isValid:s,store:o,...a}=r;return b({instanceKey:e,extensions:[V(a),T({key:t,duration:n,isValid:s,store:o})]})}function de(r){const{instanceKey:e,parallelCount:t,createId:n,retries:s,delay:o,retryCondition:a}=r;return b({instanceKey:e,extensions:[x({parallelCount:t,createId:n}),P({retries:s,delay:o,retryCondition:a})]})}u.cache=T,u.concurrent=x,u.createCachedIdempotentRequestor=le,u.createConcurrentRetryRequestor=de,u.createRequestor=b,u.idempotent=V,u.inject=ie,u.retry=P,u.sync=oe,u.useRequestor=F,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
1
  {
2
- "name": "@net-vert/core",
3
- "version": "1.2.0",
4
- "description": "Dependency Inversion Network Library with Type-Safe Injection.",
5
- "main": "dist/index",
6
- "type": "module",
7
- "types": "dist/index.d.ts",
8
- "scripts": {
9
- "test": "vitest run",
10
- "build": "run-p type-check build-only",
11
- "build-only": "vite build",
12
- "type-check": "tsc --noEmit"
13
- },
14
- "files": [
15
- "dist"
16
- ],
17
- "sideEffects": false,
18
- "keywords": [
19
- "dependency-injection",
20
- "di",
21
- "network-library",
22
- "adapter-pattern",
23
- "extensible",
24
- "http-client",
25
- "lightweight"
26
- ],
27
- "author": "yuzinan <1589937631@qq.com>",
28
- "license": "MIT",
29
- "publishConfig": {
30
- "access": "public"
31
- },
32
- "dependencies": {
33
- "id-queue": "^1.1.1",
34
- "store-vert": "^0.1.2"
35
- }
2
+ "name": "@net-vert/core",
3
+ "version": "1.2.1",
4
+ "description": "Dependency Inversion Network Library with Type-Safe Injection.",
5
+ "main": "dist/index",
6
+ "type": "module",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "test": "vitest run",
10
+ "build": "run-p type-check build-only",
11
+ "build-only": "vite build",
12
+ "type-check": "tsc --noEmit"
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "sideEffects": false,
18
+ "keywords": [
19
+ "dependency-injection",
20
+ "di",
21
+ "network-library",
22
+ "adapter-pattern",
23
+ "extensible",
24
+ "http-client",
25
+ "lightweight"
26
+ ],
27
+ "author": "yuzinan <1589937631@qq.com>",
28
+ "license": "MIT",
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "dependencies": {
33
+ "id-queue": "^1.1.1",
34
+ "store-vert": "^0.2.0"
35
+ }
36
36
  }