@zajno/common 2.4.2 → 2.4.4

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 (298) hide show
  1. package/cjs/api/call.js +5 -5
  2. package/cjs/api/call.js.map +1 -1
  3. package/cjs/api/endpoint.js +9 -9
  4. package/cjs/api/endpoint.js.map +1 -1
  5. package/cjs/api/index.js +12 -12
  6. package/cjs/api/index.js.map +1 -1
  7. package/cjs/api/processor.js +2 -2
  8. package/cjs/api/processor.js.map +1 -1
  9. package/cjs/api/register.js +5 -5
  10. package/cjs/api/register.js.map +1 -1
  11. package/cjs/async/misc.js +1 -1
  12. package/cjs/async/misc.js.map +1 -1
  13. package/cjs/dates/calc.js +9 -9
  14. package/cjs/dates/calc.js.map +1 -1
  15. package/cjs/dates/convert.js +16 -16
  16. package/cjs/dates/convert.js.map +1 -1
  17. package/cjs/dates/datex.js +7 -7
  18. package/cjs/dates/datex.js.map +1 -1
  19. package/cjs/dates/decompose.js +7 -7
  20. package/cjs/dates/decompose.js.map +1 -1
  21. package/cjs/dates/format.js +10 -10
  22. package/cjs/dates/format.js.map +1 -1
  23. package/cjs/dates/index.js +10 -10
  24. package/cjs/dates/index.js.map +1 -1
  25. package/cjs/dates/period.js +3 -3
  26. package/cjs/dates/period.js.map +1 -1
  27. package/cjs/dates/shift.js +17 -17
  28. package/cjs/dates/shift.js.map +1 -1
  29. package/cjs/dates/types.js +2 -2
  30. package/cjs/dates/types.js.map +1 -1
  31. package/cjs/dates/yearDate.js +3 -3
  32. package/cjs/dates/yearDate.js.map +1 -1
  33. package/cjs/fields/index.js +3 -3
  34. package/cjs/fields/index.js.map +1 -1
  35. package/cjs/functions/assert.js +4 -4
  36. package/cjs/functions/assert.js.map +1 -1
  37. package/cjs/functions/disposer.js +2 -2
  38. package/cjs/functions/disposer.js.map +1 -1
  39. package/cjs/functions/throttle.js +8 -8
  40. package/cjs/functions/throttle.js.map +1 -1
  41. package/cjs/logger/console.js +2 -2
  42. package/cjs/logger/console.js.map +1 -1
  43. package/cjs/logger/index.js +8 -8
  44. package/cjs/logger/index.js.map +1 -1
  45. package/cjs/logger/manager.js +8 -8
  46. package/cjs/logger/manager.js.map +1 -1
  47. package/cjs/logger/proxy.js +5 -5
  48. package/cjs/logger/proxy.js.map +1 -1
  49. package/cjs/math/arrays.js +6 -6
  50. package/cjs/math/arrays.js.map +1 -1
  51. package/cjs/math/index.js +3 -3
  52. package/cjs/math/index.js.map +1 -1
  53. package/cjs/math/object/index.js +9 -9
  54. package/cjs/math/object/index.js.map +1 -1
  55. package/cjs/math/object/math.composite.js +26 -16
  56. package/cjs/math/object/math.composite.js.map +1 -1
  57. package/cjs/math/object/math.js +9 -9
  58. package/cjs/math/object/math.js.map +1 -1
  59. package/cjs/math/object/ops.composite.js +7 -7
  60. package/cjs/math/object/ops.composite.js.map +1 -1
  61. package/cjs/math/object/ops.js +9 -9
  62. package/cjs/math/object/ops.js.map +1 -1
  63. package/cjs/models/Loading.js +14 -6
  64. package/cjs/models/Loading.js.map +1 -1
  65. package/cjs/models/LogicModel.js +27 -13
  66. package/cjs/models/LogicModel.js.map +1 -1
  67. package/cjs/models/Model.js +2 -2
  68. package/cjs/models/Model.js.map +1 -1
  69. package/cjs/models/wrappers.js +2 -2
  70. package/cjs/models/wrappers.js.map +1 -1
  71. package/cjs/observing/event.js +6 -6
  72. package/cjs/observing/event.js.map +1 -1
  73. package/cjs/observing/event.late.js +4 -4
  74. package/cjs/observing/event.late.js.map +1 -1
  75. package/cjs/observing/progressTracker.js +6 -6
  76. package/cjs/observing/progressTracker.js.map +1 -1
  77. package/cjs/observing/throttledEvent.js +4 -4
  78. package/cjs/observing/throttledEvent.js.map +1 -1
  79. package/cjs/observing/timer.js +3 -3
  80. package/cjs/observing/timer.js.map +1 -1
  81. package/cjs/storage/index.js +2 -2
  82. package/cjs/storage/index.js.map +1 -1
  83. package/cjs/structures/path/builder.js +8 -8
  84. package/cjs/structures/path/builder.js.map +1 -1
  85. package/cjs/structures/path/index.js +2 -2
  86. package/cjs/structures/path/index.js.map +1 -1
  87. package/cjs/structures/promiseCache.js +4 -4
  88. package/cjs/structures/promiseCache.js.map +1 -1
  89. package/cjs/structures/promiseExtended.js +15 -1
  90. package/cjs/structures/promiseExtended.js.map +1 -1
  91. package/cjs/structures/promiseProxy.js +2 -2
  92. package/cjs/structures/promiseProxy.js.map +1 -1
  93. package/cjs/structures/queue/parallel.js +7 -7
  94. package/cjs/structures/queue/parallel.js.map +1 -1
  95. package/cjs/structures/subscribersMap.js +6 -6
  96. package/cjs/structures/subscribersMap.js.map +1 -1
  97. package/cjs/structures/tempoCache.js +2 -2
  98. package/cjs/structures/tempoCache.js.map +1 -1
  99. package/cjs/types/index.js +4 -4
  100. package/cjs/types/index.js.map +1 -1
  101. package/cjs/validation/ValidationErrors.js +2 -2
  102. package/cjs/validation/ValidationErrors.js.map +1 -1
  103. package/cjs/validation/helpers.js +8 -8
  104. package/cjs/validation/helpers.js.map +1 -1
  105. package/cjs/validation/index.js +5 -5
  106. package/cjs/validation/index.js.map +1 -1
  107. package/cjs/validation/validators.js +17 -17
  108. package/cjs/validation/validators.js.map +1 -1
  109. package/cjs/validation/wrappers.js +7 -7
  110. package/cjs/validation/wrappers.js.map +1 -1
  111. package/esm/api/call.js +2 -2
  112. package/esm/api/call.js.map +1 -1
  113. package/esm/api/endpoint.js +2 -2
  114. package/esm/api/endpoint.js.map +1 -1
  115. package/esm/api/index.js +6 -6
  116. package/esm/api/index.js.map +1 -1
  117. package/esm/api/processor.js +1 -1
  118. package/esm/api/processor.js.map +1 -1
  119. package/esm/api/register.js +2 -2
  120. package/esm/api/register.js.map +1 -1
  121. package/esm/async/misc.js +1 -1
  122. package/esm/async/misc.js.map +1 -1
  123. package/esm/dates/calc.js +2 -2
  124. package/esm/dates/calc.js.map +1 -1
  125. package/esm/dates/convert.js +4 -4
  126. package/esm/dates/convert.js.map +1 -1
  127. package/esm/dates/datex.js +3 -3
  128. package/esm/dates/datex.js.map +1 -1
  129. package/esm/dates/decompose.js +2 -2
  130. package/esm/dates/decompose.js.map +1 -1
  131. package/esm/dates/format.js +4 -4
  132. package/esm/dates/format.js.map +1 -1
  133. package/esm/dates/index.js +10 -10
  134. package/esm/dates/index.js.map +1 -1
  135. package/esm/dates/period.js +1 -1
  136. package/esm/dates/period.js.map +1 -1
  137. package/esm/dates/shift.js +3 -3
  138. package/esm/dates/shift.js.map +1 -1
  139. package/esm/dates/types.js +1 -1
  140. package/esm/dates/types.js.map +1 -1
  141. package/esm/dates/yearDate.js +1 -1
  142. package/esm/dates/yearDate.js.map +1 -1
  143. package/esm/fields/index.js +3 -3
  144. package/esm/fields/index.js.map +1 -1
  145. package/esm/functions/assert.js +2 -2
  146. package/esm/functions/assert.js.map +1 -1
  147. package/esm/functions/disposer.js +1 -1
  148. package/esm/functions/disposer.js.map +1 -1
  149. package/esm/functions/throttle.js +4 -4
  150. package/esm/functions/throttle.js.map +1 -1
  151. package/esm/logger/console.js +1 -1
  152. package/esm/logger/console.js.map +1 -1
  153. package/esm/logger/index.js +4 -4
  154. package/esm/logger/index.js.map +1 -1
  155. package/esm/logger/manager.js +3 -3
  156. package/esm/logger/manager.js.map +1 -1
  157. package/esm/logger/proxy.js +1 -1
  158. package/esm/logger/proxy.js.map +1 -1
  159. package/esm/math/arrays.js +2 -2
  160. package/esm/math/arrays.js.map +1 -1
  161. package/esm/math/index.js +3 -3
  162. package/esm/math/index.js.map +1 -1
  163. package/esm/math/object/index.js +5 -5
  164. package/esm/math/object/index.js.map +1 -1
  165. package/esm/math/object/math.composite.js +17 -7
  166. package/esm/math/object/math.composite.js.map +1 -1
  167. package/esm/math/object/math.js +2 -2
  168. package/esm/math/object/math.js.map +1 -1
  169. package/esm/math/object/ops.composite.js +1 -1
  170. package/esm/math/object/ops.composite.js.map +1 -1
  171. package/esm/math/object/ops.js +2 -2
  172. package/esm/math/object/ops.js.map +1 -1
  173. package/esm/models/Loading.js +11 -4
  174. package/esm/models/Loading.js.map +1 -1
  175. package/esm/models/LogicModel.js +22 -8
  176. package/esm/models/LogicModel.js.map +1 -1
  177. package/esm/models/Model.js +1 -1
  178. package/esm/models/Model.js.map +1 -1
  179. package/esm/models/wrappers.js +1 -1
  180. package/esm/models/wrappers.js.map +1 -1
  181. package/esm/observing/event.js +3 -3
  182. package/esm/observing/event.js.map +1 -1
  183. package/esm/observing/event.late.js +2 -2
  184. package/esm/observing/event.late.js.map +1 -1
  185. package/esm/observing/progressTracker.js +4 -4
  186. package/esm/observing/progressTracker.js.map +1 -1
  187. package/esm/observing/throttledEvent.js +2 -2
  188. package/esm/observing/throttledEvent.js.map +1 -1
  189. package/esm/observing/timer.js +1 -1
  190. package/esm/observing/timer.js.map +1 -1
  191. package/esm/storage/index.js +2 -2
  192. package/esm/storage/index.js.map +1 -1
  193. package/esm/structures/path/builder.js +2 -2
  194. package/esm/structures/path/builder.js.map +1 -1
  195. package/esm/structures/path/index.js +2 -2
  196. package/esm/structures/path/index.js.map +1 -1
  197. package/esm/structures/promiseCache.js +2 -2
  198. package/esm/structures/promiseCache.js.map +1 -1
  199. package/esm/structures/promiseExtended.js +15 -1
  200. package/esm/structures/promiseExtended.js.map +1 -1
  201. package/esm/structures/promiseProxy.js +1 -1
  202. package/esm/structures/promiseProxy.js.map +1 -1
  203. package/esm/structures/queue/parallel.js +3 -3
  204. package/esm/structures/queue/parallel.js.map +1 -1
  205. package/esm/structures/subscribersMap.js +3 -3
  206. package/esm/structures/subscribersMap.js.map +1 -1
  207. package/esm/structures/tempoCache.js +1 -1
  208. package/esm/structures/tempoCache.js.map +1 -1
  209. package/esm/types/index.js +4 -4
  210. package/esm/types/index.js.map +1 -1
  211. package/esm/validation/ValidationErrors.js +1 -1
  212. package/esm/validation/ValidationErrors.js.map +1 -1
  213. package/esm/validation/helpers.js +3 -3
  214. package/esm/validation/helpers.js.map +1 -1
  215. package/esm/validation/index.js +5 -5
  216. package/esm/validation/index.js.map +1 -1
  217. package/esm/validation/validators.js +2 -2
  218. package/esm/validation/validators.js.map +1 -1
  219. package/esm/validation/wrappers.js +3 -3
  220. package/esm/validation/wrappers.js.map +1 -1
  221. package/package.json +1 -1
  222. package/types/api/call.d.ts +4 -4
  223. package/types/api/endpoint.d.ts +4 -4
  224. package/types/api/endpoint.types.d.ts +3 -3
  225. package/types/api/error.d.ts +1 -1
  226. package/types/api/helpers.d.ts +1 -1
  227. package/types/api/index.d.ts +8 -8
  228. package/types/api/logging.d.ts +1 -1
  229. package/types/api/register.d.ts +2 -2
  230. package/types/async/misc.d.ts +1 -1
  231. package/types/dates/calc.d.ts +1 -1
  232. package/types/dates/convert.d.ts +1 -1
  233. package/types/dates/datex.d.ts +1 -1
  234. package/types/dates/decompose.d.ts +1 -1
  235. package/types/dates/format.d.ts +1 -1
  236. package/types/dates/index.d.ts +10 -10
  237. package/types/dates/period.d.ts +1 -1
  238. package/types/dates/shift.d.ts +1 -1
  239. package/types/fields/index.d.ts +3 -3
  240. package/types/fields/update.d.ts +1 -1
  241. package/types/functions/assert.d.ts +1 -1
  242. package/types/functions/disposer.symbols.d.ts +1 -1
  243. package/types/functions/safe.d.ts +1 -1
  244. package/types/functions/throttle.d.ts +1 -1
  245. package/types/lazy/light.d.ts +1 -1
  246. package/types/lazy/promise.d.ts +2 -2
  247. package/types/lazy/singleton.d.ts +2 -2
  248. package/types/lazy/types.d.ts +2 -2
  249. package/types/logger/batch.d.ts +1 -1
  250. package/types/logger/console.d.ts +2 -2
  251. package/types/logger/file.d.ts +1 -1
  252. package/types/logger/index.d.ts +5 -5
  253. package/types/logger/manager.d.ts +3 -3
  254. package/types/logger/named.d.ts +1 -1
  255. package/types/logger/proxy.d.ts +2 -2
  256. package/types/math/arrays.d.ts +1 -1
  257. package/types/math/index.d.ts +3 -3
  258. package/types/math/object/helpers.d.ts +2 -2
  259. package/types/math/object/index.d.ts +5 -5
  260. package/types/math/object/math.composite.d.ts +4 -4
  261. package/types/math/object/math.d.ts +3 -3
  262. package/types/math/object/ops.composite.d.ts +3 -3
  263. package/types/math/object/ops.d.ts +3 -3
  264. package/types/math/object/types.d.ts +1 -1
  265. package/types/models/Loading.d.ts +7 -3
  266. package/types/models/LogicModel.d.ts +20 -7
  267. package/types/models/Model.d.ts +3 -3
  268. package/types/models/ValuesCollector.d.ts +1 -1
  269. package/types/models/wrappers.d.ts +2 -2
  270. package/types/observing/event.d.ts +2 -2
  271. package/types/observing/event.late.d.ts +1 -1
  272. package/types/observing/progressTracker.d.ts +2 -2
  273. package/types/observing/throttledEvent.d.ts +1 -1
  274. package/types/observing/timer.d.ts +2 -2
  275. package/types/storage/index.d.ts +2 -2
  276. package/types/storage/types.d.ts +1 -1
  277. package/types/storage/wrappers.d.ts +1 -1
  278. package/types/structures/path/builder.d.ts +2 -2
  279. package/types/structures/path/index.d.ts +2 -2
  280. package/types/structures/path/types.d.ts +2 -2
  281. package/types/structures/path/utils.d.ts +1 -1
  282. package/types/structures/pool.d.ts +1 -1
  283. package/types/structures/promiseCache.d.ts +1 -1
  284. package/types/structures/promiseExtended.d.ts +10 -1
  285. package/types/structures/promiseProxy.d.ts +2 -2
  286. package/types/structures/queue/parallel.d.ts +3 -3
  287. package/types/structures/queue/tasks.d.ts +1 -1
  288. package/types/structures/subscribersMap.d.ts +1 -1
  289. package/types/structures/tempoCache.d.ts +2 -2
  290. package/types/types/deep.d.ts +1 -1
  291. package/types/types/functions.d.ts +1 -1
  292. package/types/types/index.d.ts +4 -4
  293. package/types/validation/ValidationErrors.d.ts +1 -1
  294. package/types/validation/helpers.d.ts +3 -3
  295. package/types/validation/index.d.ts +5 -5
  296. package/types/validation/types.d.ts +1 -1
  297. package/types/validation/validators.d.ts +1 -1
  298. package/types/validation/wrappers.d.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { Granularity } from './types';
1
+ import { Granularity } from './types.js';
2
2
  export declare function contains(start: Date | number, end: Date | number, target: Date | number, granularity?: Granularity): boolean;
3
3
  export declare function intersects(start1: Date | number, end1: Date | number, start2: Date | number, end2: Date | number, granularity?: Granularity): boolean;
4
4
  export declare function countDays(start: Date, end: Date, condition?: (d: Date) => boolean): number;
@@ -1,4 +1,4 @@
1
- import { Granularity } from './types';
1
+ import { Granularity } from './types.js';
2
2
  type DateFields<T> = {
3
3
  [P in keyof T]: T[P] extends Date ? P : never;
4
4
  }[keyof T];
@@ -1,4 +1,4 @@
1
- import { Granularity } from './types';
1
+ import { Granularity } from './types.js';
2
2
  export declare namespace DateX {
3
3
  type DateGranularity = Granularity | 'weekDay';
4
4
  function get(d: Date, g: DateGranularity, local: boolean): number;
@@ -1,4 +1,4 @@
1
- import { Granularity } from './types';
1
+ import { Granularity } from './types.js';
2
2
  export type DecomposeGranularity = 'week' | 'day' | 'hour' | 'minute' | 'second';
3
3
  export declare function decomposeMs<K extends Granularity & DecomposeGranularity>(ms: number, ...grans: K[]): Record<K, number>;
4
4
  export declare function decompose(date: number | Date, local: boolean, ...grans: (Granularity & DecomposeGranularity)[]): Partial<Record<DecomposeGranularity, number>>;
@@ -1,4 +1,4 @@
1
- import { YearDate } from './yearDate';
1
+ import { YearDate } from './yearDate.js';
2
2
  export declare namespace Format {
3
3
  const DefaultLocale = "en-US";
4
4
  enum Presets {
@@ -1,10 +1,10 @@
1
- export * from './calc';
2
- export * from './convert';
3
- export * from './datex';
4
- export * from './format';
5
- export * from './parse';
6
- export * from './period';
7
- export * from './shift';
8
- export * from './types';
9
- export * from './yearDate';
10
- export * from './decompose';
1
+ export * from './calc.js';
2
+ export * from './convert.js';
3
+ export * from './datex.js';
4
+ export * from './format.js';
5
+ export * from './parse.js';
6
+ export * from './period.js';
7
+ export * from './shift.js';
8
+ export * from './types.js';
9
+ export * from './yearDate.js';
10
+ export * from './decompose.js';
@@ -1,4 +1,4 @@
1
- import { Granularity } from './types';
1
+ import { Granularity } from './types.js';
2
2
  export type Period = {
3
3
  amount: number;
4
4
  granularity: Granularity;
@@ -1,4 +1,4 @@
1
- import { Granularity } from './types';
1
+ import { Granularity } from './types.js';
2
2
  export declare function addDays(start: Date, amount: number, condition: (d: Date) => boolean, maxShift?: number): Date;
3
3
  export declare function shiftDate(date: Date | number, amount: number, granularity: Granularity, local?: boolean): Date;
4
4
  /** @deprecated Use {@link shiftDate} instead */
@@ -1,3 +1,3 @@
1
- export * from './filter';
2
- export * from './update';
3
- export * from './transfer';
1
+ export * from './filter.js';
2
+ export * from './update.js';
3
+ export * from './transfer.js';
@@ -1,4 +1,4 @@
1
- import { Comparator } from '../types';
1
+ import { Comparator } from '../types/index.js';
2
2
  export declare namespace Fields {
3
3
  type Getter<T> = (obj: Partial<T>) => (T[keyof T] | undefined);
4
4
  type Setter<T> = (obj: Partial<T>, val: T[keyof T] | undefined) => void;
@@ -1,2 +1,2 @@
1
- import { Getter } from '../types';
1
+ import { Getter } from '../types/index.js';
2
2
  export declare function assert(condition: boolean, error: Getter<string | Error>, objectToLog?: Getter<any>): asserts condition;
@@ -1,4 +1,4 @@
1
- import type { IDisposable } from './disposer';
1
+ import type { IDisposable } from './disposer.js';
2
2
  export declare abstract class SymbolDisposable implements globalThis.Disposable, IDisposable {
3
3
  [Symbol.dispose]: () => void;
4
4
  abstract dispose(): void;
@@ -1,4 +1,4 @@
1
- import { Nullable } from '../types';
1
+ import { Nullable } from '../types/index.js';
2
2
  type LaxPromise<T> = Promise<T> | T | void;
3
3
  export declare function catchPromise(promise: LaxPromise<any>, cb?: (err: any) => void): void;
4
4
  export declare function wrapAsync<T, TArgs extends any[]>(fn: Nullable<(...args: TArgs) => LaxPromise<T>>, cb?: (err: any) => void): (...args: TArgs) => void;
@@ -1,4 +1,4 @@
1
- import { ILogger } from '../logger';
1
+ import { ILogger } from '../logger/index.js';
2
2
  /** Runs a callback after a timeout, ignoring all consecutive calls until the first is processed. */
3
3
  export declare class ThrottleAction<T = any> {
4
4
  timeout: number;
@@ -1,2 +1,2 @@
1
- import type { ILazy } from './types';
1
+ import type { ILazy } from './types.js';
2
2
  export declare function createLazy<T>(factory: () => T): ILazy<T>;
@@ -1,5 +1,5 @@
1
- import type { IExpireTracker } from '../structures/expire';
2
- import type { ILazyPromise } from './types';
1
+ import type { IExpireTracker } from '../structures/expire.js';
2
+ import type { ILazyPromise } from './types.js';
3
3
  export declare class LazyPromise<T> implements ILazyPromise<T> {
4
4
  private readonly _factory;
5
5
  private readonly initial;
@@ -1,5 +1,5 @@
1
- import type { IExpireTracker } from '../structures/expire';
2
- import type { ILazy } from './types';
1
+ import type { IExpireTracker } from '../structures/expire.js';
2
+ import type { ILazy } from './types.js';
3
3
  export declare class Lazy<T> implements ILazy<T> {
4
4
  protected readonly _factory: (() => T);
5
5
  protected _instance: T | undefined;
@@ -1,5 +1,5 @@
1
- import { IDisposable } from '../functions/disposer';
2
- import { IResetableModel } from '../models/types';
1
+ import { IDisposable } from '../functions/disposer.js';
2
+ import { IResetableModel } from '../models/types.js';
3
3
  export type ILazy<T> = IDisposable & IResetableModel & {
4
4
  readonly value: T;
5
5
  readonly hasValue: boolean;
@@ -1,2 +1,2 @@
1
- import { ILogger } from './abstractions';
1
+ import { ILogger } from './abstractions.js';
2
2
  export declare function batchLoggers(...loggers: ILogger[]): ILogger;
@@ -1,5 +1,5 @@
1
- import { ILogger } from './abstractions';
2
- import { NamedLogger } from './named';
1
+ import { ILogger } from './abstractions.js';
2
+ import { NamedLogger } from './named.js';
3
3
  export declare const CONSOLE: ILogger;
4
4
  export declare class ConsoleLogger extends NamedLogger {
5
5
  protected get implementation(): ILogger;
@@ -1,4 +1,4 @@
1
- import { ILogger } from './abstractions';
1
+ import { ILogger } from './abstractions.js';
2
2
  export declare class FileLoggerNode implements ILogger {
3
3
  readonly extraLogger: ILogger;
4
4
  readonly instantFlush: boolean;
@@ -1,9 +1,9 @@
1
- import { ILogger, LoggerFunction } from './abstractions';
2
- import { ConsoleLogger } from './console';
3
- import { batchLoggers } from './batch';
4
- import { LoggerModes } from './manager';
1
+ import { ILogger, LoggerFunction } from './abstractions.js';
2
+ import { ConsoleLogger } from './console.js';
3
+ import { batchLoggers } from './batch.js';
4
+ import { LoggerModes } from './manager.js';
5
5
  export type { ILogger, LoggerFunction };
6
- export { NamedLogger } from './named';
6
+ export { NamedLogger } from './named.js';
7
7
  export { ConsoleLogger, batchLoggers };
8
8
  export declare function createLogger(name: string | undefined, mode?: undefined | LoggerModes): ILogger;
9
9
  export declare function detachLogger(instance: ILogger, terminate?: boolean): boolean;
@@ -1,6 +1,6 @@
1
- import { Getter } from '../types/getter';
2
- import { ILogger } from './abstractions';
3
- import { ProxyLogger } from './proxy';
1
+ import { Getter } from '../types/getter.js';
2
+ import { ILogger } from './abstractions.js';
3
+ import { ProxyLogger } from './proxy.js';
4
4
  export type LoggerTypes = 'console';
5
5
  export type LoggerModes = LoggerTypes | false | Getter<ILogger>;
6
6
  export declare class LoggersManager {
@@ -1,4 +1,4 @@
1
- import { ILogger, ILoggerSwitchable, LoggerFunction } from './abstractions';
1
+ import { ILogger, ILoggerSwitchable, LoggerFunction } from './abstractions.js';
2
2
  export declare const EMPTY_FUNCTION: () => void;
3
3
  export declare abstract class NamedLogger implements ILogger, ILoggerSwitchable {
4
4
  log: LoggerFunction;
@@ -1,5 +1,5 @@
1
- import { ILogger } from './abstractions';
2
- import { NamedLogger } from './named';
1
+ import { ILogger } from './abstractions.js';
2
+ import { NamedLogger } from './named.js';
3
3
  export declare const EMPTY_LOGGER: ILogger;
4
4
  export declare class ProxyLogger extends NamedLogger {
5
5
  protected get implementation(): ILogger;
@@ -1,4 +1,4 @@
1
- import { Comparator, Getter, Nullable, Predicate } from '../types';
1
+ import { Comparator, Getter, Nullable, Predicate } from '../types/index.js';
2
2
  /** type-safe `Array.isArray` wrapper */
3
3
  export declare function isArray<T>(value: any): value is T[];
4
4
  export declare function arrayCompareG<T>(arr: ReadonlyArray<T> | null | undefined, cond: (current: T, previous: T | null) => boolean): T | null;
@@ -1,5 +1,5 @@
1
- export * from './calc';
2
- export * from './arrays';
3
- export * from './distribution';
1
+ export * from './calc.js';
2
+ export * from './arrays.js';
3
+ export * from './distribution.js';
4
4
  export declare function getNumberSuffix(num: number): "st" | "nd" | "rd" | "th";
5
5
  export declare function format(n: number, digits?: number): string;
@@ -1,5 +1,5 @@
1
- import { DeepReadonly, DeepReadonlyPartial } from '../../types/deep';
2
- import { BasePair, IObjectOps, NumKey } from './types';
1
+ import { DeepReadonly, DeepReadonlyPartial } from '../../types/deep.js';
2
+ import { BasePair, IObjectOps, NumKey } from './types.js';
3
3
  export declare function _getValue<T extends object, TKey extends NumKey<T> = NumKey<T>>(o: DeepReadonlyPartial<T>, key: TKey): T[TKey] | null;
4
4
  export declare function _getInnerValue<T extends object, TKey extends string & keyof T>(o: DeepReadonly<T>, key: TKey): DeepReadonly<T[TKey]>;
5
5
  export declare function _getInnerValue<T extends object, TKey extends string & keyof T>(o: DeepReadonly<T> | number, key: TKey): DeepReadonly<T[TKey]> | number;
@@ -1,5 +1,5 @@
1
- export * from './types';
2
- export { ObjectOps } from './ops';
3
- export { ObjectMath } from './math';
4
- export { CompositeObjectOps } from './ops.composite';
5
- export { CompositeObjectMath } from './math.composite';
1
+ export * from './types.js';
2
+ export { ObjectOps } from './ops.js';
3
+ export { ObjectMath } from './math.js';
4
+ export { CompositeObjectOps } from './ops.composite.js';
5
+ export { CompositeObjectMath } from './math.composite.js';
@@ -1,7 +1,7 @@
1
- import { AnyObject } from '../../types';
2
- import { DeepReadonly } from '../../types/deep';
3
- import { CompositeObjectOps } from './ops.composite';
4
- import { AbsOptions, IObjectMath, MathPairsMap, RoundOptions } from './types';
1
+ import { AnyObject } from '../../types/index.js';
2
+ import { DeepReadonly } from '../../types/deep.js';
3
+ import { CompositeObjectOps } from './ops.composite.js';
4
+ import { 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>);
@@ -1,6 +1,6 @@
1
- import { DeepReadonly, DeepReadonlyPartial } from '../../types/deep';
2
- import { ObjectOps } from './ops';
3
- import { AbsOptions, DELETE_TYPE, IObjectMath, NumKey, RoundOptions } from './types';
1
+ import { DeepReadonly, DeepReadonlyPartial } from '../../types/deep.js';
2
+ import { ObjectOps } from './ops.js';
3
+ import { AbsOptions, DELETE_TYPE, IObjectMath, NumKey, RoundOptions } from './types.js';
4
4
  export declare class ObjectMath<T extends object> extends ObjectOps<T> implements IObjectMath<T> {
5
5
  getTotal(o: DeepReadonlyPartial<T>): number;
6
6
  contains(base: DeepReadonly<T>, target: DeepReadonly<T>): boolean;
@@ -1,6 +1,6 @@
1
- import { AnyObject } from '../../types';
2
- import { DeepReadonly } from '../../types/deep';
3
- import { IObjectOps, OpsPairsMap } from './types';
1
+ import { AnyObject } from '../../types/index.js';
2
+ import { DeepReadonly } from '../../types/deep.js';
3
+ import { 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;
@@ -1,6 +1,6 @@
1
- import { SkipCondition, SkipOptions } from '../../fields/skip';
2
- import { AnyObject, DeepPartial, DeepReadonly, Predicate } from '../../types';
3
- import { IObjectOps, NumKey } from './types';
1
+ import { SkipCondition, SkipOptions } from '../../fields/skip.js';
2
+ import { AnyObject, DeepPartial, DeepReadonly, Predicate } from '../../types/index.js';
3
+ import { 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> {
6
6
  readonly keys: Keys<T>;
@@ -1,4 +1,4 @@
1
- import { AnyObject, DeepReadonly, TypedKeys } from '../../types';
1
+ import { AnyObject, DeepReadonly, 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';
@@ -1,9 +1,9 @@
1
- import type { IResetableModel, IValueModel } from './types';
1
+ import type { IResetableModel, IValueModel } from './types.js';
2
2
  export type LoadingWorker<T> = () => (T | Promise<T>);
3
3
  export type LoadingResult<T = unknown> = {
4
- exclusivenessFailed: true;
4
+ aborted: true;
5
5
  } | {
6
- exclusivenessFailed: false;
6
+ aborted: false;
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>>;
@@ -29,3 +29,7 @@ export declare class LoadingModel implements IValueModel<boolean>, IResetableMod
29
29
  * Called in the ctor. Should be pure and should NOT access `this`. */
30
30
  protected pureConstructNumberModel(): IValueModel<number> & IResetableModel;
31
31
  }
32
+ export declare class ExclusiveLoadingError extends Error {
33
+ readonly actionName?: string | undefined;
34
+ constructor(message?: string, actionName?: string | undefined);
35
+ }
@@ -1,8 +1,8 @@
1
- import { LoadingModel } from './Loading';
2
- import { Getter } from '../types';
3
- import { PromiseExtended } from '../structures/promiseExtended';
4
- import { ILogger } from '../logger';
5
- type RunOptions = {
1
+ import { ExclusiveLoadingError, LoadingModel } from './Loading.js';
2
+ import { Getter } from '../types/index.js';
3
+ import { PromiseExtended } from '../structures/promiseExtended.js';
4
+ import { ILogger } from '../logger/index.js';
5
+ export type ActionRunOptions = {
6
6
  /** Action name, required for logging and joining. */
7
7
  name?: string;
8
8
  /** If set to truthy, will not start an action if another is still in progress.
@@ -29,6 +29,19 @@ export declare class LogicModel {
29
29
  private readonly _runningActionNames;
30
30
  constructor(name?: string, useFirstInit?: boolean);
31
31
  protected pureConstructLoadingModel(useFirstInit: boolean): LoadingModel;
32
- protected runAction<T = unknown>(worker: () => Promise<T>, options?: RunOptions, errorCtx?: Getter<unknown>): PromiseExtended<T | undefined>;
32
+ protected runAction<T = unknown>(worker: () => Promise<T>, options?: ActionRunOptions, errorCtx?: Getter<unknown>): ActionResult<T>;
33
+ }
34
+ export type ActionResult<T, TCustomErrors extends Record<string, unknown> = Record<never, unknown>> = ReturnType<typeof ActionResult.expectExclusive<T | undefined, TCustomErrors>>;
35
+ export declare namespace ActionResult {
36
+ type Expect = {
37
+ exclusive: ExclusiveLoadingError;
38
+ };
39
+ namespace Expect {
40
+ const Config: {
41
+ readonly name: "exclusive";
42
+ readonly ErrCtor: typeof ExclusiveLoadingError;
43
+ };
44
+ }
45
+ const expectExclusive: <T, TPrevErrors extends Record<string, unknown>>(promise: PromiseExtended<T, TPrevErrors>, processor?: ((error: ExclusiveLoadingError) => void | Partial<TPrevErrors & Record<"exclusive", ExclusiveLoadingError>>) | undefined) => PromiseExtended<T, TPrevErrors & Record<"exclusive", ExclusiveLoadingError>>;
46
+ function createSucceeded<T>(data: T): ActionResult<T>;
33
47
  }
34
- export {};
@@ -1,6 +1,6 @@
1
- import type { IResetableModel, IValueModel } from './types';
2
- import { Getter } from '../types/getter';
3
- import { Nullable } from '../types/misc';
1
+ import type { IResetableModel, IValueModel } from './types.js';
2
+ import { Getter } from '../types/getter.js';
3
+ import { Nullable } from '../types/misc.js';
4
4
  export declare class Model<T> implements IValueModel<Nullable<T>>, IResetableModel {
5
5
  private _value;
6
6
  private readonly _defaultValue;
@@ -1,4 +1,4 @@
1
- import type { IValueModel } from './types';
1
+ import type { IValueModel } from './types.js';
2
2
  export interface IValueCollector<TSource, TValue> {
3
3
  getValue(source: TSource): TValue;
4
4
  setValue(source: TSource, value: TValue): void;
@@ -1,5 +1,5 @@
1
- import { Getter } from '../types/getter';
2
- import type { ILabel, IValueModel } from './types';
1
+ import { Getter } from '../types/getter.js';
2
+ import type { ILabel, IValueModel } from './types.js';
3
3
  export declare function withLabel<T, TModel extends IValueModel<T>, TLabel = string>(model: TModel, label: Getter<TLabel>): TModel & ILabel<TLabel>;
4
4
  export declare function inject<T, TModel extends IValueModel<T>>(model: TModel, source: IValueModel<T>): TModel;
5
5
  /**
@@ -1,5 +1,5 @@
1
- import type { Predicate } from '../types';
2
- import { ILogger } from '../logger';
1
+ import type { Predicate } from '../types/index.js';
2
+ import { ILogger } from '../logger/index.js';
3
3
  export type EventHandler<T = any> = (data?: T) => void | Promise<void>;
4
4
  type Unsubscribe = () => void;
5
5
  export interface IEvent<T = any> {
@@ -1,4 +1,4 @@
1
- import { Event, EventHandler } from './event';
1
+ import { Event, EventHandler } from './event.js';
2
2
  export declare class OneTimeLateEvent<T = any> extends Event<T> {
3
3
  private _triggeredWith;
4
4
  private _triggered;
@@ -1,4 +1,4 @@
1
- import { ILogger } from '../logger';
1
+ import { ILogger } from '../logger/index.js';
2
2
  export declare class ProgressTracker {
3
3
  readonly log: boolean | ILogger;
4
4
  private readonly _firstTimestamp;
@@ -10,7 +10,7 @@ export declare class ProgressTracker {
10
10
  private readonly _deltas;
11
11
  private readonly _changed;
12
12
  constructor(log?: boolean | ILogger);
13
- get changed(): import("./event").IEvent<{
13
+ get changed(): import("./event.js").IEvent<{
14
14
  completed: number;
15
15
  total: number;
16
16
  currentProgress: number;
@@ -1,4 +1,4 @@
1
- import { Event } from './event';
1
+ import { Event } from './event.js';
2
2
  export declare class ThrottledEvent extends Event {
3
3
  private readonly _throttle;
4
4
  setTimeout(timeout: number): this;
@@ -1,5 +1,5 @@
1
- import { IDisposable } from '../functions/disposer';
2
- import { EventHandler, IEvent } from './event';
1
+ import { IDisposable } from '../functions/disposer.js';
2
+ import { EventHandler, IEvent } from './event.js';
3
3
  export type TimerState = {
4
4
  timer: Timer;
5
5
  elapsed: number;
@@ -1,2 +1,2 @@
1
- export * from './types';
2
- export * from './wrappers';
1
+ export * from './types.js';
2
+ export * from './wrappers.js';
@@ -1,4 +1,4 @@
1
- import type { RemoveFirstParameter, Awaitify } from '../types/functions';
1
+ import type { RemoveFirstParameter, Awaitify } from '../types/functions.js';
2
2
  export interface IStorage<T = string> {
3
3
  getValue(key: string): Promise<T | null>;
4
4
  setValue(key: string, value: T): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { IKeyedStorage, IKeyedStorageSync, IStorage, IStorageSync } from './types';
1
+ import type { IKeyedStorage, IKeyedStorageSync, IStorage, IStorageSync } from './types.js';
2
2
  export declare namespace Storages {
3
3
  function toAsync<T = string>(storage: IStorageSync<T>): IStorage<T>;
4
4
  function toKeyed<T = string>(storage: IStorage<T>, storageKey: string): IKeyedStorage<T>;
@@ -1,5 +1,5 @@
1
- import { BaseInput, CombineBuilders, StaticBuilder, SwitchBuilder } from './types';
2
- export * from './types';
1
+ import { BaseInput, CombineBuilders, StaticBuilder, SwitchBuilder } from './types.js';
2
+ export * from './types.js';
3
3
  /** Tagged template literal to create a path builder */
4
4
  export declare function build<TArgs extends string[]>(strings: TemplateStringsArray, ...params: TArgs): SwitchBuilder<TArgs>;
5
5
  export declare const Empty: StaticBuilder;
@@ -1,2 +1,2 @@
1
- export * from './utils';
2
- export * as Path from './builder';
1
+ export * from './utils.js';
2
+ export * as Path from './builder.js';
@@ -1,5 +1,5 @@
1
- import type { LengthArray, Nullable } from '../../types/misc';
2
- import type { CombineOptions } from './utils';
1
+ import type { LengthArray, Nullable } from '../../types/misc.js';
2
+ import type { CombineOptions } from './utils.js';
3
3
  export type ArgValue = string | number;
4
4
  export type ObjectBuilderArgs<TArgs extends string> = Record<TArgs, ArgValue>;
5
5
  export type BuilderArgs<TArgs extends string, L extends number = number> = LengthArray<ArgValue, L> | Record<TArgs, ArgValue>;
@@ -1,4 +1,4 @@
1
- import { Nullable } from '../../types/misc';
1
+ import { Nullable } from '../../types/misc.js';
2
2
  export declare function indexTrim(str: string | null | undefined, ch: string): string;
3
3
  export type CombineOptions = {
4
4
  noTrim?: boolean;
@@ -1,4 +1,4 @@
1
- import type { IDisposable } from '../functions/disposer';
1
+ import type { IDisposable } from '../functions/disposer.js';
2
2
  export declare class Pool<T> {
3
3
  readonly factory: () => T;
4
4
  private readonly _container;
@@ -1,4 +1,4 @@
1
- import { ILogger } from '../logger';
1
+ import { ILogger } from '../logger/index.js';
2
2
  export type DeferredGetter<T> = {
3
3
  readonly current: T | null | undefined;
4
4
  readonly promise: Promise<T | null>;
@@ -1,4 +1,4 @@
1
- import type { Nullable } from '../types/misc';
1
+ import type { Nullable } from '../types/misc.js';
2
2
  /**
3
3
  * The idea here is to wrap a promise (or promise getter) so it will never throw natively, but still be able to provide success/fail results:
4
4
  * - `onSuccess` for handling successful result: like `then` but to be called only if there was no error
@@ -47,6 +47,7 @@ export declare class PromiseExtended<T, TCustomErrors extends Record<string, unk
47
47
  static errored<T, TErrors extends Record<string, unknown>>(source: Error | Error[] | string): PromiseExtended<T, TErrors>;
48
48
  onError(cb: Nullable<(data: PromiseExtended.ErrorData & TCustomErrors) => void>): this;
49
49
  onSuccess(cb: Nullable<(data: T) => void>): this;
50
+ expectError<TName extends string, TError2 extends Error>(config: PromiseExtended.ErrorConfig<TName, TError2, TCustomErrors>): PromiseExtended<T, TCustomErrors & Record<TName, TError2>>;
50
51
  expectError<TName extends string, TError2 extends Error>(name: TName, ErrCtor: new (...args: any[]) => TError2, processor?: (value: TError2) => void | Partial<TCustomErrors & Record<TName, TError2>>): PromiseExtended<T, TCustomErrors & Record<TName, TError2>>;
51
52
  then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): PromiseExtended<TResult1 | TResult2, TCustomErrors>;
52
53
  catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): PromiseExtended<T | TResult, TCustomErrors>;
@@ -67,4 +68,12 @@ export declare namespace PromiseExtended {
67
68
  error: string;
68
69
  source: Error;
69
70
  };
71
+ type ErrorConfig<TName extends string, TError2 extends Error, TPrevErrors> = {
72
+ name: TName;
73
+ ErrCtor: new (...args: any[]) => TError2;
74
+ processor?: (value: TError2) => void | Partial<TPrevErrors & Record<TName, TError2>>;
75
+ };
76
+ namespace ErrorConfig {
77
+ function createExpecter<TName extends string, TError2 extends Error>(config: Omit<ErrorConfig<TName, TError2, unknown>, 'processor'>): <T, TPrevErrors extends Record<string, unknown>>(promise: PromiseExtended<T, TPrevErrors>, processor?: (error: TError2) => void | Partial<TPrevErrors & Record<TName, TError2>>) => PromiseExtended<T, TPrevErrors & Record<TName, TError2>>;
78
+ }
70
79
  }
@@ -1,5 +1,5 @@
1
- import { LazyPromise } from '../lazy/promise';
2
- import { AnyObject, FunctionKeys, StringKeys } from '../types';
1
+ import { LazyPromise } from '../lazy/promise.js';
2
+ import { AnyObject, FunctionKeys, StringKeys } from '../types/index.js';
3
3
  declare const PromiseGetter = "__promise";
4
4
  type AllowedFnKeys<T extends AnyObject> = FunctionKeys<T, any[], void>;
5
5
  type PromiseProxy<T extends AnyObject, TKeys extends StringKeys<T> = StringKeys<T>, TFnKeys = never, TWrap extends object = object> = {
@@ -10,9 +10,9 @@ export declare class ParallelQueue {
10
10
  private readonly _finished;
11
11
  get currentPriority(): number;
12
12
  get inProgress(): boolean;
13
- get beforePriorityRun(): import("../../observing/event").IEvent<number>;
14
- get afterPriorityRun(): import("../../observing/event").IEvent<number>;
15
- get finished(): import("../../observing/event").IEvent<any>;
13
+ get beforePriorityRun(): import("../../observing/event.js").IEvent<number>;
14
+ get afterPriorityRun(): import("../../observing/event.js").IEvent<number>;
15
+ get finished(): import("../../observing/event.js").IEvent<any>;
16
16
  withLogger(name?: string): this;
17
17
  /** @returns A callback that will try to cancel queued item */
18
18
  enqueue(cb: QueueItem, priority?: number): () => void;
@@ -1,4 +1,4 @@
1
- import type { ILogger } from '../../logger';
1
+ import type { ILogger } from '../../logger/index.js';
2
2
  type Factory<T> = () => Promise<T>;
3
3
  export declare class TasksQueue<T> {
4
4
  readonly limit: number;
@@ -1,4 +1,4 @@
1
- import { IDisposable } from '../functions/disposer';
1
+ import { IDisposable } from '../functions/disposer.js';
2
2
  type Unsub = () => void;
3
3
  export declare class SubscribersMap implements IDisposable {
4
4
  readonly subscribe: null | ((key: string) => Promise<Unsub[]>);
@@ -1,5 +1,5 @@
1
- import type { ILazy, ILazyPromise } from '../lazy/types';
2
- import { ExpireTracker } from './expire';
1
+ import type { ILazy, ILazyPromise } from '../lazy/types.js';
2
+ import { ExpireTracker } from './expire.js';
3
3
  /**
4
4
  * Calls factory fn to fetch and store some value for a limited time.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { AnyFunction } from './misc';
1
+ import { AnyFunction } from './misc.js';
2
2
  export type DeepReadonly<T> = T extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : (T extends AnyFunction ? T : (T extends object ? {
3
3
  readonly [P in keyof T]: DeepReadonly<T[P]>;
4
4
  } : T));
@@ -1,4 +1,4 @@
1
- import { AnyFunction } from './misc';
1
+ import { AnyFunction } from './misc.js';
2
2
  export type TypedFn<A extends unknown[], R> = (...args: A) => R;
3
3
  export type Asyncify<T> = {
4
4
  [P in keyof T]: T[P] extends TypedFn<unknown[], Promise<unknown>> ? T[P] : (T[P] extends TypedFn<infer A, infer R> ? (...args: A) => Promise<R> : T[P]);