@naturalcycles/js-lib 14.108.1 → 14.109.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.
- package/dist/array/array.util.d.ts +2 -2
- package/dist/datetime/dateInterval.d.ts +2 -1
- package/dist/datetime/localDate.d.ts +1 -1
- package/dist/datetime/localTime.d.ts +3 -2
- package/dist/datetime/timeInterval.d.ts +4 -3
- package/dist/decorators/asyncMemo.decorator.d.ts +2 -2
- package/dist/decorators/debounce.d.ts +1 -1
- package/dist/decorators/debounce.decorator.d.ts +1 -1
- package/dist/decorators/decorator.util.d.ts +1 -1
- package/dist/decorators/logMethod.decorator.d.ts +1 -1
- package/dist/decorators/memo.decorator.d.ts +2 -2
- package/dist/decorators/memo.util.d.ts +1 -1
- package/dist/decorators/memoFn.d.ts +2 -2
- package/dist/decorators/memoFnAsync.d.ts +2 -2
- package/dist/decorators/memoSimple.decorator.d.ts +1 -1
- package/dist/decorators/retry.decorator.d.ts +1 -1
- package/dist/decorators/timeout.decorator.d.ts +1 -1
- package/dist/enum.util.d.ts +1 -1
- package/dist/error/app.error.d.ts +1 -1
- package/dist/error/assert.d.ts +1 -1
- package/dist/error/error.util.d.ts +4 -3
- package/dist/error/http.error.d.ts +1 -1
- package/dist/error/try.d.ts +1 -1
- package/dist/error/tryCatch.d.ts +2 -2
- package/dist/index.d.ts +27 -19
- package/dist/index.js +0 -1
- package/dist/is.util.d.ts +2 -2
- package/dist/json-schema/from-data/generateJsonSchemaFromData.d.ts +2 -2
- package/dist/json-schema/jsonSchema.cnst.d.ts +1 -1
- package/dist/json-schema/jsonSchema.model.d.ts +2 -2
- package/dist/json-schema/jsonSchema.util.d.ts +3 -2
- package/dist/json-schema/jsonSchemaBuilder.d.ts +2 -2
- package/dist/json-schema/jsonSchemas.d.ts +1 -1
- package/dist/lazy.d.ts +1 -1
- package/dist/object/object.util.d.ts +2 -2
- package/dist/object/sortObject.d.ts +1 -1
- package/dist/promise/pFilter.d.ts +1 -1
- package/dist/promise/pMap.d.ts +2 -1
- package/dist/promise/pQueue.d.ts +1 -1
- package/dist/promise/pRetry.d.ts +1 -1
- package/dist/promise/pTimeout.d.ts +2 -2
- package/dist/seq/seq.d.ts +2 -1
- package/dist/string/safeJsonStringify.d.ts +1 -1
- package/dist/string/stringifyAny.d.ts +1 -1
- package/dist/string/url.util.d.ts +1 -1
- package/dist/types.d.ts +4 -6
- package/dist/types.js +3 -14
- package/dist-esm/error/error.util.js +1 -1
- package/dist-esm/index.js +2 -3
- package/dist-esm/json-schema/from-data/generateJsonSchemaFromData.js +1 -1
- package/dist-esm/json-schema/jsonSchemaBuilder.js +1 -1
- package/dist-esm/seq/seq.js +1 -1
- package/dist-esm/types.js +3 -11
- package/package.json +3 -5
- package/src/array/array.util.ts +2 -2
- package/src/datetime/dateInterval.ts +2 -1
- package/src/datetime/localDate.ts +1 -1
- package/src/datetime/localTime.ts +3 -2
- package/src/datetime/timeInterval.ts +4 -3
- package/src/decorators/asyncMemo.decorator.ts +4 -3
- package/src/decorators/debounce.decorator.ts +2 -1
- package/src/decorators/debounce.ts +1 -1
- package/src/decorators/decorator.util.ts +1 -1
- package/src/decorators/logMethod.decorator.ts +2 -1
- package/src/decorators/memo.decorator.ts +4 -3
- package/src/decorators/memo.util.ts +1 -1
- package/src/decorators/memoFn.ts +3 -2
- package/src/decorators/memoFnAsync.ts +3 -2
- package/src/decorators/memoSimple.decorator.ts +3 -2
- package/src/decorators/retry.decorator.ts +2 -1
- package/src/decorators/timeout.decorator.ts +2 -1
- package/src/enum.util.ts +1 -1
- package/src/error/app.error.ts +1 -1
- package/src/error/assert.ts +2 -1
- package/src/error/error.util.ts +6 -6
- package/src/error/http.error.ts +1 -1
- package/src/error/try.ts +1 -1
- package/src/error/tryCatch.ts +3 -2
- package/src/index.ts +27 -27
- package/src/is.util.ts +2 -2
- package/src/json-schema/from-data/generateJsonSchemaFromData.ts +5 -4
- package/src/json-schema/jsonSchema.cnst.ts +1 -1
- package/src/json-schema/jsonSchema.model.ts +2 -2
- package/src/json-schema/jsonSchema.util.ts +3 -3
- package/src/json-schema/jsonSchemaBuilder.ts +3 -5
- package/src/json-schema/jsonSchemas.ts +1 -1
- package/src/lazy.ts +1 -1
- package/src/object/object.util.ts +2 -2
- package/src/object/sortObject.ts +2 -1
- package/src/promise/pFilter.ts +1 -1
- package/src/promise/pMap.ts +2 -1
- package/src/promise/pQueue.ts +3 -2
- package/src/promise/pRetry.ts +2 -1
- package/src/promise/pTimeout.ts +2 -2
- package/src/seq/seq.ts +2 -3
- package/src/string/safeJsonStringify.ts +1 -1
- package/src/string/stringifyAny.ts +1 -1
- package/src/string/url.util.ts +1 -1
- package/src/types.ts +4 -12
package/dist-esm/types.js
CHANGED
|
@@ -18,25 +18,17 @@ export const _passNothingPredicate = () => false;
|
|
|
18
18
|
* Needed due to https://github.com/microsoft/TypeScript/issues/13778
|
|
19
19
|
* Only affects typings, no runtime effect.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
22
|
-
return Object.values(m);
|
|
23
|
-
}
|
|
21
|
+
export const _stringMapValues = Object.values;
|
|
24
22
|
/**
|
|
25
23
|
* Needed due to https://github.com/microsoft/TypeScript/issues/13778
|
|
26
24
|
* Only affects typings, no runtime effect.
|
|
27
25
|
*/
|
|
28
|
-
export
|
|
29
|
-
return Object.entries(m);
|
|
30
|
-
}
|
|
26
|
+
export const _stringMapEntries = Object.entries;
|
|
31
27
|
/**
|
|
32
28
|
* Like `Object.keys`, but returns keys typed as `keyof T`, not as just `string`.
|
|
33
29
|
* This is how TypeScript should work, actually.
|
|
34
|
-
*
|
|
35
|
-
* @experimental
|
|
36
30
|
*/
|
|
37
|
-
export
|
|
38
|
-
return Object.keys(obj);
|
|
39
|
-
}
|
|
31
|
+
export const _objectKeys = Object.keys;
|
|
40
32
|
/**
|
|
41
33
|
* Utility function that helps to cast *existing variable* to needed type T.
|
|
42
34
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/js-lib",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.109.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky install",
|
|
6
6
|
"build-prod": "build-prod-esm-cjs",
|
|
@@ -17,13 +17,11 @@
|
|
|
17
17
|
"@naturalcycles/time-lib": "^3.5.1",
|
|
18
18
|
"@types/node": "^18.0.0",
|
|
19
19
|
"expect-type": "^0.13.0",
|
|
20
|
-
"jest": "^
|
|
21
|
-
"patch-package": "^6.2.1",
|
|
20
|
+
"jest": "^29.0.0",
|
|
22
21
|
"prettier": "^2.1.2",
|
|
23
22
|
"rxjs": "^7.0.1",
|
|
24
23
|
"vuepress": "^1.7.1",
|
|
25
|
-
"vuepress-plugin-typescript": "^0.3.1"
|
|
26
|
-
"weak-napi": "^2.0.2"
|
|
24
|
+
"vuepress-plugin-typescript": "^0.3.1"
|
|
27
25
|
},
|
|
28
26
|
"files": [
|
|
29
27
|
"dist",
|
package/src/array/array.util.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _isNotNullish } from '../is.util'
|
|
2
|
-
import { RecursiveArray } from '../lodash.types'
|
|
3
|
-
import { FalsyValue, Mapper, Predicate, StringMap } from '../types'
|
|
2
|
+
import type { RecursiveArray } from '../lodash.types'
|
|
3
|
+
import type { FalsyValue, Mapper, Predicate, StringMap } from '../types'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Inclusiveness,
|
|
1
|
+
import type { Inclusiveness, LocalDateConfig, LocalDateUnit } from './localDate'
|
|
2
|
+
import { LocalDate } from './localDate'
|
|
2
3
|
|
|
3
4
|
export type DateIntervalConfig = DateInterval | DateIntervalString
|
|
4
5
|
export type DateIntervalString = string
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { _assert } from '../error/assert'
|
|
2
2
|
import { _ms } from '../time/time.util'
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
4
|
IsoDateString,
|
|
5
5
|
IsoDateTimeString,
|
|
6
6
|
UnixTimestampMillisNumber,
|
|
7
7
|
UnixTimestampNumber,
|
|
8
8
|
} from '../types'
|
|
9
|
-
import { Inclusiveness
|
|
9
|
+
import type { Inclusiveness } from './localDate'
|
|
10
|
+
import { LocalDate } from './localDate'
|
|
10
11
|
|
|
11
12
|
export type LocalTimeUnit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second'
|
|
12
13
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { UnixTimestampNumber } from '../types'
|
|
2
|
-
import { Inclusiveness } from './localDate'
|
|
3
|
-
import {
|
|
1
|
+
import type { UnixTimestampNumber } from '../types'
|
|
2
|
+
import type { Inclusiveness } from './localDate'
|
|
3
|
+
import type { LocalTimeConfig } from './localTime'
|
|
4
|
+
import { LocalTime } from './localTime'
|
|
4
5
|
|
|
5
6
|
export type TimeIntervalConfig = TimeInterval | TimeIntervalString
|
|
6
7
|
export type TimeIntervalString = string
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { CommonLogger } from '../log/commonLogger'
|
|
1
|
+
import type { CommonLogger } from '../log/commonLogger'
|
|
2
2
|
import { _since } from '../time/time.util'
|
|
3
|
-
import { AnyObject } from '../types'
|
|
3
|
+
import type { AnyObject } from '../types'
|
|
4
4
|
import { _getArgsSignature, _getMethodSignature, _getTargetMethodSignature } from './decorator.util'
|
|
5
|
-
import { AsyncMemoCache
|
|
5
|
+
import type { AsyncMemoCache } from './memo.util'
|
|
6
|
+
import { jsonMemoSerializer, MapMemoCache } from './memo.util'
|
|
6
7
|
|
|
7
8
|
export interface AsyncMemoOptions {
|
|
8
9
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DebounceOptions, ThrottleOptions
|
|
1
|
+
import type { DebounceOptions, ThrottleOptions } from './debounce'
|
|
2
|
+
import { _debounce, _throttle } from './debounce'
|
|
2
3
|
|
|
3
4
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4
5
|
export function _Debounce(wait: number, opt: DebounceOptions = {}): MethodDecorator {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CommonLogger } from '..'
|
|
2
|
+
import { SimpleMovingAverage, _stringifyAny, _assert } from '..'
|
|
2
3
|
import { _ms } from '../time/time.util'
|
|
3
4
|
import { _getArgsSignature, _getMethodSignature } from './decorator.util'
|
|
4
5
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { CommonLogger } from '../log/commonLogger'
|
|
1
|
+
import type { CommonLogger } from '../log/commonLogger'
|
|
2
2
|
import { _since } from '../time/time.util'
|
|
3
|
-
import { AnyObject } from '../types'
|
|
3
|
+
import type { AnyObject } from '../types'
|
|
4
4
|
import { _getArgsSignature, _getMethodSignature, _getTargetMethodSignature } from './decorator.util'
|
|
5
|
-
import {
|
|
5
|
+
import type { MemoCache } from './memo.util'
|
|
6
|
+
import { jsonMemoSerializer, MapMemoCache } from './memo.util'
|
|
6
7
|
|
|
7
8
|
export interface MemoOptions {
|
|
8
9
|
/**
|
package/src/decorators/memoFn.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { _since } from '../time/time.util'
|
|
2
2
|
import { _getArgsSignature } from './decorator.util'
|
|
3
|
-
import { MemoOptions } from './memo.decorator'
|
|
4
|
-
import {
|
|
3
|
+
import type { MemoOptions } from './memo.decorator'
|
|
4
|
+
import type { MemoCache } from './memo.util'
|
|
5
|
+
import { jsonMemoSerializer, MapMemoCache } from './memo.util'
|
|
5
6
|
|
|
6
7
|
export interface MemoizedFunction {
|
|
7
8
|
cache: MemoCache
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { _since } from '../time/time.util'
|
|
2
|
-
import { AsyncMemoOptions } from './asyncMemo.decorator'
|
|
2
|
+
import type { AsyncMemoOptions } from './asyncMemo.decorator'
|
|
3
3
|
import { _getArgsSignature } from './decorator.util'
|
|
4
|
-
import { AsyncMemoCache
|
|
4
|
+
import type { AsyncMemoCache } from './memo.util'
|
|
5
|
+
import { jsonMemoSerializer, MapMemoCache } from './memo.util'
|
|
5
6
|
|
|
6
7
|
export interface MemoizedAsyncFunction {
|
|
7
8
|
cache: AsyncMemoCache
|
|
@@ -11,9 +11,10 @@ Otherwise resorts to JSON.stringify.
|
|
|
11
11
|
Benchmark shows similar perf for ObjectCache and MapCache.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { CommonLogger } from '../log/commonLogger'
|
|
14
|
+
import type { CommonLogger } from '../log/commonLogger'
|
|
15
15
|
import { _getArgsSignature, _getTargetMethodSignature } from './decorator.util'
|
|
16
|
-
import {
|
|
16
|
+
import type { MemoCache } from './memo.util'
|
|
17
|
+
import { jsonMemoSerializer, MapMemoCache } from './memo.util'
|
|
17
18
|
|
|
18
19
|
export interface MemoOpts {
|
|
19
20
|
logHit?: boolean
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _assert } from '../error/assert'
|
|
2
|
-
import {
|
|
2
|
+
import type { PTimeoutOptions } from '../promise/pTimeout'
|
|
3
|
+
import { pTimeout } from '../promise/pTimeout'
|
|
3
4
|
import { _getMethodSignature } from './decorator.util'
|
|
4
5
|
|
|
5
6
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
package/src/enum.util.ts
CHANGED
package/src/error/app.error.ts
CHANGED
package/src/error/assert.ts
CHANGED
package/src/error/error.util.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AppError,
|
|
1
|
+
import type {
|
|
3
2
|
ErrorData,
|
|
4
3
|
ErrorObject,
|
|
5
4
|
HttpErrorData,
|
|
6
5
|
HttpErrorResponse,
|
|
7
6
|
StringifyAnyOptions,
|
|
8
|
-
_jsonParseIfPossible,
|
|
9
|
-
_stringifyAny,
|
|
10
7
|
Class,
|
|
11
8
|
} from '..'
|
|
9
|
+
import { AppError, _jsonParseIfPossible, _stringifyAny } from '..'
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* Useful to ensure that error in `catch (err) { ... }`
|
|
@@ -89,11 +87,13 @@ export function _errorToErrorObject<DATA_TYPE extends ErrorData = ErrorData>(
|
|
|
89
87
|
return obj
|
|
90
88
|
}
|
|
91
89
|
|
|
92
|
-
export function _errorObjectToAppError<DATA_TYPE
|
|
90
|
+
export function _errorObjectToAppError<DATA_TYPE extends ErrorData>(
|
|
91
|
+
o: ErrorObject<DATA_TYPE>,
|
|
92
|
+
): AppError<DATA_TYPE> {
|
|
93
93
|
return _errorObjectToError(o, AppError)
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
export function _errorObjectToError<DATA_TYPE, ERROR_TYPE extends Error>(
|
|
96
|
+
export function _errorObjectToError<DATA_TYPE extends ErrorData, ERROR_TYPE extends Error>(
|
|
97
97
|
o: ErrorObject<DATA_TYPE>,
|
|
98
98
|
errorClass: Class<ERROR_TYPE> = Error as any,
|
|
99
99
|
): ERROR_TYPE {
|
package/src/error/http.error.ts
CHANGED
package/src/error/try.ts
CHANGED
package/src/error/tryCatch.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { CommonLogger } from '../index'
|
|
2
|
+
import { _anyToError, _since, _stringifyAny } from '../index'
|
|
3
|
+
import type { AnyFunction } from '../types'
|
|
3
4
|
|
|
4
5
|
export interface TryCatchOptions {
|
|
5
6
|
/**
|
package/src/index.ts
CHANGED
|
@@ -2,18 +2,15 @@ export * from './array/array.util'
|
|
|
2
2
|
export * from './lazy'
|
|
3
3
|
export * from './string/url.util'
|
|
4
4
|
export * from './array/range'
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
PromiseDecoratorResp,
|
|
8
|
-
_createPromiseDecorator,
|
|
9
|
-
} from './decorators/createPromiseDecorator'
|
|
5
|
+
import type { PromiseDecoratorCfg, PromiseDecoratorResp } from './decorators/createPromiseDecorator'
|
|
6
|
+
import { _createPromiseDecorator } from './decorators/createPromiseDecorator'
|
|
10
7
|
export * from './decorators/debounce'
|
|
11
8
|
export * from './decorators/debounce.decorator'
|
|
12
9
|
export * from './decorators/decorator.util'
|
|
13
10
|
export * from './decorators/logMethod.decorator'
|
|
14
11
|
export * from './decorators/memo.decorator'
|
|
15
12
|
export * from './decorators/asyncMemo.decorator'
|
|
16
|
-
import { MemoCache, AsyncMemoCache } from './decorators/memo.util'
|
|
13
|
+
import type { MemoCache, AsyncMemoCache } from './decorators/memo.util'
|
|
17
14
|
export * from './decorators/memoFn'
|
|
18
15
|
export * from './decorators/memoFnAsync'
|
|
19
16
|
export * from './decorators/retry.decorator'
|
|
@@ -21,7 +18,7 @@ export * from './decorators/timeout.decorator'
|
|
|
21
18
|
export * from './error/app.error'
|
|
22
19
|
export * from './error/assert'
|
|
23
20
|
export * from './enum.util'
|
|
24
|
-
import {
|
|
21
|
+
import type {
|
|
25
22
|
Admin401ErrorData,
|
|
26
23
|
Admin403ErrorData,
|
|
27
24
|
ErrorData,
|
|
@@ -33,10 +30,11 @@ export * from './error/error.util'
|
|
|
33
30
|
import { ErrorMode } from './error/errorMode'
|
|
34
31
|
export * from './error/http.error'
|
|
35
32
|
export * from './error/try'
|
|
36
|
-
import { TryCatchOptions
|
|
33
|
+
import type { TryCatchOptions } from './error/tryCatch'
|
|
34
|
+
import { _TryCatch, _tryCatch } from './error/tryCatch'
|
|
37
35
|
export * from './json-schema/from-data/generateJsonSchemaFromData'
|
|
38
36
|
export * from './json-schema/jsonSchema.cnst'
|
|
39
|
-
import {
|
|
37
|
+
import type {
|
|
40
38
|
JsonSchema,
|
|
41
39
|
JsonSchemaAllOf,
|
|
42
40
|
JsonSchemaAny,
|
|
@@ -56,11 +54,8 @@ import {
|
|
|
56
54
|
JsonSchemaTuple,
|
|
57
55
|
} from './json-schema/jsonSchema.model'
|
|
58
56
|
export * from './json-schema/jsonSchema.util'
|
|
59
|
-
import {
|
|
60
|
-
|
|
61
|
-
JsonSchemaAnyBuilder,
|
|
62
|
-
JsonSchemaBuilder,
|
|
63
|
-
} from './json-schema/jsonSchemaBuilder'
|
|
57
|
+
import type { JsonSchemaBuilder } from './json-schema/jsonSchemaBuilder'
|
|
58
|
+
import { jsonSchema, JsonSchemaAnyBuilder } from './json-schema/jsonSchemaBuilder'
|
|
64
59
|
export * from './math/math.util'
|
|
65
60
|
export * from './math/sma'
|
|
66
61
|
export * from './number/createDeterministicRandom'
|
|
@@ -70,26 +65,31 @@ export * from './object/object.util'
|
|
|
70
65
|
export * from './object/sortObject'
|
|
71
66
|
export * from './object/sortObjectDeep'
|
|
72
67
|
import { AggregatedError } from './promise/AggregatedError'
|
|
73
|
-
import { DeferredPromise
|
|
68
|
+
import type { DeferredPromise } from './promise/pDefer'
|
|
69
|
+
import { pDefer } from './promise/pDefer'
|
|
74
70
|
export * from './promise/pDelay'
|
|
75
71
|
export * from './promise/pFilter'
|
|
76
72
|
export * from './promise/pHang'
|
|
77
|
-
import {
|
|
73
|
+
import type { PMapOptions } from './promise/pMap'
|
|
74
|
+
import { pMap } from './promise/pMap'
|
|
78
75
|
export * from './promise/pProps'
|
|
79
|
-
import {
|
|
76
|
+
import type { PRetryOptions } from './promise/pRetry'
|
|
77
|
+
import { pRetry, pRetryFn } from './promise/pRetry'
|
|
80
78
|
export * from './promise/pState'
|
|
81
|
-
import {
|
|
79
|
+
import type { PTimeoutOptions } from './promise/pTimeout'
|
|
80
|
+
import { pTimeout, pTimeoutFn } from './promise/pTimeout'
|
|
82
81
|
export * from './string/case'
|
|
83
82
|
export * from './string/json.util'
|
|
84
83
|
export * from './string/string.util'
|
|
85
84
|
export * from './string/readingTime'
|
|
86
85
|
export * from './string/escape'
|
|
87
86
|
export * from './string/pupa'
|
|
88
|
-
import { JsonStringifyFunction, StringifyAnyOptions
|
|
87
|
+
import type { JsonStringifyFunction, StringifyAnyOptions } from './string/stringifyAny'
|
|
88
|
+
import { _stringifyAny } from './string/stringifyAny'
|
|
89
89
|
export * from './time/time.util'
|
|
90
90
|
export * from './is.util'
|
|
91
91
|
|
|
92
|
-
import {
|
|
92
|
+
import type {
|
|
93
93
|
Class,
|
|
94
94
|
ConditionalExcept,
|
|
95
95
|
ConditionalPick,
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
ReadonlyDeep,
|
|
99
99
|
Simplify,
|
|
100
100
|
} from './typeFest'
|
|
101
|
-
import {
|
|
101
|
+
import type {
|
|
102
102
|
AsyncMapper,
|
|
103
103
|
AsyncPredicate,
|
|
104
104
|
BaseDBEntity,
|
|
@@ -144,7 +144,7 @@ import {
|
|
|
144
144
|
export * from './types'
|
|
145
145
|
export * from './unit/size.util'
|
|
146
146
|
import { is } from './vendor/is'
|
|
147
|
-
import {
|
|
147
|
+
import type {
|
|
148
148
|
CommonLogLevel,
|
|
149
149
|
CommonLogFunction,
|
|
150
150
|
CommonLogger,
|
|
@@ -152,7 +152,7 @@ import {
|
|
|
152
152
|
} from './log/commonLogger'
|
|
153
153
|
export * from './log/commonLogger'
|
|
154
154
|
export * from './string/safeJsonStringify'
|
|
155
|
-
import { PQueueCfg } from './promise/pQueue'
|
|
155
|
+
import type { PQueueCfg } from './promise/pQueue'
|
|
156
156
|
export * from './promise/pQueue'
|
|
157
157
|
export * from './seq/seq'
|
|
158
158
|
export * from './math/stack.util'
|
|
@@ -161,22 +161,22 @@ export * from './datetime/localDate'
|
|
|
161
161
|
export * from './datetime/localTime'
|
|
162
162
|
export * from './datetime/dateInterval'
|
|
163
163
|
export * from './datetime/timeInterval'
|
|
164
|
-
import {
|
|
164
|
+
import type {
|
|
165
165
|
LocalDateConfig,
|
|
166
166
|
LocalDateFormatter,
|
|
167
167
|
LocalDateUnit,
|
|
168
168
|
LocalDateUnitStrict,
|
|
169
169
|
Inclusiveness,
|
|
170
170
|
} from './datetime/localDate'
|
|
171
|
-
import {
|
|
171
|
+
import type {
|
|
172
172
|
LocalTimeConfig,
|
|
173
173
|
LocalTimeFormatter,
|
|
174
174
|
LocalTimeUnit,
|
|
175
175
|
LocalTimeComponents,
|
|
176
176
|
ISODayOfWeek,
|
|
177
177
|
} from './datetime/localTime'
|
|
178
|
-
import { DateIntervalConfig, DateIntervalString } from './datetime/dateInterval'
|
|
179
|
-
import { TimeIntervalConfig, TimeIntervalString } from './datetime/timeInterval'
|
|
178
|
+
import type { DateIntervalConfig, DateIntervalString } from './datetime/dateInterval'
|
|
179
|
+
import type { TimeIntervalConfig, TimeIntervalString } from './datetime/timeInterval'
|
|
180
180
|
|
|
181
181
|
export type {
|
|
182
182
|
DateIntervalConfig,
|
package/src/is.util.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Primitive } from './typeFest'
|
|
2
|
-
import { AnyObject, FalsyValue, NullishValue } from './types'
|
|
1
|
+
import type { Primitive } from './typeFest'
|
|
2
|
+
import type { AnyObject, FalsyValue, NullishValue } from './types'
|
|
3
3
|
|
|
4
4
|
type Nullish<T> = T extends NullishValue ? T : never
|
|
5
5
|
type Truthy<T> = T extends FalsyValue ? never : T
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
JsonSchema,
|
|
3
3
|
JsonSchemaArray,
|
|
4
4
|
JsonSchemaBoolean,
|
|
@@ -8,10 +8,9 @@ import {
|
|
|
8
8
|
JsonSchemaOneOf,
|
|
9
9
|
JsonSchemaString,
|
|
10
10
|
StringMap,
|
|
11
|
-
_stringMapEntries,
|
|
12
|
-
_uniq,
|
|
13
11
|
AnyObject,
|
|
14
12
|
} from '../..'
|
|
13
|
+
import { _stringMapEntries, _uniq } from '../..'
|
|
15
14
|
|
|
16
15
|
type PrimitiveType = 'undefined' | 'null' | 'boolean' | 'string' | 'number'
|
|
17
16
|
type Type = PrimitiveType | 'array' | 'object'
|
|
@@ -21,7 +20,9 @@ type Type = PrimitiveType | 'array' | 'object'
|
|
|
21
20
|
*
|
|
22
21
|
* `additionalProperties` is set to `true`, cause it's safer.
|
|
23
22
|
*/
|
|
24
|
-
export function generateJsonSchemaFromData<T =
|
|
23
|
+
export function generateJsonSchemaFromData<T extends AnyObject = AnyObject>(
|
|
24
|
+
rows: AnyObject[],
|
|
25
|
+
): JsonSchemaObject<T> {
|
|
25
26
|
return objectToJsonSchema(rows as any) as JsonSchemaObject<T>
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyObject, StringMap } from '../types'
|
|
1
|
+
import type { AnyObject, StringMap } from '../types'
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
4
4
|
export type JsonSchema<T = unknown> =
|
|
@@ -14,7 +14,7 @@ export type JsonSchema<T = unknown> =
|
|
|
14
14
|
| JsonSchemaNumber
|
|
15
15
|
| JsonSchemaBoolean
|
|
16
16
|
| JsonSchemaNull
|
|
17
|
-
| JsonSchemaObject
|
|
17
|
+
| JsonSchemaObject
|
|
18
18
|
| JsonSchemaArray<T>
|
|
19
19
|
| JsonSchemaTuple<T>
|
|
20
20
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { _uniq } from '../index'
|
|
1
|
+
import { _uniq, AnyObject } from '../index'
|
|
2
2
|
import { _filterNullishValues } from '../object/object.util'
|
|
3
|
-
import { JsonSchemaObject } from './jsonSchema.model'
|
|
3
|
+
import type { JsonSchemaObject } from './jsonSchema.model'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Merges s2 into s1 (mutates s1) and returns s1.
|
|
7
7
|
* Does not mutate s2.
|
|
8
8
|
* API similar to Object.assign(s1, s2)
|
|
9
9
|
*/
|
|
10
|
-
export function mergeJsonSchemaObjects<T1, T2>(
|
|
10
|
+
export function mergeJsonSchemaObjects<T1 extends AnyObject, T2 extends AnyObject>(
|
|
11
11
|
s1: JsonSchemaObject<T1>,
|
|
12
12
|
s2: JsonSchemaObject<T2>,
|
|
13
13
|
): JsonSchemaObject<T1 & T2> {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { _uniq } from '../array/array.util'
|
|
2
|
-
import {
|
|
2
|
+
import type {
|
|
3
3
|
BaseDBEntity,
|
|
4
4
|
JsonSchemaAllOf,
|
|
5
5
|
JsonSchemaArray,
|
|
6
6
|
JsonSchemaOneOf,
|
|
7
7
|
JsonSchemaTuple,
|
|
8
|
-
mergeJsonSchemaObjects,
|
|
9
8
|
SavedDBEntity,
|
|
10
|
-
_deepCopy,
|
|
11
|
-
_sortObject,
|
|
12
9
|
AnyObject,
|
|
13
10
|
} from '../index'
|
|
11
|
+
import { mergeJsonSchemaObjects, _deepCopy, _sortObject } from '../index'
|
|
14
12
|
import { JSON_SCHEMA_ORDER } from './jsonSchema.cnst'
|
|
15
|
-
import {
|
|
13
|
+
import type {
|
|
16
14
|
JsonSchema,
|
|
17
15
|
JsonSchemaAny,
|
|
18
16
|
JsonSchemaBoolean,
|
package/src/lazy.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _isEmpty, _isObject } from '../is.util'
|
|
2
|
-
import { PropertyPath } from '../lodash.types'
|
|
3
|
-
import { AnyObject, ObjectMapper, ObjectPredicate, StringMap, ValueOf } from '../types'
|
|
2
|
+
import type { PropertyPath } from '../lodash.types'
|
|
3
|
+
import type { AnyObject, ObjectMapper, ObjectPredicate, StringMap, ValueOf } from '../types'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns clone of `obj` with only `props` preserved.
|
package/src/object/sortObject.ts
CHANGED
package/src/promise/pFilter.ts
CHANGED
package/src/promise/pMap.ts
CHANGED
|
@@ -7,7 +7,8 @@ Improvements:
|
|
|
7
7
|
- Compatible with pProps (that had typings issues)
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { AbortableAsyncMapper
|
|
10
|
+
import type { AbortableAsyncMapper } from '..'
|
|
11
|
+
import { END, ErrorMode, SKIP } from '..'
|
|
11
12
|
import { AggregatedError } from './AggregatedError'
|
|
12
13
|
|
|
13
14
|
export interface PMapOptions {
|
package/src/promise/pQueue.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ErrorMode } from '../error/errorMode'
|
|
2
|
-
import { CommonLogger } from '../log/commonLogger'
|
|
3
|
-
import { DeferredPromise
|
|
2
|
+
import type { CommonLogger } from '../log/commonLogger'
|
|
3
|
+
import type { DeferredPromise } from './pDefer'
|
|
4
|
+
import { pDefer } from './pDefer'
|
|
4
5
|
|
|
5
6
|
export interface PQueueCfg {
|
|
6
7
|
concurrency: number
|
package/src/promise/pRetry.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AnyFunction, AppError, CommonLogger, ErrorData } from '..'
|
|
2
|
+
import { _since, _stringifyAny } from '..'
|
|
2
3
|
import { TimeoutError } from './pTimeout'
|
|
3
4
|
|
|
4
5
|
export interface PRetryOptions {
|