@commercelayer/sdk 6.0.0-beta.7 → 6.0.0-beta.9

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/lib/index.d.mts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { DocWithData } from 'jsonapi-typescript';
2
2
 
3
+ type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
3
4
  type FetchResponse = DocWithData;
4
- type FetchOptions = RequestInit;
5
+ type FetchRequestOptions = RequestInit;
5
6
  declare class FetchError extends Error {
6
7
  #private;
7
8
  static isFetchError: (error: any) => error is FetchError;
@@ -25,7 +26,7 @@ type InterceptorManager = {
25
26
  };
26
27
  type RequestObj = {
27
28
  url: URL;
28
- options: FetchOptions;
29
+ options: FetchRequestOptions;
29
30
  };
30
31
  type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
31
32
  type ResponseObj = Response;
@@ -40,7 +41,7 @@ type ErrorInterceptor = (error: ErrorObj) => ErrorObj | Promise<ErrorObj>;
40
41
  type InterceptorType = 'request' | 'response';
41
42
 
42
43
  type RawResponseReader = {
43
- id?: number;
44
+ id: number;
44
45
  rawResponse?: any;
45
46
  headers?: HeadersObj;
46
47
  ok: boolean;
@@ -53,6 +54,7 @@ type RequestConfig = {
53
54
  params?: RequestParams;
54
55
  headers?: RequestHeaders;
55
56
  userAgent?: string;
57
+ fetch?: Fetch;
56
58
  };
57
59
  type ApiConfig = {
58
60
  organization: string;
package/lib/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { DocWithData } from 'jsonapi-typescript';
2
2
 
3
+ type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
3
4
  type FetchResponse = DocWithData;
4
- type FetchOptions = RequestInit;
5
+ type FetchRequestOptions = RequestInit;
5
6
  declare class FetchError extends Error {
6
7
  #private;
7
8
  static isFetchError: (error: any) => error is FetchError;
@@ -25,7 +26,7 @@ type InterceptorManager = {
25
26
  };
26
27
  type RequestObj = {
27
28
  url: URL;
28
- options: FetchOptions;
29
+ options: FetchRequestOptions;
29
30
  };
30
31
  type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
31
32
  type ResponseObj = Response;
@@ -40,7 +41,7 @@ type ErrorInterceptor = (error: ErrorObj) => ErrorObj | Promise<ErrorObj>;
40
41
  type InterceptorType = 'request' | 'response';
41
42
 
42
43
  type RawResponseReader = {
43
- id?: number;
44
+ id: number;
44
45
  rawResponse?: any;
45
46
  headers?: HeadersObj;
46
47
  ok: boolean;
@@ -53,6 +54,7 @@ type RequestConfig = {
53
54
  params?: RequestParams;
54
55
  headers?: RequestHeaders;
55
56
  userAgent?: string;
57
+ fetch?: Fetch;
56
58
  };
57
59
  type ApiConfig = {
58
60
  organization: string;