@eudiplo/sdk-core 1.14.0-main.4e97beb → 1.14.0-main.51fa8d2
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 +54 -15
- package/dist/api/client/client.gen.d.mts +1 -1
- package/dist/api/client/client.gen.d.ts +1 -1
- package/dist/api/client/client.gen.js +102 -138
- package/dist/api/client/client.gen.mjs +102 -138
- package/dist/api/client/index.d.mts +4 -4
- package/dist/api/client/index.d.ts +4 -4
- package/dist/api/client/index.js +105 -145
- package/dist/api/client/index.mjs +105 -145
- package/dist/api/client/types.gen.d.mts +1 -1
- package/dist/api/client/types.gen.d.ts +1 -1
- package/dist/api/client.gen.d.mts +2 -2
- package/dist/api/client.gen.d.ts +2 -2
- package/dist/api/client.gen.js +103 -141
- package/dist/api/client.gen.mjs +103 -141
- package/dist/api/index.d.mts +226 -174
- package/dist/api/index.d.ts +226 -174
- package/dist/api/index.js +492 -344
- package/dist/api/index.mjs +442 -306
- package/dist/index.d.mts +167 -9
- package/dist/index.d.ts +167 -9
- package/dist/index.js +1122 -351
- package/dist/index.mjs +1065 -313
- package/dist/{types.gen-DDunhhsd.d.mts → types.gen-B0nhFpj5.d.mts} +38 -31
- package/dist/{types.gen-DDunhhsd.d.ts → types.gen-B0nhFpj5.d.ts} +38 -31
- package/dist/types.gen-BXTtmC9a.d.mts +4476 -0
- package/dist/types.gen-BXTtmC9a.d.ts +4476 -0
- package/package.json +10 -8
- package/dist/types.gen-BLJOziWG.d.mts +0 -2798
- package/dist/types.gen-BLJOziWG.d.ts +0 -2798
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/api/core/serverSentEvents.gen.ts
|
|
2
|
-
|
|
2
|
+
function createSseClient({
|
|
3
3
|
onRequest,
|
|
4
4
|
onSseError,
|
|
5
5
|
onSseEvent,
|
|
@@ -11,7 +11,7 @@ var createSseClient = ({
|
|
|
11
11
|
sseSleepFn,
|
|
12
12
|
url,
|
|
13
13
|
...options
|
|
14
|
-
})
|
|
14
|
+
}) {
|
|
15
15
|
let lastEventId;
|
|
16
16
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
17
17
|
const createStream = async function* () {
|
|
@@ -39,10 +39,7 @@ var createSseClient = ({
|
|
|
39
39
|
}
|
|
40
40
|
const _fetch = options.fetch ?? globalThis.fetch;
|
|
41
41
|
const response = await _fetch(request);
|
|
42
|
-
if (!response.ok)
|
|
43
|
-
throw new Error(
|
|
44
|
-
`SSE failed: ${response.status} ${response.statusText}`
|
|
45
|
-
);
|
|
42
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
46
43
|
if (!response.body) throw new Error("No body in SSE response");
|
|
47
44
|
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
48
45
|
let buffer = "";
|
|
@@ -58,7 +55,7 @@ var createSseClient = ({
|
|
|
58
55
|
const { done, value } = await reader.read();
|
|
59
56
|
if (done) break;
|
|
60
57
|
buffer += value;
|
|
61
|
-
buffer = buffer.replace(/\r\n
|
|
58
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
62
59
|
const chunks = buffer.split("\n\n");
|
|
63
60
|
buffer = chunks.pop() ?? "";
|
|
64
61
|
for (const chunk of chunks) {
|
|
@@ -73,10 +70,7 @@ var createSseClient = ({
|
|
|
73
70
|
} else if (line.startsWith("id:")) {
|
|
74
71
|
lastEventId = line.replace(/^id:\s*/, "");
|
|
75
72
|
} else if (line.startsWith("retry:")) {
|
|
76
|
-
const parsed = Number.parseInt(
|
|
77
|
-
line.replace(/^retry:\s*/, ""),
|
|
78
|
-
10
|
|
79
|
-
);
|
|
73
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
80
74
|
if (!Number.isNaN(parsed)) {
|
|
81
75
|
retryDelay = parsed;
|
|
82
76
|
}
|
|
@@ -122,17 +116,14 @@ var createSseClient = ({
|
|
|
122
116
|
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
123
117
|
break;
|
|
124
118
|
}
|
|
125
|
-
const backoff = Math.min(
|
|
126
|
-
retryDelay * 2 ** (attempt - 1),
|
|
127
|
-
sseMaxRetryDelay ?? 3e4
|
|
128
|
-
);
|
|
119
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
129
120
|
await sleep(backoff);
|
|
130
121
|
}
|
|
131
122
|
}
|
|
132
123
|
};
|
|
133
124
|
const stream = createStream();
|
|
134
125
|
return { stream };
|
|
135
|
-
}
|
|
126
|
+
}
|
|
136
127
|
|
|
137
128
|
// src/api/core/pathSerializer.gen.ts
|
|
138
129
|
var separatorArrayExplode = (style) => {
|
|
@@ -233,11 +224,7 @@ var serializeObjectParam = ({
|
|
|
233
224
|
if (style !== "deepObject" && !explode) {
|
|
234
225
|
let values = [];
|
|
235
226
|
Object.entries(value).forEach(([key, v]) => {
|
|
236
|
-
values = [
|
|
237
|
-
...values,
|
|
238
|
-
key,
|
|
239
|
-
allowReserved ? v : encodeURIComponent(v)
|
|
240
|
-
];
|
|
227
|
+
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
241
228
|
});
|
|
242
229
|
const joinedValues2 = values.join(",");
|
|
243
230
|
switch (style) {
|
|
@@ -288,10 +275,7 @@ var defaultPathSerializer = ({ path, url: _url }) => {
|
|
|
288
275
|
continue;
|
|
289
276
|
}
|
|
290
277
|
if (Array.isArray(value)) {
|
|
291
|
-
url = url.replace(
|
|
292
|
-
match,
|
|
293
|
-
serializeArrayParam({ explode, name, style, value })
|
|
294
|
-
);
|
|
278
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
295
279
|
continue;
|
|
296
280
|
}
|
|
297
281
|
if (typeof value === "object") {
|
|
@@ -379,10 +363,7 @@ var getAuthToken = async (auth, callback) => {
|
|
|
379
363
|
|
|
380
364
|
// src/api/core/bodySerializer.gen.ts
|
|
381
365
|
var jsonBodySerializer = {
|
|
382
|
-
bodySerializer: (body) => JSON.stringify(
|
|
383
|
-
body,
|
|
384
|
-
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
385
|
-
)
|
|
366
|
+
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
|
|
386
367
|
};
|
|
387
368
|
|
|
388
369
|
// src/api/client/utils.gen.ts
|
|
@@ -447,9 +428,7 @@ var getParseAs = (contentType) => {
|
|
|
447
428
|
if (cleanContent === "multipart/form-data") {
|
|
448
429
|
return "formData";
|
|
449
430
|
}
|
|
450
|
-
if (["application/", "audio/", "image/", "video/"].some(
|
|
451
|
-
(type) => cleanContent.startsWith(type)
|
|
452
|
-
)) {
|
|
431
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
453
432
|
return "blob";
|
|
454
433
|
}
|
|
455
434
|
if (cleanContent.startsWith("text/")) {
|
|
@@ -635,136 +614,121 @@ var createClient = (config = {}) => {
|
|
|
635
614
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
636
615
|
opts.headers.delete("Content-Type");
|
|
637
616
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
617
|
+
const resolvedOpts = opts;
|
|
618
|
+
const url = buildUrl(resolvedOpts);
|
|
619
|
+
return { opts: resolvedOpts, url };
|
|
640
620
|
};
|
|
641
621
|
const request = async (options) => {
|
|
642
|
-
const
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
...opts,
|
|
646
|
-
body: getValidRequestBody(opts)
|
|
647
|
-
};
|
|
648
|
-
let request2 = new Request(url, requestInit);
|
|
649
|
-
for (const fn of interceptors.request.fns) {
|
|
650
|
-
if (fn) {
|
|
651
|
-
request2 = await fn(request2, opts);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
const _fetch = opts.fetch;
|
|
622
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
623
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
624
|
+
let request2;
|
|
655
625
|
let response;
|
|
656
626
|
try {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
627
|
+
const { opts, url } = await beforeRequest(options);
|
|
628
|
+
const requestInit = {
|
|
629
|
+
redirect: "follow",
|
|
630
|
+
...opts,
|
|
631
|
+
body: getValidRequestBody(opts)
|
|
632
|
+
};
|
|
633
|
+
request2 = new Request(url, requestInit);
|
|
634
|
+
for (const fn of interceptors.request.fns) {
|
|
661
635
|
if (fn) {
|
|
662
|
-
|
|
663
|
-
error2,
|
|
664
|
-
void 0,
|
|
665
|
-
request2,
|
|
666
|
-
opts
|
|
667
|
-
);
|
|
636
|
+
request2 = await fn(request2, opts);
|
|
668
637
|
}
|
|
669
638
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
639
|
+
const _fetch = opts.fetch;
|
|
640
|
+
response = await _fetch(request2);
|
|
641
|
+
for (const fn of interceptors.response.fns) {
|
|
642
|
+
if (fn) {
|
|
643
|
+
response = await fn(response, request2, opts);
|
|
644
|
+
}
|
|
673
645
|
}
|
|
674
|
-
|
|
675
|
-
error: finalError2,
|
|
646
|
+
const result = {
|
|
676
647
|
request: request2,
|
|
677
|
-
response
|
|
648
|
+
response
|
|
678
649
|
};
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
650
|
+
if (response.ok) {
|
|
651
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
652
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
653
|
+
let emptyData;
|
|
654
|
+
switch (parseAs) {
|
|
655
|
+
case "arrayBuffer":
|
|
656
|
+
case "blob":
|
|
657
|
+
case "text":
|
|
658
|
+
emptyData = await response[parseAs]();
|
|
659
|
+
break;
|
|
660
|
+
case "formData":
|
|
661
|
+
emptyData = new FormData();
|
|
662
|
+
break;
|
|
663
|
+
case "stream":
|
|
664
|
+
emptyData = response.body;
|
|
665
|
+
break;
|
|
666
|
+
case "json":
|
|
667
|
+
default:
|
|
668
|
+
emptyData = {};
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
672
|
+
data: emptyData,
|
|
673
|
+
...result
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
let data;
|
|
693
677
|
switch (parseAs) {
|
|
694
678
|
case "arrayBuffer":
|
|
695
679
|
case "blob":
|
|
680
|
+
case "formData":
|
|
696
681
|
case "text":
|
|
697
|
-
|
|
682
|
+
data = await response[parseAs]();
|
|
698
683
|
break;
|
|
699
|
-
case "
|
|
700
|
-
|
|
684
|
+
case "json": {
|
|
685
|
+
const text = await response.text();
|
|
686
|
+
data = text ? JSON.parse(text) : {};
|
|
701
687
|
break;
|
|
688
|
+
}
|
|
702
689
|
case "stream":
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
emptyData = {};
|
|
708
|
-
break;
|
|
690
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
691
|
+
data: response.body,
|
|
692
|
+
...result
|
|
693
|
+
};
|
|
709
694
|
}
|
|
710
|
-
|
|
711
|
-
|
|
695
|
+
if (parseAs === "json") {
|
|
696
|
+
if (opts.responseValidator) {
|
|
697
|
+
await opts.responseValidator(data);
|
|
698
|
+
}
|
|
699
|
+
if (opts.responseTransformer) {
|
|
700
|
+
data = await opts.responseTransformer(data);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return opts.responseStyle === "data" ? data : {
|
|
704
|
+
data,
|
|
712
705
|
...result
|
|
713
706
|
};
|
|
714
707
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
case "text":
|
|
721
|
-
data = await response[parseAs]();
|
|
722
|
-
break;
|
|
723
|
-
case "json": {
|
|
724
|
-
const text = await response.text();
|
|
725
|
-
data = text ? JSON.parse(text) : {};
|
|
726
|
-
break;
|
|
727
|
-
}
|
|
728
|
-
case "stream":
|
|
729
|
-
return opts.responseStyle === "data" ? response.body : {
|
|
730
|
-
data: response.body,
|
|
731
|
-
...result
|
|
732
|
-
};
|
|
708
|
+
const textError = await response.text();
|
|
709
|
+
let jsonError;
|
|
710
|
+
try {
|
|
711
|
+
jsonError = JSON.parse(textError);
|
|
712
|
+
} catch {
|
|
733
713
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
if (
|
|
739
|
-
|
|
714
|
+
throw jsonError ?? textError;
|
|
715
|
+
} catch (error) {
|
|
716
|
+
let finalError = error;
|
|
717
|
+
for (const fn of interceptors.error.fns) {
|
|
718
|
+
if (fn) {
|
|
719
|
+
finalError = await fn(finalError, response, request2, options);
|
|
740
720
|
}
|
|
741
721
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
};
|
|
746
|
-
}
|
|
747
|
-
const textError = await response.text();
|
|
748
|
-
let jsonError;
|
|
749
|
-
try {
|
|
750
|
-
jsonError = JSON.parse(textError);
|
|
751
|
-
} catch {
|
|
752
|
-
}
|
|
753
|
-
const error = jsonError ?? textError;
|
|
754
|
-
let finalError = error;
|
|
755
|
-
for (const fn of interceptors.error.fns) {
|
|
756
|
-
if (fn) {
|
|
757
|
-
finalError = await fn(error, response, request2, opts);
|
|
722
|
+
finalError = finalError || {};
|
|
723
|
+
if (throwOnError) {
|
|
724
|
+
throw finalError;
|
|
758
725
|
}
|
|
726
|
+
return responseStyle === "data" ? void 0 : {
|
|
727
|
+
error: finalError,
|
|
728
|
+
request: request2,
|
|
729
|
+
response
|
|
730
|
+
};
|
|
759
731
|
}
|
|
760
|
-
finalError = finalError || {};
|
|
761
|
-
if (opts.throwOnError) {
|
|
762
|
-
throw finalError;
|
|
763
|
-
}
|
|
764
|
-
return opts.responseStyle === "data" ? void 0 : {
|
|
765
|
-
error: finalError,
|
|
766
|
-
...result
|
|
767
|
-
};
|
|
768
732
|
};
|
|
769
733
|
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
770
734
|
const makeSseFn = (method) => async (options) => {
|
|
@@ -772,7 +736,6 @@ var createClient = (config = {}) => {
|
|
|
772
736
|
return createSseClient({
|
|
773
737
|
...opts,
|
|
774
738
|
body: opts.body,
|
|
775
|
-
headers: opts.headers,
|
|
776
739
|
method,
|
|
777
740
|
onRequest: async (url2, init) => {
|
|
778
741
|
let request2 = new Request(url2, init);
|
|
@@ -787,8 +750,9 @@ var createClient = (config = {}) => {
|
|
|
787
750
|
url
|
|
788
751
|
});
|
|
789
752
|
};
|
|
753
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
790
754
|
return {
|
|
791
|
-
buildUrl,
|
|
755
|
+
buildUrl: _buildUrl,
|
|
792
756
|
connect: makeMethodFn("CONNECT"),
|
|
793
757
|
delete: makeMethodFn("DELETE"),
|
|
794
758
|
get: makeMethodFn("GET"),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-
|
|
1
|
+
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-B0nhFpj5.mjs';
|
|
2
2
|
export { createClient } from './client.gen.mjs';
|
|
3
3
|
|
|
4
|
-
type Slot =
|
|
4
|
+
type Slot = 'body' | 'headers' | 'path' | 'query';
|
|
5
5
|
type Field = {
|
|
6
|
-
in: Exclude<Slot,
|
|
6
|
+
in: Exclude<Slot, 'body'>;
|
|
7
7
|
/**
|
|
8
8
|
* Field name. This is the name we want the user to see and use.
|
|
9
9
|
*/
|
|
@@ -14,7 +14,7 @@ type Field = {
|
|
|
14
14
|
*/
|
|
15
15
|
map?: string;
|
|
16
16
|
} | {
|
|
17
|
-
in: Extract<Slot,
|
|
17
|
+
in: Extract<Slot, 'body'>;
|
|
18
18
|
/**
|
|
19
19
|
* Key isn't required for bodies.
|
|
20
20
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-
|
|
1
|
+
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-B0nhFpj5.js';
|
|
2
2
|
export { createClient } from './client.gen.js';
|
|
3
3
|
|
|
4
|
-
type Slot =
|
|
4
|
+
type Slot = 'body' | 'headers' | 'path' | 'query';
|
|
5
5
|
type Field = {
|
|
6
|
-
in: Exclude<Slot,
|
|
6
|
+
in: Exclude<Slot, 'body'>;
|
|
7
7
|
/**
|
|
8
8
|
* Field name. This is the name we want the user to see and use.
|
|
9
9
|
*/
|
|
@@ -14,7 +14,7 @@ type Field = {
|
|
|
14
14
|
*/
|
|
15
15
|
map?: string;
|
|
16
16
|
} | {
|
|
17
|
-
in: Extract<Slot,
|
|
17
|
+
in: Extract<Slot, 'body'>;
|
|
18
18
|
/**
|
|
19
19
|
* Key isn't required for bodies.
|
|
20
20
|
*/
|