@awesome-ecs/abstract 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs.map +1 -1
- package/dist/entities/index.cjs.map +1 -1
- package/dist/entities/index.d.cts +3 -3
- package/dist/entities/index.d.mts +3 -3
- package/dist/entities/index.mjs.map +1 -1
- package/dist/factories/index.cjs +1 -1
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +1 -1
- package/dist/factories/index.d.mts +1 -1
- package/dist/factories/index.mjs +1 -1
- package/dist/factories/index.mjs.map +1 -1
- package/dist/{index-zohK7ftH.d.cts → index-B1OYkMOx.d.cts} +197 -350
- package/dist/{index-BguFn1Xj.d.cts → index-BGLTfuj8.d.cts} +24 -4
- package/dist/{identity-component-CuWHf7jX.d.mts → index-C0jDrUBA.d.cts} +81 -70
- package/dist/{index-kNcUiDBd.d.mts → index-C1hRAjM-.d.mts} +24 -4
- package/dist/index-CeqaKmWR.d.mts +218 -0
- package/dist/{index-DZlhICMZ.d.mts → index-D3rS2RFG.d.mts} +197 -350
- package/dist/index-DMTkNY1e.d.cts +218 -0
- package/dist/{identity-component-DLDaOTyK.d.cts → index-b5BtWAvO.d.mts} +81 -70
- package/dist/pipelines/index.d.cts +1 -1
- package/dist/pipelines/index.d.mts +1 -1
- package/dist/systems/index.cjs +9 -4
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +2 -2
- package/dist/systems/index.d.mts +2 -2
- package/dist/systems/index.mjs +9 -4
- package/dist/systems/index.mjs.map +1 -1
- package/dist/types-Bbmnq4ni.d.cts +74 -0
- package/dist/types-C1ojaDL4.d.mts +74 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +3 -3
- package/dist/utils/index.d.mts +3 -3
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//#region src/utils/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Maps all properties of a type to boolean flags.
|
|
4
|
+
* Useful for feature flags, capability indicators, or boolean option sets.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The type whose properties are mapped to booleans.
|
|
7
|
+
* @example type Features = BooleanProps<{health: any; armor: any}>; // => {health: boolean, armor: boolean}
|
|
8
|
+
*/
|
|
9
|
+
type BooleanProps<T> = { [Property in keyof T]: boolean };
|
|
10
|
+
/**
|
|
11
|
+
* Removes readonly modifiers from all properties, making them mutable.
|
|
12
|
+
* One level of immutability removal (see MutableDeep for recursive removal).
|
|
13
|
+
*
|
|
14
|
+
* @template T - The type to make mutable.
|
|
15
|
+
* @example type Mut = Mutable<{readonly x: number}>; // => {x: number}
|
|
16
|
+
*/
|
|
17
|
+
type Mutable<T> = { -readonly [K in keyof T]: T[K] };
|
|
18
|
+
/**
|
|
19
|
+
* Recursively removes readonly modifiers from all properties at all nesting levels.
|
|
20
|
+
* Makes entire object graph mutable.
|
|
21
|
+
*
|
|
22
|
+
* @template T - The type to make mutable recursively.
|
|
23
|
+
*/
|
|
24
|
+
type MutableDeep<T> = { -readonly [K in keyof T]: Mutable<T[K]> };
|
|
25
|
+
type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
|
|
26
|
+
/**
|
|
27
|
+
* Makes a type fully immutable at the top level only.
|
|
28
|
+
* Primitives and functions remain unchanged.
|
|
29
|
+
* Collections (Array, Map, Set) become readonly.
|
|
30
|
+
* Objects have their properties made readonly.
|
|
31
|
+
*
|
|
32
|
+
* @template T - The type to make immutable.
|
|
33
|
+
* @example type Imm = Immutable<{x: number}>; // => {readonly x: number}
|
|
34
|
+
*/
|
|
35
|
+
type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
|
|
36
|
+
/**
|
|
37
|
+
* Readonly array variant for use in Immutable type transformation.
|
|
38
|
+
*
|
|
39
|
+
* @template T - Element type of the array.
|
|
40
|
+
*/
|
|
41
|
+
type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
|
|
42
|
+
/**
|
|
43
|
+
* Readonly map variant for use in Immutable type transformation.
|
|
44
|
+
*
|
|
45
|
+
* @template K - Key type of the map.
|
|
46
|
+
* @template V - Value type of the map.
|
|
47
|
+
*/
|
|
48
|
+
type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
|
|
49
|
+
/**
|
|
50
|
+
* Readonly set variant for use in Immutable type transformation.
|
|
51
|
+
*
|
|
52
|
+
* @template T - Element type of the set.
|
|
53
|
+
*/
|
|
54
|
+
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
|
|
55
|
+
/**
|
|
56
|
+
* Makes all object properties readonly (one level only).
|
|
57
|
+
*
|
|
58
|
+
* @template T - The type to make immutable.
|
|
59
|
+
*/
|
|
60
|
+
type ImmutableObject<T> = { readonly [K in keyof T]: T[K] };
|
|
61
|
+
/**
|
|
62
|
+
* Recursively makes all properties readonly at all nesting levels.
|
|
63
|
+
* Provides complete immutability guarantee for the entire object graph.
|
|
64
|
+
*
|
|
65
|
+
* @template T - The type to make deeply immutable.
|
|
66
|
+
*/
|
|
67
|
+
type ImmutableObjectDeep<T> = { readonly [K in keyof T]: Immutable<T[K]> };
|
|
68
|
+
/**
|
|
69
|
+
* Recursively makes all properties optional at all nesting levels.
|
|
70
|
+
*/
|
|
71
|
+
type DeepPartial<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends readonly unknown[] ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { ImmutableMap as a, ImmutableSet as c, ImmutableArray as i, Mutable as l, DeepPartial as n, ImmutableObject as o, Immutable as r, ImmutableObjectDeep as s, BooleanProps as t, MutableDeep as u };
|
|
74
|
+
//# sourceMappingURL=types-C1ojaDL4.d.mts.map
|
package/dist/utils/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/utils/dispatch-sequential.ts","../../src/utils/logger.ts"],"sourcesContent":["/**\r\n * Executes a function for each item in an iterable, sequentially.\r\n *\r\n * Uses a sync fast-path: iterates synchronously until the first Promise is\r\n * encountered, then switches to async for the remainder. If no item produces\r\n * a Promise, the entire call stays synchronous with zero async overhead.\r\n *\r\n * @param items - The iterable to iterate over.\r\n * @param fn - The function to call for each item. May return void or a Promise.\r\n * @returns void if all calls were synchronous, or a Promise if any were async.\r\n */\r\nexport function dispatchSequential<T>(\r\n items: Iterable<T>,\r\n fn: (item: T) => void | Promise<void>\r\n): void | Promise<void> {\r\n const iterator = items[Symbol.iterator]();\r\n\r\n for (let next = iterator.next(); !next.done; next = iterator.next()) {\r\n const result = fn(next.value);\r\n\r\n if (result instanceof Promise) {\r\n return continueAsync(iterator, fn, result);\r\n }\r\n }\r\n}\r\n\r\nasync function continueAsync<T>(\r\n iterator: Iterator<T>,\r\n fn: (item: T) => void | Promise<void>,\r\n pending: Promise<void>\r\n): Promise<void> {\r\n await pending;\r\n\r\n for (let next = iterator.next(); !next.done; next = iterator.next()) {\r\n const result = fn(next.value);\r\n\r\n if (result instanceof Promise) {\r\n await result;\r\n }\r\n }\r\n}\r\n","/**\r\n * Logger interface for debug and diagnostic output.\r\n * Supports multiple log levels for controlling verbosity.\r\n * Implementations can target different outputs (console, file, remote, etc.).\r\n */\r\nexport interface ILogger {\r\n /**\r\n * Logs a message with a specified severity level.\r\n * @param level - The severity level of the message.\r\n * @param message - The primary message content.\r\n * @param args - Additional arguments to include in the log output.\r\n */\r\n log(level: LogLevel, message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs detailed diagnostic information.\r\n * Typically the lowest level, most verbose output.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n trace(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs debug-level information.\r\n * Useful during development and troubleshooting.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n debug(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs warning-level messages.\r\n * Indicates potentially problematic conditions.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n warn(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs error-level messages.\r\n * Indicates error conditions that may require attention.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n error(message: any, ...args: any[]): void;\r\n}\r\n\r\n/**\r\n * Logging severity levels in increasing order.\r\n */\r\nexport enum LogLevel {\r\n /**\r\n * Most detailed, diagnostic-level logging.\r\n */\r\n trace,\r\n\r\n /**\r\n * Development and debugging information.\r\n */\r\n debug,\r\n\r\n /**\r\n * Warning-level conditions.\r\n */\r\n warn,\r\n\r\n /**\r\n * Error-level conditions.\r\n */\r\n error\r\n}\r\n\r\n/**\r\n * Configuration options for logger instances.\r\n */\r\nexport interface ILoggerOptions {\r\n /**\r\n * Enables/disables each log level.\r\n * If a level is disabled, log calls at that level are ignored.\r\n */\r\n enabled: Map<LogLevel, boolean>;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,mBACd,OACA,IACsB;CACtB,MAAM,WAAW,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/utils/dispatch-sequential.ts","../../src/utils/logger.ts"],"sourcesContent":["/**\r\n * Executes a function for each item in an iterable, sequentially.\r\n *\r\n * Uses a sync fast-path: iterates synchronously until the first Promise is\r\n * encountered, then switches to async for the remainder. If no item produces\r\n * a Promise, the entire call stays synchronous with zero async overhead.\r\n *\r\n * @param items - The iterable to iterate over.\r\n * @param fn - The function to call for each item. May return void or a Promise.\r\n * @returns void if all calls were synchronous, or a Promise if any were async.\r\n */\r\nexport function dispatchSequential<T>(\r\n items: Iterable<T>,\r\n fn: (item: T) => void | Promise<void>\r\n): void | Promise<void> {\r\n const iterator = items[Symbol.iterator]();\r\n\r\n for (let next = iterator.next(); !next.done; next = iterator.next()) {\r\n const result = fn(next.value);\r\n\r\n if (result instanceof Promise) {\r\n return continueAsync(iterator, fn, result);\r\n }\r\n }\r\n}\r\n\r\nasync function continueAsync<T>(\r\n iterator: Iterator<T>,\r\n fn: (item: T) => void | Promise<void>,\r\n pending: Promise<void>\r\n): Promise<void> {\r\n await pending;\r\n\r\n for (let next = iterator.next(); !next.done; next = iterator.next()) {\r\n const result = fn(next.value);\r\n\r\n if (result instanceof Promise) {\r\n await result;\r\n }\r\n }\r\n}\r\n","/**\r\n * Logger interface for debug and diagnostic output.\r\n * Supports multiple log levels for controlling verbosity.\r\n * Implementations can target different outputs (console, file, remote, etc.).\r\n */\r\nexport interface ILogger {\r\n /**\r\n * Logs a message with a specified severity level.\r\n * @param level - The severity level of the message.\r\n * @param message - The primary message content.\r\n * @param args - Additional arguments to include in the log output.\r\n */\r\n log(level: LogLevel, message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs detailed diagnostic information.\r\n * Typically the lowest level, most verbose output.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n trace(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs debug-level information.\r\n * Useful during development and troubleshooting.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n debug(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs warning-level messages.\r\n * Indicates potentially problematic conditions.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n warn(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs error-level messages.\r\n * Indicates error conditions that may require attention.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n error(message: any, ...args: any[]): void;\r\n}\r\n\r\n/**\r\n * Logging severity levels in increasing order.\r\n */\r\nexport enum LogLevel {\r\n /**\r\n * Most detailed, diagnostic-level logging.\r\n */\r\n trace,\r\n\r\n /**\r\n * Development and debugging information.\r\n */\r\n debug,\r\n\r\n /**\r\n * Warning-level conditions.\r\n */\r\n warn,\r\n\r\n /**\r\n * Error-level conditions.\r\n */\r\n error\r\n}\r\n\r\n/**\r\n * Configuration options for logger instances.\r\n */\r\nexport interface ILoggerOptions {\r\n /**\r\n * Enables/disables each log level.\r\n * If a level is disabled, log calls at that level are ignored.\r\n */\r\n enabled: Map<LogLevel, boolean>;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,mBACd,OACA,IACsB;CACtB,MAAM,WAAW,MAAM,OAAO,UAAU;CAExC,KAAK,IAAI,OAAO,SAAS,KAAK,GAAG,CAAC,KAAK,MAAM,OAAO,SAAS,KAAK,GAAG;EACnE,MAAM,SAAS,GAAG,KAAK,KAAK;EAE5B,IAAI,kBAAkB,SACpB,OAAO,cAAc,UAAU,IAAI,MAAM;CAE7C;AACF;AAEA,eAAe,cACb,UACA,IACA,SACe;CACf,MAAM;CAEN,KAAK,IAAI,OAAO,SAAS,KAAK,GAAG,CAAC,KAAK,MAAM,OAAO,SAAS,KAAK,GAAG;EACnE,MAAM,SAAS,GAAG,KAAK,KAAK;EAE5B,IAAI,kBAAkB,SACpB,MAAM;CAEV;AACF;;;;;;ACUA,IAAY,WAAL,yBAAA,UAAA;;;;CAIL,SAAA,SAAA,WAAA,KAAA;;;;CAKA,SAAA,SAAA,WAAA,KAAA;;;;CAKA,SAAA,SAAA,UAAA,KAAA;;;;CAKA,SAAA,SAAA,WAAA,KAAA;;AACF,EAAA,CAAA,CAAA"}
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
export { BooleanProps, IJsonSerializer, ILogger, ILoggerOptions, IPerformanceTimer, Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableObjectDeep, ImmutableSet, LogLevel, MiddlewareMetricsSummary, Mutable, MutableDeep, PerformanceMetricOptions, PerformanceTimeEntry, PerformanceTimerUid, RenderSnapshot, TickMetricEntry, TickSnapshot, dispatchSequential };
|
|
1
|
+
import { a as ImmutableMap, c as ImmutableSet, i as ImmutableArray, l as Mutable, n as DeepPartial, o as ImmutableObject, r as Immutable, s as ImmutableObjectDeep, t as BooleanProps, u as MutableDeep } from "../types-Bbmnq4ni.cjs";
|
|
2
|
+
import { C as TickSnapshot, G as LogLevel, O as IJsonSerializer, S as TickMetricEntry, U as ILogger, W as ILoggerOptions, _ as PerformanceMetricOptions, b as MiddlewareMetricsSummary, g as IPerformanceTimer, v as PerformanceTimeEntry, w as dispatchSequential, x as RenderSnapshot, y as PerformanceTimerUid } from "../index-B1OYkMOx.cjs";
|
|
3
|
+
export { BooleanProps, DeepPartial, IJsonSerializer, ILogger, ILoggerOptions, IPerformanceTimer, Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableObjectDeep, ImmutableSet, LogLevel, MiddlewareMetricsSummary, Mutable, MutableDeep, PerformanceMetricOptions, PerformanceTimeEntry, PerformanceTimerUid, RenderSnapshot, TickMetricEntry, TickSnapshot, dispatchSequential };
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
export { BooleanProps, IJsonSerializer, ILogger, ILoggerOptions, IPerformanceTimer, Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableObjectDeep, ImmutableSet, LogLevel, MiddlewareMetricsSummary, Mutable, MutableDeep, PerformanceMetricOptions, PerformanceTimeEntry, PerformanceTimerUid, RenderSnapshot, TickMetricEntry, TickSnapshot, dispatchSequential };
|
|
1
|
+
import { a as ImmutableMap, c as ImmutableSet, i as ImmutableArray, l as Mutable, n as DeepPartial, o as ImmutableObject, r as Immutable, s as ImmutableObjectDeep, t as BooleanProps, u as MutableDeep } from "../types-C1ojaDL4.mjs";
|
|
2
|
+
import { C as TickSnapshot, G as LogLevel, O as IJsonSerializer, S as TickMetricEntry, U as ILogger, W as ILoggerOptions, _ as PerformanceMetricOptions, b as MiddlewareMetricsSummary, g as IPerformanceTimer, v as PerformanceTimeEntry, w as dispatchSequential, x as RenderSnapshot, y as PerformanceTimerUid } from "../index-D3rS2RFG.mjs";
|
|
3
|
+
export { BooleanProps, DeepPartial, IJsonSerializer, ILogger, ILoggerOptions, IPerformanceTimer, Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableObjectDeep, ImmutableSet, LogLevel, MiddlewareMetricsSummary, Mutable, MutableDeep, PerformanceMetricOptions, PerformanceTimeEntry, PerformanceTimerUid, RenderSnapshot, TickMetricEntry, TickSnapshot, dispatchSequential };
|
package/dist/utils/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/utils/dispatch-sequential.ts","../../src/utils/logger.ts"],"sourcesContent":["/**\r\n * Executes a function for each item in an iterable, sequentially.\r\n *\r\n * Uses a sync fast-path: iterates synchronously until the first Promise is\r\n * encountered, then switches to async for the remainder. If no item produces\r\n * a Promise, the entire call stays synchronous with zero async overhead.\r\n *\r\n * @param items - The iterable to iterate over.\r\n * @param fn - The function to call for each item. May return void or a Promise.\r\n * @returns void if all calls were synchronous, or a Promise if any were async.\r\n */\r\nexport function dispatchSequential<T>(\r\n items: Iterable<T>,\r\n fn: (item: T) => void | Promise<void>\r\n): void | Promise<void> {\r\n const iterator = items[Symbol.iterator]();\r\n\r\n for (let next = iterator.next(); !next.done; next = iterator.next()) {\r\n const result = fn(next.value);\r\n\r\n if (result instanceof Promise) {\r\n return continueAsync(iterator, fn, result);\r\n }\r\n }\r\n}\r\n\r\nasync function continueAsync<T>(\r\n iterator: Iterator<T>,\r\n fn: (item: T) => void | Promise<void>,\r\n pending: Promise<void>\r\n): Promise<void> {\r\n await pending;\r\n\r\n for (let next = iterator.next(); !next.done; next = iterator.next()) {\r\n const result = fn(next.value);\r\n\r\n if (result instanceof Promise) {\r\n await result;\r\n }\r\n }\r\n}\r\n","/**\r\n * Logger interface for debug and diagnostic output.\r\n * Supports multiple log levels for controlling verbosity.\r\n * Implementations can target different outputs (console, file, remote, etc.).\r\n */\r\nexport interface ILogger {\r\n /**\r\n * Logs a message with a specified severity level.\r\n * @param level - The severity level of the message.\r\n * @param message - The primary message content.\r\n * @param args - Additional arguments to include in the log output.\r\n */\r\n log(level: LogLevel, message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs detailed diagnostic information.\r\n * Typically the lowest level, most verbose output.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n trace(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs debug-level information.\r\n * Useful during development and troubleshooting.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n debug(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs warning-level messages.\r\n * Indicates potentially problematic conditions.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n warn(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs error-level messages.\r\n * Indicates error conditions that may require attention.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n error(message: any, ...args: any[]): void;\r\n}\r\n\r\n/**\r\n * Logging severity levels in increasing order.\r\n */\r\nexport enum LogLevel {\r\n /**\r\n * Most detailed, diagnostic-level logging.\r\n */\r\n trace,\r\n\r\n /**\r\n * Development and debugging information.\r\n */\r\n debug,\r\n\r\n /**\r\n * Warning-level conditions.\r\n */\r\n warn,\r\n\r\n /**\r\n * Error-level conditions.\r\n */\r\n error\r\n}\r\n\r\n/**\r\n * Configuration options for logger instances.\r\n */\r\nexport interface ILoggerOptions {\r\n /**\r\n * Enables/disables each log level.\r\n * If a level is disabled, log calls at that level are ignored.\r\n */\r\n enabled: Map<LogLevel, boolean>;\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,mBACd,OACA,IACsB;CACtB,MAAM,WAAW,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/utils/dispatch-sequential.ts","../../src/utils/logger.ts"],"sourcesContent":["/**\r\n * Executes a function for each item in an iterable, sequentially.\r\n *\r\n * Uses a sync fast-path: iterates synchronously until the first Promise is\r\n * encountered, then switches to async for the remainder. If no item produces\r\n * a Promise, the entire call stays synchronous with zero async overhead.\r\n *\r\n * @param items - The iterable to iterate over.\r\n * @param fn - The function to call for each item. May return void or a Promise.\r\n * @returns void if all calls were synchronous, or a Promise if any were async.\r\n */\r\nexport function dispatchSequential<T>(\r\n items: Iterable<T>,\r\n fn: (item: T) => void | Promise<void>\r\n): void | Promise<void> {\r\n const iterator = items[Symbol.iterator]();\r\n\r\n for (let next = iterator.next(); !next.done; next = iterator.next()) {\r\n const result = fn(next.value);\r\n\r\n if (result instanceof Promise) {\r\n return continueAsync(iterator, fn, result);\r\n }\r\n }\r\n}\r\n\r\nasync function continueAsync<T>(\r\n iterator: Iterator<T>,\r\n fn: (item: T) => void | Promise<void>,\r\n pending: Promise<void>\r\n): Promise<void> {\r\n await pending;\r\n\r\n for (let next = iterator.next(); !next.done; next = iterator.next()) {\r\n const result = fn(next.value);\r\n\r\n if (result instanceof Promise) {\r\n await result;\r\n }\r\n }\r\n}\r\n","/**\r\n * Logger interface for debug and diagnostic output.\r\n * Supports multiple log levels for controlling verbosity.\r\n * Implementations can target different outputs (console, file, remote, etc.).\r\n */\r\nexport interface ILogger {\r\n /**\r\n * Logs a message with a specified severity level.\r\n * @param level - The severity level of the message.\r\n * @param message - The primary message content.\r\n * @param args - Additional arguments to include in the log output.\r\n */\r\n log(level: LogLevel, message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs detailed diagnostic information.\r\n * Typically the lowest level, most verbose output.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n trace(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs debug-level information.\r\n * Useful during development and troubleshooting.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n debug(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs warning-level messages.\r\n * Indicates potentially problematic conditions.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n warn(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs error-level messages.\r\n * Indicates error conditions that may require attention.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n error(message: any, ...args: any[]): void;\r\n}\r\n\r\n/**\r\n * Logging severity levels in increasing order.\r\n */\r\nexport enum LogLevel {\r\n /**\r\n * Most detailed, diagnostic-level logging.\r\n */\r\n trace,\r\n\r\n /**\r\n * Development and debugging information.\r\n */\r\n debug,\r\n\r\n /**\r\n * Warning-level conditions.\r\n */\r\n warn,\r\n\r\n /**\r\n * Error-level conditions.\r\n */\r\n error\r\n}\r\n\r\n/**\r\n * Configuration options for logger instances.\r\n */\r\nexport interface ILoggerOptions {\r\n /**\r\n * Enables/disables each log level.\r\n * If a level is disabled, log calls at that level are ignored.\r\n */\r\n enabled: Map<LogLevel, boolean>;\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,mBACd,OACA,IACsB;CACtB,MAAM,WAAW,MAAM,OAAO,UAAU;CAExC,KAAK,IAAI,OAAO,SAAS,KAAK,GAAG,CAAC,KAAK,MAAM,OAAO,SAAS,KAAK,GAAG;EACnE,MAAM,SAAS,GAAG,KAAK,KAAK;EAE5B,IAAI,kBAAkB,SACpB,OAAO,cAAc,UAAU,IAAI,MAAM;CAE7C;AACF;AAEA,eAAe,cACb,UACA,IACA,SACe;CACf,MAAM;CAEN,KAAK,IAAI,OAAO,SAAS,KAAK,GAAG,CAAC,KAAK,MAAM,OAAO,SAAS,KAAK,GAAG;EACnE,MAAM,SAAS,GAAG,KAAK,KAAK;EAE5B,IAAI,kBAAkB,SACpB,MAAM;CAEV;AACF;;;;;;ACUA,IAAY,WAAL,yBAAA,UAAA;;;;CAIL,SAAA,SAAA,WAAA,KAAA;;;;CAKA,SAAA,SAAA,WAAA,KAAA;;;;CAKA,SAAA,SAAA,UAAA,KAAA;;;;CAKA,SAAA,SAAA,WAAA,KAAA;;AACF,EAAA,CAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awesome-ecs/abstract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "A comprehensive Entity-Component-System (ECS) Architecture implementation. Abstract components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"url": "https://github.com/privatebytes/awesome-ecs/issues"
|
|
98
98
|
},
|
|
99
99
|
"homepage": "https://github.com/privatebytes/awesome-ecs#readme",
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "0a5ee91c2d3cc1854cf92ec953c31a55c88b8353"
|
|
101
101
|
}
|