@eudiplo/sdk-core 4.1.0 → 4.3.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.
@@ -1,4 +1,4 @@
1
- import { b as Config, C as Client } from '../../types.gen-CVkHMB8b.mjs';
1
+ import { b as Config, C as Client } from '../../types.gen-DKrNRB-E.mjs';
2
2
 
3
3
  declare const createClient: (config?: Config) => Client;
4
4
 
@@ -1,4 +1,4 @@
1
- import { b as Config, C as Client } from '../../types.gen-CVkHMB8b.js';
1
+ import { b as Config, C as Client } from '../../types.gen-DKrNRB-E.js';
2
2
 
3
3
  declare const createClient: (config?: Config) => Client;
4
4
 
@@ -642,132 +642,121 @@ var createClient = (config = {}) => {
642
642
  return { opts: resolvedOpts, url };
643
643
  };
644
644
  const request = async (options) => {
645
- const { opts, url } = await beforeRequest(options);
646
- const requestInit = {
647
- redirect: "follow",
648
- ...opts,
649
- body: getValidRequestBody(opts)
650
- };
651
- let request2 = new Request(url, requestInit);
652
- for (const fn of interceptors.request.fns) {
653
- if (fn) {
654
- request2 = await fn(request2, opts);
655
- }
656
- }
657
- const _fetch = opts.fetch;
645
+ const throwOnError = options.throwOnError ?? _config.throwOnError;
646
+ const responseStyle = options.responseStyle ?? _config.responseStyle;
647
+ let request2;
658
648
  let response;
659
649
  try {
660
- response = await _fetch(request2);
661
- } catch (error2) {
662
- let finalError2 = error2;
663
- for (const fn of interceptors.error.fns) {
650
+ const { opts, url } = await beforeRequest(options);
651
+ const requestInit = {
652
+ redirect: "follow",
653
+ ...opts,
654
+ body: getValidRequestBody(opts)
655
+ };
656
+ request2 = new Request(url, requestInit);
657
+ for (const fn of interceptors.request.fns) {
664
658
  if (fn) {
665
- finalError2 = await fn(
666
- error2,
667
- void 0,
668
- request2,
669
- opts
670
- );
659
+ request2 = await fn(request2, opts);
671
660
  }
672
661
  }
673
- finalError2 = finalError2 || {};
674
- if (opts.throwOnError) {
675
- throw finalError2;
662
+ const _fetch = opts.fetch;
663
+ response = await _fetch(request2);
664
+ for (const fn of interceptors.response.fns) {
665
+ if (fn) {
666
+ response = await fn(response, request2, opts);
667
+ }
676
668
  }
677
- return opts.responseStyle === "data" ? void 0 : {
678
- error: finalError2,
669
+ const result = {
679
670
  request: request2,
680
- response: void 0
671
+ response
681
672
  };
682
- }
683
- for (const fn of interceptors.response.fns) {
684
- if (fn) {
685
- response = await fn(response, request2, opts);
686
- }
687
- }
688
- const result = {
689
- request: request2,
690
- response
691
- };
692
- if (response.ok) {
693
- const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
694
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
695
- let emptyData;
673
+ if (response.ok) {
674
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
675
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
676
+ let emptyData;
677
+ switch (parseAs) {
678
+ case "arrayBuffer":
679
+ case "blob":
680
+ case "text":
681
+ emptyData = await response[parseAs]();
682
+ break;
683
+ case "formData":
684
+ emptyData = new FormData();
685
+ break;
686
+ case "stream":
687
+ emptyData = response.body;
688
+ break;
689
+ case "json":
690
+ default:
691
+ emptyData = {};
692
+ break;
693
+ }
694
+ return opts.responseStyle === "data" ? emptyData : {
695
+ data: emptyData,
696
+ ...result
697
+ };
698
+ }
699
+ let data;
696
700
  switch (parseAs) {
697
701
  case "arrayBuffer":
698
702
  case "blob":
703
+ case "formData":
699
704
  case "text":
700
- emptyData = await response[parseAs]();
705
+ data = await response[parseAs]();
701
706
  break;
702
- case "formData":
703
- emptyData = new FormData();
707
+ case "json": {
708
+ const text = await response.text();
709
+ data = text ? JSON.parse(text) : {};
704
710
  break;
711
+ }
705
712
  case "stream":
706
- emptyData = response.body;
707
- break;
708
- case "json":
709
- default:
710
- emptyData = {};
711
- break;
713
+ return opts.responseStyle === "data" ? response.body : {
714
+ data: response.body,
715
+ ...result
716
+ };
717
+ }
718
+ if (parseAs === "json") {
719
+ if (opts.responseValidator) {
720
+ await opts.responseValidator(data);
721
+ }
722
+ if (opts.responseTransformer) {
723
+ data = await opts.responseTransformer(data);
724
+ }
712
725
  }
713
- return opts.responseStyle === "data" ? emptyData : {
714
- data: emptyData,
726
+ return opts.responseStyle === "data" ? data : {
727
+ data,
715
728
  ...result
716
729
  };
717
730
  }
718
- let data;
719
- switch (parseAs) {
720
- case "arrayBuffer":
721
- case "blob":
722
- case "formData":
723
- case "text":
724
- data = await response[parseAs]();
725
- break;
726
- case "json": {
727
- const text = await response.text();
728
- data = text ? JSON.parse(text) : {};
729
- break;
730
- }
731
- case "stream":
732
- return opts.responseStyle === "data" ? response.body : {
733
- data: response.body,
734
- ...result
735
- };
731
+ const textError = await response.text();
732
+ let jsonError;
733
+ try {
734
+ jsonError = JSON.parse(textError);
735
+ } catch {
736
736
  }
737
- if (parseAs === "json") {
738
- if (opts.responseValidator) {
739
- await opts.responseValidator(data);
740
- }
741
- if (opts.responseTransformer) {
742
- data = await opts.responseTransformer(data);
737
+ throw jsonError ?? textError;
738
+ } catch (error) {
739
+ let finalError = error;
740
+ for (const fn of interceptors.error.fns) {
741
+ if (fn) {
742
+ finalError = await fn(
743
+ finalError,
744
+ response,
745
+ request2,
746
+ options
747
+ );
743
748
  }
744
749
  }
745
- return opts.responseStyle === "data" ? data : {
746
- data,
747
- ...result
748
- };
749
- }
750
- const textError = await response.text();
751
- let jsonError;
752
- try {
753
- jsonError = JSON.parse(textError);
754
- } catch {
755
- }
756
- const error = jsonError ?? textError;
757
- let finalError = error;
758
- for (const fn of interceptors.error.fns) {
759
- if (fn) {
760
- finalError = await fn(error, response, request2, opts);
750
+ finalError = finalError || {};
751
+ if (throwOnError) {
752
+ throw finalError;
761
753
  }
754
+ return responseStyle === "data" ? void 0 : {
755
+ error: finalError,
756
+ request: request2,
757
+ response
758
+ };
762
759
  }
763
- finalError = finalError || {};
764
- if (opts.throwOnError) {
765
- throw finalError;
766
- }
767
- return opts.responseStyle === "data" ? void 0 : {
768
- error: finalError,
769
- ...result
770
- };
771
760
  };
772
761
  const makeMethodFn = (method) => (options) => request({ ...options, method });
773
762
  const makeSseFn = (method) => async (options) => {
@@ -775,7 +764,6 @@ var createClient = (config = {}) => {
775
764
  return createSseClient({
776
765
  ...opts,
777
766
  body: opts.body,
778
- headers: opts.headers,
779
767
  method,
780
768
  onRequest: async (url2, init) => {
781
769
  let request2 = new Request(url2, init);
@@ -640,132 +640,121 @@ var createClient = (config = {}) => {
640
640
  return { opts: resolvedOpts, url };
641
641
  };
642
642
  const request = async (options) => {
643
- const { opts, url } = await beforeRequest(options);
644
- const requestInit = {
645
- redirect: "follow",
646
- ...opts,
647
- body: getValidRequestBody(opts)
648
- };
649
- let request2 = new Request(url, requestInit);
650
- for (const fn of interceptors.request.fns) {
651
- if (fn) {
652
- request2 = await fn(request2, opts);
653
- }
654
- }
655
- const _fetch = opts.fetch;
643
+ const throwOnError = options.throwOnError ?? _config.throwOnError;
644
+ const responseStyle = options.responseStyle ?? _config.responseStyle;
645
+ let request2;
656
646
  let response;
657
647
  try {
658
- response = await _fetch(request2);
659
- } catch (error2) {
660
- let finalError2 = error2;
661
- for (const fn of interceptors.error.fns) {
648
+ const { opts, url } = await beforeRequest(options);
649
+ const requestInit = {
650
+ redirect: "follow",
651
+ ...opts,
652
+ body: getValidRequestBody(opts)
653
+ };
654
+ request2 = new Request(url, requestInit);
655
+ for (const fn of interceptors.request.fns) {
662
656
  if (fn) {
663
- finalError2 = await fn(
664
- error2,
665
- void 0,
666
- request2,
667
- opts
668
- );
657
+ request2 = await fn(request2, opts);
669
658
  }
670
659
  }
671
- finalError2 = finalError2 || {};
672
- if (opts.throwOnError) {
673
- throw finalError2;
660
+ const _fetch = opts.fetch;
661
+ response = await _fetch(request2);
662
+ for (const fn of interceptors.response.fns) {
663
+ if (fn) {
664
+ response = await fn(response, request2, opts);
665
+ }
674
666
  }
675
- return opts.responseStyle === "data" ? void 0 : {
676
- error: finalError2,
667
+ const result = {
677
668
  request: request2,
678
- response: void 0
669
+ response
679
670
  };
680
- }
681
- for (const fn of interceptors.response.fns) {
682
- if (fn) {
683
- response = await fn(response, request2, opts);
684
- }
685
- }
686
- const result = {
687
- request: request2,
688
- response
689
- };
690
- if (response.ok) {
691
- const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
692
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
693
- let emptyData;
671
+ if (response.ok) {
672
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
673
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
674
+ let emptyData;
675
+ switch (parseAs) {
676
+ case "arrayBuffer":
677
+ case "blob":
678
+ case "text":
679
+ emptyData = await response[parseAs]();
680
+ break;
681
+ case "formData":
682
+ emptyData = new FormData();
683
+ break;
684
+ case "stream":
685
+ emptyData = response.body;
686
+ break;
687
+ case "json":
688
+ default:
689
+ emptyData = {};
690
+ break;
691
+ }
692
+ return opts.responseStyle === "data" ? emptyData : {
693
+ data: emptyData,
694
+ ...result
695
+ };
696
+ }
697
+ let data;
694
698
  switch (parseAs) {
695
699
  case "arrayBuffer":
696
700
  case "blob":
701
+ case "formData":
697
702
  case "text":
698
- emptyData = await response[parseAs]();
703
+ data = await response[parseAs]();
699
704
  break;
700
- case "formData":
701
- emptyData = new FormData();
705
+ case "json": {
706
+ const text = await response.text();
707
+ data = text ? JSON.parse(text) : {};
702
708
  break;
709
+ }
703
710
  case "stream":
704
- emptyData = response.body;
705
- break;
706
- case "json":
707
- default:
708
- emptyData = {};
709
- break;
711
+ return opts.responseStyle === "data" ? response.body : {
712
+ data: response.body,
713
+ ...result
714
+ };
715
+ }
716
+ if (parseAs === "json") {
717
+ if (opts.responseValidator) {
718
+ await opts.responseValidator(data);
719
+ }
720
+ if (opts.responseTransformer) {
721
+ data = await opts.responseTransformer(data);
722
+ }
710
723
  }
711
- return opts.responseStyle === "data" ? emptyData : {
712
- data: emptyData,
724
+ return opts.responseStyle === "data" ? data : {
725
+ data,
713
726
  ...result
714
727
  };
715
728
  }
716
- let data;
717
- switch (parseAs) {
718
- case "arrayBuffer":
719
- case "blob":
720
- case "formData":
721
- case "text":
722
- data = await response[parseAs]();
723
- break;
724
- case "json": {
725
- const text = await response.text();
726
- data = text ? JSON.parse(text) : {};
727
- break;
728
- }
729
- case "stream":
730
- return opts.responseStyle === "data" ? response.body : {
731
- data: response.body,
732
- ...result
733
- };
729
+ const textError = await response.text();
730
+ let jsonError;
731
+ try {
732
+ jsonError = JSON.parse(textError);
733
+ } catch {
734
734
  }
735
- if (parseAs === "json") {
736
- if (opts.responseValidator) {
737
- await opts.responseValidator(data);
738
- }
739
- if (opts.responseTransformer) {
740
- data = await opts.responseTransformer(data);
735
+ throw jsonError ?? textError;
736
+ } catch (error) {
737
+ let finalError = error;
738
+ for (const fn of interceptors.error.fns) {
739
+ if (fn) {
740
+ finalError = await fn(
741
+ finalError,
742
+ response,
743
+ request2,
744
+ options
745
+ );
741
746
  }
742
747
  }
743
- return opts.responseStyle === "data" ? data : {
744
- data,
745
- ...result
746
- };
747
- }
748
- const textError = await response.text();
749
- let jsonError;
750
- try {
751
- jsonError = JSON.parse(textError);
752
- } catch {
753
- }
754
- const error = jsonError ?? textError;
755
- let finalError = error;
756
- for (const fn of interceptors.error.fns) {
757
- if (fn) {
758
- finalError = await fn(error, response, request2, opts);
748
+ finalError = finalError || {};
749
+ if (throwOnError) {
750
+ throw finalError;
759
751
  }
752
+ return responseStyle === "data" ? void 0 : {
753
+ error: finalError,
754
+ request: request2,
755
+ response
756
+ };
760
757
  }
761
- finalError = finalError || {};
762
- if (opts.throwOnError) {
763
- throw finalError;
764
- }
765
- return opts.responseStyle === "data" ? void 0 : {
766
- error: finalError,
767
- ...result
768
- };
769
758
  };
770
759
  const makeMethodFn = (method) => (options) => request({ ...options, method });
771
760
  const makeSseFn = (method) => async (options) => {
@@ -773,7 +762,6 @@ var createClient = (config = {}) => {
773
762
  return createSseClient({
774
763
  ...opts,
775
764
  body: opts.body,
776
- headers: opts.headers,
777
765
  method,
778
766
  onRequest: async (url2, init) => {
779
767
  let request2 = new Request(url2, init);
@@ -1,4 +1,4 @@
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-CVkHMB8b.mjs';
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-DKrNRB-E.mjs';
2
2
  export { createClient } from './client.gen.mjs';
3
3
 
4
4
  type Slot = "body" | "headers" | "path" | "query";
@@ -1,4 +1,4 @@
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-CVkHMB8b.js';
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-DKrNRB-E.js';
2
2
  export { createClient } from './client.gen.js';
3
3
 
4
4
  type Slot = "body" | "headers" | "path" | "query";