@naturalcycles/js-lib 14.274.0 → 14.274.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/dist/array/array.util.d.ts +1 -1
- package/dist/browser/adminService.d.ts +1 -1
- package/dist/browser/i18n/fetchTranslationLoader.d.ts +3 -3
- package/dist/browser/i18n/translation.service.d.ts +1 -1
- package/dist/datetime/dateInterval.d.ts +2 -2
- package/dist/datetime/localDate.d.ts +1 -1
- package/dist/datetime/localTime.d.ts +1 -1
- package/dist/datetime/timeInterval.d.ts +1 -1
- package/dist/datetime/wallTime.d.ts +2 -2
- package/dist/decorators/asyncMemo.decorator.d.ts +2 -2
- package/dist/decorators/memo.decorator.d.ts +2 -3
- package/dist/decorators/memoFn.d.ts +1 -1
- package/dist/decorators/memoFnAsync.d.ts +1 -1
- package/dist/env.js +2 -3
- package/dist/error/error.model.d.ts +2 -2
- package/dist/http/fetcher.d.ts +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/iter/asyncIterable2.d.ts +3 -2
- package/dist/iter/iterable2.d.ts +2 -1
- package/dist/json-schema/jsonSchema.util.d.ts +1 -1
- package/dist/object/object.util.d.ts +2 -1
- package/dist/promise/abortable.d.ts +1 -1
- package/dist/promise/pDelay.d.ts +1 -1
- package/dist/promise/pTimeout.d.ts +1 -1
- package/dist/semver.d.ts +1 -1
- package/dist/string/hash.util.d.ts +1 -1
- package/dist/string/json.util.d.ts +1 -1
- package/dist/web.d.ts +1 -1
- package/dist-esm/array/array.util.js +1 -1
- package/dist-esm/decorators/asyncMemo.decorator.js +1 -1
- package/dist-esm/env.js +2 -3
- package/dist-esm/object/object.util.js +1 -1
- package/package.json +1 -1
- package/src/array/array.util.ts +2 -2
- package/src/browser/adminService.ts +1 -1
- package/src/browser/i18n/fetchTranslationLoader.ts +3 -3
- package/src/browser/i18n/translation.service.ts +1 -1
- package/src/datetime/dateInterval.ts +3 -2
- package/src/datetime/localDate.ts +2 -1
- package/src/datetime/localTime.ts +2 -1
- package/src/datetime/timeInterval.ts +2 -1
- package/src/datetime/wallTime.ts +3 -2
- package/src/decorators/asyncMemo.decorator.ts +4 -9
- package/src/decorators/memo.decorator.ts +4 -3
- package/src/decorators/memoFn.ts +1 -1
- package/src/decorators/memoFnAsync.ts +2 -1
- package/src/decorators/swarmSafe.decorator.ts +1 -1
- package/src/env.ts +2 -3
- package/src/error/error.model.ts +2 -2
- package/src/http/fetcher.ts +3 -3
- package/src/index.ts +2 -1
- package/src/iter/asyncIterable2.ts +3 -2
- package/src/iter/iterable2.ts +2 -1
- package/src/json-schema/jsonSchema.util.ts +2 -1
- package/src/object/object.util.ts +2 -3
- package/src/promise/abortable.ts +1 -1
- package/src/promise/pDelay.ts +2 -1
- package/src/promise/pTimeout.ts +2 -1
- package/src/semver.ts +1 -1
- package/src/string/hash.util.ts +1 -1
- package/src/string/json.util.ts +1 -1
- package/src/web.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbortablePredicate, FalsyValue, Mapper, Predicate, SortDirection, StringMap } from '../types';
|
|
1
|
+
import type { AbortablePredicate, FalsyValue, Mapper, Predicate, SortDirection, StringMap } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
|
|
4
4
|
* final chunk will be the remaining elements.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fetcher } from '../../http/fetcher';
|
|
2
|
-
import { StringMap } from '../../types';
|
|
3
|
-
import { TranslationLoader } from './translation.service';
|
|
1
|
+
import type { Fetcher } from '../../http/fetcher';
|
|
2
|
+
import type { StringMap } from '../../types';
|
|
3
|
+
import type { TranslationLoader } from './translation.service';
|
|
4
4
|
/**
|
|
5
5
|
* Use `baseUrl` to prefix your language files.
|
|
6
6
|
* Example URL structure:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StringMap } from '../../types';
|
|
1
|
+
import type { StringMap } from '../../types';
|
|
2
2
|
export type MissingTranslationHandler = (key: string, params?: StringMap<any>) => string;
|
|
3
3
|
export declare const defaultMissingTranslationHandler: MissingTranslationHandler;
|
|
4
4
|
export interface TranslationServiceCfg {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Inclusiveness } from '../types';
|
|
2
|
-
import { LocalDate, LocalDateInput, LocalDateUnit } from './localDate';
|
|
1
|
+
import type { Inclusiveness } from '../types';
|
|
2
|
+
import type { LocalDate, LocalDateInput, LocalDateUnit } from './localDate';
|
|
3
3
|
export type DateIntervalConfig = DateInterval | DateIntervalString;
|
|
4
4
|
export type DateIntervalString = string;
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Iterable2 } from '../iter/iterable2';
|
|
2
2
|
import type { Inclusiveness, IsoDate, IsoDateTime, MonthId, SortDirection, UnixTimestamp, UnixTimestampMillis } from '../types';
|
|
3
|
-
import { DateObject, ISODayOfWeek, LocalTime } from './localTime';
|
|
3
|
+
import type { DateObject, ISODayOfWeek, LocalTime } from './localTime';
|
|
4
4
|
export type LocalDateUnit = LocalDateUnitStrict | 'week';
|
|
5
5
|
export type LocalDateUnitStrict = 'year' | 'month' | 'day';
|
|
6
6
|
export type LocalDateInput = LocalDate | Date | IsoDate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IANATimezone, Inclusiveness, IsoDate, IsoDateTime, MonthId, NumberOfHours, NumberOfMinutes, SortDirection, UnixTimestamp, UnixTimestampMillis } from '../types';
|
|
2
|
-
import { LocalDate } from './localDate';
|
|
2
|
+
import type { LocalDate } from './localDate';
|
|
3
3
|
import { WallTime } from './wallTime';
|
|
4
4
|
export type LocalTimeUnit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
|
|
5
5
|
export declare enum ISODayOfWeek {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Inclusiveness, UnixTimestamp } from '../types';
|
|
2
|
-
import { LocalTime, LocalTimeInput } from './localTime';
|
|
2
|
+
import type { LocalTime, LocalTimeInput } from './localTime';
|
|
3
3
|
export type TimeIntervalConfig = TimeInterval | TimeIntervalString;
|
|
4
4
|
export type TimeIntervalString = string;
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IsoDate, IsoDateTime } from '../types';
|
|
1
|
+
import type { IsoDate, IsoDateTime } from '../types';
|
|
2
2
|
import { LocalDate } from './localDate';
|
|
3
|
-
import { DateTimeObject, LocalTime } from './localTime';
|
|
3
|
+
import type { DateTimeObject, LocalTime } from './localTime';
|
|
4
4
|
/**
|
|
5
5
|
* Representation of a "time on the wall clock",
|
|
6
6
|
* which means "local time, regardless of timezone".
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CommonLogger } from '../log/commonLogger';
|
|
2
|
-
import { AnyAsyncFunction, AnyFunction, AnyObject, MaybeParameters } from '../types';
|
|
3
|
-
import { AsyncMemoCache, MethodDecorator } from './memo.util';
|
|
2
|
+
import type { AnyAsyncFunction, AnyFunction, AnyObject, MaybeParameters } from '../types';
|
|
3
|
+
import type { AsyncMemoCache, MethodDecorator } from './memo.util';
|
|
4
4
|
export interface AsyncMemoOptions<FN> {
|
|
5
5
|
/**
|
|
6
6
|
* Provide a custom implementation of AsyncMemoCache.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { CommonLogger } from '../log/commonLogger';
|
|
2
|
-
import { AnyFunction, AnyObject, MaybeParameters } from '../types';
|
|
3
|
-
import type { MemoCache } from './memo.util';
|
|
4
|
-
import { MethodDecorator } from './memo.util';
|
|
2
|
+
import type { AnyFunction, AnyObject, MaybeParameters } from '../types';
|
|
3
|
+
import type { MemoCache, MethodDecorator } from './memo.util';
|
|
5
4
|
export interface MemoOptions<FN> {
|
|
6
5
|
/**
|
|
7
6
|
* Provide a custom implementation of MemoCache.
|
package/dist/env.js
CHANGED
|
@@ -9,8 +9,7 @@ exports.isClientSide = isClientSide;
|
|
|
9
9
|
* Will return `false` in the Browser.
|
|
10
10
|
*/
|
|
11
11
|
function isServerSide() {
|
|
12
|
-
|
|
13
|
-
return typeof window === 'undefined';
|
|
12
|
+
return !isClientSide();
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
15
|
* Use it to detect Browser (not SSR/Node) environment.
|
|
@@ -20,5 +19,5 @@ function isServerSide() {
|
|
|
20
19
|
*/
|
|
21
20
|
function isClientSide() {
|
|
22
21
|
// eslint-disable-next-line unicorn/prefer-global-this
|
|
23
|
-
return typeof window !== 'undefined';
|
|
22
|
+
return typeof window !== 'undefined' && !!window?.document;
|
|
24
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HttpMethod, HttpStatusCode } from '../http/http.model';
|
|
2
|
-
import { NumberOfMilliseconds } from '../types';
|
|
1
|
+
import type { HttpMethod, HttpStatusCode } from '../http/http.model';
|
|
2
|
+
import type { NumberOfMilliseconds } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Extendable payload object to transfer custom additional data with AppError.
|
|
5
5
|
*/
|
package/dist/http/fetcher.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/// <reference lib="dom" preserve="true" />
|
|
3
3
|
/// <reference lib="dom.iterable" preserve="true" />
|
|
4
4
|
import { HttpRequestError } from '../error/error.util';
|
|
5
|
-
import { ErrorDataTuple } from '../types';
|
|
6
|
-
import { FetcherAfterResponseHook, FetcherBeforeRequestHook, FetcherBeforeRetryHook, FetcherCfg, FetcherGraphQLOptions, FetcherNormalizedCfg, FetcherOnErrorHook, FetcherOptions, FetcherResponse, RequestInitNormalized } from './fetcher.model';
|
|
5
|
+
import type { ErrorDataTuple } from '../types';
|
|
6
|
+
import type { FetcherAfterResponseHook, FetcherBeforeRequestHook, FetcherBeforeRetryHook, FetcherCfg, FetcherGraphQLOptions, FetcherNormalizedCfg, FetcherOnErrorHook, FetcherOptions, FetcherResponse, RequestInitNormalized } from './fetcher.model';
|
|
7
7
|
/**
|
|
8
8
|
* Experimental wrapper around Fetch.
|
|
9
9
|
* Works in both Browser and Node, using `globalThis.fetch`.
|
package/dist/index.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ export * from './unit/size.util';
|
|
|
96
96
|
export * from './web';
|
|
97
97
|
export * from './zod/zod.shared.schemas';
|
|
98
98
|
export * from './zod/zod.util';
|
|
99
|
-
import {
|
|
99
|
+
import type { ZodIssue } from 'zod';
|
|
100
|
+
import { z, ZodError, ZodSchema } from 'zod';
|
|
100
101
|
export { z, ZodError, ZodSchema };
|
|
101
102
|
export type { ZodIssue };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Promisable } from '../typeFest';
|
|
2
|
-
import { AbortableAsyncMapper, AbortableAsyncPredicate
|
|
1
|
+
import type { Promisable } from '../typeFest';
|
|
2
|
+
import type { AbortableAsyncMapper, AbortableAsyncPredicate } from '../types';
|
|
3
|
+
import { END } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Similar to Iterable2, but for AsyncIterable.
|
|
5
6
|
*
|
package/dist/iter/iterable2.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AbortableMapper, AbortablePredicate
|
|
1
|
+
import type { AbortableMapper, AbortablePredicate } from '../types';
|
|
2
|
+
import { END } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Iterable2 is a wrapper around Iterable that implements "Iterator Helpers proposal":
|
|
4
5
|
* https://github.com/tc39/proposal-iterator-helpers
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AnyObject, KeyValueTuple, ObjectMapper, ObjectPredicate, Reviver,
|
|
1
|
+
import type { AnyObject, KeyValueTuple, ObjectMapper, ObjectPredicate, Reviver, ValueOf } from '../types';
|
|
2
|
+
import { SKIP } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Returns clone of `obj` with only `props` preserved.
|
|
4
5
|
* Opposite of Omit.
|
package/dist/promise/pDelay.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ErrorData } from '../error/error.model';
|
|
2
2
|
import { TimeoutError } from '../error/error.util';
|
|
3
|
-
import { AnyAsyncFunction, NumberOfMilliseconds } from '../types';
|
|
3
|
+
import type { AnyAsyncFunction, NumberOfMilliseconds } from '../types';
|
|
4
4
|
export interface PTimeoutOptions {
|
|
5
5
|
/**
|
|
6
6
|
* Timeout in milliseconds.
|
package/dist/semver.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SortDirection } from './types';
|
|
1
|
+
import type { SortDirection } from './types';
|
|
2
2
|
export type SemverInput = string | Semver;
|
|
3
3
|
export type SemverInputNullable = SemverInput | null | undefined;
|
|
4
4
|
export type SemverTokens = [major: number, minor: number, patch: number];
|
package/dist/web.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="es2022" preserve="true" />
|
|
2
2
|
/// <reference lib="dom" preserve="true" />
|
|
3
|
-
import { StringMap } from './types';
|
|
3
|
+
import type { StringMap } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Implements WebStorage API by using in-memory storage.
|
|
6
6
|
* Can be useful in SSR environment or unit tests.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _assert } from '../error/assert';
|
|
2
|
-
import { END
|
|
2
|
+
import { END } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
|
|
5
5
|
* final chunk will be the remaining elements.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _assert, _assertTypeOf } from '../error/assert';
|
|
2
|
-
import { _objectAssign, MISS
|
|
2
|
+
import { _objectAssign, MISS } from '../types';
|
|
3
3
|
import { _getTargetMethodSignature } from './decorator.util';
|
|
4
4
|
import { jsonMemoSerializer } from './memo.util';
|
|
5
5
|
/**
|
package/dist-esm/env.js
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* Will return `false` in the Browser.
|
|
6
6
|
*/
|
|
7
7
|
export function isServerSide() {
|
|
8
|
-
|
|
9
|
-
return typeof window === 'undefined';
|
|
8
|
+
return !isClientSide();
|
|
10
9
|
}
|
|
11
10
|
/**
|
|
12
11
|
* Use it to detect Browser (not SSR/Node) environment.
|
|
@@ -16,5 +15,5 @@ export function isServerSide() {
|
|
|
16
15
|
*/
|
|
17
16
|
export function isClientSide() {
|
|
18
17
|
// eslint-disable-next-line unicorn/prefer-global-this
|
|
19
|
-
return typeof window !== 'undefined';
|
|
18
|
+
return typeof window !== 'undefined' && !!window?.document;
|
|
20
19
|
}
|
package/package.json
CHANGED
package/src/array/array.util.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { _assert } from '../error/assert'
|
|
2
|
-
import {
|
|
2
|
+
import type {
|
|
3
3
|
AbortablePredicate,
|
|
4
|
-
END,
|
|
5
4
|
FalsyValue,
|
|
6
5
|
Mapper,
|
|
7
6
|
Predicate,
|
|
8
7
|
SortDirection,
|
|
9
8
|
StringMap,
|
|
10
9
|
} from '../types'
|
|
10
|
+
import { END } from '../types'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _Memo } from '../decorators/memo.decorator'
|
|
2
2
|
import { isServerSide } from '../env'
|
|
3
3
|
import { _stringify } from '../string/stringify'
|
|
4
|
-
import { Promisable } from '../typeFest'
|
|
4
|
+
import type { Promisable } from '../typeFest'
|
|
5
5
|
|
|
6
6
|
export interface AdminModeCfg {
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fetcher } from '../../http/fetcher'
|
|
2
|
-
import { StringMap } from '../../types'
|
|
3
|
-
import { TranslationLoader } from './translation.service'
|
|
1
|
+
import type { Fetcher } from '../../http/fetcher'
|
|
2
|
+
import type { StringMap } from '../../types'
|
|
3
|
+
import type { TranslationLoader } from './translation.service'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Use `baseUrl` to prefix your language files.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Inclusiveness, IsoDate } from '../types'
|
|
2
|
-
import { LocalDate,
|
|
1
|
+
import type { Inclusiveness, IsoDate } from '../types'
|
|
2
|
+
import type { LocalDate, LocalDateInput, LocalDateUnit } from './localDate'
|
|
3
|
+
import { localDate } from './localDate'
|
|
3
4
|
|
|
4
5
|
export type DateIntervalConfig = DateInterval | DateIntervalString
|
|
5
6
|
export type DateIntervalString = string
|
|
@@ -9,7 +9,8 @@ import type {
|
|
|
9
9
|
UnixTimestamp,
|
|
10
10
|
UnixTimestampMillis,
|
|
11
11
|
} from '../types'
|
|
12
|
-
import { DateObject, ISODayOfWeek, LocalTime
|
|
12
|
+
import type { DateObject, ISODayOfWeek, LocalTime } from './localTime'
|
|
13
|
+
import { localTime, VALID_DAYS_OF_WEEK } from './localTime'
|
|
13
14
|
|
|
14
15
|
export type LocalDateUnit = LocalDateUnitStrict | 'week'
|
|
15
16
|
export type LocalDateUnitStrict = 'year' | 'month' | 'day'
|
|
@@ -12,7 +12,8 @@ import type {
|
|
|
12
12
|
UnixTimestamp,
|
|
13
13
|
UnixTimestampMillis,
|
|
14
14
|
} from '../types'
|
|
15
|
-
import { LocalDate
|
|
15
|
+
import type { LocalDate } from './localDate'
|
|
16
|
+
import { localDate } from './localDate'
|
|
16
17
|
import { WallTime } from './wallTime'
|
|
17
18
|
|
|
18
19
|
export type LocalTimeUnit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Inclusiveness, UnixTimestamp } from '../types'
|
|
2
|
-
import { LocalTime,
|
|
2
|
+
import type { LocalTime, LocalTimeInput } from './localTime'
|
|
3
|
+
import { localTime } from './localTime'
|
|
3
4
|
|
|
4
5
|
export type TimeIntervalConfig = TimeInterval | TimeIntervalString
|
|
5
6
|
export type TimeIntervalString = string
|
package/src/datetime/wallTime.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { IsoDate, IsoDateTime } from '../types'
|
|
1
|
+
import type { IsoDate, IsoDateTime } from '../types'
|
|
2
2
|
import { LocalDate } from './localDate'
|
|
3
|
-
import { DateTimeObject, LocalTime
|
|
3
|
+
import type { DateTimeObject, LocalTime } from './localTime'
|
|
4
|
+
import { localTime } from './localTime'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Representation of a "time on the wall clock",
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { _assert, _assertTypeOf } from '../error/assert'
|
|
2
2
|
import type { CommonLogger } from '../log/commonLogger'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
AnyAsyncFunction,
|
|
6
|
-
AnyFunction,
|
|
7
|
-
AnyObject,
|
|
8
|
-
MaybeParameters,
|
|
9
|
-
MISS,
|
|
10
|
-
} from '../types'
|
|
3
|
+
import type { AnyAsyncFunction, AnyFunction, AnyObject, MaybeParameters } from '../types'
|
|
4
|
+
import { _objectAssign, MISS } from '../types'
|
|
11
5
|
import { _getTargetMethodSignature } from './decorator.util'
|
|
12
|
-
import { AsyncMemoCache,
|
|
6
|
+
import type { AsyncMemoCache, MethodDecorator } from './memo.util'
|
|
7
|
+
import { jsonMemoSerializer } from './memo.util'
|
|
13
8
|
|
|
14
9
|
export interface AsyncMemoOptions<FN> {
|
|
15
10
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { _assert, _assertTypeOf } from '../error/assert'
|
|
2
2
|
import type { CommonLogger } from '../log/commonLogger'
|
|
3
|
-
import {
|
|
3
|
+
import type { AnyFunction, AnyObject, MaybeParameters } from '../types'
|
|
4
|
+
import { _objectAssign } from '../types'
|
|
4
5
|
import { _getTargetMethodSignature } from './decorator.util'
|
|
5
|
-
import type { MemoCache } from './memo.util'
|
|
6
|
-
import { jsonMemoSerializer, MapMemoCache
|
|
6
|
+
import type { MemoCache, MethodDecorator } from './memo.util'
|
|
7
|
+
import { jsonMemoSerializer, MapMemoCache } from './memo.util'
|
|
7
8
|
|
|
8
9
|
export interface MemoOptions<FN> {
|
|
9
10
|
/**
|
package/src/decorators/memoFn.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyFunction, MaybeParameters } from '../types'
|
|
1
|
+
import type { AnyFunction, MaybeParameters } from '../types'
|
|
2
2
|
import type { MemoOptions } from './memo.decorator'
|
|
3
3
|
import type { MemoCache } from './memo.util'
|
|
4
4
|
import { jsonMemoSerializer, MapMemoCache } from './memo.util'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AnyAsyncFunction, MaybeParameters
|
|
1
|
+
import type { AnyAsyncFunction, MaybeParameters } from '../types'
|
|
2
|
+
import { MISS } from '../types'
|
|
2
3
|
import type { AsyncMemoOptions } from './asyncMemo.decorator'
|
|
3
4
|
import type { AsyncMemoCache } from './memo.util'
|
|
4
5
|
import { jsonMemoSerializer, MapMemoCache } from './memo.util'
|
package/src/env.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* Will return `false` in the Browser.
|
|
6
6
|
*/
|
|
7
7
|
export function isServerSide(): boolean {
|
|
8
|
-
|
|
9
|
-
return typeof window === 'undefined'
|
|
8
|
+
return !isClientSide()
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -17,5 +16,5 @@ export function isServerSide(): boolean {
|
|
|
17
16
|
*/
|
|
18
17
|
export function isClientSide(): boolean {
|
|
19
18
|
// eslint-disable-next-line unicorn/prefer-global-this
|
|
20
|
-
return typeof window !== 'undefined'
|
|
19
|
+
return typeof window !== 'undefined' && !!window?.document
|
|
21
20
|
}
|
package/src/error/error.model.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HttpMethod, HttpStatusCode } from '../http/http.model'
|
|
2
|
-
import { NumberOfMilliseconds } from '../types'
|
|
1
|
+
import type { HttpMethod, HttpStatusCode } from '../http/http.model'
|
|
2
|
+
import type { NumberOfMilliseconds } from '../types'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Extendable payload object to transfer custom additional data with AppError.
|
package/src/http/fetcher.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { isServerSide } from '../env'
|
|
6
6
|
import { _assertErrorClassOrRethrow, _assertIsError } from '../error/assert'
|
|
7
|
-
import { ErrorLike, ErrorObject } from '../error/error.model'
|
|
7
|
+
import type { ErrorLike, ErrorObject } from '../error/error.model'
|
|
8
8
|
import {
|
|
9
9
|
_anyToError,
|
|
10
10
|
_anyToErrorObject,
|
|
@@ -29,8 +29,8 @@ import { pTimeout } from '../promise/pTimeout'
|
|
|
29
29
|
import { _jsonParse, _jsonParseIfPossible } from '../string/json.util'
|
|
30
30
|
import { _stringify } from '../string/stringify'
|
|
31
31
|
import { _ms, _since } from '../time/time.util'
|
|
32
|
-
import { AnyObject, ErrorDataTuple, NumberOfMilliseconds, UnixTimestampMillis } from '../types'
|
|
33
|
-
import {
|
|
32
|
+
import type { AnyObject, ErrorDataTuple, NumberOfMilliseconds, UnixTimestampMillis } from '../types'
|
|
33
|
+
import type {
|
|
34
34
|
FetcherAfterResponseHook,
|
|
35
35
|
FetcherBeforeRequestHook,
|
|
36
36
|
FetcherBeforeRetryHook,
|
package/src/index.ts
CHANGED
|
@@ -96,7 +96,8 @@ export * from './unit/size.util'
|
|
|
96
96
|
export * from './web'
|
|
97
97
|
export * from './zod/zod.shared.schemas'
|
|
98
98
|
export * from './zod/zod.util'
|
|
99
|
-
import {
|
|
99
|
+
import type { ZodIssue } from 'zod'
|
|
100
|
+
import { z, ZodError, ZodSchema } from 'zod'
|
|
100
101
|
|
|
101
102
|
export { z, ZodError, ZodSchema }
|
|
102
103
|
export type { ZodIssue }
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Promisable } from '../typeFest'
|
|
2
|
-
import { AbortableAsyncMapper, AbortableAsyncPredicate
|
|
1
|
+
import type { Promisable } from '../typeFest'
|
|
2
|
+
import type { AbortableAsyncMapper, AbortableAsyncPredicate } from '../types'
|
|
3
|
+
import { END, SKIP } from '../types'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Similar to Iterable2, but for AsyncIterable.
|
package/src/iter/iterable2.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AbortableMapper, AbortablePredicate
|
|
1
|
+
import type { AbortableMapper, AbortablePredicate } from '../types'
|
|
2
|
+
import { END, SKIP } from '../types'
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Iterable2 is a wrapper around Iterable that implements "Iterator Helpers proposal":
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { _isEmpty, _isObject } from '../is.util'
|
|
2
|
-
import {
|
|
3
|
-
_objectEntries,
|
|
2
|
+
import type {
|
|
4
3
|
AnyObject,
|
|
5
4
|
KeyValueTuple,
|
|
6
5
|
ObjectMapper,
|
|
7
6
|
ObjectPredicate,
|
|
8
7
|
Reviver,
|
|
9
|
-
SKIP,
|
|
10
8
|
ValueOf,
|
|
11
9
|
} from '../types'
|
|
10
|
+
import { _objectEntries, SKIP } from '../types'
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Returns clone of `obj` with only `props` preserved.
|
package/src/promise/abortable.ts
CHANGED
package/src/promise/pDelay.ts
CHANGED
package/src/promise/pTimeout.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ErrorData } from '../error/error.model'
|
|
2
2
|
import { _errorDataAppend, TimeoutError } from '../error/error.util'
|
|
3
|
-
import {
|
|
3
|
+
import type { AnyAsyncFunction, NumberOfMilliseconds } from '../types'
|
|
4
|
+
import { _typeCast } from '../types'
|
|
4
5
|
|
|
5
6
|
export interface PTimeoutOptions {
|
|
6
7
|
/**
|
package/src/semver.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _range } from './array/range'
|
|
2
2
|
import { _assert } from './error/assert'
|
|
3
|
-
import { SortDirection } from './types'
|
|
3
|
+
import type { SortDirection } from './types'
|
|
4
4
|
|
|
5
5
|
export type SemverInput = string | Semver
|
|
6
6
|
export type SemverInputNullable = SemverInput | null | undefined
|
package/src/string/hash.util.ts
CHANGED
package/src/string/json.util.ts
CHANGED
package/src/web.ts
CHANGED