@awesome-ecs/abstract 0.33.0 → 0.34.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 (36) hide show
  1. package/README.md +119 -124
  2. package/dist/components/index.cjs.map +1 -1
  3. package/dist/components/index.d.cts +2 -2
  4. package/dist/components/index.d.mts +2 -2
  5. package/dist/components/index.mjs.map +1 -1
  6. package/dist/entities/index.cjs +4 -0
  7. package/dist/entities/index.cjs.map +1 -1
  8. package/dist/entities/index.d.cts +3 -3
  9. package/dist/entities/index.d.mts +3 -3
  10. package/dist/entities/index.mjs +4 -1
  11. package/dist/entities/index.mjs.map +1 -1
  12. package/dist/factories/index.cjs.map +1 -1
  13. package/dist/factories/index.d.cts +1 -1
  14. package/dist/factories/index.d.mts +1 -1
  15. package/dist/factories/index.mjs.map +1 -1
  16. package/dist/{index-DXbpfhHa.d.mts → index-B3DqdxE6.d.mts} +2 -2
  17. package/dist/{index--9JJtMKF.d.mts → index-BanhgPCc.d.mts} +34 -22
  18. package/dist/{index-CPGVaS-_.d.cts → index-BivyWazf.d.cts} +183 -172
  19. package/dist/{index-0hg5PXZe.d.cts → index-CSaKdQe-.d.cts} +34 -22
  20. package/dist/{index-BOS-47DQ.d.mts → index-DGyDijY7.d.mts} +183 -172
  21. package/dist/{index-HeCQLTSE.d.cts → index-DMZSrHoB.d.cts} +134 -101
  22. package/dist/{index-Tznk33g6.d.mts → index-Dbwzlrgp.d.mts} +134 -101
  23. package/dist/{index-Bl7Cf9gi.d.cts → index-aVjnG975.d.cts} +2 -2
  24. package/dist/pipelines/index.d.cts +1 -1
  25. package/dist/pipelines/index.d.mts +1 -1
  26. package/dist/systems/index.cjs.map +1 -1
  27. package/dist/systems/index.d.cts +11 -5
  28. package/dist/systems/index.d.mts +11 -5
  29. package/dist/systems/index.mjs.map +1 -1
  30. package/dist/{types-COxeVghs.d.cts → types-BaCGIrym.d.cts} +1 -1
  31. package/dist/{types-UnqKSA14.d.mts → types-BaCGIrym.d.mts} +1 -1
  32. package/dist/utils/index.cjs.map +1 -1
  33. package/dist/utils/index.d.cts +2 -2
  34. package/dist/utils/index.d.mts +2 -2
  35. package/dist/utils/index.mjs.map +1 -1
  36. package/package.json +2 -2
@@ -1,8 +1,46 @@
1
- import { a as IEntity, c as IEntityProxy, i as EntityUid, o as IEntityModel, p as ComponentTypeUid, r as EntityTypeUid, s as EntityProxy, v as ConfigRecord } from "./index-HeCQLTSE.cjs";
2
- import { r as Immutable } from "./types-COxeVghs.cjs";
3
- import { b as IEntityConfigSnapshot, h as IEntityEvent, l as IEntitySnapshot, m as EntityEventUid, p as EntityEventSubscriptionOptions, s as IEntityUpdate, v as IEventData } from "./index-0hg5PXZe.cjs";
4
- import { c as IMiddleware, l as IPipelineContext, o as IPipeline, u as PipelineDispatch } from "./index-Bl7Cf9gi.cjs";
1
+ import { T as ConfigRecord, a as IEntityProxy, b as ComponentTypeUid, f as IEntity, h as IEntitySpec, i as EntityProxyManyLookup, n as EntityProxy, p as IEntityModel, r as EntityProxyLookup, u as EntityTypeUid } from "./index-DMZSrHoB.cjs";
2
+ import { r as Immutable } from "./types-BaCGIrym.cjs";
3
+ import { b as IEntityConfigSnapshot, c as IEntityUpdate, g as IEntityEvent, h as EntityEventUid, m as EntityEventSubscriptionOptions, u as IEntitySnapshot, y as IEventData } from "./index-CSaKdQe-.cjs";
4
+ import { c as IMiddleware, l as IPipelineContext, o as IPipeline, u as PipelineDispatch } from "./index-aVjnG975.cjs";
5
5
 
6
+ //#region src/utils/dispatch-sequential.d.ts
7
+ /**
8
+ * Executes a function for each item in an iterable, sequentially.
9
+ *
10
+ * Uses a sync fast-path: iterates synchronously until the first Promise is
11
+ * encountered, then switches to async for the remainder. If no item produces
12
+ * a Promise, the entire call stays synchronous with zero async overhead.
13
+ *
14
+ * @param items - The iterable to iterate over.
15
+ * @param fn - The function to call for each item. May return void or a Promise.
16
+ * @returns void if all calls were synchronous, or a Promise if any were async.
17
+ */
18
+ declare function dispatchSequential<T>(items: Iterable<T>, fn: (item: T) => void | Promise<void>): void | Promise<void>;
19
+ //#endregion
20
+ //#region src/utils/json-serializer.d.ts
21
+ /**
22
+ * Custom JSON serialization and deserialization interface.
23
+ * Allows different serialization strategies for handling complex types.
24
+ * Used for entity snapshots, events, and any data needing JSON conversion.
25
+ */
26
+ interface IJsonSerializer {
27
+ /**
28
+ * Converts an object to a serializable JSON representation.
29
+ * Handles types that don't serialize naturally (dates, maps, custom objects, etc.).
30
+ * @param value - The object to serialize.
31
+ * @returns A JSON-serializable representation.
32
+ */
33
+ serializeCustom(value: object): string;
34
+ /**
35
+ * Converts a JSON string back to its original object type.
36
+ * Reconstructs complex types from their serialized form.
37
+ * @template TObject - The target object type.
38
+ * @param text - The JSON string to deserialize.
39
+ * @returns The deserialized object of the specified type.
40
+ */
41
+ parseCustom<TObject>(text: string): TObject;
42
+ }
43
+ //#endregion
6
44
  //#region src/utils/logger.d.ts
7
45
  /**
8
46
  * Logger interface for debug and diagnostic output.
@@ -78,6 +116,103 @@ interface ILoggerOptions {
78
116
  enabled: Map<LogLevel, boolean>;
79
117
  }
80
118
  //#endregion
119
+ //#region src/utils/performance.d.ts
120
+ type TickMetricEntry = {
121
+ name: string;
122
+ category: string;
123
+ totalMs: number;
124
+ count: number;
125
+ };
126
+ type TickSnapshot = {
127
+ tickIndex: number;
128
+ tickDurationMs: number;
129
+ fps: number;
130
+ queueSize: number;
131
+ timestamp: number;
132
+ metrics: TickMetricEntry[];
133
+ render?: RenderSnapshot;
134
+ };
135
+ type RenderSnapshot = {
136
+ frameTimeMs: number;
137
+ renderTimeMs: number;
138
+ gpuFrameTimeMs: number;
139
+ drawCalls: number;
140
+ activeMeshesEvalMs: number;
141
+ cameraRenderMs: number;
142
+ totalVertices: number;
143
+ activeIndices: number;
144
+ };
145
+ type MiddlewareMetricsSummary = {
146
+ name: string;
147
+ category: PipelineCategoryName;
148
+ count: number;
149
+ totalMs: number;
150
+ avgMs: number;
151
+ minMs: number;
152
+ maxMs: number;
153
+ lastMs: number;
154
+ };
155
+ //#endregion
156
+ //#region src/utils/performance-timer.d.ts
157
+ /**
158
+ * Unique identifier for a timer instance.
159
+ */
160
+ type PerformanceTimerUid = number;
161
+ /**
162
+ * Options for identifying and categorizing performance metrics.
163
+ * Used by pipeline factories and performance decorators.
164
+ */
165
+ type PerformanceMetricOptions = {
166
+ name?: string;
167
+ category?: string;
168
+ };
169
+ /**
170
+ * Record of a completed timer measurement.
171
+ * Captures timing information for performance analysis and profiling.
172
+ */
173
+ interface PerformanceTimeEntry {
174
+ /**
175
+ * The name identifying this timer.
176
+ */
177
+ name: string;
178
+ /**
179
+ * The category of this metric (e.g. 'module', 'runtime', 'system').
180
+ */
181
+ category?: string;
182
+ /**
183
+ * Timestamp in milliseconds when the timer started.
184
+ */
185
+ startedAt: number;
186
+ /**
187
+ * Timestamp in milliseconds when the timer ended.
188
+ */
189
+ endedAt?: number;
190
+ /**
191
+ * Duration in milliseconds that elapsed.
192
+ */
193
+ msPassed?: number;
194
+ }
195
+ /**
196
+ * Interface for measuring operation duration.
197
+ * Provides start/stop functionality for performance profiling.
198
+ * Used throughout the system to collect timing metrics.
199
+ */
200
+ interface IPerformanceTimer {
201
+ /**
202
+ * Starts a new timer.
203
+ * @param name - Label for this timer (used in results).
204
+ * @param category - Optional category for grouping metrics.
205
+ * @returns A unique identifier for this timer instance.
206
+ */
207
+ startTimer(name: string, category?: string): PerformanceTimerUid;
208
+ /**
209
+ * Stops a timer and returns the recorded metrics.
210
+ * @param timerUid - The timer identifier returned by startTimer.
211
+ * @returns Complete timing entry with start, end, and duration.
212
+ */
213
+ endTimer(timerUid: PerformanceTimerUid): PerformanceTimeEntry;
214
+ }
215
+ //#endregion
81
216
  //#region src/systems/pipeline/system-context-config.d.ts
82
217
  /**
83
218
  * Config-specific API for the current system execution.
@@ -286,30 +421,18 @@ interface ISystemContextProxies {
286
421
  * @param proxy - The entity reference to remove.
287
422
  */
288
423
  remove(proxy: IEntityProxy): void;
289
- /**
290
- * Removes all entity references from the current entity.
291
- * Optionally filter by target entity type.
292
- * @param targetType - If provided, only removes references to entities of this type.
293
- */
294
- removeAll(targetType?: EntityTypeUid): void;
295
424
  /**
296
425
  * Retrieves a single reference of a specific entity type from the current entity.
297
426
  * @param targetType - The entity type to find.
298
427
  * @returns The first matching proxy, or null if not found.
299
428
  */
300
- get(targetType: EntityTypeUid): IEntityProxy | null;
429
+ getProxy<TEntity extends IEntity = IEntity>(targetType: EntityProxyLookup<TEntity>): EntityProxy<TEntity> | null;
301
430
  /**
302
431
  * Retrieves all references to entities of a specific type from the current entity.
303
432
  * @param targetType - The entity type to find.
304
433
  * @returns Array of matching proxies.
305
434
  */
306
- getMany(targetType: EntityTypeUid): Readonly<IEntityProxy[]>;
307
- /**
308
- * Retrieves all entity references from the current entity.
309
- * Organized by target entity type.
310
- * @returns Map of entity type to their proxies.
311
- */
312
- getAll(): ReadonlyMap<EntityTypeUid, Readonly<IEntityProxy[]>>;
435
+ getProxies<TEntity extends IEntity = IEntity>(targetType: EntityProxyManyLookup<TEntity>): Readonly<EntityProxy<TEntity>[]>;
313
436
  }
314
437
  //#endregion
315
438
  //#region src/systems/pipeline/system-context-repository.d.ts
@@ -333,7 +456,28 @@ interface ISystemContextRepository {
333
456
  * @param proxy - Reference to the entity.
334
457
  * @returns The immutable entity instance.
335
458
  */
336
- getEntity<TEntity extends IEntity>(proxy: EntityProxy<TEntity> | EntityTypeUid): Immutable<TEntity>;
459
+ getEntity<TEntity extends IEntity>(proxy: EntityProxy<TEntity> | null | undefined): TEntity | undefined;
460
+ /**
461
+ * Retrieves an entity from storage based on its type.
462
+ * @template TEntity - The expected entity type.
463
+ * @param targetType - Reference to the entity type.
464
+ * @returns The immutable entity instance.
465
+ */
466
+ getEntity<TEntity extends IEntity>(targetType: EntityProxyLookup<TEntity> | null | undefined): TEntity | undefined;
467
+ /**
468
+ * Retrieves an entity from storage based on its type or proxy.
469
+ * @template TEntity - The expected entity type.
470
+ * @param proxyOrTargetType - Reference to the entity proxy or type.
471
+ * @returns The immutable entity instance.
472
+ */
473
+ getEntity<TEntity extends IEntity>(proxy: EntityProxy<TEntity> | EntityProxyLookup<TEntity> | null | undefined): TEntity | undefined;
474
+ /**
475
+ * Retrieves all entities from the current entity's proxy relationships.
476
+ * @template TEntity - The expected entity type.
477
+ * @param targetType - Reference to the entity type.
478
+ * @returns The immutable entity instances.
479
+ */
480
+ getEntities<TEntity extends IEntity>(targetType: EntityProxyManyLookup<TEntity> | null | undefined): Readonly<TEntity[]>;
337
481
  /**
338
482
  * Enqueues an entity for update.
339
483
  * Triggers the update pipeline for the entity.
@@ -377,30 +521,6 @@ interface ISystemContextScheduler {
377
521
  hasSchedule(target?: IEntityProxy): boolean;
378
522
  }
379
523
  //#endregion
380
- //#region src/utils/json-serializer.d.ts
381
- /**
382
- * Custom JSON serialization and deserialization interface.
383
- * Allows different serialization strategies for handling complex types.
384
- * Used for entity snapshots, events, and any data needing JSON conversion.
385
- */
386
- interface IJsonSerializer {
387
- /**
388
- * Converts an object to a serializable JSON representation.
389
- * Handles types that don't serialize naturally (dates, maps, custom objects, etc.).
390
- * @param value - The object to serialize.
391
- * @returns A JSON-serializable representation.
392
- */
393
- serializeCustom(value: object): string;
394
- /**
395
- * Converts a JSON string back to its original object type.
396
- * Reconstructs complex types from their serialized form.
397
- * @template TObject - The target object type.
398
- * @param text - The JSON string to deserialize.
399
- * @returns The deserialized object of the specified type.
400
- */
401
- parseCustom<TObject>(text: string): TObject;
402
- }
403
- //#endregion
404
524
  //#region src/systems/pipeline/system-context-snapshot.d.ts
405
525
  /**
406
526
  * System context API for entity serialization and state transfer.
@@ -452,7 +572,7 @@ interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
452
572
  /**
453
573
  * The entity currently being processed by this middleware.
454
574
  */
455
- readonly entity: TEntity;
575
+ readonly entity: Immutable<TEntity>;
456
576
  /**
457
577
  * Config metadata and config-update API for the current update.
458
578
  */
@@ -513,9 +633,7 @@ interface IMutableSystemContext<TEntity extends IEntity> extends ISystemContext<
513
633
  //#endregion
514
634
  //#region src/factories/context-factory.d.ts
515
635
  interface IContextFactory {
516
- getOrCreateContext<TEntity extends IEntity>(entity: TEntity, registry?: MiddlewareRegistryReadonly): IMutableSystemContext<TEntity>;
517
- getContext<TEntity extends IEntity>(entityUid: EntityUid): IMutableSystemContext<TEntity> | undefined;
518
- disposeEntity(entityUid: EntityUid): void;
636
+ createContext<TEntity extends IEntity>(entity: Immutable<TEntity>, registry?: MiddlewareRegistryReadonly): IMutableSystemContext<TEntity>;
519
637
  }
520
638
  //#endregion
521
639
  //#region src/factories/pipeline-factory.d.ts
@@ -559,117 +677,6 @@ interface IPipelineFactory {
559
677
  createPipeline<TContext extends IPipelineContext>(options?: PipelineOptions): IPipeline<TContext>;
560
678
  }
561
679
  //#endregion
562
- //#region src/utils/dispatch-sequential.d.ts
563
- /**
564
- * Executes a function for each item in an iterable, sequentially.
565
- *
566
- * Uses a sync fast-path: iterates synchronously until the first Promise is
567
- * encountered, then switches to async for the remainder. If no item produces
568
- * a Promise, the entire call stays synchronous with zero async overhead.
569
- *
570
- * @param items - The iterable to iterate over.
571
- * @param fn - The function to call for each item. May return void or a Promise.
572
- * @returns void if all calls were synchronous, or a Promise if any were async.
573
- */
574
- declare function dispatchSequential<T>(items: Iterable<T>, fn: (item: T) => void | Promise<void>): void | Promise<void>;
575
- //#endregion
576
- //#region src/utils/performance.d.ts
577
- type TickMetricEntry = {
578
- name: string;
579
- category: string;
580
- totalMs: number;
581
- count: number;
582
- };
583
- type TickSnapshot = {
584
- tickIndex: number;
585
- tickDurationMs: number;
586
- fps: number;
587
- queueSize: number;
588
- timestamp: number;
589
- metrics: TickMetricEntry[];
590
- render?: RenderSnapshot;
591
- };
592
- type RenderSnapshot = {
593
- frameTimeMs: number;
594
- renderTimeMs: number;
595
- gpuFrameTimeMs: number;
596
- drawCalls: number;
597
- activeMeshesEvalMs: number;
598
- cameraRenderMs: number;
599
- totalVertices: number;
600
- activeIndices: number;
601
- };
602
- type MiddlewareMetricsSummary = {
603
- name: string;
604
- category: PipelineCategoryName;
605
- count: number;
606
- totalMs: number;
607
- avgMs: number;
608
- minMs: number;
609
- maxMs: number;
610
- lastMs: number;
611
- };
612
- //#endregion
613
- //#region src/utils/performance-timer.d.ts
614
- /**
615
- * Unique identifier for a timer instance.
616
- */
617
- type PerformanceTimerUid = number;
618
- /**
619
- * Options for identifying and categorizing performance metrics.
620
- * Used by pipeline factories and performance decorators.
621
- */
622
- type PerformanceMetricOptions = {
623
- name?: string;
624
- category?: string;
625
- };
626
- /**
627
- * Record of a completed timer measurement.
628
- * Captures timing information for performance analysis and profiling.
629
- */
630
- interface PerformanceTimeEntry {
631
- /**
632
- * The name identifying this timer.
633
- */
634
- name: string;
635
- /**
636
- * The category of this metric (e.g. 'module', 'runtime', 'system').
637
- */
638
- category?: string;
639
- /**
640
- * Timestamp in milliseconds when the timer started.
641
- */
642
- startedAt: number;
643
- /**
644
- * Timestamp in milliseconds when the timer ended.
645
- */
646
- endedAt?: number;
647
- /**
648
- * Duration in milliseconds that elapsed.
649
- */
650
- msPassed?: number;
651
- }
652
- /**
653
- * Interface for measuring operation duration.
654
- * Provides start/stop functionality for performance profiling.
655
- * Used throughout the system to collect timing metrics.
656
- */
657
- interface IPerformanceTimer {
658
- /**
659
- * Starts a new timer.
660
- * @param name - Label for this timer (used in results).
661
- * @param category - Optional category for grouping metrics.
662
- * @returns A unique identifier for this timer instance.
663
- */
664
- startTimer(name: string, category?: string): PerformanceTimerUid;
665
- /**
666
- * Stops a timer and returns the recorded metrics.
667
- * @param timerUid - The timer identifier returned by startTimer.
668
- * @returns Complete timing entry with start, end, and duration.
669
- */
670
- endTimer(timerUid: PerformanceTimerUid): PerformanceTimeEntry;
671
- }
672
- //#endregion
673
680
  //#region src/systems/system-type.d.ts
674
681
  /**
675
682
  * The five phases of entity system execution in each frame.
@@ -721,13 +728,6 @@ interface ISystemsModule<TEntity extends IEntity> {
721
728
  * The builder instance used to construct this module.
722
729
  */
723
730
  readonly builder: ISystemsModuleBuilderReadonly<TEntity>;
724
- /**
725
- * Optional factory function to initialize new entity instances.
726
- * If provided, is called when a new entity of this type is created.
727
- * @param model - The initialization model.
728
- * @returns The initialized entity.
729
- */
730
- readonly initEntity?: (model: IEntityModel) => TEntity;
731
731
  }
732
732
  //#endregion
733
733
  //#region src/systems/module/systems-module-builder.d.ts
@@ -753,9 +753,10 @@ interface ISystemsModuleBuilderReadonly<TEntity extends IEntity> {
753
753
  */
754
754
  readonly scopeRoot: boolean;
755
755
  /**
756
- * Whether this entity type is a scoped proxy. When initialized, the entity registers itself in the inherited scope, making it resolvable via `context.proxies.get()` by any entity in the same scope.
756
+ * Whether this entity type is a scoped proxy. When initialized, the entity registers itself in the inherited scope, making it resolvable via `context.proxies.getProxy()` by any entity in the same scope.
757
757
  */
758
758
  readonly scopedProxy: boolean;
759
+ readonly entitySpec?: IEntitySpec<TEntity>;
759
760
  }
760
761
  /**
761
762
  * Builder pattern interface for constructing system modules.
@@ -781,13 +782,23 @@ interface ISystemsModuleBuilder<TEntity extends IEntity> extends ISystemsModuleB
781
782
  addEventSystems(uid: EntityEventUid, systems: Immutable<ISystemEventMiddleware<TEntity>[]>): this;
782
783
  /**
783
784
  * Integrates an entire module's pipelines into this builder.
784
- * Allows composition of multiple modules into one.
785
- * @template TModuleEntity - The module's entity type (must extend current type).
785
+ *
786
+ * Composition is gated by structural assignability: the host's `TEntity` must extend
787
+ * the inner module's `TInner`. In other words, the host entity contract must contain
788
+ * every field the inner module reads from `context.entity`.
789
+ *
790
+ * @template TInner - The inner module's entity type; must be assignable from `TEntity`.
786
791
  * @param module - The module to integrate.
787
792
  * @param systemType - Optional specific pipeline to integrate from module. If omitted, integrates all.
788
793
  * @returns This builder for method chaining.
789
794
  */
790
- addModule<TModuleEntity extends TEntity>(module: ISystemsModule<TModuleEntity>, systemType?: SystemType): this;
795
+ addModule<TInner extends IEntity>(module: TEntity extends TInner ? ISystemsModule<TInner> : never, systemType?: SystemType): this;
796
+ /**
797
+ * Declares this module's entity creation spec. `type` carries the entity type UID;
798
+ * `init` constructs and returns the entity at first creation. The dispatcher validates
799
+ * at runtime that the returned entity's `identity.entityType` matches `type`.
800
+ */
801
+ setEntity(spec: IEntitySpec<TEntity>): this;
791
802
  /**
792
803
  * Marks this entity type as a scope root.
793
804
  * When initialized, a new scope is auto-generated and all child entities inherit it.
@@ -797,7 +808,7 @@ interface ISystemsModuleBuilder<TEntity extends IEntity> extends ISystemsModuleB
797
808
  /**
798
809
  * Marks this entity type as a scoped proxy.
799
810
  * When initialized, the entity registers itself in the inherited scope,
800
- * making it resolvable via `context.proxies.get()` by any entity in the same scope.
811
+ * making it resolvable via `context.proxies.getProxy()` by any entity in the same scope.
801
812
  * @returns This builder for method chaining.
802
813
  */
803
814
  setScopedProxy(): this;
@@ -819,5 +830,5 @@ interface ISystemsFactory {
819
830
  createSystemsModuleBuilder<TEntity extends IEntity>(name: string): ISystemsModuleBuilder<TEntity>;
820
831
  }
821
832
  //#endregion
822
- export { ISystemContextControlState as A, ISystemContextConfigReadonly as B, IJsonSerializer as C, IMutableSystemContextEvents as D, ISystemContextProxies as E, MiddlewareRegistry as F, ILoggerOptions as H, MiddlewareRegistryReadonly as I, SystemMiddlewareName as L, SystemContextControlTarget as M, ISystemEventMiddleware as N, ISystemContextEvents as O, ISystemMiddleware as P, SystemModuleName as R, ISystemContextSnapshot as S, ISystemContextRepository as T, LogLevel as U, ILogger as V, PipelineCategoryName as _, SystemType as a, IMutableSystemContext as b, PerformanceTimeEntry as c, RenderSnapshot as d, TickMetricEntry as f, PipelineCategory as g, IPipelineFactory as h, ISystemsModule as i, SystemContextControlState as j, ISystemContextControl as k, PerformanceTimerUid as l, dispatchSequential as m, ISystemsModuleBuilder as n, IPerformanceTimer as o, TickSnapshot as p, ISystemsModuleBuilderReadonly as r, PerformanceMetricOptions as s, ISystemsFactory as t, MiddlewareMetricsSummary as u, PipelineOptions as v, ISystemContextScheduler as w, ISystemContext as x, IContextFactory as y, ISystemContextConfig as z };
823
- //# sourceMappingURL=index-CPGVaS-_.d.cts.map
833
+ export { ISystemContextConfigReadonly as A, ILoggerOptions as B, ISystemEventMiddleware as C, SystemMiddlewareName as D, MiddlewareRegistryReadonly as E, MiddlewareMetricsSummary as F, IJsonSerializer as H, RenderSnapshot as I, TickMetricEntry as L, PerformanceMetricOptions as M, PerformanceTimeEntry as N, SystemModuleName as O, PerformanceTimerUid as P, TickSnapshot as R, SystemContextControlTarget as S, MiddlewareRegistry as T, dispatchSequential as U, LogLevel as V, IMutableSystemContextEvents as _, SystemType as a, ISystemContextControlState as b, PipelineCategoryName as c, IMutableSystemContext as d, ISystemContext as f, ISystemContextProxies as g, ISystemContextRepository as h, ISystemsModule as i, IPerformanceTimer as j, ISystemContextConfig as k, PipelineOptions as l, ISystemContextScheduler as m, ISystemsModuleBuilder as n, IPipelineFactory as o, ISystemContextSnapshot as p, ISystemsModuleBuilderReadonly as r, PipelineCategory as s, ISystemsFactory as t, IContextFactory as u, ISystemContextEvents as v, ISystemMiddleware as w, SystemContextControlState as x, ISystemContextControl as y, ILogger as z };
834
+ //# sourceMappingURL=index-BivyWazf.d.cts.map
@@ -1,6 +1,15 @@
1
- import { a as IEntity, c as IEntityProxy, i as EntityUid, m as IComponent, n as IdentityComponent, o as IEntityModel, p as ComponentTypeUid, r as EntityTypeUid, v as ConfigRecord } from "./index-HeCQLTSE.cjs";
2
- import { n as DeepPartial } from "./types-COxeVghs.cjs";
1
+ import { T as ConfigRecord, a as IEntityProxy, b as ComponentTypeUid, f as IEntity, p as IEntityModel, u as EntityTypeUid, x as IComponent, y as IdentityComponent } from "./index-DMZSrHoB.cjs";
2
+ import { n as DeepPartial } from "./types-BaCGIrym.cjs";
3
3
 
4
+ //#region src/entities/context-repository.d.ts
5
+ declare const SYSTEM_CONTEXT_KEY: unique symbol;
6
+ interface IContextRepository {
7
+ get<TContext>(proxy: IEntityProxy, key: string | symbol): TContext | undefined;
8
+ set<TContext>(proxy: IEntityProxy, key: string | symbol, context: TContext): TContext;
9
+ delete(proxy: IEntityProxy, key: string | symbol): boolean;
10
+ deleteAll(proxy: IEntityProxy): boolean;
11
+ }
12
+ //#endregion
4
13
  //#region src/entities/entity-config.d.ts
5
14
  /**
6
15
  * Config-only entity state update.
@@ -14,18 +23,6 @@ interface IEntityConfigSnapshot<TConfig extends ConfigRecord = ConfigRecord> {
14
23
  readonly components: Record<ComponentTypeUid, DeepPartial<TConfig>>;
15
24
  }
16
25
  //#endregion
17
- //#region src/entities/entity-context-cache.d.ts
18
- /**
19
- * Flat per-entity key-value storage for runtime-owned cached context objects.
20
- */
21
- interface IEntityContextCache {
22
- get<T>(entityUid: EntityUid, key: string | symbol): T | undefined;
23
- set(entityUid: EntityUid, key: string | symbol, value: unknown): void;
24
- has(entityUid: EntityUid, key?: string | symbol): boolean;
25
- getEntries(entityUid: EntityUid): IterableIterator<[string | symbol, unknown]> | undefined;
26
- disposeEntity(entityUid: EntityUid): void;
27
- }
28
- //#endregion
29
26
  //#region src/entities/entity-events.d.ts
30
27
  /**
31
28
  * Represents a unique identifier for an entity event.
@@ -193,14 +190,14 @@ interface IEntityRepository {
193
190
  * @param proxy - Reference to the entity to retrieve.
194
191
  * @returns The requested entity.
195
192
  */
196
- get<TEntity extends IEntity>(proxy: IEntityProxy): TEntity;
193
+ getEntity<TEntity extends IEntity>(proxy: IEntityProxy): TEntity | undefined;
197
194
  /**
198
195
  * Retrieves all entities of a specific type.
199
196
  * @template TEntity - The entity type to retrieve.
200
197
  * @param entityType - The type identifier to filter by.
201
198
  * @returns Array of all entities matching the type.
202
199
  */
203
- getAll<TEntity extends IEntity>(entityType: EntityTypeUid): TEntity[];
200
+ getEntities<TEntity extends IEntity>(entityType: EntityTypeUid): TEntity[];
204
201
  /**
205
202
  * Iterates over all entities regardless of type.
206
203
  * @returns An iterator over all stored entities.
@@ -210,7 +207,7 @@ interface IEntityRepository {
210
207
  * Stores or updates an entity.
211
208
  * @param entity - The entity to store.
212
209
  */
213
- set(entity: IEntity): void;
210
+ set<TEntity extends IEntity>(entity: TEntity): TEntity;
214
211
  /**
215
212
  * Removes an entity from storage.
216
213
  * @param proxy - Reference to the entity to remove.
@@ -307,17 +304,32 @@ declare enum SchedulerPauseType {
307
304
  intervals = "intervals"
308
305
  }
309
306
  interface IEntityRuntimeScheduler {
310
- readonly dirtyCount: number;
311
- readonly rawDirtyCount: number;
312
- readonly pendingCount: number;
313
307
  enqueue(update: IEntityUpdate): void;
314
308
  enqueueEvent(entity: IEntityProxy, event: IEntityEvent<IEventData>): void;
315
309
  enqueueEvents(entity: IEntityProxy, events: ReadonlyArray<IEntityEvent<IEventData>>): void;
310
+ clearDirtyUpdates(): void;
316
311
  schedule(proxy: IEntityProxy, intervalMs?: number): void;
317
312
  removeSchedule(proxy: IEntityProxy): void;
318
313
  hasSchedule(proxy: IEntityProxy): boolean;
314
+ clearSchedules(): void;
319
315
  takePendingGroups(maxItems?: number, options?: EntityRuntimePendingGroupOptions): ReadonlyArray<IEntityDispatchGroup>;
316
+ skipEntityType(entityType: EntityTypeUid): void;
317
+ unskipEntityType(entityType: EntityTypeUid): void;
318
+ pause(type?: SchedulerPauseType): void;
319
+ resume(): void;
320
+ }
321
+ interface IEntityRuntimeSchedulerInspector extends IEntityRuntimeScheduler {
322
+ readonly dirtyCount: number;
323
+ readonly frameSubscriptions: ReadonlySet<IEntityProxy>;
324
+ readonly isPaused: boolean;
325
+ readonly pauseType: SchedulerPauseType | null;
326
+ readonly pendingGroupCount: number;
327
+ readonly pendingCount: number;
328
+ readonly rawDirtyCount: number;
329
+ readonly schedules: ReadonlyArray<EntitySchedule>;
330
+ readonly skippedEntityTypes: ReadonlySet<EntityTypeUid>;
331
+ inspectDirtyUpdates(): ReadonlyArray<IEntityUpdate>;
320
332
  }
321
333
  //#endregion
322
- export { IEntityEventsManager as _, IEntityDispatchGroup as a, IEntityConfigSnapshot as b, SchedulerPauseType as c, IEntityRepository as d, EntityEventSubscriptionFilter as f, IEntityEventsDispatcher as g, IEntityEvent as h, EntityUpdateType as i, IEntitySnapshot as l, EntityEventUid as m, EntityRuntimePendingGroupOptions as n, IEntityRuntimeScheduler as o, EntityEventSubscriptionOptions as p, EntitySchedule as r, IEntityUpdate as s, EntityPriorityModel as t, IEntitySnapshotProvider as u, IEventData as v, IEntityContextCache as y };
323
- //# sourceMappingURL=index-0hg5PXZe.d.cts.map
334
+ export { SYSTEM_CONTEXT_KEY as S, IEntityEventsDispatcher as _, IEntityDispatchGroup as a, IEntityConfigSnapshot as b, IEntityUpdate as c, IEntitySnapshotProvider as d, IEntityRepository as f, IEntityEvent as g, EntityEventUid as h, EntityUpdateType as i, SchedulerPauseType as l, EntityEventSubscriptionOptions as m, EntityRuntimePendingGroupOptions as n, IEntityRuntimeScheduler as o, EntityEventSubscriptionFilter as p, EntitySchedule as r, IEntityRuntimeSchedulerInspector as s, EntityPriorityModel as t, IEntitySnapshot as u, IEntityEventsManager as v, IContextRepository as x, IEventData as y };
335
+ //# sourceMappingURL=index-CSaKdQe-.d.cts.map