@readyfor/api-client-base 0.207.1 → 0.207.2

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,5 +1,4 @@
1
1
  import { Store } from './store.mjs';
2
- import { HTTPError } from './apiError.mjs';
3
2
 
4
3
  type DeserializeResponseConfig = {
5
4
  forceDeserializeResponse?: false;
@@ -13,7 +12,7 @@ type LoggingConfig = {
13
12
  type RequestConfig = {
14
13
  hostName?: string | ((path: string) => string);
15
14
  defaultRequestInit?: RequestInit;
16
- onError?: (error: HTTPError) => void;
15
+ onError?: (error: unknown) => void;
17
16
  };
18
17
  type Config = RequestConfig & DeserializeResponseConfig & LoggingConfig;
19
18
  declare const store: Store<Config>;
@@ -1,5 +1,4 @@
1
1
  import { Store } from './store.js';
2
- import { HTTPError } from './apiError.js';
3
2
 
4
3
  type DeserializeResponseConfig = {
5
4
  forceDeserializeResponse?: false;
@@ -13,7 +12,7 @@ type LoggingConfig = {
13
12
  type RequestConfig = {
14
13
  hostName?: string | ((path: string) => string);
15
14
  defaultRequestInit?: RequestInit;
16
- onError?: (error: HTTPError) => void;
15
+ onError?: (error: unknown) => void;
17
16
  };
18
17
  type Config = RequestConfig & DeserializeResponseConfig & LoggingConfig;
19
18
  declare const store: Store<Config>;
@@ -40,6 +40,8 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
40
40
  if (res.ok) return body;
41
41
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
42
42
  const error = new HTTPError(code, body);
43
+ throw error;
44
+ }).catch((error) => {
43
45
  store.getState().onError?.(error);
44
46
  throw error;
45
47
  });
@@ -57,6 +59,8 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
57
59
  if (res.ok) return { body, headers: res.headers };
58
60
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
59
61
  const error = new HTTPError(code, body);
62
+ throw error;
63
+ }).catch((error) => {
60
64
  store.getState().onError?.(error);
61
65
  throw error;
62
66
  });
@@ -74,6 +78,8 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
74
78
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
75
79
  const body = await res.text();
76
80
  const error = new HTTPError(code, body);
81
+ throw error;
82
+ }).catch((error) => {
77
83
  store.getState().onError?.(error);
78
84
  throw error;
79
85
  });
package/dist/fetcher.js CHANGED
@@ -131,6 +131,8 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
131
131
  if (res.ok) return body;
132
132
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
133
133
  const error = new HTTPError(code, body);
134
+ throw error;
135
+ }).catch((error) => {
134
136
  store.getState().onError?.(error);
135
137
  throw error;
136
138
  });
@@ -148,6 +150,8 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
148
150
  if (res.ok) return { body, headers: res.headers };
149
151
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
150
152
  const error = new HTTPError(code, body);
153
+ throw error;
154
+ }).catch((error) => {
151
155
  store.getState().onError?.(error);
152
156
  throw error;
153
157
  });
@@ -165,6 +169,8 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
165
169
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
166
170
  const body = await res.text();
167
171
  const error = new HTTPError(code, body);
172
+ throw error;
173
+ }).catch((error) => {
168
174
  store.getState().onError?.(error);
169
175
  throw error;
170
176
  });
package/dist/fetcher.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createJsonFetcher,
4
4
  createTextFetcher,
5
5
  createVoidFetcher
6
- } from "./chunk-HBZIYFCM.mjs";
6
+ } from "./chunk-XDHAVIKP.mjs";
7
7
  import "./chunk-PY35XWDS.mjs";
8
8
  import "./chunk-JCZWXJBU.mjs";
9
9
  import "./chunk-472P3XVV.mjs";
package/dist/index.js CHANGED
@@ -168,6 +168,8 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
168
168
  if (res.ok) return body;
169
169
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
170
170
  const error = new HTTPError(code, body);
171
+ throw error;
172
+ }).catch((error) => {
171
173
  store.getState().onError?.(error);
172
174
  throw error;
173
175
  });
@@ -185,6 +187,8 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
185
187
  if (res.ok) return { body, headers: res.headers };
186
188
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
187
189
  const error = new HTTPError(code, body);
190
+ throw error;
191
+ }).catch((error) => {
188
192
  store.getState().onError?.(error);
189
193
  throw error;
190
194
  });
@@ -202,6 +206,8 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
202
206
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
203
207
  const body = await res.text();
204
208
  const error = new HTTPError(code, body);
209
+ throw error;
210
+ }).catch((error) => {
205
211
  store.getState().onError?.(error);
206
212
  throw error;
207
213
  });
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createJsonFetcher,
4
4
  createTextFetcher,
5
5
  createVoidFetcher
6
- } from "./chunk-HBZIYFCM.mjs";
6
+ } from "./chunk-XDHAVIKP.mjs";
7
7
  import {
8
8
  HTTPError,
9
9
  errorStatusCode,
@@ -2,7 +2,6 @@ import { FC, ReactNode } from 'react';
2
2
  import { Config } from '../apiClientConfigStore.mjs';
3
3
  import { Store } from '../store.mjs';
4
4
  import { SWRConfiguration } from 'swr';
5
- import '../apiError.mjs';
6
5
 
7
6
  type Configuration = Config & {
8
7
  swr?: SWRConfiguration;
@@ -2,7 +2,6 @@ import { FC, ReactNode } from 'react';
2
2
  import { Config } from '../apiClientConfigStore.js';
3
3
  import { Store } from '../store.js';
4
4
  import { SWRConfiguration } from 'swr';
5
- import '../apiError.js';
6
5
 
7
6
  type Configuration = Config & {
8
7
  swr?: SWRConfiguration;
@@ -4,5 +4,4 @@ export { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit } fr
4
4
  import 'react';
5
5
  import '../apiClientConfigStore.mjs';
6
6
  import '../store.mjs';
7
- import '../apiError.mjs';
8
7
  import 'swr';
@@ -4,5 +4,4 @@ export { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit } fr
4
4
  import 'react';
5
5
  import '../apiClientConfigStore.js';
6
6
  import '../store.js';
7
- import '../apiError.js';
8
7
  import 'swr';
@@ -1,6 +1,5 @@
1
1
  import { Config } from '../apiClientConfigStore.mjs';
2
2
  import '../store.mjs';
3
- import '../apiError.mjs';
4
3
 
5
4
  declare const useApiClientConfig: () => Config;
6
5
  declare const useApiClientConfigWithSelector: <T>(selector: (state: Config) => T) => T;
@@ -1,6 +1,5 @@
1
1
  import { Config } from '../apiClientConfigStore.js';
2
2
  import '../store.js';
3
- import '../apiError.js';
4
3
 
5
4
  declare const useApiClientConfig: () => Config;
6
5
  declare const useApiClientConfigWithSelector: <T>(selector: (state: Config) => T) => T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readyfor/api-client-base",
3
- "version": "0.207.1",
3
+ "version": "0.207.2",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -63,5 +63,5 @@
63
63
  "src"
64
64
  ]
65
65
  },
66
- "gitHead": "8d5b1494e0a21fe73dff424239d633f58dbfad7a"
66
+ "gitHead": "cdc91b00d586f23fd3d63815b14d329c214adc7b"
67
67
  }