@ahoo-wang/fetcher-decorator 0.5.0 → 0.5.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/README.md CHANGED
@@ -93,7 +93,6 @@ Defines API metadata for a class.
93
93
  **Example:**
94
94
 
95
95
  ```typescript
96
-
97
96
  @api('/api/v1', {
98
97
  headers: { 'X-API-Version': '1.0' },
99
98
  timeout: 5000,
@@ -213,7 +212,6 @@ class UserService {
213
212
  ### Inheritance Support
214
213
 
215
214
  ```typescript
216
-
217
215
  @api('/base')
218
216
  class BaseService {
219
217
  @get('/status')
@@ -234,7 +232,6 @@ class UserService extends BaseService {
234
232
  ### Complex Parameter Handling
235
233
 
236
234
  ```typescript
237
-
238
235
  @api('/api')
239
236
  class ComplexService {
240
237
  @post('/batch')
package/README.zh-CN.md CHANGED
@@ -92,7 +92,6 @@ const response = await userService.createUser({ name: 'John' });
92
92
  **示例:**
93
93
 
94
94
  ```typescript
95
-
96
95
  @api('/api/v1', {
97
96
  headers: { 'X-API-Version': '1.0' },
98
97
  timeout: 5000,
@@ -212,7 +211,6 @@ class UserService {
212
211
  ### 继承支持
213
212
 
214
213
  ```typescript
215
-
216
214
  @api('/base')
217
215
  class BaseService {
218
216
  @get('/status')
@@ -233,7 +231,6 @@ class UserService extends BaseService {
233
231
  ### 复杂参数处理
234
232
 
235
233
  ```typescript
236
-
237
234
  @api('/api')
238
235
  class ComplexService {
239
236
  @post('/batch')
package/dist/index.es.js CHANGED
@@ -28,7 +28,7 @@ function Le() {
28
28
  Object.defineProperty(A, k, { configurable: !0, writable: !0, value: C }), j && j(k, C);
29
29
  };
30
30
  }
31
- function m() {
31
+ function M() {
32
32
  try {
33
33
  return Function("return this;")();
34
34
  } catch {
@@ -41,10 +41,10 @@ function Le() {
41
41
  }
42
42
  }
43
43
  function I() {
44
- return m() || E();
44
+ return M() || E();
45
45
  }
46
46
  })(function(d, l) {
47
- var p = Object.prototype.hasOwnProperty, O = typeof Symbol == "function", m = O && typeof Symbol.toPrimitive < "u" ? Symbol.toPrimitive : "@@toPrimitive", E = O && typeof Symbol.iterator < "u" ? Symbol.iterator : "@@iterator", I = typeof Object.create == "function", A = { __proto__: [] } instanceof Array, j = !I && !A, k = {
47
+ var p = Object.prototype.hasOwnProperty, O = typeof Symbol == "function", M = O && typeof Symbol.toPrimitive < "u" ? Symbol.toPrimitive : "@@toPrimitive", E = O && typeof Symbol.iterator < "u" ? Symbol.iterator : "@@iterator", I = typeof Object.create == "function", A = { __proto__: [] } instanceof Array, j = !I && !A, k = {
48
48
  // create an object in dictionary mode (a.k.a. "slow" mode in v8)
49
49
  create: I ? function() {
50
50
  return z(/* @__PURE__ */ Object.create(null));
@@ -93,18 +93,18 @@ function Le() {
93
93
  return r;
94
94
  }
95
95
  d("metadata", _e);
96
- function Me(e, t, r, n) {
96
+ function me(e, t, r, n) {
97
97
  if (!g(r))
98
98
  throw new TypeError();
99
99
  return h(n) || (n = T(n)), K(e, t, r, n);
100
100
  }
101
- d("defineMetadata", Me);
102
- function me(e, t, r) {
101
+ d("defineMetadata", me);
102
+ function Me(e, t, r) {
103
103
  if (!g(t))
104
104
  throw new TypeError();
105
105
  return h(r) || (r = T(r)), J(e, t, r);
106
106
  }
107
- d("hasMetadata", me);
107
+ d("hasMetadata", Me);
108
108
  function ge(e, t, r) {
109
109
  if (!g(t))
110
110
  throw new TypeError();
@@ -290,7 +290,7 @@ function Le() {
290
290
  case 5:
291
291
  return e;
292
292
  }
293
- var r = "string", n = oe(e, m);
293
+ var r = "string", n = oe(e, M);
294
294
  if (n !== void 0) {
295
295
  var c = n.call(e, r);
296
296
  if (g(c))
@@ -426,10 +426,10 @@ function Le() {
426
426
  return t;
427
427
  if (!h(n))
428
428
  for (var w = ue(n); ; ) {
429
- var M = se(w);
430
- if (!M)
429
+ var m = se(w);
430
+ if (!m)
431
431
  return;
432
- var P = fe(M);
432
+ var P = fe(m);
433
433
  if (P.isProviderFor(s, y))
434
434
  return ce(w), P;
435
435
  }
@@ -439,8 +439,8 @@ function Le() {
439
439
  return e;
440
440
  }
441
441
  function i(s, y) {
442
- var w = c.get(s), M;
443
- return h(w) || (M = w.get(y)), h(M) && (M = v(s, y), h(M) || (h(w) && (w = new G(), c.set(s, w)), w.set(y, M))), M;
442
+ var w = c.get(s), m;
443
+ return h(w) || (m = w.get(y)), h(m) && (m = v(s, y), h(m) || (h(w) && (w = new G(), c.set(s, w)), w.set(y, m))), m;
444
444
  }
445
445
  function o(s) {
446
446
  if (h(s))
@@ -450,9 +450,9 @@ function Le() {
450
450
  function u(s, y, w) {
451
451
  if (!o(w))
452
452
  throw new Error("Metadata provider not registered.");
453
- var M = i(s, y);
454
- if (M !== w) {
455
- if (!h(M))
453
+ var m = i(s, y);
454
+ if (m !== w) {
455
+ if (!h(m))
456
456
  return !1;
457
457
  var P = c.get(s);
458
458
  h(P) && (P = new G(), c.set(s, P)), P.set(y, w);
@@ -489,14 +489,14 @@ function Le() {
489
489
  return;
490
490
  y = new G(), t.set(o, y), w = !0;
491
491
  }
492
- var M = y.get(u);
493
- if (h(M)) {
492
+ var m = y.get(u);
493
+ if (h(m)) {
494
494
  if (!s)
495
495
  return;
496
- if (M = new G(), y.set(u, M), !e.setProvider(o, u, r))
496
+ if (m = new G(), y.set(u, m), !e.setProvider(o, u, r))
497
497
  throw y.delete(u), w && t.delete(o), new Error("Wrong provider for target.");
498
498
  }
499
- return M;
499
+ return m;
500
500
  }
501
501
  function c(o, u, s) {
502
502
  var y = n(
@@ -535,8 +535,8 @@ function Le() {
535
535
  );
536
536
  if (h(y))
537
537
  return s;
538
- for (var w = y.keys(), M = ue(w), P = 0; ; ) {
539
- var de = se(M);
538
+ for (var w = y.keys(), m = ue(w), P = 0; ; ) {
539
+ var de = se(m);
540
540
  if (!de)
541
541
  return s.length = P, s;
542
542
  var We = fe(de);
@@ -544,7 +544,7 @@ function Le() {
544
544
  s[P] = We;
545
545
  } catch (Ne) {
546
546
  try {
547
- ce(M);
547
+ ce(m);
548
548
  } finally {
549
549
  throw Ne;
550
550
  }
@@ -931,14 +931,14 @@ function W(a, f = "") {
931
931
  l,
932
932
  p,
933
933
  f
934
- ), m = Reflect.getMetadata(Q, d, l) || [];
935
- m.push({
934
+ ), M = Reflect.getMetadata(Q, d, l) || [];
935
+ M.push({
936
936
  type: a,
937
937
  name: O,
938
938
  index: p
939
939
  }), Reflect.defineMetadata(
940
940
  Q,
941
- m,
941
+ M,
942
942
  d,
943
943
  l
944
944
  );
@@ -953,7 +953,7 @@ function wt(a = "") {
953
953
  function _t(a = "") {
954
954
  return W("header", a);
955
955
  }
956
- function Mt() {
956
+ function mt() {
957
957
  return W(
958
958
  "body"
959
959
  /* BODY */
@@ -999,23 +999,24 @@ class nt {
999
999
  ...this.endpoint.headers
1000
1000
  };
1001
1001
  let O = null;
1002
- return this.parameters.forEach((m) => {
1003
- const E = f[m.index];
1004
- switch (m.type) {
1002
+ return this.parameters.forEach((M) => {
1003
+ const E = f[M.index];
1004
+ switch (M.type) {
1005
1005
  case H.PATH:
1006
- m.name ? d[m.name] = E : d["param" + m.index] = E;
1006
+ M.name ? d[M.name] = E : d["param" + M.index] = E;
1007
1007
  break;
1008
1008
  case H.QUERY:
1009
- m.name ? l[m.name] = E : l["param" + m.index] = E;
1009
+ M.name ? l[M.name] = E : l["param" + M.index] = E;
1010
1010
  break;
1011
1011
  case H.HEADER:
1012
- m.name && E !== void 0 && (p[m.name] = String(E));
1012
+ M.name && E !== void 0 && (p[M.name] = String(E));
1013
1013
  break;
1014
1014
  case H.BODY:
1015
1015
  O = E;
1016
1016
  break;
1017
1017
  }
1018
1018
  }), {
1019
+ method: this.endpoint.method,
1019
1020
  pathParams: d,
1020
1021
  queryParams: l,
1021
1022
  headers: p,
@@ -1086,17 +1087,17 @@ function ot(a, f, d) {
1086
1087
  Q,
1087
1088
  a.prototype,
1088
1089
  f
1089
- ) || [], m = new nt(
1090
+ ) || [], M = new nt(
1090
1091
  f,
1091
1092
  d,
1092
1093
  p,
1093
1094
  O
1094
- ), E = new at(m);
1095
+ ), E = new at(M);
1095
1096
  a.prototype[f] = function(...I) {
1096
1097
  return E.execute(I);
1097
1098
  };
1098
1099
  }
1099
- function mt(a = "", f = {}) {
1100
+ function Mt(a = "", f = {}) {
1100
1101
  return function(d) {
1101
1102
  const l = {
1102
1103
  basePath: a,
@@ -1121,9 +1122,9 @@ export {
1121
1122
  Q as PARAMETER_METADATA_KEY,
1122
1123
  H as ParameterType,
1123
1124
  at as RequestExecutor,
1124
- mt as api,
1125
+ Mt as api,
1125
1126
  gt as autoGeneratedError,
1126
- Mt as body,
1127
+ mt as body,
1127
1128
  lt as del,
1128
1129
  x as endpoint,
1129
1130
  st as get,
package/dist/index.umd.js CHANGED
@@ -11,4 +11,4 @@
11
11
 
12
12
  See the Apache Version 2.0 License for specific language governing permissions
13
13
  and limitations under the License.
14
- ***************************************************************************** */var K;function Ee(){if(K)return $;K=1;var a;return(function(f){(function(d){var l=typeof globalThis=="object"?globalThis:typeof X=="object"?X:typeof self=="object"?self:typeof this=="object"?this:D(),w=E(f);typeof l.Reflect<"u"&&(w=E(l.Reflect,w)),d(w,l),typeof l.Reflect>"u"&&(l.Reflect=f);function E(j,q){return function(I,x){Object.defineProperty(j,I,{configurable:!0,writable:!0,value:x}),q&&q(I,x)}}function g(){try{return Function("return this;")()}catch{}}function T(){try{return(0,eval)("(function() { return this; })()")}catch{}}function D(){return g()||T()}})(function(d,l){var w=Object.prototype.hasOwnProperty,E=typeof Symbol=="function",g=E&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",T=E&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",D=typeof Object.create=="function",j={__proto__:[]}instanceof Array,q=!D&&!j,I={create:D?function(){return J(Object.create(null))}:j?function(){return J({__proto__:null})}:function(){return J({})},has:q?function(e,t){return w.call(e,t)}:function(e,t){return t in e},get:q?function(e,t){return w.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},x=Object.getPrototypeOf(Function),F=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:yt(),B=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:vt(),L=typeof WeakMap=="function"?WeakMap:pt(),C=E?Symbol.for("@reflect-metadata:registry"):void 0,W=dt(),ue=lt(W);function ze(e,t,n,r){if(h(n)){if(!pe(e))throw new TypeError;if(!we(t))throw new TypeError;return rt(e,t)}else{if(!pe(e))throw new TypeError;if(!b(t))throw new TypeError;if(!b(r)&&!h(r)&&!G(r))throw new TypeError;return G(r)&&(r=void 0),n=R(n),at(e,t,n,r)}}d("decorate",ze);function Qe(e,t){function n(r,c){if(!b(r))throw new TypeError;if(!h(c)&&!st(c))throw new TypeError;de(e,t,r,c)}return n}d("metadata",Qe);function Ze(e,t,n,r){if(!b(n))throw new TypeError;return h(r)||(r=R(r)),de(e,t,n,r)}d("defineMetadata",Ze);function Je(e,t,n){if(!b(t))throw new TypeError;return h(n)||(n=R(n)),fe(e,t,n)}d("hasMetadata",Je);function Xe(e,t,n){if(!b(t))throw new TypeError;return h(n)||(n=R(n)),z(e,t,n)}d("hasOwnMetadata",Xe);function $e(e,t,n){if(!b(t))throw new TypeError;return h(n)||(n=R(n)),se(e,t,n)}d("getMetadata",$e);function Ke(e,t,n){if(!b(t))throw new TypeError;return h(n)||(n=R(n)),ce(e,t,n)}d("getOwnMetadata",Ke);function et(e,t){if(!b(e))throw new TypeError;return h(t)||(t=R(t)),le(e,t)}d("getMetadataKeys",et);function tt(e,t){if(!b(e))throw new TypeError;return h(t)||(t=R(t)),he(e,t)}d("getOwnMetadataKeys",tt);function nt(e,t,n){if(!b(t))throw new TypeError;if(h(n)||(n=R(n)),!b(t))throw new TypeError;h(n)||(n=R(n));var r=N(t,n,!1);return h(r)?!1:r.OrdinaryDeleteMetadata(e,t,n)}d("deleteMetadata",nt);function rt(e,t){for(var n=e.length-1;n>=0;--n){var r=e[n],c=r(t);if(!h(c)&&!G(c)){if(!we(c))throw new TypeError;t=c}}return t}function at(e,t,n,r){for(var c=e.length-1;c>=0;--c){var _=e[c],O=_(t,n,r);if(!h(O)&&!G(O)){if(!b(O))throw new TypeError;r=O}}return r}function fe(e,t,n){var r=z(e,t,n);if(r)return!0;var c=Z(t);return G(c)?!1:fe(e,c,n)}function z(e,t,n){var r=N(t,n,!1);return h(r)?!1:ve(r.OrdinaryHasOwnMetadata(e,t,n))}function se(e,t,n){var r=z(e,t,n);if(r)return ce(e,t,n);var c=Z(t);if(!G(c))return se(e,c,n)}function ce(e,t,n){var r=N(t,n,!1);if(!h(r))return r.OrdinaryGetOwnMetadata(e,t,n)}function de(e,t,n,r){var c=N(n,r,!0);c.OrdinaryDefineOwnMetadata(e,t,n,r)}function le(e,t){var n=he(e,t),r=Z(e);if(r===null)return n;var c=le(r,t);if(c.length<=0)return n;if(n.length<=0)return c;for(var _=new B,O=[],y=0,i=n;y<i.length;y++){var o=i[y],u=_.has(o);u||(_.add(o),O.push(o))}for(var s=0,v=c;s<v.length;s++){var o=v[s],u=_.has(o);u||(_.add(o),O.push(o))}return O}function he(e,t){var n=N(e,t,!1);return n?n.OrdinaryOwnMetadataKeys(e,t):[]}function ye(e){if(e===null)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return e===null?1:6;default:return 6}}function h(e){return e===void 0}function G(e){return e===null}function it(e){return typeof e=="symbol"}function b(e){return typeof e=="object"?e!==null:typeof e=="function"}function ot(e,t){switch(ye(e)){case 0:return e;case 1:return e;case 2:return e;case 3:return e;case 4:return e;case 5:return e}var n="string",r=Me(e,g);if(r!==void 0){var c=r.call(e,n);if(b(c))throw new TypeError;return c}return ut(e)}function ut(e,t){var n,r,c;{var _=e.toString;if(Y(_)){var r=_.call(e);if(!b(r))return r}var n=e.valueOf;if(Y(n)){var r=n.call(e);if(!b(r))return r}}throw new TypeError}function ve(e){return!!e}function ft(e){return""+e}function R(e){var t=ot(e);return it(t)?t:ft(t)}function pe(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:Object.prototype.toString.call(e)==="[object Array]"}function Y(e){return typeof e=="function"}function we(e){return typeof e=="function"}function st(e){switch(ye(e)){case 3:return!0;case 4:return!0;default:return!1}}function Q(e,t){return e===t||e!==e&&t!==t}function Me(e,t){var n=e[t];if(n!=null){if(!Y(n))throw new TypeError;return n}}function _e(e){var t=Me(e,T);if(!Y(t))throw new TypeError;var n=t.call(e);if(!b(n))throw new TypeError;return n}function me(e){return e.value}function ge(e){var t=e.next();return t.done?!1:t}function be(e){var t=e.return;t&&t.call(e)}function Z(e){var t=Object.getPrototypeOf(e);if(typeof e!="function"||e===x||t!==x)return t;var n=e.prototype,r=n&&Object.getPrototypeOf(n);if(r==null||r===Object.prototype)return t;var c=r.constructor;return typeof c!="function"||c===e?t:c}function ct(){var e;!h(C)&&typeof l.Reflect<"u"&&!(C in l.Reflect)&&typeof l.Reflect.defineMetadata=="function"&&(e=ht(l.Reflect));var t,n,r,c=new L,_={registerProvider:O,getProvider:i,setProvider:u};return _;function O(s){if(!Object.isExtensible(_))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===s:break;case h(t):t=s;break;case t===s:break;case h(n):n=s;break;case n===s:break;default:r===void 0&&(r=new B),r.add(s);break}}function y(s,v){if(!h(t)){if(t.isProviderFor(s,v))return t;if(!h(n)){if(n.isProviderFor(s,v))return t;if(!h(r))for(var M=_e(r);;){var m=ge(M);if(!m)return;var k=me(m);if(k.isProviderFor(s,v))return be(M),k}}}if(!h(e)&&e.isProviderFor(s,v))return e}function i(s,v){var M=c.get(s),m;return h(M)||(m=M.get(v)),h(m)&&(m=y(s,v),h(m)||(h(M)&&(M=new F,c.set(s,M)),M.set(v,m))),m}function o(s){if(h(s))throw new TypeError;return t===s||n===s||!h(r)&&r.has(s)}function u(s,v,M){if(!o(M))throw new Error("Metadata provider not registered.");var m=i(s,v);if(m!==M){if(!h(m))return!1;var k=c.get(s);h(k)&&(k=new F,c.set(s,k)),k.set(v,M)}return!0}}function dt(){var e;return!h(C)&&b(l.Reflect)&&Object.isExtensible(l.Reflect)&&(e=l.Reflect[C]),h(e)&&(e=ct()),!h(C)&&b(l.Reflect)&&Object.isExtensible(l.Reflect)&&Object.defineProperty(l.Reflect,C,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}function lt(e){var t=new L,n={isProviderFor:function(o,u){var s=t.get(o);return h(s)?!1:s.has(u)},OrdinaryDefineOwnMetadata:O,OrdinaryHasOwnMetadata:c,OrdinaryGetOwnMetadata:_,OrdinaryOwnMetadataKeys:y,OrdinaryDeleteMetadata:i};return W.registerProvider(n),n;function r(o,u,s){var v=t.get(o),M=!1;if(h(v)){if(!s)return;v=new F,t.set(o,v),M=!0}var m=v.get(u);if(h(m)){if(!s)return;if(m=new F,v.set(u,m),!e.setProvider(o,u,n))throw v.delete(u),M&&t.delete(o),new Error("Wrong provider for target.")}return m}function c(o,u,s){var v=r(u,s,!1);return h(v)?!1:ve(v.has(o))}function _(o,u,s){var v=r(u,s,!1);if(!h(v))return v.get(o)}function O(o,u,s,v){var M=r(s,v,!0);M.set(o,u)}function y(o,u){var s=[],v=r(o,u,!1);if(h(v))return s;for(var M=v.keys(),m=_e(M),k=0;;){var Oe=ge(m);if(!Oe)return s.length=k,s;var wt=me(Oe);try{s[k]=wt}catch(Mt){try{be(m)}finally{throw Mt}}k++}}function i(o,u,s){var v=r(u,s,!1);if(h(v)||!v.delete(o))return!1;if(v.size===0){var M=t.get(u);h(M)||(M.delete(s),M.size===0&&t.delete(M))}return!0}}function ht(e){var t=e.defineMetadata,n=e.hasOwnMetadata,r=e.getOwnMetadata,c=e.getOwnMetadataKeys,_=e.deleteMetadata,O=new L,y={isProviderFor:function(i,o){var u=O.get(i);return!h(u)&&u.has(o)?!0:c(i,o).length?(h(u)&&(u=new B,O.set(i,u)),u.add(o),!0):!1},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:n,OrdinaryGetOwnMetadata:r,OrdinaryOwnMetadataKeys:c,OrdinaryDeleteMetadata:_};return y}function N(e,t,n){var r=W.getProvider(e,t);if(!h(r))return r;if(n){if(W.setProvider(e,t,ue))return ue;throw new Error("Illegal state.")}}function yt(){var e={},t=[],n=(function(){function y(i,o,u){this._index=0,this._keys=i,this._values=o,this._selector=u}return y.prototype["@@iterator"]=function(){return this},y.prototype[T]=function(){return this},y.prototype.next=function(){var i=this._index;if(i>=0&&i<this._keys.length){var o=this._selector(this._keys[i],this._values[i]);return i+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:o,done:!1}}return{value:void 0,done:!0}},y.prototype.throw=function(i){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),i},y.prototype.return=function(i){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:i,done:!0}},y})(),r=(function(){function y(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(y.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),y.prototype.has=function(i){return this._find(i,!1)>=0},y.prototype.get=function(i){var o=this._find(i,!1);return o>=0?this._values[o]:void 0},y.prototype.set=function(i,o){var u=this._find(i,!0);return this._values[u]=o,this},y.prototype.delete=function(i){var o=this._find(i,!1);if(o>=0){for(var u=this._keys.length,s=o+1;s<u;s++)this._keys[s-1]=this._keys[s],this._values[s-1]=this._values[s];return this._keys.length--,this._values.length--,Q(i,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},y.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},y.prototype.keys=function(){return new n(this._keys,this._values,c)},y.prototype.values=function(){return new n(this._keys,this._values,_)},y.prototype.entries=function(){return new n(this._keys,this._values,O)},y.prototype["@@iterator"]=function(){return this.entries()},y.prototype[T]=function(){return this.entries()},y.prototype._find=function(i,o){if(!Q(this._cacheKey,i)){this._cacheIndex=-1;for(var u=0;u<this._keys.length;u++)if(Q(this._keys[u],i)){this._cacheIndex=u;break}}return this._cacheIndex<0&&o&&(this._cacheIndex=this._keys.length,this._keys.push(i),this._values.push(void 0)),this._cacheIndex},y})();return r;function c(y,i){return y}function _(y,i){return i}function O(y,i){return[y,i]}}function vt(){var e=(function(){function t(){this._map=new F}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(n){return this._map.has(n)},t.prototype.add=function(n){return this._map.set(n,n),this},t.prototype.delete=function(n){return this._map.delete(n)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.keys()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[T]=function(){return this.keys()},t})();return e}function pt(){var e=16,t=I.create(),n=r();return(function(){function i(){this._key=r()}return i.prototype.has=function(o){var u=c(o,!1);return u!==void 0?I.has(u,this._key):!1},i.prototype.get=function(o){var u=c(o,!1);return u!==void 0?I.get(u,this._key):void 0},i.prototype.set=function(o,u){var s=c(o,!0);return s[this._key]=u,this},i.prototype.delete=function(o){var u=c(o,!1);return u!==void 0?delete u[this._key]:!1},i.prototype.clear=function(){this._key=r()},i})();function r(){var i;do i="@@WeakMap@@"+y();while(I.has(t,i));return t[i]=!0,i}function c(i,o){if(!w.call(i,n)){if(!o)return;Object.defineProperty(i,n,{value:I.create()})}return i[n]}function _(i,o){for(var u=0;u<o;++u)i[u]=Math.random()*255|0;return i}function O(i){if(typeof Uint8Array=="function"){var o=new Uint8Array(i);return typeof crypto<"u"?crypto.getRandomValues(o):typeof msCrypto<"u"?msCrypto.getRandomValues(o):_(o,i),o}return _(new Array(i),i)}function y(){var i=O(e);i[6]=i[6]&79|64,i[8]=i[8]&191|128;for(var o="",u=0;u<e;++u){var s=i[u];(u===4||u===6||u===8)&&(o+="-"),s<16&&(o+="0"),o+=s.toString(16).toLowerCase()}return o}}function J(e){return e.__=void 0,delete e.__,e}})})(a||(a={})),$}Ee();const V=Symbol("endpoint:metadata");function A(a,f="",d={}){return function(l,w){const E={method:a,path:f,...d};Reflect.defineMetadata(V,E,l,w)}}function Te(a="",f={}){return A(P.HttpMethod.GET,a,f)}function Pe(a="",f={}){return A(P.HttpMethod.POST,a,f)}function ke(a="",f={}){return A(P.HttpMethod.PUT,a,f)}function Re(a="",f={}){return A(P.HttpMethod.DELETE,a,f)}function Ae(a="",f={}){return A(P.HttpMethod.PATCH,a,f)}function Ie(a="",f={}){return A(P.HttpMethod.HEAD,a,f)}function Se(a="",f={}){return A(P.HttpMethod.OPTIONS,a,f)}function ee(a){if(typeof a!="function")throw new TypeError("Expected a function");try{const f=a.toString().trim(),d=je(f);return De(d)?Ce(d):[]}catch{return[]}}function te(a,f,d,l){if(l)return l;try{const w=a[f];if(w){const E=ee(w);if(d<E.length)return E[d]}}catch{}}function De(a){return a!=null&&a.trim()!==""}function je(a){if(a.startsWith("(")){const l=ne(a,0);return l===-1?"":a.substring(1,l)}const f=a.indexOf("(");if(f===-1)return"";const d=ne(a,f);return d===-1?"":a.substring(f+1,d)}function ne(a,f){let d=1;for(let l=f+1;l<a.length;l++){const w=a[l];if(w==="(")d++;else if(w===")"&&(d--,d===0))return l}return-1}function Ce(a){return a.split(",").map(Ge).filter(He).map(qe)}function Ge(a){return a.trim()}function He(a){return a.length>0}function qe(a){let f=xe(a);return f=Fe(f),f.trim()}function xe(a){const f=a.indexOf("=");return f!==-1?a.substring(0,f):a}function Fe(a){const f=a.indexOf(":");return f!==-1?a.substring(0,f):a}var S=(a=>(a.PATH="path",a.QUERY="query",a.HEADER="header",a.BODY="body",a))(S||{});const U=Symbol("parameter:metadata");function H(a,f=""){return function(d,l,w){const E=te(d,l,w,f),g=Reflect.getMetadata(U,d,l)||[];g.push({type:a,name:E,index:w}),Reflect.defineMetadata(U,g,d,l)}}function Ne(a=""){return H("path",a)}function Ue(a=""){return H("query",a)}function We(a=""){return H("header",a)}function Ye(){return H("body")}class re{constructor(f,d,l,w){this.name=f,this.api=d,this.endpoint=l,this.parameters=w}get fetcher(){const f=this.endpoint.fetcher||this.api.fetcher||P.defaultFetcherName;return P.fetcherRegistrar.requiredGet(f)}resolveRequest(f){const d={},l={},w={...this.api.headers,...this.endpoint.headers};let E=null;return this.parameters.forEach(g=>{const T=f[g.index];switch(g.type){case S.PATH:g.name?d[g.name]=T:d["param"+g.index]=T;break;case S.QUERY:g.name?l[g.name]=T:l["param"+g.index]=T;break;case S.HEADER:g.name&&T!==void 0&&(w[g.name]=String(T));break;case S.BODY:E=T;break}}),{pathParams:d,queryParams:l,headers:w,body:E,timeout:this.resolveTimeout()}}resolvePath(){const f=this.endpoint.basePath||this.api.basePath||"",d=this.endpoint.path||"";return P.combineURLs(f,d)}resolveTimeout(){return this.endpoint.timeout||this.api.timeout}}class ae{constructor(f){this.metadata=f}async execute(f){const d=this.metadata.resolvePath(),l=this.metadata.resolveRequest(f);return await this.metadata.fetcher.fetch(d,l)}}const ie=Symbol("api:metadata");function Ve(a,f,d){const l=a.prototype[f];if(f==="constructor"||typeof l!="function")return;const w=Reflect.getMetadata(V,a.prototype,f);if(!w)return;const E=Reflect.getMetadata(U,a.prototype,f)||[],g=new re(f,d,w,E),T=new ae(g);a.prototype[f]=function(...D){return T.execute(D)}}function Be(a="",f={}){return function(d){const l={basePath:a,...f};Reflect.defineMetadata(ie,l,d),Object.getOwnPropertyNames(d.prototype).forEach(w=>{Ve(d,w,l)})}}class oe extends Error{constructor(){super("Implementation will be generated automatically."),this.name="AutoGenerated"}}const Le=()=>new oe;p.API_METADATA_KEY=ie,p.AutoGenerated=oe,p.ENDPOINT_METADATA_KEY=V,p.FunctionMetadata=re,p.PARAMETER_METADATA_KEY=U,p.ParameterType=S,p.RequestExecutor=ae,p.api=Be,p.autoGeneratedError=Le,p.body=Ye,p.del=Re,p.endpoint=A,p.get=Te,p.getParameterName=te,p.getParameterNames=ee,p.head=Ie,p.header=We,p.options=Se,p.parameter=H,p.patch=Ae,p.path=Ne,p.post=Pe,p.put=ke,p.query=Ue,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
14
+ ***************************************************************************** */var K;function Ee(){if(K)return $;K=1;var a;return(function(f){(function(d){var l=typeof globalThis=="object"?globalThis:typeof X=="object"?X:typeof self=="object"?self:typeof this=="object"?this:D(),w=E(f);typeof l.Reflect<"u"&&(w=E(l.Reflect,w)),d(w,l),typeof l.Reflect>"u"&&(l.Reflect=f);function E(j,q){return function(I,x){Object.defineProperty(j,I,{configurable:!0,writable:!0,value:x}),q&&q(I,x)}}function g(){try{return Function("return this;")()}catch{}}function T(){try{return(0,eval)("(function() { return this; })()")}catch{}}function D(){return g()||T()}})(function(d,l){var w=Object.prototype.hasOwnProperty,E=typeof Symbol=="function",g=E&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",T=E&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",D=typeof Object.create=="function",j={__proto__:[]}instanceof Array,q=!D&&!j,I={create:D?function(){return J(Object.create(null))}:j?function(){return J({__proto__:null})}:function(){return J({})},has:q?function(e,t){return w.call(e,t)}:function(e,t){return t in e},get:q?function(e,t){return w.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},x=Object.getPrototypeOf(Function),F=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:yt(),B=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:vt(),L=typeof WeakMap=="function"?WeakMap:pt(),C=E?Symbol.for("@reflect-metadata:registry"):void 0,W=dt(),ue=lt(W);function ze(e,t,n,r){if(h(n)){if(!pe(e))throw new TypeError;if(!we(t))throw new TypeError;return rt(e,t)}else{if(!pe(e))throw new TypeError;if(!b(t))throw new TypeError;if(!b(r)&&!h(r)&&!G(r))throw new TypeError;return G(r)&&(r=void 0),n=R(n),at(e,t,n,r)}}d("decorate",ze);function Qe(e,t){function n(r,c){if(!b(r))throw new TypeError;if(!h(c)&&!st(c))throw new TypeError;de(e,t,r,c)}return n}d("metadata",Qe);function Ze(e,t,n,r){if(!b(n))throw new TypeError;return h(r)||(r=R(r)),de(e,t,n,r)}d("defineMetadata",Ze);function Je(e,t,n){if(!b(t))throw new TypeError;return h(n)||(n=R(n)),fe(e,t,n)}d("hasMetadata",Je);function Xe(e,t,n){if(!b(t))throw new TypeError;return h(n)||(n=R(n)),z(e,t,n)}d("hasOwnMetadata",Xe);function $e(e,t,n){if(!b(t))throw new TypeError;return h(n)||(n=R(n)),se(e,t,n)}d("getMetadata",$e);function Ke(e,t,n){if(!b(t))throw new TypeError;return h(n)||(n=R(n)),ce(e,t,n)}d("getOwnMetadata",Ke);function et(e,t){if(!b(e))throw new TypeError;return h(t)||(t=R(t)),le(e,t)}d("getMetadataKeys",et);function tt(e,t){if(!b(e))throw new TypeError;return h(t)||(t=R(t)),he(e,t)}d("getOwnMetadataKeys",tt);function nt(e,t,n){if(!b(t))throw new TypeError;if(h(n)||(n=R(n)),!b(t))throw new TypeError;h(n)||(n=R(n));var r=N(t,n,!1);return h(r)?!1:r.OrdinaryDeleteMetadata(e,t,n)}d("deleteMetadata",nt);function rt(e,t){for(var n=e.length-1;n>=0;--n){var r=e[n],c=r(t);if(!h(c)&&!G(c)){if(!we(c))throw new TypeError;t=c}}return t}function at(e,t,n,r){for(var c=e.length-1;c>=0;--c){var m=e[c],O=m(t,n,r);if(!h(O)&&!G(O)){if(!b(O))throw new TypeError;r=O}}return r}function fe(e,t,n){var r=z(e,t,n);if(r)return!0;var c=Z(t);return G(c)?!1:fe(e,c,n)}function z(e,t,n){var r=N(t,n,!1);return h(r)?!1:ve(r.OrdinaryHasOwnMetadata(e,t,n))}function se(e,t,n){var r=z(e,t,n);if(r)return ce(e,t,n);var c=Z(t);if(!G(c))return se(e,c,n)}function ce(e,t,n){var r=N(t,n,!1);if(!h(r))return r.OrdinaryGetOwnMetadata(e,t,n)}function de(e,t,n,r){var c=N(n,r,!0);c.OrdinaryDefineOwnMetadata(e,t,n,r)}function le(e,t){var n=he(e,t),r=Z(e);if(r===null)return n;var c=le(r,t);if(c.length<=0)return n;if(n.length<=0)return c;for(var m=new B,O=[],y=0,i=n;y<i.length;y++){var o=i[y],u=m.has(o);u||(m.add(o),O.push(o))}for(var s=0,v=c;s<v.length;s++){var o=v[s],u=m.has(o);u||(m.add(o),O.push(o))}return O}function he(e,t){var n=N(e,t,!1);return n?n.OrdinaryOwnMetadataKeys(e,t):[]}function ye(e){if(e===null)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return e===null?1:6;default:return 6}}function h(e){return e===void 0}function G(e){return e===null}function it(e){return typeof e=="symbol"}function b(e){return typeof e=="object"?e!==null:typeof e=="function"}function ot(e,t){switch(ye(e)){case 0:return e;case 1:return e;case 2:return e;case 3:return e;case 4:return e;case 5:return e}var n="string",r=Me(e,g);if(r!==void 0){var c=r.call(e,n);if(b(c))throw new TypeError;return c}return ut(e)}function ut(e,t){var n,r,c;{var m=e.toString;if(Y(m)){var r=m.call(e);if(!b(r))return r}var n=e.valueOf;if(Y(n)){var r=n.call(e);if(!b(r))return r}}throw new TypeError}function ve(e){return!!e}function ft(e){return""+e}function R(e){var t=ot(e);return it(t)?t:ft(t)}function pe(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:Object.prototype.toString.call(e)==="[object Array]"}function Y(e){return typeof e=="function"}function we(e){return typeof e=="function"}function st(e){switch(ye(e)){case 3:return!0;case 4:return!0;default:return!1}}function Q(e,t){return e===t||e!==e&&t!==t}function Me(e,t){var n=e[t];if(n!=null){if(!Y(n))throw new TypeError;return n}}function me(e){var t=Me(e,T);if(!Y(t))throw new TypeError;var n=t.call(e);if(!b(n))throw new TypeError;return n}function _e(e){return e.value}function ge(e){var t=e.next();return t.done?!1:t}function be(e){var t=e.return;t&&t.call(e)}function Z(e){var t=Object.getPrototypeOf(e);if(typeof e!="function"||e===x||t!==x)return t;var n=e.prototype,r=n&&Object.getPrototypeOf(n);if(r==null||r===Object.prototype)return t;var c=r.constructor;return typeof c!="function"||c===e?t:c}function ct(){var e;!h(C)&&typeof l.Reflect<"u"&&!(C in l.Reflect)&&typeof l.Reflect.defineMetadata=="function"&&(e=ht(l.Reflect));var t,n,r,c=new L,m={registerProvider:O,getProvider:i,setProvider:u};return m;function O(s){if(!Object.isExtensible(m))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===s:break;case h(t):t=s;break;case t===s:break;case h(n):n=s;break;case n===s:break;default:r===void 0&&(r=new B),r.add(s);break}}function y(s,v){if(!h(t)){if(t.isProviderFor(s,v))return t;if(!h(n)){if(n.isProviderFor(s,v))return t;if(!h(r))for(var M=me(r);;){var _=ge(M);if(!_)return;var k=_e(_);if(k.isProviderFor(s,v))return be(M),k}}}if(!h(e)&&e.isProviderFor(s,v))return e}function i(s,v){var M=c.get(s),_;return h(M)||(_=M.get(v)),h(_)&&(_=y(s,v),h(_)||(h(M)&&(M=new F,c.set(s,M)),M.set(v,_))),_}function o(s){if(h(s))throw new TypeError;return t===s||n===s||!h(r)&&r.has(s)}function u(s,v,M){if(!o(M))throw new Error("Metadata provider not registered.");var _=i(s,v);if(_!==M){if(!h(_))return!1;var k=c.get(s);h(k)&&(k=new F,c.set(s,k)),k.set(v,M)}return!0}}function dt(){var e;return!h(C)&&b(l.Reflect)&&Object.isExtensible(l.Reflect)&&(e=l.Reflect[C]),h(e)&&(e=ct()),!h(C)&&b(l.Reflect)&&Object.isExtensible(l.Reflect)&&Object.defineProperty(l.Reflect,C,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}function lt(e){var t=new L,n={isProviderFor:function(o,u){var s=t.get(o);return h(s)?!1:s.has(u)},OrdinaryDefineOwnMetadata:O,OrdinaryHasOwnMetadata:c,OrdinaryGetOwnMetadata:m,OrdinaryOwnMetadataKeys:y,OrdinaryDeleteMetadata:i};return W.registerProvider(n),n;function r(o,u,s){var v=t.get(o),M=!1;if(h(v)){if(!s)return;v=new F,t.set(o,v),M=!0}var _=v.get(u);if(h(_)){if(!s)return;if(_=new F,v.set(u,_),!e.setProvider(o,u,n))throw v.delete(u),M&&t.delete(o),new Error("Wrong provider for target.")}return _}function c(o,u,s){var v=r(u,s,!1);return h(v)?!1:ve(v.has(o))}function m(o,u,s){var v=r(u,s,!1);if(!h(v))return v.get(o)}function O(o,u,s,v){var M=r(s,v,!0);M.set(o,u)}function y(o,u){var s=[],v=r(o,u,!1);if(h(v))return s;for(var M=v.keys(),_=me(M),k=0;;){var Oe=ge(_);if(!Oe)return s.length=k,s;var wt=_e(Oe);try{s[k]=wt}catch(Mt){try{be(_)}finally{throw Mt}}k++}}function i(o,u,s){var v=r(u,s,!1);if(h(v)||!v.delete(o))return!1;if(v.size===0){var M=t.get(u);h(M)||(M.delete(s),M.size===0&&t.delete(M))}return!0}}function ht(e){var t=e.defineMetadata,n=e.hasOwnMetadata,r=e.getOwnMetadata,c=e.getOwnMetadataKeys,m=e.deleteMetadata,O=new L,y={isProviderFor:function(i,o){var u=O.get(i);return!h(u)&&u.has(o)?!0:c(i,o).length?(h(u)&&(u=new B,O.set(i,u)),u.add(o),!0):!1},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:n,OrdinaryGetOwnMetadata:r,OrdinaryOwnMetadataKeys:c,OrdinaryDeleteMetadata:m};return y}function N(e,t,n){var r=W.getProvider(e,t);if(!h(r))return r;if(n){if(W.setProvider(e,t,ue))return ue;throw new Error("Illegal state.")}}function yt(){var e={},t=[],n=(function(){function y(i,o,u){this._index=0,this._keys=i,this._values=o,this._selector=u}return y.prototype["@@iterator"]=function(){return this},y.prototype[T]=function(){return this},y.prototype.next=function(){var i=this._index;if(i>=0&&i<this._keys.length){var o=this._selector(this._keys[i],this._values[i]);return i+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:o,done:!1}}return{value:void 0,done:!0}},y.prototype.throw=function(i){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),i},y.prototype.return=function(i){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:i,done:!0}},y})(),r=(function(){function y(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(y.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),y.prototype.has=function(i){return this._find(i,!1)>=0},y.prototype.get=function(i){var o=this._find(i,!1);return o>=0?this._values[o]:void 0},y.prototype.set=function(i,o){var u=this._find(i,!0);return this._values[u]=o,this},y.prototype.delete=function(i){var o=this._find(i,!1);if(o>=0){for(var u=this._keys.length,s=o+1;s<u;s++)this._keys[s-1]=this._keys[s],this._values[s-1]=this._values[s];return this._keys.length--,this._values.length--,Q(i,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},y.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},y.prototype.keys=function(){return new n(this._keys,this._values,c)},y.prototype.values=function(){return new n(this._keys,this._values,m)},y.prototype.entries=function(){return new n(this._keys,this._values,O)},y.prototype["@@iterator"]=function(){return this.entries()},y.prototype[T]=function(){return this.entries()},y.prototype._find=function(i,o){if(!Q(this._cacheKey,i)){this._cacheIndex=-1;for(var u=0;u<this._keys.length;u++)if(Q(this._keys[u],i)){this._cacheIndex=u;break}}return this._cacheIndex<0&&o&&(this._cacheIndex=this._keys.length,this._keys.push(i),this._values.push(void 0)),this._cacheIndex},y})();return r;function c(y,i){return y}function m(y,i){return i}function O(y,i){return[y,i]}}function vt(){var e=(function(){function t(){this._map=new F}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(n){return this._map.has(n)},t.prototype.add=function(n){return this._map.set(n,n),this},t.prototype.delete=function(n){return this._map.delete(n)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.keys()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[T]=function(){return this.keys()},t})();return e}function pt(){var e=16,t=I.create(),n=r();return(function(){function i(){this._key=r()}return i.prototype.has=function(o){var u=c(o,!1);return u!==void 0?I.has(u,this._key):!1},i.prototype.get=function(o){var u=c(o,!1);return u!==void 0?I.get(u,this._key):void 0},i.prototype.set=function(o,u){var s=c(o,!0);return s[this._key]=u,this},i.prototype.delete=function(o){var u=c(o,!1);return u!==void 0?delete u[this._key]:!1},i.prototype.clear=function(){this._key=r()},i})();function r(){var i;do i="@@WeakMap@@"+y();while(I.has(t,i));return t[i]=!0,i}function c(i,o){if(!w.call(i,n)){if(!o)return;Object.defineProperty(i,n,{value:I.create()})}return i[n]}function m(i,o){for(var u=0;u<o;++u)i[u]=Math.random()*255|0;return i}function O(i){if(typeof Uint8Array=="function"){var o=new Uint8Array(i);return typeof crypto<"u"?crypto.getRandomValues(o):typeof msCrypto<"u"?msCrypto.getRandomValues(o):m(o,i),o}return m(new Array(i),i)}function y(){var i=O(e);i[6]=i[6]&79|64,i[8]=i[8]&191|128;for(var o="",u=0;u<e;++u){var s=i[u];(u===4||u===6||u===8)&&(o+="-"),s<16&&(o+="0"),o+=s.toString(16).toLowerCase()}return o}}function J(e){return e.__=void 0,delete e.__,e}})})(a||(a={})),$}Ee();const V=Symbol("endpoint:metadata");function A(a,f="",d={}){return function(l,w){const E={method:a,path:f,...d};Reflect.defineMetadata(V,E,l,w)}}function Te(a="",f={}){return A(P.HttpMethod.GET,a,f)}function Pe(a="",f={}){return A(P.HttpMethod.POST,a,f)}function ke(a="",f={}){return A(P.HttpMethod.PUT,a,f)}function Re(a="",f={}){return A(P.HttpMethod.DELETE,a,f)}function Ae(a="",f={}){return A(P.HttpMethod.PATCH,a,f)}function Ie(a="",f={}){return A(P.HttpMethod.HEAD,a,f)}function Se(a="",f={}){return A(P.HttpMethod.OPTIONS,a,f)}function ee(a){if(typeof a!="function")throw new TypeError("Expected a function");try{const f=a.toString().trim(),d=je(f);return De(d)?Ce(d):[]}catch{return[]}}function te(a,f,d,l){if(l)return l;try{const w=a[f];if(w){const E=ee(w);if(d<E.length)return E[d]}}catch{}}function De(a){return a!=null&&a.trim()!==""}function je(a){if(a.startsWith("(")){const l=ne(a,0);return l===-1?"":a.substring(1,l)}const f=a.indexOf("(");if(f===-1)return"";const d=ne(a,f);return d===-1?"":a.substring(f+1,d)}function ne(a,f){let d=1;for(let l=f+1;l<a.length;l++){const w=a[l];if(w==="(")d++;else if(w===")"&&(d--,d===0))return l}return-1}function Ce(a){return a.split(",").map(Ge).filter(He).map(qe)}function Ge(a){return a.trim()}function He(a){return a.length>0}function qe(a){let f=xe(a);return f=Fe(f),f.trim()}function xe(a){const f=a.indexOf("=");return f!==-1?a.substring(0,f):a}function Fe(a){const f=a.indexOf(":");return f!==-1?a.substring(0,f):a}var S=(a=>(a.PATH="path",a.QUERY="query",a.HEADER="header",a.BODY="body",a))(S||{});const U=Symbol("parameter:metadata");function H(a,f=""){return function(d,l,w){const E=te(d,l,w,f),g=Reflect.getMetadata(U,d,l)||[];g.push({type:a,name:E,index:w}),Reflect.defineMetadata(U,g,d,l)}}function Ne(a=""){return H("path",a)}function Ue(a=""){return H("query",a)}function We(a=""){return H("header",a)}function Ye(){return H("body")}class re{constructor(f,d,l,w){this.name=f,this.api=d,this.endpoint=l,this.parameters=w}get fetcher(){const f=this.endpoint.fetcher||this.api.fetcher||P.defaultFetcherName;return P.fetcherRegistrar.requiredGet(f)}resolveRequest(f){const d={},l={},w={...this.api.headers,...this.endpoint.headers};let E=null;return this.parameters.forEach(g=>{const T=f[g.index];switch(g.type){case S.PATH:g.name?d[g.name]=T:d["param"+g.index]=T;break;case S.QUERY:g.name?l[g.name]=T:l["param"+g.index]=T;break;case S.HEADER:g.name&&T!==void 0&&(w[g.name]=String(T));break;case S.BODY:E=T;break}}),{method:this.endpoint.method,pathParams:d,queryParams:l,headers:w,body:E,timeout:this.resolveTimeout()}}resolvePath(){const f=this.endpoint.basePath||this.api.basePath||"",d=this.endpoint.path||"";return P.combineURLs(f,d)}resolveTimeout(){return this.endpoint.timeout||this.api.timeout}}class ae{constructor(f){this.metadata=f}async execute(f){const d=this.metadata.resolvePath(),l=this.metadata.resolveRequest(f);return await this.metadata.fetcher.fetch(d,l)}}const ie=Symbol("api:metadata");function Ve(a,f,d){const l=a.prototype[f];if(f==="constructor"||typeof l!="function")return;const w=Reflect.getMetadata(V,a.prototype,f);if(!w)return;const E=Reflect.getMetadata(U,a.prototype,f)||[],g=new re(f,d,w,E),T=new ae(g);a.prototype[f]=function(...D){return T.execute(D)}}function Be(a="",f={}){return function(d){const l={basePath:a,...f};Reflect.defineMetadata(ie,l,d),Object.getOwnPropertyNames(d.prototype).forEach(w=>{Ve(d,w,l)})}}class oe extends Error{constructor(){super("Implementation will be generated automatically."),this.name="AutoGenerated"}}const Le=()=>new oe;p.API_METADATA_KEY=ie,p.AutoGenerated=oe,p.ENDPOINT_METADATA_KEY=V,p.FunctionMetadata=re,p.PARAMETER_METADATA_KEY=U,p.ParameterType=S,p.RequestExecutor=ae,p.api=Be,p.autoGeneratedError=Le,p.body=Ye,p.del=Re,p.endpoint=A,p.get=Te,p.getParameterName=te,p.getParameterNames=ee,p.head=Ie,p.header=We,p.options=Se,p.parameter=H,p.patch=Ae,p.path=Ne,p.post=Pe,p.put=ke,p.query=Ue,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
@@ -1 +1 @@
1
- {"version":3,"file":"requestExecutor.d.ts","sourceRoot":"","sources":["../src/requestExecutor.ts"],"names":[],"mappings":"AAYA,OAAO,EAGL,OAAO,EAEP,cAAc,EACd,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAiB,MAAM,sBAAsB,CAAC;AAExE;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,GAAG,EAAE,WAAW,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;OAEG;IACH,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAEhC;;;;;;;OAOG;gBAED,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,iBAAiB,EAAE;IAQjC;;;;;;;OAOG;IACH,IAAI,OAAO,IAAI,OAAO,CAIrB;IAED;;;;;;;;;OASG;IACH,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,cAAc;IA8C3C;;;;;;;OAOG;IACH,WAAW,IAAI,MAAM;IAMrB;;;;;;;OAOG;IACH,cAAc,IAAI,MAAM,GAAG,SAAS;CAGrC;AAED;;;;;;GAMG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAE5C;;;;OAIG;gBACS,QAAQ,EAAE,gBAAgB;IAItC;;;;;;;;OAQG;IACG,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;CAK9C"}
1
+ {"version":3,"file":"requestExecutor.d.ts","sourceRoot":"","sources":["../src/requestExecutor.ts"],"names":[],"mappings":"AAYA,OAAO,EAGL,OAAO,EAEP,cAAc,EACd,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAiB,MAAM,sBAAsB,CAAC;AAExE;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,GAAG,EAAE,WAAW,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;OAEG;IACH,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAEhC;;;;;;;OAOG;gBAED,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,iBAAiB,EAAE;IAQjC;;;;;;;OAOG;IACH,IAAI,OAAO,IAAI,OAAO,CAIrB;IAED;;;;;;;;;OASG;IACH,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,cAAc;IA+C3C;;;;;;;OAOG;IACH,WAAW,IAAI,MAAM;IAMrB;;;;;;;OAOG;IACH,cAAc,IAAI,MAAM,GAAG,SAAS;CAGrC;AAED;;;;;;GAMG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAE5C;;;;OAIG;gBACS,QAAQ,EAAE,gBAAgB;IAItC;;;;;;;;OAQG;IACG,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;CAK9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahoo-wang/fetcher-decorator",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Decorator support for Fetcher HTTP client",
5
5
  "keywords": [
6
6
  "fetch",
@@ -35,7 +35,7 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "reflect-metadata": "^0.2.2",
38
- "@ahoo-wang/fetcher": "0.5.0"
38
+ "@ahoo-wang/fetcher": "0.5.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@vitest/coverage-v8": "^3.2.4",