eth-graph-query 2.0.15 → 2.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -90
- package/dist/index.cjs +1 -6
- package/dist/index.d.ts +324 -3
- package/dist/index.js +210 -1599
- package/package.json +28 -33
- package/dist/api-query.d.ts +0 -14
- package/dist/eth-graph-query.d.ts +0 -34
- package/dist/query-builder.d.ts +0 -51
- package/dist/type.d.ts +0 -66
package/dist/index.js
CHANGED
|
@@ -1,1478 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
12
|
-
})(/* @__PURE__ */ Object.create(null)), O = (e) => (e = e.toLowerCase(), (t) => M(t) === e), q = (e) => (t) => typeof t === e, { isArray: F } = Array, k = q("undefined");
|
|
13
|
-
function Je(e) {
|
|
14
|
-
return e !== null && !k(e) && e.constructor !== null && !k(e.constructor) && g(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
15
|
-
}
|
|
16
|
-
const Se = O("ArrayBuffer");
|
|
17
|
-
function ze(e) {
|
|
18
|
-
let t;
|
|
19
|
-
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Se(e.buffer), t;
|
|
20
|
-
}
|
|
21
|
-
const Ve = q("string"), g = q("function"), ge = q("number"), Q = (e) => e !== null && typeof e == "object", We = (e) => e === !0 || e === !1, L = (e) => {
|
|
22
|
-
if (M(e) !== "object")
|
|
23
|
-
return !1;
|
|
24
|
-
const t = te(e);
|
|
25
|
-
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
|
|
26
|
-
}, Ke = O("Date"), Ge = O("File"), Xe = O("Blob"), ve = O("FileList"), Ze = (e) => Q(e) && g(e.pipe), Ye = (e) => {
|
|
27
|
-
let t;
|
|
28
|
-
return e && (typeof FormData == "function" && e instanceof FormData || g(e.append) && ((t = M(e)) === "formdata" || // detect form-data instance
|
|
29
|
-
t === "object" && g(e.toString) && e.toString() === "[object FormData]"));
|
|
30
|
-
}, et = O("URLSearchParams"), tt = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
31
|
-
function C(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
32
|
-
if (e === null || typeof e > "u")
|
|
33
|
-
return;
|
|
34
|
-
let r, s;
|
|
35
|
-
if (typeof e != "object" && (e = [e]), F(e))
|
|
36
|
-
for (r = 0, s = e.length; r < s; r++)
|
|
37
|
-
t.call(null, e[r], r, e);
|
|
38
|
-
else {
|
|
39
|
-
const o = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = o.length;
|
|
40
|
-
let c;
|
|
41
|
-
for (r = 0; r < i; r++)
|
|
42
|
-
c = o[r], t.call(null, e[c], c, e);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function Re(e, t) {
|
|
46
|
-
t = t.toLowerCase();
|
|
47
|
-
const n = Object.keys(e);
|
|
48
|
-
let r = n.length, s;
|
|
49
|
-
for (; r-- > 0; )
|
|
50
|
-
if (s = n[r], t === s.toLowerCase())
|
|
51
|
-
return s;
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
const Oe = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Ae = (e) => !k(e) && e !== Oe;
|
|
55
|
-
function X() {
|
|
56
|
-
const { caseless: e } = Ae(this) && this || {}, t = {}, n = (r, s) => {
|
|
57
|
-
const o = e && Re(t, s) || s;
|
|
58
|
-
L(t[o]) && L(r) ? t[o] = X(t[o], r) : L(r) ? t[o] = X({}, r) : F(r) ? t[o] = r.slice() : t[o] = r;
|
|
59
|
-
};
|
|
60
|
-
for (let r = 0, s = arguments.length; r < s; r++)
|
|
61
|
-
arguments[r] && C(arguments[r], n);
|
|
62
|
-
return t;
|
|
63
|
-
}
|
|
64
|
-
const nt = (e, t, n, { allOwnKeys: r } = {}) => (C(t, (s, o) => {
|
|
65
|
-
n && g(s) ? e[o] = Ee(s, n) : e[o] = s;
|
|
66
|
-
}, { allOwnKeys: r }), e), rt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), st = (e, t, n, r) => {
|
|
67
|
-
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
68
|
-
value: t.prototype
|
|
69
|
-
}), n && Object.assign(e.prototype, n);
|
|
70
|
-
}, ot = (e, t, n, r) => {
|
|
71
|
-
let s, o, i;
|
|
72
|
-
const c = {};
|
|
73
|
-
if (t = t || {}, e == null)
|
|
74
|
-
return t;
|
|
75
|
-
do {
|
|
76
|
-
for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
|
|
77
|
-
i = s[o], (!r || r(i, e, t)) && !c[i] && (t[i] = e[i], c[i] = !0);
|
|
78
|
-
e = n !== !1 && te(e);
|
|
79
|
-
} while (e && (!n || n(e, t)) && e !== Object.prototype);
|
|
80
|
-
return t;
|
|
81
|
-
}, it = (e, t, n) => {
|
|
82
|
-
e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
|
|
83
|
-
const r = e.indexOf(t, n);
|
|
84
|
-
return r !== -1 && r === n;
|
|
85
|
-
}, at = (e) => {
|
|
86
|
-
if (!e)
|
|
87
|
-
return null;
|
|
88
|
-
if (F(e))
|
|
89
|
-
return e;
|
|
90
|
-
let t = e.length;
|
|
91
|
-
if (!ge(t))
|
|
92
|
-
return null;
|
|
93
|
-
const n = new Array(t);
|
|
94
|
-
for (; t-- > 0; )
|
|
95
|
-
n[t] = e[t];
|
|
96
|
-
return n;
|
|
97
|
-
}, ct = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && te(Uint8Array)), lt = (e, t) => {
|
|
98
|
-
const r = (e && e[Symbol.iterator]).call(e);
|
|
99
|
-
let s;
|
|
100
|
-
for (; (s = r.next()) && !s.done; ) {
|
|
101
|
-
const o = s.value;
|
|
102
|
-
t.call(e, o[0], o[1]);
|
|
103
|
-
}
|
|
104
|
-
}, ut = (e, t) => {
|
|
105
|
-
let n;
|
|
106
|
-
const r = [];
|
|
107
|
-
for (; (n = e.exec(t)) !== null; )
|
|
108
|
-
r.push(n);
|
|
109
|
-
return r;
|
|
110
|
-
}, ft = O("HTMLFormElement"), dt = (e) => e.toLowerCase().replace(
|
|
111
|
-
/[-_\s]([a-z\d])(\w*)/g,
|
|
112
|
-
function(n, r, s) {
|
|
113
|
-
return r.toUpperCase() + s;
|
|
114
|
-
}
|
|
115
|
-
), ae = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), ht = O("RegExp"), Te = (e, t) => {
|
|
116
|
-
const n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
117
|
-
C(n, (s, o) => {
|
|
118
|
-
let i;
|
|
119
|
-
(i = t(s, o, e)) !== !1 && (r[o] = i || s);
|
|
120
|
-
}), Object.defineProperties(e, r);
|
|
121
|
-
}, pt = (e) => {
|
|
122
|
-
Te(e, (t, n) => {
|
|
123
|
-
if (g(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
124
|
-
return !1;
|
|
125
|
-
const r = e[n];
|
|
126
|
-
if (g(r)) {
|
|
127
|
-
if (t.enumerable = !1, "writable" in t) {
|
|
128
|
-
t.writable = !1;
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
t.set || (t.set = () => {
|
|
132
|
-
throw Error("Can not rewrite read-only method '" + n + "'");
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}, mt = (e, t) => {
|
|
137
|
-
const n = {}, r = (s) => {
|
|
138
|
-
s.forEach((o) => {
|
|
139
|
-
n[o] = !0;
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
return F(e) ? r(e) : r(String(e).split(t)), n;
|
|
143
|
-
}, yt = () => {
|
|
144
|
-
}, bt = (e, t) => (e = +e, Number.isFinite(e) ? e : t), V = "abcdefghijklmnopqrstuvwxyz", ce = "0123456789", _e = {
|
|
145
|
-
DIGIT: ce,
|
|
146
|
-
ALPHA: V,
|
|
147
|
-
ALPHA_DIGIT: V + V.toUpperCase() + ce
|
|
148
|
-
}, wt = (e = 16, t = _e.ALPHA_DIGIT) => {
|
|
149
|
-
let n = "";
|
|
150
|
-
const { length: r } = t;
|
|
151
|
-
for (; e--; )
|
|
152
|
-
n += t[Math.random() * r | 0];
|
|
153
|
-
return n;
|
|
154
|
-
};
|
|
155
|
-
function Et(e) {
|
|
156
|
-
return !!(e && g(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
|
|
157
|
-
}
|
|
158
|
-
const St = (e) => {
|
|
159
|
-
const t = new Array(10), n = (r, s) => {
|
|
160
|
-
if (Q(r)) {
|
|
161
|
-
if (t.indexOf(r) >= 0)
|
|
162
|
-
return;
|
|
163
|
-
if (!("toJSON" in r)) {
|
|
164
|
-
t[s] = r;
|
|
165
|
-
const o = F(r) ? [] : {};
|
|
166
|
-
return C(r, (i, c) => {
|
|
167
|
-
const d = n(i, s + 1);
|
|
168
|
-
!k(d) && (o[c] = d);
|
|
169
|
-
}), t[s] = void 0, o;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return r;
|
|
173
|
-
};
|
|
174
|
-
return n(e, 0);
|
|
175
|
-
}, gt = O("AsyncFunction"), Rt = (e) => e && (Q(e) || g(e)) && g(e.then) && g(e.catch), a = {
|
|
176
|
-
isArray: F,
|
|
177
|
-
isArrayBuffer: Se,
|
|
178
|
-
isBuffer: Je,
|
|
179
|
-
isFormData: Ye,
|
|
180
|
-
isArrayBufferView: ze,
|
|
181
|
-
isString: Ve,
|
|
182
|
-
isNumber: ge,
|
|
183
|
-
isBoolean: We,
|
|
184
|
-
isObject: Q,
|
|
185
|
-
isPlainObject: L,
|
|
186
|
-
isUndefined: k,
|
|
187
|
-
isDate: Ke,
|
|
188
|
-
isFile: Ge,
|
|
189
|
-
isBlob: Xe,
|
|
190
|
-
isRegExp: ht,
|
|
191
|
-
isFunction: g,
|
|
192
|
-
isStream: Ze,
|
|
193
|
-
isURLSearchParams: et,
|
|
194
|
-
isTypedArray: ct,
|
|
195
|
-
isFileList: ve,
|
|
196
|
-
forEach: C,
|
|
197
|
-
merge: X,
|
|
198
|
-
extend: nt,
|
|
199
|
-
trim: tt,
|
|
200
|
-
stripBOM: rt,
|
|
201
|
-
inherits: st,
|
|
202
|
-
toFlatObject: ot,
|
|
203
|
-
kindOf: M,
|
|
204
|
-
kindOfTest: O,
|
|
205
|
-
endsWith: it,
|
|
206
|
-
toArray: at,
|
|
207
|
-
forEachEntry: lt,
|
|
208
|
-
matchAll: ut,
|
|
209
|
-
isHTMLForm: ft,
|
|
210
|
-
hasOwnProperty: ae,
|
|
211
|
-
hasOwnProp: ae,
|
|
212
|
-
// an alias to avoid ESLint no-prototype-builtins detection
|
|
213
|
-
reduceDescriptors: Te,
|
|
214
|
-
freezeMethods: pt,
|
|
215
|
-
toObjectSet: mt,
|
|
216
|
-
toCamelCase: dt,
|
|
217
|
-
noop: yt,
|
|
218
|
-
toFiniteNumber: bt,
|
|
219
|
-
findKey: Re,
|
|
220
|
-
global: Oe,
|
|
221
|
-
isContextDefined: Ae,
|
|
222
|
-
ALPHABET: _e,
|
|
223
|
-
generateString: wt,
|
|
224
|
-
isSpecCompliantForm: Et,
|
|
225
|
-
toJSONObject: St,
|
|
226
|
-
isAsyncFn: gt,
|
|
227
|
-
isThenable: Rt
|
|
228
|
-
};
|
|
229
|
-
function m(e, t, n, r, s) {
|
|
230
|
-
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), s && (this.response = s);
|
|
231
|
-
}
|
|
232
|
-
a.inherits(m, Error, {
|
|
233
|
-
toJSON: function() {
|
|
234
|
-
return {
|
|
235
|
-
// Standard
|
|
236
|
-
message: this.message,
|
|
237
|
-
name: this.name,
|
|
238
|
-
// Microsoft
|
|
239
|
-
description: this.description,
|
|
240
|
-
number: this.number,
|
|
241
|
-
// Mozilla
|
|
242
|
-
fileName: this.fileName,
|
|
243
|
-
lineNumber: this.lineNumber,
|
|
244
|
-
columnNumber: this.columnNumber,
|
|
245
|
-
stack: this.stack,
|
|
246
|
-
// Axios
|
|
247
|
-
config: a.toJSONObject(this.config),
|
|
248
|
-
code: this.code,
|
|
249
|
-
status: this.response && this.response.status ? this.response.status : null
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
const Ne = m.prototype, xe = {};
|
|
254
|
-
[
|
|
255
|
-
"ERR_BAD_OPTION_VALUE",
|
|
256
|
-
"ERR_BAD_OPTION",
|
|
257
|
-
"ECONNABORTED",
|
|
258
|
-
"ETIMEDOUT",
|
|
259
|
-
"ERR_NETWORK",
|
|
260
|
-
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
261
|
-
"ERR_DEPRECATED",
|
|
262
|
-
"ERR_BAD_RESPONSE",
|
|
263
|
-
"ERR_BAD_REQUEST",
|
|
264
|
-
"ERR_CANCELED",
|
|
265
|
-
"ERR_NOT_SUPPORT",
|
|
266
|
-
"ERR_INVALID_URL"
|
|
267
|
-
// eslint-disable-next-line func-names
|
|
268
|
-
].forEach((e) => {
|
|
269
|
-
xe[e] = { value: e };
|
|
270
|
-
});
|
|
271
|
-
Object.defineProperties(m, xe);
|
|
272
|
-
Object.defineProperty(Ne, "isAxiosError", { value: !0 });
|
|
273
|
-
m.from = (e, t, n, r, s, o) => {
|
|
274
|
-
const i = Object.create(Ne);
|
|
275
|
-
return a.toFlatObject(e, i, function(d) {
|
|
276
|
-
return d !== Error.prototype;
|
|
277
|
-
}, (c) => c !== "isAxiosError"), m.call(i, e.message, t, n, r, s), i.cause = e, i.name = e.name, o && Object.assign(i, o), i;
|
|
278
|
-
};
|
|
279
|
-
const Ot = null;
|
|
280
|
-
function v(e) {
|
|
281
|
-
return a.isPlainObject(e) || a.isArray(e);
|
|
282
|
-
}
|
|
283
|
-
function Fe(e) {
|
|
284
|
-
return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
285
|
-
}
|
|
286
|
-
function le(e, t, n) {
|
|
287
|
-
return e ? e.concat(t).map(function(s, o) {
|
|
288
|
-
return s = Fe(s), !n && o ? "[" + s + "]" : s;
|
|
289
|
-
}).join(n ? "." : "") : t;
|
|
290
|
-
}
|
|
291
|
-
function At(e) {
|
|
292
|
-
return a.isArray(e) && !e.some(v);
|
|
293
|
-
}
|
|
294
|
-
const Tt = a.toFlatObject(a, {}, null, function(t) {
|
|
295
|
-
return /^is[A-Z]/.test(t);
|
|
296
|
-
});
|
|
297
|
-
function J(e, t, n) {
|
|
298
|
-
if (!a.isObject(e))
|
|
299
|
-
throw new TypeError("target must be an object");
|
|
300
|
-
t = t || new FormData(), n = a.toFlatObject(n, {
|
|
301
|
-
metaTokens: !0,
|
|
302
|
-
dots: !1,
|
|
303
|
-
indexes: !1
|
|
304
|
-
}, !1, function(p, w) {
|
|
305
|
-
return !a.isUndefined(w[p]);
|
|
306
|
-
});
|
|
307
|
-
const r = n.metaTokens, s = n.visitor || u, o = n.dots, i = n.indexes, d = (n.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(t);
|
|
308
|
-
if (!a.isFunction(s))
|
|
309
|
-
throw new TypeError("visitor must be a function");
|
|
310
|
-
function f(h) {
|
|
311
|
-
if (h === null)
|
|
312
|
-
return "";
|
|
313
|
-
if (a.isDate(h))
|
|
314
|
-
return h.toISOString();
|
|
315
|
-
if (!d && a.isBlob(h))
|
|
316
|
-
throw new m("Blob is not supported. Use a Buffer instead.");
|
|
317
|
-
return a.isArrayBuffer(h) || a.isTypedArray(h) ? d && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
|
|
318
|
-
}
|
|
319
|
-
function u(h, p, w) {
|
|
320
|
-
let E = h;
|
|
321
|
-
if (h && !w && typeof h == "object") {
|
|
322
|
-
if (a.endsWith(p, "{}"))
|
|
323
|
-
p = r ? p : p.slice(0, -2), h = JSON.stringify(h);
|
|
324
|
-
else if (a.isArray(h) && At(h) || (a.isFileList(h) || a.endsWith(p, "[]")) && (E = a.toArray(h)))
|
|
325
|
-
return p = Fe(p), E.forEach(function(_, Ie) {
|
|
326
|
-
!(a.isUndefined(_) || _ === null) && t.append(
|
|
327
|
-
// eslint-disable-next-line no-nested-ternary
|
|
328
|
-
i === !0 ? le([p], Ie, o) : i === null ? p : p + "[]",
|
|
329
|
-
f(_)
|
|
330
|
-
);
|
|
331
|
-
}), !1;
|
|
332
|
-
}
|
|
333
|
-
return v(h) ? !0 : (t.append(le(w, p, o), f(h)), !1);
|
|
334
|
-
}
|
|
335
|
-
const l = [], b = Object.assign(Tt, {
|
|
336
|
-
defaultVisitor: u,
|
|
337
|
-
convertValue: f,
|
|
338
|
-
isVisitable: v
|
|
339
|
-
});
|
|
340
|
-
function S(h, p) {
|
|
341
|
-
if (!a.isUndefined(h)) {
|
|
342
|
-
if (l.indexOf(h) !== -1)
|
|
343
|
-
throw Error("Circular reference detected in " + p.join("."));
|
|
344
|
-
l.push(h), a.forEach(h, function(E, T) {
|
|
345
|
-
(!(a.isUndefined(E) || E === null) && s.call(
|
|
346
|
-
t,
|
|
347
|
-
E,
|
|
348
|
-
a.isString(T) ? T.trim() : T,
|
|
349
|
-
p,
|
|
350
|
-
b
|
|
351
|
-
)) === !0 && S(E, p ? p.concat(T) : [T]);
|
|
352
|
-
}), l.pop();
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
if (!a.isObject(e))
|
|
356
|
-
throw new TypeError("data must be an object");
|
|
357
|
-
return S(e), t;
|
|
358
|
-
}
|
|
359
|
-
function ue(e) {
|
|
360
|
-
const t = {
|
|
361
|
-
"!": "%21",
|
|
362
|
-
"'": "%27",
|
|
363
|
-
"(": "%28",
|
|
364
|
-
")": "%29",
|
|
365
|
-
"~": "%7E",
|
|
366
|
-
"%20": "+",
|
|
367
|
-
"%00": "\0"
|
|
368
|
-
};
|
|
369
|
-
return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
370
|
-
return t[r];
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
function ne(e, t) {
|
|
374
|
-
this._pairs = [], e && J(e, this, t);
|
|
375
|
-
}
|
|
376
|
-
const Pe = ne.prototype;
|
|
377
|
-
Pe.append = function(t, n) {
|
|
378
|
-
this._pairs.push([t, n]);
|
|
379
|
-
};
|
|
380
|
-
Pe.toString = function(t) {
|
|
381
|
-
const n = t ? function(r) {
|
|
382
|
-
return t.call(this, r, ue);
|
|
383
|
-
} : ue;
|
|
384
|
-
return this._pairs.map(function(s) {
|
|
385
|
-
return n(s[0]) + "=" + n(s[1]);
|
|
386
|
-
}, "").join("&");
|
|
387
|
-
};
|
|
388
|
-
function _t(e) {
|
|
389
|
-
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
390
|
-
}
|
|
391
|
-
function ke(e, t, n) {
|
|
392
|
-
if (!t)
|
|
393
|
-
return e;
|
|
394
|
-
const r = n && n.encode || _t, s = n && n.serialize;
|
|
395
|
-
let o;
|
|
396
|
-
if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new ne(t, n).toString(r), o) {
|
|
397
|
-
const i = e.indexOf("#");
|
|
398
|
-
i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
|
|
399
|
-
}
|
|
400
|
-
return e;
|
|
401
|
-
}
|
|
402
|
-
class fe {
|
|
403
|
-
constructor() {
|
|
404
|
-
this.handlers = [];
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* Add a new interceptor to the stack
|
|
408
|
-
*
|
|
409
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
410
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
411
|
-
*
|
|
412
|
-
* @return {Number} An ID used to remove interceptor later
|
|
413
|
-
*/
|
|
414
|
-
use(t, n, r) {
|
|
415
|
-
return this.handlers.push({
|
|
416
|
-
fulfilled: t,
|
|
417
|
-
rejected: n,
|
|
418
|
-
synchronous: r ? r.synchronous : !1,
|
|
419
|
-
runWhen: r ? r.runWhen : null
|
|
420
|
-
}), this.handlers.length - 1;
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Remove an interceptor from the stack
|
|
424
|
-
*
|
|
425
|
-
* @param {Number} id The ID that was returned by `use`
|
|
426
|
-
*
|
|
427
|
-
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
428
|
-
*/
|
|
429
|
-
eject(t) {
|
|
430
|
-
this.handlers[t] && (this.handlers[t] = null);
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Clear all interceptors from the stack
|
|
434
|
-
*
|
|
435
|
-
* @returns {void}
|
|
436
|
-
*/
|
|
437
|
-
clear() {
|
|
438
|
-
this.handlers && (this.handlers = []);
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Iterate over all the registered interceptors
|
|
442
|
-
*
|
|
443
|
-
* This method is particularly useful for skipping over any
|
|
444
|
-
* interceptors that may have become `null` calling `eject`.
|
|
445
|
-
*
|
|
446
|
-
* @param {Function} fn The function to call for each interceptor
|
|
447
|
-
*
|
|
448
|
-
* @returns {void}
|
|
449
|
-
*/
|
|
450
|
-
forEach(t) {
|
|
451
|
-
a.forEach(this.handlers, function(r) {
|
|
452
|
-
r !== null && t(r);
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
const Ce = {
|
|
457
|
-
silentJSONParsing: !0,
|
|
458
|
-
forcedJSONParsing: !0,
|
|
459
|
-
clarifyTimeoutError: !1
|
|
460
|
-
}, Nt = typeof URLSearchParams < "u" ? URLSearchParams : ne, xt = typeof FormData < "u" ? FormData : null, Ft = typeof Blob < "u" ? Blob : null, Pt = {
|
|
461
|
-
isBrowser: !0,
|
|
462
|
-
classes: {
|
|
463
|
-
URLSearchParams: Nt,
|
|
464
|
-
FormData: xt,
|
|
465
|
-
Blob: Ft
|
|
466
|
-
},
|
|
467
|
-
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
468
|
-
}, Be = typeof window < "u" && typeof document < "u", kt = ((e) => Be && ["ReactNative", "NativeScript", "NS"].indexOf(e) < 0)(typeof navigator < "u" && navigator.product), Ct = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
469
|
-
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
470
|
-
__proto__: null,
|
|
471
|
-
hasBrowserEnv: Be,
|
|
472
|
-
hasStandardBrowserEnv: kt,
|
|
473
|
-
hasStandardBrowserWebWorkerEnv: Ct
|
|
474
|
-
}, Symbol.toStringTag, { value: "Module" })), R = {
|
|
475
|
-
...Bt,
|
|
476
|
-
...Pt
|
|
477
|
-
};
|
|
478
|
-
function jt(e, t) {
|
|
479
|
-
return J(e, new R.classes.URLSearchParams(), Object.assign({
|
|
480
|
-
visitor: function(n, r, s, o) {
|
|
481
|
-
return R.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
|
|
482
|
-
}
|
|
483
|
-
}, t));
|
|
484
|
-
}
|
|
485
|
-
function Dt(e) {
|
|
486
|
-
return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
|
|
487
|
-
}
|
|
488
|
-
function $t(e) {
|
|
489
|
-
const t = {}, n = Object.keys(e);
|
|
490
|
-
let r;
|
|
491
|
-
const s = n.length;
|
|
492
|
-
let o;
|
|
493
|
-
for (r = 0; r < s; r++)
|
|
494
|
-
o = n[r], t[o] = e[o];
|
|
495
|
-
return t;
|
|
496
|
-
}
|
|
497
|
-
function je(e) {
|
|
498
|
-
function t(n, r, s, o) {
|
|
499
|
-
let i = n[o++];
|
|
500
|
-
if (i === "__proto__")
|
|
501
|
-
return !0;
|
|
502
|
-
const c = Number.isFinite(+i), d = o >= n.length;
|
|
503
|
-
return i = !i && a.isArray(s) ? s.length : i, d ? (a.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !c) : ((!s[i] || !a.isObject(s[i])) && (s[i] = []), t(n, r, s[i], o) && a.isArray(s[i]) && (s[i] = $t(s[i])), !c);
|
|
504
|
-
}
|
|
505
|
-
if (a.isFormData(e) && a.isFunction(e.entries)) {
|
|
506
|
-
const n = {};
|
|
507
|
-
return a.forEachEntry(e, (r, s) => {
|
|
508
|
-
t(Dt(r), s, n, 0);
|
|
509
|
-
}), n;
|
|
510
|
-
}
|
|
511
|
-
return null;
|
|
512
|
-
}
|
|
513
|
-
function Lt(e, t, n) {
|
|
514
|
-
if (a.isString(e))
|
|
515
|
-
try {
|
|
516
|
-
return (t || JSON.parse)(e), a.trim(e);
|
|
517
|
-
} catch (r) {
|
|
518
|
-
if (r.name !== "SyntaxError")
|
|
519
|
-
throw r;
|
|
520
|
-
}
|
|
521
|
-
return (n || JSON.stringify)(e);
|
|
522
|
-
}
|
|
523
|
-
const re = {
|
|
524
|
-
transitional: Ce,
|
|
525
|
-
adapter: ["xhr", "http"],
|
|
526
|
-
transformRequest: [function(t, n) {
|
|
527
|
-
const r = n.getContentType() || "", s = r.indexOf("application/json") > -1, o = a.isObject(t);
|
|
528
|
-
if (o && a.isHTMLForm(t) && (t = new FormData(t)), a.isFormData(t))
|
|
529
|
-
return s ? JSON.stringify(je(t)) : t;
|
|
530
|
-
if (a.isArrayBuffer(t) || a.isBuffer(t) || a.isStream(t) || a.isFile(t) || a.isBlob(t))
|
|
531
|
-
return t;
|
|
532
|
-
if (a.isArrayBufferView(t))
|
|
533
|
-
return t.buffer;
|
|
534
|
-
if (a.isURLSearchParams(t))
|
|
535
|
-
return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
|
|
536
|
-
let c;
|
|
537
|
-
if (o) {
|
|
538
|
-
if (r.indexOf("application/x-www-form-urlencoded") > -1)
|
|
539
|
-
return jt(t, this.formSerializer).toString();
|
|
540
|
-
if ((c = a.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
|
|
541
|
-
const d = this.env && this.env.FormData;
|
|
542
|
-
return J(
|
|
543
|
-
c ? { "files[]": t } : t,
|
|
544
|
-
d && new d(),
|
|
545
|
-
this.formSerializer
|
|
546
|
-
);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
return o || s ? (n.setContentType("application/json", !1), Lt(t)) : t;
|
|
550
|
-
}],
|
|
551
|
-
transformResponse: [function(t) {
|
|
552
|
-
const n = this.transitional || re.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
|
|
553
|
-
if (t && a.isString(t) && (r && !this.responseType || s)) {
|
|
554
|
-
const i = !(n && n.silentJSONParsing) && s;
|
|
555
|
-
try {
|
|
556
|
-
return JSON.parse(t);
|
|
557
|
-
} catch (c) {
|
|
558
|
-
if (i)
|
|
559
|
-
throw c.name === "SyntaxError" ? m.from(c, m.ERR_BAD_RESPONSE, this, null, this.response) : c;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
return t;
|
|
563
|
-
}],
|
|
1
|
+
import y from "axios";
|
|
2
|
+
const p = { Accept: "application/json", "Content-Type": "application/json" };
|
|
3
|
+
function f(a) {
|
|
4
|
+
return a.data;
|
|
5
|
+
}
|
|
6
|
+
class d {
|
|
7
|
+
/** The root URL for all API requests. */
|
|
8
|
+
root;
|
|
9
|
+
/** Axios configuration used for all requests. */
|
|
10
|
+
config;
|
|
564
11
|
/**
|
|
565
|
-
*
|
|
566
|
-
*
|
|
12
|
+
* Initializes a new instance of the ApiQuery class.
|
|
13
|
+
* @param rootUrl - The base URL for the API.
|
|
14
|
+
* @param config - Optional axios configuration.
|
|
567
15
|
*/
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
FormData: R.classes.FormData,
|
|
575
|
-
Blob: R.classes.Blob
|
|
576
|
-
},
|
|
577
|
-
validateStatus: function(t) {
|
|
578
|
-
return t >= 200 && t < 300;
|
|
579
|
-
},
|
|
580
|
-
headers: {
|
|
581
|
-
common: {
|
|
582
|
-
Accept: "application/json, text/plain, */*",
|
|
583
|
-
"Content-Type": void 0
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
};
|
|
587
|
-
a.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
|
|
588
|
-
re.headers[e] = {};
|
|
589
|
-
});
|
|
590
|
-
const se = re, Ut = a.toObjectSet([
|
|
591
|
-
"age",
|
|
592
|
-
"authorization",
|
|
593
|
-
"content-length",
|
|
594
|
-
"content-type",
|
|
595
|
-
"etag",
|
|
596
|
-
"expires",
|
|
597
|
-
"from",
|
|
598
|
-
"host",
|
|
599
|
-
"if-modified-since",
|
|
600
|
-
"if-unmodified-since",
|
|
601
|
-
"last-modified",
|
|
602
|
-
"location",
|
|
603
|
-
"max-forwards",
|
|
604
|
-
"proxy-authorization",
|
|
605
|
-
"referer",
|
|
606
|
-
"retry-after",
|
|
607
|
-
"user-agent"
|
|
608
|
-
]), Ht = (e) => {
|
|
609
|
-
const t = {};
|
|
610
|
-
let n, r, s;
|
|
611
|
-
return e && e.split(`
|
|
612
|
-
`).forEach(function(i) {
|
|
613
|
-
s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && Ut[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
|
|
614
|
-
}), t;
|
|
615
|
-
}, de = Symbol("internals");
|
|
616
|
-
function P(e) {
|
|
617
|
-
return e && String(e).trim().toLowerCase();
|
|
618
|
-
}
|
|
619
|
-
function U(e) {
|
|
620
|
-
return e === !1 || e == null ? e : a.isArray(e) ? e.map(U) : String(e);
|
|
621
|
-
}
|
|
622
|
-
function It(e) {
|
|
623
|
-
const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
624
|
-
let r;
|
|
625
|
-
for (; r = n.exec(e); )
|
|
626
|
-
t[r[1]] = r[2];
|
|
627
|
-
return t;
|
|
628
|
-
}
|
|
629
|
-
const Mt = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
|
630
|
-
function W(e, t, n, r, s) {
|
|
631
|
-
if (a.isFunction(r))
|
|
632
|
-
return r.call(this, t, n);
|
|
633
|
-
if (s && (t = n), !!a.isString(t)) {
|
|
634
|
-
if (a.isString(r))
|
|
635
|
-
return t.indexOf(r) !== -1;
|
|
636
|
-
if (a.isRegExp(r))
|
|
637
|
-
return r.test(t);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
function qt(e) {
|
|
641
|
-
return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
|
|
642
|
-
}
|
|
643
|
-
function Qt(e, t) {
|
|
644
|
-
const n = a.toCamelCase(" " + t);
|
|
645
|
-
["get", "set", "has"].forEach((r) => {
|
|
646
|
-
Object.defineProperty(e, r + n, {
|
|
647
|
-
value: function(s, o, i) {
|
|
648
|
-
return this[r].call(this, t, s, o, i);
|
|
649
|
-
},
|
|
650
|
-
configurable: !0
|
|
651
|
-
});
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
class z {
|
|
655
|
-
constructor(t) {
|
|
656
|
-
t && this.set(t);
|
|
657
|
-
}
|
|
658
|
-
set(t, n, r) {
|
|
659
|
-
const s = this;
|
|
660
|
-
function o(c, d, f) {
|
|
661
|
-
const u = P(d);
|
|
662
|
-
if (!u)
|
|
663
|
-
throw new Error("header name must be a non-empty string");
|
|
664
|
-
const l = a.findKey(s, u);
|
|
665
|
-
(!l || s[l] === void 0 || f === !0 || f === void 0 && s[l] !== !1) && (s[l || d] = U(c));
|
|
666
|
-
}
|
|
667
|
-
const i = (c, d) => a.forEach(c, (f, u) => o(f, u, d));
|
|
668
|
-
return a.isPlainObject(t) || t instanceof this.constructor ? i(t, n) : a.isString(t) && (t = t.trim()) && !Mt(t) ? i(Ht(t), n) : t != null && o(n, t, r), this;
|
|
669
|
-
}
|
|
670
|
-
get(t, n) {
|
|
671
|
-
if (t = P(t), t) {
|
|
672
|
-
const r = a.findKey(this, t);
|
|
673
|
-
if (r) {
|
|
674
|
-
const s = this[r];
|
|
675
|
-
if (!n)
|
|
676
|
-
return s;
|
|
677
|
-
if (n === !0)
|
|
678
|
-
return It(s);
|
|
679
|
-
if (a.isFunction(n))
|
|
680
|
-
return n.call(this, s, r);
|
|
681
|
-
if (a.isRegExp(n))
|
|
682
|
-
return n.exec(s);
|
|
683
|
-
throw new TypeError("parser must be boolean|regexp|function");
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
has(t, n) {
|
|
688
|
-
if (t = P(t), t) {
|
|
689
|
-
const r = a.findKey(this, t);
|
|
690
|
-
return !!(r && this[r] !== void 0 && (!n || W(this, this[r], r, n)));
|
|
691
|
-
}
|
|
692
|
-
return !1;
|
|
693
|
-
}
|
|
694
|
-
delete(t, n) {
|
|
695
|
-
const r = this;
|
|
696
|
-
let s = !1;
|
|
697
|
-
function o(i) {
|
|
698
|
-
if (i = P(i), i) {
|
|
699
|
-
const c = a.findKey(r, i);
|
|
700
|
-
c && (!n || W(r, r[c], c, n)) && (delete r[c], s = !0);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
return a.isArray(t) ? t.forEach(o) : o(t), s;
|
|
704
|
-
}
|
|
705
|
-
clear(t) {
|
|
706
|
-
const n = Object.keys(this);
|
|
707
|
-
let r = n.length, s = !1;
|
|
708
|
-
for (; r--; ) {
|
|
709
|
-
const o = n[r];
|
|
710
|
-
(!t || W(this, this[o], o, t, !0)) && (delete this[o], s = !0);
|
|
711
|
-
}
|
|
712
|
-
return s;
|
|
713
|
-
}
|
|
714
|
-
normalize(t) {
|
|
715
|
-
const n = this, r = {};
|
|
716
|
-
return a.forEach(this, (s, o) => {
|
|
717
|
-
const i = a.findKey(r, o);
|
|
718
|
-
if (i) {
|
|
719
|
-
n[i] = U(s), delete n[o];
|
|
720
|
-
return;
|
|
16
|
+
constructor(t, e = {}) {
|
|
17
|
+
this.root = t, this.config = {
|
|
18
|
+
...e,
|
|
19
|
+
headers: {
|
|
20
|
+
...p,
|
|
21
|
+
...e.headers || {}
|
|
721
22
|
}
|
|
722
|
-
const c = t ? qt(o) : String(o).trim();
|
|
723
|
-
c !== o && delete n[o], n[c] = U(s), r[c] = !0;
|
|
724
|
-
}), this;
|
|
725
|
-
}
|
|
726
|
-
concat(...t) {
|
|
727
|
-
return this.constructor.concat(this, ...t);
|
|
728
|
-
}
|
|
729
|
-
toJSON(t) {
|
|
730
|
-
const n = /* @__PURE__ */ Object.create(null);
|
|
731
|
-
return a.forEach(this, (r, s) => {
|
|
732
|
-
r != null && r !== !1 && (n[s] = t && a.isArray(r) ? r.join(", ") : r);
|
|
733
|
-
}), n;
|
|
734
|
-
}
|
|
735
|
-
[Symbol.iterator]() {
|
|
736
|
-
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
737
|
-
}
|
|
738
|
-
toString() {
|
|
739
|
-
return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
|
|
740
|
-
`);
|
|
741
|
-
}
|
|
742
|
-
get [Symbol.toStringTag]() {
|
|
743
|
-
return "AxiosHeaders";
|
|
744
|
-
}
|
|
745
|
-
static from(t) {
|
|
746
|
-
return t instanceof this ? t : new this(t);
|
|
747
|
-
}
|
|
748
|
-
static concat(t, ...n) {
|
|
749
|
-
const r = new this(t);
|
|
750
|
-
return n.forEach((s) => r.set(s)), r;
|
|
751
|
-
}
|
|
752
|
-
static accessor(t) {
|
|
753
|
-
const r = (this[de] = this[de] = {
|
|
754
|
-
accessors: {}
|
|
755
|
-
}).accessors, s = this.prototype;
|
|
756
|
-
function o(i) {
|
|
757
|
-
const c = P(i);
|
|
758
|
-
r[c] || (Qt(s, i), r[c] = !0);
|
|
759
|
-
}
|
|
760
|
-
return a.isArray(t) ? t.forEach(o) : o(t), this;
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
z.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
764
|
-
a.reduceDescriptors(z.prototype, ({ value: e }, t) => {
|
|
765
|
-
let n = t[0].toUpperCase() + t.slice(1);
|
|
766
|
-
return {
|
|
767
|
-
get: () => e,
|
|
768
|
-
set(r) {
|
|
769
|
-
this[n] = r;
|
|
770
|
-
}
|
|
771
|
-
};
|
|
772
|
-
});
|
|
773
|
-
a.freezeMethods(z);
|
|
774
|
-
const A = z;
|
|
775
|
-
function K(e, t) {
|
|
776
|
-
const n = this || se, r = t || n, s = A.from(r.headers);
|
|
777
|
-
let o = r.data;
|
|
778
|
-
return a.forEach(e, function(c) {
|
|
779
|
-
o = c.call(n, o, s.normalize(), t ? t.status : void 0);
|
|
780
|
-
}), s.normalize(), o;
|
|
781
|
-
}
|
|
782
|
-
function De(e) {
|
|
783
|
-
return !!(e && e.__CANCEL__);
|
|
784
|
-
}
|
|
785
|
-
function B(e, t, n) {
|
|
786
|
-
m.call(this, e ?? "canceled", m.ERR_CANCELED, t, n), this.name = "CanceledError";
|
|
787
|
-
}
|
|
788
|
-
a.inherits(B, m, {
|
|
789
|
-
__CANCEL__: !0
|
|
790
|
-
});
|
|
791
|
-
function Jt(e, t, n) {
|
|
792
|
-
const r = n.config.validateStatus;
|
|
793
|
-
!n.status || !r || r(n.status) ? e(n) : t(new m(
|
|
794
|
-
"Request failed with status code " + n.status,
|
|
795
|
-
[m.ERR_BAD_REQUEST, m.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
|
|
796
|
-
n.config,
|
|
797
|
-
n.request,
|
|
798
|
-
n
|
|
799
|
-
));
|
|
800
|
-
}
|
|
801
|
-
const zt = R.hasStandardBrowserEnv ? (
|
|
802
|
-
// Standard browser envs support document.cookie
|
|
803
|
-
{
|
|
804
|
-
write(e, t, n, r, s, o) {
|
|
805
|
-
const i = [e + "=" + encodeURIComponent(t)];
|
|
806
|
-
a.isNumber(n) && i.push("expires=" + new Date(n).toGMTString()), a.isString(r) && i.push("path=" + r), a.isString(s) && i.push("domain=" + s), o === !0 && i.push("secure"), document.cookie = i.join("; ");
|
|
807
|
-
},
|
|
808
|
-
read(e) {
|
|
809
|
-
const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
|
|
810
|
-
return t ? decodeURIComponent(t[3]) : null;
|
|
811
|
-
},
|
|
812
|
-
remove(e) {
|
|
813
|
-
this.write(e, "", Date.now() - 864e5);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
) : (
|
|
817
|
-
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
818
|
-
{
|
|
819
|
-
write() {
|
|
820
|
-
},
|
|
821
|
-
read() {
|
|
822
|
-
return null;
|
|
823
|
-
},
|
|
824
|
-
remove() {
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
);
|
|
828
|
-
function Vt(e) {
|
|
829
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
|
|
830
|
-
}
|
|
831
|
-
function Wt(e, t) {
|
|
832
|
-
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
833
|
-
}
|
|
834
|
-
function $e(e, t) {
|
|
835
|
-
return e && !Vt(t) ? Wt(e, t) : t;
|
|
836
|
-
}
|
|
837
|
-
const Kt = R.hasStandardBrowserEnv ? (
|
|
838
|
-
// Standard browser envs have full support of the APIs needed to test
|
|
839
|
-
// whether the request URL is of the same origin as current location.
|
|
840
|
-
function() {
|
|
841
|
-
const t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a");
|
|
842
|
-
let r;
|
|
843
|
-
function s(o) {
|
|
844
|
-
let i = o;
|
|
845
|
-
return t && (n.setAttribute("href", i), i = n.href), n.setAttribute("href", i), {
|
|
846
|
-
href: n.href,
|
|
847
|
-
protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
|
|
848
|
-
host: n.host,
|
|
849
|
-
search: n.search ? n.search.replace(/^\?/, "") : "",
|
|
850
|
-
hash: n.hash ? n.hash.replace(/^#/, "") : "",
|
|
851
|
-
hostname: n.hostname,
|
|
852
|
-
port: n.port,
|
|
853
|
-
pathname: n.pathname.charAt(0) === "/" ? n.pathname : "/" + n.pathname
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
return r = s(window.location.href), function(i) {
|
|
857
|
-
const c = a.isString(i) ? s(i) : i;
|
|
858
|
-
return c.protocol === r.protocol && c.host === r.host;
|
|
859
|
-
};
|
|
860
|
-
}()
|
|
861
|
-
) : (
|
|
862
|
-
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
863
|
-
/* @__PURE__ */ function() {
|
|
864
|
-
return function() {
|
|
865
|
-
return !0;
|
|
866
|
-
};
|
|
867
|
-
}()
|
|
868
|
-
);
|
|
869
|
-
function Gt(e) {
|
|
870
|
-
const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
|
|
871
|
-
return t && t[1] || "";
|
|
872
|
-
}
|
|
873
|
-
function Xt(e, t) {
|
|
874
|
-
e = e || 10;
|
|
875
|
-
const n = new Array(e), r = new Array(e);
|
|
876
|
-
let s = 0, o = 0, i;
|
|
877
|
-
return t = t !== void 0 ? t : 1e3, function(d) {
|
|
878
|
-
const f = Date.now(), u = r[o];
|
|
879
|
-
i || (i = f), n[s] = d, r[s] = f;
|
|
880
|
-
let l = o, b = 0;
|
|
881
|
-
for (; l !== s; )
|
|
882
|
-
b += n[l++], l = l % e;
|
|
883
|
-
if (s = (s + 1) % e, s === o && (o = (o + 1) % e), f - i < t)
|
|
884
|
-
return;
|
|
885
|
-
const S = u && f - u;
|
|
886
|
-
return S ? Math.round(b * 1e3 / S) : void 0;
|
|
887
|
-
};
|
|
888
|
-
}
|
|
889
|
-
function he(e, t) {
|
|
890
|
-
let n = 0;
|
|
891
|
-
const r = Xt(50, 250);
|
|
892
|
-
return (s) => {
|
|
893
|
-
const o = s.loaded, i = s.lengthComputable ? s.total : void 0, c = o - n, d = r(c), f = o <= i;
|
|
894
|
-
n = o;
|
|
895
|
-
const u = {
|
|
896
|
-
loaded: o,
|
|
897
|
-
total: i,
|
|
898
|
-
progress: i ? o / i : void 0,
|
|
899
|
-
bytes: c,
|
|
900
|
-
rate: d || void 0,
|
|
901
|
-
estimated: d && i && f ? (i - o) / d : void 0,
|
|
902
|
-
event: s
|
|
903
|
-
};
|
|
904
|
-
u[t ? "download" : "upload"] = !0, e(u);
|
|
905
|
-
};
|
|
906
|
-
}
|
|
907
|
-
const vt = typeof XMLHttpRequest < "u", Zt = vt && function(e) {
|
|
908
|
-
return new Promise(function(n, r) {
|
|
909
|
-
let s = e.data;
|
|
910
|
-
const o = A.from(e.headers).normalize();
|
|
911
|
-
let { responseType: i, withXSRFToken: c } = e, d;
|
|
912
|
-
function f() {
|
|
913
|
-
e.cancelToken && e.cancelToken.unsubscribe(d), e.signal && e.signal.removeEventListener("abort", d);
|
|
914
|
-
}
|
|
915
|
-
let u;
|
|
916
|
-
if (a.isFormData(s)) {
|
|
917
|
-
if (R.hasStandardBrowserEnv || R.hasStandardBrowserWebWorkerEnv)
|
|
918
|
-
o.setContentType(!1);
|
|
919
|
-
else if ((u = o.getContentType()) !== !1) {
|
|
920
|
-
const [p, ...w] = u ? u.split(";").map((E) => E.trim()).filter(Boolean) : [];
|
|
921
|
-
o.setContentType([p || "multipart/form-data", ...w].join("; "));
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
let l = new XMLHttpRequest();
|
|
925
|
-
if (e.auth) {
|
|
926
|
-
const p = e.auth.username || "", w = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
|
|
927
|
-
o.set("Authorization", "Basic " + btoa(p + ":" + w));
|
|
928
|
-
}
|
|
929
|
-
const b = $e(e.baseURL, e.url);
|
|
930
|
-
l.open(e.method.toUpperCase(), ke(b, e.params, e.paramsSerializer), !0), l.timeout = e.timeout;
|
|
931
|
-
function S() {
|
|
932
|
-
if (!l)
|
|
933
|
-
return;
|
|
934
|
-
const p = A.from(
|
|
935
|
-
"getAllResponseHeaders" in l && l.getAllResponseHeaders()
|
|
936
|
-
), E = {
|
|
937
|
-
data: !i || i === "text" || i === "json" ? l.responseText : l.response,
|
|
938
|
-
status: l.status,
|
|
939
|
-
statusText: l.statusText,
|
|
940
|
-
headers: p,
|
|
941
|
-
config: e,
|
|
942
|
-
request: l
|
|
943
|
-
};
|
|
944
|
-
Jt(function(_) {
|
|
945
|
-
n(_), f();
|
|
946
|
-
}, function(_) {
|
|
947
|
-
r(_), f();
|
|
948
|
-
}, E), l = null;
|
|
949
|
-
}
|
|
950
|
-
if ("onloadend" in l ? l.onloadend = S : l.onreadystatechange = function() {
|
|
951
|
-
!l || l.readyState !== 4 || l.status === 0 && !(l.responseURL && l.responseURL.indexOf("file:") === 0) || setTimeout(S);
|
|
952
|
-
}, l.onabort = function() {
|
|
953
|
-
l && (r(new m("Request aborted", m.ECONNABORTED, e, l)), l = null);
|
|
954
|
-
}, l.onerror = function() {
|
|
955
|
-
r(new m("Network Error", m.ERR_NETWORK, e, l)), l = null;
|
|
956
|
-
}, l.ontimeout = function() {
|
|
957
|
-
let w = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
|
|
958
|
-
const E = e.transitional || Ce;
|
|
959
|
-
e.timeoutErrorMessage && (w = e.timeoutErrorMessage), r(new m(
|
|
960
|
-
w,
|
|
961
|
-
E.clarifyTimeoutError ? m.ETIMEDOUT : m.ECONNABORTED,
|
|
962
|
-
e,
|
|
963
|
-
l
|
|
964
|
-
)), l = null;
|
|
965
|
-
}, R.hasStandardBrowserEnv && (c && a.isFunction(c) && (c = c(e)), c || c !== !1 && Kt(b))) {
|
|
966
|
-
const p = e.xsrfHeaderName && e.xsrfCookieName && zt.read(e.xsrfCookieName);
|
|
967
|
-
p && o.set(e.xsrfHeaderName, p);
|
|
968
|
-
}
|
|
969
|
-
s === void 0 && o.setContentType(null), "setRequestHeader" in l && a.forEach(o.toJSON(), function(w, E) {
|
|
970
|
-
l.setRequestHeader(E, w);
|
|
971
|
-
}), a.isUndefined(e.withCredentials) || (l.withCredentials = !!e.withCredentials), i && i !== "json" && (l.responseType = e.responseType), typeof e.onDownloadProgress == "function" && l.addEventListener("progress", he(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && l.upload && l.upload.addEventListener("progress", he(e.onUploadProgress)), (e.cancelToken || e.signal) && (d = (p) => {
|
|
972
|
-
l && (r(!p || p.type ? new B(null, e, l) : p), l.abort(), l = null);
|
|
973
|
-
}, e.cancelToken && e.cancelToken.subscribe(d), e.signal && (e.signal.aborted ? d() : e.signal.addEventListener("abort", d)));
|
|
974
|
-
const h = Gt(b);
|
|
975
|
-
if (h && R.protocols.indexOf(h) === -1) {
|
|
976
|
-
r(new m("Unsupported protocol " + h + ":", m.ERR_BAD_REQUEST, e));
|
|
977
|
-
return;
|
|
978
|
-
}
|
|
979
|
-
l.send(s || null);
|
|
980
|
-
});
|
|
981
|
-
}, Z = {
|
|
982
|
-
http: Ot,
|
|
983
|
-
xhr: Zt
|
|
984
|
-
};
|
|
985
|
-
a.forEach(Z, (e, t) => {
|
|
986
|
-
if (e) {
|
|
987
|
-
try {
|
|
988
|
-
Object.defineProperty(e, "name", { value: t });
|
|
989
|
-
} catch {
|
|
990
|
-
}
|
|
991
|
-
Object.defineProperty(e, "adapterName", { value: t });
|
|
992
|
-
}
|
|
993
|
-
});
|
|
994
|
-
const pe = (e) => `- ${e}`, Yt = (e) => a.isFunction(e) || e === null || e === !1, Le = {
|
|
995
|
-
getAdapter: (e) => {
|
|
996
|
-
e = a.isArray(e) ? e : [e];
|
|
997
|
-
const { length: t } = e;
|
|
998
|
-
let n, r;
|
|
999
|
-
const s = {};
|
|
1000
|
-
for (let o = 0; o < t; o++) {
|
|
1001
|
-
n = e[o];
|
|
1002
|
-
let i;
|
|
1003
|
-
if (r = n, !Yt(n) && (r = Z[(i = String(n)).toLowerCase()], r === void 0))
|
|
1004
|
-
throw new m(`Unknown adapter '${i}'`);
|
|
1005
|
-
if (r)
|
|
1006
|
-
break;
|
|
1007
|
-
s[i || "#" + o] = r;
|
|
1008
|
-
}
|
|
1009
|
-
if (!r) {
|
|
1010
|
-
const o = Object.entries(s).map(
|
|
1011
|
-
([c, d]) => `adapter ${c} ` + (d === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1012
|
-
);
|
|
1013
|
-
let i = t ? o.length > 1 ? `since :
|
|
1014
|
-
` + o.map(pe).join(`
|
|
1015
|
-
`) : " " + pe(o[0]) : "as no adapter specified";
|
|
1016
|
-
throw new m(
|
|
1017
|
-
"There is no suitable adapter to dispatch the request " + i,
|
|
1018
|
-
"ERR_NOT_SUPPORT"
|
|
1019
|
-
);
|
|
1020
|
-
}
|
|
1021
|
-
return r;
|
|
1022
|
-
},
|
|
1023
|
-
adapters: Z
|
|
1024
|
-
};
|
|
1025
|
-
function G(e) {
|
|
1026
|
-
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1027
|
-
throw new B(null, e);
|
|
1028
|
-
}
|
|
1029
|
-
function me(e) {
|
|
1030
|
-
return G(e), e.headers = A.from(e.headers), e.data = K.call(
|
|
1031
|
-
e,
|
|
1032
|
-
e.transformRequest
|
|
1033
|
-
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Le.getAdapter(e.adapter || se.adapter)(e).then(function(r) {
|
|
1034
|
-
return G(e), r.data = K.call(
|
|
1035
|
-
e,
|
|
1036
|
-
e.transformResponse,
|
|
1037
|
-
r
|
|
1038
|
-
), r.headers = A.from(r.headers), r;
|
|
1039
|
-
}, function(r) {
|
|
1040
|
-
return De(r) || (G(e), r && r.response && (r.response.data = K.call(
|
|
1041
|
-
e,
|
|
1042
|
-
e.transformResponse,
|
|
1043
|
-
r.response
|
|
1044
|
-
), r.response.headers = A.from(r.response.headers))), Promise.reject(r);
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
|
-
const ye = (e) => e instanceof A ? { ...e } : e;
|
|
1048
|
-
function x(e, t) {
|
|
1049
|
-
t = t || {};
|
|
1050
|
-
const n = {};
|
|
1051
|
-
function r(f, u, l) {
|
|
1052
|
-
return a.isPlainObject(f) && a.isPlainObject(u) ? a.merge.call({ caseless: l }, f, u) : a.isPlainObject(u) ? a.merge({}, u) : a.isArray(u) ? u.slice() : u;
|
|
1053
|
-
}
|
|
1054
|
-
function s(f, u, l) {
|
|
1055
|
-
if (a.isUndefined(u)) {
|
|
1056
|
-
if (!a.isUndefined(f))
|
|
1057
|
-
return r(void 0, f, l);
|
|
1058
|
-
} else
|
|
1059
|
-
return r(f, u, l);
|
|
1060
|
-
}
|
|
1061
|
-
function o(f, u) {
|
|
1062
|
-
if (!a.isUndefined(u))
|
|
1063
|
-
return r(void 0, u);
|
|
1064
|
-
}
|
|
1065
|
-
function i(f, u) {
|
|
1066
|
-
if (a.isUndefined(u)) {
|
|
1067
|
-
if (!a.isUndefined(f))
|
|
1068
|
-
return r(void 0, f);
|
|
1069
|
-
} else
|
|
1070
|
-
return r(void 0, u);
|
|
1071
|
-
}
|
|
1072
|
-
function c(f, u, l) {
|
|
1073
|
-
if (l in t)
|
|
1074
|
-
return r(f, u);
|
|
1075
|
-
if (l in e)
|
|
1076
|
-
return r(void 0, f);
|
|
1077
|
-
}
|
|
1078
|
-
const d = {
|
|
1079
|
-
url: o,
|
|
1080
|
-
method: o,
|
|
1081
|
-
data: o,
|
|
1082
|
-
baseURL: i,
|
|
1083
|
-
transformRequest: i,
|
|
1084
|
-
transformResponse: i,
|
|
1085
|
-
paramsSerializer: i,
|
|
1086
|
-
timeout: i,
|
|
1087
|
-
timeoutMessage: i,
|
|
1088
|
-
withCredentials: i,
|
|
1089
|
-
withXSRFToken: i,
|
|
1090
|
-
adapter: i,
|
|
1091
|
-
responseType: i,
|
|
1092
|
-
xsrfCookieName: i,
|
|
1093
|
-
xsrfHeaderName: i,
|
|
1094
|
-
onUploadProgress: i,
|
|
1095
|
-
onDownloadProgress: i,
|
|
1096
|
-
decompress: i,
|
|
1097
|
-
maxContentLength: i,
|
|
1098
|
-
maxBodyLength: i,
|
|
1099
|
-
beforeRedirect: i,
|
|
1100
|
-
transport: i,
|
|
1101
|
-
httpAgent: i,
|
|
1102
|
-
httpsAgent: i,
|
|
1103
|
-
cancelToken: i,
|
|
1104
|
-
socketPath: i,
|
|
1105
|
-
responseEncoding: i,
|
|
1106
|
-
validateStatus: c,
|
|
1107
|
-
headers: (f, u) => s(ye(f), ye(u), !0)
|
|
1108
|
-
};
|
|
1109
|
-
return a.forEach(Object.keys(Object.assign({}, e, t)), function(u) {
|
|
1110
|
-
const l = d[u] || s, b = l(e[u], t[u], u);
|
|
1111
|
-
a.isUndefined(b) && l !== c || (n[u] = b);
|
|
1112
|
-
}), n;
|
|
1113
|
-
}
|
|
1114
|
-
const Ue = "1.6.8", oe = {};
|
|
1115
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
|
|
1116
|
-
oe[e] = function(r) {
|
|
1117
|
-
return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
|
|
1118
|
-
};
|
|
1119
|
-
});
|
|
1120
|
-
const be = {};
|
|
1121
|
-
oe.transitional = function(t, n, r) {
|
|
1122
|
-
function s(o, i) {
|
|
1123
|
-
return "[Axios v" + Ue + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
|
|
1124
|
-
}
|
|
1125
|
-
return (o, i, c) => {
|
|
1126
|
-
if (t === !1)
|
|
1127
|
-
throw new m(
|
|
1128
|
-
s(i, " has been removed" + (n ? " in " + n : "")),
|
|
1129
|
-
m.ERR_DEPRECATED
|
|
1130
|
-
);
|
|
1131
|
-
return n && !be[i] && (be[i] = !0, console.warn(
|
|
1132
|
-
s(
|
|
1133
|
-
i,
|
|
1134
|
-
" has been deprecated since v" + n + " and will be removed in the near future"
|
|
1135
|
-
)
|
|
1136
|
-
)), t ? t(o, i, c) : !0;
|
|
1137
|
-
};
|
|
1138
|
-
};
|
|
1139
|
-
function en(e, t, n) {
|
|
1140
|
-
if (typeof e != "object")
|
|
1141
|
-
throw new m("options must be an object", m.ERR_BAD_OPTION_VALUE);
|
|
1142
|
-
const r = Object.keys(e);
|
|
1143
|
-
let s = r.length;
|
|
1144
|
-
for (; s-- > 0; ) {
|
|
1145
|
-
const o = r[s], i = t[o];
|
|
1146
|
-
if (i) {
|
|
1147
|
-
const c = e[o], d = c === void 0 || i(c, o, e);
|
|
1148
|
-
if (d !== !0)
|
|
1149
|
-
throw new m("option " + o + " must be " + d, m.ERR_BAD_OPTION_VALUE);
|
|
1150
|
-
continue;
|
|
1151
|
-
}
|
|
1152
|
-
if (n !== !0)
|
|
1153
|
-
throw new m("Unknown option " + o, m.ERR_BAD_OPTION);
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
const Y = {
|
|
1157
|
-
assertOptions: en,
|
|
1158
|
-
validators: oe
|
|
1159
|
-
}, N = Y.validators;
|
|
1160
|
-
class I {
|
|
1161
|
-
constructor(t) {
|
|
1162
|
-
this.defaults = t, this.interceptors = {
|
|
1163
|
-
request: new fe(),
|
|
1164
|
-
response: new fe()
|
|
1165
23
|
};
|
|
1166
24
|
}
|
|
1167
25
|
/**
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
* @param
|
|
1171
|
-
* @param
|
|
1172
|
-
*
|
|
1173
|
-
* @
|
|
26
|
+
* Performs an API request.
|
|
27
|
+
* @template T - The expected response type.
|
|
28
|
+
* @param method - The HTTP method to use.
|
|
29
|
+
* @param url - The relative URL for the request.
|
|
30
|
+
* @param data - The request payload (for POST, PUT).
|
|
31
|
+
* @param config - Optional axios configuration to override defaults.
|
|
32
|
+
* @returns A promise that resolves to the response data.
|
|
1174
33
|
*/
|
|
1175
|
-
async request(t,
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
} catch (r) {
|
|
1179
|
-
if (r instanceof Error) {
|
|
1180
|
-
let s;
|
|
1181
|
-
Error.captureStackTrace ? Error.captureStackTrace(s = {}) : s = new Error();
|
|
1182
|
-
const o = s.stack ? s.stack.replace(/^.+\n/, "") : "";
|
|
1183
|
-
r.stack ? o && !String(r.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (r.stack += `
|
|
1184
|
-
` + o) : r.stack = o;
|
|
1185
|
-
}
|
|
1186
|
-
throw r;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
_request(t, n) {
|
|
1190
|
-
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = x(this.defaults, n);
|
|
1191
|
-
const { transitional: r, paramsSerializer: s, headers: o } = n;
|
|
1192
|
-
r !== void 0 && Y.assertOptions(r, {
|
|
1193
|
-
silentJSONParsing: N.transitional(N.boolean),
|
|
1194
|
-
forcedJSONParsing: N.transitional(N.boolean),
|
|
1195
|
-
clarifyTimeoutError: N.transitional(N.boolean)
|
|
1196
|
-
}, !1), s != null && (a.isFunction(s) ? n.paramsSerializer = {
|
|
1197
|
-
serialize: s
|
|
1198
|
-
} : Y.assertOptions(s, {
|
|
1199
|
-
encode: N.function,
|
|
1200
|
-
serialize: N.function
|
|
1201
|
-
}, !0)), n.method = (n.method || this.defaults.method || "get").toLowerCase();
|
|
1202
|
-
let i = o && a.merge(
|
|
1203
|
-
o.common,
|
|
1204
|
-
o[n.method]
|
|
1205
|
-
);
|
|
1206
|
-
o && a.forEach(
|
|
1207
|
-
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1208
|
-
(h) => {
|
|
1209
|
-
delete o[h];
|
|
1210
|
-
}
|
|
1211
|
-
), n.headers = A.concat(i, o);
|
|
1212
|
-
const c = [];
|
|
1213
|
-
let d = !0;
|
|
1214
|
-
this.interceptors.request.forEach(function(p) {
|
|
1215
|
-
typeof p.runWhen == "function" && p.runWhen(n) === !1 || (d = d && p.synchronous, c.unshift(p.fulfilled, p.rejected));
|
|
1216
|
-
});
|
|
1217
|
-
const f = [];
|
|
1218
|
-
this.interceptors.response.forEach(function(p) {
|
|
1219
|
-
f.push(p.fulfilled, p.rejected);
|
|
1220
|
-
});
|
|
1221
|
-
let u, l = 0, b;
|
|
1222
|
-
if (!d) {
|
|
1223
|
-
const h = [me.bind(this), void 0];
|
|
1224
|
-
for (h.unshift.apply(h, c), h.push.apply(h, f), b = h.length, u = Promise.resolve(n); l < b; )
|
|
1225
|
-
u = u.then(h[l++], h[l++]);
|
|
1226
|
-
return u;
|
|
1227
|
-
}
|
|
1228
|
-
b = c.length;
|
|
1229
|
-
let S = n;
|
|
1230
|
-
for (l = 0; l < b; ) {
|
|
1231
|
-
const h = c[l++], p = c[l++];
|
|
1232
|
-
try {
|
|
1233
|
-
S = h(S);
|
|
1234
|
-
} catch (w) {
|
|
1235
|
-
p.call(this, w);
|
|
1236
|
-
break;
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
try {
|
|
1240
|
-
u = me.call(this, S);
|
|
1241
|
-
} catch (h) {
|
|
1242
|
-
return Promise.reject(h);
|
|
1243
|
-
}
|
|
1244
|
-
for (l = 0, b = f.length; l < b; )
|
|
1245
|
-
u = u.then(f[l++], f[l++]);
|
|
1246
|
-
return u;
|
|
1247
|
-
}
|
|
1248
|
-
getUri(t) {
|
|
1249
|
-
t = x(this.defaults, t);
|
|
1250
|
-
const n = $e(t.baseURL, t.url);
|
|
1251
|
-
return ke(n, t.params, t.paramsSerializer);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
a.forEach(["delete", "get", "head", "options"], function(t) {
|
|
1255
|
-
I.prototype[t] = function(n, r) {
|
|
1256
|
-
return this.request(x(r || {}, {
|
|
1257
|
-
method: t,
|
|
1258
|
-
url: n,
|
|
1259
|
-
data: (r || {}).data
|
|
1260
|
-
}));
|
|
1261
|
-
};
|
|
1262
|
-
});
|
|
1263
|
-
a.forEach(["post", "put", "patch"], function(t) {
|
|
1264
|
-
function n(r) {
|
|
1265
|
-
return function(o, i, c) {
|
|
1266
|
-
return this.request(x(c || {}, {
|
|
1267
|
-
method: t,
|
|
1268
|
-
headers: r ? {
|
|
1269
|
-
"Content-Type": "multipart/form-data"
|
|
1270
|
-
} : {},
|
|
1271
|
-
url: o,
|
|
1272
|
-
data: i
|
|
1273
|
-
}));
|
|
1274
|
-
};
|
|
1275
|
-
}
|
|
1276
|
-
I.prototype[t] = n(), I.prototype[t + "Form"] = n(!0);
|
|
1277
|
-
});
|
|
1278
|
-
const H = I;
|
|
1279
|
-
class ie {
|
|
1280
|
-
constructor(t) {
|
|
1281
|
-
if (typeof t != "function")
|
|
1282
|
-
throw new TypeError("executor must be a function.");
|
|
1283
|
-
let n;
|
|
1284
|
-
this.promise = new Promise(function(o) {
|
|
1285
|
-
n = o;
|
|
1286
|
-
});
|
|
1287
|
-
const r = this;
|
|
1288
|
-
this.promise.then((s) => {
|
|
1289
|
-
if (!r._listeners)
|
|
1290
|
-
return;
|
|
1291
|
-
let o = r._listeners.length;
|
|
1292
|
-
for (; o-- > 0; )
|
|
1293
|
-
r._listeners[o](s);
|
|
1294
|
-
r._listeners = null;
|
|
1295
|
-
}), this.promise.then = (s) => {
|
|
1296
|
-
let o;
|
|
1297
|
-
const i = new Promise((c) => {
|
|
1298
|
-
r.subscribe(c), o = c;
|
|
1299
|
-
}).then(s);
|
|
1300
|
-
return i.cancel = function() {
|
|
1301
|
-
r.unsubscribe(o);
|
|
1302
|
-
}, i;
|
|
1303
|
-
}, t(function(o, i, c) {
|
|
1304
|
-
r.reason || (r.reason = new B(o, i, c), n(r.reason));
|
|
1305
|
-
});
|
|
34
|
+
async request(t, e, r, s) {
|
|
35
|
+
const n = `${this.root}${e}`, i = { ...this.config, ...s }, c = await (t === "get" || t === "delete" ? y[t](n, i) : y[t](n, r, i));
|
|
36
|
+
return f(c);
|
|
1306
37
|
}
|
|
1307
38
|
/**
|
|
1308
|
-
*
|
|
39
|
+
* Performs a GET request.
|
|
40
|
+
* @template T - The expected response type.
|
|
41
|
+
* @param url - The relative URL for the request.
|
|
42
|
+
* @param config - Optional axios configuration to override defaults.
|
|
43
|
+
* @returns A promise that resolves to the response data.
|
|
1309
44
|
*/
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
throw this.reason;
|
|
45
|
+
async get(t, e) {
|
|
46
|
+
return this.request("get", t, void 0, e);
|
|
1313
47
|
}
|
|
1314
48
|
/**
|
|
1315
|
-
*
|
|
49
|
+
* Performs a POST request.
|
|
50
|
+
* @template B - The request body type.
|
|
51
|
+
* @template T - The expected response type.
|
|
52
|
+
* @param url - The relative URL for the request.
|
|
53
|
+
* @param data - The request payload.
|
|
54
|
+
* @param config - Optional axios configuration to override defaults.
|
|
55
|
+
* @returns A promise that resolves to the response data.
|
|
1316
56
|
*/
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
t(this.reason);
|
|
1320
|
-
return;
|
|
1321
|
-
}
|
|
1322
|
-
this._listeners ? this._listeners.push(t) : this._listeners = [t];
|
|
57
|
+
async post(t, e, r) {
|
|
58
|
+
return this.request("post", t, e, r);
|
|
1323
59
|
}
|
|
1324
60
|
/**
|
|
1325
|
-
*
|
|
61
|
+
* Performs a PUT request.
|
|
62
|
+
* @template B - The request body type.
|
|
63
|
+
* @template T - The expected response type.
|
|
64
|
+
* @param url - The relative URL for the request.
|
|
65
|
+
* @param data - The request payload.
|
|
66
|
+
* @param config - Optional axios configuration to override defaults.
|
|
67
|
+
* @returns A promise that resolves to the response data.
|
|
1326
68
|
*/
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
return;
|
|
1330
|
-
const n = this._listeners.indexOf(t);
|
|
1331
|
-
n !== -1 && this._listeners.splice(n, 1);
|
|
69
|
+
async put(t, e, r) {
|
|
70
|
+
return this.request("put", t, e, r);
|
|
1332
71
|
}
|
|
1333
72
|
/**
|
|
1334
|
-
*
|
|
1335
|
-
*
|
|
73
|
+
* Performs a DELETE request.
|
|
74
|
+
* @template T - The expected response type.
|
|
75
|
+
* @param url - The relative URL for the request.
|
|
76
|
+
* @param config - Optional axios configuration to override defaults.
|
|
77
|
+
* @returns A promise that resolves to the response data.
|
|
1336
78
|
*/
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
return {
|
|
1340
|
-
token: new ie(function(s) {
|
|
1341
|
-
t = s;
|
|
1342
|
-
}),
|
|
1343
|
-
cancel: t
|
|
1344
|
-
};
|
|
79
|
+
async del(t, e) {
|
|
80
|
+
return this.request("delete", t, void 0, e);
|
|
1345
81
|
}
|
|
1346
82
|
}
|
|
1347
|
-
const
|
|
1348
|
-
function nn(e) {
|
|
1349
|
-
return function(n) {
|
|
1350
|
-
return e.apply(null, n);
|
|
1351
|
-
};
|
|
1352
|
-
}
|
|
1353
|
-
function rn(e) {
|
|
1354
|
-
return a.isObject(e) && e.isAxiosError === !0;
|
|
1355
|
-
}
|
|
1356
|
-
const ee = {
|
|
1357
|
-
Continue: 100,
|
|
1358
|
-
SwitchingProtocols: 101,
|
|
1359
|
-
Processing: 102,
|
|
1360
|
-
EarlyHints: 103,
|
|
1361
|
-
Ok: 200,
|
|
1362
|
-
Created: 201,
|
|
1363
|
-
Accepted: 202,
|
|
1364
|
-
NonAuthoritativeInformation: 203,
|
|
1365
|
-
NoContent: 204,
|
|
1366
|
-
ResetContent: 205,
|
|
1367
|
-
PartialContent: 206,
|
|
1368
|
-
MultiStatus: 207,
|
|
1369
|
-
AlreadyReported: 208,
|
|
1370
|
-
ImUsed: 226,
|
|
1371
|
-
MultipleChoices: 300,
|
|
1372
|
-
MovedPermanently: 301,
|
|
1373
|
-
Found: 302,
|
|
1374
|
-
SeeOther: 303,
|
|
1375
|
-
NotModified: 304,
|
|
1376
|
-
UseProxy: 305,
|
|
1377
|
-
Unused: 306,
|
|
1378
|
-
TemporaryRedirect: 307,
|
|
1379
|
-
PermanentRedirect: 308,
|
|
1380
|
-
BadRequest: 400,
|
|
1381
|
-
Unauthorized: 401,
|
|
1382
|
-
PaymentRequired: 402,
|
|
1383
|
-
Forbidden: 403,
|
|
1384
|
-
NotFound: 404,
|
|
1385
|
-
MethodNotAllowed: 405,
|
|
1386
|
-
NotAcceptable: 406,
|
|
1387
|
-
ProxyAuthenticationRequired: 407,
|
|
1388
|
-
RequestTimeout: 408,
|
|
1389
|
-
Conflict: 409,
|
|
1390
|
-
Gone: 410,
|
|
1391
|
-
LengthRequired: 411,
|
|
1392
|
-
PreconditionFailed: 412,
|
|
1393
|
-
PayloadTooLarge: 413,
|
|
1394
|
-
UriTooLong: 414,
|
|
1395
|
-
UnsupportedMediaType: 415,
|
|
1396
|
-
RangeNotSatisfiable: 416,
|
|
1397
|
-
ExpectationFailed: 417,
|
|
1398
|
-
ImATeapot: 418,
|
|
1399
|
-
MisdirectedRequest: 421,
|
|
1400
|
-
UnprocessableEntity: 422,
|
|
1401
|
-
Locked: 423,
|
|
1402
|
-
FailedDependency: 424,
|
|
1403
|
-
TooEarly: 425,
|
|
1404
|
-
UpgradeRequired: 426,
|
|
1405
|
-
PreconditionRequired: 428,
|
|
1406
|
-
TooManyRequests: 429,
|
|
1407
|
-
RequestHeaderFieldsTooLarge: 431,
|
|
1408
|
-
UnavailableForLegalReasons: 451,
|
|
1409
|
-
InternalServerError: 500,
|
|
1410
|
-
NotImplemented: 501,
|
|
1411
|
-
BadGateway: 502,
|
|
1412
|
-
ServiceUnavailable: 503,
|
|
1413
|
-
GatewayTimeout: 504,
|
|
1414
|
-
HttpVersionNotSupported: 505,
|
|
1415
|
-
VariantAlsoNegotiates: 506,
|
|
1416
|
-
InsufficientStorage: 507,
|
|
1417
|
-
LoopDetected: 508,
|
|
1418
|
-
NotExtended: 510,
|
|
1419
|
-
NetworkAuthenticationRequired: 511
|
|
1420
|
-
};
|
|
1421
|
-
Object.entries(ee).forEach(([e, t]) => {
|
|
1422
|
-
ee[t] = e;
|
|
1423
|
-
});
|
|
1424
|
-
const sn = ee;
|
|
1425
|
-
function He(e) {
|
|
1426
|
-
const t = new H(e), n = Ee(H.prototype.request, t);
|
|
1427
|
-
return a.extend(n, H.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
|
|
1428
|
-
return He(x(e, s));
|
|
1429
|
-
}, n;
|
|
1430
|
-
}
|
|
1431
|
-
const y = He(se);
|
|
1432
|
-
y.Axios = H;
|
|
1433
|
-
y.CanceledError = B;
|
|
1434
|
-
y.CancelToken = tn;
|
|
1435
|
-
y.isCancel = De;
|
|
1436
|
-
y.VERSION = Ue;
|
|
1437
|
-
y.toFormData = J;
|
|
1438
|
-
y.AxiosError = m;
|
|
1439
|
-
y.Cancel = y.CanceledError;
|
|
1440
|
-
y.all = function(t) {
|
|
1441
|
-
return Promise.all(t);
|
|
1442
|
-
};
|
|
1443
|
-
y.spread = nn;
|
|
1444
|
-
y.isAxiosError = rn;
|
|
1445
|
-
y.mergeConfig = x;
|
|
1446
|
-
y.AxiosHeaders = A;
|
|
1447
|
-
y.formToJSON = (e) => je(a.isHTMLForm(e) ? new FormData(e) : e);
|
|
1448
|
-
y.getAdapter = Le.getAdapter;
|
|
1449
|
-
y.HttpStatusCode = sn;
|
|
1450
|
-
y.default = y;
|
|
1451
|
-
const we = { Accept: "application/json", "Content-Type": "application/json" };
|
|
1452
|
-
function D(e) {
|
|
1453
|
-
return e.data;
|
|
1454
|
-
}
|
|
1455
|
-
class on {
|
|
1456
|
-
constructor(t, n) {
|
|
1457
|
-
j(this, "root");
|
|
1458
|
-
j(this, "config");
|
|
1459
|
-
var r;
|
|
1460
|
-
this.root = t, n ? (this.config = n, (r = this.config) != null && r.headers || (this.config.headers = {}), this.config.headers = { ...this.config.headers, ...we }) : this.config = { headers: we };
|
|
1461
|
-
}
|
|
1462
|
-
async get(t, n) {
|
|
1463
|
-
return await y.get(`${this.root}${t}`, { ...n, ...this.config }).then(D);
|
|
1464
|
-
}
|
|
1465
|
-
async post(t, n, r) {
|
|
1466
|
-
return await y.post(`${this.root}${t}`, n, { ...r, ...this.config }).then(D);
|
|
1467
|
-
}
|
|
1468
|
-
async put(t, n, r) {
|
|
1469
|
-
return await y.put(`${this.root}${t}`, n, { ...r, ...this.config }).then(D);
|
|
1470
|
-
}
|
|
1471
|
-
async del(t, n) {
|
|
1472
|
-
return await y.delete(`${this.root}${t}`, { ...n, ...this.config }).then(D);
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
const an = [
|
|
83
|
+
const b = [
|
|
1476
84
|
"contains",
|
|
1477
85
|
"contains_nocase",
|
|
1478
86
|
"ends_with",
|
|
@@ -1492,206 +100,209 @@ const an = [
|
|
|
1492
100
|
"not",
|
|
1493
101
|
"in",
|
|
1494
102
|
"not_in"
|
|
1495
|
-
];
|
|
1496
|
-
class
|
|
103
|
+
], $ = 1e3, g = 5e3;
|
|
104
|
+
class h {
|
|
1497
105
|
/**
|
|
1498
|
-
*
|
|
1499
|
-
*
|
|
1500
|
-
* @
|
|
106
|
+
* Converts a JSON query object into a GraphQL-compatible string.
|
|
107
|
+
* Handles nested objects and operator mapping (e.g., $gt -> _gt).
|
|
108
|
+
* @param query - The JSON filter object to build.
|
|
109
|
+
* @returns A string representing the GraphQL 'where' or 'block' filter.
|
|
1501
110
|
*/
|
|
1502
111
|
static buildJsonQuery(t) {
|
|
1503
|
-
const
|
|
1504
|
-
for (const r in t)
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
n
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
112
|
+
const e = [];
|
|
113
|
+
for (const r in t) {
|
|
114
|
+
const s = t[r];
|
|
115
|
+
if (s !== void 0)
|
|
116
|
+
if (s === null)
|
|
117
|
+
e.push(`${r}: null`);
|
|
118
|
+
else if (Array.isArray(s)) {
|
|
119
|
+
const n = s;
|
|
120
|
+
e.push(
|
|
121
|
+
`${r}: [${n.map((i) => typeof i == "string" ? `"${i}"` : i).join(", ")}]`
|
|
122
|
+
);
|
|
123
|
+
} else if (typeof s == "string")
|
|
124
|
+
e.push(`${r}: "${s}"`);
|
|
125
|
+
else if (typeof s == "object") {
|
|
126
|
+
const n = {}, i = {}, c = s;
|
|
127
|
+
for (const l in c) {
|
|
128
|
+
const u = c[l];
|
|
129
|
+
if (l.startsWith("$")) {
|
|
130
|
+
const o = l.slice(1);
|
|
131
|
+
b.includes(o) ? i[`${r}_${o}`] = u : n[l] = u;
|
|
1520
132
|
} else
|
|
1521
|
-
|
|
133
|
+
n[l] = u;
|
|
1522
134
|
}
|
|
1523
|
-
Object.keys(
|
|
135
|
+
Object.keys(n).length > 0 && e.push(`${r}: {${this.buildJsonQuery(n)}}`), Object.keys(i).length > 0 && e.push(this.buildJsonQuery(i));
|
|
1524
136
|
} else
|
|
1525
|
-
|
|
1526
|
-
|
|
137
|
+
e.push(`${r}: ${s}`);
|
|
138
|
+
}
|
|
139
|
+
return e.join(", ");
|
|
1527
140
|
}
|
|
1528
141
|
/**
|
|
1529
|
-
*
|
|
1530
|
-
* @param
|
|
1531
|
-
* @returns
|
|
142
|
+
* Builds the fields/elements part of a GraphQL query from an array of strings or objects.
|
|
143
|
+
* @param elements - An array of fields to query. Can include nested collections as GraphObject.
|
|
144
|
+
* @returns An array of strings representing the selected fields.
|
|
1532
145
|
*/
|
|
1533
146
|
static buildElements(t) {
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
const s = r;
|
|
1540
|
-
n.push(this.buildQuery({ collection: s.collection, params: s.params }));
|
|
1541
|
-
}
|
|
1542
|
-
return n;
|
|
147
|
+
return t.map((e) => {
|
|
148
|
+
if (typeof e == "string") return e;
|
|
149
|
+
const r = e;
|
|
150
|
+
return this.buildQuery({ collection: r.collection, params: r.params });
|
|
151
|
+
});
|
|
1543
152
|
}
|
|
1544
153
|
/**
|
|
1545
|
-
*
|
|
1546
|
-
* @param
|
|
1547
|
-
* @returns
|
|
154
|
+
* Builds the metadata (_meta) fragment of a GraphQL query.
|
|
155
|
+
* @param metadata - The metadata configuration.
|
|
156
|
+
* @returns A string representing the _meta query fragment.
|
|
1548
157
|
*/
|
|
1549
158
|
static buildMetadata(t) {
|
|
1550
|
-
let
|
|
159
|
+
let e = "";
|
|
1551
160
|
const r = [];
|
|
1552
|
-
t.blockQuery && (t.blockQuery.hash && r.push(`hash: "${t.blockQuery.hash}"`), t.blockQuery.number && r.push(`number: ${t.blockQuery.number}`), t.blockQuery.number_gte && r.push(`number_gte: ${t.blockQuery.number_gte}`));
|
|
161
|
+
t.blockQuery && (t.blockQuery.hash && r.push(`hash: "${t.blockQuery.hash}"`), t.blockQuery.number !== void 0 && r.push(`number: ${t.blockQuery.number}`), t.blockQuery.number_gte !== void 0 && r.push(`number_gte: ${t.blockQuery.number_gte}`));
|
|
1553
162
|
const s = r.join(", ");
|
|
1554
|
-
s.length > 0 && (
|
|
1555
|
-
const
|
|
163
|
+
s.length > 0 && (e += `(block: {${s}})`);
|
|
164
|
+
const n = [], i = [];
|
|
1556
165
|
if (t.elements) {
|
|
1557
|
-
for (const
|
|
1558
|
-
|
|
1559
|
-
const u = f.toString();
|
|
1560
|
-
o.includes(u) || o.push(u);
|
|
1561
|
-
} else {
|
|
1562
|
-
const u = f.toString();
|
|
1563
|
-
i.includes(u) || i.push(u);
|
|
1564
|
-
}
|
|
166
|
+
for (const u of t.elements)
|
|
167
|
+
u === "deployment" || u === "hasIndexingErrors" ? n.includes(u) || n.push(u) : i.includes(u) || i.push(u);
|
|
1565
168
|
const c = i.join(" ");
|
|
1566
|
-
c.length > 0 &&
|
|
1567
|
-
const
|
|
1568
|
-
|
|
169
|
+
c.length > 0 && n.push(`block{${c}}`);
|
|
170
|
+
const l = n.join(" ");
|
|
171
|
+
l.length > 0 && (e += `{${l}}`);
|
|
1569
172
|
}
|
|
1570
|
-
return
|
|
173
|
+
return e.length > 0 ? `_meta${e}` : "";
|
|
1571
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* Builds an inline fragment (... on Collection { ... }) for a query.
|
|
177
|
+
* @param fragment - The inline fragment configuration.
|
|
178
|
+
* @returns A string representing the inline fragment.
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
1572
181
|
static _buildInlineFragment(t) {
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
return (r = t.params) != null && r.elements && (n = this.buildElements(t.params.elements)), `... on ${t.collection}{${n.join(" ")}}`;
|
|
182
|
+
const e = t.params?.elements?.length ? this.buildElements(t.params.elements) : ["id"];
|
|
183
|
+
return `... on ${t.collection}{${e.join(" ")}}`;
|
|
1576
184
|
}
|
|
1577
185
|
/**
|
|
1578
|
-
*
|
|
1579
|
-
* @param
|
|
1580
|
-
* @returns
|
|
186
|
+
* Builds multiple inline fragments from an array of fragment configurations.
|
|
187
|
+
* @param fragments - An array of inline fragments.
|
|
188
|
+
* @returns A string containing all built inline fragments.
|
|
1581
189
|
*/
|
|
1582
190
|
static buildInlineFragments(t) {
|
|
1583
|
-
|
|
1584
|
-
for (const r of t)
|
|
1585
|
-
n.push(this._buildInlineFragment(r));
|
|
1586
|
-
return n.join(" ");
|
|
191
|
+
return t.map((e) => this._buildInlineFragment(e)).join(" ");
|
|
1587
192
|
}
|
|
1588
193
|
/**
|
|
1589
|
-
*
|
|
1590
|
-
* @param
|
|
1591
|
-
*
|
|
1592
|
-
*
|
|
1593
|
-
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
1594
|
-
* @returns The string query
|
|
194
|
+
* Builds a complete GraphQL query for a single collection.
|
|
195
|
+
* @param data - The collection and parameters for the query.
|
|
196
|
+
* @param metadata - Optional metadata configuration.
|
|
197
|
+
* @returns A string containing the GraphQL query for the collection.
|
|
1595
198
|
*/
|
|
1596
|
-
static buildQuery(t,
|
|
1597
|
-
const
|
|
1598
|
-
if (
|
|
1599
|
-
const
|
|
1600
|
-
|
|
199
|
+
static buildQuery(t, e) {
|
|
200
|
+
const { collection: r, params: s } = t, n = [];
|
|
201
|
+
if (s?.id !== void 0 && n.push(`id: ${s.id}`), s?.orderBy && n.push(`orderBy: ${s.orderBy}`), s?.orderDirection && n.push(`orderDirection: ${s.orderDirection}`), s?.first !== void 0) {
|
|
202
|
+
const o = Math.max(0, Math.min(s.first, $));
|
|
203
|
+
n.push(`first: ${o}`);
|
|
204
|
+
}
|
|
205
|
+
if (s?.skip !== void 0) {
|
|
206
|
+
const o = Math.max(0, Math.min(s.skip, g));
|
|
207
|
+
n.push(`skip: ${o}`);
|
|
208
|
+
}
|
|
209
|
+
if (s?.where) {
|
|
210
|
+
const o = this.buildJsonQuery(s.where);
|
|
211
|
+
o.length > 0 && n.push(`where: {${o}}`);
|
|
1601
212
|
}
|
|
1602
|
-
if (s
|
|
1603
|
-
const
|
|
1604
|
-
|
|
213
|
+
if (s?.block) {
|
|
214
|
+
const o = this.buildJsonQuery(s.block);
|
|
215
|
+
o.length > 0 && n.push(`block: {${o}}`);
|
|
1605
216
|
}
|
|
1606
|
-
const i =
|
|
217
|
+
const i = n.length > 0 ? `(${n.join(", ")})` : "";
|
|
1607
218
|
let c = ["id"];
|
|
1608
|
-
s
|
|
1609
|
-
let
|
|
1610
|
-
s
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
return l.length > 0 ? `${l} ${f}` : f;
|
|
219
|
+
s?.elements && s.elements.length > 0 && (c = this.buildElements(s.elements));
|
|
220
|
+
let l = "";
|
|
221
|
+
s?.inlineFragments && s.inlineFragments.length > 0 && (l = ` ${this.buildInlineFragments(s.inlineFragments)}`);
|
|
222
|
+
const u = `${r}${i} {${c.join(" ")}${l}}`;
|
|
223
|
+
if (e) {
|
|
224
|
+
const o = this.buildMetadata(e);
|
|
225
|
+
return o ? `${o} ${u}` : u;
|
|
1616
226
|
}
|
|
1617
|
-
return
|
|
227
|
+
return u;
|
|
1618
228
|
}
|
|
1619
229
|
/**
|
|
1620
|
-
*
|
|
1621
|
-
* @param
|
|
1622
|
-
* @param
|
|
1623
|
-
* @returns
|
|
230
|
+
* Builds a query that targets multiple collections simultaneously.
|
|
231
|
+
* @param data - An array of collection queries and their parameters.
|
|
232
|
+
* @param metadata - Optional metadata configuration that applies to the entire query.
|
|
233
|
+
* @returns A string containing the merged GraphQL query for multiple collections.
|
|
1624
234
|
*/
|
|
1625
|
-
static buildMultipleQuery(t,
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
return o.length > 0 ? `${o} ${s}` : s;
|
|
235
|
+
static buildMultipleQuery(t, e) {
|
|
236
|
+
const s = t.map(
|
|
237
|
+
(n) => this.buildQuery({ collection: n.collection, params: n.params })
|
|
238
|
+
).join(" ");
|
|
239
|
+
if (e) {
|
|
240
|
+
const n = this.buildMetadata(e);
|
|
241
|
+
return n ? `${n} ${s}` : s;
|
|
1633
242
|
}
|
|
1634
243
|
return s;
|
|
1635
244
|
}
|
|
1636
245
|
/**
|
|
1637
|
-
*
|
|
1638
|
-
* @param
|
|
1639
|
-
* @param
|
|
1640
|
-
* @returns The
|
|
246
|
+
* Wraps a query fragment into a full GraphQL 'query' block.
|
|
247
|
+
* @param query - The query fragment to wrap.
|
|
248
|
+
* @param queryName - An optional name for the GraphQL query (defaults to 'query').
|
|
249
|
+
* @returns The full GraphQL query string.
|
|
1641
250
|
*/
|
|
1642
|
-
static makeFullQuery(t,
|
|
1643
|
-
return `query ${
|
|
251
|
+
static makeFullQuery(t, e = "query") {
|
|
252
|
+
return `query ${e} {${t}}`;
|
|
1644
253
|
}
|
|
1645
254
|
}
|
|
1646
|
-
class
|
|
255
|
+
class Q extends d {
|
|
256
|
+
/** The name of the GraphQL query, used in makeFullQuery. */
|
|
257
|
+
queryName;
|
|
1647
258
|
/**
|
|
1648
|
-
*
|
|
1649
|
-
* @param
|
|
1650
|
-
* @param
|
|
259
|
+
* Initializes a new EthGraphQuery instance.
|
|
260
|
+
* @param rootUrl - The endpoint URL of the subgraph.
|
|
261
|
+
* @param config - Optional axios configuration for custom headers or timeouts.
|
|
1651
262
|
*/
|
|
1652
|
-
constructor(
|
|
1653
|
-
super(
|
|
1654
|
-
j(this, "queryName");
|
|
1655
|
-
this.queryName = "query";
|
|
263
|
+
constructor(t, e) {
|
|
264
|
+
super(t, e), this.queryName = "query";
|
|
1656
265
|
}
|
|
1657
266
|
/**
|
|
1658
|
-
*
|
|
1659
|
-
* @
|
|
1660
|
-
* @
|
|
267
|
+
* Executes a raw GraphQL query string.
|
|
268
|
+
* @template T - The expected return type of the data.
|
|
269
|
+
* @param data - The raw GraphQL query string.
|
|
270
|
+
* @returns A promise resolving to the query result.
|
|
271
|
+
* @throws Error if the response contains any GraphQL errors.
|
|
1661
272
|
*/
|
|
1662
|
-
async stringQuery(
|
|
1663
|
-
const
|
|
1664
|
-
if (
|
|
1665
|
-
const s =
|
|
1666
|
-
throw new Error(s
|
|
273
|
+
async stringQuery(t) {
|
|
274
|
+
const e = await this.post("", { query: t });
|
|
275
|
+
if (e && typeof e == "object" && "errors" in e) {
|
|
276
|
+
const s = e.errors.map((n) => n.message).join("; ");
|
|
277
|
+
throw new Error(`GraphQL Error: ${s}`);
|
|
1667
278
|
}
|
|
1668
|
-
return
|
|
279
|
+
return e.data;
|
|
1669
280
|
}
|
|
1670
281
|
/**
|
|
1671
|
-
*
|
|
1672
|
-
* @
|
|
1673
|
-
*
|
|
1674
|
-
*
|
|
1675
|
-
* @
|
|
1676
|
-
* @returns The data respective with the query data
|
|
282
|
+
* Executes a single collection query using a JSON configuration.
|
|
283
|
+
* @template T - The expected return type of the data.
|
|
284
|
+
* @param data - The configuration for the collection query.
|
|
285
|
+
* @param metadata - Optional metadata fields to include in the query.
|
|
286
|
+
* @returns A promise resolving to the fetched data.
|
|
1677
287
|
*/
|
|
1678
|
-
async query(
|
|
1679
|
-
const
|
|
1680
|
-
return
|
|
288
|
+
async query(t, e) {
|
|
289
|
+
const r = h.buildQuery(t, e);
|
|
290
|
+
return this.stringQuery(h.makeFullQuery(r, this.queryName));
|
|
1681
291
|
}
|
|
1682
292
|
/**
|
|
1683
|
-
*
|
|
1684
|
-
* @
|
|
1685
|
-
* @param
|
|
1686
|
-
* @
|
|
293
|
+
* Executes multiple collection queries in a single request using JSON configurations.
|
|
294
|
+
* @template T - The expected return type of the data.
|
|
295
|
+
* @param data - An array of query configurations.
|
|
296
|
+
* @param metadata - Optional metadata fields to include in the query.
|
|
297
|
+
* @returns A promise resolving to the merged results of all queries.
|
|
1687
298
|
*/
|
|
1688
|
-
async multipleQuery(
|
|
1689
|
-
const
|
|
1690
|
-
return
|
|
299
|
+
async multipleQuery(t, e) {
|
|
300
|
+
const r = h.buildMultipleQuery(t, e);
|
|
301
|
+
return this.stringQuery(h.makeFullQuery(r, this.queryName));
|
|
1691
302
|
}
|
|
1692
303
|
}
|
|
1693
304
|
export {
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
305
|
+
Q as EthGraphQuery,
|
|
306
|
+
b as OptionKeys,
|
|
307
|
+
h as QueryBuilder
|
|
1697
308
|
};
|