@api7/portal-sdk 0.0.1 → 0.0.3
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 +39 -5
- package/dist/api_product.d.ts +4 -2
- package/dist/api_product.d.ts.map +1 -1
- package/dist/application.d.ts +8 -12
- package/dist/application.d.ts.map +1 -1
- package/dist/browser.cjs +1 -0
- package/dist/browser.d.ts +24 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +23 -0
- package/dist/credential.d.ts +52 -3
- package/dist/credential.d.ts.map +1 -1
- package/dist/index.cjs +1 -7
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -1012
- package/dist/miscellaneous.d.ts +1 -1
- package/dist/miscellaneous.d.ts.map +1 -1
- package/dist/subscription-DPb2gn6N.js +1054 -0
- package/dist/subscription-ukRySaBq.cjs +7 -0
- package/dist/subscription.d.ts +2 -1
- package/dist/subscription.d.ts.map +1 -1
- package/dist/unstable/typing.d.ts +2 -0
- package/dist/unstable/typing.d.ts.map +1 -0
- package/dist/unstable-types.cjs +1 -0
- package/dist/unstable-types.js +1 -0
- package/dist/utils.d.ts +0 -3
- package/dist/utils.d.ts.map +1 -1
- package/package.json +13 -2
package/dist/index.js
CHANGED
|
@@ -1,1006 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
onSseEvent: r,
|
|
6
|
-
responseTransformer: s,
|
|
7
|
-
responseValidator: n,
|
|
8
|
-
sseDefaultRetryDelay: l,
|
|
9
|
-
sseMaxRetryAttempts: c,
|
|
10
|
-
sseMaxRetryDelay: i,
|
|
11
|
-
sseSleepFn: o,
|
|
12
|
-
url: d,
|
|
13
|
-
...a
|
|
14
|
-
}) => {
|
|
15
|
-
let h;
|
|
16
|
-
const b = o ?? ((m) => new Promise((y) => setTimeout(y, m)));
|
|
17
|
-
return { stream: async function* () {
|
|
18
|
-
let m = l ?? 3e3, y = 0;
|
|
19
|
-
const A = a.signal ?? new AbortController().signal;
|
|
20
|
-
for (; !A.aborted; ) {
|
|
21
|
-
y++;
|
|
22
|
-
const I = a.headers instanceof Headers ? a.headers : new Headers(a.headers);
|
|
23
|
-
h !== void 0 && I.set("Last-Event-ID", h);
|
|
24
|
-
try {
|
|
25
|
-
const j = {
|
|
26
|
-
redirect: "follow",
|
|
27
|
-
...a,
|
|
28
|
-
body: a.serializedBody,
|
|
29
|
-
headers: I,
|
|
30
|
-
signal: A
|
|
31
|
-
};
|
|
32
|
-
let R = new Request(d, j);
|
|
33
|
-
e && (R = await e(d, j));
|
|
34
|
-
const _ = await (a.fetch ?? globalThis.fetch)(R);
|
|
35
|
-
if (!_.ok)
|
|
36
|
-
throw new Error(
|
|
37
|
-
`SSE failed: ${_.status} ${_.statusText}`
|
|
38
|
-
);
|
|
39
|
-
if (!_.body) throw new Error("No body in SSE response");
|
|
40
|
-
const $ = _.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
41
|
-
let C = "";
|
|
42
|
-
const O = () => {
|
|
43
|
-
try {
|
|
44
|
-
$.cancel();
|
|
45
|
-
} catch {
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
A.addEventListener("abort", O);
|
|
49
|
-
try {
|
|
50
|
-
for (; ; ) {
|
|
51
|
-
const { done: X, value: Q } = await $.read();
|
|
52
|
-
if (X) break;
|
|
53
|
-
C += Q, C = C.replace(/\r\n/g, `
|
|
54
|
-
`).replace(/\r/g, `
|
|
55
|
-
`);
|
|
56
|
-
const q = C.split(`
|
|
57
|
-
|
|
58
|
-
`);
|
|
59
|
-
C = q.pop() ?? "";
|
|
60
|
-
for (const Y of q) {
|
|
61
|
-
const Z = Y.split(`
|
|
62
|
-
`), D = [];
|
|
63
|
-
let U;
|
|
64
|
-
for (const f of Z)
|
|
65
|
-
if (f.startsWith("data:"))
|
|
66
|
-
D.push(f.replace(/^data:\s*/, ""));
|
|
67
|
-
else if (f.startsWith("event:"))
|
|
68
|
-
U = f.replace(/^event:\s*/, "");
|
|
69
|
-
else if (f.startsWith("id:"))
|
|
70
|
-
h = f.replace(/^id:\s*/, "");
|
|
71
|
-
else if (f.startsWith("retry:")) {
|
|
72
|
-
const B = Number.parseInt(
|
|
73
|
-
f.replace(/^retry:\s*/, ""),
|
|
74
|
-
10
|
|
75
|
-
);
|
|
76
|
-
Number.isNaN(B) || (m = B);
|
|
77
|
-
}
|
|
78
|
-
let T, N = !1;
|
|
79
|
-
if (D.length) {
|
|
80
|
-
const f = D.join(`
|
|
81
|
-
`);
|
|
82
|
-
try {
|
|
83
|
-
T = JSON.parse(f), N = !0;
|
|
84
|
-
} catch {
|
|
85
|
-
T = f;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
N && (n && await n(T), s && (T = await s(T))), r?.({
|
|
89
|
-
data: T,
|
|
90
|
-
event: U,
|
|
91
|
-
id: h,
|
|
92
|
-
retry: m
|
|
93
|
-
}), D.length && (yield T);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
} finally {
|
|
97
|
-
A.removeEventListener("abort", O), $.releaseLock();
|
|
98
|
-
}
|
|
99
|
-
break;
|
|
100
|
-
} catch (j) {
|
|
101
|
-
if (t?.(j), c !== void 0 && y >= c)
|
|
102
|
-
break;
|
|
103
|
-
const R = Math.min(
|
|
104
|
-
m * 2 ** (y - 1),
|
|
105
|
-
i ?? 3e4
|
|
106
|
-
);
|
|
107
|
-
await b(R);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}() };
|
|
111
|
-
}, te = (e) => {
|
|
112
|
-
switch (e) {
|
|
113
|
-
case "label":
|
|
114
|
-
return ".";
|
|
115
|
-
case "matrix":
|
|
116
|
-
return ";";
|
|
117
|
-
case "simple":
|
|
118
|
-
return ",";
|
|
119
|
-
default:
|
|
120
|
-
return "&";
|
|
121
|
-
}
|
|
122
|
-
}, re = (e) => {
|
|
123
|
-
switch (e) {
|
|
124
|
-
case "form":
|
|
125
|
-
return ",";
|
|
126
|
-
case "pipeDelimited":
|
|
127
|
-
return "|";
|
|
128
|
-
case "spaceDelimited":
|
|
129
|
-
return "%20";
|
|
130
|
-
default:
|
|
131
|
-
return ",";
|
|
132
|
-
}
|
|
133
|
-
}, se = (e) => {
|
|
134
|
-
switch (e) {
|
|
135
|
-
case "label":
|
|
136
|
-
return ".";
|
|
137
|
-
case "matrix":
|
|
138
|
-
return ";";
|
|
139
|
-
case "simple":
|
|
140
|
-
return ",";
|
|
141
|
-
default:
|
|
142
|
-
return "&";
|
|
143
|
-
}
|
|
144
|
-
}, V = ({
|
|
145
|
-
allowReserved: e,
|
|
146
|
-
explode: t,
|
|
147
|
-
name: r,
|
|
148
|
-
style: s,
|
|
149
|
-
value: n
|
|
150
|
-
}) => {
|
|
151
|
-
if (!t) {
|
|
152
|
-
const i = (e ? n : n.map((o) => encodeURIComponent(o))).join(re(s));
|
|
153
|
-
switch (s) {
|
|
154
|
-
case "label":
|
|
155
|
-
return `.${i}`;
|
|
156
|
-
case "matrix":
|
|
157
|
-
return `;${r}=${i}`;
|
|
158
|
-
case "simple":
|
|
159
|
-
return i;
|
|
160
|
-
default:
|
|
161
|
-
return `${r}=${i}`;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
const l = te(s), c = n.map((i) => s === "label" || s === "simple" ? e ? i : encodeURIComponent(i) : E({
|
|
165
|
-
allowReserved: e,
|
|
166
|
-
name: r,
|
|
167
|
-
value: i
|
|
168
|
-
})).join(l);
|
|
169
|
-
return s === "label" || s === "matrix" ? l + c : c;
|
|
170
|
-
}, E = ({
|
|
171
|
-
allowReserved: e,
|
|
172
|
-
name: t,
|
|
173
|
-
value: r
|
|
174
|
-
}) => {
|
|
175
|
-
if (r == null)
|
|
176
|
-
return "";
|
|
177
|
-
if (typeof r == "object")
|
|
178
|
-
throw new Error(
|
|
179
|
-
"Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these."
|
|
180
|
-
);
|
|
181
|
-
return `${t}=${e ? r : encodeURIComponent(r)}`;
|
|
182
|
-
}, M = ({
|
|
183
|
-
allowReserved: e,
|
|
184
|
-
explode: t,
|
|
185
|
-
name: r,
|
|
186
|
-
style: s,
|
|
187
|
-
value: n,
|
|
188
|
-
valueOnly: l
|
|
189
|
-
}) => {
|
|
190
|
-
if (n instanceof Date)
|
|
191
|
-
return l ? n.toISOString() : `${r}=${n.toISOString()}`;
|
|
192
|
-
if (s !== "deepObject" && !t) {
|
|
193
|
-
let o = [];
|
|
194
|
-
Object.entries(n).forEach(([a, h]) => {
|
|
195
|
-
o = [
|
|
196
|
-
...o,
|
|
197
|
-
a,
|
|
198
|
-
e ? h : encodeURIComponent(h)
|
|
199
|
-
];
|
|
200
|
-
});
|
|
201
|
-
const d = o.join(",");
|
|
202
|
-
switch (s) {
|
|
203
|
-
case "form":
|
|
204
|
-
return `${r}=${d}`;
|
|
205
|
-
case "label":
|
|
206
|
-
return `.${d}`;
|
|
207
|
-
case "matrix":
|
|
208
|
-
return `;${r}=${d}`;
|
|
209
|
-
default:
|
|
210
|
-
return d;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
const c = se(s), i = Object.entries(n).map(
|
|
214
|
-
([o, d]) => E({
|
|
215
|
-
allowReserved: e,
|
|
216
|
-
name: s === "deepObject" ? `${r}[${o}]` : o,
|
|
217
|
-
value: d
|
|
218
|
-
})
|
|
219
|
-
).join(c);
|
|
220
|
-
return s === "label" || s === "matrix" ? c + i : i;
|
|
221
|
-
}, ne = /\{[^{}]+\}/g, ie = ({ path: e, url: t }) => {
|
|
222
|
-
let r = t;
|
|
223
|
-
const s = t.match(ne);
|
|
224
|
-
if (s)
|
|
225
|
-
for (const n of s) {
|
|
226
|
-
let l = !1, c = n.substring(1, n.length - 1), i = "simple";
|
|
227
|
-
c.endsWith("*") && (l = !0, c = c.substring(0, c.length - 1)), c.startsWith(".") ? (c = c.substring(1), i = "label") : c.startsWith(";") && (c = c.substring(1), i = "matrix");
|
|
228
|
-
const o = e[c];
|
|
229
|
-
if (o == null)
|
|
230
|
-
continue;
|
|
231
|
-
if (Array.isArray(o)) {
|
|
232
|
-
r = r.replace(
|
|
233
|
-
n,
|
|
234
|
-
V({ explode: l, name: c, style: i, value: o })
|
|
235
|
-
);
|
|
236
|
-
continue;
|
|
237
|
-
}
|
|
238
|
-
if (typeof o == "object") {
|
|
239
|
-
r = r.replace(
|
|
240
|
-
n,
|
|
241
|
-
M({
|
|
242
|
-
explode: l,
|
|
243
|
-
name: c,
|
|
244
|
-
style: i,
|
|
245
|
-
value: o,
|
|
246
|
-
valueOnly: !0
|
|
247
|
-
})
|
|
248
|
-
);
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
if (i === "matrix") {
|
|
252
|
-
r = r.replace(
|
|
253
|
-
n,
|
|
254
|
-
`;${E({
|
|
255
|
-
name: c,
|
|
256
|
-
value: o
|
|
257
|
-
})}`
|
|
258
|
-
);
|
|
259
|
-
continue;
|
|
260
|
-
}
|
|
261
|
-
const d = encodeURIComponent(
|
|
262
|
-
i === "label" ? `.${o}` : o
|
|
263
|
-
);
|
|
264
|
-
r = r.replace(n, d);
|
|
265
|
-
}
|
|
266
|
-
return r;
|
|
267
|
-
}, ae = ({
|
|
268
|
-
baseUrl: e,
|
|
269
|
-
path: t,
|
|
270
|
-
query: r,
|
|
271
|
-
querySerializer: s,
|
|
272
|
-
url: n
|
|
273
|
-
}) => {
|
|
274
|
-
const l = n.startsWith("/") ? n : `/${n}`;
|
|
275
|
-
let c = (e ?? "") + l;
|
|
276
|
-
t && (c = ie({ path: t, url: c }));
|
|
277
|
-
let i = r ? s(r) : "";
|
|
278
|
-
return i.startsWith("?") && (i = i.substring(1)), i && (c += `?${i}`), c;
|
|
279
|
-
};
|
|
280
|
-
function ce(e) {
|
|
281
|
-
const t = e.body !== void 0;
|
|
282
|
-
if (t && e.bodySerializer)
|
|
283
|
-
return "serializedBody" in e ? e.serializedBody !== void 0 && e.serializedBody !== "" ? e.serializedBody : null : e.body !== "" ? e.body : null;
|
|
284
|
-
if (t)
|
|
285
|
-
return e.body;
|
|
286
|
-
}
|
|
287
|
-
const oe = async (e, t) => {
|
|
288
|
-
const r = typeof t == "function" ? await t(e) : t;
|
|
289
|
-
if (r)
|
|
290
|
-
return e.scheme === "bearer" ? `Bearer ${r}` : e.scheme === "basic" ? `Basic ${btoa(r)}` : r;
|
|
291
|
-
}, le = ({
|
|
292
|
-
parameters: e = {},
|
|
293
|
-
...t
|
|
294
|
-
} = {}) => (s) => {
|
|
295
|
-
const n = [];
|
|
296
|
-
if (s && typeof s == "object")
|
|
297
|
-
for (const l in s) {
|
|
298
|
-
const c = s[l];
|
|
299
|
-
if (c == null)
|
|
300
|
-
continue;
|
|
301
|
-
const i = e[l] || t;
|
|
302
|
-
if (Array.isArray(c)) {
|
|
303
|
-
const o = V({
|
|
304
|
-
allowReserved: i.allowReserved,
|
|
305
|
-
explode: !0,
|
|
306
|
-
name: l,
|
|
307
|
-
style: "form",
|
|
308
|
-
value: c,
|
|
309
|
-
...i.array
|
|
310
|
-
});
|
|
311
|
-
o && n.push(o);
|
|
312
|
-
} else if (typeof c == "object") {
|
|
313
|
-
const o = M({
|
|
314
|
-
allowReserved: i.allowReserved,
|
|
315
|
-
explode: !0,
|
|
316
|
-
name: l,
|
|
317
|
-
style: "deepObject",
|
|
318
|
-
value: c,
|
|
319
|
-
...i.object
|
|
320
|
-
});
|
|
321
|
-
o && n.push(o);
|
|
322
|
-
} else {
|
|
323
|
-
const o = E({
|
|
324
|
-
allowReserved: i.allowReserved,
|
|
325
|
-
name: l,
|
|
326
|
-
value: c
|
|
327
|
-
});
|
|
328
|
-
o && n.push(o);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return n.join("&");
|
|
332
|
-
}, pe = (e, t) => t ? t in e.headers || e.query?.[t] ? !0 : "Cookie" in e.headers && e.headers.Cookie && typeof e.headers.Cookie == "string" ? e.headers.Cookie.includes(`${t}=`) : !1 : !1, ue = async ({
|
|
333
|
-
security: e,
|
|
334
|
-
...t
|
|
335
|
-
}) => {
|
|
336
|
-
for (const r of e) {
|
|
337
|
-
if (pe(t, r.name))
|
|
338
|
-
continue;
|
|
339
|
-
const s = await oe(r, t.auth);
|
|
340
|
-
if (!s)
|
|
341
|
-
continue;
|
|
342
|
-
const n = r.name ?? "Authorization";
|
|
343
|
-
switch (r.in) {
|
|
344
|
-
case "query":
|
|
345
|
-
t.query || (t.query = {}), t.query[n] = s;
|
|
346
|
-
break;
|
|
347
|
-
case "cookie": {
|
|
348
|
-
const l = `${n}=${s}`;
|
|
349
|
-
"Cookie" in t.headers && t.headers.Cookie ? t.headers.Cookie = `${t.headers.Cookie}; ${l}` : t.headers.Cookie = l;
|
|
350
|
-
break;
|
|
351
|
-
}
|
|
352
|
-
case "header":
|
|
353
|
-
default:
|
|
354
|
-
t.headers[n] = s;
|
|
355
|
-
break;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}, L = (e) => {
|
|
359
|
-
const t = e.axios?.defaults?.baseURL, r = e.baseURL && typeof e.baseURL == "string" ? e.baseURL : t;
|
|
360
|
-
return ae({
|
|
361
|
-
baseUrl: r,
|
|
362
|
-
path: e.path,
|
|
363
|
-
// let `paramsSerializer()` handle query params if it exists
|
|
364
|
-
query: e.paramsSerializer ? void 0 : e.query,
|
|
365
|
-
querySerializer: typeof e.querySerializer == "function" ? e.querySerializer : le(e.querySerializer),
|
|
366
|
-
url: e.url
|
|
367
|
-
});
|
|
368
|
-
}, H = (e, t) => {
|
|
369
|
-
const r = { ...e, ...t };
|
|
370
|
-
return r.headers = z(e.headers, t.headers), r;
|
|
371
|
-
}, de = [
|
|
372
|
-
"common",
|
|
373
|
-
"delete",
|
|
374
|
-
"get",
|
|
375
|
-
"head",
|
|
376
|
-
"patch",
|
|
377
|
-
"post",
|
|
378
|
-
"put"
|
|
379
|
-
], z = (...e) => {
|
|
380
|
-
const t = {};
|
|
381
|
-
for (const r of e) {
|
|
382
|
-
if (!r || typeof r != "object")
|
|
383
|
-
continue;
|
|
384
|
-
const s = Object.entries(r);
|
|
385
|
-
for (const [n, l] of s)
|
|
386
|
-
if (de.includes(
|
|
387
|
-
n
|
|
388
|
-
) && typeof l == "object")
|
|
389
|
-
t[n] = {
|
|
390
|
-
...t[n],
|
|
391
|
-
...l
|
|
392
|
-
};
|
|
393
|
-
else if (l === null)
|
|
394
|
-
delete t[n];
|
|
395
|
-
else if (Array.isArray(l))
|
|
396
|
-
for (const c of l)
|
|
397
|
-
t[n] = [...t[n] ?? [], c];
|
|
398
|
-
else l !== void 0 && (t[n] = typeof l == "object" ? JSON.stringify(l) : l);
|
|
399
|
-
}
|
|
400
|
-
return t;
|
|
401
|
-
}, F = (e = {}) => ({
|
|
402
|
-
...e
|
|
403
|
-
}), J = (e = {}) => {
|
|
404
|
-
let t = H(F(), e), r;
|
|
405
|
-
if (t.axios && !("Axios" in t.axios))
|
|
406
|
-
r = t.axios;
|
|
407
|
-
else {
|
|
408
|
-
const { auth: d, ...a } = t;
|
|
409
|
-
r = W.create(a);
|
|
410
|
-
}
|
|
411
|
-
const s = () => ({ ...t }), n = (d) => (t = H(t, d), r.defaults = {
|
|
412
|
-
...r.defaults,
|
|
413
|
-
...t,
|
|
414
|
-
// @ts-expect-error
|
|
415
|
-
headers: z(r.defaults.headers, t.headers)
|
|
416
|
-
}, s()), l = async (d) => {
|
|
417
|
-
const a = {
|
|
418
|
-
...t,
|
|
419
|
-
...d,
|
|
420
|
-
axios: d.axios ?? t.axios ?? r,
|
|
421
|
-
headers: z(t.headers, d.headers)
|
|
422
|
-
};
|
|
423
|
-
a.security && await ue({
|
|
424
|
-
...a,
|
|
425
|
-
security: a.security
|
|
426
|
-
}), a.requestValidator && await a.requestValidator(a), a.body !== void 0 && a.bodySerializer && (a.body = a.bodySerializer(a.body));
|
|
427
|
-
const h = L(a);
|
|
428
|
-
return { opts: a, url: h };
|
|
429
|
-
}, c = async (d) => {
|
|
430
|
-
const { opts: a, url: h } = await l(d);
|
|
431
|
-
try {
|
|
432
|
-
const b = a.axios, { auth: g, ...k } = a, m = await b({
|
|
433
|
-
...k,
|
|
434
|
-
baseURL: "",
|
|
435
|
-
// the baseURL is already included in `url`
|
|
436
|
-
data: ce(a),
|
|
437
|
-
headers: a.headers,
|
|
438
|
-
// let `paramsSerializer()` handle query params if it exists
|
|
439
|
-
params: a.paramsSerializer ? a.query : void 0,
|
|
440
|
-
url: h
|
|
441
|
-
});
|
|
442
|
-
let { data: y } = m;
|
|
443
|
-
return a.responseType === "json" && (a.responseValidator && await a.responseValidator(y), a.responseTransformer && (y = await a.responseTransformer(y))), {
|
|
444
|
-
...m,
|
|
445
|
-
data: y ?? {}
|
|
446
|
-
};
|
|
447
|
-
} catch (b) {
|
|
448
|
-
const g = b;
|
|
449
|
-
if (a.throwOnError)
|
|
450
|
-
throw g;
|
|
451
|
-
return g.error = g.response?.data ?? {}, g;
|
|
452
|
-
}
|
|
453
|
-
}, i = (d) => (a) => c({ ...a, method: d }), o = (d) => async (a) => {
|
|
454
|
-
const { opts: h, url: b } = await l(a);
|
|
455
|
-
return ee({
|
|
456
|
-
...h,
|
|
457
|
-
body: h.body,
|
|
458
|
-
headers: h.headers,
|
|
459
|
-
method: d,
|
|
460
|
-
// @ts-expect-error
|
|
461
|
-
signal: h.signal,
|
|
462
|
-
url: b
|
|
463
|
-
});
|
|
464
|
-
};
|
|
465
|
-
return {
|
|
466
|
-
buildUrl: L,
|
|
467
|
-
connect: i("CONNECT"),
|
|
468
|
-
delete: i("DELETE"),
|
|
469
|
-
get: i("GET"),
|
|
470
|
-
getConfig: s,
|
|
471
|
-
head: i("HEAD"),
|
|
472
|
-
instance: r,
|
|
473
|
-
options: i("OPTIONS"),
|
|
474
|
-
patch: i("PATCH"),
|
|
475
|
-
post: i("POST"),
|
|
476
|
-
put: i("PUT"),
|
|
477
|
-
request: c,
|
|
478
|
-
setConfig: n,
|
|
479
|
-
sse: {
|
|
480
|
-
connect: o("CONNECT"),
|
|
481
|
-
delete: o("DELETE"),
|
|
482
|
-
get: o("GET"),
|
|
483
|
-
head: o("HEAD"),
|
|
484
|
-
options: o("OPTIONS"),
|
|
485
|
-
patch: o("PATCH"),
|
|
486
|
-
post: o("POST"),
|
|
487
|
-
put: o("PUT"),
|
|
488
|
-
trace: o("TRACE")
|
|
489
|
-
},
|
|
490
|
-
trace: i("TRACE")
|
|
491
|
-
};
|
|
492
|
-
}, u = J(F()), w = (e) => (e = new Date(e), e), G = (e) => (e.last_active_at && (e.last_active_at = w(e.last_active_at)), e.created_at = w(e.created_at), e.updated_at = w(e.updated_at), e), he = async (e) => (e.list = e.list.map((t) => G(t)), e), fe = async (e) => (e = G(e), e), ye = (e) => (e.subscribed_at = w(e.subscribed_at), e), me = async (e) => (e.list = e.list.map((t) => ye(t)), e), K = (e) => (e.created_at = w(e.created_at), e.updated_at = w(e.updated_at), e), x = (e) => (e = K(e), e), be = (e) => (e = x(e), e), Te = async (e) => (e.list = e.list.map((t) => be(t)), e), we = async (e) => (e = x(e), e), ge = async (e) => (e = x(e), e), ve = async (e) => (e = x(e), e), v = (e) => (e = K(e), e), _e = async (e) => (e.list = e.list.map((t) => v(t)), e), Ce = async (e) => (e = v(e), e), Se = async (e) => (e = v(e), e), Ae = async (e) => (e = v(e), e), je = async (e) => (e = v(e), e), Re = (e) => (e.hour_timestamp = w(e.hour_timestamp), e), De = async (e) => (e.list = e.list.map((t) => Re(t)), e), Pe = async (e) => (e.list = e.list.map((t) => v(t)), e), Ee = (e) => (e?.client ?? u).get({
|
|
493
|
-
responseTransformer: he,
|
|
494
|
-
responseType: "json",
|
|
495
|
-
url: "/api/developers",
|
|
496
|
-
...e
|
|
497
|
-
}), xe = (e) => (e?.client ?? u).post({
|
|
498
|
-
responseTransformer: fe,
|
|
499
|
-
responseType: "json",
|
|
500
|
-
url: "/api/developers",
|
|
501
|
-
...e,
|
|
502
|
-
headers: {
|
|
503
|
-
"Content-Type": "application/json",
|
|
504
|
-
...e?.headers
|
|
505
|
-
}
|
|
506
|
-
}), $e = (e) => (e.client ?? u).delete({ url: "/api/developers/{developer_id}", ...e }), ze = (e) => (e?.client ?? u).get({
|
|
507
|
-
responseType: "json",
|
|
508
|
-
url: "/api/api_products",
|
|
509
|
-
...e
|
|
510
|
-
}), ke = (e) => (e.client ?? u).get({
|
|
511
|
-
responseType: "json",
|
|
512
|
-
url: "/api/api_products/{api_product_id}",
|
|
513
|
-
...e
|
|
514
|
-
}), Ie = (e) => (e.client ?? u).post({
|
|
515
|
-
url: "/api/api_products/{api_product_id}/subscriptions",
|
|
516
|
-
...e,
|
|
517
|
-
headers: {
|
|
518
|
-
"Content-Type": "application/json",
|
|
519
|
-
...e.headers
|
|
520
|
-
}
|
|
521
|
-
}), Oe = (e) => (e?.client ?? u).get({
|
|
522
|
-
responseTransformer: me,
|
|
523
|
-
responseType: "json",
|
|
524
|
-
url: "/api/subscriptions",
|
|
525
|
-
...e
|
|
526
|
-
}), qe = (e) => (e?.client ?? u).post({
|
|
527
|
-
url: "/api/subscriptions",
|
|
528
|
-
...e,
|
|
529
|
-
headers: {
|
|
530
|
-
"Content-Type": "application/json",
|
|
531
|
-
...e?.headers
|
|
532
|
-
}
|
|
533
|
-
}), Ue = (e) => (e.client ?? u).delete({ url: "/api/subscriptions/{subscription_id}", ...e }), Ne = (e) => (e?.client ?? u).get({
|
|
534
|
-
responseTransformer: Te,
|
|
535
|
-
responseType: "json",
|
|
536
|
-
url: "/api/applications",
|
|
537
|
-
...e
|
|
538
|
-
}), Be = (e) => (e?.client ?? u).post({
|
|
539
|
-
responseTransformer: we,
|
|
540
|
-
responseType: "json",
|
|
541
|
-
url: "/api/applications",
|
|
542
|
-
...e,
|
|
543
|
-
headers: {
|
|
544
|
-
"Content-Type": "application/json",
|
|
545
|
-
...e?.headers
|
|
546
|
-
}
|
|
547
|
-
}), Le = (e) => (e.client ?? u).delete({ url: "/api/applications/{application_id}", ...e }), He = (e) => (e.client ?? u).get({
|
|
548
|
-
responseTransformer: ge,
|
|
549
|
-
responseType: "json",
|
|
550
|
-
url: "/api/applications/{application_id}",
|
|
551
|
-
...e
|
|
552
|
-
}), We = (e) => (e.client ?? u).put({
|
|
553
|
-
responseTransformer: ve,
|
|
554
|
-
responseType: "json",
|
|
555
|
-
url: "/api/applications/{application_id}",
|
|
556
|
-
...e,
|
|
557
|
-
headers: {
|
|
558
|
-
"Content-Type": "application/json",
|
|
559
|
-
...e.headers
|
|
560
|
-
}
|
|
561
|
-
}), Ve = (e) => (e.client ?? u).get({
|
|
562
|
-
responseTransformer: _e,
|
|
563
|
-
responseType: "json",
|
|
564
|
-
url: "/api/applications/{application_id}/credentials",
|
|
565
|
-
...e
|
|
566
|
-
}), Me = (e) => (e.client ?? u).post({
|
|
567
|
-
responseTransformer: Ce,
|
|
568
|
-
responseType: "json",
|
|
569
|
-
url: "/api/applications/{application_id}/credentials",
|
|
570
|
-
...e,
|
|
571
|
-
headers: {
|
|
572
|
-
"Content-Type": "application/json",
|
|
573
|
-
...e.headers
|
|
574
|
-
}
|
|
575
|
-
}), Fe = (e) => (e.client ?? u).delete({ url: "/api/applications/{application_id}/credentials/{credential_id}", ...e }), Je = (e) => (e.client ?? u).get({
|
|
576
|
-
responseTransformer: Se,
|
|
577
|
-
responseType: "json",
|
|
578
|
-
url: "/api/applications/{application_id}/credentials/{credential_id}",
|
|
579
|
-
...e
|
|
580
|
-
}), Ge = (e) => (e.client ?? u).put({
|
|
581
|
-
responseTransformer: Ae,
|
|
582
|
-
responseType: "json",
|
|
583
|
-
url: "/api/applications/{application_id}/credentials/{credential_id}",
|
|
584
|
-
...e,
|
|
585
|
-
headers: {
|
|
586
|
-
"Content-Type": "application/json",
|
|
587
|
-
...e.headers
|
|
588
|
-
}
|
|
589
|
-
}), Ke = (e) => (e.client ?? u).put({
|
|
590
|
-
responseTransformer: je,
|
|
591
|
-
responseType: "json",
|
|
592
|
-
url: "/api/applications/{application_id}/credentials/{credential_id}/regenerate",
|
|
593
|
-
...e,
|
|
594
|
-
headers: {
|
|
595
|
-
"Content-Type": "application/json",
|
|
596
|
-
...e.headers
|
|
597
|
-
}
|
|
598
|
-
}), Xe = (e) => (e.client ?? u).get({
|
|
599
|
-
responseTransformer: De,
|
|
600
|
-
responseType: "json",
|
|
601
|
-
url: "/api/applications/api_calls",
|
|
602
|
-
...e
|
|
603
|
-
}), Qe = (e) => (e?.client ?? u).get({
|
|
604
|
-
responseTransformer: Pe,
|
|
605
|
-
responseType: "json",
|
|
606
|
-
url: "/api/credentials",
|
|
607
|
-
...e
|
|
608
|
-
}), Ye = (e) => (e.client ?? u).get({
|
|
609
|
-
responseType: "json",
|
|
610
|
-
url: "/api/labels/{resource_type}",
|
|
611
|
-
...e
|
|
612
|
-
}), Ze = (e) => (e?.client ?? u).get({
|
|
613
|
-
responseType: "json",
|
|
614
|
-
url: "/api/system_settings/public_access",
|
|
615
|
-
...e
|
|
616
|
-
}), et = (e) => (e?.client ?? u).get({
|
|
617
|
-
responseType: "json",
|
|
618
|
-
url: "/api/dcr_providers",
|
|
619
|
-
...e
|
|
620
|
-
}), S = (e, t) => ({
|
|
621
|
-
...t,
|
|
622
|
-
"X-Portal-Developer-ID": e
|
|
623
|
-
});
|
|
624
|
-
class P extends Error {
|
|
625
|
-
constructor(t, r, s, n, l) {
|
|
626
|
-
super(t), this.message = t, this.status = r, this.method = s, this.url = n, this.stack = void 0, this.#e = l;
|
|
627
|
-
}
|
|
628
|
-
#e;
|
|
629
|
-
static fromAxiosError = (t) => {
|
|
630
|
-
const r = t.error && t.error.error_msg;
|
|
631
|
-
return new P(
|
|
632
|
-
`Request failed: ${r || (t.status ? `with status code ${t.status}` : t.message)}`,
|
|
633
|
-
t.status ?? 0,
|
|
634
|
-
t.config?.method?.toUpperCase() ?? "",
|
|
635
|
-
t.config?.url ?? "",
|
|
636
|
-
t
|
|
637
|
-
);
|
|
638
|
-
};
|
|
639
|
-
/**
|
|
640
|
-
* Check if the given error is an instance of APIError.
|
|
641
|
-
* @param error The error to check.
|
|
642
|
-
* @returns True if the error is an instance of APIError, false otherwise.
|
|
643
|
-
*/
|
|
644
|
-
static isAPIError = (t) => t instanceof P;
|
|
645
|
-
/**
|
|
646
|
-
* Get the original raw Axios error.
|
|
647
|
-
* @returns {AxiosError} The original Axios error.
|
|
648
|
-
*/
|
|
649
|
-
rawError() {
|
|
650
|
-
return this.#e;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
const p = (e) => {
|
|
654
|
-
if (e.error || e.status && e.status >= 400)
|
|
655
|
-
throw P.fromAxiosError(e);
|
|
656
|
-
return e.data;
|
|
657
|
-
};
|
|
658
|
-
class tt {
|
|
659
|
-
constructor(t) {
|
|
660
|
-
this.client = t;
|
|
661
|
-
}
|
|
662
|
-
async create(t, r) {
|
|
663
|
-
return p(
|
|
664
|
-
await Me({
|
|
665
|
-
client: this.client,
|
|
666
|
-
path: { application_id: t },
|
|
667
|
-
body: r
|
|
668
|
-
})
|
|
669
|
-
);
|
|
670
|
-
}
|
|
671
|
-
async list(t, r) {
|
|
672
|
-
return p(
|
|
673
|
-
await Ve({
|
|
674
|
-
client: this.client,
|
|
675
|
-
path: { application_id: t },
|
|
676
|
-
query: r
|
|
677
|
-
})
|
|
678
|
-
);
|
|
679
|
-
}
|
|
680
|
-
async get(t, r) {
|
|
681
|
-
return p(
|
|
682
|
-
await Je({
|
|
683
|
-
client: this.client,
|
|
684
|
-
path: {
|
|
685
|
-
application_id: t,
|
|
686
|
-
credential_id: r
|
|
687
|
-
}
|
|
688
|
-
})
|
|
689
|
-
);
|
|
690
|
-
}
|
|
691
|
-
async update(t, r, s) {
|
|
692
|
-
return p(
|
|
693
|
-
await Ge({
|
|
694
|
-
client: this.client,
|
|
695
|
-
path: {
|
|
696
|
-
application_id: t,
|
|
697
|
-
credential_id: r
|
|
698
|
-
},
|
|
699
|
-
body: s
|
|
700
|
-
})
|
|
701
|
-
);
|
|
702
|
-
}
|
|
703
|
-
async delete(t, r) {
|
|
704
|
-
return p(
|
|
705
|
-
await Fe({
|
|
706
|
-
client: this.client,
|
|
707
|
-
path: {
|
|
708
|
-
application_id: t,
|
|
709
|
-
credential_id: r
|
|
710
|
-
}
|
|
711
|
-
})
|
|
712
|
-
);
|
|
713
|
-
}
|
|
714
|
-
async regenerate(t, r, s) {
|
|
715
|
-
return p(
|
|
716
|
-
await Ke({
|
|
717
|
-
client: this.client,
|
|
718
|
-
path: {
|
|
719
|
-
application_id: t,
|
|
720
|
-
credential_id: r
|
|
721
|
-
},
|
|
722
|
-
body: s
|
|
723
|
-
})
|
|
724
|
-
);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
class rt {
|
|
728
|
-
constructor(t) {
|
|
729
|
-
this.client = t;
|
|
730
|
-
}
|
|
731
|
-
async list(t) {
|
|
732
|
-
return p(
|
|
733
|
-
await Qe({
|
|
734
|
-
client: this.client,
|
|
735
|
-
query: t
|
|
736
|
-
})
|
|
737
|
-
);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
class st {
|
|
741
|
-
constructor(t) {
|
|
742
|
-
this.client = t, this.credential = new tt(this.client);
|
|
743
|
-
}
|
|
744
|
-
credential;
|
|
745
|
-
/**
|
|
746
|
-
* Create a new developer application.
|
|
747
|
-
* @param developerId The developer ID.
|
|
748
|
-
* @param application The application data.
|
|
749
|
-
* @returns The created developer application.
|
|
750
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
751
|
-
*/
|
|
752
|
-
async create(t, r) {
|
|
753
|
-
return p(
|
|
754
|
-
await Be({
|
|
755
|
-
client: this.client,
|
|
756
|
-
headers: S(t),
|
|
757
|
-
body: r
|
|
758
|
-
})
|
|
759
|
-
);
|
|
760
|
-
}
|
|
761
|
-
/**
|
|
762
|
-
* List all applications for a developer.
|
|
763
|
-
* @param developerId The developer ID.
|
|
764
|
-
* @returns The list of developer's applications.
|
|
765
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
766
|
-
*/
|
|
767
|
-
async list(t, r) {
|
|
768
|
-
return p(
|
|
769
|
-
await Ne({
|
|
770
|
-
client: this.client,
|
|
771
|
-
headers: S(t),
|
|
772
|
-
query: r
|
|
773
|
-
})
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
/**
|
|
777
|
-
* Get a developer application by ID.
|
|
778
|
-
* @param developerId The developer ID.
|
|
779
|
-
* @param applicationId The application ID.
|
|
780
|
-
* @returns The developer application.
|
|
781
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
782
|
-
*/
|
|
783
|
-
async get(t, r) {
|
|
784
|
-
return p(
|
|
785
|
-
await He({
|
|
786
|
-
client: this.client,
|
|
787
|
-
headers: S(t),
|
|
788
|
-
path: { application_id: r }
|
|
789
|
-
})
|
|
790
|
-
);
|
|
791
|
-
}
|
|
792
|
-
/**
|
|
793
|
-
* Update a developer application.
|
|
794
|
-
* @param developerId The developer ID.
|
|
795
|
-
* @param applicationId The application ID.
|
|
796
|
-
* @param data The application data.
|
|
797
|
-
* @returns The updated developer application.
|
|
798
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
799
|
-
*/
|
|
800
|
-
async update(t, r, s) {
|
|
801
|
-
return p(
|
|
802
|
-
await We({
|
|
803
|
-
client: this.client,
|
|
804
|
-
headers: S(t),
|
|
805
|
-
path: { application_id: r },
|
|
806
|
-
body: s
|
|
807
|
-
})
|
|
808
|
-
);
|
|
809
|
-
}
|
|
810
|
-
/**
|
|
811
|
-
* Delete a developer application.
|
|
812
|
-
* @param developerId The developer ID.
|
|
813
|
-
* @param applicationId The application ID.
|
|
814
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
815
|
-
*/
|
|
816
|
-
async delete(t, r) {
|
|
817
|
-
p(
|
|
818
|
-
await Le({
|
|
819
|
-
client: this.client,
|
|
820
|
-
headers: S(t),
|
|
821
|
-
path: { application_id: r }
|
|
822
|
-
})
|
|
823
|
-
);
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* Get API call metrics.
|
|
827
|
-
* @param query The query parameters.
|
|
828
|
-
* @returns The API call metrics.
|
|
829
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
830
|
-
*/
|
|
831
|
-
async apiCall(t) {
|
|
832
|
-
return p(
|
|
833
|
-
await Xe({
|
|
834
|
-
client: this.client,
|
|
835
|
-
query: t
|
|
836
|
-
})
|
|
837
|
-
);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
class nt {
|
|
841
|
-
constructor(t) {
|
|
842
|
-
this.client = t;
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
* List all DCR providers.
|
|
846
|
-
* @returns The list of DCR providers.
|
|
847
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
848
|
-
*/
|
|
849
|
-
async list(t) {
|
|
850
|
-
return p(
|
|
851
|
-
await et({ client: this.client, query: t })
|
|
852
|
-
);
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
class it {
|
|
856
|
-
constructor(t) {
|
|
857
|
-
this.client = t;
|
|
858
|
-
}
|
|
859
|
-
/**
|
|
860
|
-
* Get public access settings.
|
|
861
|
-
* @returns Whether the developer portal is publicly accessible.
|
|
862
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
863
|
-
*/
|
|
864
|
-
async getPublicAccess() {
|
|
865
|
-
return p(
|
|
866
|
-
await Ze({ client: this.client })
|
|
867
|
-
).portal_public_access;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
class at {
|
|
871
|
-
constructor(t) {
|
|
872
|
-
this.client = t;
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* Get list of labels for a given resource type.
|
|
876
|
-
* @param type The resource type.
|
|
877
|
-
* @returns The list of labels.
|
|
878
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
879
|
-
*/
|
|
880
|
-
async listLabels(t) {
|
|
881
|
-
return p(
|
|
882
|
-
await Ye({ client: this.client, path: { resource_type: t } })
|
|
883
|
-
);
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
class ct {
|
|
887
|
-
constructor(t) {
|
|
888
|
-
this.client = t;
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
* Create a new developer.
|
|
892
|
-
* @param data The developer data.
|
|
893
|
-
* @returns The created developer.
|
|
894
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
895
|
-
*/
|
|
896
|
-
async create(t) {
|
|
897
|
-
return p(
|
|
898
|
-
await xe({ client: this.client, body: t })
|
|
899
|
-
);
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
* List all developers.
|
|
903
|
-
* @param query Optional query parameters.
|
|
904
|
-
* @returns The list of developers.
|
|
905
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
906
|
-
*/
|
|
907
|
-
async list(t) {
|
|
908
|
-
return p(
|
|
909
|
-
await Ee({ client: this.client, query: t })
|
|
910
|
-
);
|
|
911
|
-
}
|
|
912
|
-
/**
|
|
913
|
-
* Delete a developer by ID.
|
|
914
|
-
* @param id The developer ID.
|
|
915
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
916
|
-
*/
|
|
917
|
-
async delete(t) {
|
|
918
|
-
p(
|
|
919
|
-
await $e({ client: this.client, path: { developer_id: t } })
|
|
920
|
-
);
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
class ot {
|
|
924
|
-
constructor(t) {
|
|
925
|
-
this.client = t;
|
|
926
|
-
}
|
|
927
|
-
/**
|
|
928
|
-
* List all API products.
|
|
929
|
-
* @returns The list of API products.
|
|
930
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
931
|
-
*/
|
|
932
|
-
async list(t) {
|
|
933
|
-
return p(
|
|
934
|
-
await ze({ client: this.client, query: t })
|
|
935
|
-
);
|
|
936
|
-
}
|
|
937
|
-
/**
|
|
938
|
-
* Get an API product by ID.
|
|
939
|
-
* @param id The API product ID.
|
|
940
|
-
* @returns The API product.
|
|
941
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
942
|
-
*/
|
|
943
|
-
async get(t) {
|
|
944
|
-
return p(
|
|
945
|
-
await ke({
|
|
946
|
-
client: this.client,
|
|
947
|
-
path: { api_product_id: t }
|
|
948
|
-
})
|
|
949
|
-
);
|
|
950
|
-
}
|
|
951
|
-
/**
|
|
952
|
-
* Subscribe to an API product by ID.
|
|
953
|
-
* @param id The API product ID.
|
|
954
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
955
|
-
*/
|
|
956
|
-
async subscribe(t) {
|
|
957
|
-
p(
|
|
958
|
-
await Ie({
|
|
959
|
-
client: this.client,
|
|
960
|
-
path: { api_product_id: t }
|
|
961
|
-
})
|
|
962
|
-
);
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
class lt {
|
|
966
|
-
constructor(t) {
|
|
967
|
-
this.client = t;
|
|
968
|
-
}
|
|
969
|
-
/**
|
|
970
|
-
* List all subscriptions.
|
|
971
|
-
* @param query Optional query parameters.
|
|
972
|
-
* @returns The list of subscriptions.
|
|
973
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
974
|
-
*/
|
|
975
|
-
async list(t) {
|
|
976
|
-
return p(
|
|
977
|
-
await Oe({ client: this.client, query: t })
|
|
978
|
-
);
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* Bulk subscribe to products
|
|
982
|
-
* @returns The created subscription.
|
|
983
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
984
|
-
*/
|
|
985
|
-
async bulkSubscribe(t) {
|
|
986
|
-
p(await qe({ client: this.client, data: t }));
|
|
987
|
-
}
|
|
988
|
-
/**
|
|
989
|
-
* Unsubscribe from a subscription by ID.
|
|
990
|
-
* @param id The subscription ID.
|
|
991
|
-
* @returns The result of the unsubscription.
|
|
992
|
-
* @throws {APIError} If the API request fails or network error occurs.
|
|
993
|
-
*/
|
|
994
|
-
async unsubscribe(t) {
|
|
995
|
-
p(
|
|
996
|
-
await Ue({
|
|
997
|
-
client: this.client,
|
|
998
|
-
path: { subscription_id: t }
|
|
999
|
-
})
|
|
1000
|
-
);
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
class dt {
|
|
1
|
+
import n from "axios";
|
|
2
|
+
import { c, A as d, a as p, C as P, D as l, b as A, M as h, S as u, d as I } from "./subscription-DPb2gn6N.js";
|
|
3
|
+
import { e as y } from "./subscription-DPb2gn6N.js";
|
|
4
|
+
class v {
|
|
1004
5
|
apiProduct;
|
|
1005
6
|
application;
|
|
1006
7
|
credential;
|
|
@@ -1009,17 +10,27 @@ class dt {
|
|
|
1009
10
|
misc;
|
|
1010
11
|
subscription;
|
|
1011
12
|
systemSetting;
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
13
|
+
proxy;
|
|
14
|
+
constructor(s) {
|
|
15
|
+
const t = s.axios ?? n.create();
|
|
16
|
+
t.defaults?.baseURL || (t.defaults.baseURL = s.endpoint), t.interceptors.request.use(async (e) => {
|
|
17
|
+
e.headers = e.headers ?? {};
|
|
18
|
+
const a = "Authorization";
|
|
19
|
+
e.headers[a] || (e.headers[a] = `Bearer ${s.token}`);
|
|
20
|
+
const i = "X-Portal-Developer-ID";
|
|
21
|
+
if (!e.headers[i])
|
|
22
|
+
try {
|
|
23
|
+
e.headers[i] = await s.getDeveloperId();
|
|
24
|
+
} catch (o) {
|
|
25
|
+
return Promise.reject(o);
|
|
26
|
+
}
|
|
27
|
+
return e;
|
|
1018
28
|
});
|
|
1019
|
-
|
|
29
|
+
const r = c({ axios: t });
|
|
30
|
+
this.apiProduct = new d(r), this.application = new p(r), this.credential = new P(r), this.dcrProvider = new l(r), this.developer = new A(r), this.misc = new h(r), this.subscription = new u(r), this.systemSetting = new I(r), this.proxy = (e) => t.request(e);
|
|
1020
31
|
}
|
|
1021
32
|
}
|
|
1022
33
|
export {
|
|
1023
|
-
|
|
1024
|
-
|
|
34
|
+
v as API7Portal,
|
|
35
|
+
y as APIError
|
|
1025
36
|
};
|