@ahoo-wang/fetcher-decorator 0.5.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/LICENSE +201 -0
- package/README.md +274 -0
- package/README.zh-CN.md +272 -0
- package/dist/apiDecorator.d.ts +42 -0
- package/dist/apiDecorator.d.ts.map +1 -0
- package/dist/endpointDecorator.d.ts +58 -0
- package/dist/endpointDecorator.d.ts.map +1 -0
- package/dist/generated.d.ts +26 -0
- package/dist/generated.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +1141 -0
- package/dist/index.umd.js +14 -0
- package/dist/parameterDecorator.d.ts +113 -0
- package/dist/parameterDecorator.d.ts.map +1 -0
- package/dist/reflection.d.ts +41 -0
- package/dist/reflection.d.ts.map +1 -0
- package/dist/requestExecutor.d.ts +103 -0
- package/dist/requestExecutor.d.ts.map +1 -0
- package/package.json +55 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,1141 @@
|
|
|
1
|
+
import { HttpMethod as R, defaultFetcherName as Ye, fetcherRegistrar as Ve, combineURLs as Be } from "@ahoo-wang/fetcher";
|
|
2
|
+
var le = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, he = {};
|
|
3
|
+
/*! *****************************************************************************
|
|
4
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
6
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
7
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
10
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
11
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
12
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
13
|
+
|
|
14
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
15
|
+
and limitations under the License.
|
|
16
|
+
***************************************************************************** */
|
|
17
|
+
var ve;
|
|
18
|
+
function Le() {
|
|
19
|
+
if (ve) return he;
|
|
20
|
+
ve = 1;
|
|
21
|
+
var a;
|
|
22
|
+
return (function(f) {
|
|
23
|
+
(function(d) {
|
|
24
|
+
var l = typeof globalThis == "object" ? globalThis : typeof le == "object" ? le : typeof self == "object" ? self : typeof this == "object" ? this : I(), p = O(f);
|
|
25
|
+
typeof l.Reflect < "u" && (p = O(l.Reflect, p)), d(p, l), typeof l.Reflect > "u" && (l.Reflect = f);
|
|
26
|
+
function O(A, j) {
|
|
27
|
+
return function(k, C) {
|
|
28
|
+
Object.defineProperty(A, k, { configurable: !0, writable: !0, value: C }), j && j(k, C);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function m() {
|
|
32
|
+
try {
|
|
33
|
+
return Function("return this;")();
|
|
34
|
+
} catch {
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function E() {
|
|
38
|
+
try {
|
|
39
|
+
return (0, eval)("(function() { return this; })()");
|
|
40
|
+
} catch {
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function I() {
|
|
44
|
+
return m() || E();
|
|
45
|
+
}
|
|
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 = {
|
|
48
|
+
// create an object in dictionary mode (a.k.a. "slow" mode in v8)
|
|
49
|
+
create: I ? function() {
|
|
50
|
+
return z(/* @__PURE__ */ Object.create(null));
|
|
51
|
+
} : A ? function() {
|
|
52
|
+
return z({ __proto__: null });
|
|
53
|
+
} : function() {
|
|
54
|
+
return z({});
|
|
55
|
+
},
|
|
56
|
+
has: j ? function(e, t) {
|
|
57
|
+
return p.call(e, t);
|
|
58
|
+
} : function(e, t) {
|
|
59
|
+
return t in e;
|
|
60
|
+
},
|
|
61
|
+
get: j ? function(e, t) {
|
|
62
|
+
return p.call(e, t) ? e[t] : void 0;
|
|
63
|
+
} : function(e, t) {
|
|
64
|
+
return e[t];
|
|
65
|
+
}
|
|
66
|
+
}, C = Object.getPrototypeOf(Function), G = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : He(), N = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : Fe(), Y = typeof WeakMap == "function" ? WeakMap : Ue(), S = O ? Symbol.for("@reflect-metadata:registry") : void 0, F = Ce(), Z = Ge(F);
|
|
67
|
+
function we(e, t, r, n) {
|
|
68
|
+
if (h(r)) {
|
|
69
|
+
if (!ae(e))
|
|
70
|
+
throw new TypeError();
|
|
71
|
+
if (!ie(t))
|
|
72
|
+
throw new TypeError();
|
|
73
|
+
return ke(e, t);
|
|
74
|
+
} else {
|
|
75
|
+
if (!ae(e))
|
|
76
|
+
throw new TypeError();
|
|
77
|
+
if (!g(t))
|
|
78
|
+
throw new TypeError();
|
|
79
|
+
if (!g(n) && !h(n) && !D(n))
|
|
80
|
+
throw new TypeError();
|
|
81
|
+
return D(n) && (n = void 0), r = T(r), Re(e, t, r, n);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
d("decorate", we);
|
|
85
|
+
function _e(e, t) {
|
|
86
|
+
function r(n, c) {
|
|
87
|
+
if (!g(n))
|
|
88
|
+
throw new TypeError();
|
|
89
|
+
if (!h(c) && !De(c))
|
|
90
|
+
throw new TypeError();
|
|
91
|
+
K(e, t, n, c);
|
|
92
|
+
}
|
|
93
|
+
return r;
|
|
94
|
+
}
|
|
95
|
+
d("metadata", _e);
|
|
96
|
+
function Me(e, t, r, n) {
|
|
97
|
+
if (!g(r))
|
|
98
|
+
throw new TypeError();
|
|
99
|
+
return h(n) || (n = T(n)), K(e, t, r, n);
|
|
100
|
+
}
|
|
101
|
+
d("defineMetadata", Me);
|
|
102
|
+
function me(e, t, r) {
|
|
103
|
+
if (!g(t))
|
|
104
|
+
throw new TypeError();
|
|
105
|
+
return h(r) || (r = T(r)), J(e, t, r);
|
|
106
|
+
}
|
|
107
|
+
d("hasMetadata", me);
|
|
108
|
+
function ge(e, t, r) {
|
|
109
|
+
if (!g(t))
|
|
110
|
+
throw new TypeError();
|
|
111
|
+
return h(r) || (r = T(r)), V(e, t, r);
|
|
112
|
+
}
|
|
113
|
+
d("hasOwnMetadata", ge);
|
|
114
|
+
function be(e, t, r) {
|
|
115
|
+
if (!g(t))
|
|
116
|
+
throw new TypeError();
|
|
117
|
+
return h(r) || (r = T(r)), X(e, t, r);
|
|
118
|
+
}
|
|
119
|
+
d("getMetadata", be);
|
|
120
|
+
function Oe(e, t, r) {
|
|
121
|
+
if (!g(t))
|
|
122
|
+
throw new TypeError();
|
|
123
|
+
return h(r) || (r = T(r)), $(e, t, r);
|
|
124
|
+
}
|
|
125
|
+
d("getOwnMetadata", Oe);
|
|
126
|
+
function Ee(e, t) {
|
|
127
|
+
if (!g(e))
|
|
128
|
+
throw new TypeError();
|
|
129
|
+
return h(t) || (t = T(t)), ee(e, t);
|
|
130
|
+
}
|
|
131
|
+
d("getMetadataKeys", Ee);
|
|
132
|
+
function Pe(e, t) {
|
|
133
|
+
if (!g(e))
|
|
134
|
+
throw new TypeError();
|
|
135
|
+
return h(t) || (t = T(t)), te(e, t);
|
|
136
|
+
}
|
|
137
|
+
d("getOwnMetadataKeys", Pe);
|
|
138
|
+
function Te(e, t, r) {
|
|
139
|
+
if (!g(t))
|
|
140
|
+
throw new TypeError();
|
|
141
|
+
if (h(r) || (r = T(r)), !g(t))
|
|
142
|
+
throw new TypeError();
|
|
143
|
+
h(r) || (r = T(r));
|
|
144
|
+
var n = q(
|
|
145
|
+
t,
|
|
146
|
+
r,
|
|
147
|
+
/*Create*/
|
|
148
|
+
!1
|
|
149
|
+
);
|
|
150
|
+
return h(n) ? !1 : n.OrdinaryDeleteMetadata(e, t, r);
|
|
151
|
+
}
|
|
152
|
+
d("deleteMetadata", Te);
|
|
153
|
+
function ke(e, t) {
|
|
154
|
+
for (var r = e.length - 1; r >= 0; --r) {
|
|
155
|
+
var n = e[r], c = n(t);
|
|
156
|
+
if (!h(c) && !D(c)) {
|
|
157
|
+
if (!ie(c))
|
|
158
|
+
throw new TypeError();
|
|
159
|
+
t = c;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return t;
|
|
163
|
+
}
|
|
164
|
+
function Re(e, t, r, n) {
|
|
165
|
+
for (var c = e.length - 1; c >= 0; --c) {
|
|
166
|
+
var _ = e[c], b = _(t, r, n);
|
|
167
|
+
if (!h(b) && !D(b)) {
|
|
168
|
+
if (!g(b))
|
|
169
|
+
throw new TypeError();
|
|
170
|
+
n = b;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return n;
|
|
174
|
+
}
|
|
175
|
+
function J(e, t, r) {
|
|
176
|
+
var n = V(e, t, r);
|
|
177
|
+
if (n)
|
|
178
|
+
return !0;
|
|
179
|
+
var c = L(t);
|
|
180
|
+
return D(c) ? !1 : J(e, c, r);
|
|
181
|
+
}
|
|
182
|
+
function V(e, t, r) {
|
|
183
|
+
var n = q(
|
|
184
|
+
t,
|
|
185
|
+
r,
|
|
186
|
+
/*Create*/
|
|
187
|
+
!1
|
|
188
|
+
);
|
|
189
|
+
return h(n) ? !1 : ne(n.OrdinaryHasOwnMetadata(e, t, r));
|
|
190
|
+
}
|
|
191
|
+
function X(e, t, r) {
|
|
192
|
+
var n = V(e, t, r);
|
|
193
|
+
if (n)
|
|
194
|
+
return $(e, t, r);
|
|
195
|
+
var c = L(t);
|
|
196
|
+
if (!D(c))
|
|
197
|
+
return X(e, c, r);
|
|
198
|
+
}
|
|
199
|
+
function $(e, t, r) {
|
|
200
|
+
var n = q(
|
|
201
|
+
t,
|
|
202
|
+
r,
|
|
203
|
+
/*Create*/
|
|
204
|
+
!1
|
|
205
|
+
);
|
|
206
|
+
if (!h(n))
|
|
207
|
+
return n.OrdinaryGetOwnMetadata(e, t, r);
|
|
208
|
+
}
|
|
209
|
+
function K(e, t, r, n) {
|
|
210
|
+
var c = q(
|
|
211
|
+
r,
|
|
212
|
+
n,
|
|
213
|
+
/*Create*/
|
|
214
|
+
!0
|
|
215
|
+
);
|
|
216
|
+
c.OrdinaryDefineOwnMetadata(e, t, r, n);
|
|
217
|
+
}
|
|
218
|
+
function ee(e, t) {
|
|
219
|
+
var r = te(e, t), n = L(e);
|
|
220
|
+
if (n === null)
|
|
221
|
+
return r;
|
|
222
|
+
var c = ee(n, t);
|
|
223
|
+
if (c.length <= 0)
|
|
224
|
+
return r;
|
|
225
|
+
if (r.length <= 0)
|
|
226
|
+
return c;
|
|
227
|
+
for (var _ = new N(), b = [], v = 0, i = r; v < i.length; v++) {
|
|
228
|
+
var o = i[v], u = _.has(o);
|
|
229
|
+
u || (_.add(o), b.push(o));
|
|
230
|
+
}
|
|
231
|
+
for (var s = 0, y = c; s < y.length; s++) {
|
|
232
|
+
var o = y[s], u = _.has(o);
|
|
233
|
+
u || (_.add(o), b.push(o));
|
|
234
|
+
}
|
|
235
|
+
return b;
|
|
236
|
+
}
|
|
237
|
+
function te(e, t) {
|
|
238
|
+
var r = q(
|
|
239
|
+
e,
|
|
240
|
+
t,
|
|
241
|
+
/*create*/
|
|
242
|
+
!1
|
|
243
|
+
);
|
|
244
|
+
return r ? r.OrdinaryOwnMetadataKeys(e, t) : [];
|
|
245
|
+
}
|
|
246
|
+
function re(e) {
|
|
247
|
+
if (e === null)
|
|
248
|
+
return 1;
|
|
249
|
+
switch (typeof e) {
|
|
250
|
+
case "undefined":
|
|
251
|
+
return 0;
|
|
252
|
+
case "boolean":
|
|
253
|
+
return 2;
|
|
254
|
+
case "string":
|
|
255
|
+
return 3;
|
|
256
|
+
case "symbol":
|
|
257
|
+
return 4;
|
|
258
|
+
case "number":
|
|
259
|
+
return 5;
|
|
260
|
+
case "object":
|
|
261
|
+
return e === null ? 1 : 6;
|
|
262
|
+
default:
|
|
263
|
+
return 6;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function h(e) {
|
|
267
|
+
return e === void 0;
|
|
268
|
+
}
|
|
269
|
+
function D(e) {
|
|
270
|
+
return e === null;
|
|
271
|
+
}
|
|
272
|
+
function xe(e) {
|
|
273
|
+
return typeof e == "symbol";
|
|
274
|
+
}
|
|
275
|
+
function g(e) {
|
|
276
|
+
return typeof e == "object" ? e !== null : typeof e == "function";
|
|
277
|
+
}
|
|
278
|
+
function Ie(e, t) {
|
|
279
|
+
switch (re(e)) {
|
|
280
|
+
case 0:
|
|
281
|
+
return e;
|
|
282
|
+
case 1:
|
|
283
|
+
return e;
|
|
284
|
+
case 2:
|
|
285
|
+
return e;
|
|
286
|
+
case 3:
|
|
287
|
+
return e;
|
|
288
|
+
case 4:
|
|
289
|
+
return e;
|
|
290
|
+
case 5:
|
|
291
|
+
return e;
|
|
292
|
+
}
|
|
293
|
+
var r = "string", n = oe(e, m);
|
|
294
|
+
if (n !== void 0) {
|
|
295
|
+
var c = n.call(e, r);
|
|
296
|
+
if (g(c))
|
|
297
|
+
throw new TypeError();
|
|
298
|
+
return c;
|
|
299
|
+
}
|
|
300
|
+
return Ae(e);
|
|
301
|
+
}
|
|
302
|
+
function Ae(e, t) {
|
|
303
|
+
var r, n, c;
|
|
304
|
+
{
|
|
305
|
+
var _ = e.toString;
|
|
306
|
+
if (U(_)) {
|
|
307
|
+
var n = _.call(e);
|
|
308
|
+
if (!g(n))
|
|
309
|
+
return n;
|
|
310
|
+
}
|
|
311
|
+
var r = e.valueOf;
|
|
312
|
+
if (U(r)) {
|
|
313
|
+
var n = r.call(e);
|
|
314
|
+
if (!g(n))
|
|
315
|
+
return n;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
throw new TypeError();
|
|
319
|
+
}
|
|
320
|
+
function ne(e) {
|
|
321
|
+
return !!e;
|
|
322
|
+
}
|
|
323
|
+
function Se(e) {
|
|
324
|
+
return "" + e;
|
|
325
|
+
}
|
|
326
|
+
function T(e) {
|
|
327
|
+
var t = Ie(e);
|
|
328
|
+
return xe(t) ? t : Se(t);
|
|
329
|
+
}
|
|
330
|
+
function ae(e) {
|
|
331
|
+
return Array.isArray ? Array.isArray(e) : e instanceof Object ? e instanceof Array : Object.prototype.toString.call(e) === "[object Array]";
|
|
332
|
+
}
|
|
333
|
+
function U(e) {
|
|
334
|
+
return typeof e == "function";
|
|
335
|
+
}
|
|
336
|
+
function ie(e) {
|
|
337
|
+
return typeof e == "function";
|
|
338
|
+
}
|
|
339
|
+
function De(e) {
|
|
340
|
+
switch (re(e)) {
|
|
341
|
+
case 3:
|
|
342
|
+
return !0;
|
|
343
|
+
case 4:
|
|
344
|
+
return !0;
|
|
345
|
+
default:
|
|
346
|
+
return !1;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function B(e, t) {
|
|
350
|
+
return e === t || e !== e && t !== t;
|
|
351
|
+
}
|
|
352
|
+
function oe(e, t) {
|
|
353
|
+
var r = e[t];
|
|
354
|
+
if (r != null) {
|
|
355
|
+
if (!U(r))
|
|
356
|
+
throw new TypeError();
|
|
357
|
+
return r;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function ue(e) {
|
|
361
|
+
var t = oe(e, E);
|
|
362
|
+
if (!U(t))
|
|
363
|
+
throw new TypeError();
|
|
364
|
+
var r = t.call(e);
|
|
365
|
+
if (!g(r))
|
|
366
|
+
throw new TypeError();
|
|
367
|
+
return r;
|
|
368
|
+
}
|
|
369
|
+
function fe(e) {
|
|
370
|
+
return e.value;
|
|
371
|
+
}
|
|
372
|
+
function se(e) {
|
|
373
|
+
var t = e.next();
|
|
374
|
+
return t.done ? !1 : t;
|
|
375
|
+
}
|
|
376
|
+
function ce(e) {
|
|
377
|
+
var t = e.return;
|
|
378
|
+
t && t.call(e);
|
|
379
|
+
}
|
|
380
|
+
function L(e) {
|
|
381
|
+
var t = Object.getPrototypeOf(e);
|
|
382
|
+
if (typeof e != "function" || e === C || t !== C)
|
|
383
|
+
return t;
|
|
384
|
+
var r = e.prototype, n = r && Object.getPrototypeOf(r);
|
|
385
|
+
if (n == null || n === Object.prototype)
|
|
386
|
+
return t;
|
|
387
|
+
var c = n.constructor;
|
|
388
|
+
return typeof c != "function" || c === e ? t : c;
|
|
389
|
+
}
|
|
390
|
+
function je() {
|
|
391
|
+
var e;
|
|
392
|
+
!h(S) && typeof l.Reflect < "u" && !(S in l.Reflect) && typeof l.Reflect.defineMetadata == "function" && (e = qe(l.Reflect));
|
|
393
|
+
var t, r, n, c = new Y(), _ = {
|
|
394
|
+
registerProvider: b,
|
|
395
|
+
getProvider: i,
|
|
396
|
+
setProvider: u
|
|
397
|
+
};
|
|
398
|
+
return _;
|
|
399
|
+
function b(s) {
|
|
400
|
+
if (!Object.isExtensible(_))
|
|
401
|
+
throw new Error("Cannot add provider to a frozen registry.");
|
|
402
|
+
switch (!0) {
|
|
403
|
+
case e === s:
|
|
404
|
+
break;
|
|
405
|
+
case h(t):
|
|
406
|
+
t = s;
|
|
407
|
+
break;
|
|
408
|
+
case t === s:
|
|
409
|
+
break;
|
|
410
|
+
case h(r):
|
|
411
|
+
r = s;
|
|
412
|
+
break;
|
|
413
|
+
case r === s:
|
|
414
|
+
break;
|
|
415
|
+
default:
|
|
416
|
+
n === void 0 && (n = new N()), n.add(s);
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function v(s, y) {
|
|
421
|
+
if (!h(t)) {
|
|
422
|
+
if (t.isProviderFor(s, y))
|
|
423
|
+
return t;
|
|
424
|
+
if (!h(r)) {
|
|
425
|
+
if (r.isProviderFor(s, y))
|
|
426
|
+
return t;
|
|
427
|
+
if (!h(n))
|
|
428
|
+
for (var w = ue(n); ; ) {
|
|
429
|
+
var M = se(w);
|
|
430
|
+
if (!M)
|
|
431
|
+
return;
|
|
432
|
+
var P = fe(M);
|
|
433
|
+
if (P.isProviderFor(s, y))
|
|
434
|
+
return ce(w), P;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (!h(e) && e.isProviderFor(s, y))
|
|
439
|
+
return e;
|
|
440
|
+
}
|
|
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;
|
|
444
|
+
}
|
|
445
|
+
function o(s) {
|
|
446
|
+
if (h(s))
|
|
447
|
+
throw new TypeError();
|
|
448
|
+
return t === s || r === s || !h(n) && n.has(s);
|
|
449
|
+
}
|
|
450
|
+
function u(s, y, w) {
|
|
451
|
+
if (!o(w))
|
|
452
|
+
throw new Error("Metadata provider not registered.");
|
|
453
|
+
var M = i(s, y);
|
|
454
|
+
if (M !== w) {
|
|
455
|
+
if (!h(M))
|
|
456
|
+
return !1;
|
|
457
|
+
var P = c.get(s);
|
|
458
|
+
h(P) && (P = new G(), c.set(s, P)), P.set(y, w);
|
|
459
|
+
}
|
|
460
|
+
return !0;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
function Ce() {
|
|
464
|
+
var e;
|
|
465
|
+
return !h(S) && g(l.Reflect) && Object.isExtensible(l.Reflect) && (e = l.Reflect[S]), h(e) && (e = je()), !h(S) && g(l.Reflect) && Object.isExtensible(l.Reflect) && Object.defineProperty(l.Reflect, S, {
|
|
466
|
+
enumerable: !1,
|
|
467
|
+
configurable: !1,
|
|
468
|
+
writable: !1,
|
|
469
|
+
value: e
|
|
470
|
+
}), e;
|
|
471
|
+
}
|
|
472
|
+
function Ge(e) {
|
|
473
|
+
var t = new Y(), r = {
|
|
474
|
+
isProviderFor: function(o, u) {
|
|
475
|
+
var s = t.get(o);
|
|
476
|
+
return h(s) ? !1 : s.has(u);
|
|
477
|
+
},
|
|
478
|
+
OrdinaryDefineOwnMetadata: b,
|
|
479
|
+
OrdinaryHasOwnMetadata: c,
|
|
480
|
+
OrdinaryGetOwnMetadata: _,
|
|
481
|
+
OrdinaryOwnMetadataKeys: v,
|
|
482
|
+
OrdinaryDeleteMetadata: i
|
|
483
|
+
};
|
|
484
|
+
return F.registerProvider(r), r;
|
|
485
|
+
function n(o, u, s) {
|
|
486
|
+
var y = t.get(o), w = !1;
|
|
487
|
+
if (h(y)) {
|
|
488
|
+
if (!s)
|
|
489
|
+
return;
|
|
490
|
+
y = new G(), t.set(o, y), w = !0;
|
|
491
|
+
}
|
|
492
|
+
var M = y.get(u);
|
|
493
|
+
if (h(M)) {
|
|
494
|
+
if (!s)
|
|
495
|
+
return;
|
|
496
|
+
if (M = new G(), y.set(u, M), !e.setProvider(o, u, r))
|
|
497
|
+
throw y.delete(u), w && t.delete(o), new Error("Wrong provider for target.");
|
|
498
|
+
}
|
|
499
|
+
return M;
|
|
500
|
+
}
|
|
501
|
+
function c(o, u, s) {
|
|
502
|
+
var y = n(
|
|
503
|
+
u,
|
|
504
|
+
s,
|
|
505
|
+
/*Create*/
|
|
506
|
+
!1
|
|
507
|
+
);
|
|
508
|
+
return h(y) ? !1 : ne(y.has(o));
|
|
509
|
+
}
|
|
510
|
+
function _(o, u, s) {
|
|
511
|
+
var y = n(
|
|
512
|
+
u,
|
|
513
|
+
s,
|
|
514
|
+
/*Create*/
|
|
515
|
+
!1
|
|
516
|
+
);
|
|
517
|
+
if (!h(y))
|
|
518
|
+
return y.get(o);
|
|
519
|
+
}
|
|
520
|
+
function b(o, u, s, y) {
|
|
521
|
+
var w = n(
|
|
522
|
+
s,
|
|
523
|
+
y,
|
|
524
|
+
/*Create*/
|
|
525
|
+
!0
|
|
526
|
+
);
|
|
527
|
+
w.set(o, u);
|
|
528
|
+
}
|
|
529
|
+
function v(o, u) {
|
|
530
|
+
var s = [], y = n(
|
|
531
|
+
o,
|
|
532
|
+
u,
|
|
533
|
+
/*Create*/
|
|
534
|
+
!1
|
|
535
|
+
);
|
|
536
|
+
if (h(y))
|
|
537
|
+
return s;
|
|
538
|
+
for (var w = y.keys(), M = ue(w), P = 0; ; ) {
|
|
539
|
+
var de = se(M);
|
|
540
|
+
if (!de)
|
|
541
|
+
return s.length = P, s;
|
|
542
|
+
var We = fe(de);
|
|
543
|
+
try {
|
|
544
|
+
s[P] = We;
|
|
545
|
+
} catch (Ne) {
|
|
546
|
+
try {
|
|
547
|
+
ce(M);
|
|
548
|
+
} finally {
|
|
549
|
+
throw Ne;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
P++;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function i(o, u, s) {
|
|
556
|
+
var y = n(
|
|
557
|
+
u,
|
|
558
|
+
s,
|
|
559
|
+
/*Create*/
|
|
560
|
+
!1
|
|
561
|
+
);
|
|
562
|
+
if (h(y) || !y.delete(o))
|
|
563
|
+
return !1;
|
|
564
|
+
if (y.size === 0) {
|
|
565
|
+
var w = t.get(u);
|
|
566
|
+
h(w) || (w.delete(s), w.size === 0 && t.delete(w));
|
|
567
|
+
}
|
|
568
|
+
return !0;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
function qe(e) {
|
|
572
|
+
var t = e.defineMetadata, r = e.hasOwnMetadata, n = e.getOwnMetadata, c = e.getOwnMetadataKeys, _ = e.deleteMetadata, b = new Y(), v = {
|
|
573
|
+
isProviderFor: function(i, o) {
|
|
574
|
+
var u = b.get(i);
|
|
575
|
+
return !h(u) && u.has(o) ? !0 : c(i, o).length ? (h(u) && (u = new N(), b.set(i, u)), u.add(o), !0) : !1;
|
|
576
|
+
},
|
|
577
|
+
OrdinaryDefineOwnMetadata: t,
|
|
578
|
+
OrdinaryHasOwnMetadata: r,
|
|
579
|
+
OrdinaryGetOwnMetadata: n,
|
|
580
|
+
OrdinaryOwnMetadataKeys: c,
|
|
581
|
+
OrdinaryDeleteMetadata: _
|
|
582
|
+
};
|
|
583
|
+
return v;
|
|
584
|
+
}
|
|
585
|
+
function q(e, t, r) {
|
|
586
|
+
var n = F.getProvider(e, t);
|
|
587
|
+
if (!h(n))
|
|
588
|
+
return n;
|
|
589
|
+
if (r) {
|
|
590
|
+
if (F.setProvider(e, t, Z))
|
|
591
|
+
return Z;
|
|
592
|
+
throw new Error("Illegal state.");
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
function He() {
|
|
596
|
+
var e = {}, t = [], r = (
|
|
597
|
+
/** @class */
|
|
598
|
+
(function() {
|
|
599
|
+
function v(i, o, u) {
|
|
600
|
+
this._index = 0, this._keys = i, this._values = o, this._selector = u;
|
|
601
|
+
}
|
|
602
|
+
return v.prototype["@@iterator"] = function() {
|
|
603
|
+
return this;
|
|
604
|
+
}, v.prototype[E] = function() {
|
|
605
|
+
return this;
|
|
606
|
+
}, v.prototype.next = function() {
|
|
607
|
+
var i = this._index;
|
|
608
|
+
if (i >= 0 && i < this._keys.length) {
|
|
609
|
+
var o = this._selector(this._keys[i], this._values[i]);
|
|
610
|
+
return i + 1 >= this._keys.length ? (this._index = -1, this._keys = t, this._values = t) : this._index++, { value: o, done: !1 };
|
|
611
|
+
}
|
|
612
|
+
return { value: void 0, done: !0 };
|
|
613
|
+
}, v.prototype.throw = function(i) {
|
|
614
|
+
throw this._index >= 0 && (this._index = -1, this._keys = t, this._values = t), i;
|
|
615
|
+
}, v.prototype.return = function(i) {
|
|
616
|
+
return this._index >= 0 && (this._index = -1, this._keys = t, this._values = t), { value: i, done: !0 };
|
|
617
|
+
}, v;
|
|
618
|
+
})()
|
|
619
|
+
), n = (
|
|
620
|
+
/** @class */
|
|
621
|
+
(function() {
|
|
622
|
+
function v() {
|
|
623
|
+
this._keys = [], this._values = [], this._cacheKey = e, this._cacheIndex = -2;
|
|
624
|
+
}
|
|
625
|
+
return Object.defineProperty(v.prototype, "size", {
|
|
626
|
+
get: function() {
|
|
627
|
+
return this._keys.length;
|
|
628
|
+
},
|
|
629
|
+
enumerable: !0,
|
|
630
|
+
configurable: !0
|
|
631
|
+
}), v.prototype.has = function(i) {
|
|
632
|
+
return this._find(
|
|
633
|
+
i,
|
|
634
|
+
/*insert*/
|
|
635
|
+
!1
|
|
636
|
+
) >= 0;
|
|
637
|
+
}, v.prototype.get = function(i) {
|
|
638
|
+
var o = this._find(
|
|
639
|
+
i,
|
|
640
|
+
/*insert*/
|
|
641
|
+
!1
|
|
642
|
+
);
|
|
643
|
+
return o >= 0 ? this._values[o] : void 0;
|
|
644
|
+
}, v.prototype.set = function(i, o) {
|
|
645
|
+
var u = this._find(
|
|
646
|
+
i,
|
|
647
|
+
/*insert*/
|
|
648
|
+
!0
|
|
649
|
+
);
|
|
650
|
+
return this._values[u] = o, this;
|
|
651
|
+
}, v.prototype.delete = function(i) {
|
|
652
|
+
var o = this._find(
|
|
653
|
+
i,
|
|
654
|
+
/*insert*/
|
|
655
|
+
!1
|
|
656
|
+
);
|
|
657
|
+
if (o >= 0) {
|
|
658
|
+
for (var u = this._keys.length, s = o + 1; s < u; s++)
|
|
659
|
+
this._keys[s - 1] = this._keys[s], this._values[s - 1] = this._values[s];
|
|
660
|
+
return this._keys.length--, this._values.length--, B(i, this._cacheKey) && (this._cacheKey = e, this._cacheIndex = -2), !0;
|
|
661
|
+
}
|
|
662
|
+
return !1;
|
|
663
|
+
}, v.prototype.clear = function() {
|
|
664
|
+
this._keys.length = 0, this._values.length = 0, this._cacheKey = e, this._cacheIndex = -2;
|
|
665
|
+
}, v.prototype.keys = function() {
|
|
666
|
+
return new r(this._keys, this._values, c);
|
|
667
|
+
}, v.prototype.values = function() {
|
|
668
|
+
return new r(this._keys, this._values, _);
|
|
669
|
+
}, v.prototype.entries = function() {
|
|
670
|
+
return new r(this._keys, this._values, b);
|
|
671
|
+
}, v.prototype["@@iterator"] = function() {
|
|
672
|
+
return this.entries();
|
|
673
|
+
}, v.prototype[E] = function() {
|
|
674
|
+
return this.entries();
|
|
675
|
+
}, v.prototype._find = function(i, o) {
|
|
676
|
+
if (!B(this._cacheKey, i)) {
|
|
677
|
+
this._cacheIndex = -1;
|
|
678
|
+
for (var u = 0; u < this._keys.length; u++)
|
|
679
|
+
if (B(this._keys[u], i)) {
|
|
680
|
+
this._cacheIndex = u;
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
return this._cacheIndex < 0 && o && (this._cacheIndex = this._keys.length, this._keys.push(i), this._values.push(void 0)), this._cacheIndex;
|
|
685
|
+
}, v;
|
|
686
|
+
})()
|
|
687
|
+
);
|
|
688
|
+
return n;
|
|
689
|
+
function c(v, i) {
|
|
690
|
+
return v;
|
|
691
|
+
}
|
|
692
|
+
function _(v, i) {
|
|
693
|
+
return i;
|
|
694
|
+
}
|
|
695
|
+
function b(v, i) {
|
|
696
|
+
return [v, i];
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
function Fe() {
|
|
700
|
+
var e = (
|
|
701
|
+
/** @class */
|
|
702
|
+
(function() {
|
|
703
|
+
function t() {
|
|
704
|
+
this._map = new G();
|
|
705
|
+
}
|
|
706
|
+
return Object.defineProperty(t.prototype, "size", {
|
|
707
|
+
get: function() {
|
|
708
|
+
return this._map.size;
|
|
709
|
+
},
|
|
710
|
+
enumerable: !0,
|
|
711
|
+
configurable: !0
|
|
712
|
+
}), t.prototype.has = function(r) {
|
|
713
|
+
return this._map.has(r);
|
|
714
|
+
}, t.prototype.add = function(r) {
|
|
715
|
+
return this._map.set(r, r), this;
|
|
716
|
+
}, t.prototype.delete = function(r) {
|
|
717
|
+
return this._map.delete(r);
|
|
718
|
+
}, t.prototype.clear = function() {
|
|
719
|
+
this._map.clear();
|
|
720
|
+
}, t.prototype.keys = function() {
|
|
721
|
+
return this._map.keys();
|
|
722
|
+
}, t.prototype.values = function() {
|
|
723
|
+
return this._map.keys();
|
|
724
|
+
}, t.prototype.entries = function() {
|
|
725
|
+
return this._map.entries();
|
|
726
|
+
}, t.prototype["@@iterator"] = function() {
|
|
727
|
+
return this.keys();
|
|
728
|
+
}, t.prototype[E] = function() {
|
|
729
|
+
return this.keys();
|
|
730
|
+
}, t;
|
|
731
|
+
})()
|
|
732
|
+
);
|
|
733
|
+
return e;
|
|
734
|
+
}
|
|
735
|
+
function Ue() {
|
|
736
|
+
var e = 16, t = k.create(), r = n();
|
|
737
|
+
return (
|
|
738
|
+
/** @class */
|
|
739
|
+
(function() {
|
|
740
|
+
function i() {
|
|
741
|
+
this._key = n();
|
|
742
|
+
}
|
|
743
|
+
return i.prototype.has = function(o) {
|
|
744
|
+
var u = c(
|
|
745
|
+
o,
|
|
746
|
+
/*create*/
|
|
747
|
+
!1
|
|
748
|
+
);
|
|
749
|
+
return u !== void 0 ? k.has(u, this._key) : !1;
|
|
750
|
+
}, i.prototype.get = function(o) {
|
|
751
|
+
var u = c(
|
|
752
|
+
o,
|
|
753
|
+
/*create*/
|
|
754
|
+
!1
|
|
755
|
+
);
|
|
756
|
+
return u !== void 0 ? k.get(u, this._key) : void 0;
|
|
757
|
+
}, i.prototype.set = function(o, u) {
|
|
758
|
+
var s = c(
|
|
759
|
+
o,
|
|
760
|
+
/*create*/
|
|
761
|
+
!0
|
|
762
|
+
);
|
|
763
|
+
return s[this._key] = u, this;
|
|
764
|
+
}, i.prototype.delete = function(o) {
|
|
765
|
+
var u = c(
|
|
766
|
+
o,
|
|
767
|
+
/*create*/
|
|
768
|
+
!1
|
|
769
|
+
);
|
|
770
|
+
return u !== void 0 ? delete u[this._key] : !1;
|
|
771
|
+
}, i.prototype.clear = function() {
|
|
772
|
+
this._key = n();
|
|
773
|
+
}, i;
|
|
774
|
+
})()
|
|
775
|
+
);
|
|
776
|
+
function n() {
|
|
777
|
+
var i;
|
|
778
|
+
do
|
|
779
|
+
i = "@@WeakMap@@" + v();
|
|
780
|
+
while (k.has(t, i));
|
|
781
|
+
return t[i] = !0, i;
|
|
782
|
+
}
|
|
783
|
+
function c(i, o) {
|
|
784
|
+
if (!p.call(i, r)) {
|
|
785
|
+
if (!o)
|
|
786
|
+
return;
|
|
787
|
+
Object.defineProperty(i, r, { value: k.create() });
|
|
788
|
+
}
|
|
789
|
+
return i[r];
|
|
790
|
+
}
|
|
791
|
+
function _(i, o) {
|
|
792
|
+
for (var u = 0; u < o; ++u)
|
|
793
|
+
i[u] = Math.random() * 255 | 0;
|
|
794
|
+
return i;
|
|
795
|
+
}
|
|
796
|
+
function b(i) {
|
|
797
|
+
if (typeof Uint8Array == "function") {
|
|
798
|
+
var o = new Uint8Array(i);
|
|
799
|
+
return typeof crypto < "u" ? crypto.getRandomValues(o) : typeof msCrypto < "u" ? msCrypto.getRandomValues(o) : _(o, i), o;
|
|
800
|
+
}
|
|
801
|
+
return _(new Array(i), i);
|
|
802
|
+
}
|
|
803
|
+
function v() {
|
|
804
|
+
var i = b(e);
|
|
805
|
+
i[6] = i[6] & 79 | 64, i[8] = i[8] & 191 | 128;
|
|
806
|
+
for (var o = "", u = 0; u < e; ++u) {
|
|
807
|
+
var s = i[u];
|
|
808
|
+
(u === 4 || u === 6 || u === 8) && (o += "-"), s < 16 && (o += "0"), o += s.toString(16).toLowerCase();
|
|
809
|
+
}
|
|
810
|
+
return o;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
function z(e) {
|
|
814
|
+
return e.__ = void 0, delete e.__, e;
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
})(a || (a = {})), he;
|
|
818
|
+
}
|
|
819
|
+
Le();
|
|
820
|
+
const pe = Symbol("endpoint:metadata");
|
|
821
|
+
function x(a, f = "", d = {}) {
|
|
822
|
+
return function(l, p) {
|
|
823
|
+
const O = {
|
|
824
|
+
method: a,
|
|
825
|
+
path: f,
|
|
826
|
+
...d
|
|
827
|
+
};
|
|
828
|
+
Reflect.defineMetadata(
|
|
829
|
+
pe,
|
|
830
|
+
O,
|
|
831
|
+
l,
|
|
832
|
+
p
|
|
833
|
+
);
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
function st(a = "", f = {}) {
|
|
837
|
+
return x(R.GET, a, f);
|
|
838
|
+
}
|
|
839
|
+
function ct(a = "", f = {}) {
|
|
840
|
+
return x(R.POST, a, f);
|
|
841
|
+
}
|
|
842
|
+
function dt(a = "", f = {}) {
|
|
843
|
+
return x(R.PUT, a, f);
|
|
844
|
+
}
|
|
845
|
+
function lt(a = "", f = {}) {
|
|
846
|
+
return x(R.DELETE, a, f);
|
|
847
|
+
}
|
|
848
|
+
function ht(a = "", f = {}) {
|
|
849
|
+
return x(R.PATCH, a, f);
|
|
850
|
+
}
|
|
851
|
+
function vt(a = "", f = {}) {
|
|
852
|
+
return x(R.HEAD, a, f);
|
|
853
|
+
}
|
|
854
|
+
function yt(a = "", f = {}) {
|
|
855
|
+
return x(R.OPTIONS, a, f);
|
|
856
|
+
}
|
|
857
|
+
function ze(a) {
|
|
858
|
+
if (typeof a != "function")
|
|
859
|
+
throw new TypeError("Expected a function");
|
|
860
|
+
try {
|
|
861
|
+
const f = a.toString().trim(), d = Je(f);
|
|
862
|
+
return Ze(d) ? Xe(d) : [];
|
|
863
|
+
} catch {
|
|
864
|
+
return [];
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
function Qe(a, f, d, l) {
|
|
868
|
+
if (l)
|
|
869
|
+
return l;
|
|
870
|
+
try {
|
|
871
|
+
const p = a[f];
|
|
872
|
+
if (p) {
|
|
873
|
+
const O = ze(p);
|
|
874
|
+
if (d < O.length)
|
|
875
|
+
return O[d];
|
|
876
|
+
}
|
|
877
|
+
} catch {
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
function Ze(a) {
|
|
881
|
+
return a != null && a.trim() !== "";
|
|
882
|
+
}
|
|
883
|
+
function Je(a) {
|
|
884
|
+
if (a.startsWith("(")) {
|
|
885
|
+
const l = ye(a, 0);
|
|
886
|
+
return l === -1 ? "" : a.substring(1, l);
|
|
887
|
+
}
|
|
888
|
+
const f = a.indexOf("(");
|
|
889
|
+
if (f === -1) return "";
|
|
890
|
+
const d = ye(a, f);
|
|
891
|
+
return d === -1 ? "" : a.substring(f + 1, d);
|
|
892
|
+
}
|
|
893
|
+
function ye(a, f) {
|
|
894
|
+
let d = 1;
|
|
895
|
+
for (let l = f + 1; l < a.length; l++) {
|
|
896
|
+
const p = a[l];
|
|
897
|
+
if (p === "(")
|
|
898
|
+
d++;
|
|
899
|
+
else if (p === ")" && (d--, d === 0))
|
|
900
|
+
return l;
|
|
901
|
+
}
|
|
902
|
+
return -1;
|
|
903
|
+
}
|
|
904
|
+
function Xe(a) {
|
|
905
|
+
return a.split(",").map($e).filter(Ke).map(et);
|
|
906
|
+
}
|
|
907
|
+
function $e(a) {
|
|
908
|
+
return a.trim();
|
|
909
|
+
}
|
|
910
|
+
function Ke(a) {
|
|
911
|
+
return a.length > 0;
|
|
912
|
+
}
|
|
913
|
+
function et(a) {
|
|
914
|
+
let f = tt(a);
|
|
915
|
+
return f = rt(f), f.trim();
|
|
916
|
+
}
|
|
917
|
+
function tt(a) {
|
|
918
|
+
const f = a.indexOf("=");
|
|
919
|
+
return f !== -1 ? a.substring(0, f) : a;
|
|
920
|
+
}
|
|
921
|
+
function rt(a) {
|
|
922
|
+
const f = a.indexOf(":");
|
|
923
|
+
return f !== -1 ? a.substring(0, f) : a;
|
|
924
|
+
}
|
|
925
|
+
var H = /* @__PURE__ */ ((a) => (a.PATH = "path", a.QUERY = "query", a.HEADER = "header", a.BODY = "body", a))(H || {});
|
|
926
|
+
const Q = Symbol("parameter:metadata");
|
|
927
|
+
function W(a, f = "") {
|
|
928
|
+
return function(d, l, p) {
|
|
929
|
+
const O = Qe(
|
|
930
|
+
d,
|
|
931
|
+
l,
|
|
932
|
+
p,
|
|
933
|
+
f
|
|
934
|
+
), m = Reflect.getMetadata(Q, d, l) || [];
|
|
935
|
+
m.push({
|
|
936
|
+
type: a,
|
|
937
|
+
name: O,
|
|
938
|
+
index: p
|
|
939
|
+
}), Reflect.defineMetadata(
|
|
940
|
+
Q,
|
|
941
|
+
m,
|
|
942
|
+
d,
|
|
943
|
+
l
|
|
944
|
+
);
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
function pt(a = "") {
|
|
948
|
+
return W("path", a);
|
|
949
|
+
}
|
|
950
|
+
function wt(a = "") {
|
|
951
|
+
return W("query", a);
|
|
952
|
+
}
|
|
953
|
+
function _t(a = "") {
|
|
954
|
+
return W("header", a);
|
|
955
|
+
}
|
|
956
|
+
function Mt() {
|
|
957
|
+
return W(
|
|
958
|
+
"body"
|
|
959
|
+
/* BODY */
|
|
960
|
+
);
|
|
961
|
+
}
|
|
962
|
+
class nt {
|
|
963
|
+
/**
|
|
964
|
+
* Creates a new FunctionMetadata instance
|
|
965
|
+
*
|
|
966
|
+
* @param name - The name of the function
|
|
967
|
+
* @param api - API-level metadata
|
|
968
|
+
* @param endpoint - Endpoint-level metadata
|
|
969
|
+
* @param parameters - Parameter metadata array
|
|
970
|
+
*/
|
|
971
|
+
constructor(f, d, l, p) {
|
|
972
|
+
this.name = f, this.api = d, this.endpoint = l, this.parameters = p;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Gets the fetcher instance to use for this function
|
|
976
|
+
*
|
|
977
|
+
* Returns the fetcher specified in the endpoint metadata, or the API metadata,
|
|
978
|
+
* or falls back to the default fetcher if none is specified.
|
|
979
|
+
*
|
|
980
|
+
* @returns The fetcher instance
|
|
981
|
+
*/
|
|
982
|
+
get fetcher() {
|
|
983
|
+
const f = this.endpoint.fetcher || this.api.fetcher || Ye;
|
|
984
|
+
return Ve.requiredGet(f);
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Resolves the request configuration from the method arguments
|
|
988
|
+
*
|
|
989
|
+
* This method processes the runtime arguments according to the parameter metadata
|
|
990
|
+
* and constructs a FetcherRequest object with path parameters, query parameters,
|
|
991
|
+
* headers, body, and timeout.
|
|
992
|
+
*
|
|
993
|
+
* @param args - The runtime arguments passed to the method
|
|
994
|
+
* @returns A FetcherRequest object with all request configuration
|
|
995
|
+
*/
|
|
996
|
+
resolveRequest(f) {
|
|
997
|
+
const d = {}, l = {}, p = {
|
|
998
|
+
...this.api.headers,
|
|
999
|
+
...this.endpoint.headers
|
|
1000
|
+
};
|
|
1001
|
+
let O = null;
|
|
1002
|
+
return this.parameters.forEach((m) => {
|
|
1003
|
+
const E = f[m.index];
|
|
1004
|
+
switch (m.type) {
|
|
1005
|
+
case H.PATH:
|
|
1006
|
+
m.name ? d[m.name] = E : d["param" + m.index] = E;
|
|
1007
|
+
break;
|
|
1008
|
+
case H.QUERY:
|
|
1009
|
+
m.name ? l[m.name] = E : l["param" + m.index] = E;
|
|
1010
|
+
break;
|
|
1011
|
+
case H.HEADER:
|
|
1012
|
+
m.name && E !== void 0 && (p[m.name] = String(E));
|
|
1013
|
+
break;
|
|
1014
|
+
case H.BODY:
|
|
1015
|
+
O = E;
|
|
1016
|
+
break;
|
|
1017
|
+
}
|
|
1018
|
+
}), {
|
|
1019
|
+
pathParams: d,
|
|
1020
|
+
queryParams: l,
|
|
1021
|
+
headers: p,
|
|
1022
|
+
body: O,
|
|
1023
|
+
timeout: this.resolveTimeout()
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Resolves the full path for the request
|
|
1028
|
+
*
|
|
1029
|
+
* Combines the base path from API metadata with the endpoint path
|
|
1030
|
+
* from endpoint metadata to create the complete path.
|
|
1031
|
+
*
|
|
1032
|
+
* @returns The full path for the request
|
|
1033
|
+
*/
|
|
1034
|
+
resolvePath() {
|
|
1035
|
+
const f = this.endpoint.basePath || this.api.basePath || "", d = this.endpoint.path || "";
|
|
1036
|
+
return Be(f, d);
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Resolves the timeout for the request
|
|
1040
|
+
*
|
|
1041
|
+
* Returns the timeout specified in the endpoint metadata, or the API metadata,
|
|
1042
|
+
* or undefined if no timeout is specified.
|
|
1043
|
+
*
|
|
1044
|
+
* @returns The timeout value in milliseconds, or undefined
|
|
1045
|
+
*/
|
|
1046
|
+
resolveTimeout() {
|
|
1047
|
+
return this.endpoint.timeout || this.api.timeout;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
class at {
|
|
1051
|
+
/**
|
|
1052
|
+
* Creates a new RequestExecutor instance
|
|
1053
|
+
*
|
|
1054
|
+
* @param metadata - The function metadata containing all request information
|
|
1055
|
+
*/
|
|
1056
|
+
constructor(f) {
|
|
1057
|
+
this.metadata = f;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Executes the HTTP request
|
|
1061
|
+
*
|
|
1062
|
+
* This method resolves the path and request configuration from the metadata
|
|
1063
|
+
* and arguments, then executes the request using the configured fetcher.
|
|
1064
|
+
*
|
|
1065
|
+
* @param args - The runtime arguments passed to the method
|
|
1066
|
+
* @returns A Promise that resolves to the Response
|
|
1067
|
+
*/
|
|
1068
|
+
async execute(f) {
|
|
1069
|
+
const d = this.metadata.resolvePath(), l = this.metadata.resolveRequest(f);
|
|
1070
|
+
return await this.metadata.fetcher.fetch(d, l);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
const it = Symbol("api:metadata");
|
|
1074
|
+
function ot(a, f, d) {
|
|
1075
|
+
const l = a.prototype[f];
|
|
1076
|
+
if (f === "constructor" || typeof l != "function")
|
|
1077
|
+
return;
|
|
1078
|
+
const p = Reflect.getMetadata(
|
|
1079
|
+
pe,
|
|
1080
|
+
a.prototype,
|
|
1081
|
+
f
|
|
1082
|
+
);
|
|
1083
|
+
if (!p)
|
|
1084
|
+
return;
|
|
1085
|
+
const O = Reflect.getMetadata(
|
|
1086
|
+
Q,
|
|
1087
|
+
a.prototype,
|
|
1088
|
+
f
|
|
1089
|
+
) || [], m = new nt(
|
|
1090
|
+
f,
|
|
1091
|
+
d,
|
|
1092
|
+
p,
|
|
1093
|
+
O
|
|
1094
|
+
), E = new at(m);
|
|
1095
|
+
a.prototype[f] = function(...I) {
|
|
1096
|
+
return E.execute(I);
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
function mt(a = "", f = {}) {
|
|
1100
|
+
return function(d) {
|
|
1101
|
+
const l = {
|
|
1102
|
+
basePath: a,
|
|
1103
|
+
...f
|
|
1104
|
+
};
|
|
1105
|
+
Reflect.defineMetadata(it, l, d), Object.getOwnPropertyNames(d.prototype).forEach((p) => {
|
|
1106
|
+
ot(d, p, l);
|
|
1107
|
+
});
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
class ut extends Error {
|
|
1111
|
+
constructor() {
|
|
1112
|
+
super("Implementation will be generated automatically."), this.name = "AutoGenerated";
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
const gt = () => new ut();
|
|
1116
|
+
export {
|
|
1117
|
+
it as API_METADATA_KEY,
|
|
1118
|
+
ut as AutoGenerated,
|
|
1119
|
+
pe as ENDPOINT_METADATA_KEY,
|
|
1120
|
+
nt as FunctionMetadata,
|
|
1121
|
+
Q as PARAMETER_METADATA_KEY,
|
|
1122
|
+
H as ParameterType,
|
|
1123
|
+
at as RequestExecutor,
|
|
1124
|
+
mt as api,
|
|
1125
|
+
gt as autoGeneratedError,
|
|
1126
|
+
Mt as body,
|
|
1127
|
+
lt as del,
|
|
1128
|
+
x as endpoint,
|
|
1129
|
+
st as get,
|
|
1130
|
+
Qe as getParameterName,
|
|
1131
|
+
ze as getParameterNames,
|
|
1132
|
+
vt as head,
|
|
1133
|
+
_t as header,
|
|
1134
|
+
yt as options,
|
|
1135
|
+
W as parameter,
|
|
1136
|
+
ht as patch,
|
|
1137
|
+
pt as path,
|
|
1138
|
+
ct as post,
|
|
1139
|
+
dt as put,
|
|
1140
|
+
wt as query
|
|
1141
|
+
};
|