@naturalcycles/js-lib 14.128.1 → 14.130.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/decorators/asyncMemo.decorator.d.ts +2 -2
- package/dist/decorators/createPromiseDecorator.d.ts +6 -6
- package/dist/decorators/debounce.d.ts +2 -2
- package/dist/decorators/memo.decorator.d.ts +2 -2
- package/dist/decorators/memo.util.d.ts +7 -7
- package/dist/error/app.error.d.ts +1 -1
- package/dist/error/app.error.js +2 -2
- package/dist/error/assert.d.ts +0 -1
- package/dist/error/assert.js +0 -3
- package/dist/error/error.model.d.ts +1 -0
- package/dist/error/error.util.d.ts +4 -4
- package/dist/error/error.util.js +26 -13
- package/dist/error/errorMode.d.ts +1 -1
- package/dist/error/errorMode.js +1 -1
- package/dist/error/http.error.d.ts +1 -1
- package/dist/error/http.error.js +2 -2
- package/dist/error/tryCatch.d.ts +1 -1
- package/dist/http/fetcher.js +4 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +9 -4
- package/dist/json-schema/jsonSchemaBuilder.d.ts +1 -1
- package/dist/promise/pDefer.d.ts +2 -2
- package/dist/promise/pMap.js +3 -4
- package/dist/promise/pRetry.d.ts +1 -1
- package/dist/promise/pTimeout.d.ts +1 -1
- package/dist/string/pupa.d.ts +2 -2
- package/dist/string/readingTime.d.ts +1 -1
- package/dist/string/stringifyAny.d.ts +6 -0
- package/dist/string/stringifyAny.js +13 -1
- package/dist/zod/zod.shared.schemas.d.ts +52 -0
- package/dist/zod/zod.shared.schemas.js +94 -0
- package/dist/zod/zod.util.d.ts +21 -0
- package/dist/zod/zod.util.js +59 -0
- package/dist-esm/error/app.error.js +2 -2
- package/dist-esm/error/assert.js +0 -3
- package/dist-esm/error/error.util.js +26 -11
- package/dist-esm/error/errorMode.js +1 -1
- package/dist-esm/error/http.error.js +2 -2
- package/dist-esm/http/fetcher.js +4 -3
- package/dist-esm/index.js +5 -3
- package/dist-esm/promise/pMap.js +3 -4
- package/dist-esm/string/stringifyAny.js +13 -1
- package/dist-esm/zod/zod.shared.schemas.js +91 -0
- package/dist-esm/zod/zod.util.js +53 -0
- package/package.json +3 -2
- package/src/decorators/asyncMemo.decorator.ts +2 -2
- package/src/decorators/createPromiseDecorator.ts +4 -4
- package/src/decorators/debounce.ts +2 -2
- package/src/decorators/memo.decorator.ts +2 -2
- package/src/decorators/memo.util.ts +7 -7
- package/src/error/app.error.ts +2 -2
- package/src/error/assert.ts +1 -5
- package/src/error/error.model.ts +10 -0
- package/src/error/error.util.ts +26 -21
- package/src/error/errorMode.ts +1 -1
- package/src/error/http.error.ts +2 -2
- package/src/error/tryCatch.ts +1 -1
- package/src/http/fetcher.ts +5 -8
- package/src/index.ts +6 -3
- package/src/json-schema/jsonSchemaBuilder.ts +1 -1
- package/src/promise/pDefer.ts +2 -2
- package/src/promise/pMap.ts +3 -4
- package/src/promise/pRetry.ts +1 -1
- package/src/promise/pTimeout.ts +1 -1
- package/src/string/pupa.ts +1 -1
- package/src/string/readingTime.ts +1 -1
- package/src/string/stringifyAny.ts +23 -1
- package/src/zod/zod.shared.schemas.ts +102 -0
- package/src/zod/zod.util.ts +77 -0
- package/dist/promise/AggregatedError.d.ts +0 -10
- package/dist/promise/AggregatedError.js +0 -34
- package/dist-esm/promise/AggregatedError.js +0 -30
- package/src/promise/AggregatedError.ts +0 -36
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error that aggregates a number of other errors.
|
|
3
|
-
* .errors contain raw original errors to be accessed if needed.
|
|
4
|
-
* .results contain the results of some batch operation (if needed).
|
|
5
|
-
*/
|
|
6
|
-
export class AggregatedError extends Error {
|
|
7
|
-
constructor(errors, results = []) {
|
|
8
|
-
const message = [
|
|
9
|
-
`${errors.length} errors:`,
|
|
10
|
-
...errors.map((e, i) => `${i + 1}. ${e.message}`),
|
|
11
|
-
].join('\n');
|
|
12
|
-
super(message);
|
|
13
|
-
this.errors = errors;
|
|
14
|
-
this.results = results;
|
|
15
|
-
Object.defineProperty(this, 'name', {
|
|
16
|
-
value: this.constructor.name,
|
|
17
|
-
configurable: true,
|
|
18
|
-
});
|
|
19
|
-
if (Error.captureStackTrace) {
|
|
20
|
-
Error.captureStackTrace(this, this.constructor);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
Object.defineProperty(this, 'stack', {
|
|
24
|
-
value: new Error().stack,
|
|
25
|
-
writable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error that aggregates a number of other errors.
|
|
3
|
-
* .errors contain raw original errors to be accessed if needed.
|
|
4
|
-
* .results contain the results of some batch operation (if needed).
|
|
5
|
-
*/
|
|
6
|
-
export class AggregatedError<RESULT = any> extends Error {
|
|
7
|
-
errors!: Error[]
|
|
8
|
-
results!: RESULT[]
|
|
9
|
-
|
|
10
|
-
constructor(errors: Error[], results: RESULT[] = []) {
|
|
11
|
-
const message = [
|
|
12
|
-
`${errors.length} errors:`,
|
|
13
|
-
...errors.map((e, i) => `${i + 1}. ${e.message}`),
|
|
14
|
-
].join('\n')
|
|
15
|
-
|
|
16
|
-
super(message)
|
|
17
|
-
|
|
18
|
-
this.errors = errors
|
|
19
|
-
this.results = results
|
|
20
|
-
|
|
21
|
-
Object.defineProperty(this, 'name', {
|
|
22
|
-
value: this.constructor.name,
|
|
23
|
-
configurable: true,
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
if (Error.captureStackTrace) {
|
|
27
|
-
Error.captureStackTrace(this, this.constructor)
|
|
28
|
-
} else {
|
|
29
|
-
Object.defineProperty(this, 'stack', {
|
|
30
|
-
value: new Error().stack, // eslint-disable-line unicorn/error-message
|
|
31
|
-
writable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|