@ahoo-wang/fetcher-decorator 1.0.1 → 1.0.2
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/endpointDecorator.d.ts +12 -10
- package/dist/endpointDecorator.d.ts.map +1 -1
- package/dist/index.es.js +135 -140
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/parameterDecorator.d.ts +14 -2
- package/dist/parameterDecorator.d.ts.map +1 -1
- package/dist/requestExecutor.d.ts +6 -8
- package/dist/requestExecutor.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { HttpMethod } from '@ahoo-wang/fetcher';
|
|
2
2
|
import { ApiMetadata } from './apiDecorator';
|
|
3
3
|
import { ResultExtractorCapable } from './resultExtractor';
|
|
4
|
+
export interface PathCapable {
|
|
5
|
+
/**
|
|
6
|
+
* Path for the endpoint (relative to class base path).
|
|
7
|
+
*
|
|
8
|
+
* This path will be appended to the class's base path to form the complete URL.
|
|
9
|
+
* Path parameters can be specified using curly braces, e.g., '/users/{id}'
|
|
10
|
+
*/
|
|
11
|
+
path?: string;
|
|
12
|
+
}
|
|
4
13
|
/**
|
|
5
14
|
* Metadata for HTTP endpoints.
|
|
6
15
|
*
|
|
7
16
|
* Defines the configuration options for individual HTTP endpoints (methods).
|
|
8
17
|
* These settings will override any corresponding class-level settings from ApiMetadata.
|
|
9
18
|
*/
|
|
10
|
-
export interface EndpointMetadata extends ApiMetadata, ResultExtractorCapable {
|
|
19
|
+
export interface EndpointMetadata extends ApiMetadata, ResultExtractorCapable, PathCapable {
|
|
11
20
|
/**
|
|
12
21
|
* HTTP method for the endpoint.
|
|
13
22
|
*
|
|
14
23
|
* Specifies the HTTP verb to be used for this endpoint (GET, POST, PUT, DELETE, etc.)
|
|
15
24
|
*/
|
|
16
|
-
method
|
|
17
|
-
/**
|
|
18
|
-
* Path for the endpoint (relative to class base path).
|
|
19
|
-
*
|
|
20
|
-
* This path will be appended to the class's base path to form the complete URL.
|
|
21
|
-
* Path parameters can be specified using curly braces, e.g., '/users/{id}'
|
|
22
|
-
*/
|
|
23
|
-
path?: string;
|
|
25
|
+
method?: HttpMethod;
|
|
24
26
|
}
|
|
25
27
|
export declare const ENDPOINT_METADATA_KEY: unique symbol;
|
|
26
28
|
export type MethodEndpointMetadata = Omit<EndpointMetadata, 'method' | 'path'>;
|
|
@@ -48,7 +50,7 @@ export type MethodEndpointMetadata = Omit<EndpointMetadata, 'method' | 'path'>;
|
|
|
48
50
|
* }
|
|
49
51
|
* ```
|
|
50
52
|
*/
|
|
51
|
-
export declare function endpoint(method
|
|
53
|
+
export declare function endpoint(method?: HttpMethod, path?: string, metadata?: MethodEndpointMetadata): (target: object, propertyKey: string | symbol) => void;
|
|
52
54
|
export declare function get(path?: string, metadata?: MethodEndpointMetadata): (target: object, propertyKey: string | symbol) => void;
|
|
53
55
|
export declare function post(path?: string, metadata?: MethodEndpointMetadata): (target: object, propertyKey: string | symbol) => void;
|
|
54
56
|
export declare function put(path?: string, metadata?: MethodEndpointMetadata): (target: object, propertyKey: string | symbol) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpointDecorator.d.ts","sourceRoot":"","sources":["../src/endpointDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAmB,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW,EAAE,sBAAsB;
|
|
1
|
+
{"version":3,"file":"endpointDecorator.d.ts","sourceRoot":"","sources":["../src/endpointDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAmB,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE5E,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW,EAAE,sBAAsB,EAAE,WAAW;IACxF;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,eAAO,MAAM,qBAAqB,eAA8B,CAAC;AAEjE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,MAAM,CAAC,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,CACtB,MAAM,CAAC,EAAE,UAAU,EACnB,IAAI,CAAC,EAAE,MAAM,EACb,QAAQ,GAAE,sBAA2B,IAErB,QAAQ,MAAM,EAAE,aAAa,MAAM,GAAG,MAAM,KAAG,IAAI,CAcpE;AAED,wBAAgB,GAAG,CAAC,IAAI,GAAE,MAAW,EAAE,QAAQ,GAAE,sBAA2B,YAhBlD,MAAM,eAAe,MAAM,GAAG,MAAM,KAAG,IAAI,CAkBpE;AAED,wBAAgB,IAAI,CAAC,IAAI,GAAE,MAAW,EAAE,QAAQ,GAAE,sBAA2B,YApBnD,MAAM,eAAe,MAAM,GAAG,MAAM,KAAG,IAAI,CAsBpE;AAED,wBAAgB,GAAG,CAAC,IAAI,GAAE,MAAW,EAAE,QAAQ,GAAE,sBAA2B,YAxBlD,MAAM,eAAe,MAAM,GAAG,MAAM,KAAG,IAAI,CA0BpE;AAED,wBAAgB,GAAG,CAAC,IAAI,GAAE,MAAW,EAAE,QAAQ,GAAE,sBAA2B,YA5BlD,MAAM,eAAe,MAAM,GAAG,MAAM,KAAG,IAAI,CA8BpE;AAED,wBAAgB,KAAK,CACnB,IAAI,GAAE,MAAW,EACjB,QAAQ,GAAE,sBAA2B,YAlCb,MAAM,eAAe,MAAM,GAAG,MAAM,KAAG,IAAI,CAqCpE;AAED,wBAAgB,IAAI,CAAC,IAAI,GAAE,MAAW,EAAE,QAAQ,GAAE,sBAA2B,YAvCnD,MAAM,eAAe,MAAM,GAAG,MAAM,KAAG,IAAI,CAyCpE;AAED,wBAAgB,OAAO,CACrB,IAAI,GAAE,MAAW,EACjB,QAAQ,GAAE,sBAA2B,YA7Cb,MAAM,eAAe,MAAM,GAAG,MAAM,KAAG,IAAI,CAgDpE"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import { HttpMethod as c, ExchangeError as
|
|
1
|
+
import { HttpMethod as c, ExchangeError as g, fetcherRegistrar as v, Fetcher as q, fetcher as M, mergeRequest as S, combineURLs as w } from "@ahoo-wang/fetcher";
|
|
2
2
|
import "reflect-metadata";
|
|
3
|
-
const
|
|
4
|
-
function d(t, e
|
|
3
|
+
const T = Symbol("endpoint:metadata");
|
|
4
|
+
function d(t, e, r = {}) {
|
|
5
5
|
return function(n, s) {
|
|
6
|
-
const
|
|
6
|
+
const a = {
|
|
7
7
|
method: t,
|
|
8
8
|
path: e,
|
|
9
9
|
...r
|
|
10
10
|
};
|
|
11
11
|
Reflect.defineMetadata(
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
T,
|
|
13
|
+
a,
|
|
14
14
|
n,
|
|
15
15
|
s
|
|
16
16
|
);
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function et(t = "", e = {}) {
|
|
20
20
|
return d(c.GET, t, e);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function rt(t = "", e = {}) {
|
|
23
23
|
return d(c.POST, t, e);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function nt(t = "", e = {}) {
|
|
26
26
|
return d(c.PUT, t, e);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function st(t = "", e = {}) {
|
|
29
29
|
return d(c.DELETE, t, e);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function at(t = "", e = {}) {
|
|
32
32
|
return d(c.PATCH, t, e);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function ot(t = "", e = {}) {
|
|
35
35
|
return d(c.HEAD, t, e);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function it(t = "", e = {}) {
|
|
38
38
|
return d(c.OPTIONS, t, e);
|
|
39
39
|
}
|
|
40
40
|
const f = /* @__PURE__ */ new WeakMap();
|
|
41
|
-
function
|
|
41
|
+
function D(t) {
|
|
42
42
|
if (typeof t != "function")
|
|
43
43
|
throw new TypeError("Expected a function");
|
|
44
44
|
if (f.has(t))
|
|
45
45
|
return f.get(t);
|
|
46
46
|
try {
|
|
47
|
-
const e = t.toString().trim(), r =
|
|
48
|
-
if (!
|
|
47
|
+
const e = t.toString().trim(), r = F(e);
|
|
48
|
+
if (!H(r)) {
|
|
49
49
|
const s = [];
|
|
50
50
|
return f.set(t, s), s;
|
|
51
51
|
}
|
|
52
|
-
const n =
|
|
52
|
+
const n = _(r);
|
|
53
53
|
return f.set(t, n), n;
|
|
54
54
|
} catch {
|
|
55
55
|
const e = [];
|
|
56
56
|
return f.set(t, e), e;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function O(t, e, r, n) {
|
|
60
60
|
if (n)
|
|
61
61
|
return n;
|
|
62
62
|
try {
|
|
63
63
|
const s = t[e];
|
|
64
64
|
if (s && typeof s == "function") {
|
|
65
|
-
const
|
|
66
|
-
if (r <
|
|
67
|
-
return
|
|
65
|
+
const a = D(s);
|
|
66
|
+
if (r < a.length)
|
|
67
|
+
return a[r];
|
|
68
68
|
}
|
|
69
69
|
} catch {
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function H(t) {
|
|
73
73
|
return t != null && t.trim() !== "";
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function F(t) {
|
|
76
76
|
if (t.startsWith("(")) {
|
|
77
|
-
const n =
|
|
77
|
+
const n = P(t, 0);
|
|
78
78
|
return n === -1 ? "" : t.substring(1, n);
|
|
79
79
|
}
|
|
80
80
|
const e = t.indexOf("(");
|
|
81
81
|
if (e === -1) return "";
|
|
82
|
-
const r =
|
|
82
|
+
const r = P(t, e);
|
|
83
83
|
return r === -1 ? "" : t.substring(e + 1, r);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function P(t, e) {
|
|
86
86
|
let r = 1;
|
|
87
87
|
for (let n = e + 1; n < t.length; n++) {
|
|
88
88
|
const s = t[n];
|
|
@@ -93,95 +93,95 @@ function R(t, e) {
|
|
|
93
93
|
}
|
|
94
94
|
return -1;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return t.split(",").map(
|
|
96
|
+
function _(t) {
|
|
97
|
+
return t.split(",").map(N).filter(U).map(Y);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function N(t) {
|
|
100
100
|
return t.trim();
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function U(t) {
|
|
103
103
|
return t.length > 0;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
let e =
|
|
107
|
-
return e =
|
|
105
|
+
function Y(t) {
|
|
106
|
+
let e = k(t);
|
|
107
|
+
return e = G(e), e.trim();
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function k(t) {
|
|
110
110
|
const e = t.indexOf("=");
|
|
111
111
|
return e !== -1 ? t.substring(0, e) : t;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function G(t) {
|
|
114
114
|
const e = t.indexOf(":");
|
|
115
115
|
return e !== -1 ? t.substring(0, e) : t;
|
|
116
116
|
}
|
|
117
|
-
var
|
|
117
|
+
var p = /* @__PURE__ */ ((t) => (t.PATH = "path", t.QUERY = "query", t.HEADER = "header", t.BODY = "body", t.REQUEST = "request", t))(p || {});
|
|
118
118
|
const l = Symbol("parameter:metadata");
|
|
119
119
|
function m(t, e = "") {
|
|
120
120
|
return function(r, n, s) {
|
|
121
|
-
const
|
|
121
|
+
const a = O(
|
|
122
122
|
r,
|
|
123
123
|
n,
|
|
124
124
|
s,
|
|
125
125
|
e
|
|
126
|
-
),
|
|
126
|
+
), o = Reflect.getMetadata(l, r, n) || /* @__PURE__ */ new Map(), i = {
|
|
127
127
|
type: t,
|
|
128
|
-
name:
|
|
128
|
+
name: a,
|
|
129
129
|
index: s
|
|
130
130
|
};
|
|
131
|
-
|
|
131
|
+
o.set(s, i), Reflect.defineMetadata(
|
|
132
132
|
l,
|
|
133
|
-
|
|
133
|
+
o,
|
|
134
134
|
r,
|
|
135
135
|
n
|
|
136
136
|
);
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function ut(t = "") {
|
|
140
140
|
return m("path", t);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function ct(t = "") {
|
|
143
143
|
return m("query", t);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function dt(t = "") {
|
|
146
146
|
return m("header", t);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function pt() {
|
|
149
149
|
return m(
|
|
150
150
|
"body"
|
|
151
151
|
/* BODY */
|
|
152
152
|
);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function ht() {
|
|
155
155
|
return m(
|
|
156
156
|
"request"
|
|
157
157
|
/* REQUEST */
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
|
-
const I = (t) => t,
|
|
160
|
+
const I = (t) => t, Q = (t) => t.requiredResponse, x = (t) => t.requiredResponse.json(), j = (t) => t.requiredResponse.text(), J = (t) => {
|
|
161
161
|
if (!t.requiredResponse.eventStream)
|
|
162
|
-
throw new
|
|
162
|
+
throw new g(t, "ServerSentEventStream is not supported");
|
|
163
163
|
return t.requiredResponse.eventStream();
|
|
164
|
-
},
|
|
164
|
+
}, C = (t) => {
|
|
165
165
|
if (!t.requiredResponse.jsonEventStream)
|
|
166
|
-
throw new
|
|
166
|
+
throw new g(
|
|
167
167
|
t,
|
|
168
168
|
"JsonServerSentEventStream is not supported"
|
|
169
169
|
);
|
|
170
170
|
return t.requiredResponse.jsonEventStream();
|
|
171
|
-
},
|
|
171
|
+
}, L = {
|
|
172
172
|
Exchange: I,
|
|
173
|
-
Response:
|
|
174
|
-
Json:
|
|
175
|
-
Text:
|
|
176
|
-
EventStream:
|
|
177
|
-
JsonEventStream:
|
|
178
|
-
DEFAULT:
|
|
173
|
+
Response: Q,
|
|
174
|
+
Json: x,
|
|
175
|
+
Text: j,
|
|
176
|
+
EventStream: J,
|
|
177
|
+
JsonEventStream: C,
|
|
178
|
+
DEFAULT: x
|
|
179
179
|
};
|
|
180
|
-
function
|
|
180
|
+
function W(t) {
|
|
181
181
|
if (t)
|
|
182
|
-
return t instanceof
|
|
182
|
+
return t instanceof q ? t : v.requiredGet(t);
|
|
183
183
|
}
|
|
184
|
-
class
|
|
184
|
+
class B {
|
|
185
185
|
/**
|
|
186
186
|
* Creates a new FunctionMetadata instance.
|
|
187
187
|
*
|
|
@@ -202,7 +202,7 @@ class L {
|
|
|
202
202
|
* @returns The fetcher instance
|
|
203
203
|
*/
|
|
204
204
|
get fetcher() {
|
|
205
|
-
return
|
|
205
|
+
return W(this.endpoint.fetcher ?? this.api.fetcher) ?? M;
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* Resolves the request configuration from the method arguments.
|
|
@@ -255,28 +255,28 @@ class L {
|
|
|
255
255
|
...this.api.headers,
|
|
256
256
|
...this.endpoint.headers
|
|
257
257
|
};
|
|
258
|
-
let
|
|
259
|
-
e.forEach((u,
|
|
258
|
+
let a, o, i = {};
|
|
259
|
+
e.forEach((u, A) => {
|
|
260
260
|
if (u instanceof AbortSignal) {
|
|
261
|
-
|
|
261
|
+
o = u;
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
|
-
const
|
|
265
|
-
if (
|
|
266
|
-
switch (
|
|
267
|
-
case
|
|
268
|
-
this.processPathParam(
|
|
264
|
+
const h = this.parameters.get(A);
|
|
265
|
+
if (h)
|
|
266
|
+
switch (h.type) {
|
|
267
|
+
case p.PATH:
|
|
268
|
+
this.processPathParam(h, u, r);
|
|
269
269
|
break;
|
|
270
|
-
case
|
|
271
|
-
this.processQueryParam(
|
|
270
|
+
case p.QUERY:
|
|
271
|
+
this.processQueryParam(h, u, n);
|
|
272
272
|
break;
|
|
273
|
-
case
|
|
274
|
-
this.processHeaderParam(
|
|
273
|
+
case p.HEADER:
|
|
274
|
+
this.processHeaderParam(h, u, s);
|
|
275
275
|
break;
|
|
276
|
-
case
|
|
277
|
-
|
|
276
|
+
case p.BODY:
|
|
277
|
+
a = u;
|
|
278
278
|
break;
|
|
279
|
-
case
|
|
279
|
+
case p.REQUEST:
|
|
280
280
|
i = this.processRequestParam(u);
|
|
281
281
|
break;
|
|
282
282
|
}
|
|
@@ -284,15 +284,15 @@ class L {
|
|
|
284
284
|
const E = {
|
|
285
285
|
path: r,
|
|
286
286
|
query: n
|
|
287
|
-
},
|
|
287
|
+
}, b = {
|
|
288
288
|
method: this.endpoint.method,
|
|
289
289
|
urlParams: E,
|
|
290
290
|
headers: s,
|
|
291
|
-
body:
|
|
291
|
+
body: a,
|
|
292
292
|
timeout: this.resolveTimeout(),
|
|
293
|
-
signal:
|
|
294
|
-
};
|
|
295
|
-
return
|
|
293
|
+
signal: o
|
|
294
|
+
}, R = S(b, i), y = i.path;
|
|
295
|
+
return R.url = this.resolvePath(y), R;
|
|
296
296
|
}
|
|
297
297
|
processPathParam(e, r, n) {
|
|
298
298
|
const s = e.name || `param${e.index}`;
|
|
@@ -333,16 +333,14 @@ class L {
|
|
|
333
333
|
return e;
|
|
334
334
|
}
|
|
335
335
|
/**
|
|
336
|
-
* Resolves the
|
|
336
|
+
* Resolves the complete path by combining base path and endpoint path
|
|
337
337
|
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
* @returns The full path for the request
|
|
338
|
+
* @param parameterPath - Optional path parameter to use instead of endpoint path
|
|
339
|
+
* @returns The combined URL path
|
|
342
340
|
*/
|
|
343
|
-
resolvePath() {
|
|
344
|
-
const
|
|
345
|
-
return
|
|
341
|
+
resolvePath(e) {
|
|
342
|
+
const r = this.endpoint.basePath || this.api.basePath || "", n = e || this.endpoint.path || "";
|
|
343
|
+
return w(r, n);
|
|
346
344
|
}
|
|
347
345
|
/**
|
|
348
346
|
* Resolves the timeout for the request.
|
|
@@ -356,11 +354,11 @@ class L {
|
|
|
356
354
|
return this.endpoint.timeout || this.api.timeout;
|
|
357
355
|
}
|
|
358
356
|
resolveResultExtractor() {
|
|
359
|
-
return this.endpoint.resultExtractor || this.api.resultExtractor ||
|
|
357
|
+
return this.endpoint.resultExtractor || this.api.resultExtractor || L.DEFAULT;
|
|
360
358
|
}
|
|
361
359
|
}
|
|
362
|
-
const
|
|
363
|
-
class
|
|
360
|
+
const $ = "fetcher";
|
|
361
|
+
class K {
|
|
364
362
|
/**
|
|
365
363
|
* Creates a new RequestExecutor instance.
|
|
366
364
|
*
|
|
@@ -378,8 +376,8 @@ class B {
|
|
|
378
376
|
getTargetFetcher(e) {
|
|
379
377
|
if (!e || typeof e != "object")
|
|
380
378
|
return;
|
|
381
|
-
const r = e[
|
|
382
|
-
if (r instanceof
|
|
379
|
+
const r = e[$];
|
|
380
|
+
if (r instanceof q)
|
|
383
381
|
return r;
|
|
384
382
|
}
|
|
385
383
|
/**
|
|
@@ -393,89 +391,86 @@ class B {
|
|
|
393
391
|
* @returns A Promise that resolves to the Response
|
|
394
392
|
*/
|
|
395
393
|
async execute(e, r) {
|
|
396
|
-
const n = this.metadata.
|
|
397
|
-
|
|
398
|
-
...s
|
|
399
|
-
}, i = await (this.getTargetFetcher(e) || this.metadata.fetcher).request(o);
|
|
400
|
-
return this.metadata.resolveResultExtractor()(i);
|
|
394
|
+
const n = this.getTargetFetcher(e) || this.metadata.fetcher, s = this.metadata.resolveRequest(r), a = await n.request(s);
|
|
395
|
+
return this.metadata.resolveResultExtractor()(a);
|
|
401
396
|
}
|
|
402
397
|
}
|
|
403
|
-
const
|
|
404
|
-
function
|
|
398
|
+
const V = Symbol("api:metadata");
|
|
399
|
+
function z(t, e, r) {
|
|
405
400
|
const n = t.prototype[e];
|
|
406
401
|
if (e === "constructor" || typeof n != "function")
|
|
407
402
|
return;
|
|
408
403
|
const s = Reflect.getMetadata(
|
|
409
|
-
|
|
404
|
+
T,
|
|
410
405
|
t.prototype,
|
|
411
406
|
e
|
|
412
407
|
);
|
|
413
408
|
if (!s)
|
|
414
409
|
return;
|
|
415
|
-
const
|
|
410
|
+
const a = Reflect.getMetadata(
|
|
416
411
|
l,
|
|
417
412
|
t.prototype,
|
|
418
413
|
e
|
|
419
|
-
) || /* @__PURE__ */ new Map(),
|
|
414
|
+
) || /* @__PURE__ */ new Map(), o = new B(
|
|
420
415
|
e,
|
|
421
416
|
r,
|
|
422
417
|
s,
|
|
423
|
-
|
|
424
|
-
), i = new
|
|
418
|
+
a
|
|
419
|
+
), i = new K(o);
|
|
425
420
|
t.prototype[e] = function(...E) {
|
|
426
421
|
return i.execute(this, E);
|
|
427
422
|
};
|
|
428
423
|
}
|
|
429
|
-
function
|
|
424
|
+
function ft(t = "", e = {}) {
|
|
430
425
|
return function(r) {
|
|
431
426
|
const n = {
|
|
432
427
|
basePath: t,
|
|
433
428
|
...e
|
|
434
429
|
};
|
|
435
|
-
return Reflect.defineMetadata(
|
|
436
|
-
|
|
430
|
+
return Reflect.defineMetadata(V, n, r), Object.getOwnPropertyNames(r.prototype).forEach((s) => {
|
|
431
|
+
z(r, s, n);
|
|
437
432
|
}), r;
|
|
438
433
|
};
|
|
439
434
|
}
|
|
440
|
-
class
|
|
435
|
+
class X extends Error {
|
|
441
436
|
constructor() {
|
|
442
437
|
super("Implementation will be generated automatically."), this.name = "AutoGenerated";
|
|
443
438
|
}
|
|
444
439
|
}
|
|
445
|
-
const
|
|
440
|
+
const mt = (...t) => new X();
|
|
446
441
|
export {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
442
|
+
V as API_METADATA_KEY,
|
|
443
|
+
X as AutoGenerated,
|
|
444
|
+
T as ENDPOINT_METADATA_KEY,
|
|
445
|
+
J as EventStreamResultExtractor,
|
|
451
446
|
I as ExchangeResultExtractor,
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
447
|
+
B as FunctionMetadata,
|
|
448
|
+
C as JsonEventStreamResultExtractor,
|
|
449
|
+
x as JsonResultExtractor,
|
|
455
450
|
l as PARAMETER_METADATA_KEY,
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
451
|
+
p as ParameterType,
|
|
452
|
+
K as RequestExecutor,
|
|
453
|
+
Q as ResponseResultExtractor,
|
|
454
|
+
L as ResultExtractors,
|
|
455
|
+
j as TextResultExtractor,
|
|
456
|
+
ft as api,
|
|
457
|
+
mt as autoGeneratedError,
|
|
458
|
+
pt as body,
|
|
459
|
+
st as del,
|
|
465
460
|
d as endpoint,
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
461
|
+
et as get,
|
|
462
|
+
W as getFetcher,
|
|
463
|
+
O as getParameterName,
|
|
464
|
+
D as getParameterNames,
|
|
465
|
+
ot as head,
|
|
466
|
+
dt as header,
|
|
467
|
+
it as options,
|
|
473
468
|
m as parameter,
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
469
|
+
at as patch,
|
|
470
|
+
ut as path,
|
|
471
|
+
rt as post,
|
|
472
|
+
nt as put,
|
|
473
|
+
ct as query,
|
|
474
|
+
ht as request
|
|
480
475
|
};
|
|
481
476
|
//# sourceMappingURL=index.es.js.map
|