@willbooster/shared-lib 3.2.2 → 3.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.
- package/dist/cjs/error.cjs +1 -1
- package/dist/cjs/error.cjs.map +1 -1
- package/dist/cjs/error.d.cts +1 -1
- package/dist/esm/error.d.ts +1 -1
- package/dist/esm/error.js +1 -1
- package/dist/esm/error.js.map +1 -1
- package/package.json +8 -8
package/dist/cjs/error.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";exports.ignoreEnoent=function(t){try{return t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}},exports.ignoreEnoentAsync=async function(t){try{return await t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}},exports.ignoreError=function(t){try{return t()}catch(t){}},exports.ignoreErrorAsync=async function(t){try{return await t()}catch(t){}},exports.withRetry=async function(t,r=3,n){let o=0;for(;;)try{return await t()}catch(t){if(o++,o>=r)throw t;null==n||n(`Retry due to: ${t instanceof Error?t.stack:t}`)}};
|
|
1
|
+
"use strict";exports.ignoreEnoent=function(t){try{return t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}},exports.ignoreEnoentAsync=async function(t){try{return await t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}},exports.ignoreError=function(t){try{return t()}catch(t){}},exports.ignoreErrorAsync=async function(t){try{return await t()}catch(t){}},exports.withRetry=async function(t,r=3,n){let o=0;for(;;)try{return await t(o)}catch(t){if(o++,o>=r)throw t;null==n||n(`Retry due to: ${t instanceof Error?t.stack:t}`)}};
|
|
2
2
|
//# sourceMappingURL=error.cjs.map
|
package/dist/cjs/error.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.cjs","sources":["../../src/error.ts"],"sourcesContent":["export function ignoreError<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch {\n // do nothing\n }\n}\n\nexport function ignoreEnoent<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n\nexport async function ignoreErrorAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch {\n // do nothing\n }\n}\n\nexport async function ignoreEnoentAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n\nexport async function withRetry<T>(\n func: () => Promise<T>,\n retryCount = 3,\n log?: (message: string) => void\n): Promise<T> {\n let failedCount = 0;\n for (;;) {\n try {\n return await func();\n } catch (error) {\n failedCount++;\n if (failedCount >= retryCount) {\n throw error;\n }\n log?.(`Retry due to: ${error instanceof Error ? error.stack : error}`);\n }\n }\n}\n"],"names":["fn","error","code","async","_unused","_unused2","func","retryCount","log","failedCount","Error","stack"],"mappings":"kCAQO,SAAyBA,GAC9B,IACE,OAAOA,GACR,CAAC,MAAOC,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,4BAUOE,eAAoCH,GACzC,IACE,aAAaA,GACd,CAAC,MAAOC,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,sBApCO,SAAwBD,GAC7B,IACE,OAAOA,GACR,CAAC,MAAAI,GACA,CAEJ,2BAaOD,eAAmCH,GACxC,IACE,aAAaA,GACd,CAAC,MAAAK,GACA,CAEJ,oBAaOF,eACLG,EACAC,EAAa,EACbC,GAEA,IAAIC,EAAc,EAClB,OACE,IACE,aAAaH,
|
|
1
|
+
{"version":3,"file":"error.cjs","sources":["../../src/error.ts"],"sourcesContent":["export function ignoreError<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch {\n // do nothing\n }\n}\n\nexport function ignoreEnoent<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n\nexport async function ignoreErrorAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch {\n // do nothing\n }\n}\n\nexport async function ignoreEnoentAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n\nexport async function withRetry<T>(\n func: (failedCount: number) => Promise<T>,\n retryCount = 3,\n log?: (message: string) => void\n): Promise<T> {\n let failedCount = 0;\n for (;;) {\n try {\n return await func(failedCount);\n } catch (error) {\n failedCount++;\n if (failedCount >= retryCount) {\n throw error;\n }\n log?.(`Retry due to: ${error instanceof Error ? error.stack : error}`);\n }\n }\n}\n"],"names":["fn","error","code","async","_unused","_unused2","func","retryCount","log","failedCount","Error","stack"],"mappings":"kCAQO,SAAyBA,GAC9B,IACE,OAAOA,GACR,CAAC,MAAOC,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,4BAUOE,eAAoCH,GACzC,IACE,aAAaA,GACd,CAAC,MAAOC,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,sBApCO,SAAwBD,GAC7B,IACE,OAAOA,GACR,CAAC,MAAAI,GACA,CAEJ,2BAaOD,eAAmCH,GACxC,IACE,aAAaA,GACd,CAAC,MAAAK,GACA,CAEJ,oBAaOF,eACLG,EACAC,EAAa,EACbC,GAEA,IAAIC,EAAc,EAClB,OACE,IACE,aAAaH,EAAKG,EACnB,CAAC,MAAOR,GAEP,GADAQ,IACIA,GAAeF,EACjB,MAAMN,EAERO,SAAAA,EAAO,iBAAgBP,aAAiBS,MAAQT,EAAMU,MAAQV,IAChE,CAEJ"}
|
package/dist/cjs/error.d.cts
CHANGED
|
@@ -2,5 +2,5 @@ declare function ignoreError<T>(fn: () => T): T | undefined;
|
|
|
2
2
|
declare function ignoreEnoent<T>(fn: () => T): T | undefined;
|
|
3
3
|
declare function ignoreErrorAsync<T>(fn: () => Promise<T>): Promise<T | undefined>;
|
|
4
4
|
declare function ignoreEnoentAsync<T>(fn: () => Promise<T>): Promise<T | undefined>;
|
|
5
|
-
declare function withRetry<T>(func: () => Promise<T>, retryCount?: number, log?: (message: string) => void): Promise<T>;
|
|
5
|
+
declare function withRetry<T>(func: (failedCount: number) => Promise<T>, retryCount?: number, log?: (message: string) => void): Promise<T>;
|
|
6
6
|
export { ignoreError, ignoreEnoent, ignoreErrorAsync, ignoreEnoentAsync, withRetry };
|
package/dist/esm/error.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ declare function ignoreError<T>(fn: () => T): T | undefined;
|
|
|
2
2
|
declare function ignoreEnoent<T>(fn: () => T): T | undefined;
|
|
3
3
|
declare function ignoreErrorAsync<T>(fn: () => Promise<T>): Promise<T | undefined>;
|
|
4
4
|
declare function ignoreEnoentAsync<T>(fn: () => Promise<T>): Promise<T | undefined>;
|
|
5
|
-
declare function withRetry<T>(func: () => Promise<T>, retryCount?: number, log?: (message: string) => void): Promise<T>;
|
|
5
|
+
declare function withRetry<T>(func: (failedCount: number) => Promise<T>, retryCount?: number, log?: (message: string) => void): Promise<T>;
|
|
6
6
|
export { ignoreError, ignoreEnoent, ignoreErrorAsync, ignoreEnoentAsync, withRetry };
|
package/dist/esm/error.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(t){try{return t()}catch(t){}}function r(t){try{return t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}}async function c(t){try{return await t()}catch(t){}}async function n(t){try{return await t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}}async function o(t,r=3,c){let n=0;for(;;)try{return await t()}catch(t){if(n++,n>=r)throw t;null==c||c(`Retry due to: ${t instanceof Error?t.stack:t}`)}}export{r as ignoreEnoent,n as ignoreEnoentAsync,t as ignoreError,c as ignoreErrorAsync,o as withRetry};
|
|
1
|
+
function t(t){try{return t()}catch(t){}}function r(t){try{return t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}}async function c(t){try{return await t()}catch(t){}}async function n(t){try{return await t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}}async function o(t,r=3,c){let n=0;for(;;)try{return await t(n)}catch(t){if(n++,n>=r)throw t;null==c||c(`Retry due to: ${t instanceof Error?t.stack:t}`)}}export{r as ignoreEnoent,n as ignoreEnoentAsync,t as ignoreError,c as ignoreErrorAsync,o as withRetry};
|
|
2
2
|
//# sourceMappingURL=error.js.map
|
package/dist/esm/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sources":["../../src/error.ts"],"sourcesContent":["export function ignoreError<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch {\n // do nothing\n }\n}\n\nexport function ignoreEnoent<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n\nexport async function ignoreErrorAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch {\n // do nothing\n }\n}\n\nexport async function ignoreEnoentAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n\nexport async function withRetry<T>(\n func: () => Promise<T>,\n retryCount = 3,\n log?: (message: string) => void\n): Promise<T> {\n let failedCount = 0;\n for (;;) {\n try {\n return await func();\n } catch (error) {\n failedCount++;\n if (failedCount >= retryCount) {\n throw error;\n }\n log?.(`Retry due to: ${error instanceof Error ? error.stack : error}`);\n }\n }\n}\n"],"names":["ignoreError","fn","_unused","ignoreEnoent","error","code","async","ignoreErrorAsync","_unused2","ignoreEnoentAsync","withRetry","func","retryCount","log","failedCount","Error","stack"],"mappings":"AAAO,SAASA,EAAeC,GAC7B,IACE,OAAOA,GACR,CAAC,MAAAC,GACA,CAEJ,CAEO,SAASC,EAAgBF,GAC9B,IACE,OAAOA,GACR,CAAC,MAAOG,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,CAEOE,eAAeC,EAAoBN,GACxC,IACE,aAAaA,GACd,CAAC,MAAAO,GACA,CAEJ,CAEOF,eAAeG,EAAqBR,GACzC,IACE,aAAaA,GACd,CAAC,MAAOG,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,CAEOE,eAAeI,EACpBC,EACAC,EAAa,EACbC,GAEA,IAAIC,EAAc,EAClB,OACE,IACE,aAAaH,
|
|
1
|
+
{"version":3,"file":"error.js","sources":["../../src/error.ts"],"sourcesContent":["export function ignoreError<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch {\n // do nothing\n }\n}\n\nexport function ignoreEnoent<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n\nexport async function ignoreErrorAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch {\n // do nothing\n }\n}\n\nexport async function ignoreEnoentAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n\nexport async function withRetry<T>(\n func: (failedCount: number) => Promise<T>,\n retryCount = 3,\n log?: (message: string) => void\n): Promise<T> {\n let failedCount = 0;\n for (;;) {\n try {\n return await func(failedCount);\n } catch (error) {\n failedCount++;\n if (failedCount >= retryCount) {\n throw error;\n }\n log?.(`Retry due to: ${error instanceof Error ? error.stack : error}`);\n }\n }\n}\n"],"names":["ignoreError","fn","_unused","ignoreEnoent","error","code","async","ignoreErrorAsync","_unused2","ignoreEnoentAsync","withRetry","func","retryCount","log","failedCount","Error","stack"],"mappings":"AAAO,SAASA,EAAeC,GAC7B,IACE,OAAOA,GACR,CAAC,MAAAC,GACA,CAEJ,CAEO,SAASC,EAAgBF,GAC9B,IACE,OAAOA,GACR,CAAC,MAAOG,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,CAEOE,eAAeC,EAAoBN,GACxC,IACE,aAAaA,GACd,CAAC,MAAAO,GACA,CAEJ,CAEOF,eAAeG,EAAqBR,GACzC,IACE,aAAaA,GACd,CAAC,MAAOG,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,CAEOE,eAAeI,EACpBC,EACAC,EAAa,EACbC,GAEA,IAAIC,EAAc,EAClB,OACE,IACE,aAAaH,EAAKG,EACnB,CAAC,MAAOV,GAEP,GADAU,IACIA,GAAeF,EACjB,MAAMR,EAERS,SAAAA,EAAO,iBAAgBT,aAAiBW,MAAQX,EAAMY,MAAQZ,IAChE,CAEJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/shared-lib",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "WillBooster Inc.",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -39,23 +39,23 @@
|
|
|
39
39
|
"@types/eslint": "8.40.2",
|
|
40
40
|
"@types/micromatch": "4.0.2",
|
|
41
41
|
"@types/prettier": "2.7.3",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "5.60.
|
|
43
|
-
"@typescript-eslint/parser": "5.60.
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "5.60.1",
|
|
43
|
+
"@typescript-eslint/parser": "5.60.1",
|
|
44
44
|
"@willbooster/eslint-config-ts": "10.2.0",
|
|
45
45
|
"@willbooster/prettier-config": "9.1.1",
|
|
46
|
-
"build-ts": "5.10.
|
|
47
|
-
"eslint": "8.
|
|
46
|
+
"build-ts": "5.10.4",
|
|
47
|
+
"eslint": "8.44.0",
|
|
48
48
|
"eslint-config-prettier": "8.8.0",
|
|
49
49
|
"eslint-import-resolver-typescript": "3.5.5",
|
|
50
50
|
"eslint-plugin-import": "2.27.5",
|
|
51
51
|
"eslint-plugin-sort-class-members": "1.18.0",
|
|
52
52
|
"eslint-plugin-sort-destructure-keys": "1.5.0",
|
|
53
53
|
"eslint-plugin-unicorn": "47.0.0",
|
|
54
|
-
"lint-staged": "13.2.
|
|
54
|
+
"lint-staged": "13.2.3",
|
|
55
55
|
"micromatch": "4.0.5",
|
|
56
56
|
"prettier": "2.8.8",
|
|
57
|
-
"sort-package-json": "2.
|
|
58
|
-
"typescript": "5.1.
|
|
57
|
+
"sort-package-json": "2.5.0",
|
|
58
|
+
"typescript": "5.1.6",
|
|
59
59
|
"vitest": "0.32.2"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|