@ahoo-wang/fetcher-react 2.6.8 → 2.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +2070 -101
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +17 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/wow/index.d.ts +5 -0
- package/dist/wow/index.d.ts.map +1 -1
- package/dist/wow/useCountQuery.d.ts +57 -0
- package/dist/wow/useCountQuery.d.ts.map +1 -0
- package/dist/wow/useListQuery.d.ts +75 -0
- package/dist/wow/useListQuery.d.ts.map +1 -0
- package/dist/wow/useListQueryState.d.ts +66 -0
- package/dist/wow/useListQueryState.d.ts.map +1 -0
- package/dist/wow/useListStreamQuery.d.ts +83 -0
- package/dist/wow/useListStreamQuery.d.ts.map +1 -0
- package/dist/wow/usePagedQuery.d.ts +75 -0
- package/dist/wow/usePagedQuery.d.ts.map +1 -0
- package/dist/wow/useSingleQuery.d.ts +70 -0
- package/dist/wow/useSingleQuery.d.ts.map +1 -0
- package/package.json +5 -4
package/dist/index.es.js
CHANGED
|
@@ -1,178 +1,2147 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { fetcherRegistrar as
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
return
|
|
1
|
+
import { useRef as ht, useCallback as _, useEffect as Jt, useState as C, useMemo as F, useSyncExternalStore as Le } from "react";
|
|
2
|
+
import { fetcherRegistrar as ke, getFetcher as zt, CONTENT_TYPE_HEADER as xe, ContentTypeValues as at, FetcherError as Ce, HttpMethod as De, combineURLs as je, JsonResultExtractor as Ge, mergeRecordToMap as mt, mergeRequest as qe } from "@ahoo-wang/fetcher";
|
|
3
|
+
function _t() {
|
|
4
|
+
const t = ht(!1), e = _(() => t.current, []);
|
|
5
|
+
return Jt(() => (t.current = !0, () => {
|
|
6
6
|
t.current = !1;
|
|
7
7
|
}), []), e;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
const e =
|
|
9
|
+
function J(t) {
|
|
10
|
+
const e = ht(t);
|
|
11
11
|
return e.current = t, e;
|
|
12
12
|
}
|
|
13
|
-
var
|
|
14
|
-
function
|
|
15
|
-
const [e, r] =
|
|
13
|
+
var He = /* @__PURE__ */ ((t) => (t.IDLE = "idle", t.LOADING = "loading", t.SUCCESS = "success", t.ERROR = "error", t))(He || {});
|
|
14
|
+
function Zt(t) {
|
|
15
|
+
const [e, r] = C(
|
|
16
16
|
t?.initialStatus ?? "idle"
|
|
17
17
|
/* IDLE */
|
|
18
|
-
), [a,
|
|
19
|
-
|
|
18
|
+
), [a, s] = C(void 0), [u, f] = C(void 0), E = _t(), m = J(t), S = _(() => {
|
|
19
|
+
E() && (r(
|
|
20
20
|
"loading"
|
|
21
21
|
/* LOADING */
|
|
22
|
-
),
|
|
23
|
-
}, [
|
|
24
|
-
async (
|
|
25
|
-
if (
|
|
26
|
-
|
|
22
|
+
), f(void 0));
|
|
23
|
+
}, [E]), O = _(
|
|
24
|
+
async (R) => {
|
|
25
|
+
if (E()) {
|
|
26
|
+
s(R), r(
|
|
27
27
|
"success"
|
|
28
28
|
/* SUCCESS */
|
|
29
|
-
),
|
|
29
|
+
), f(void 0);
|
|
30
30
|
try {
|
|
31
|
-
await
|
|
32
|
-
} catch (
|
|
33
|
-
console.warn("PromiseState onSuccess callback error:",
|
|
31
|
+
await m.current?.onSuccess?.(R);
|
|
32
|
+
} catch (M) {
|
|
33
|
+
console.warn("PromiseState onSuccess callback error:", M);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
[
|
|
38
|
-
),
|
|
39
|
-
async (
|
|
40
|
-
if (
|
|
41
|
-
|
|
37
|
+
[E, m]
|
|
38
|
+
), b = _(
|
|
39
|
+
async (R) => {
|
|
40
|
+
if (E()) {
|
|
41
|
+
f(R), r(
|
|
42
42
|
"error"
|
|
43
43
|
/* ERROR */
|
|
44
|
-
),
|
|
44
|
+
), s(void 0);
|
|
45
45
|
try {
|
|
46
|
-
await
|
|
47
|
-
} catch (
|
|
48
|
-
console.warn("PromiseState onError callback error:",
|
|
46
|
+
await m.current?.onError?.(R);
|
|
47
|
+
} catch (M) {
|
|
48
|
+
console.warn("PromiseState onError callback error:", M);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
[
|
|
53
|
-
),
|
|
54
|
-
|
|
52
|
+
[E, m]
|
|
53
|
+
), P = _(() => {
|
|
54
|
+
E() && (r(
|
|
55
55
|
"idle"
|
|
56
56
|
/* IDLE */
|
|
57
|
-
),
|
|
58
|
-
}, [
|
|
59
|
-
return
|
|
57
|
+
), f(void 0), s(void 0));
|
|
58
|
+
}, [E]);
|
|
59
|
+
return F(
|
|
60
60
|
() => ({
|
|
61
61
|
status: e,
|
|
62
62
|
loading: e === "loading",
|
|
63
63
|
result: a,
|
|
64
|
-
error:
|
|
65
|
-
setLoading:
|
|
66
|
-
setSuccess:
|
|
67
|
-
setError:
|
|
68
|
-
setIdle:
|
|
64
|
+
error: u,
|
|
65
|
+
setLoading: S,
|
|
66
|
+
setSuccess: O,
|
|
67
|
+
setError: b,
|
|
68
|
+
setIdle: P
|
|
69
69
|
}),
|
|
70
|
-
[e, a,
|
|
70
|
+
[e, a, u, S, O, b, P]
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
const t =
|
|
73
|
+
function Kt() {
|
|
74
|
+
const t = ht(0), e = _(() => ++t.current, []), r = _(() => t.current, []), a = _((f) => f === t.current, []), s = _(() => {
|
|
75
75
|
t.current++;
|
|
76
|
-
}, []),
|
|
76
|
+
}, []), u = _(() => {
|
|
77
77
|
t.current = 0;
|
|
78
78
|
}, []);
|
|
79
|
-
return
|
|
79
|
+
return F(() => ({
|
|
80
80
|
generate: e,
|
|
81
81
|
current: r,
|
|
82
82
|
isLatest: a,
|
|
83
|
-
invalidate:
|
|
84
|
-
reset:
|
|
85
|
-
}), [e, r, a,
|
|
83
|
+
invalidate: s,
|
|
84
|
+
reset: u
|
|
85
|
+
}), [e, r, a, s, u]);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const e =
|
|
89
|
-
async (
|
|
87
|
+
function ot(t) {
|
|
88
|
+
const e = Zt(t), r = _t(), a = Kt(), s = _(
|
|
89
|
+
async (f) => {
|
|
90
90
|
if (!r())
|
|
91
91
|
throw new Error("Component is unmounted");
|
|
92
|
-
const
|
|
92
|
+
const E = a.generate();
|
|
93
93
|
e.setLoading();
|
|
94
94
|
try {
|
|
95
|
-
const
|
|
96
|
-
return r() && a.isLatest(
|
|
97
|
-
} catch (
|
|
98
|
-
if (r() && a.isLatest(
|
|
99
|
-
throw
|
|
100
|
-
return
|
|
95
|
+
const S = await (typeof f == "function" ? f() : f);
|
|
96
|
+
return r() && a.isLatest(E) && await e.setSuccess(S), S;
|
|
97
|
+
} catch (m) {
|
|
98
|
+
if (r() && a.isLatest(E) && await e.setError(m), t?.propagateError)
|
|
99
|
+
throw m;
|
|
100
|
+
return m;
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
[e, r, a, t]
|
|
104
|
-
),
|
|
104
|
+
), u = _(() => {
|
|
105
105
|
r() && e.setIdle();
|
|
106
106
|
}, [e, r]);
|
|
107
|
-
return
|
|
107
|
+
return F(
|
|
108
108
|
() => ({
|
|
109
109
|
loading: e.loading,
|
|
110
110
|
result: e.result,
|
|
111
111
|
error: e.error,
|
|
112
|
-
execute:
|
|
113
|
-
reset:
|
|
112
|
+
execute: s,
|
|
113
|
+
reset: u,
|
|
114
114
|
status: e.status
|
|
115
115
|
}),
|
|
116
|
-
[e.loading, e.result, e.error,
|
|
116
|
+
[e.loading, e.result, e.error, s, u, e.status]
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
const e =
|
|
121
|
-
(
|
|
119
|
+
function Mr(t) {
|
|
120
|
+
const e = _(
|
|
121
|
+
(u) => t.addListener(u),
|
|
122
122
|
[t]
|
|
123
|
-
), r =
|
|
124
|
-
(
|
|
123
|
+
), r = _(() => t.get(), [t]), a = Le(e, r, r), s = _(
|
|
124
|
+
(u) => t.set(u),
|
|
125
125
|
[t]
|
|
126
126
|
);
|
|
127
|
-
return [a,
|
|
127
|
+
return [a, s];
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
const { fetcher: e =
|
|
129
|
+
function Ar(t) {
|
|
130
|
+
const { fetcher: e = ke.default } = t || {}, r = Zt(t), [a, s] = C(
|
|
131
131
|
void 0
|
|
132
|
-
),
|
|
133
|
-
async (
|
|
134
|
-
|
|
135
|
-
const
|
|
132
|
+
), u = _t(), f = ht(), E = Kt(), m = J(t), S = zt(e), O = _(
|
|
133
|
+
async (b) => {
|
|
134
|
+
f.current && f.current.abort(), f.current = b.abortController ?? new AbortController(), b.abortController = f.current;
|
|
135
|
+
const P = E.generate();
|
|
136
136
|
r.setLoading();
|
|
137
137
|
try {
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
const R = await S.exchange(
|
|
139
|
+
b,
|
|
140
|
+
m.current
|
|
141
141
|
);
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
} catch (
|
|
146
|
-
if (
|
|
147
|
-
|
|
142
|
+
u() && E.isLatest(P) && s(R);
|
|
143
|
+
const M = await R.extractResult();
|
|
144
|
+
u() && E.isLatest(P) && await r.setSuccess(M);
|
|
145
|
+
} catch (R) {
|
|
146
|
+
if (R instanceof Error && R.name === "AbortError") {
|
|
147
|
+
u() && r.setIdle();
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
u() && E.isLatest(P) && await r.setError(R);
|
|
151
151
|
} finally {
|
|
152
|
-
|
|
152
|
+
f.current === b.abortController && (f.current = void 0);
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
|
-
[
|
|
155
|
+
[S, u, m, r, E]
|
|
156
156
|
);
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
}, []),
|
|
157
|
+
return Jt(() => () => {
|
|
158
|
+
f.current?.abort(), f.current = void 0;
|
|
159
|
+
}, []), F(
|
|
160
160
|
() => ({
|
|
161
161
|
...r,
|
|
162
162
|
exchange: a,
|
|
163
|
-
execute:
|
|
163
|
+
execute: O
|
|
164
|
+
}),
|
|
165
|
+
[r, a, O]
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
let Ue = class {
|
|
169
|
+
constructor() {
|
|
170
|
+
this.buffer = "";
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Transform input string chunk by splitting it into lines.
|
|
174
|
+
*
|
|
175
|
+
* @param chunk Input string chunk
|
|
176
|
+
* @param controller Controller for controlling the transform stream
|
|
177
|
+
*/
|
|
178
|
+
transform(e, r) {
|
|
179
|
+
try {
|
|
180
|
+
this.buffer += e;
|
|
181
|
+
const a = this.buffer.split(`
|
|
182
|
+
`);
|
|
183
|
+
this.buffer = a.pop() || "";
|
|
184
|
+
for (const s of a)
|
|
185
|
+
r.enqueue(s);
|
|
186
|
+
} catch (a) {
|
|
187
|
+
r.error(a);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Flush remaining buffer when the stream ends.
|
|
192
|
+
*
|
|
193
|
+
* @param controller Controller for controlling the transform stream
|
|
194
|
+
*/
|
|
195
|
+
flush(e) {
|
|
196
|
+
try {
|
|
197
|
+
this.buffer && e.enqueue(this.buffer);
|
|
198
|
+
} catch (r) {
|
|
199
|
+
e.error(r);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
class $e extends TransformStream {
|
|
204
|
+
constructor() {
|
|
205
|
+
super(new Ue());
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const nt = class {
|
|
209
|
+
};
|
|
210
|
+
nt.ID = "id", nt.RETRY = "retry", nt.EVENT = "event", nt.DATA = "data";
|
|
211
|
+
let ft = nt;
|
|
212
|
+
function We(t, e, r) {
|
|
213
|
+
switch (t) {
|
|
214
|
+
case ft.EVENT:
|
|
215
|
+
r.event = e;
|
|
216
|
+
break;
|
|
217
|
+
case ft.DATA:
|
|
218
|
+
r.data.push(e);
|
|
219
|
+
break;
|
|
220
|
+
case ft.ID:
|
|
221
|
+
r.id = e;
|
|
222
|
+
break;
|
|
223
|
+
case ft.RETRY: {
|
|
224
|
+
const a = parseInt(e, 10);
|
|
225
|
+
isNaN(a) || (r.retry = a);
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const Z = "message";
|
|
231
|
+
let Fe = class {
|
|
232
|
+
constructor() {
|
|
233
|
+
this.currentEvent = {
|
|
234
|
+
event: Z,
|
|
235
|
+
id: void 0,
|
|
236
|
+
retry: void 0,
|
|
237
|
+
data: []
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Transform input string chunk into ServerSentEvent object.
|
|
242
|
+
*
|
|
243
|
+
* @param chunk Input string chunk
|
|
244
|
+
* @param controller Controller for controlling the transform stream
|
|
245
|
+
*/
|
|
246
|
+
transform(e, r) {
|
|
247
|
+
const a = this.currentEvent;
|
|
248
|
+
try {
|
|
249
|
+
if (e.trim() === "") {
|
|
250
|
+
a.data.length > 0 && (r.enqueue({
|
|
251
|
+
event: a.event || Z,
|
|
252
|
+
data: a.data.join(`
|
|
253
|
+
`),
|
|
254
|
+
id: a.id || "",
|
|
255
|
+
retry: a.retry
|
|
256
|
+
}), a.event = Z, a.data = []);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
if (e.startsWith(":"))
|
|
260
|
+
return;
|
|
261
|
+
const s = e.indexOf(":");
|
|
262
|
+
let u, f;
|
|
263
|
+
s === -1 ? (u = e.toLowerCase(), f = "") : (u = e.substring(0, s).toLowerCase(), f = e.substring(s + 1), f.startsWith(" ") && (f = f.substring(1))), u = u.trim(), f = f.trim(), We(u, f, a);
|
|
264
|
+
} catch (s) {
|
|
265
|
+
r.error(
|
|
266
|
+
s instanceof Error ? s : new Error(String(s))
|
|
267
|
+
), a.event = Z, a.id = void 0, a.retry = void 0, a.data = [];
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Called when the stream ends, used to process remaining data.
|
|
272
|
+
*
|
|
273
|
+
* @param controller Controller for controlling the transform stream
|
|
274
|
+
*/
|
|
275
|
+
flush(e) {
|
|
276
|
+
const r = this.currentEvent;
|
|
277
|
+
try {
|
|
278
|
+
r.data.length > 0 && e.enqueue({
|
|
279
|
+
event: r.event || Z,
|
|
280
|
+
data: r.data.join(`
|
|
281
|
+
`),
|
|
282
|
+
id: r.id || "",
|
|
283
|
+
retry: r.retry
|
|
284
|
+
});
|
|
285
|
+
} catch (a) {
|
|
286
|
+
e.error(
|
|
287
|
+
a instanceof Error ? a : new Error(String(a))
|
|
288
|
+
);
|
|
289
|
+
} finally {
|
|
290
|
+
r.event = Z, r.id = void 0, r.retry = void 0, r.data = [];
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
class Qe extends TransformStream {
|
|
295
|
+
constructor() {
|
|
296
|
+
super(new Fe());
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
class it extends Ce {
|
|
300
|
+
/**
|
|
301
|
+
* Creates a new EventStreamConvertError instance.
|
|
302
|
+
* @param response - The Response object associated with the error
|
|
303
|
+
* @param errorMsg - Optional error message describing what went wrong during conversion
|
|
304
|
+
* @param cause - Optional underlying error that caused this error
|
|
305
|
+
*/
|
|
306
|
+
constructor(e, r, a) {
|
|
307
|
+
super(r, a), this.response = e, this.name = "EventStreamConvertError", Object.setPrototypeOf(this, it.prototype);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function Ve(t) {
|
|
311
|
+
if (!t.body)
|
|
312
|
+
throw new it(t, "Response body is null");
|
|
313
|
+
return t.body.pipeThrough(new TextDecoderStream("utf-8")).pipeThrough(new $e()).pipeThrough(new Qe());
|
|
314
|
+
}
|
|
315
|
+
let Ye = class {
|
|
316
|
+
transform(e, r) {
|
|
317
|
+
const a = JSON.parse(e.data);
|
|
318
|
+
r.enqueue({
|
|
319
|
+
data: a,
|
|
320
|
+
event: e.event,
|
|
321
|
+
id: e.id,
|
|
322
|
+
retry: e.retry
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}, Be = class extends TransformStream {
|
|
326
|
+
constructor() {
|
|
327
|
+
super(new Ye());
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
function Xe(t) {
|
|
331
|
+
return t.pipeThrough(
|
|
332
|
+
new Be()
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
const pt = (t) => t.requiredResponse.requiredJsonEventStream();
|
|
336
|
+
Object.defineProperty(Response.prototype, "contentType", {
|
|
337
|
+
get() {
|
|
338
|
+
return this.headers.get(xe);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
Object.defineProperty(Response.prototype, "isEventStream", {
|
|
342
|
+
get() {
|
|
343
|
+
const t = this.contentType;
|
|
344
|
+
return t ? t.includes(at.TEXT_EVENT_STREAM) : !1;
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
Response.prototype.eventStream = function() {
|
|
348
|
+
return this.isEventStream ? Ve(this) : null;
|
|
349
|
+
};
|
|
350
|
+
Response.prototype.requiredEventStream = function() {
|
|
351
|
+
const t = this.eventStream();
|
|
352
|
+
if (!t)
|
|
353
|
+
throw new it(
|
|
354
|
+
this,
|
|
355
|
+
`Event stream is not available. Response content-type: [${this.contentType}]`
|
|
356
|
+
);
|
|
357
|
+
return t;
|
|
358
|
+
};
|
|
359
|
+
Response.prototype.jsonEventStream = function() {
|
|
360
|
+
const t = this.eventStream();
|
|
361
|
+
return t ? Xe(t) : null;
|
|
362
|
+
};
|
|
363
|
+
Response.prototype.requiredJsonEventStream = function() {
|
|
364
|
+
const t = this.jsonEventStream();
|
|
365
|
+
if (!t)
|
|
366
|
+
throw new it(
|
|
367
|
+
this,
|
|
368
|
+
`Event stream is not available. Response content-type: [${this.contentType}]`
|
|
369
|
+
);
|
|
370
|
+
return t;
|
|
371
|
+
};
|
|
372
|
+
class Je {
|
|
373
|
+
/**
|
|
374
|
+
* Creates a new ReadableStreamAsyncIterable instance.
|
|
375
|
+
* @param stream - The ReadableStream to wrap.
|
|
376
|
+
*/
|
|
377
|
+
constructor(e) {
|
|
378
|
+
this.stream = e, this._locked = !0, this.reader = e.getReader();
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Gets the lock status of the reader.
|
|
382
|
+
* @returns True if the reader is currently locked, false otherwise.
|
|
383
|
+
*/
|
|
384
|
+
get locked() {
|
|
385
|
+
return this._locked;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Releases the reader lock if currently locked.
|
|
389
|
+
* This method safely releases the reader lock by catching any potential errors.
|
|
390
|
+
*/
|
|
391
|
+
releaseLock() {
|
|
392
|
+
if (!this._locked) return !1;
|
|
393
|
+
this._locked = !1;
|
|
394
|
+
try {
|
|
395
|
+
return this.reader.releaseLock(), !0;
|
|
396
|
+
} catch (e) {
|
|
397
|
+
return console.debug("Failed to release reader lock:", e), !1;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Implements the AsyncIterable interface by returning this iterator.
|
|
402
|
+
* @returns The async iterator for this instance.
|
|
403
|
+
*/
|
|
404
|
+
[Symbol.asyncIterator]() {
|
|
405
|
+
return this;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Gets the next value from the stream.
|
|
409
|
+
* Reads the next chunk from the stream and returns it as an IteratorResult.
|
|
410
|
+
* If the stream is done, releases the lock and returns a done result.
|
|
411
|
+
* @returns A promise that resolves to an IteratorResult containing the next value or done status.
|
|
412
|
+
* @throws If an error occurs while reading from the stream.
|
|
413
|
+
*/
|
|
414
|
+
async next() {
|
|
415
|
+
try {
|
|
416
|
+
const { done: e, value: r } = await this.reader.read();
|
|
417
|
+
return e ? (this.releaseLock(), { done: !0, value: void 0 }) : { done: !1, value: r };
|
|
418
|
+
} catch (e) {
|
|
419
|
+
throw this.releaseLock(), e;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Implements the return method of the async iterator.
|
|
424
|
+
* Cancels the stream reader and releases the lock.
|
|
425
|
+
* @returns A promise that resolves to a done IteratorResult.
|
|
426
|
+
*/
|
|
427
|
+
async return() {
|
|
428
|
+
try {
|
|
429
|
+
await this.reader.cancel();
|
|
430
|
+
} catch (e) {
|
|
431
|
+
console.debug("Failed to cancel stream reader:", e);
|
|
432
|
+
} finally {
|
|
433
|
+
this.releaseLock();
|
|
434
|
+
}
|
|
435
|
+
return { done: !0, value: void 0 };
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Implements the throw method of the async iterator.
|
|
439
|
+
* Releases the lock and returns a done result.
|
|
440
|
+
* @param error - The error to be thrown.
|
|
441
|
+
* @returns A promise that resolves to a done IteratorResult.
|
|
442
|
+
*/
|
|
443
|
+
async throw(e) {
|
|
444
|
+
return console.debug("Throwing error:", e), this.releaseLock(), { done: !0, value: void 0 };
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
const ze = typeof ReadableStream.prototype[Symbol.asyncIterator] == "function";
|
|
448
|
+
ze || (ReadableStream.prototype[Symbol.asyncIterator] = function() {
|
|
449
|
+
return new Je(this);
|
|
450
|
+
});
|
|
451
|
+
var Vt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Yt = {};
|
|
452
|
+
/*! *****************************************************************************
|
|
453
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
454
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
455
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
456
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
457
|
+
|
|
458
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
459
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
460
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
461
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
462
|
+
|
|
463
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
464
|
+
and limitations under the License.
|
|
465
|
+
***************************************************************************** */
|
|
466
|
+
var Bt;
|
|
467
|
+
function Ze() {
|
|
468
|
+
if (Bt) return Yt;
|
|
469
|
+
Bt = 1;
|
|
470
|
+
var t;
|
|
471
|
+
return (function(e) {
|
|
472
|
+
(function(r) {
|
|
473
|
+
var a = typeof globalThis == "object" ? globalThis : typeof Vt == "object" ? Vt : typeof self == "object" ? self : typeof this == "object" ? this : m(), s = u(e);
|
|
474
|
+
typeof a.Reflect < "u" && (s = u(a.Reflect, s)), r(s, a), typeof a.Reflect > "u" && (a.Reflect = e);
|
|
475
|
+
function u(S, O) {
|
|
476
|
+
return function(b, P) {
|
|
477
|
+
Object.defineProperty(S, b, { configurable: !0, writable: !0, value: P }), O && O(b, P);
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function f() {
|
|
481
|
+
try {
|
|
482
|
+
return Function("return this;")();
|
|
483
|
+
} catch {
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function E() {
|
|
487
|
+
try {
|
|
488
|
+
return (0, eval)("(function() { return this; })()");
|
|
489
|
+
} catch {
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
function m() {
|
|
493
|
+
return f() || E();
|
|
494
|
+
}
|
|
495
|
+
})(function(r, a) {
|
|
496
|
+
var s = Object.prototype.hasOwnProperty, u = typeof Symbol == "function", f = u && typeof Symbol.toPrimitive < "u" ? Symbol.toPrimitive : "@@toPrimitive", E = u && typeof Symbol.iterator < "u" ? Symbol.iterator : "@@iterator", m = typeof Object.create == "function", S = { __proto__: [] } instanceof Array, O = !m && !S, b = {
|
|
497
|
+
// create an object in dictionary mode (a.k.a. "slow" mode in v8)
|
|
498
|
+
create: m ? function() {
|
|
499
|
+
return wt(/* @__PURE__ */ Object.create(null));
|
|
500
|
+
} : S ? function() {
|
|
501
|
+
return wt({ __proto__: null });
|
|
502
|
+
} : function() {
|
|
503
|
+
return wt({});
|
|
504
|
+
},
|
|
505
|
+
has: O ? function(n, o) {
|
|
506
|
+
return s.call(n, o);
|
|
507
|
+
} : function(n, o) {
|
|
508
|
+
return o in n;
|
|
509
|
+
},
|
|
510
|
+
get: O ? function(n, o) {
|
|
511
|
+
return s.call(n, o) ? n[o] : void 0;
|
|
512
|
+
} : function(n, o) {
|
|
513
|
+
return n[o];
|
|
514
|
+
}
|
|
515
|
+
}, P = Object.getPrototypeOf(Function), R = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : Me(), M = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : Ae(), tt = typeof WeakMap == "function" ? WeakMap : Ie(), G = u ? Symbol.for("@reflect-metadata:registry") : void 0, ut = ge(), It = Re(ut);
|
|
516
|
+
function ie(n, o, i, c) {
|
|
517
|
+
if (v(i)) {
|
|
518
|
+
if (!Gt(n))
|
|
519
|
+
throw new TypeError();
|
|
520
|
+
if (!qt(o))
|
|
521
|
+
throw new TypeError();
|
|
522
|
+
return ve(n, o);
|
|
523
|
+
} else {
|
|
524
|
+
if (!Gt(n))
|
|
525
|
+
throw new TypeError();
|
|
526
|
+
if (!N(o))
|
|
527
|
+
throw new TypeError();
|
|
528
|
+
if (!N(c) && !v(c) && !z(c))
|
|
529
|
+
throw new TypeError();
|
|
530
|
+
return z(c) && (c = void 0), i = W(i), Ee(n, o, i, c);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
r("decorate", ie);
|
|
534
|
+
function se(n, o) {
|
|
535
|
+
function i(c, y) {
|
|
536
|
+
if (!N(c))
|
|
537
|
+
throw new TypeError();
|
|
538
|
+
if (!v(y) && !_e(y))
|
|
539
|
+
throw new TypeError();
|
|
540
|
+
kt(n, o, c, y);
|
|
541
|
+
}
|
|
542
|
+
return i;
|
|
543
|
+
}
|
|
544
|
+
r("metadata", se);
|
|
545
|
+
function ue(n, o, i, c) {
|
|
546
|
+
if (!N(i))
|
|
547
|
+
throw new TypeError();
|
|
548
|
+
return v(c) || (c = W(c)), kt(n, o, i, c);
|
|
549
|
+
}
|
|
550
|
+
r("defineMetadata", ue);
|
|
551
|
+
function ce(n, o, i) {
|
|
552
|
+
if (!N(o))
|
|
553
|
+
throw new TypeError();
|
|
554
|
+
return v(i) || (i = W(i)), Pt(n, o, i);
|
|
555
|
+
}
|
|
556
|
+
r("hasMetadata", ce);
|
|
557
|
+
function fe(n, o, i) {
|
|
558
|
+
if (!N(o))
|
|
559
|
+
throw new TypeError();
|
|
560
|
+
return v(i) || (i = W(i)), vt(n, o, i);
|
|
561
|
+
}
|
|
562
|
+
r("hasOwnMetadata", fe);
|
|
563
|
+
function de(n, o, i) {
|
|
564
|
+
if (!N(o))
|
|
565
|
+
throw new TypeError();
|
|
566
|
+
return v(i) || (i = W(i)), Nt(n, o, i);
|
|
567
|
+
}
|
|
568
|
+
r("getMetadata", de);
|
|
569
|
+
function le(n, o, i) {
|
|
570
|
+
if (!N(o))
|
|
571
|
+
throw new TypeError();
|
|
572
|
+
return v(i) || (i = W(i)), Lt(n, o, i);
|
|
573
|
+
}
|
|
574
|
+
r("getOwnMetadata", le);
|
|
575
|
+
function he(n, o) {
|
|
576
|
+
if (!N(n))
|
|
577
|
+
throw new TypeError();
|
|
578
|
+
return v(o) || (o = W(o)), xt(n, o);
|
|
579
|
+
}
|
|
580
|
+
r("getMetadataKeys", he);
|
|
581
|
+
function pe(n, o) {
|
|
582
|
+
if (!N(n))
|
|
583
|
+
throw new TypeError();
|
|
584
|
+
return v(o) || (o = W(o)), Ct(n, o);
|
|
585
|
+
}
|
|
586
|
+
r("getOwnMetadataKeys", pe);
|
|
587
|
+
function ye(n, o, i) {
|
|
588
|
+
if (!N(o))
|
|
589
|
+
throw new TypeError();
|
|
590
|
+
if (v(i) || (i = W(i)), !N(o))
|
|
591
|
+
throw new TypeError();
|
|
592
|
+
v(i) || (i = W(i));
|
|
593
|
+
var c = et(
|
|
594
|
+
o,
|
|
595
|
+
i,
|
|
596
|
+
/*Create*/
|
|
597
|
+
!1
|
|
598
|
+
);
|
|
599
|
+
return v(c) ? !1 : c.OrdinaryDeleteMetadata(n, o, i);
|
|
600
|
+
}
|
|
601
|
+
r("deleteMetadata", ye);
|
|
602
|
+
function ve(n, o) {
|
|
603
|
+
for (var i = n.length - 1; i >= 0; --i) {
|
|
604
|
+
var c = n[i], y = c(o);
|
|
605
|
+
if (!v(y) && !z(y)) {
|
|
606
|
+
if (!qt(y))
|
|
607
|
+
throw new TypeError();
|
|
608
|
+
o = y;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return o;
|
|
612
|
+
}
|
|
613
|
+
function Ee(n, o, i, c) {
|
|
614
|
+
for (var y = n.length - 1; y >= 0; --y) {
|
|
615
|
+
var A = n[y], L = A(o, i, c);
|
|
616
|
+
if (!v(L) && !z(L)) {
|
|
617
|
+
if (!N(L))
|
|
618
|
+
throw new TypeError();
|
|
619
|
+
c = L;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
return c;
|
|
623
|
+
}
|
|
624
|
+
function Pt(n, o, i) {
|
|
625
|
+
var c = vt(n, o, i);
|
|
626
|
+
if (c)
|
|
627
|
+
return !0;
|
|
628
|
+
var y = Tt(o);
|
|
629
|
+
return z(y) ? !1 : Pt(n, y, i);
|
|
630
|
+
}
|
|
631
|
+
function vt(n, o, i) {
|
|
632
|
+
var c = et(
|
|
633
|
+
o,
|
|
634
|
+
i,
|
|
635
|
+
/*Create*/
|
|
636
|
+
!1
|
|
637
|
+
);
|
|
638
|
+
return v(c) ? !1 : jt(c.OrdinaryHasOwnMetadata(n, o, i));
|
|
639
|
+
}
|
|
640
|
+
function Nt(n, o, i) {
|
|
641
|
+
var c = vt(n, o, i);
|
|
642
|
+
if (c)
|
|
643
|
+
return Lt(n, o, i);
|
|
644
|
+
var y = Tt(o);
|
|
645
|
+
if (!z(y))
|
|
646
|
+
return Nt(n, y, i);
|
|
647
|
+
}
|
|
648
|
+
function Lt(n, o, i) {
|
|
649
|
+
var c = et(
|
|
650
|
+
o,
|
|
651
|
+
i,
|
|
652
|
+
/*Create*/
|
|
653
|
+
!1
|
|
654
|
+
);
|
|
655
|
+
if (!v(c))
|
|
656
|
+
return c.OrdinaryGetOwnMetadata(n, o, i);
|
|
657
|
+
}
|
|
658
|
+
function kt(n, o, i, c) {
|
|
659
|
+
var y = et(
|
|
660
|
+
i,
|
|
661
|
+
c,
|
|
662
|
+
/*Create*/
|
|
663
|
+
!0
|
|
664
|
+
);
|
|
665
|
+
y.OrdinaryDefineOwnMetadata(n, o, i, c);
|
|
666
|
+
}
|
|
667
|
+
function xt(n, o) {
|
|
668
|
+
var i = Ct(n, o), c = Tt(n);
|
|
669
|
+
if (c === null)
|
|
670
|
+
return i;
|
|
671
|
+
var y = xt(c, o);
|
|
672
|
+
if (y.length <= 0)
|
|
673
|
+
return i;
|
|
674
|
+
if (i.length <= 0)
|
|
675
|
+
return y;
|
|
676
|
+
for (var A = new M(), L = [], T = 0, d = i; T < d.length; T++) {
|
|
677
|
+
var l = d[T], h = A.has(l);
|
|
678
|
+
h || (A.add(l), L.push(l));
|
|
679
|
+
}
|
|
680
|
+
for (var p = 0, w = y; p < w.length; p++) {
|
|
681
|
+
var l = w[p], h = A.has(l);
|
|
682
|
+
h || (A.add(l), L.push(l));
|
|
683
|
+
}
|
|
684
|
+
return L;
|
|
685
|
+
}
|
|
686
|
+
function Ct(n, o) {
|
|
687
|
+
var i = et(
|
|
688
|
+
n,
|
|
689
|
+
o,
|
|
690
|
+
/*create*/
|
|
691
|
+
!1
|
|
692
|
+
);
|
|
693
|
+
return i ? i.OrdinaryOwnMetadataKeys(n, o) : [];
|
|
694
|
+
}
|
|
695
|
+
function Dt(n) {
|
|
696
|
+
if (n === null)
|
|
697
|
+
return 1;
|
|
698
|
+
switch (typeof n) {
|
|
699
|
+
case "undefined":
|
|
700
|
+
return 0;
|
|
701
|
+
case "boolean":
|
|
702
|
+
return 2;
|
|
703
|
+
case "string":
|
|
704
|
+
return 3;
|
|
705
|
+
case "symbol":
|
|
706
|
+
return 4;
|
|
707
|
+
case "number":
|
|
708
|
+
return 5;
|
|
709
|
+
case "object":
|
|
710
|
+
return n === null ? 1 : 6;
|
|
711
|
+
default:
|
|
712
|
+
return 6;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
function v(n) {
|
|
716
|
+
return n === void 0;
|
|
717
|
+
}
|
|
718
|
+
function z(n) {
|
|
719
|
+
return n === null;
|
|
720
|
+
}
|
|
721
|
+
function Te(n) {
|
|
722
|
+
return typeof n == "symbol";
|
|
723
|
+
}
|
|
724
|
+
function N(n) {
|
|
725
|
+
return typeof n == "object" ? n !== null : typeof n == "function";
|
|
726
|
+
}
|
|
727
|
+
function we(n, o) {
|
|
728
|
+
switch (Dt(n)) {
|
|
729
|
+
case 0:
|
|
730
|
+
return n;
|
|
731
|
+
case 1:
|
|
732
|
+
return n;
|
|
733
|
+
case 2:
|
|
734
|
+
return n;
|
|
735
|
+
case 3:
|
|
736
|
+
return n;
|
|
737
|
+
case 4:
|
|
738
|
+
return n;
|
|
739
|
+
case 5:
|
|
740
|
+
return n;
|
|
741
|
+
}
|
|
742
|
+
var i = "string", c = Ht(n, f);
|
|
743
|
+
if (c !== void 0) {
|
|
744
|
+
var y = c.call(n, i);
|
|
745
|
+
if (N(y))
|
|
746
|
+
throw new TypeError();
|
|
747
|
+
return y;
|
|
748
|
+
}
|
|
749
|
+
return me(n);
|
|
750
|
+
}
|
|
751
|
+
function me(n, o) {
|
|
752
|
+
var i, c, y;
|
|
753
|
+
{
|
|
754
|
+
var A = n.toString;
|
|
755
|
+
if (ct(A)) {
|
|
756
|
+
var c = A.call(n);
|
|
757
|
+
if (!N(c))
|
|
758
|
+
return c;
|
|
759
|
+
}
|
|
760
|
+
var i = n.valueOf;
|
|
761
|
+
if (ct(i)) {
|
|
762
|
+
var c = i.call(n);
|
|
763
|
+
if (!N(c))
|
|
764
|
+
return c;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
throw new TypeError();
|
|
768
|
+
}
|
|
769
|
+
function jt(n) {
|
|
770
|
+
return !!n;
|
|
771
|
+
}
|
|
772
|
+
function Se(n) {
|
|
773
|
+
return "" + n;
|
|
774
|
+
}
|
|
775
|
+
function W(n) {
|
|
776
|
+
var o = we(n);
|
|
777
|
+
return Te(o) ? o : Se(o);
|
|
778
|
+
}
|
|
779
|
+
function Gt(n) {
|
|
780
|
+
return Array.isArray ? Array.isArray(n) : n instanceof Object ? n instanceof Array : Object.prototype.toString.call(n) === "[object Array]";
|
|
781
|
+
}
|
|
782
|
+
function ct(n) {
|
|
783
|
+
return typeof n == "function";
|
|
784
|
+
}
|
|
785
|
+
function qt(n) {
|
|
786
|
+
return typeof n == "function";
|
|
787
|
+
}
|
|
788
|
+
function _e(n) {
|
|
789
|
+
switch (Dt(n)) {
|
|
790
|
+
case 3:
|
|
791
|
+
return !0;
|
|
792
|
+
case 4:
|
|
793
|
+
return !0;
|
|
794
|
+
default:
|
|
795
|
+
return !1;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
function Et(n, o) {
|
|
799
|
+
return n === o || n !== n && o !== o;
|
|
800
|
+
}
|
|
801
|
+
function Ht(n, o) {
|
|
802
|
+
var i = n[o];
|
|
803
|
+
if (i != null) {
|
|
804
|
+
if (!ct(i))
|
|
805
|
+
throw new TypeError();
|
|
806
|
+
return i;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
function Ut(n) {
|
|
810
|
+
var o = Ht(n, E);
|
|
811
|
+
if (!ct(o))
|
|
812
|
+
throw new TypeError();
|
|
813
|
+
var i = o.call(n);
|
|
814
|
+
if (!N(i))
|
|
815
|
+
throw new TypeError();
|
|
816
|
+
return i;
|
|
817
|
+
}
|
|
818
|
+
function $t(n) {
|
|
819
|
+
return n.value;
|
|
820
|
+
}
|
|
821
|
+
function Wt(n) {
|
|
822
|
+
var o = n.next();
|
|
823
|
+
return o.done ? !1 : o;
|
|
824
|
+
}
|
|
825
|
+
function Ft(n) {
|
|
826
|
+
var o = n.return;
|
|
827
|
+
o && o.call(n);
|
|
828
|
+
}
|
|
829
|
+
function Tt(n) {
|
|
830
|
+
var o = Object.getPrototypeOf(n);
|
|
831
|
+
if (typeof n != "function" || n === P || o !== P)
|
|
832
|
+
return o;
|
|
833
|
+
var i = n.prototype, c = i && Object.getPrototypeOf(i);
|
|
834
|
+
if (c == null || c === Object.prototype)
|
|
835
|
+
return o;
|
|
836
|
+
var y = c.constructor;
|
|
837
|
+
return typeof y != "function" || y === n ? o : y;
|
|
838
|
+
}
|
|
839
|
+
function be() {
|
|
840
|
+
var n;
|
|
841
|
+
!v(G) && typeof a.Reflect < "u" && !(G in a.Reflect) && typeof a.Reflect.defineMetadata == "function" && (n = Oe(a.Reflect));
|
|
842
|
+
var o, i, c, y = new tt(), A = {
|
|
843
|
+
registerProvider: L,
|
|
844
|
+
getProvider: d,
|
|
845
|
+
setProvider: h
|
|
846
|
+
};
|
|
847
|
+
return A;
|
|
848
|
+
function L(p) {
|
|
849
|
+
if (!Object.isExtensible(A))
|
|
850
|
+
throw new Error("Cannot add provider to a frozen registry.");
|
|
851
|
+
switch (!0) {
|
|
852
|
+
case n === p:
|
|
853
|
+
break;
|
|
854
|
+
case v(o):
|
|
855
|
+
o = p;
|
|
856
|
+
break;
|
|
857
|
+
case o === p:
|
|
858
|
+
break;
|
|
859
|
+
case v(i):
|
|
860
|
+
i = p;
|
|
861
|
+
break;
|
|
862
|
+
case i === p:
|
|
863
|
+
break;
|
|
864
|
+
default:
|
|
865
|
+
c === void 0 && (c = new M()), c.add(p);
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
function T(p, w) {
|
|
870
|
+
if (!v(o)) {
|
|
871
|
+
if (o.isProviderFor(p, w))
|
|
872
|
+
return o;
|
|
873
|
+
if (!v(i)) {
|
|
874
|
+
if (i.isProviderFor(p, w))
|
|
875
|
+
return o;
|
|
876
|
+
if (!v(c))
|
|
877
|
+
for (var g = Ut(c); ; ) {
|
|
878
|
+
var I = Wt(g);
|
|
879
|
+
if (!I)
|
|
880
|
+
return;
|
|
881
|
+
var U = $t(I);
|
|
882
|
+
if (U.isProviderFor(p, w))
|
|
883
|
+
return Ft(g), U;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
if (!v(n) && n.isProviderFor(p, w))
|
|
888
|
+
return n;
|
|
889
|
+
}
|
|
890
|
+
function d(p, w) {
|
|
891
|
+
var g = y.get(p), I;
|
|
892
|
+
return v(g) || (I = g.get(w)), v(I) && (I = T(p, w), v(I) || (v(g) && (g = new R(), y.set(p, g)), g.set(w, I))), I;
|
|
893
|
+
}
|
|
894
|
+
function l(p) {
|
|
895
|
+
if (v(p))
|
|
896
|
+
throw new TypeError();
|
|
897
|
+
return o === p || i === p || !v(c) && c.has(p);
|
|
898
|
+
}
|
|
899
|
+
function h(p, w, g) {
|
|
900
|
+
if (!l(g))
|
|
901
|
+
throw new Error("Metadata provider not registered.");
|
|
902
|
+
var I = d(p, w);
|
|
903
|
+
if (I !== g) {
|
|
904
|
+
if (!v(I))
|
|
905
|
+
return !1;
|
|
906
|
+
var U = y.get(p);
|
|
907
|
+
v(U) && (U = new R(), y.set(p, U)), U.set(w, g);
|
|
908
|
+
}
|
|
909
|
+
return !0;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
function ge() {
|
|
913
|
+
var n;
|
|
914
|
+
return !v(G) && N(a.Reflect) && Object.isExtensible(a.Reflect) && (n = a.Reflect[G]), v(n) && (n = be()), !v(G) && N(a.Reflect) && Object.isExtensible(a.Reflect) && Object.defineProperty(a.Reflect, G, {
|
|
915
|
+
enumerable: !1,
|
|
916
|
+
configurable: !1,
|
|
917
|
+
writable: !1,
|
|
918
|
+
value: n
|
|
919
|
+
}), n;
|
|
920
|
+
}
|
|
921
|
+
function Re(n) {
|
|
922
|
+
var o = new tt(), i = {
|
|
923
|
+
isProviderFor: function(l, h) {
|
|
924
|
+
var p = o.get(l);
|
|
925
|
+
return v(p) ? !1 : p.has(h);
|
|
926
|
+
},
|
|
927
|
+
OrdinaryDefineOwnMetadata: L,
|
|
928
|
+
OrdinaryHasOwnMetadata: y,
|
|
929
|
+
OrdinaryGetOwnMetadata: A,
|
|
930
|
+
OrdinaryOwnMetadataKeys: T,
|
|
931
|
+
OrdinaryDeleteMetadata: d
|
|
932
|
+
};
|
|
933
|
+
return ut.registerProvider(i), i;
|
|
934
|
+
function c(l, h, p) {
|
|
935
|
+
var w = o.get(l), g = !1;
|
|
936
|
+
if (v(w)) {
|
|
937
|
+
if (!p)
|
|
938
|
+
return;
|
|
939
|
+
w = new R(), o.set(l, w), g = !0;
|
|
940
|
+
}
|
|
941
|
+
var I = w.get(h);
|
|
942
|
+
if (v(I)) {
|
|
943
|
+
if (!p)
|
|
944
|
+
return;
|
|
945
|
+
if (I = new R(), w.set(h, I), !n.setProvider(l, h, i))
|
|
946
|
+
throw w.delete(h), g && o.delete(l), new Error("Wrong provider for target.");
|
|
947
|
+
}
|
|
948
|
+
return I;
|
|
949
|
+
}
|
|
950
|
+
function y(l, h, p) {
|
|
951
|
+
var w = c(
|
|
952
|
+
h,
|
|
953
|
+
p,
|
|
954
|
+
/*Create*/
|
|
955
|
+
!1
|
|
956
|
+
);
|
|
957
|
+
return v(w) ? !1 : jt(w.has(l));
|
|
958
|
+
}
|
|
959
|
+
function A(l, h, p) {
|
|
960
|
+
var w = c(
|
|
961
|
+
h,
|
|
962
|
+
p,
|
|
963
|
+
/*Create*/
|
|
964
|
+
!1
|
|
965
|
+
);
|
|
966
|
+
if (!v(w))
|
|
967
|
+
return w.get(l);
|
|
968
|
+
}
|
|
969
|
+
function L(l, h, p, w) {
|
|
970
|
+
var g = c(
|
|
971
|
+
p,
|
|
972
|
+
w,
|
|
973
|
+
/*Create*/
|
|
974
|
+
!0
|
|
975
|
+
);
|
|
976
|
+
g.set(l, h);
|
|
977
|
+
}
|
|
978
|
+
function T(l, h) {
|
|
979
|
+
var p = [], w = c(
|
|
980
|
+
l,
|
|
981
|
+
h,
|
|
982
|
+
/*Create*/
|
|
983
|
+
!1
|
|
984
|
+
);
|
|
985
|
+
if (v(w))
|
|
986
|
+
return p;
|
|
987
|
+
for (var g = w.keys(), I = Ut(g), U = 0; ; ) {
|
|
988
|
+
var Qt = Wt(I);
|
|
989
|
+
if (!Qt)
|
|
990
|
+
return p.length = U, p;
|
|
991
|
+
var Pe = $t(Qt);
|
|
992
|
+
try {
|
|
993
|
+
p[U] = Pe;
|
|
994
|
+
} catch (Ne) {
|
|
995
|
+
try {
|
|
996
|
+
Ft(I);
|
|
997
|
+
} finally {
|
|
998
|
+
throw Ne;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
U++;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
function d(l, h, p) {
|
|
1005
|
+
var w = c(
|
|
1006
|
+
h,
|
|
1007
|
+
p,
|
|
1008
|
+
/*Create*/
|
|
1009
|
+
!1
|
|
1010
|
+
);
|
|
1011
|
+
if (v(w) || !w.delete(l))
|
|
1012
|
+
return !1;
|
|
1013
|
+
if (w.size === 0) {
|
|
1014
|
+
var g = o.get(h);
|
|
1015
|
+
v(g) || (g.delete(p), g.size === 0 && o.delete(g));
|
|
1016
|
+
}
|
|
1017
|
+
return !0;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
function Oe(n) {
|
|
1021
|
+
var o = n.defineMetadata, i = n.hasOwnMetadata, c = n.getOwnMetadata, y = n.getOwnMetadataKeys, A = n.deleteMetadata, L = new tt(), T = {
|
|
1022
|
+
isProviderFor: function(d, l) {
|
|
1023
|
+
var h = L.get(d);
|
|
1024
|
+
return !v(h) && h.has(l) ? !0 : y(d, l).length ? (v(h) && (h = new M(), L.set(d, h)), h.add(l), !0) : !1;
|
|
1025
|
+
},
|
|
1026
|
+
OrdinaryDefineOwnMetadata: o,
|
|
1027
|
+
OrdinaryHasOwnMetadata: i,
|
|
1028
|
+
OrdinaryGetOwnMetadata: c,
|
|
1029
|
+
OrdinaryOwnMetadataKeys: y,
|
|
1030
|
+
OrdinaryDeleteMetadata: A
|
|
1031
|
+
};
|
|
1032
|
+
return T;
|
|
1033
|
+
}
|
|
1034
|
+
function et(n, o, i) {
|
|
1035
|
+
var c = ut.getProvider(n, o);
|
|
1036
|
+
if (!v(c))
|
|
1037
|
+
return c;
|
|
1038
|
+
if (i) {
|
|
1039
|
+
if (ut.setProvider(n, o, It))
|
|
1040
|
+
return It;
|
|
1041
|
+
throw new Error("Illegal state.");
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
function Me() {
|
|
1045
|
+
var n = {}, o = [], i = (
|
|
1046
|
+
/** @class */
|
|
1047
|
+
(function() {
|
|
1048
|
+
function T(d, l, h) {
|
|
1049
|
+
this._index = 0, this._keys = d, this._values = l, this._selector = h;
|
|
1050
|
+
}
|
|
1051
|
+
return T.prototype["@@iterator"] = function() {
|
|
1052
|
+
return this;
|
|
1053
|
+
}, T.prototype[E] = function() {
|
|
1054
|
+
return this;
|
|
1055
|
+
}, T.prototype.next = function() {
|
|
1056
|
+
var d = this._index;
|
|
1057
|
+
if (d >= 0 && d < this._keys.length) {
|
|
1058
|
+
var l = this._selector(this._keys[d], this._values[d]);
|
|
1059
|
+
return d + 1 >= this._keys.length ? (this._index = -1, this._keys = o, this._values = o) : this._index++, { value: l, done: !1 };
|
|
1060
|
+
}
|
|
1061
|
+
return { value: void 0, done: !0 };
|
|
1062
|
+
}, T.prototype.throw = function(d) {
|
|
1063
|
+
throw this._index >= 0 && (this._index = -1, this._keys = o, this._values = o), d;
|
|
1064
|
+
}, T.prototype.return = function(d) {
|
|
1065
|
+
return this._index >= 0 && (this._index = -1, this._keys = o, this._values = o), { value: d, done: !0 };
|
|
1066
|
+
}, T;
|
|
1067
|
+
})()
|
|
1068
|
+
), c = (
|
|
1069
|
+
/** @class */
|
|
1070
|
+
(function() {
|
|
1071
|
+
function T() {
|
|
1072
|
+
this._keys = [], this._values = [], this._cacheKey = n, this._cacheIndex = -2;
|
|
1073
|
+
}
|
|
1074
|
+
return Object.defineProperty(T.prototype, "size", {
|
|
1075
|
+
get: function() {
|
|
1076
|
+
return this._keys.length;
|
|
1077
|
+
},
|
|
1078
|
+
enumerable: !0,
|
|
1079
|
+
configurable: !0
|
|
1080
|
+
}), T.prototype.has = function(d) {
|
|
1081
|
+
return this._find(
|
|
1082
|
+
d,
|
|
1083
|
+
/*insert*/
|
|
1084
|
+
!1
|
|
1085
|
+
) >= 0;
|
|
1086
|
+
}, T.prototype.get = function(d) {
|
|
1087
|
+
var l = this._find(
|
|
1088
|
+
d,
|
|
1089
|
+
/*insert*/
|
|
1090
|
+
!1
|
|
1091
|
+
);
|
|
1092
|
+
return l >= 0 ? this._values[l] : void 0;
|
|
1093
|
+
}, T.prototype.set = function(d, l) {
|
|
1094
|
+
var h = this._find(
|
|
1095
|
+
d,
|
|
1096
|
+
/*insert*/
|
|
1097
|
+
!0
|
|
1098
|
+
);
|
|
1099
|
+
return this._values[h] = l, this;
|
|
1100
|
+
}, T.prototype.delete = function(d) {
|
|
1101
|
+
var l = this._find(
|
|
1102
|
+
d,
|
|
1103
|
+
/*insert*/
|
|
1104
|
+
!1
|
|
1105
|
+
);
|
|
1106
|
+
if (l >= 0) {
|
|
1107
|
+
for (var h = this._keys.length, p = l + 1; p < h; p++)
|
|
1108
|
+
this._keys[p - 1] = this._keys[p], this._values[p - 1] = this._values[p];
|
|
1109
|
+
return this._keys.length--, this._values.length--, Et(d, this._cacheKey) && (this._cacheKey = n, this._cacheIndex = -2), !0;
|
|
1110
|
+
}
|
|
1111
|
+
return !1;
|
|
1112
|
+
}, T.prototype.clear = function() {
|
|
1113
|
+
this._keys.length = 0, this._values.length = 0, this._cacheKey = n, this._cacheIndex = -2;
|
|
1114
|
+
}, T.prototype.keys = function() {
|
|
1115
|
+
return new i(this._keys, this._values, y);
|
|
1116
|
+
}, T.prototype.values = function() {
|
|
1117
|
+
return new i(this._keys, this._values, A);
|
|
1118
|
+
}, T.prototype.entries = function() {
|
|
1119
|
+
return new i(this._keys, this._values, L);
|
|
1120
|
+
}, T.prototype["@@iterator"] = function() {
|
|
1121
|
+
return this.entries();
|
|
1122
|
+
}, T.prototype[E] = function() {
|
|
1123
|
+
return this.entries();
|
|
1124
|
+
}, T.prototype._find = function(d, l) {
|
|
1125
|
+
if (!Et(this._cacheKey, d)) {
|
|
1126
|
+
this._cacheIndex = -1;
|
|
1127
|
+
for (var h = 0; h < this._keys.length; h++)
|
|
1128
|
+
if (Et(this._keys[h], d)) {
|
|
1129
|
+
this._cacheIndex = h;
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
return this._cacheIndex < 0 && l && (this._cacheIndex = this._keys.length, this._keys.push(d), this._values.push(void 0)), this._cacheIndex;
|
|
1134
|
+
}, T;
|
|
1135
|
+
})()
|
|
1136
|
+
);
|
|
1137
|
+
return c;
|
|
1138
|
+
function y(T, d) {
|
|
1139
|
+
return T;
|
|
1140
|
+
}
|
|
1141
|
+
function A(T, d) {
|
|
1142
|
+
return d;
|
|
1143
|
+
}
|
|
1144
|
+
function L(T, d) {
|
|
1145
|
+
return [T, d];
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
function Ae() {
|
|
1149
|
+
var n = (
|
|
1150
|
+
/** @class */
|
|
1151
|
+
(function() {
|
|
1152
|
+
function o() {
|
|
1153
|
+
this._map = new R();
|
|
1154
|
+
}
|
|
1155
|
+
return Object.defineProperty(o.prototype, "size", {
|
|
1156
|
+
get: function() {
|
|
1157
|
+
return this._map.size;
|
|
1158
|
+
},
|
|
1159
|
+
enumerable: !0,
|
|
1160
|
+
configurable: !0
|
|
1161
|
+
}), o.prototype.has = function(i) {
|
|
1162
|
+
return this._map.has(i);
|
|
1163
|
+
}, o.prototype.add = function(i) {
|
|
1164
|
+
return this._map.set(i, i), this;
|
|
1165
|
+
}, o.prototype.delete = function(i) {
|
|
1166
|
+
return this._map.delete(i);
|
|
1167
|
+
}, o.prototype.clear = function() {
|
|
1168
|
+
this._map.clear();
|
|
1169
|
+
}, o.prototype.keys = function() {
|
|
1170
|
+
return this._map.keys();
|
|
1171
|
+
}, o.prototype.values = function() {
|
|
1172
|
+
return this._map.keys();
|
|
1173
|
+
}, o.prototype.entries = function() {
|
|
1174
|
+
return this._map.entries();
|
|
1175
|
+
}, o.prototype["@@iterator"] = function() {
|
|
1176
|
+
return this.keys();
|
|
1177
|
+
}, o.prototype[E] = function() {
|
|
1178
|
+
return this.keys();
|
|
1179
|
+
}, o;
|
|
1180
|
+
})()
|
|
1181
|
+
);
|
|
1182
|
+
return n;
|
|
1183
|
+
}
|
|
1184
|
+
function Ie() {
|
|
1185
|
+
var n = 16, o = b.create(), i = c();
|
|
1186
|
+
return (
|
|
1187
|
+
/** @class */
|
|
1188
|
+
(function() {
|
|
1189
|
+
function d() {
|
|
1190
|
+
this._key = c();
|
|
1191
|
+
}
|
|
1192
|
+
return d.prototype.has = function(l) {
|
|
1193
|
+
var h = y(
|
|
1194
|
+
l,
|
|
1195
|
+
/*create*/
|
|
1196
|
+
!1
|
|
1197
|
+
);
|
|
1198
|
+
return h !== void 0 ? b.has(h, this._key) : !1;
|
|
1199
|
+
}, d.prototype.get = function(l) {
|
|
1200
|
+
var h = y(
|
|
1201
|
+
l,
|
|
1202
|
+
/*create*/
|
|
1203
|
+
!1
|
|
1204
|
+
);
|
|
1205
|
+
return h !== void 0 ? b.get(h, this._key) : void 0;
|
|
1206
|
+
}, d.prototype.set = function(l, h) {
|
|
1207
|
+
var p = y(
|
|
1208
|
+
l,
|
|
1209
|
+
/*create*/
|
|
1210
|
+
!0
|
|
1211
|
+
);
|
|
1212
|
+
return p[this._key] = h, this;
|
|
1213
|
+
}, d.prototype.delete = function(l) {
|
|
1214
|
+
var h = y(
|
|
1215
|
+
l,
|
|
1216
|
+
/*create*/
|
|
1217
|
+
!1
|
|
1218
|
+
);
|
|
1219
|
+
return h !== void 0 ? delete h[this._key] : !1;
|
|
1220
|
+
}, d.prototype.clear = function() {
|
|
1221
|
+
this._key = c();
|
|
1222
|
+
}, d;
|
|
1223
|
+
})()
|
|
1224
|
+
);
|
|
1225
|
+
function c() {
|
|
1226
|
+
var d;
|
|
1227
|
+
do
|
|
1228
|
+
d = "@@WeakMap@@" + T();
|
|
1229
|
+
while (b.has(o, d));
|
|
1230
|
+
return o[d] = !0, d;
|
|
1231
|
+
}
|
|
1232
|
+
function y(d, l) {
|
|
1233
|
+
if (!s.call(d, i)) {
|
|
1234
|
+
if (!l)
|
|
1235
|
+
return;
|
|
1236
|
+
Object.defineProperty(d, i, { value: b.create() });
|
|
1237
|
+
}
|
|
1238
|
+
return d[i];
|
|
1239
|
+
}
|
|
1240
|
+
function A(d, l) {
|
|
1241
|
+
for (var h = 0; h < l; ++h)
|
|
1242
|
+
d[h] = Math.random() * 255 | 0;
|
|
1243
|
+
return d;
|
|
1244
|
+
}
|
|
1245
|
+
function L(d) {
|
|
1246
|
+
if (typeof Uint8Array == "function") {
|
|
1247
|
+
var l = new Uint8Array(d);
|
|
1248
|
+
return typeof crypto < "u" ? crypto.getRandomValues(l) : typeof msCrypto < "u" ? msCrypto.getRandomValues(l) : A(l, d), l;
|
|
1249
|
+
}
|
|
1250
|
+
return A(new Array(d), d);
|
|
1251
|
+
}
|
|
1252
|
+
function T() {
|
|
1253
|
+
var d = L(n);
|
|
1254
|
+
d[6] = d[6] & 79 | 64, d[8] = d[8] & 191 | 128;
|
|
1255
|
+
for (var l = "", h = 0; h < n; ++h) {
|
|
1256
|
+
var p = d[h];
|
|
1257
|
+
(h === 4 || h === 6 || h === 8) && (l += "-"), p < 16 && (l += "0"), l += p.toString(16).toLowerCase();
|
|
1258
|
+
}
|
|
1259
|
+
return l;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
function wt(n) {
|
|
1263
|
+
return n.__ = void 0, delete n.__, n;
|
|
1264
|
+
}
|
|
1265
|
+
});
|
|
1266
|
+
})(t || (t = {})), Yt;
|
|
1267
|
+
}
|
|
1268
|
+
Ze();
|
|
1269
|
+
const te = Symbol("endpoint:metadata");
|
|
1270
|
+
function bt(t, e, r = {}) {
|
|
1271
|
+
return function(a, s) {
|
|
1272
|
+
const u = {
|
|
1273
|
+
method: t,
|
|
1274
|
+
path: e,
|
|
1275
|
+
...r
|
|
1276
|
+
};
|
|
1277
|
+
Reflect.defineMetadata(
|
|
1278
|
+
te,
|
|
1279
|
+
u,
|
|
1280
|
+
a,
|
|
1281
|
+
s
|
|
1282
|
+
);
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
function q(t = "", e = {}) {
|
|
1286
|
+
return bt(De.POST, t, e);
|
|
1287
|
+
}
|
|
1288
|
+
var gt = /* @__PURE__ */ ((t) => (t.EXCHANGE = "Exchange", t.RESULT = "Result", t))(gt || {});
|
|
1289
|
+
const Ke = "__decorator_target__", tr = "__decorator_metadata__";
|
|
1290
|
+
let er = class {
|
|
1291
|
+
/**
|
|
1292
|
+
* Creates a new RequestExecutor instance.
|
|
1293
|
+
* @param target - The target object that the method is called on.
|
|
1294
|
+
* This can contain a custom fetcher instance in its 'fetcher' property.
|
|
1295
|
+
* @param metadata - The function metadata containing all request information
|
|
1296
|
+
*/
|
|
1297
|
+
constructor(e, r) {
|
|
1298
|
+
this.target = e, this.metadata = r;
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Executes the HTTP request.
|
|
1302
|
+
*
|
|
1303
|
+
* This method resolves the path and request configuration from the metadata
|
|
1304
|
+
* and arguments, then executes the request using the configured fetcher.
|
|
1305
|
+
* It handles the complete request lifecycle from parameter processing to
|
|
1306
|
+
* response extraction.
|
|
1307
|
+
*
|
|
1308
|
+
|
|
1309
|
+
* @param args - The runtime arguments passed to the decorated method.
|
|
1310
|
+
* These are mapped to request components based on parameter decorators.
|
|
1311
|
+
* @returns A Promise that resolves to the extracted result based on the configured result extractor.
|
|
1312
|
+
* By default, this is the Response object, but can be customized to return
|
|
1313
|
+
* parsed JSON, the raw exchange object, or any other transformed result.
|
|
1314
|
+
*
|
|
1315
|
+
* @example
|
|
1316
|
+
* ```typescript
|
|
1317
|
+
* // Given a decorated service method:
|
|
1318
|
+
* class UserService {
|
|
1319
|
+
* @get('/users/{id}')
|
|
1320
|
+
* getUser(@path('id') id: number): Promise<Response> {
|
|
1321
|
+
* // This method body is replaced by the executor at runtime
|
|
1322
|
+
* }
|
|
1323
|
+
* }
|
|
1324
|
+
*
|
|
1325
|
+
* // When calling:
|
|
1326
|
+
* const userService = new UserService();
|
|
1327
|
+
* const response = await userService.getUser(123);
|
|
1328
|
+
*
|
|
1329
|
+
* // The execute method will:
|
|
1330
|
+
* // 1. Resolve the path to '/users/123'
|
|
1331
|
+
* // 2. Create a request with method 'GET'
|
|
1332
|
+
* // 3. Execute the request using the configured fetcher
|
|
1333
|
+
* // 4. Return the Response object
|
|
1334
|
+
* ```
|
|
1335
|
+
*/
|
|
1336
|
+
async execute(e) {
|
|
1337
|
+
const r = this.metadata.fetcher, a = this.metadata.resolveExchangeInit(e);
|
|
1338
|
+
a.attributes?.set(Ke, this.target), a.attributes?.set(
|
|
1339
|
+
tr,
|
|
1340
|
+
this.metadata
|
|
1341
|
+
);
|
|
1342
|
+
const s = this.metadata.resolveResultExtractor(), u = this.metadata.resolveEndpointReturnType(), f = await r.exchange(a.request, {
|
|
1343
|
+
resultExtractor: s,
|
|
1344
|
+
attributes: a.attributes
|
|
1345
|
+
});
|
|
1346
|
+
return u === gt.EXCHANGE ? f : await f.extractResult();
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
const rt = /* @__PURE__ */ new WeakMap();
|
|
1350
|
+
function rr(t) {
|
|
1351
|
+
if (typeof t != "function")
|
|
1352
|
+
throw new TypeError("Expected a function");
|
|
1353
|
+
if (rt.has(t))
|
|
1354
|
+
return rt.get(t);
|
|
1355
|
+
try {
|
|
1356
|
+
const e = t.toString().trim(), r = or(e);
|
|
1357
|
+
if (!ar(r)) {
|
|
1358
|
+
const s = [];
|
|
1359
|
+
return rt.set(t, s), s;
|
|
1360
|
+
}
|
|
1361
|
+
const a = ir(r);
|
|
1362
|
+
return rt.set(t, a), a;
|
|
1363
|
+
} catch {
|
|
1364
|
+
const e = [];
|
|
1365
|
+
return rt.set(t, e), e;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
function nr(t, e, r, a) {
|
|
1369
|
+
if (a)
|
|
1370
|
+
return a;
|
|
1371
|
+
try {
|
|
1372
|
+
const s = t[e];
|
|
1373
|
+
if (s && typeof s == "function") {
|
|
1374
|
+
const u = rr(s);
|
|
1375
|
+
if (r < u.length)
|
|
1376
|
+
return u[r];
|
|
1377
|
+
}
|
|
1378
|
+
} catch {
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
function ar(t) {
|
|
1382
|
+
return t != null && t.trim() !== "";
|
|
1383
|
+
}
|
|
1384
|
+
function or(t) {
|
|
1385
|
+
if (t.startsWith("(")) {
|
|
1386
|
+
const a = Xt(t, 0);
|
|
1387
|
+
return a === -1 ? "" : t.substring(1, a);
|
|
1388
|
+
}
|
|
1389
|
+
const e = t.indexOf("(");
|
|
1390
|
+
if (e === -1) return "";
|
|
1391
|
+
const r = Xt(t, e);
|
|
1392
|
+
return r === -1 ? "" : t.substring(e + 1, r);
|
|
1393
|
+
}
|
|
1394
|
+
function Xt(t, e) {
|
|
1395
|
+
let r = 1;
|
|
1396
|
+
for (let a = e + 1; a < t.length; a++) {
|
|
1397
|
+
const s = t[a];
|
|
1398
|
+
if (s === "(")
|
|
1399
|
+
r++;
|
|
1400
|
+
else if (s === ")" && (r--, r === 0))
|
|
1401
|
+
return a;
|
|
1402
|
+
}
|
|
1403
|
+
return -1;
|
|
1404
|
+
}
|
|
1405
|
+
function ir(t) {
|
|
1406
|
+
return t.split(",").map(sr).filter(ur).map(cr);
|
|
1407
|
+
}
|
|
1408
|
+
function sr(t) {
|
|
1409
|
+
return t.trim();
|
|
1410
|
+
}
|
|
1411
|
+
function ur(t) {
|
|
1412
|
+
return t.length > 0;
|
|
1413
|
+
}
|
|
1414
|
+
function cr(t) {
|
|
1415
|
+
let e = fr(t);
|
|
1416
|
+
return e = dr(e), e.trim();
|
|
1417
|
+
}
|
|
1418
|
+
function fr(t) {
|
|
1419
|
+
const e = t.indexOf("=");
|
|
1420
|
+
return e !== -1 ? t.substring(0, e) : t;
|
|
1421
|
+
}
|
|
1422
|
+
function dr(t) {
|
|
1423
|
+
const e = t.indexOf(":");
|
|
1424
|
+
return e !== -1 ? t.substring(0, e) : t;
|
|
1425
|
+
}
|
|
1426
|
+
var X = /* @__PURE__ */ ((t) => (t.PATH = "path", t.QUERY = "query", t.HEADER = "header", t.BODY = "body", t.REQUEST = "request", t.ATTRIBUTE = "attribute", t))(X || {});
|
|
1427
|
+
const St = Symbol("parameter:metadata");
|
|
1428
|
+
function Rt(t, e = "") {
|
|
1429
|
+
return function(r, a, s) {
|
|
1430
|
+
const u = nr(
|
|
1431
|
+
r,
|
|
1432
|
+
a,
|
|
1433
|
+
s,
|
|
1434
|
+
e
|
|
1435
|
+
), f = Reflect.getMetadata(St, r, a) || /* @__PURE__ */ new Map(), E = {
|
|
1436
|
+
type: t,
|
|
1437
|
+
name: u,
|
|
1438
|
+
index: s
|
|
1439
|
+
};
|
|
1440
|
+
f.set(s, E), Reflect.defineMetadata(
|
|
1441
|
+
St,
|
|
1442
|
+
f,
|
|
1443
|
+
r,
|
|
1444
|
+
a
|
|
1445
|
+
);
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
function H() {
|
|
1449
|
+
return Rt(
|
|
1450
|
+
"body"
|
|
1451
|
+
/* BODY */
|
|
1452
|
+
);
|
|
1453
|
+
}
|
|
1454
|
+
function ee() {
|
|
1455
|
+
return Rt(
|
|
1456
|
+
"request"
|
|
1457
|
+
/* REQUEST */
|
|
1458
|
+
);
|
|
1459
|
+
}
|
|
1460
|
+
function j(t = "") {
|
|
1461
|
+
return Rt("attribute", t);
|
|
1462
|
+
}
|
|
1463
|
+
let re = class {
|
|
1464
|
+
/**
|
|
1465
|
+
* Creates a new FunctionMetadata instance.
|
|
1466
|
+
*
|
|
1467
|
+
* @param name - The name of the function
|
|
1468
|
+
* @param api - API-level metadata
|
|
1469
|
+
* @param endpoint - Endpoint-level metadata
|
|
1470
|
+
* @param parameters - Parameter metadata array
|
|
1471
|
+
*/
|
|
1472
|
+
constructor(e, r, a, s) {
|
|
1473
|
+
this.name = e, this.api = r, this.endpoint = a, this.parameters = s;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Gets the fetcher instance to use for this function.
|
|
1477
|
+
*
|
|
1478
|
+
* Returns the fetcher specified in the endpoint metadata, or the API metadata,
|
|
1479
|
+
* or falls back to the default fetcher if none is specified.
|
|
1480
|
+
*
|
|
1481
|
+
* @returns The fetcher instance
|
|
1482
|
+
*/
|
|
1483
|
+
get fetcher() {
|
|
1484
|
+
return zt(this.endpoint.fetcher ?? this.api.fetcher);
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Resolves the complete path by combining base path and endpoint path
|
|
1488
|
+
*
|
|
1489
|
+
* @param parameterPath - Optional path parameter to use instead of endpoint path
|
|
1490
|
+
* @returns The combined URL path
|
|
1491
|
+
*/
|
|
1492
|
+
resolvePath(e) {
|
|
1493
|
+
const r = this.endpoint.basePath || this.api.basePath || "", a = e || this.endpoint.path || "";
|
|
1494
|
+
return je(r, a);
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Resolves the timeout for the request.
|
|
1498
|
+
*
|
|
1499
|
+
* Returns the timeout specified in the endpoint metadata, or the API metadata,
|
|
1500
|
+
* or undefined if no timeout is specified.
|
|
1501
|
+
*
|
|
1502
|
+
* @returns The timeout value in milliseconds, or undefined
|
|
1503
|
+
*/
|
|
1504
|
+
resolveTimeout() {
|
|
1505
|
+
return this.endpoint.timeout || this.api.timeout;
|
|
1506
|
+
}
|
|
1507
|
+
resolveResultExtractor() {
|
|
1508
|
+
return this.endpoint.resultExtractor || this.api.resultExtractor || Ge;
|
|
1509
|
+
}
|
|
1510
|
+
resolveAttributes() {
|
|
1511
|
+
const e = mt(this.api.attributes);
|
|
1512
|
+
return mt(this.endpoint.attributes, e);
|
|
1513
|
+
}
|
|
1514
|
+
resolveEndpointReturnType() {
|
|
1515
|
+
return this.endpoint.returnType || this.api.returnType || gt.RESULT;
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Resolves the request configuration from the method arguments.
|
|
1519
|
+
*
|
|
1520
|
+
* This method processes the runtime arguments according to the parameter metadata
|
|
1521
|
+
* and constructs a FetcherRequest object with path parameters, query parameters,
|
|
1522
|
+
* headers, body, and timeout. It handles various parameter types including:
|
|
1523
|
+
* - Path parameters (@path decorator)
|
|
1524
|
+
* - Query parameters (@query decorator)
|
|
1525
|
+
* - Header parameters (@header decorator)
|
|
1526
|
+
* - Body parameter (@body decorator)
|
|
1527
|
+
* - Complete request object (@request decorator)
|
|
1528
|
+
* - AbortSignal for request cancellation
|
|
1529
|
+
*
|
|
1530
|
+
* The method uses mergeRequest to combine the endpoint-specific configuration
|
|
1531
|
+
* with the parameter-provided request object, where the parameter request
|
|
1532
|
+
* takes precedence over endpoint configuration.
|
|
1533
|
+
*
|
|
1534
|
+
* @param args - The runtime arguments passed to the method
|
|
1535
|
+
* @returns A FetcherRequest object with all request configuration
|
|
1536
|
+
*
|
|
1537
|
+
* @example
|
|
1538
|
+
* ```typescript
|
|
1539
|
+
* // For a method decorated like:
|
|
1540
|
+
* @get('/users/{id}')
|
|
1541
|
+
* getUser(
|
|
1542
|
+
* @path('id') id: number,
|
|
1543
|
+
* @query('include') include: string,
|
|
1544
|
+
* @header('Authorization') auth: string
|
|
1545
|
+
* ): Promise<Response>
|
|
1546
|
+
*
|
|
1547
|
+
* // Calling with: getUser(123, 'profile', 'Bearer token')
|
|
1548
|
+
* // Would produce a request with:
|
|
1549
|
+
* // {
|
|
1550
|
+
* // method: 'GET',
|
|
1551
|
+
* // urlParams: {
|
|
1552
|
+
* // path: { id: 123 },
|
|
1553
|
+
* // query: { include: 'profile' }
|
|
1554
|
+
* // },
|
|
1555
|
+
* // headers: {
|
|
1556
|
+
* // 'Authorization': 'Bearer token',
|
|
1557
|
+
* // ...apiHeaders,
|
|
1558
|
+
* // ...endpointHeaders
|
|
1559
|
+
* // }
|
|
1560
|
+
* // }
|
|
1561
|
+
* ```
|
|
1562
|
+
*/
|
|
1563
|
+
resolveExchangeInit(e) {
|
|
1564
|
+
const r = {}, a = {}, s = {
|
|
1565
|
+
...this.api.headers,
|
|
1566
|
+
...this.endpoint.headers
|
|
1567
|
+
};
|
|
1568
|
+
let u, f, E, m = {};
|
|
1569
|
+
const S = this.resolveAttributes();
|
|
1570
|
+
e.forEach((M, tt) => {
|
|
1571
|
+
if (M instanceof AbortSignal) {
|
|
1572
|
+
f = M;
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
if (M instanceof AbortController) {
|
|
1576
|
+
E = M;
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
const G = this.parameters.get(tt);
|
|
1580
|
+
if (G)
|
|
1581
|
+
switch (G.type) {
|
|
1582
|
+
case X.PATH:
|
|
1583
|
+
this.processPathParam(G, M, r);
|
|
1584
|
+
break;
|
|
1585
|
+
case X.QUERY:
|
|
1586
|
+
this.processQueryParam(G, M, a);
|
|
1587
|
+
break;
|
|
1588
|
+
case X.HEADER:
|
|
1589
|
+
this.processHeaderParam(G, M, s);
|
|
1590
|
+
break;
|
|
1591
|
+
case X.BODY:
|
|
1592
|
+
u = M;
|
|
1593
|
+
break;
|
|
1594
|
+
case X.REQUEST:
|
|
1595
|
+
m = this.processRequestParam(M);
|
|
1596
|
+
break;
|
|
1597
|
+
case X.ATTRIBUTE:
|
|
1598
|
+
this.processAttributeParam(G, M, S);
|
|
1599
|
+
break;
|
|
1600
|
+
}
|
|
1601
|
+
});
|
|
1602
|
+
const O = {
|
|
1603
|
+
path: r,
|
|
1604
|
+
query: a
|
|
1605
|
+
}, b = {
|
|
1606
|
+
method: this.endpoint.method,
|
|
1607
|
+
urlParams: O,
|
|
1608
|
+
headers: s,
|
|
1609
|
+
body: u,
|
|
1610
|
+
timeout: this.resolveTimeout(),
|
|
1611
|
+
signal: f,
|
|
1612
|
+
abortController: E
|
|
1613
|
+
}, P = qe(
|
|
1614
|
+
b,
|
|
1615
|
+
m
|
|
1616
|
+
), R = m.path;
|
|
1617
|
+
return P.url = this.resolvePath(R), {
|
|
1618
|
+
request: P,
|
|
1619
|
+
attributes: S
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
processHttpParam(e, r, a) {
|
|
1623
|
+
if (r == null)
|
|
1624
|
+
return;
|
|
1625
|
+
if (typeof r == "object") {
|
|
1626
|
+
Object.entries(r).forEach(([u, f]) => {
|
|
1627
|
+
a[u] = f;
|
|
1628
|
+
});
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
const s = e.name || `param${e.index}`;
|
|
1632
|
+
a[s] = r;
|
|
1633
|
+
}
|
|
1634
|
+
processPathParam(e, r, a) {
|
|
1635
|
+
this.processHttpParam(e, r, a);
|
|
1636
|
+
}
|
|
1637
|
+
processQueryParam(e, r, a) {
|
|
1638
|
+
this.processHttpParam(e, r, a);
|
|
1639
|
+
}
|
|
1640
|
+
processHeaderParam(e, r, a) {
|
|
1641
|
+
this.processHttpParam(e, r, a);
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Processes a request parameter value.
|
|
1645
|
+
*
|
|
1646
|
+
* This method handles the @request() decorator parameter by casting
|
|
1647
|
+
* the provided value to a FetcherRequest. The @request() decorator
|
|
1648
|
+
* allows users to pass a complete FetcherRequest object to customize
|
|
1649
|
+
* the request configuration.
|
|
1650
|
+
*
|
|
1651
|
+
* @param value - The value provided for the @request() parameter
|
|
1652
|
+
* @returns The value cast to FetcherRequest type
|
|
1653
|
+
*
|
|
1654
|
+
* @example
|
|
1655
|
+
* ```typescript
|
|
1656
|
+
* @post('/users')
|
|
1657
|
+
* createUsers(@request() request: FetcherRequest): Promise<Response>
|
|
1658
|
+
*
|
|
1659
|
+
* // Usage:
|
|
1660
|
+
* const customRequest: FetcherRequest = {
|
|
1661
|
+
* headers: { 'X-Custom': 'value' },
|
|
1662
|
+
* timeout: 5000
|
|
1663
|
+
* };
|
|
1664
|
+
* await service.createUsers(customRequest);
|
|
1665
|
+
* ```
|
|
1666
|
+
*/
|
|
1667
|
+
processRequestParam(e) {
|
|
1668
|
+
if (!e)
|
|
1669
|
+
return {};
|
|
1670
|
+
const r = e;
|
|
1671
|
+
return {
|
|
1672
|
+
...r,
|
|
1673
|
+
headers: r.headers || {},
|
|
1674
|
+
urlParams: r.urlParams || { path: {}, query: {} }
|
|
1675
|
+
};
|
|
1676
|
+
}
|
|
1677
|
+
processAttributeParam(e, r, a) {
|
|
1678
|
+
if (typeof r == "object" || r instanceof Map) {
|
|
1679
|
+
mt(r, a);
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
e.name && r !== void 0 && a.set(e.name, r);
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
const lr = Symbol("api:metadata");
|
|
1686
|
+
function hr(t, e, r) {
|
|
1687
|
+
const a = t.prototype[e];
|
|
1688
|
+
if (e === "constructor" || typeof a != "function")
|
|
1689
|
+
return;
|
|
1690
|
+
const s = Reflect.getMetadata(
|
|
1691
|
+
te,
|
|
1692
|
+
t.prototype,
|
|
1693
|
+
e
|
|
1694
|
+
);
|
|
1695
|
+
if (!s)
|
|
1696
|
+
return;
|
|
1697
|
+
const u = Reflect.getMetadata(
|
|
1698
|
+
St,
|
|
1699
|
+
t.prototype,
|
|
1700
|
+
e
|
|
1701
|
+
) || /* @__PURE__ */ new Map(), f = new re(
|
|
1702
|
+
e,
|
|
1703
|
+
r,
|
|
1704
|
+
s,
|
|
1705
|
+
u
|
|
1706
|
+
);
|
|
1707
|
+
t.prototype[e] = async function(...E) {
|
|
1708
|
+
return await pr(
|
|
1709
|
+
this,
|
|
1710
|
+
f
|
|
1711
|
+
).execute(E);
|
|
1712
|
+
};
|
|
1713
|
+
}
|
|
1714
|
+
function pr(t, e) {
|
|
1715
|
+
let r = t.requestExecutors;
|
|
1716
|
+
r || (r = /* @__PURE__ */ new Map(), t.requestExecutors = r);
|
|
1717
|
+
let a = r.get(e.name);
|
|
1718
|
+
if (a)
|
|
1719
|
+
return a;
|
|
1720
|
+
const s = t.apiMetadata, u = {
|
|
1721
|
+
...e.api,
|
|
1722
|
+
...s
|
|
1723
|
+
};
|
|
1724
|
+
return a = new er(
|
|
1725
|
+
t,
|
|
1726
|
+
new re(
|
|
1727
|
+
e.name,
|
|
1728
|
+
u,
|
|
1729
|
+
e.endpoint,
|
|
1730
|
+
e.parameters
|
|
1731
|
+
)
|
|
1732
|
+
), r.set(e.name, a), a;
|
|
1733
|
+
}
|
|
1734
|
+
function Ot(t = "", e = {}) {
|
|
1735
|
+
return function(r) {
|
|
1736
|
+
const a = {
|
|
1737
|
+
basePath: t,
|
|
1738
|
+
...e
|
|
1739
|
+
};
|
|
1740
|
+
return Reflect.defineMetadata(lr, a, r), Object.getOwnPropertyNames(r.prototype).forEach((s) => {
|
|
1741
|
+
hr(r, s, a);
|
|
1742
|
+
}), r;
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
let yr = class extends Error {
|
|
1746
|
+
constructor() {
|
|
1747
|
+
super("Implementation will be generated automatically."), this.name = "AutoGenerated";
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
const D = (...t) => new yr();
|
|
1751
|
+
var vr = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, Mt = (t, e, r, a) => {
|
|
1752
|
+
for (var s = a > 1 ? void 0 : a ? Er(e, r) : e, u = t.length - 1, f; u >= 0; u--)
|
|
1753
|
+
(f = t[u]) && (s = (a ? f(e, r, s) : f(s)) || s);
|
|
1754
|
+
return a && s && vr(e, r, s), s;
|
|
1755
|
+
}, dt = (t, e) => (r, a) => e(r, a, t);
|
|
1756
|
+
let lt = class {
|
|
1757
|
+
constructor(t) {
|
|
1758
|
+
this.apiMetadata = t;
|
|
1759
|
+
}
|
|
1760
|
+
send(t, e) {
|
|
1761
|
+
throw D(t, e);
|
|
1762
|
+
}
|
|
1763
|
+
sendAndWaitStream(t, e) {
|
|
1764
|
+
throw D(t, e);
|
|
1765
|
+
}
|
|
1766
|
+
};
|
|
1767
|
+
Mt([
|
|
1768
|
+
bt(),
|
|
1769
|
+
dt(0, ee()),
|
|
1770
|
+
dt(1, j())
|
|
1771
|
+
], lt.prototype, "send", 1);
|
|
1772
|
+
Mt([
|
|
1773
|
+
bt(void 0, void 0, {
|
|
1774
|
+
headers: { Accept: at.TEXT_EVENT_STREAM },
|
|
1775
|
+
resultExtractor: pt
|
|
1776
|
+
}),
|
|
1777
|
+
dt(0, ee()),
|
|
1778
|
+
dt(1, j())
|
|
1779
|
+
], lt.prototype, "sendAndWaitStream", 1);
|
|
1780
|
+
lt = Mt([
|
|
1781
|
+
Ot()
|
|
1782
|
+
], lt);
|
|
1783
|
+
var ne = /* @__PURE__ */ ((t) => (t.AND = "AND", t.OR = "OR", t.NOR = "NOR", t.ID = "ID", t.IDS = "IDS", t.AGGREGATE_ID = "AGGREGATE_ID", t.AGGREGATE_IDS = "AGGREGATE_IDS", t.TENANT_ID = "TENANT_ID", t.OWNER_ID = "OWNER_ID", t.DELETED = "DELETED", t.ALL = "ALL", t.EQ = "EQ", t.NE = "NE", t.GT = "GT", t.LT = "LT", t.GTE = "GTE", t.LTE = "LTE", t.CONTAINS = "CONTAINS", t.IN = "IN", t.NOT_IN = "NOT_IN", t.BETWEEN = "BETWEEN", t.ALL_IN = "ALL_IN", t.STARTS_WITH = "STARTS_WITH", t.ENDS_WITH = "ENDS_WITH", t.ELEM_MATCH = "ELEM_MATCH", t.NULL = "NULL", t.NOT_NULL = "NOT_NULL", t.TRUE = "TRUE", t.FALSE = "FALSE", t.EXISTS = "EXISTS", t.TODAY = "TODAY", t.BEFORE_TODAY = "BEFORE_TODAY", t.TOMORROW = "TOMORROW", t.THIS_WEEK = "THIS_WEEK", t.NEXT_WEEK = "NEXT_WEEK", t.LAST_WEEK = "LAST_WEEK", t.THIS_MONTH = "THIS_MONTH", t.LAST_MONTH = "LAST_MONTH", t.RECENT_DAYS = "RECENT_DAYS", t.EARLIER_DAYS = "EARLIER_DAYS", t.RAW = "RAW", t))(ne || {});
|
|
1784
|
+
function At() {
|
|
1785
|
+
return {
|
|
1786
|
+
operator: ne.ALL
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
const ae = {
|
|
1790
|
+
index: 1,
|
|
1791
|
+
size: 10
|
|
1792
|
+
};
|
|
1793
|
+
function Tr({
|
|
1794
|
+
condition: t = At(),
|
|
1795
|
+
projection: e,
|
|
1796
|
+
sort: r
|
|
1797
|
+
} = {}) {
|
|
1798
|
+
return {
|
|
1799
|
+
condition: t,
|
|
1800
|
+
projection: e,
|
|
1801
|
+
sort: r
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
function wr({
|
|
1805
|
+
condition: t = At(),
|
|
1806
|
+
projection: e,
|
|
1807
|
+
sort: r,
|
|
1808
|
+
limit: a = ae.size
|
|
1809
|
+
} = {}) {
|
|
1810
|
+
return {
|
|
1811
|
+
condition: t,
|
|
1812
|
+
projection: e,
|
|
1813
|
+
sort: r,
|
|
1814
|
+
limit: a
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
function mr({
|
|
1818
|
+
condition: t = At(),
|
|
1819
|
+
projection: e,
|
|
1820
|
+
sort: r,
|
|
1821
|
+
pagination: a = ae
|
|
1822
|
+
} = {}) {
|
|
1823
|
+
return {
|
|
1824
|
+
condition: t,
|
|
1825
|
+
projection: e,
|
|
1826
|
+
sort: r,
|
|
1827
|
+
pagination: a
|
|
1828
|
+
};
|
|
1829
|
+
}
|
|
1830
|
+
const Y = class {
|
|
1831
|
+
};
|
|
1832
|
+
Y.EVENT_STREAM_RESOURCE_NAME = "event", Y.COUNT = `${Y.EVENT_STREAM_RESOURCE_NAME}/count`, Y.LIST = `${Y.EVENT_STREAM_RESOURCE_NAME}/list`, Y.PAGED = `${Y.EVENT_STREAM_RESOURCE_NAME}/paged`;
|
|
1833
|
+
let yt = Y;
|
|
1834
|
+
var Sr = Object.defineProperty, _r = Object.getOwnPropertyDescriptor, st = (t, e, r, a) => {
|
|
1835
|
+
for (var s = a > 1 ? void 0 : a ? _r(e, r) : e, u = t.length - 1, f; u >= 0; u--)
|
|
1836
|
+
(f = t[u]) && (s = (a ? f(e, r, s) : f(s)) || s);
|
|
1837
|
+
return a && s && Sr(e, r, s), s;
|
|
1838
|
+
}, B = (t, e) => (r, a) => e(r, a, t);
|
|
1839
|
+
let K = class {
|
|
1840
|
+
/**
|
|
1841
|
+
* Creates a new EventStreamQueryClient instance.
|
|
1842
|
+
*/
|
|
1843
|
+
constructor(t) {
|
|
1844
|
+
this.apiMetadata = t;
|
|
1845
|
+
}
|
|
1846
|
+
count(t, e) {
|
|
1847
|
+
throw D(t, e);
|
|
1848
|
+
}
|
|
1849
|
+
list(t, e) {
|
|
1850
|
+
throw D(t, e);
|
|
1851
|
+
}
|
|
1852
|
+
listStream(t, e) {
|
|
1853
|
+
throw D(t, e);
|
|
1854
|
+
}
|
|
1855
|
+
paged(t, e) {
|
|
1856
|
+
throw D(t, e);
|
|
1857
|
+
}
|
|
1858
|
+
};
|
|
1859
|
+
st([
|
|
1860
|
+
q(yt.COUNT),
|
|
1861
|
+
B(0, H()),
|
|
1862
|
+
B(1, j())
|
|
1863
|
+
], K.prototype, "count", 1);
|
|
1864
|
+
st([
|
|
1865
|
+
q(yt.LIST),
|
|
1866
|
+
B(0, H()),
|
|
1867
|
+
B(1, j())
|
|
1868
|
+
], K.prototype, "list", 1);
|
|
1869
|
+
st([
|
|
1870
|
+
q(yt.LIST, {
|
|
1871
|
+
headers: { Accept: at.TEXT_EVENT_STREAM },
|
|
1872
|
+
resultExtractor: pt
|
|
1873
|
+
}),
|
|
1874
|
+
B(0, H()),
|
|
1875
|
+
B(1, j())
|
|
1876
|
+
], K.prototype, "listStream", 1);
|
|
1877
|
+
st([
|
|
1878
|
+
q(yt.PAGED),
|
|
1879
|
+
B(0, H()),
|
|
1880
|
+
B(1, j())
|
|
1881
|
+
], K.prototype, "paged", 1);
|
|
1882
|
+
K = st([
|
|
1883
|
+
Ot()
|
|
1884
|
+
], K);
|
|
1885
|
+
const x = class {
|
|
1886
|
+
};
|
|
1887
|
+
x.SNAPSHOT_RESOURCE_NAME = "snapshot", x.COUNT = `${x.SNAPSHOT_RESOURCE_NAME}/count`, x.LIST = `${x.SNAPSHOT_RESOURCE_NAME}/list`, x.LIST_STATE = `${x.LIST}/state`, x.PAGED = `${x.SNAPSHOT_RESOURCE_NAME}/paged`, x.PAGED_STATE = `${x.PAGED}/state`, x.SINGLE = `${x.SNAPSHOT_RESOURCE_NAME}/single`, x.SINGLE_STATE = `${x.SINGLE}/state`;
|
|
1888
|
+
let V = x;
|
|
1889
|
+
var br = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, Q = (t, e, r, a) => {
|
|
1890
|
+
for (var s = a > 1 ? void 0 : a ? gr(e, r) : e, u = t.length - 1, f; u >= 0; u--)
|
|
1891
|
+
(f = t[u]) && (s = (a ? f(e, r, s) : f(s)) || s);
|
|
1892
|
+
return a && s && br(e, r, s), s;
|
|
1893
|
+
}, k = (t, e) => (r, a) => e(r, a, t);
|
|
1894
|
+
let $ = class {
|
|
1895
|
+
/**
|
|
1896
|
+
* Creates a new SnapshotQueryClient instance.
|
|
1897
|
+
*/
|
|
1898
|
+
constructor(t) {
|
|
1899
|
+
this.apiMetadata = t;
|
|
1900
|
+
}
|
|
1901
|
+
count(t, e) {
|
|
1902
|
+
throw D(t, e);
|
|
1903
|
+
}
|
|
1904
|
+
list(t, e) {
|
|
1905
|
+
throw D(t, e);
|
|
1906
|
+
}
|
|
1907
|
+
listStream(t, e) {
|
|
1908
|
+
throw D(t, e);
|
|
1909
|
+
}
|
|
1910
|
+
listState(t, e) {
|
|
1911
|
+
throw D(t, e);
|
|
1912
|
+
}
|
|
1913
|
+
listStateStream(t, e) {
|
|
1914
|
+
throw D(t, e);
|
|
1915
|
+
}
|
|
1916
|
+
paged(t, e) {
|
|
1917
|
+
throw D(t, e);
|
|
1918
|
+
}
|
|
1919
|
+
pagedState(t, e) {
|
|
1920
|
+
throw D(t, e);
|
|
1921
|
+
}
|
|
1922
|
+
single(t, e) {
|
|
1923
|
+
throw D(t, e);
|
|
1924
|
+
}
|
|
1925
|
+
singleState(t, e) {
|
|
1926
|
+
throw D(t, e);
|
|
1927
|
+
}
|
|
1928
|
+
};
|
|
1929
|
+
Q([
|
|
1930
|
+
q(V.COUNT),
|
|
1931
|
+
k(0, H()),
|
|
1932
|
+
k(1, j())
|
|
1933
|
+
], $.prototype, "count", 1);
|
|
1934
|
+
Q([
|
|
1935
|
+
q(V.LIST),
|
|
1936
|
+
k(0, H()),
|
|
1937
|
+
k(1, j())
|
|
1938
|
+
], $.prototype, "list", 1);
|
|
1939
|
+
Q([
|
|
1940
|
+
q(V.LIST, {
|
|
1941
|
+
headers: { Accept: at.TEXT_EVENT_STREAM },
|
|
1942
|
+
resultExtractor: pt
|
|
1943
|
+
}),
|
|
1944
|
+
k(0, H()),
|
|
1945
|
+
k(1, j())
|
|
1946
|
+
], $.prototype, "listStream", 1);
|
|
1947
|
+
Q([
|
|
1948
|
+
q(V.LIST_STATE),
|
|
1949
|
+
k(0, H()),
|
|
1950
|
+
k(1, j())
|
|
1951
|
+
], $.prototype, "listState", 1);
|
|
1952
|
+
Q([
|
|
1953
|
+
q(V.LIST_STATE, {
|
|
1954
|
+
headers: { Accept: at.TEXT_EVENT_STREAM },
|
|
1955
|
+
resultExtractor: pt
|
|
1956
|
+
}),
|
|
1957
|
+
k(0, H()),
|
|
1958
|
+
k(1, j())
|
|
1959
|
+
], $.prototype, "listStateStream", 1);
|
|
1960
|
+
Q([
|
|
1961
|
+
q(V.PAGED),
|
|
1962
|
+
k(0, H()),
|
|
1963
|
+
k(1, j())
|
|
1964
|
+
], $.prototype, "paged", 1);
|
|
1965
|
+
Q([
|
|
1966
|
+
q(V.PAGED_STATE),
|
|
1967
|
+
k(0, H()),
|
|
1968
|
+
k(1, j())
|
|
1969
|
+
], $.prototype, "pagedState", 1);
|
|
1970
|
+
Q([
|
|
1971
|
+
q(V.SINGLE),
|
|
1972
|
+
k(0, H()),
|
|
1973
|
+
k(1, j())
|
|
1974
|
+
], $.prototype, "single", 1);
|
|
1975
|
+
Q([
|
|
1976
|
+
q(V.SINGLE_STATE),
|
|
1977
|
+
k(0, H()),
|
|
1978
|
+
k(1, j())
|
|
1979
|
+
], $.prototype, "singleState", 1);
|
|
1980
|
+
$ = Q([
|
|
1981
|
+
Ot()
|
|
1982
|
+
], $);
|
|
1983
|
+
function qr(t) {
|
|
1984
|
+
const { initialQuery: e } = t, r = ot(t), [a, s] = C(e.condition), [u, f] = C(e.pagination), [E, m] = C(e.projection), [S, O] = C(e.sort), b = J(t), P = _(async () => {
|
|
1985
|
+
const M = mr({
|
|
1986
|
+
condition: a,
|
|
1987
|
+
pagination: u,
|
|
1988
|
+
projection: E,
|
|
1989
|
+
sort: S
|
|
1990
|
+
});
|
|
1991
|
+
return b.current.query(
|
|
1992
|
+
M,
|
|
1993
|
+
b.current.attributes
|
|
1994
|
+
);
|
|
1995
|
+
}, [a, E, u, S, b]), R = _(() => r.execute(P), [r, P]);
|
|
1996
|
+
return F(() => ({
|
|
1997
|
+
...r,
|
|
1998
|
+
execute: R,
|
|
1999
|
+
setCondition: s,
|
|
2000
|
+
setProjection: m,
|
|
2001
|
+
setPagination: f,
|
|
2002
|
+
setSort: O
|
|
2003
|
+
}), [
|
|
2004
|
+
r,
|
|
2005
|
+
R,
|
|
2006
|
+
s,
|
|
2007
|
+
m,
|
|
2008
|
+
f,
|
|
2009
|
+
O
|
|
2010
|
+
]);
|
|
2011
|
+
}
|
|
2012
|
+
function Hr(t) {
|
|
2013
|
+
const { initialQuery: e } = t, r = ot(t), [a, s] = C(e.condition), [u, f] = C(e.projection), [E, m] = C(e.sort), S = J(t), O = _(async () => {
|
|
2014
|
+
const P = Tr({
|
|
2015
|
+
condition: a,
|
|
2016
|
+
projection: u,
|
|
2017
|
+
sort: E
|
|
2018
|
+
});
|
|
2019
|
+
return S.current.query(
|
|
2020
|
+
P,
|
|
2021
|
+
S.current.attributes
|
|
2022
|
+
);
|
|
2023
|
+
}, [a, u, E, S]), b = _(() => r.execute(O), [r, O]);
|
|
2024
|
+
return F(() => ({
|
|
2025
|
+
...r,
|
|
2026
|
+
execute: b,
|
|
2027
|
+
setCondition: s,
|
|
2028
|
+
setProjection: f,
|
|
2029
|
+
setSort: m
|
|
2030
|
+
}), [r, b, s, f, m]);
|
|
2031
|
+
}
|
|
2032
|
+
function Ur(t) {
|
|
2033
|
+
const { initialCondition: e } = t, r = ot(t), [a, s] = C(e), u = J(t), f = _(async () => u.current.count(
|
|
2034
|
+
a,
|
|
2035
|
+
u.current.attributes
|
|
2036
|
+
), [a, u]), E = _(() => r.execute(f), [r, f]);
|
|
2037
|
+
return F(
|
|
2038
|
+
() => ({
|
|
2039
|
+
...r,
|
|
2040
|
+
execute: E,
|
|
2041
|
+
setCondition: s
|
|
2042
|
+
}),
|
|
2043
|
+
[r, E, s]
|
|
2044
|
+
);
|
|
2045
|
+
}
|
|
2046
|
+
function oe(t) {
|
|
2047
|
+
const { initialQuery: e } = t, [r, a] = C(e.condition), [s, u] = C(e.projection), [f, E] = C(e.sort), [m, S] = C(e.limit), O = _(() => wr({
|
|
2048
|
+
condition: r,
|
|
2049
|
+
projection: s,
|
|
2050
|
+
sort: f,
|
|
2051
|
+
limit: m
|
|
2052
|
+
}), [r, s, f, m]);
|
|
2053
|
+
return F(
|
|
2054
|
+
() => ({
|
|
2055
|
+
condition: r,
|
|
2056
|
+
projection: s,
|
|
2057
|
+
sort: f,
|
|
2058
|
+
limit: m,
|
|
2059
|
+
setCondition: a,
|
|
2060
|
+
setProjection: u,
|
|
2061
|
+
setSort: E,
|
|
2062
|
+
setLimit: S,
|
|
2063
|
+
buildQuery: O
|
|
2064
|
+
}),
|
|
2065
|
+
[
|
|
2066
|
+
r,
|
|
2067
|
+
s,
|
|
2068
|
+
f,
|
|
2069
|
+
m,
|
|
2070
|
+
a,
|
|
2071
|
+
u,
|
|
2072
|
+
E,
|
|
2073
|
+
S,
|
|
2074
|
+
O
|
|
2075
|
+
]
|
|
2076
|
+
);
|
|
2077
|
+
}
|
|
2078
|
+
function $r(t) {
|
|
2079
|
+
const e = ot(t), r = oe({ initialQuery: t.initialQuery }), a = J(t), s = _(async () => {
|
|
2080
|
+
const f = r.buildQuery();
|
|
2081
|
+
return a.current.list(
|
|
2082
|
+
f,
|
|
2083
|
+
a.current.attributes
|
|
2084
|
+
);
|
|
2085
|
+
}, [r, a]), u = _(() => e.execute(s), [e, s]);
|
|
2086
|
+
return F(
|
|
2087
|
+
() => ({
|
|
2088
|
+
...e,
|
|
2089
|
+
execute: u,
|
|
2090
|
+
setCondition: r.setCondition,
|
|
2091
|
+
setProjection: r.setProjection,
|
|
2092
|
+
setSort: r.setSort,
|
|
2093
|
+
setLimit: r.setLimit
|
|
2094
|
+
}),
|
|
2095
|
+
[
|
|
2096
|
+
e,
|
|
2097
|
+
u,
|
|
2098
|
+
r.setCondition,
|
|
2099
|
+
r.setProjection,
|
|
2100
|
+
r.setSort,
|
|
2101
|
+
r.setLimit
|
|
2102
|
+
]
|
|
2103
|
+
);
|
|
2104
|
+
}
|
|
2105
|
+
function Wr(t) {
|
|
2106
|
+
const e = ot(t), r = oe({ initialQuery: t.initialQuery }), a = J(t), s = _(async () => {
|
|
2107
|
+
const f = r.buildQuery();
|
|
2108
|
+
return a.current.listStream(
|
|
2109
|
+
f,
|
|
2110
|
+
a.current.attributes
|
|
2111
|
+
);
|
|
2112
|
+
}, [r, a]), u = _(() => e.execute(s), [e, s]);
|
|
2113
|
+
return F(
|
|
2114
|
+
() => ({
|
|
2115
|
+
...e,
|
|
2116
|
+
execute: u,
|
|
2117
|
+
setCondition: r.setCondition,
|
|
2118
|
+
setProjection: r.setProjection,
|
|
2119
|
+
setSort: r.setSort,
|
|
2120
|
+
setLimit: r.setLimit
|
|
164
2121
|
}),
|
|
165
|
-
[
|
|
2122
|
+
[
|
|
2123
|
+
e,
|
|
2124
|
+
u,
|
|
2125
|
+
r.setCondition,
|
|
2126
|
+
r.setProjection,
|
|
2127
|
+
r.setSort,
|
|
2128
|
+
r.setLimit
|
|
2129
|
+
]
|
|
166
2130
|
);
|
|
167
2131
|
}
|
|
168
2132
|
export {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
2133
|
+
He as PromiseStatus,
|
|
2134
|
+
Ur as useCountQuery,
|
|
2135
|
+
ot as useExecutePromise,
|
|
2136
|
+
Ar as useFetcher,
|
|
2137
|
+
Mr as useKeyStorage,
|
|
2138
|
+
J as useLatest,
|
|
2139
|
+
$r as useListQuery,
|
|
2140
|
+
Wr as useListStreamQuery,
|
|
2141
|
+
_t as useMounted,
|
|
2142
|
+
qr as usePagedQuery,
|
|
2143
|
+
Zt as usePromiseState,
|
|
2144
|
+
Kt as useRequestId,
|
|
2145
|
+
Hr as useSingleQuery
|
|
177
2146
|
};
|
|
178
2147
|
//# sourceMappingURL=index.es.js.map
|