@zajno/common 2.7.6 → 2.8.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.
Files changed (116) hide show
  1. package/cjs/functions/disposer.js +7 -0
  2. package/cjs/functions/disposer.js.map +1 -1
  3. package/cjs/lazy/lazy.js +8 -2
  4. package/cjs/lazy/lazy.js.map +1 -1
  5. package/cjs/lazy/light.js.map +1 -1
  6. package/cjs/lazy/promise.js +20 -10
  7. package/cjs/lazy/promise.js.map +1 -1
  8. package/cjs/lazy/types.js +2 -0
  9. package/cjs/lazy/types.js.map +1 -1
  10. package/cjs/logger/buffered/buffered.memory.js +13 -1
  11. package/cjs/logger/buffered/buffered.memory.js.map +1 -1
  12. package/cjs/logger/loggable.js +1 -1
  13. package/cjs/logger/loggable.js.map +1 -1
  14. package/cjs/math/object/helpers.js +1 -1
  15. package/cjs/math/object/helpers.js.map +1 -1
  16. package/cjs/math/object/math.composite.js.map +1 -1
  17. package/cjs/math/object/math.js +1 -1
  18. package/cjs/math/object/math.js.map +1 -1
  19. package/cjs/math/object/ops.composite.js +1 -1
  20. package/cjs/math/object/ops.composite.js.map +1 -1
  21. package/cjs/math/object/ops.js +4 -3
  22. package/cjs/math/object/ops.js.map +1 -1
  23. package/cjs/models/Loading.js.map +1 -1
  24. package/cjs/structures/path/builder.helpers.js +5 -5
  25. package/cjs/structures/path/builder.helpers.js.map +1 -1
  26. package/cjs/structures/path/builder.js +3 -3
  27. package/cjs/structures/path/builder.js.map +1 -1
  28. package/cjs/structures/path/index.js +1 -1
  29. package/cjs/structures/path/index.js.map +1 -1
  30. package/cjs/structures/path/{utils.js → utils/combineUrls.js} +3 -16
  31. package/cjs/structures/path/utils/combineUrls.js.map +1 -0
  32. package/cjs/structures/path/utils/index.js +7 -0
  33. package/cjs/structures/path/utils/index.js.map +1 -0
  34. package/cjs/structures/path/utils/indexTrim.js +17 -0
  35. package/cjs/structures/path/utils/indexTrim.js.map +1 -0
  36. package/cjs/structures/path/utils/optionals.js +11 -0
  37. package/cjs/structures/path/utils/optionals.js.map +1 -0
  38. package/cjs/structures/promiseCache.js +126 -19
  39. package/cjs/structures/promiseCache.js.map +1 -1
  40. package/cjs/structures/promiseProxy.js +2 -5
  41. package/cjs/structures/promiseProxy.js.map +1 -1
  42. package/cjs/structures/tempoCache.js.map +1 -1
  43. package/esm/functions/disposer.js +7 -0
  44. package/esm/functions/disposer.js.map +1 -1
  45. package/esm/lazy/lazy.js +8 -2
  46. package/esm/lazy/lazy.js.map +1 -1
  47. package/esm/lazy/light.js.map +1 -1
  48. package/esm/lazy/promise.js +20 -10
  49. package/esm/lazy/promise.js.map +1 -1
  50. package/esm/lazy/types.js +2 -0
  51. package/esm/lazy/types.js.map +1 -1
  52. package/esm/logger/buffered/buffered.memory.js +13 -1
  53. package/esm/logger/buffered/buffered.memory.js.map +1 -1
  54. package/esm/logger/loggable.js +1 -1
  55. package/esm/logger/loggable.js.map +1 -1
  56. package/esm/math/object/helpers.js +1 -1
  57. package/esm/math/object/helpers.js.map +1 -1
  58. package/esm/math/object/math.composite.js.map +1 -1
  59. package/esm/math/object/math.js +1 -1
  60. package/esm/math/object/math.js.map +1 -1
  61. package/esm/math/object/ops.composite.js +1 -1
  62. package/esm/math/object/ops.composite.js.map +1 -1
  63. package/esm/math/object/ops.js +4 -3
  64. package/esm/math/object/ops.js.map +1 -1
  65. package/esm/models/Loading.js.map +1 -1
  66. package/esm/structures/path/builder.helpers.js +1 -1
  67. package/esm/structures/path/builder.helpers.js.map +1 -1
  68. package/esm/structures/path/builder.js +1 -1
  69. package/esm/structures/path/builder.js.map +1 -1
  70. package/esm/structures/path/index.js +1 -1
  71. package/esm/structures/path/index.js.map +1 -1
  72. package/esm/structures/path/{utils.js → utils/combineUrls.js} +2 -14
  73. package/esm/structures/path/utils/combineUrls.js.map +1 -0
  74. package/esm/structures/path/utils/index.js +4 -0
  75. package/esm/structures/path/utils/index.js.map +1 -0
  76. package/esm/structures/path/utils/indexTrim.js +14 -0
  77. package/esm/structures/path/utils/indexTrim.js.map +1 -0
  78. package/esm/structures/path/utils/optionals.js +8 -0
  79. package/esm/structures/path/utils/optionals.js.map +1 -0
  80. package/esm/structures/promiseCache.js +126 -19
  81. package/esm/structures/promiseCache.js.map +1 -1
  82. package/esm/structures/promiseProxy.js +2 -5
  83. package/esm/structures/promiseProxy.js.map +1 -1
  84. package/esm/structures/tempoCache.js.map +1 -1
  85. package/package.json +7 -1
  86. package/tsconfig.cjs.tsbuildinfo +1 -1
  87. package/tsconfig.esm.tsbuildinfo +1 -1
  88. package/tsconfig.types.tsbuildinfo +1 -1
  89. package/types/functions/disposer.d.ts +2 -0
  90. package/types/lazy/lazy.d.ts +3 -1
  91. package/types/lazy/light.d.ts +3 -1
  92. package/types/lazy/promise.d.ts +5 -3
  93. package/types/lazy/types.d.ts +12 -8
  94. package/types/logger/buffered/buffered.memory.d.ts +2 -0
  95. package/types/math/object/helpers.d.ts +5 -4
  96. package/types/math/object/math.composite.d.ts +9 -9
  97. package/types/math/object/math.d.ts +13 -12
  98. package/types/math/object/ops.composite.d.ts +6 -6
  99. package/types/math/object/ops.d.ts +8 -8
  100. package/types/math/object/types.d.ts +14 -14
  101. package/types/models/Loading.d.ts +4 -4
  102. package/types/models/LogicModel.d.ts +1 -1
  103. package/types/models/Model.d.ts +2 -2
  104. package/types/models/types.d.ts +1 -1
  105. package/types/structures/path/index.d.ts +1 -1
  106. package/types/structures/path/types.d.ts +1 -1
  107. package/types/structures/path/{utils.d.ts → utils/combineUrls.d.ts} +1 -2
  108. package/types/structures/path/utils/index.d.ts +3 -0
  109. package/types/structures/path/utils/indexTrim.d.ts +2 -0
  110. package/types/structures/path/utils/optionals.d.ts +2 -0
  111. package/types/structures/promiseCache.d.ts +127 -12
  112. package/types/structures/promiseProxy.d.ts +10 -6
  113. package/types/structures/tempoCache.d.ts +3 -2
  114. package/types/types/misc.d.ts +3 -3
  115. package/cjs/structures/path/utils.js.map +0 -1
  116. package/esm/structures/path/utils.js.map +0 -1
@@ -1,7 +1,8 @@
1
1
  import type { DeepReadonly, DeepReadonlyPartial } from '../../types/deep.js';
2
+ import type { Nullable } from '../../types/misc.js';
2
3
  import type { BasePair, IObjectOps, NumKey } from './types.js';
3
- export declare function _getValue<T extends object, TKey extends NumKey<T> = NumKey<T>>(o: DeepReadonlyPartial<T>, key: TKey): T[TKey] | null;
4
- export declare function _getInnerValue<T extends object, TKey extends string & keyof T>(o: DeepReadonly<T>, key: TKey): DeepReadonly<T[TKey]>;
5
- export declare function _getInnerValue<T extends object, TKey extends string & keyof T>(o: DeepReadonly<T> | number, key: TKey): DeepReadonly<T[TKey]> | number;
4
+ export declare function _getValue<T extends object, TKey extends NumKey<T> = NumKey<T>>(o: Nullable<DeepReadonlyPartial<T>>, key: TKey): T[TKey] | undefined;
5
+ export declare function _getInnerValue<T extends object, TKey extends string & keyof T>(o: Nullable<DeepReadonly<T>>, key: TKey): DeepReadonly<T[TKey]>;
6
+ export declare function _getInnerValue<T extends object, TKey extends string & keyof T>(o: Nullable<DeepReadonly<T> | number>, key: TKey): DeepReadonly<T[TKey]> | number;
6
7
  /** this helpers hides some cumbersome type transformations */
7
- export declare function doOps<T extends object, TOps extends IObjectOps<any>>(this: void, ops: BasePair<T, string & keyof T, TOps>[], o: DeepReadonly<T>, processor?: (ops: TOps, value: DeepReadonly<T[string & keyof T]>, key: string & keyof T) => T[keyof T] | null): T;
8
+ export declare function doOps<T extends object, TOps extends IObjectOps<any>>(this: void, ops: BasePair<T, string & keyof T, TOps>[], o: Nullable<DeepReadonly<T>>, processor?: (ops: TOps, value: DeepReadonly<T[string & keyof T]>, key: string & keyof T) => T[keyof T] | null): T;
@@ -1,16 +1,16 @@
1
- import type { AnyObject } from '../../types/index.js';
1
+ import type { AnyObject, Nullable } from '../../types/index.js';
2
2
  import type { DeepReadonly } from '../../types/deep.js';
3
3
  import { CompositeObjectOps } from './ops.composite.js';
4
4
  import type { AbsOptions, IObjectMath, MathPairsMap, RoundOptions } from './types.js';
5
5
  export declare class CompositeObjectMath<T extends AnyObject> extends CompositeObjectOps<T> implements IObjectMath<T> {
6
6
  private readonly _math;
7
7
  constructor(innerMath: MathPairsMap<T>);
8
- contains(base: DeepReadonly<T>, target: DeepReadonly<T>): boolean;
9
- inverse(o: DeepReadonly<T>): T;
10
- abs(o: DeepReadonly<T>, options?: AbsOptions): T | null;
11
- round(o: DeepReadonly<T>, options?: RoundOptions): T;
12
- add(o1: DeepReadonly<T>, o2: DeepReadonly<T>): T;
13
- subtract(base: DeepReadonly<T>, amount: number | DeepReadonly<T>): T;
14
- multiply(o1: DeepReadonly<T>, o2: number | DeepReadonly<T>): T;
15
- div(o1: DeepReadonly<T>, o2: number | DeepReadonly<T>): number;
8
+ contains(base: Nullable<DeepReadonly<T>>, target: Nullable<DeepReadonly<T>>): boolean;
9
+ inverse(o: Nullable<DeepReadonly<T>>): T;
10
+ abs(o: Nullable<DeepReadonly<T>>, options?: AbsOptions): T | null;
11
+ round(o: Nullable<DeepReadonly<T>>, options?: RoundOptions): T;
12
+ add(o1: Nullable<DeepReadonly<T>>, o2: Nullable<DeepReadonly<T>>): T;
13
+ subtract(base: Nullable<DeepReadonly<T>>, amount: number | Nullable<DeepReadonly<T>>): T;
14
+ multiply(o1: Nullable<DeepReadonly<T>>, o2: number | Nullable<DeepReadonly<T>>): T;
15
+ div(o1: Nullable<DeepReadonly<T>>, o2: Nullable<number | DeepReadonly<T>>): number;
16
16
  }
@@ -1,17 +1,18 @@
1
+ import type { Nullable } from '../../types/index.js';
1
2
  import type { DeepReadonly, DeepReadonlyPartial } from '../../types/deep.js';
2
3
  import { ObjectOps } from './ops.js';
3
4
  import type { AbsOptions, DELETE_TYPE, IObjectMath, NumKey, RoundOptions } from './types.js';
4
5
  export declare class ObjectMath<T extends object> extends ObjectOps<T> implements IObjectMath<T> {
5
- getTotal(o: DeepReadonlyPartial<T>): number;
6
- contains(base: DeepReadonly<T>, target: DeepReadonly<T>): boolean;
7
- inverse(o: DeepReadonly<T>): T;
8
- div(o1: DeepReadonly<T>, o2: number): T;
9
- div(o1: DeepReadonly<T>, o2: DeepReadonly<T>): number;
10
- process(o: DeepReadonly<T>, processor: (val: number, key: NumKey<T>) => number | DELETE_TYPE): T | null;
11
- abs(c: DeepReadonly<T>, stripNegatives?: AbsOptions): T | null;
12
- round(c: DeepReadonly<T>, method?: RoundOptions): T | null;
13
- calc(c1: DeepReadonly<T>, c2: DeepReadonly<T> | number, operator: (n: number, n2: number) => number): T;
14
- add(c1: DeepReadonly<T>, c2: DeepReadonly<T> | number): T;
15
- subtract(base: DeepReadonly<T>, amount: DeepReadonly<T> | number): T;
16
- multiply(c1: DeepReadonly<T>, c2: DeepReadonly<T> | number): T;
6
+ getTotal(o: Nullable<DeepReadonlyPartial<T>>): number;
7
+ contains(base: Nullable<DeepReadonly<T>>, target: Nullable<DeepReadonly<T>>): boolean;
8
+ inverse(o: Nullable<DeepReadonly<T>>): T;
9
+ div(o1: Nullable<DeepReadonly<T>>, o2: Nullable<number>): T;
10
+ div(o1: Nullable<DeepReadonly<T>>, o2: Nullable<DeepReadonly<T>>): number;
11
+ process(o: Nullable<DeepReadonly<T>>, processor: (val: number, key: NumKey<T>) => number | DELETE_TYPE): T | null;
12
+ abs(c: Nullable<DeepReadonly<T>>, stripNegatives?: AbsOptions): T | null;
13
+ round(c: Nullable<DeepReadonly<T>>, method?: RoundOptions): T | null;
14
+ calc(c1: Nullable<DeepReadonly<T>>, c2: Nullable<DeepReadonly<T> | number>, operator: (n: number, n2: number) => number): T;
15
+ add(c1: Nullable<DeepReadonly<T>>, c2: Nullable<DeepReadonly<T> | number>): T;
16
+ subtract(base: Nullable<DeepReadonly<T>>, amount: Nullable<DeepReadonly<T> | number>): T;
17
+ multiply(c1: Nullable<DeepReadonly<T>>, c2: Nullable<DeepReadonly<T> | number>): T;
17
18
  }
@@ -1,14 +1,14 @@
1
- import type { AnyObject } from '../../types/index.js';
1
+ import type { AnyObject, Nullable } from '../../types/index.js';
2
2
  import type { DeepReadonly } from '../../types/deep.js';
3
3
  import type { IObjectOps, OpsPairsMap } from './types.js';
4
4
  export declare class CompositeObjectOps<T extends AnyObject> implements IObjectOps<T> {
5
5
  readonly Empty: Readonly<T>;
6
6
  private readonly _ops;
7
7
  constructor(innerOps: OpsPairsMap<T>);
8
- isEmpty(o: DeepReadonly<T>): boolean;
8
+ isEmpty(o: Nullable<DeepReadonly<T>>): boolean;
9
9
  getEmpty(): T;
10
- clone(o: DeepReadonly<T>): T;
11
- isValid(o: DeepReadonly<T>): boolean;
12
- isEquals(a: DeepReadonly<T>, b: DeepReadonly<T>): boolean;
13
- assign(to: T, other: DeepReadonly<T>): void;
10
+ clone(o: Nullable<DeepReadonly<T>>): T;
11
+ isValid(o: Nullable<DeepReadonly<T>>): boolean;
12
+ isEquals(a: Nullable<DeepReadonly<T>>, b: Nullable<DeepReadonly<T>>): boolean;
13
+ assign(to: T, other: Nullable<DeepReadonly<T>>): void;
14
14
  }
@@ -1,5 +1,5 @@
1
1
  import { SkipCondition, SkipOptions } from '../../fields/skip.js';
2
- import type { AnyObject, DeepPartial, DeepReadonly, Predicate } from '../../types/index.js';
2
+ import type { AnyObject, DeepPartial, DeepReadonly, Nullable, Predicate } from '../../types/index.js';
3
3
  import type { IObjectOps, NumKey } from './types.js';
4
4
  type Keys<T extends AnyObject> = NumKey<T>[];
5
5
  export declare class ObjectOps<T extends AnyObject> implements IObjectOps<T> {
@@ -9,12 +9,12 @@ export declare class ObjectOps<T extends AnyObject> implements IObjectOps<T> {
9
9
  constructor(keys: Keys<T>);
10
10
  addValidator(validator: Predicate<DeepReadonly<T>>): this;
11
11
  getEmpty(): T;
12
- clone(o: DeepReadonly<T>): T;
13
- isEmpty(o: DeepReadonly<T>): boolean;
14
- isValid(o: DeepReadonly<T>): boolean;
15
- isEquals(a: DeepReadonly<T>, b: DeepReadonly<T>): boolean;
16
- strip(v: DeepReadonly<T>, condition?: SkipCondition<T, NumKey<T>>): DeepPartial<T>;
17
- toStringData(v: DeepReadonly<T>, labels: Readonly<Record<Keys<T>[number], string>>, strip?: SkipOptions): [number, string][];
18
- assign(to: T, other: DeepReadonly<T>): void;
12
+ clone(o: Nullable<DeepReadonly<T>>): T;
13
+ isEmpty(o: Nullable<DeepReadonly<T>>): boolean;
14
+ isValid(o: Nullable<DeepReadonly<T>>): boolean;
15
+ isEquals(a: Nullable<DeepReadonly<T>>, b: Nullable<DeepReadonly<T>>): boolean;
16
+ strip(v: Nullable<DeepReadonly<T>>, condition?: SkipCondition<T, NumKey<T>>): DeepPartial<T>;
17
+ toStringData(v: Nullable<DeepReadonly<T>>, labels: Readonly<Record<Keys<T>[number], string>>, strip?: SkipOptions): [number, string][];
18
+ assign(to: T, other: Nullable<DeepReadonly<T>>): T;
19
19
  }
20
20
  export {};
@@ -1,26 +1,26 @@
1
- import type { AnyObject, DeepReadonly, TypedKeys } from '../../types/index.js';
1
+ import type { AnyObject, DeepReadonly, Nullable, TypedKeys } from '../../types/index.js';
2
2
  export type NumKey<T extends AnyObject> = TypedKeys<T, number>;
3
3
  export type AbsOptions = false | 'remove' | 'zero';
4
4
  export type RoundOptions = 'floor' | 'ceil' | 'round';
5
5
  export type DELETE_TYPE = 'delete';
6
6
  export interface IObjectOps<T extends AnyObject> {
7
7
  readonly Empty: Readonly<T>;
8
- isEmpty(o: DeepReadonly<T>): boolean;
8
+ isEmpty(o: Nullable<DeepReadonly<T>>): boolean;
9
9
  getEmpty(): T;
10
- clone(o: DeepReadonly<T>): T;
11
- isValid(o: DeepReadonly<T>): boolean;
12
- isEquals(a: DeepReadonly<T>, b: DeepReadonly<T>): boolean;
13
- assign(to: T, other: DeepReadonly<T>): void;
10
+ clone(o: Nullable<DeepReadonly<T>>): T;
11
+ isValid(o: Nullable<DeepReadonly<T>>): boolean;
12
+ isEquals(a: Nullable<DeepReadonly<T>>, b: Nullable<DeepReadonly<T>>): boolean;
13
+ assign(to: T, other: Nullable<DeepReadonly<T>>): void;
14
14
  }
15
15
  export interface IObjectMath<T extends AnyObject> extends IObjectOps<T> {
16
- contains(base: DeepReadonly<T>, target: DeepReadonly<T>): boolean;
17
- inverse(o: DeepReadonly<T>): T;
18
- abs(o: DeepReadonly<T>, options?: AbsOptions): T | null;
19
- round(o: DeepReadonly<T>, options?: RoundOptions): T | null;
20
- add(o1: DeepReadonly<T>, o2: DeepReadonly<T>): T;
21
- subtract(base: DeepReadonly<T>, amount: DeepReadonly<T> | number): T;
22
- multiply(o1: DeepReadonly<T>, o2: DeepReadonly<T> | number): T;
23
- div(o1: DeepReadonly<T>, o2: DeepReadonly<T> | number): number;
16
+ contains(base: Nullable<DeepReadonly<T>>, target: Nullable<DeepReadonly<T>>): boolean;
17
+ inverse(o: Nullable<DeepReadonly<T>>): T;
18
+ abs(o: Nullable<DeepReadonly<T>>, options?: AbsOptions): T | null;
19
+ round(o: Nullable<DeepReadonly<T>>, options?: RoundOptions): T | null;
20
+ add(o1: Nullable<DeepReadonly<T>>, o2: Nullable<DeepReadonly<T>>): T;
21
+ subtract(base: Nullable<DeepReadonly<T>>, amount: Nullable<DeepReadonly<T> | number>): T;
22
+ multiply(o1: Nullable<DeepReadonly<T>>, o2: Nullable<DeepReadonly<T> | number>): T;
23
+ div(o1: Nullable<DeepReadonly<T>>, o2: Nullable<DeepReadonly<T> | number>): number;
24
24
  }
25
25
  export type BasePair<T extends AnyObject, TKey extends string & keyof T = string & keyof T, TOps extends IObjectOps<T[TKey]> = IObjectOps<T[TKey]>> = {
26
26
  key: TKey;
@@ -1,4 +1,4 @@
1
- import type { IResetableModel, IValueModel } from './types.js';
1
+ import type { IResettableModel, IValueModel } from './types.js';
2
2
  export type LoadingWorker<T> = () => (T | Promise<T>);
3
3
  export type LoadingResult<T = unknown> = {
4
4
  aborted: true;
@@ -7,8 +7,8 @@ export type LoadingResult<T = unknown> = {
7
7
  result: T;
8
8
  };
9
9
  export declare function withLoading<T>(this: void, model: IValueModel<boolean>, cb: LoadingWorker<T>, exclusive?: boolean | 'throw'): Promise<LoadingResult<T>>;
10
- export declare class LoadingModel implements IValueModel<boolean>, IResetableModel {
11
- protected readonly _number: IValueModel<number> & IResetableModel;
10
+ export declare class LoadingModel implements IValueModel<boolean>, IResettableModel {
11
+ protected readonly _number: IValueModel<number> & IResettableModel;
12
12
  protected _firstInit: boolean;
13
13
  /**
14
14
  * @param useFirstInit - if true, then `isLoading` will be returning 'true' until first `useLoading` call. Defaults to false.
@@ -27,7 +27,7 @@ export declare class LoadingModel implements IValueModel<boolean>, IResetableMod
27
27
  /** override me
28
28
  *
29
29
  * Called in the ctor. Should be pure and should NOT access `this`. */
30
- protected pureConstructNumberModel(): IValueModel<number> & IResetableModel;
30
+ protected pureConstructNumberModel(): IValueModel<number> & IResettableModel;
31
31
  }
32
32
  export declare class ExclusiveLoadingError extends Error {
33
33
  readonly actionName?: string | undefined;
@@ -5,7 +5,7 @@ import { Loggable } from '../logger/loggable.js';
5
5
  export type ActionRunOptions = {
6
6
  /** Action name, required for logging and joining. */
7
7
  name?: string;
8
- /** If set to truthy, will not start an action if another is still in progress.
8
+ /** If set to truthy, will not start this action if another is still in progress.
9
9
  * Additionally, if set to 'throw', will throw an error. Otherwise, will return undefined.
10
10
  *
11
11
  * Note: if a current action runs in an exclusive mode, but the next one is not, the next one will still be allowed.
@@ -1,7 +1,7 @@
1
- import type { IResetableModel, IValueModel } from './types.js';
1
+ import type { IResettableModel, IValueModel } from './types.js';
2
2
  import { Getter } from '../types/getter.js';
3
3
  import type { Nullable } from '../types/misc.js';
4
- export declare class Model<T> implements IValueModel<Nullable<T>>, IResetableModel {
4
+ export declare class Model<T> implements IValueModel<Nullable<T>>, IResettableModel {
5
5
  private _value;
6
6
  private readonly _defaultValue;
7
7
  constructor(v?: Getter<Nullable<T>>);
@@ -7,7 +7,7 @@ export interface IValueModel<TValue> extends IValueModelReadonly<TValue> {
7
7
  export interface ILabel<T> {
8
8
  readonly label: T;
9
9
  }
10
- export interface IResetableModel {
10
+ export interface IResettableModel {
11
11
  readonly reset: () => void;
12
12
  readonly isDefault?: boolean;
13
13
  }
@@ -1,2 +1,2 @@
1
- export * from './utils.js';
1
+ export * from './utils/index.js';
2
2
  export * as Path from './builder.js';
@@ -1,6 +1,6 @@
1
1
  import type { EmptyObject, Expand, IsNever, LengthArray, Nullable } from '../../types/misc.js';
2
2
  import type { ArgValue, IsOptional, ReadonlyArrayNormalized, TemplateTransform, ToOptionalArray, ToRequired, ToRequiredArray, TransformMap } from './types.helpers.js';
3
- import type { CombineOptions } from './utils.js';
3
+ import type { CombineOptions } from './utils/combineUrls.js';
4
4
  export type ObjectBuilderArgs<TArgs extends string, TFallback = EmptyObject> = string extends TArgs ? TFallback : ArgRecord<TArgs>;
5
5
  export type BuilderArgs<TArgs extends string, L extends number = number> = LengthArray<ArgValue | null, L> | ArgRecord<TArgs>;
6
6
  export type ArgRecord<T extends string> = Expand<{
@@ -1,5 +1,4 @@
1
- import type { Nullable } from '../../types/misc.js';
2
- export declare function indexTrim(str: string | null | undefined, ch: string): string;
1
+ import type { Nullable } from '../../../types/misc.js';
3
2
  export type CombineOptions = {
4
3
  noTrim?: boolean;
5
4
  addTrail?: boolean | string;
@@ -0,0 +1,3 @@
1
+ export * from './indexTrim.js';
2
+ export * from './combineUrls.js';
3
+ export * from './optionals.js';
@@ -0,0 +1,2 @@
1
+ export type TrimChar<T extends string, C extends string> = [T] extends undefined ? '' : T extends `${C}${infer R}` ? TrimChar<R, C> : T extends `${infer R}${C}` ? TrimChar<R, C> : T;
2
+ export declare function indexTrim<T extends string, C extends string>(str: T | null | undefined, ch: C): TrimChar<T, C>;
@@ -0,0 +1,2 @@
1
+ /** Reformats path from format `'/foo/bar?'` to `'/foo{/bar}'`, according to the latest `path-to-regex` lib rules */
2
+ export declare function replaceOptionalParts(pathname: string): string;
@@ -1,21 +1,28 @@
1
1
  import { Loggable } from '../logger/loggable.js';
2
2
  import type { IMapModel, IValueModel } from '../models/types.js';
3
+ /** Represents a state of a cached item. Holds a references to an actual state. */
3
4
  export type DeferredGetter<T> = {
5
+ /** Get current resolved value, if any, or initiates fetching. */
4
6
  readonly current: T | null | undefined;
7
+ /** Returns a promise that resolves to the current or fetching value. */
5
8
  readonly promise: Promise<T | null>;
6
- readonly busy: boolean | undefined;
9
+ /** Returns true if the item is currently being fetched. Returns undefined if fetching has not started yet. */
10
+ readonly isLoading: boolean | undefined;
7
11
  };
8
12
  export declare namespace DeferredGetter {
13
+ /** Empty resolved value. */
9
14
  const Empty: {
10
15
  readonly current: null;
11
16
  readonly promise: Promise<null>;
12
- readonly busy: boolean;
17
+ readonly isLoading: boolean;
13
18
  };
14
19
  }
15
- /** Caches items by key which are resolve by a promise.
20
+ /**
21
+ * Caches items by a key (string or another type) which are resolved by an async fetcher (`Promise`).
16
22
  *
17
23
  * Supports:
18
24
  * - custom key adapter and parser for non-string keys.
25
+ * - direct manual cache manipulation.
19
26
  * - batching of fetches.
20
27
  * - auto-invalidation of cached items.
21
28
  */
@@ -23,22 +30,70 @@ export declare class PromiseCache<T, K = string> extends Loggable {
23
30
  private readonly fetcher;
24
31
  private readonly keyAdapter?;
25
32
  private readonly keyParser?;
33
+ /** Stores resolved items in map by id. */
26
34
  protected readonly _itemsCache: IMapModel<string, T | null | undefined>;
35
+ /** Stores items loading state (loading or not) in map by id. */
27
36
  protected readonly _itemsStatus: IMapModel<string, boolean>;
28
- protected readonly _busyCount: IValueModel<number>;
37
+ /** Stores items loading count. */
38
+ protected readonly _loadingCount: IValueModel<number>;
39
+ /** Stores items Promises state (if still loading) in map by id. */
29
40
  private readonly _fetchCache;
41
+ /** Stores items resolve timestamps (for expiration) in map by id. */
30
42
  private readonly _timestamps;
31
43
  private _batch;
32
44
  private _invalidationTimeMs;
33
45
  private _keepInstanceDuringInvalidation;
34
46
  private _version;
47
+ /**
48
+ * Creates an instance of PromiseCache.
49
+ * @param fetcher Function to fetch data by key.
50
+ * @param keyAdapter Optional function to adapt non-string keys to strings.
51
+ * @param keyParser Optional function to parse string keys back to their original type.
52
+ */
35
53
  constructor(fetcher: (id: K) => Promise<T>, keyAdapter?: (K extends string ? null : (k: K) => string) | undefined, keyParser?: (K extends string ? null : (id: string) => K) | undefined);
36
54
  get busyCount(): number;
55
+ /**
56
+ * @pure @const
57
+ * Creates a model for tracking the loading state. Override to inject own instance, e.g. for observability.
58
+ *
59
+ * Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
60
+ *
61
+ * @returns A value model for the loading count.
62
+ */
37
63
  protected pure_createBusyCount(): IValueModel<number>;
64
+ /**
65
+ * @pure @const
66
+ * Creates a map for caching resolved items by id. Override to inject own instance, e.g. for observability.
67
+ *
68
+ * Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
69
+ *
70
+ * @returns A map model for the items cache.
71
+ */
38
72
  protected pure_createItemsCache(): IMapModel<string, T | null | undefined>;
73
+ /**
74
+ * @pure @const
75
+ * Creates a map for tracking the loading state of items by id. Override to inject own instance, e.g. for observability.
76
+ *
77
+ * Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
78
+ *
79
+ * @returns A map model for the items loading state.
80
+ */
39
81
  protected pure_createItemsStatus(): IMapModel<string, boolean>;
82
+ /**
83
+ * @pure @const
84
+ * Creates a map for caching promises of items by id. Override to inject own instance, e.g. for observability.
85
+ *
86
+ * Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
87
+ *
88
+ * @returns A map model for the items promises cache.
89
+ */
40
90
  protected pure_createFetchCache(): IMapModel<string, Promise<T | null>>;
41
91
  private _pk;
92
+ /**
93
+ * Creates a logger name for this instance.
94
+ * @param name The name of the cache instance.
95
+ * @returns The logger name.
96
+ */
42
97
  protected getLoggerName(name: string | undefined): string;
43
98
  /**
44
99
  * Provide a fetcher function that takes multiple ids and returns multiple results at once. Will be called with a slight delay to allow multiple ids to be collected.
@@ -52,40 +107,100 @@ export declare class PromiseCache<T, K = string> extends Loggable {
52
107
  * Enables auto-invalidation of cached items.
53
108
  *
54
109
  * @param ms Time in milliseconds after which the item will be considered invalid. If null, auto-invalidation is disabled.
110
+ * @param keepInstance If true, the cached item will not be removed during invalidation, but will be set to `undefined` instead. Defaults to false.
55
111
  */
56
112
  useInvalidationTime(ms: number | null, keepInstance?: boolean): this;
113
+ /**
114
+ * Returns a {@link DeferredGetter} object for a specfied key.
115
+ *
116
+ * This can be used to access the current value, promise, and loading state of the item.
117
+ *
118
+ * @param key The key of the item.
119
+ */
57
120
  getDeferred(key: K): DeferredGetter<T>;
121
+ /**
122
+ * Returns the loading state of an item.
123
+ *
124
+ * @param id The id of the item.
125
+ * @returns The loading state of the item: true if loading, false if loading completed, undefined if loading was not started yet for the specified key.
126
+ */
58
127
  getIsBusy(id: K): boolean | undefined;
128
+ /**
129
+ * Returns the current cached value for the specified key, without triggering a fetch.
130
+ * @param id The id of the item.
131
+ * @returns The current cached value of the item.
132
+ */
59
133
  protected _getCurrent(id: K): {
60
134
  item: T | null | undefined;
61
135
  key: string;
62
136
  isInvalid: boolean;
63
137
  };
138
+ /**
139
+ * Returns the current cached value for the specified key, optionally triggering a fetch.
140
+ * @param id The id of the item.
141
+ * @param initiateFetch If true, will initiate a fetch if the item is not cached.
142
+ * @returns The current cached value of the item.
143
+ */
64
144
  getCurrent(id: K, initiateFetch?: boolean): T | null | undefined;
145
+ /**
146
+ * Returns a promise that resolves to the cached value of the item if loaded already, otherwise starts fetching and the promise will be resolved to the final value.
147
+ *
148
+ * Consequent calls will return the same promise until it resolves.
149
+ *
150
+ * @param id The id of the item.
151
+ * @returns A promise that resolves to the result, whether it's cached or freshly fetched.
152
+ */
65
153
  get(id: K): Promise<T | null>;
154
+ /**
155
+ * Fetches the item asynchronously.
156
+ * @param id The id of the item.
157
+ * @param key The cache key.
158
+ * @returns A promise that resolves to the fetched item.
159
+ */
66
160
  protected _doFetchAsync: (id: K, key: string) => Promise<T | null>;
161
+ /**
162
+ * Instantly invalidates the cached item for the specified id, like it was never fetched/accessed.
163
+ * @param id The id of the item.
164
+ */
67
165
  invalidate(id: K): void;
166
+ /**
167
+ * Updates the cached value for the specified id directly, like it was fetched already. Overrides existing value, if any.
168
+ * @param id The id of the item.
169
+ * @param value The new value to cache.
170
+ */
68
171
  updateValueDirectly(id: K, value: T | null): void;
172
+ /** Returns true if the item is cached or fetching was initiated. Does not initiates fetching. */
69
173
  hasKey(id: K): boolean;
174
+ /** Returns an iterator over the keys of the cached items. */
70
175
  keys(iterate: true): MapIterator<string>;
176
+ /** Returns an array of the keys of the cached items. */
71
177
  keys(): string[];
178
+ /** Returns an iterator over the parsed keys of the cached items. */
72
179
  keysParsed(iterate: true): Generator<K> | null;
180
+ /** Returns an array of the parsed keys of the cached items. */
73
181
  keysParsed(): K[] | null;
182
+ /** Clears the cache and resets the loading state. */
74
183
  clear(): void;
184
+ /** @internal updates all caches states at once. */
75
185
  protected _set(key: string, item: T | null | undefined, promise: Promise<T> | undefined, busy: boolean | undefined): void;
186
+ /**
187
+ * Checks if the cached item for the specified key is invalidated (expired).
188
+ * @param key The cache key.
189
+ * @returns True if the item is invalidated, false otherwise.
190
+ */
76
191
  protected getIsInvalidated(key: string): boolean;
77
- /** @override */
192
+ /** Updates the loading status for the specified key. Override to add a hook. */
78
193
  protected setStatus(key: string, status: boolean): void;
79
- /** @override */
194
+ /** Updates the promise for the specified key. Override to add a hook. */
80
195
  protected setPromise(key: string, promise: Promise<T | null>): void;
81
- /** @override */
196
+ /** Stores the result for the specified key. Override to add a hook. */
82
197
  protected storeResult(key: string, res: T | null): void;
83
- /** @override */
198
+ /** Hooks into the fetch process before it starts. */
84
199
  protected onBeforeFetch(_key: string): void;
85
- /** @override */
86
- protected prepareResult(res: T | null): NonNullable<T> | null;
87
- /** @override */
200
+ /** Hooks into the fetch process after it completes. */
88
201
  protected onFetchComplete(key: string): void;
89
- /** @pure */
202
+ /** Hooks into the result preparation process, before it's stored into the cache. */
203
+ protected prepareResult(res: T | null): NonNullable<T> | null;
204
+ /** @pure Performs a fetch operation in batch mode if available, otherwise uses the regular fetch. */
90
205
  protected tryFetchInBatch(id: K): Promise<T | null>;
91
206
  }
@@ -11,18 +11,22 @@ type ForbiddenKeys = typeof PromiseGetter;
11
11
  type NoForbiddenKeys<T> = {
12
12
  [K in keyof T]: K extends ForbiddenKeys ? never : T[K];
13
13
  };
14
- type Options<T, TFnKeys, TWrap, TLazy> = {
14
+ interface LazyPromiseCtor<K> {
15
+ new (loader: () => Promise<K>): LazyPromise<K>;
16
+ }
17
+ type Options<T, TFnKeys, TWrap, TLazy extends LazyPromiseCtor<T>> = {
18
+ /** Function returning a promise that resolves to a proxied object */
15
19
  loader: () => Promise<T>;
20
+ /** An array of keys that should be treated as functions so that they can be called before the object is resolved */
16
21
  fnKeys?: TFnKeys[];
22
+ /** An object that will be used as a wrapper for the proxied object. Can contain any fields that will be copied to the resolved object */
17
23
  wrap?: TWrap;
24
+ /** A constructor that creates {@link {LazyPromise}} instance for handling loader */
18
25
  lazy?: TLazy;
19
26
  };
20
27
  /**
21
- * Creates a proxy object that will be resolved to the object returned by the loader function. // Thanks CoPilot for this comment :)
22
- *
23
- * @param loader a function returning a promise that resolves to a proxied object
24
- * @param fnKeys an array of keys that should be treated as functions so that they can be called before the object is resolved
25
- * @param wrap an object that will be used as a wrapper for the proxied object. can contain any fields that will be copied to the resolved object
28
+ * Creates a proxy object that will be resolved to the object returned by the loader function.
29
+ * @param options - Options for creating the proxy, see {@link Options}
26
30
  * @returns a proxy object that will be resolved to the object returned by the loader function
27
31
  */
28
32
  export declare function createPromiseProxy<T extends NoForbiddenKeys<T>, TFnKeys extends AllowedFnKeys<T> = never, TWrap extends object = object>(options: Options<T, TFnKeys, TWrap, typeof LazyPromise>): PromiseProxy<T, StringKeys<T>, TFnKeys, TWrap>;
@@ -1,4 +1,5 @@
1
1
  import type { ILazy, ILazyPromise } from '../lazy/types.js';
2
+ import type { IResettableModel } from '../models/types.js';
2
3
  import { ExpireTracker } from './expire.js';
3
4
  /**
4
5
  * Calls factory fn to fetch and store some value for a limited time.
@@ -19,11 +20,11 @@ export declare namespace TempoCache {
19
20
  *
20
21
  * Note a limitation: calling `reset` (or changing the stored value directly in other way) on `lazy` will not affect the value cached by `TempoCache` instance.
21
22
  */
22
- function createFromLazy<T>(lazy: ILazy<T>, lifetimeMs: number): TempoCache<T>;
23
+ function createFromLazy<T>(lazy: ILazy<T> & IResettableModel, lifetimeMs: number): TempoCache<T>;
23
24
  /**
24
25
  * Creates a TempoCache instance which caches `ILazyPromise.promise` for a specified time.
25
26
  *
26
27
  * Note a limitation: calling `reset` (or changing the stored value directly in other way) on `lazy` will not affect the value cached by `TempoCache` instance.
27
28
  */
28
- function createFromLazyPromise<T>(lazy: ILazyPromise<T>, lifetimeMs: number): TempoCache<Promise<T>>;
29
+ function createFromLazyPromise<T>(lazy: ILazyPromise<T> & IResettableModel, lifetimeMs: number): TempoCache<Promise<T>>;
29
30
  }
@@ -1,11 +1,11 @@
1
1
  export type Predicate<T> = (value: T) => boolean;
2
2
  /** Type for extracting only string keys from T (skips number & symbol keys) */
3
- export type StringKeys<T extends AnyObject> = {
3
+ export type StringKeys<T extends AnyObject> = Exclude<{
4
4
  [K in keyof T]: K extends string ? K : never;
5
- }[keyof T];
5
+ }[keyof T], undefined | null>;
6
6
  /** Type for extracting string keys of type `T` values of each are of certain type `K` */
7
7
  export type TypedKeys<T extends AnyObject, K> = {
8
- [P in StringKeys<T>]: T[P] extends K ? P : never;
8
+ [P in StringKeys<T>]: T[P] extends (K | undefined) ? P : never;
9
9
  }[StringKeys<T>];
10
10
  /** Type for extraction only keys, values of which are functions with certain args and return result */
11
11
  export type FunctionKeys<T extends AnyObject, TArgs extends any[] = any[], TRes = any> = TypedKeys<T, (...args: TArgs) => TRes>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/structures/path/utils.ts"],"names":[],"mappings":";;;AAEA,8BAgBC;AAoBD,kCAgDC;AApFD,SAAgB,SAAS,CAAC,GAA8B,EAAE,EAAU;IAChE,I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