@choksheak/react-utils 0.3.9 → 0.4.1
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/NoSSR.cjs +7 -30
- package/NoSSR.min.cjs +1 -1
- package/NoSSR.min.cjs.map +1 -1
- package/NoSSR.min.mjs +1 -1
- package/NoSSR.min.mjs.map +1 -1
- package/NoSSR.mjs +2 -0
- package/chunk-33UMQLKY.mjs +43 -0
- package/chunk-3X25NN6X.cjs +195 -0
- package/chunk-5DO7KC3L.cjs +43 -0
- package/chunk-5PDGU37E.cjs +104 -0
- package/chunk-74BS2FAO.cjs +12 -0
- package/chunk-F5L32IUC.min.cjs +2 -0
- package/chunk-F5L32IUC.min.cjs.map +1 -0
- package/chunk-GPV6JIQK.mjs +17 -0
- package/chunk-KE3RXVMS.min.cjs +2 -0
- package/chunk-KE3RXVMS.min.cjs.map +1 -0
- package/chunk-KILGR7YA.min.mjs +2 -0
- package/chunk-KILGR7YA.min.mjs.map +1 -0
- package/chunk-KRXENFK3.mjs +195 -0
- package/chunk-MWDH7YON.min.mjs +2 -0
- package/chunk-MWDH7YON.min.mjs.map +1 -0
- package/chunk-NTFFK7ZH.min.cjs +2 -0
- package/chunk-NTFFK7ZH.min.cjs.map +1 -0
- package/chunk-PHLY3LR4.mjs +104 -0
- package/chunk-RM4ZGGZ2.min.mjs +2 -0
- package/chunk-RM4ZGGZ2.min.mjs.map +1 -0
- package/chunk-TEZPF6BG.min.cjs +2 -0
- package/chunk-TEZPF6BG.min.cjs.map +1 -0
- package/chunk-UFJQLQFI.min.cjs +2 -0
- package/chunk-UFJQLQFI.min.cjs.map +1 -0
- package/chunk-V7L3UICC.min.mjs +2 -0
- package/chunk-V7L3UICC.min.mjs.map +1 -0
- package/chunk-VHMO75EY.min.mjs +2 -0
- package/chunk-VHMO75EY.min.mjs.map +1 -0
- package/chunk-WVLPJPWG.cjs +17 -0
- package/chunk-X6BYQHVC.mjs +12 -0
- package/package.json +104 -43
- package/sharedQuery.cjs +130 -391
- package/sharedQuery.d.mts +55 -10
- package/sharedQuery.d.ts +54 -9
- package/sharedQuery.min.cjs +1 -1
- package/sharedQuery.min.cjs.map +1 -1
- package/sharedQuery.min.mjs +1 -1
- package/sharedQuery.min.mjs.map +1 -1
- package/sharedQuery.mjs +92 -321
- package/sharedState.cjs +15 -304
- package/sharedState.d.mts +4 -4
- package/sharedState.d.ts +4 -4
- package/sharedState.min.cjs +1 -1
- package/sharedState.min.cjs.map +1 -1
- package/sharedState.min.mjs +1 -1
- package/sharedState.min.mjs.map +1 -1
- package/sharedState.mjs +10 -269
- package/storage.cjs +10 -123
- package/storage.d.mts +1 -0
- package/storage.d.ts +1 -0
- package/storage.min.cjs +1 -1
- package/storage.min.cjs.map +1 -1
- package/storage.min.mjs +1 -1
- package/storage.min.mjs.map +1 -1
- package/storage.mjs +6 -92
- package/stringify.cjs +8 -57
- package/stringify.min.cjs +1 -1
- package/stringify.min.cjs.map +1 -1
- package/stringify.min.mjs +1 -1
- package/stringify.min.mjs.map +1 -1
- package/stringify.mjs +6 -30
- package/useDeepMemo.cjs +6 -50
- package/useDeepMemo.min.cjs +1 -1
- package/useDeepMemo.min.cjs.map +1 -1
- package/useDeepMemo.min.mjs +1 -1
- package/useDeepMemo.min.mjs.map +1 -1
- package/useDeepMemo.mjs +4 -13
- package/fetcher.cjs +0 -51
- package/fetcher.d.mts +0 -36
- package/fetcher.d.ts +0 -32
- package/fetcher.min.cjs +0 -2
- package/fetcher.min.cjs.map +0 -1
- package/fetcher.min.mjs +0 -2
- package/fetcher.min.mjs.map +0 -1
- package/fetcher.mjs +0 -15
package/stringify.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["/Users/choksheaklau/src/react-utils/dist/stringify.min.cjs"],"names":[],"mappings":"AAAA,wIAAyC,oCAAiC,oCAAE,CAAE,CAAC,+DAA0C","file":"/Users/choksheaklau/src/react-utils/dist/stringify.min.cjs"}
|
package/stringify.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{a,b}from"./chunk-RM4ZGGZ2.min.mjs";import"./chunk-MWDH7YON.min.mjs";b();export{a as stringifyDeterministicForKeys};
|
|
2
2
|
//# sourceMappingURL=stringify.min.mjs.map
|
package/stringify.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/stringify.mjs
CHANGED
|
@@ -1,33 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
if (cache.has(value)) {
|
|
12
|
-
return "[Circular]";
|
|
13
|
-
}
|
|
14
|
-
cache.add(value);
|
|
15
|
-
if (value !== params) {
|
|
16
|
-
try {
|
|
17
|
-
JSON.stringify(value);
|
|
18
|
-
} catch {
|
|
19
|
-
return "[Unserializable]";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return Object.keys(value).sort().reduce(
|
|
23
|
-
(result, key) => {
|
|
24
|
-
result[key] = value[key];
|
|
25
|
-
return result;
|
|
26
|
-
},
|
|
27
|
-
{}
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
init_stringify,
|
|
3
|
+
stringifyDeterministicForKeys
|
|
4
|
+
} from "./chunk-33UMQLKY.mjs";
|
|
5
|
+
import "./chunk-X6BYQHVC.mjs";
|
|
6
|
+
init_stringify();
|
|
31
7
|
export {
|
|
32
8
|
stringifyDeterministicForKeys
|
|
33
9
|
};
|
package/useDeepMemo.cjs
CHANGED
|
@@ -1,51 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
module.exports = __toCommonJS(useDeepMemo_exports);
|
|
36
|
-
var import_isEqual = __toESM(require("lodash/isEqual"));
|
|
37
|
-
var import_react = require("react");
|
|
38
|
-
function useDeepMemo(value) {
|
|
39
|
-
const [state, setState] = (0, import_react.useState)(value);
|
|
40
|
-
return (0, import_react.useMemo)(() => {
|
|
41
|
-
if ((0, import_isEqual.default)(state, value)) {
|
|
42
|
-
return state;
|
|
43
|
-
}
|
|
44
|
-
setState(value);
|
|
45
|
-
return value;
|
|
46
|
-
}, [state, value]);
|
|
47
|
-
}
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
useDeepMemo
|
|
51
|
-
});
|
|
3
|
+
var _chunkWVLPJPWGcjs = require('./chunk-WVLPJPWG.cjs');
|
|
4
|
+
require('./chunk-74BS2FAO.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.useDeepMemo = _chunkWVLPJPWGcjs.useDeepMemo;
|
package/useDeepMemo.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkF5L32IUCmincjs = require('./chunk-F5L32IUC.min.cjs');require('./chunk-KE3RXVMS.min.cjs');exports.useDeepMemo = _chunkF5L32IUCmincjs.a;
|
|
2
2
|
//# sourceMappingURL=useDeepMemo.min.cjs.map
|
package/useDeepMemo.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["/Users/choksheaklau/src/react-utils/dist/useDeepMemo.min.cjs"],"names":[],"mappings":"AAAA,wIAAuC,oCAAiC,6CAAyB","file":"/Users/choksheaklau/src/react-utils/dist/useDeepMemo.min.cjs"}
|
package/useDeepMemo.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{a}from"./chunk-V7L3UICC.min.mjs";import"./chunk-MWDH7YON.min.mjs";export{a as useDeepMemo};
|
|
2
2
|
//# sourceMappingURL=useDeepMemo.min.mjs.map
|
package/useDeepMemo.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/useDeepMemo.mjs
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const [state, setState] = useState(value);
|
|
6
|
-
return useMemo(() => {
|
|
7
|
-
if (isEqual(state, value)) {
|
|
8
|
-
return state;
|
|
9
|
-
}
|
|
10
|
-
setState(value);
|
|
11
|
-
return value;
|
|
12
|
-
}, [state, value]);
|
|
13
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
useDeepMemo
|
|
3
|
+
} from "./chunk-GPV6JIQK.mjs";
|
|
4
|
+
import "./chunk-X6BYQHVC.mjs";
|
|
14
5
|
export {
|
|
15
6
|
useDeepMemo
|
|
16
7
|
};
|
package/fetcher.cjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/fetcher.ts
|
|
31
|
-
var fetcher_exports = {};
|
|
32
|
-
__export(fetcher_exports, {
|
|
33
|
-
fetcher: () => fetcher,
|
|
34
|
-
fetcherNoRetries: () => fetcherNoRetries
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(fetcher_exports);
|
|
37
|
-
var import_wretch = __toESM(require("wretch"));
|
|
38
|
-
var import_middlewares = require("wretch/middlewares");
|
|
39
|
-
var fetcher = (0, import_wretch.default)().middlewares([
|
|
40
|
-
(0, import_middlewares.retry)({
|
|
41
|
-
maxAttempts: 3,
|
|
42
|
-
delayTimer: 1e3,
|
|
43
|
-
retryOnNetworkError: true
|
|
44
|
-
})
|
|
45
|
-
]);
|
|
46
|
-
var fetcherNoRetries = (0, import_wretch.default)();
|
|
47
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
-
0 && (module.exports = {
|
|
49
|
-
fetcher,
|
|
50
|
-
fetcherNoRetries
|
|
51
|
-
});
|
package/fetcher.d.mts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as wretch from 'wretch';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @packageDocumentation
|
|
5
|
-
*
|
|
6
|
-
* An alternate syntax to fetch() that allows function chaining to compose the
|
|
7
|
-
* entire fetch request. One can also compose partial fetcher objects to be
|
|
8
|
-
* reused in future requests.
|
|
9
|
-
*
|
|
10
|
-
* Examples:
|
|
11
|
-
* ```
|
|
12
|
-
* const userFetcher = fetcher
|
|
13
|
-
* .auth("Bearer TOPSECRET")
|
|
14
|
-
* .content("application/json")
|
|
15
|
-
* .url("/api/user");
|
|
16
|
-
*
|
|
17
|
-
* const user = await userFetcher.get();
|
|
18
|
-
*
|
|
19
|
-
* const updateResult = await userFetcher
|
|
20
|
-
* .body({ id: user.id, name: "New name"})
|
|
21
|
-
* .post();
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* Fetcher with default short retries. Use this to make your queries more
|
|
26
|
-
* robust without any additional work.
|
|
27
|
-
*/
|
|
28
|
-
declare const fetcher: wretch.Wretch<unknown, unknown, undefined, undefined>;
|
|
29
|
-
/**
|
|
30
|
-
* Name this as `fetcherNoRetries` to make it easier to understand than
|
|
31
|
-
* `wretch`. Use this if you don't want retries. Use `fetcher` if you want
|
|
32
|
-
* retries.
|
|
33
|
-
*/
|
|
34
|
-
declare const fetcherNoRetries: wretch.Wretch<unknown, unknown, undefined, undefined>;
|
|
35
|
-
|
|
36
|
-
export { fetcher, fetcherNoRetries };
|
package/fetcher.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
*
|
|
4
|
-
* An alternate syntax to fetch() that allows function chaining to compose the
|
|
5
|
-
* entire fetch request. One can also compose partial fetcher objects to be
|
|
6
|
-
* reused in future requests.
|
|
7
|
-
*
|
|
8
|
-
* Examples:
|
|
9
|
-
* ```
|
|
10
|
-
* const userFetcher = fetcher
|
|
11
|
-
* .auth("Bearer TOPSECRET")
|
|
12
|
-
* .content("application/json")
|
|
13
|
-
* .url("/api/user");
|
|
14
|
-
*
|
|
15
|
-
* const user = await userFetcher.get();
|
|
16
|
-
*
|
|
17
|
-
* const updateResult = await userFetcher
|
|
18
|
-
* .body({ id: user.id, name: "New name"})
|
|
19
|
-
* .post();
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Fetcher with default short retries. Use this to make your queries more
|
|
24
|
-
* robust without any additional work.
|
|
25
|
-
*/
|
|
26
|
-
export declare const fetcher: import("wretch").Wretch<unknown, unknown, undefined, undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* Name this as `fetcherNoRetries` to make it easier to understand than
|
|
29
|
-
* `wretch`. Use this if you don't want retries. Use `fetcher` if you want
|
|
30
|
-
* retries.
|
|
31
|
-
*/
|
|
32
|
-
export declare const fetcherNoRetries: import("wretch").Wretch<unknown, unknown, undefined, undefined>;
|
package/fetcher.min.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var f=Object.create;var m=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty;var w=(r,e)=>{for(var t in e)m(r,t,{get:e[t],enumerable:!0})},p=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!n.call(r,o)&&o!==t&&m(r,o,{get:()=>e[o],enumerable:!(i=a(e,o))||i.enumerable});return r};var x=(r,e,t)=>(t=r!=null?f(h(r)):{},p(e||!r||!r.__esModule?m(t,"default",{value:r,enumerable:!0}):t,r)),y=r=>p(m({},"__esModule",{value:!0}),r);var k={};w(k,{fetcher:()=>l,fetcherNoRetries:()=>N});module.exports=y(k);var c=x(require("wretch")),s=require("wretch/middlewares"),l=(0,c.default)().middlewares([(0,s.retry)({maxAttempts:3,delayTimer:1e3,retryOnNetworkError:!0})]),N=(0,c.default)();0&&(module.exports={fetcher,fetcherNoRetries});
|
|
2
|
-
//# sourceMappingURL=fetcher.min.cjs.map
|
package/fetcher.min.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fetcher.ts"],"sourcesContent":["/**\n * @packageDocumentation\n *\n * An alternate syntax to fetch() that allows function chaining to compose the\n * entire fetch request. One can also compose partial fetcher objects to be\n * reused in future requests.\n *\n * Examples:\n * ```\n * const userFetcher = fetcher\n * .auth(\"Bearer TOPSECRET\")\n * .content(\"application/json\")\n * .url(\"/api/user\");\n *\n * const user = await userFetcher.get();\n *\n * const updateResult = await userFetcher\n * .body({ id: user.id, name: \"New name\"})\n * .post();\n * ```\n */\n\nimport wretch from \"wretch\";\nimport { retry } from \"wretch/middlewares\";\n\n/**\n * Fetcher with default short retries. Use this to make your queries more\n * robust without any additional work.\n */\nexport const fetcher = wretch().middlewares([\n retry({\n maxAttempts: 3,\n delayTimer: 1000,\n retryOnNetworkError: true,\n }),\n]);\n\n/**\n * Name this as `fetcherNoRetries` to make it easier to understand than\n * `wretch`. Use this if you don't want retries. Use `fetcher` if you want\n * retries.\n */\nexport const fetcherNoRetries = wretch();\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,qBAAAC,IAAA,eAAAC,EAAAJ,GAsBA,IAAAK,EAAmB,qBACnBC,EAAsB,8BAMTJ,KAAU,EAAAK,SAAO,EAAE,YAAY,IAC1C,SAAM,CACJ,YAAa,EACb,WAAY,IACZ,oBAAqB,EACvB,CAAC,CACH,CAAC,EAOYJ,KAAmB,EAAAI,SAAO","names":["fetcher_exports","__export","fetcher","fetcherNoRetries","__toCommonJS","import_wretch","import_middlewares","wretch"]}
|
package/fetcher.min.mjs
DELETED
package/fetcher.min.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fetcher.ts"],"sourcesContent":["/**\n * @packageDocumentation\n *\n * An alternate syntax to fetch() that allows function chaining to compose the\n * entire fetch request. One can also compose partial fetcher objects to be\n * reused in future requests.\n *\n * Examples:\n * ```\n * const userFetcher = fetcher\n * .auth(\"Bearer TOPSECRET\")\n * .content(\"application/json\")\n * .url(\"/api/user\");\n *\n * const user = await userFetcher.get();\n *\n * const updateResult = await userFetcher\n * .body({ id: user.id, name: \"New name\"})\n * .post();\n * ```\n */\n\nimport wretch from \"wretch\";\nimport { retry } from \"wretch/middlewares\";\n\n/**\n * Fetcher with default short retries. Use this to make your queries more\n * robust without any additional work.\n */\nexport const fetcher = wretch().middlewares([\n retry({\n maxAttempts: 3,\n delayTimer: 1000,\n retryOnNetworkError: true,\n }),\n]);\n\n/**\n * Name this as `fetcherNoRetries` to make it easier to understand than\n * `wretch`. Use this if you don't want retries. Use `fetcher` if you want\n * retries.\n */\nexport const fetcherNoRetries = wretch();\n"],"mappings":"AAsBA,OAAOA,MAAY,SACnB,OAAS,SAAAC,MAAa,qBAMf,IAAMC,EAAUF,EAAO,EAAE,YAAY,CAC1CC,EAAM,CACJ,YAAa,EACb,WAAY,IACZ,oBAAqB,EACvB,CAAC,CACH,CAAC,EAOYE,EAAmBH,EAAO","names":["wretch","retry","fetcher","fetcherNoRetries"]}
|
package/fetcher.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// src/fetcher.ts
|
|
2
|
-
import wretch from "wretch";
|
|
3
|
-
import { retry } from "wretch/middlewares";
|
|
4
|
-
var fetcher = wretch().middlewares([
|
|
5
|
-
retry({
|
|
6
|
-
maxAttempts: 3,
|
|
7
|
-
delayTimer: 1e3,
|
|
8
|
-
retryOnNetworkError: true
|
|
9
|
-
})
|
|
10
|
-
]);
|
|
11
|
-
var fetcherNoRetries = wretch();
|
|
12
|
-
export {
|
|
13
|
-
fetcher,
|
|
14
|
-
fetcherNoRetries
|
|
15
|
-
};
|