@api7/portal-sdk 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.cjs +1 -1
- package/dist/browser.js +2 -2
- package/dist/generated/client/client.gen.d.ts.map +1 -1
- package/dist/generated/client/types.gen.d.ts +1 -1
- package/dist/generated/client/types.gen.d.ts.map +1 -1
- package/dist/generated/client/utils.gen.d.ts.map +1 -1
- package/dist/generated/core/auth.gen.d.ts.map +1 -1
- package/dist/generated/core/bodySerializer.gen.d.ts +4 -4
- package/dist/generated/core/bodySerializer.gen.d.ts.map +1 -1
- package/dist/generated/core/params.gen.d.ts.map +1 -1
- package/dist/generated/core/pathSerializer.gen.d.ts.map +1 -1
- package/dist/generated/core/queryKeySerializer.gen.d.ts.map +1 -1
- package/dist/generated/core/serverSentEvents.gen.d.ts.map +1 -1
- package/dist/generated/core/types.gen.d.ts +1 -1
- package/dist/generated/core/types.gen.d.ts.map +1 -1
- package/dist/generated/core/utils.gen.d.ts.map +1 -1
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/sdk.gen.d.ts +4 -4
- package/dist/generated/types.gen.d.ts +16 -3
- package/dist/generated/types.gen.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/{subscription-CUxUCjEx.js → subscription-D3SjlqUh.js} +172 -189
- package/dist/subscription-D8NGq1RW.cjs +7 -0
- package/package.json +3 -3
- package/dist/subscription-KkQYwMqa.cjs +0 -7
|
@@ -1,114 +1,105 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import Y from "axios";
|
|
2
|
+
const Z = ({
|
|
3
3
|
onRequest: e,
|
|
4
4
|
onSseError: t,
|
|
5
5
|
onSseEvent: r,
|
|
6
6
|
responseTransformer: s,
|
|
7
7
|
responseValidator: i,
|
|
8
8
|
sseDefaultRetryDelay: l,
|
|
9
|
-
sseMaxRetryAttempts:
|
|
9
|
+
sseMaxRetryAttempts: a,
|
|
10
10
|
sseMaxRetryDelay: n,
|
|
11
11
|
sseSleepFn: o,
|
|
12
|
-
url:
|
|
13
|
-
...
|
|
12
|
+
url: h,
|
|
13
|
+
...d
|
|
14
14
|
}) => {
|
|
15
|
-
let
|
|
16
|
-
const
|
|
15
|
+
let c;
|
|
16
|
+
const f = o ?? ((T) => new Promise((m) => setTimeout(m, T)));
|
|
17
17
|
return { stream: async function* () {
|
|
18
|
-
let
|
|
19
|
-
const
|
|
20
|
-
for (; !
|
|
21
|
-
|
|
22
|
-
const k =
|
|
23
|
-
|
|
18
|
+
let T = l ?? 3e3, m = 0;
|
|
19
|
+
const b = d.signal ?? new AbortController().signal;
|
|
20
|
+
for (; !b.aborted; ) {
|
|
21
|
+
m++;
|
|
22
|
+
const k = d.headers instanceof Headers ? d.headers : new Headers(d.headers);
|
|
23
|
+
c !== void 0 && k.set("Last-Event-ID", c);
|
|
24
24
|
try {
|
|
25
|
-
const
|
|
25
|
+
const v = {
|
|
26
26
|
redirect: "follow",
|
|
27
|
-
...
|
|
28
|
-
body:
|
|
27
|
+
...d,
|
|
28
|
+
body: d.serializedBody,
|
|
29
29
|
headers: k,
|
|
30
|
-
signal:
|
|
30
|
+
signal: b
|
|
31
31
|
};
|
|
32
|
-
let
|
|
33
|
-
e && (
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (!_.body) throw new Error("No body in SSE response");
|
|
40
|
-
const D = _.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
41
|
-
let C = "";
|
|
32
|
+
let R = new Request(h, v);
|
|
33
|
+
e && (R = await e(h, v));
|
|
34
|
+
const S = await (d.fetch ?? globalThis.fetch)(R);
|
|
35
|
+
if (!S.ok) throw new Error(`SSE failed: ${S.status} ${S.statusText}`);
|
|
36
|
+
if (!S.body) throw new Error("No body in SSE response");
|
|
37
|
+
const D = S.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
38
|
+
let j = "";
|
|
42
39
|
const I = () => {
|
|
43
40
|
try {
|
|
44
41
|
D.cancel();
|
|
45
42
|
} catch {
|
|
46
43
|
}
|
|
47
44
|
};
|
|
48
|
-
|
|
45
|
+
b.addEventListener("abort", I);
|
|
49
46
|
try {
|
|
50
47
|
for (; ; ) {
|
|
51
|
-
const { done:
|
|
52
|
-
if (
|
|
53
|
-
|
|
48
|
+
const { done: G, value: K } = await D.read();
|
|
49
|
+
if (G) break;
|
|
50
|
+
j += K, j = j.replace(/\r\n/g, `
|
|
54
51
|
`).replace(/\r/g, `
|
|
55
52
|
`);
|
|
56
|
-
const O =
|
|
53
|
+
const O = j.split(`
|
|
57
54
|
|
|
58
55
|
`);
|
|
59
|
-
|
|
60
|
-
for (const
|
|
61
|
-
const
|
|
62
|
-
`),
|
|
63
|
-
let
|
|
64
|
-
for (const
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
else if (
|
|
68
|
-
|
|
69
|
-
else if (
|
|
70
|
-
|
|
71
|
-
else if (
|
|
72
|
-
const B = Number.parseInt(
|
|
73
|
-
|
|
74
|
-
10
|
|
75
|
-
);
|
|
76
|
-
Number.isNaN(B) || (b = B);
|
|
56
|
+
j = O.pop() ?? "";
|
|
57
|
+
for (const Q of O) {
|
|
58
|
+
const X = Q.split(`
|
|
59
|
+
`), E = [];
|
|
60
|
+
let U;
|
|
61
|
+
for (const y of X)
|
|
62
|
+
if (y.startsWith("data:"))
|
|
63
|
+
E.push(y.replace(/^data:\s*/, ""));
|
|
64
|
+
else if (y.startsWith("event:"))
|
|
65
|
+
U = y.replace(/^event:\s*/, "");
|
|
66
|
+
else if (y.startsWith("id:"))
|
|
67
|
+
c = y.replace(/^id:\s*/, "");
|
|
68
|
+
else if (y.startsWith("retry:")) {
|
|
69
|
+
const B = Number.parseInt(y.replace(/^retry:\s*/, ""), 10);
|
|
70
|
+
Number.isNaN(B) || (T = B);
|
|
77
71
|
}
|
|
78
|
-
let
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
72
|
+
let g, q = !1;
|
|
73
|
+
if (E.length) {
|
|
74
|
+
const y = E.join(`
|
|
81
75
|
`);
|
|
82
76
|
try {
|
|
83
|
-
|
|
77
|
+
g = JSON.parse(y), q = !0;
|
|
84
78
|
} catch {
|
|
85
|
-
|
|
79
|
+
g = y;
|
|
86
80
|
}
|
|
87
81
|
}
|
|
88
|
-
|
|
89
|
-
data:
|
|
90
|
-
event:
|
|
91
|
-
id:
|
|
92
|
-
retry:
|
|
93
|
-
}),
|
|
82
|
+
q && (i && await i(g), s && (g = await s(g))), r?.({
|
|
83
|
+
data: g,
|
|
84
|
+
event: U,
|
|
85
|
+
id: c,
|
|
86
|
+
retry: T
|
|
87
|
+
}), E.length && (yield g);
|
|
94
88
|
}
|
|
95
89
|
}
|
|
96
90
|
} finally {
|
|
97
|
-
|
|
91
|
+
b.removeEventListener("abort", I), D.releaseLock();
|
|
98
92
|
}
|
|
99
93
|
break;
|
|
100
|
-
} catch (
|
|
101
|
-
if (t?.(
|
|
94
|
+
} catch (v) {
|
|
95
|
+
if (t?.(v), a !== void 0 && m >= a)
|
|
102
96
|
break;
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
n ?? 3e4
|
|
106
|
-
);
|
|
107
|
-
await m(v);
|
|
97
|
+
const R = Math.min(T * 2 ** (m - 1), n ?? 3e4);
|
|
98
|
+
await f(R);
|
|
108
99
|
}
|
|
109
100
|
}
|
|
110
101
|
}() };
|
|
111
|
-
},
|
|
102
|
+
}, ee = (e) => {
|
|
112
103
|
switch (e) {
|
|
113
104
|
case "label":
|
|
114
105
|
return ".";
|
|
@@ -119,7 +110,7 @@ const Y = ({
|
|
|
119
110
|
default:
|
|
120
111
|
return "&";
|
|
121
112
|
}
|
|
122
|
-
},
|
|
113
|
+
}, te = (e) => {
|
|
123
114
|
switch (e) {
|
|
124
115
|
case "form":
|
|
125
116
|
return ",";
|
|
@@ -130,7 +121,7 @@ const Y = ({
|
|
|
130
121
|
default:
|
|
131
122
|
return ",";
|
|
132
123
|
}
|
|
133
|
-
},
|
|
124
|
+
}, re = (e) => {
|
|
134
125
|
switch (e) {
|
|
135
126
|
case "label":
|
|
136
127
|
return ".";
|
|
@@ -141,7 +132,7 @@ const Y = ({
|
|
|
141
132
|
default:
|
|
142
133
|
return "&";
|
|
143
134
|
}
|
|
144
|
-
},
|
|
135
|
+
}, H = ({
|
|
145
136
|
allowReserved: e,
|
|
146
137
|
explode: t,
|
|
147
138
|
name: r,
|
|
@@ -149,7 +140,7 @@ const Y = ({
|
|
|
149
140
|
value: i
|
|
150
141
|
}) => {
|
|
151
142
|
if (!t) {
|
|
152
|
-
const n = (e ? i : i.map((o) => encodeURIComponent(o))).join(
|
|
143
|
+
const n = (e ? i : i.map((o) => encodeURIComponent(o))).join(te(s));
|
|
153
144
|
switch (s) {
|
|
154
145
|
case "label":
|
|
155
146
|
return `.${n}`;
|
|
@@ -161,13 +152,13 @@ const Y = ({
|
|
|
161
152
|
return `${r}=${n}`;
|
|
162
153
|
}
|
|
163
154
|
}
|
|
164
|
-
const l =
|
|
155
|
+
const l = ee(s), a = i.map((n) => s === "label" || s === "simple" ? e ? n : encodeURIComponent(n) : x({
|
|
165
156
|
allowReserved: e,
|
|
166
157
|
name: r,
|
|
167
158
|
value: n
|
|
168
159
|
})).join(l);
|
|
169
|
-
return s === "label" || s === "matrix" ? l +
|
|
170
|
-
},
|
|
160
|
+
return s === "label" || s === "matrix" ? l + a : a;
|
|
161
|
+
}, x = ({
|
|
171
162
|
allowReserved: e,
|
|
172
163
|
name: t,
|
|
173
164
|
value: r
|
|
@@ -179,7 +170,7 @@ const Y = ({
|
|
|
179
170
|
"Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these."
|
|
180
171
|
);
|
|
181
172
|
return `${t}=${e ? r : encodeURIComponent(r)}`;
|
|
182
|
-
},
|
|
173
|
+
}, V = ({
|
|
183
174
|
allowReserved: e,
|
|
184
175
|
explode: t,
|
|
185
176
|
name: r,
|
|
@@ -191,56 +182,49 @@ const Y = ({
|
|
|
191
182
|
return l ? i.toISOString() : `${r}=${i.toISOString()}`;
|
|
192
183
|
if (s !== "deepObject" && !t) {
|
|
193
184
|
let o = [];
|
|
194
|
-
Object.entries(i).forEach(([
|
|
195
|
-
o = [
|
|
196
|
-
...o,
|
|
197
|
-
a,
|
|
198
|
-
e ? h : encodeURIComponent(h)
|
|
199
|
-
];
|
|
185
|
+
Object.entries(i).forEach(([d, c]) => {
|
|
186
|
+
o = [...o, d, e ? c : encodeURIComponent(c)];
|
|
200
187
|
});
|
|
201
|
-
const
|
|
188
|
+
const h = o.join(",");
|
|
202
189
|
switch (s) {
|
|
203
190
|
case "form":
|
|
204
|
-
return `${r}=${
|
|
191
|
+
return `${r}=${h}`;
|
|
205
192
|
case "label":
|
|
206
|
-
return `.${
|
|
193
|
+
return `.${h}`;
|
|
207
194
|
case "matrix":
|
|
208
|
-
return `;${r}=${
|
|
195
|
+
return `;${r}=${h}`;
|
|
209
196
|
default:
|
|
210
|
-
return
|
|
197
|
+
return h;
|
|
211
198
|
}
|
|
212
199
|
}
|
|
213
|
-
const
|
|
214
|
-
([o,
|
|
200
|
+
const a = re(s), n = Object.entries(i).map(
|
|
201
|
+
([o, h]) => x({
|
|
215
202
|
allowReserved: e,
|
|
216
203
|
name: s === "deepObject" ? `${r}[${o}]` : o,
|
|
217
|
-
value:
|
|
204
|
+
value: h
|
|
218
205
|
})
|
|
219
|
-
).join(
|
|
220
|
-
return s === "label" || s === "matrix" ?
|
|
221
|
-
},
|
|
206
|
+
).join(a);
|
|
207
|
+
return s === "label" || s === "matrix" ? a + n : n;
|
|
208
|
+
}, se = /\{[^{}]+\}/g, ie = ({ path: e, url: t }) => {
|
|
222
209
|
let r = t;
|
|
223
|
-
const s = t.match(
|
|
210
|
+
const s = t.match(se);
|
|
224
211
|
if (s)
|
|
225
212
|
for (const i of s) {
|
|
226
|
-
let l = !1,
|
|
227
|
-
|
|
228
|
-
const o = e[
|
|
213
|
+
let l = !1, a = i.substring(1, i.length - 1), n = "simple";
|
|
214
|
+
a.endsWith("*") && (l = !0, a = a.substring(0, a.length - 1)), a.startsWith(".") ? (a = a.substring(1), n = "label") : a.startsWith(";") && (a = a.substring(1), n = "matrix");
|
|
215
|
+
const o = e[a];
|
|
229
216
|
if (o == null)
|
|
230
217
|
continue;
|
|
231
218
|
if (Array.isArray(o)) {
|
|
232
|
-
r = r.replace(
|
|
233
|
-
i,
|
|
234
|
-
W({ explode: l, name: c, style: n, value: o })
|
|
235
|
-
);
|
|
219
|
+
r = r.replace(i, H({ explode: l, name: a, style: n, value: o }));
|
|
236
220
|
continue;
|
|
237
221
|
}
|
|
238
222
|
if (typeof o == "object") {
|
|
239
223
|
r = r.replace(
|
|
240
224
|
i,
|
|
241
|
-
|
|
225
|
+
V({
|
|
242
226
|
explode: l,
|
|
243
|
-
name:
|
|
227
|
+
name: a,
|
|
244
228
|
style: n,
|
|
245
229
|
value: o,
|
|
246
230
|
valueOnly: !0
|
|
@@ -251,20 +235,20 @@ const Y = ({
|
|
|
251
235
|
if (n === "matrix") {
|
|
252
236
|
r = r.replace(
|
|
253
237
|
i,
|
|
254
|
-
`;${
|
|
255
|
-
name:
|
|
238
|
+
`;${x({
|
|
239
|
+
name: a,
|
|
256
240
|
value: o
|
|
257
241
|
})}`
|
|
258
242
|
);
|
|
259
243
|
continue;
|
|
260
244
|
}
|
|
261
|
-
const
|
|
245
|
+
const h = encodeURIComponent(
|
|
262
246
|
n === "label" ? `.${o}` : o
|
|
263
247
|
);
|
|
264
|
-
r = r.replace(i,
|
|
248
|
+
r = r.replace(i, h);
|
|
265
249
|
}
|
|
266
250
|
return r;
|
|
267
|
-
},
|
|
251
|
+
}, ne = ({
|
|
268
252
|
baseUrl: e,
|
|
269
253
|
path: t,
|
|
270
254
|
query: r,
|
|
@@ -272,12 +256,12 @@ const Y = ({
|
|
|
272
256
|
url: i
|
|
273
257
|
}) => {
|
|
274
258
|
const l = i.startsWith("/") ? i : `/${i}`;
|
|
275
|
-
let
|
|
276
|
-
t && (
|
|
259
|
+
let a = (e ?? "") + l;
|
|
260
|
+
t && (a = ie({ path: t, url: a }));
|
|
277
261
|
let n = r ? s(r) : "";
|
|
278
|
-
return n.startsWith("?") && (n = n.substring(1)), n && (
|
|
262
|
+
return n.startsWith("?") && (n = n.substring(1)), n && (a += `?${n}`), a;
|
|
279
263
|
};
|
|
280
|
-
function
|
|
264
|
+
function N(e) {
|
|
281
265
|
const t = e.body !== void 0;
|
|
282
266
|
if (t && e.bodySerializer)
|
|
283
267
|
return "serializedBody" in e ? e.serializedBody !== void 0 && e.serializedBody !== "" ? e.serializedBody : null : e.body !== "" ? e.body : null;
|
|
@@ -295,35 +279,35 @@ const ae = async (e, t) => {
|
|
|
295
279
|
const i = [];
|
|
296
280
|
if (s && typeof s == "object")
|
|
297
281
|
for (const l in s) {
|
|
298
|
-
const
|
|
299
|
-
if (
|
|
282
|
+
const a = s[l];
|
|
283
|
+
if (a == null)
|
|
300
284
|
continue;
|
|
301
285
|
const n = e[l] || t;
|
|
302
|
-
if (Array.isArray(
|
|
303
|
-
const o =
|
|
286
|
+
if (Array.isArray(a)) {
|
|
287
|
+
const o = H({
|
|
304
288
|
allowReserved: n.allowReserved,
|
|
305
289
|
explode: !0,
|
|
306
290
|
name: l,
|
|
307
291
|
style: "form",
|
|
308
|
-
value:
|
|
292
|
+
value: a,
|
|
309
293
|
...n.array
|
|
310
294
|
});
|
|
311
295
|
o && i.push(o);
|
|
312
|
-
} else if (typeof
|
|
313
|
-
const o =
|
|
296
|
+
} else if (typeof a == "object") {
|
|
297
|
+
const o = V({
|
|
314
298
|
allowReserved: n.allowReserved,
|
|
315
299
|
explode: !0,
|
|
316
300
|
name: l,
|
|
317
301
|
style: "deepObject",
|
|
318
|
-
value:
|
|
302
|
+
value: a,
|
|
319
303
|
...n.object
|
|
320
304
|
});
|
|
321
305
|
o && i.push(o);
|
|
322
306
|
} else {
|
|
323
|
-
const o =
|
|
307
|
+
const o = x({
|
|
324
308
|
allowReserved: n.allowReserved,
|
|
325
309
|
name: l,
|
|
326
|
-
value:
|
|
310
|
+
value: a
|
|
327
311
|
});
|
|
328
312
|
o && i.push(o);
|
|
329
313
|
}
|
|
@@ -355,9 +339,9 @@ const ae = async (e, t) => {
|
|
|
355
339
|
break;
|
|
356
340
|
}
|
|
357
341
|
}
|
|
358
|
-
},
|
|
342
|
+
}, L = (e) => {
|
|
359
343
|
const t = e.axios?.defaults?.baseURL, r = e.baseURL && typeof e.baseURL == "string" ? e.baseURL : t;
|
|
360
|
-
return
|
|
344
|
+
return ne({
|
|
361
345
|
baseUrl: r,
|
|
362
346
|
path: e.path,
|
|
363
347
|
// let `paramsSerializer()` handle query params if it exists
|
|
@@ -365,7 +349,7 @@ const ae = async (e, t) => {
|
|
|
365
349
|
querySerializer: typeof e.querySerializer == "function" ? e.querySerializer : ce(e.querySerializer),
|
|
366
350
|
url: e.url
|
|
367
351
|
});
|
|
368
|
-
},
|
|
352
|
+
}, W = (e, t) => {
|
|
369
353
|
const r = { ...e, ...t };
|
|
370
354
|
return r.headers = $(e.headers, t.headers), r;
|
|
371
355
|
}, pe = [
|
|
@@ -383,9 +367,7 @@ const ae = async (e, t) => {
|
|
|
383
367
|
continue;
|
|
384
368
|
const s = Object.entries(r);
|
|
385
369
|
for (const [i, l] of s)
|
|
386
|
-
if (pe.includes(
|
|
387
|
-
i
|
|
388
|
-
) && typeof l == "object")
|
|
370
|
+
if (pe.includes(i) && typeof l == "object")
|
|
389
371
|
t[i] = {
|
|
390
372
|
...t[i],
|
|
391
373
|
...l
|
|
@@ -393,77 +375,78 @@ const ae = async (e, t) => {
|
|
|
393
375
|
else if (l === null)
|
|
394
376
|
delete t[i];
|
|
395
377
|
else if (Array.isArray(l))
|
|
396
|
-
for (const
|
|
397
|
-
t[i] = [...t[i] ?? [],
|
|
378
|
+
for (const a of l)
|
|
379
|
+
t[i] = [...t[i] ?? [], a];
|
|
398
380
|
else l !== void 0 && (t[i] = typeof l == "object" ? JSON.stringify(l) : l);
|
|
399
381
|
}
|
|
400
382
|
return t;
|
|
401
|
-
},
|
|
383
|
+
}, M = (e = {}) => ({
|
|
402
384
|
...e
|
|
403
385
|
}), ue = (e = {}) => {
|
|
404
|
-
let t =
|
|
386
|
+
let t = W(M(), e), r;
|
|
405
387
|
if (t.axios && !("Axios" in t.axios))
|
|
406
388
|
r = t.axios;
|
|
407
389
|
else {
|
|
408
|
-
const { auth: d, ...
|
|
409
|
-
r =
|
|
390
|
+
const { auth: d, ...c } = t;
|
|
391
|
+
r = Y.create(c);
|
|
410
392
|
}
|
|
411
|
-
const s = () => ({ ...t }), i = (d) => (t =
|
|
393
|
+
const s = () => ({ ...t }), i = (d) => (t = W(t, d), r.defaults = {
|
|
412
394
|
...r.defaults,
|
|
413
395
|
...t,
|
|
414
396
|
// @ts-expect-error
|
|
415
397
|
headers: $(r.defaults.headers, t.headers)
|
|
416
398
|
}, s()), l = async (d) => {
|
|
417
|
-
const
|
|
399
|
+
const c = {
|
|
418
400
|
...t,
|
|
419
401
|
...d,
|
|
420
402
|
axios: d.axios ?? t.axios ?? r,
|
|
421
403
|
headers: $(t.headers, d.headers)
|
|
422
404
|
};
|
|
423
|
-
|
|
424
|
-
...
|
|
425
|
-
security:
|
|
426
|
-
}),
|
|
427
|
-
const
|
|
428
|
-
return { opts:
|
|
429
|
-
},
|
|
430
|
-
const { opts:
|
|
405
|
+
c.security && await le({
|
|
406
|
+
...c,
|
|
407
|
+
security: c.security
|
|
408
|
+
}), c.requestValidator && await c.requestValidator(c), c.body !== void 0 && c.bodySerializer && (c.body = c.bodySerializer(c.body));
|
|
409
|
+
const f = L(c);
|
|
410
|
+
return { opts: c, url: f };
|
|
411
|
+
}, a = async (d) => {
|
|
412
|
+
const { opts: c, url: f } = await l(d);
|
|
431
413
|
try {
|
|
432
|
-
const
|
|
433
|
-
...
|
|
414
|
+
const w = c.axios, { auth: _, ...T } = c, m = await w({
|
|
415
|
+
...T,
|
|
434
416
|
baseURL: "",
|
|
435
417
|
// the baseURL is already included in `url`
|
|
436
|
-
data:
|
|
437
|
-
headers:
|
|
418
|
+
data: N(c),
|
|
419
|
+
headers: c.headers,
|
|
438
420
|
// let `paramsSerializer()` handle query params if it exists
|
|
439
|
-
params:
|
|
440
|
-
url:
|
|
421
|
+
params: c.paramsSerializer ? c.query : void 0,
|
|
422
|
+
url: f
|
|
441
423
|
});
|
|
442
|
-
let { data:
|
|
443
|
-
return
|
|
444
|
-
...
|
|
445
|
-
data:
|
|
424
|
+
let { data: b } = m;
|
|
425
|
+
return c.responseType === "json" && (c.responseValidator && await c.responseValidator(b), c.responseTransformer && (b = await c.responseTransformer(b))), {
|
|
426
|
+
...m,
|
|
427
|
+
data: b ?? {}
|
|
446
428
|
};
|
|
447
|
-
} catch (
|
|
448
|
-
const
|
|
449
|
-
if (
|
|
450
|
-
throw
|
|
451
|
-
return
|
|
429
|
+
} catch (w) {
|
|
430
|
+
const _ = w;
|
|
431
|
+
if (c.throwOnError)
|
|
432
|
+
throw _;
|
|
433
|
+
return _.error = _.response?.data ?? {}, _;
|
|
452
434
|
}
|
|
453
|
-
}, n = (d) => (
|
|
454
|
-
const { opts:
|
|
455
|
-
return
|
|
456
|
-
...
|
|
457
|
-
body:
|
|
458
|
-
headers:
|
|
435
|
+
}, n = (d) => (c) => a({ ...c, method: d }), o = (d) => async (c) => {
|
|
436
|
+
const { opts: f, url: w } = await l(c);
|
|
437
|
+
return Z({
|
|
438
|
+
...f,
|
|
439
|
+
body: f.body,
|
|
440
|
+
headers: f.headers,
|
|
459
441
|
method: d,
|
|
442
|
+
serializedBody: N(f),
|
|
460
443
|
// @ts-expect-error
|
|
461
|
-
signal:
|
|
462
|
-
url:
|
|
444
|
+
signal: f.signal,
|
|
445
|
+
url: w
|
|
463
446
|
});
|
|
464
447
|
};
|
|
465
448
|
return {
|
|
466
|
-
buildUrl:
|
|
449
|
+
buildUrl: (d) => L({ axios: r, ...t, ...d }),
|
|
467
450
|
connect: n("CONNECT"),
|
|
468
451
|
delete: n("DELETE"),
|
|
469
452
|
get: n("GET"),
|
|
@@ -474,7 +457,7 @@ const ae = async (e, t) => {
|
|
|
474
457
|
patch: n("PATCH"),
|
|
475
458
|
post: n("POST"),
|
|
476
459
|
put: n("PUT"),
|
|
477
|
-
request:
|
|
460
|
+
request: a,
|
|
478
461
|
setConfig: i,
|
|
479
462
|
sse: {
|
|
480
463
|
connect: o("CONNECT"),
|
|
@@ -489,7 +472,7 @@ const ae = async (e, t) => {
|
|
|
489
472
|
},
|
|
490
473
|
trace: n("TRACE")
|
|
491
474
|
};
|
|
492
|
-
}, u = ue(
|
|
475
|
+
}, u = ue(M()), A = (e) => (e = new Date(e), e), F = (e) => (e.last_active_at && (e.last_active_at = A(e.last_active_at)), e.created_at = A(e.created_at), e.updated_at = A(e.updated_at), e), de = async (e) => (e.list = e.list.map((t) => F(t)), e), he = async (e) => (e = F(e), e), fe = (e) => (e.subscribed_at && (e.subscribed_at = A(e.subscribed_at)), e), ye = async (e) => (e.list = e.list.map((t) => fe(t)), e), J = (e) => (e.created_at = A(e.created_at), e.updated_at = A(e.updated_at), e), z = (e) => (e = J(e), e), be = (e) => (e = z(e), e), me = async (e) => (e.list = e.list.map((t) => be(t)), e), Te = async (e) => (e = z(e), e), ge = async (e) => (e = z(e), e), we = async (e) => (e = z(e), e), C = (e) => (e = J(e), e), _e = async (e) => (e.list = e.list.map((t) => C(t)), e), Ae = async (e) => (e = C(e), e), Ce = async (e) => (e = C(e), e), Se = async (e) => (e = C(e), e), je = async (e) => (e = C(e), e), ve = async (e) => (e.list = e.list.map((t) => C(t)), e), Re = (e) => (e?.client ?? u).get({
|
|
493
476
|
responseTransformer: de,
|
|
494
477
|
responseType: "json",
|
|
495
478
|
url: "/api/developers",
|
|
@@ -507,18 +490,18 @@ const ae = async (e, t) => {
|
|
|
507
490
|
responseType: "json",
|
|
508
491
|
url: "/api/api_products",
|
|
509
492
|
...e
|
|
510
|
-
}),
|
|
493
|
+
}), ze = (e) => (e.client ?? u).get({
|
|
511
494
|
responseType: "json",
|
|
512
495
|
url: "/api/api_products/{api_product_id}",
|
|
513
496
|
...e
|
|
514
|
-
}),
|
|
497
|
+
}), De = (e) => (e.client ?? u).post({
|
|
515
498
|
url: "/api/api_products/{api_product_id}/subscriptions",
|
|
516
499
|
...e,
|
|
517
500
|
headers: {
|
|
518
501
|
"Content-Type": "application/json",
|
|
519
502
|
...e.headers
|
|
520
503
|
}
|
|
521
|
-
}),
|
|
504
|
+
}), $e = (e) => (e?.client ?? u).get({
|
|
522
505
|
responseTransformer: ye,
|
|
523
506
|
responseType: "json",
|
|
524
507
|
url: "/api/subscriptions",
|
|
@@ -535,7 +518,7 @@ const ae = async (e, t) => {
|
|
|
535
518
|
responseType: "json",
|
|
536
519
|
url: "/api/applications",
|
|
537
520
|
...e
|
|
538
|
-
}),
|
|
521
|
+
}), Ue = (e) => (e?.client ?? u).post({
|
|
539
522
|
responseTransformer: Te,
|
|
540
523
|
responseType: "json",
|
|
541
524
|
url: "/api/applications",
|
|
@@ -544,7 +527,7 @@ const ae = async (e, t) => {
|
|
|
544
527
|
"Content-Type": "application/json",
|
|
545
528
|
...e?.headers
|
|
546
529
|
}
|
|
547
|
-
}),
|
|
530
|
+
}), qe = (e) => (e.client ?? u).delete({ url: "/api/applications/{application_id}", ...e }), Be = (e) => (e.client ?? u).get({
|
|
548
531
|
responseTransformer: ge,
|
|
549
532
|
responseType: "json",
|
|
550
533
|
url: "/api/applications/{application_id}",
|
|
@@ -559,12 +542,12 @@ const ae = async (e, t) => {
|
|
|
559
542
|
...e.headers
|
|
560
543
|
}
|
|
561
544
|
}), Le = (e) => (e.client ?? u).get({
|
|
562
|
-
responseTransformer:
|
|
545
|
+
responseTransformer: _e,
|
|
563
546
|
responseType: "json",
|
|
564
547
|
url: "/api/applications/{application_id}/credentials",
|
|
565
548
|
...e
|
|
566
549
|
}), We = (e) => (e.client ?? u).post({
|
|
567
|
-
responseTransformer:
|
|
550
|
+
responseTransformer: Ae,
|
|
568
551
|
responseType: "json",
|
|
569
552
|
url: "/api/applications/{application_id}/credentials",
|
|
570
553
|
...e,
|
|
@@ -617,14 +600,14 @@ const ae = async (e, t) => {
|
|
|
617
600
|
url: "/api/dcr_providers",
|
|
618
601
|
...e
|
|
619
602
|
});
|
|
620
|
-
class
|
|
603
|
+
class P extends Error {
|
|
621
604
|
constructor(t, r, s, i, l) {
|
|
622
605
|
super(t), this.message = t, this.status = r, this.method = s, this.url = i, this.stack = void 0, this.#e = l;
|
|
623
606
|
}
|
|
624
607
|
#e;
|
|
625
608
|
static fromAxiosError = (t) => {
|
|
626
609
|
const r = t.error && t.error.error_msg;
|
|
627
|
-
return new
|
|
610
|
+
return new P(
|
|
628
611
|
`Request failed: ${r || (t.status ? `with status code ${t.status}` : t.message)}`,
|
|
629
612
|
t.status ?? 0,
|
|
630
613
|
t.config?.method?.toUpperCase() ?? "",
|
|
@@ -637,7 +620,7 @@ class E extends Error {
|
|
|
637
620
|
* @param error The error to check.
|
|
638
621
|
* @returns True if the error is an instance of APIError, false otherwise.
|
|
639
622
|
*/
|
|
640
|
-
static isAPIError = (t) => t instanceof
|
|
623
|
+
static isAPIError = (t) => t instanceof P;
|
|
641
624
|
/**
|
|
642
625
|
* Get the original raw Axios error.
|
|
643
626
|
* @returns {AxiosError} The original Axios error.
|
|
@@ -648,7 +631,7 @@ class E extends Error {
|
|
|
648
631
|
}
|
|
649
632
|
const p = (e) => {
|
|
650
633
|
if (e.error || e.status && e.status >= 400)
|
|
651
|
-
throw
|
|
634
|
+
throw P.fromAxiosError(e);
|
|
652
635
|
return e.data;
|
|
653
636
|
};
|
|
654
637
|
class Ye {
|
|
@@ -795,7 +778,7 @@ class rt {
|
|
|
795
778
|
*/
|
|
796
779
|
async create(t) {
|
|
797
780
|
return p(
|
|
798
|
-
await
|
|
781
|
+
await Ue({
|
|
799
782
|
client: this.client,
|
|
800
783
|
body: t
|
|
801
784
|
})
|
|
@@ -849,7 +832,7 @@ class rt {
|
|
|
849
832
|
*/
|
|
850
833
|
async delete(t) {
|
|
851
834
|
p(
|
|
852
|
-
await
|
|
835
|
+
await qe({
|
|
853
836
|
client: this.client,
|
|
854
837
|
path: { application_id: t }
|
|
855
838
|
})
|
|
@@ -976,7 +959,7 @@ class ct {
|
|
|
976
959
|
*/
|
|
977
960
|
async get(t) {
|
|
978
961
|
return p(
|
|
979
|
-
await
|
|
962
|
+
await ze({
|
|
980
963
|
client: this.client,
|
|
981
964
|
path: { api_product_id: t }
|
|
982
965
|
})
|
|
@@ -990,7 +973,7 @@ class ct {
|
|
|
990
973
|
*/
|
|
991
974
|
async subscribe(t, r) {
|
|
992
975
|
p(
|
|
993
|
-
await
|
|
976
|
+
await De({
|
|
994
977
|
client: this.client,
|
|
995
978
|
path: { api_product_id: t },
|
|
996
979
|
body: r
|
|
@@ -1010,7 +993,7 @@ class ot {
|
|
|
1010
993
|
*/
|
|
1011
994
|
async list(t) {
|
|
1012
995
|
return p(
|
|
1013
|
-
await
|
|
996
|
+
await $e({ client: this.client, query: t })
|
|
1014
997
|
);
|
|
1015
998
|
}
|
|
1016
999
|
/**
|
|
@@ -1049,5 +1032,5 @@ export {
|
|
|
1049
1032
|
at as b,
|
|
1050
1033
|
ue as c,
|
|
1051
1034
|
it as d,
|
|
1052
|
-
|
|
1035
|
+
P as e
|
|
1053
1036
|
};
|