@awesome-ecs/abstract 0.22.0 → 0.23.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 (74) hide show
  1. package/README.md +126 -228
  2. package/dist/components/index.cjs +3 -3
  3. package/dist/components/index.cjs.map +1 -1
  4. package/dist/components/index.d.cts +1 -2
  5. package/dist/components/index.d.mts +2 -0
  6. package/dist/components/{index.js → index.mjs} +4 -4
  7. package/dist/components/index.mjs.map +1 -0
  8. package/dist/entities/index.cjs +12 -5
  9. package/dist/entities/index.cjs.map +1 -1
  10. package/dist/entities/index.d.cts +3 -4
  11. package/dist/entities/index.d.mts +3 -0
  12. package/dist/entities/index.mjs +20 -0
  13. package/dist/entities/index.mjs.map +1 -0
  14. package/dist/factories/index.d.cts +47 -35
  15. package/dist/factories/index.d.mts +69 -0
  16. package/dist/factories/index.mjs +1 -0
  17. package/dist/identity-component-5neFUd2Q.d.cts +241 -0
  18. package/dist/identity-component-BCmEilvk.d.mts +241 -0
  19. package/dist/index-6OSsa_UD.d.cts +309 -0
  20. package/dist/index-BUadwkVZ.d.cts +224 -0
  21. package/dist/index-BWmhFdFg.d.mts +148 -0
  22. package/dist/index-BtPTY71-.d.cts +485 -0
  23. package/dist/index-CQpE-5sx.d.mts +309 -0
  24. package/dist/index-CW6-OhB4.d.mts +485 -0
  25. package/dist/index-DcirKLCP.d.mts +224 -0
  26. package/dist/index-eECJUE_O.d.cts +148 -0
  27. package/dist/pipelines/index.cjs +0 -31
  28. package/dist/pipelines/index.d.cts +2 -4
  29. package/dist/pipelines/index.d.mts +2 -0
  30. package/dist/pipelines/index.mjs +1 -0
  31. package/dist/systems/index.cjs +18 -18
  32. package/dist/systems/index.cjs.map +1 -1
  33. package/dist/systems/index.d.cts +2 -7
  34. package/dist/systems/index.d.mts +2 -0
  35. package/dist/systems/index.mjs +33 -0
  36. package/dist/systems/index.mjs.map +1 -0
  37. package/dist/types-CnDtpKsY.d.mts +70 -0
  38. package/dist/types-DLOd2zXO.d.cts +70 -0
  39. package/dist/utils/index.cjs +11 -11
  40. package/dist/utils/index.cjs.map +1 -1
  41. package/dist/utils/index.d.cts +2 -2
  42. package/dist/utils/index.d.mts +3 -0
  43. package/dist/utils/index.mjs +27 -0
  44. package/dist/utils/index.mjs.map +1 -0
  45. package/package.json +14 -14
  46. package/dist/components/index.d.ts +0 -3
  47. package/dist/components/index.js.map +0 -1
  48. package/dist/entities/index.d.ts +0 -4
  49. package/dist/entities/index.js +0 -13
  50. package/dist/entities/index.js.map +0 -1
  51. package/dist/factories/index.d.ts +0 -57
  52. package/dist/factories/index.js +0 -0
  53. package/dist/identity-component-BDWEtAXA.d.cts +0 -238
  54. package/dist/identity-component-CR1ULadR.d.ts +0 -238
  55. package/dist/index-C3UGZqUG.d.ts +0 -288
  56. package/dist/index-CH8ucsKZ.d.ts +0 -472
  57. package/dist/index-ChV4Q5j6.d.cts +0 -137
  58. package/dist/index-CjNeb3ML.d.cts +0 -472
  59. package/dist/index-Cm-YSPhK.d.ts +0 -254
  60. package/dist/index-D81Fo9XN.d.cts +0 -254
  61. package/dist/index-DLm-DKAk.d.cts +0 -288
  62. package/dist/index-oenqxDCa.d.ts +0 -137
  63. package/dist/pipelines/index.cjs.map +0 -1
  64. package/dist/pipelines/index.d.ts +0 -4
  65. package/dist/pipelines/index.js +0 -30
  66. package/dist/pipelines/index.js.map +0 -1
  67. package/dist/systems/index.d.ts +0 -7
  68. package/dist/systems/index.js +0 -33
  69. package/dist/systems/index.js.map +0 -1
  70. package/dist/types-DvzdpbLu.d.cts +0 -69
  71. package/dist/types-yh4pOGEm.d.ts +0 -69
  72. package/dist/utils/index.d.ts +0 -3
  73. package/dist/utils/index.js +0 -27
  74. package/dist/utils/index.js.map +0 -1
@@ -0,0 +1,69 @@
1
+ import { a as IEntity } from "../identity-component-BCmEilvk.mjs";
2
+ import { l as IPipelineContext, o as IPipeline } from "../index-DcirKLCP.mjs";
3
+ import { n as ISystemsRuntimeContext, o as ISystemsModuleBuilder, u as ISystemContext } from "../index-CW6-OhB4.mjs";
4
+
5
+ //#region src/factories/context-factory.d.ts
6
+ interface IContextFactory {
7
+ /**
8
+ * Creates a new system context for the given entity type.
9
+ * @template TEntity - The entity type for which the system context is being created.
10
+ * @returns A new context instance.
11
+ */
12
+ createSystemContext<TEntity extends IEntity>(): ISystemContext<TEntity>;
13
+ }
14
+ //#endregion
15
+ //#region src/factories/pipeline-factory.d.ts
16
+ /**
17
+ * Creates pipeline instances for various contexts.
18
+ * Abstracts pipeline creation to support different implementations.
19
+ * Used by the system to instantiate pipelines without coupling to specific implementations.
20
+ */
21
+ interface IPipelineFactory {
22
+ /**
23
+ * Creates a new pipeline for the specified context type.
24
+ * @template TContext - The context type for the pipeline. Must extend IPipelineContext.
25
+ * @param name - Optional name for the pipeline (useful for debugging).
26
+ * @returns A new pipeline instance ready for middleware registration.
27
+ */
28
+ createPipeline<TContext extends IPipelineContext>(name?: string): IPipeline<TContext>;
29
+ }
30
+ //#endregion
31
+ //#region src/factories/runtime-factory.d.ts
32
+ /**
33
+ * Creates runtime contexts and pipelines for system execution.
34
+ * Provides factory methods for constructing runtime infrastructure.
35
+ * Allows different runtime strategies through multiple implementations.
36
+ */
37
+ interface IRuntimeFactory {
38
+ /**
39
+ * Creates a new runtime context for system execution.
40
+ * @template TEntity - The entity type for the runtime context.
41
+ * @returns A new systems runtime context instance.
42
+ */
43
+ createRuntimeContext<TEntity extends IEntity>(): ISystemsRuntimeContext<TEntity>;
44
+ /**
45
+ * Creates a pipeline for systems runtime orchestration.
46
+ * @template TEntity - The entity type for this runtime pipeline.
47
+ * @param name - Optional name for debugging.
48
+ * @returns A new runtime pipeline for system execution.
49
+ */
50
+ createRuntimePipeline<TEntity extends IEntity>(name?: string): IPipeline<ISystemsRuntimeContext<TEntity>>;
51
+ }
52
+ //#endregion
53
+ //#region src/factories/systems-factory.d.ts
54
+ /**
55
+ * Creates systems module builders for constructing entity system pipelines.
56
+ * Provides factory access to module builder instances.
57
+ * Enables composition of systems for different entity types.
58
+ */
59
+ interface ISystemsFactory {
60
+ /**
61
+ * Creates a new builder for constructing a systems module.
62
+ * @template TEntity - The entity type for which systems are being built.
63
+ * @returns A new systems module builder instance.
64
+ */
65
+ createSystemsModuleBuilder<TEntity extends IEntity>(): ISystemsModuleBuilder<TEntity>;
66
+ }
67
+ //#endregion
68
+ export { IContextFactory, IPipelineFactory, IRuntimeFactory, ISystemsFactory };
69
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,241 @@
1
+ import { n as Immutable } from "./types-DLOd2zXO.cjs";
2
+
3
+ //#region src/components/component.d.ts
4
+ type ComponentTypeUid = string | number;
5
+ /**
6
+ * The foundational data storage interface for all entity state.
7
+ * Components are pure data holders without behavior.
8
+ * They are the primary mechanism for organizing and accessing entity state.
9
+ * Systems read and modify components to drive entity behavior.
10
+ */
11
+ interface IComponent {
12
+ /**
13
+ * The unique type identifier for this component.
14
+ * Enables type-safe component retrieval and categorization.
15
+ */
16
+ readonly componentType: ComponentTypeUid;
17
+ /**
18
+ * Indicates whether this component's state should be included in entity snapshots.
19
+ * Set to false for local-only state (UI, caches, transient data).
20
+ * Set to true for state that needs replication or persistence.
21
+ */
22
+ readonly isSerializable: boolean;
23
+ /**
24
+ * Optional version number for this component.
25
+ * Useful for managing backwards-compatibility when component schemas evolve.
26
+ * Allows deserialization to handle multiple component versions.
27
+ */
28
+ readonly version?: number;
29
+ /**
30
+ * Optional custom serialization function.
31
+ * Converts the component to a transmittable or storable format.
32
+ * If not provided, standard JSON stringification is used.
33
+ * @returns Serialized representation of the component.
34
+ */
35
+ toJSON?(): string | object;
36
+ /**
37
+ * Optional custom deserialization function.
38
+ * Updates the component's state from a previously serialized form.
39
+ * If not provided, fields are overwritten directly from the target state.
40
+ * @param targetState The serialized state to restore.
41
+ */
42
+ load?(targetState: this): void;
43
+ }
44
+ //#endregion
45
+ //#region src/entities/entity-proxies.d.ts
46
+ /**
47
+ * Represents a reference (pointer) to another entity.
48
+ * Proxies are the primary mechanism for establishing and maintaining relationships between entities,
49
+ * enabling decoupled entity-to-entity communication without direct dependencies.
50
+ */
51
+ interface IEntityProxy {
52
+ /**
53
+ * The type identifier of the entity being referenced.
54
+ * Allows filtering and categorizing proxy relationships by entity type.
55
+ */
56
+ readonly entityType: EntityTypeUid;
57
+ /**
58
+ * The unique identifier of the referenced entity instance.
59
+ */
60
+ readonly entityUid: EntityUid;
61
+ }
62
+ /**
63
+ * A typed variant of `IEntityProxy` that carries compile-time type information.
64
+ * This allows IDEs to provide better type inference and type-checking when working with entity relationships.
65
+ *
66
+ * @template TEntity - The specific entity type that this proxy references.
67
+ */
68
+ interface EntityProxy<TEntity extends IEntity> extends IEntityProxy {}
69
+ /**
70
+ * A helper type to create a typed entity proxy.
71
+ */
72
+ type TypedEntityProxy<T extends EntityTypeUid> = {
73
+ entityType: T;
74
+ entityUid: EntityUid;
75
+ };
76
+ /**
77
+ * A mapped type that transforms an array of EntityType into an array of TypedEntityProxy.
78
+ */
79
+ type RequiredProxies<TProxyTypes extends readonly EntityTypeUid[]> = [...{ [I in keyof TProxyTypes]: TypedEntityProxy<TProxyTypes[I]> }, ...IEntityProxy[]];
80
+ /**
81
+ * Central registry for managing entity-to-entity relationships through proxies.
82
+ * Maintains bidirectional proxy links, ensuring consistency across all entity references.
83
+ * This is the authoritative source for proxy data and manages the complete relationship lifecycle.
84
+ */
85
+ interface IEntityProxyRepository {
86
+ /**
87
+ * Establishes a bidirectional proxy relationship between two entities.
88
+ * @param source - The entity establishing the reference.
89
+ * @param target - The entity being referenced.
90
+ * @param cleanup - If true, removes existing proxies of the same type before registering new relationship.
91
+ */
92
+ register(source: IEntityProxy, target: IEntityProxy, cleanup?: boolean): void;
93
+ /**
94
+ * Establishes multiple bidirectional proxy relationships for a source entity.
95
+ * Efficiently batch-registers relationships to multiple target entities.
96
+ * @param source - The entity establishing the references.
97
+ * @param targets - The entities being referenced.
98
+ * @param cleanup - If true, removes existing proxies of matching types before registering new relationships.
99
+ */
100
+ registerMany(source: IEntityProxy, targets: readonly IEntityProxy[], cleanup?: boolean): void;
101
+ /**
102
+ * Removes a bidirectional proxy relationship between two entities.
103
+ * @param source - The entity from which the reference is removed.
104
+ * @param target - The entity whose reference is being removed.
105
+ */
106
+ remove(source: IEntityProxy, target: IEntityProxy): void;
107
+ /**
108
+ * Removes all proxies from an entity, optionally filtered by target entity type.
109
+ * Also cleans up corresponding back-references from target entities.
110
+ * @param source - The entity from which proxies are removed.
111
+ * @param targetType - Optional entity type filter. If provided, only proxies to entities of this type are removed.
112
+ */
113
+ removeAllFor(source: IEntityProxy, targetType?: EntityTypeUid): void;
114
+ /**
115
+ * Retrieves a single proxy of a specific type for a source entity.
116
+ * If multiple proxies of the same type exist, it returns the first one found.
117
+ * @param source - The proxy of the source entity.
118
+ * @param targetType - The entity type of the target proxy to retrieve.
119
+ * @returns The entity proxy, or null if not found.
120
+ */
121
+ get(source: IEntityProxy, targetType: EntityTypeUid): IEntityProxy | null;
122
+ /**
123
+ * Retrieves all proxies of a specific type for a source entity.
124
+ * @param source - The proxy of the source entity.
125
+ * @param targetType - The entity type of the target proxies to retrieve.
126
+ * @returns A readonly array of entity proxies.
127
+ */
128
+ getMany(source: IEntityProxy, targetType: EntityTypeUid): Readonly<IEntityProxy[]>;
129
+ /**
130
+ * Retrieves all proxies for a source entity.
131
+ * @param source - The proxy of the source entity.
132
+ * @returns A readonly map of entity type UIDs to an array of their proxies.
133
+ */
134
+ getAll(source: IEntityProxy): ReadonlyMap<EntityTypeUid, Readonly<IEntityProxy[]>>;
135
+ }
136
+ //#endregion
137
+ //#region src/entities/entity.d.ts
138
+ /**
139
+ * Represents the unique identifier for an entity type.
140
+ * Can be either a string or a number.
141
+ */
142
+ type EntityTypeUid = string | number;
143
+ /**
144
+ * Represents the unique identifier for an entity.
145
+ * Can be either a string or a number.
146
+ */
147
+ type EntityUid = string | number;
148
+ /**
149
+ * Represents the core identification and initialization data for an entity.
150
+ * Every entity must have a model containing the minimal information needed for instantiation.
151
+ * Models are immutable and define the entity's initial structure.
152
+ */
153
+ interface IEntityModel {
154
+ /**
155
+ * The unique identifier for this entity instance.
156
+ */
157
+ readonly uid: EntityUid;
158
+ /**
159
+ * Optional array of proxies (references) to other entities.
160
+ * Used to establish relationships at entity creation time.
161
+ */
162
+ readonly proxies?: readonly IEntityProxy[];
163
+ }
164
+ /**
165
+ * Entity model with enforced required proxy relationships.
166
+ * Used when an entity requires specific relationships to be present from creation.
167
+ *
168
+ * @template TProxyTypes - A readonly array of entity type IDs that must be provided as proxies.
169
+ */
170
+ interface IEntityModelWithRequiredProxies<TProxyTypes extends readonly EntityTypeUid[]> extends IEntityModel {
171
+ /**
172
+ * Required proxies for this entity.
173
+ * The array structure matches the TProxyTypes template to ensure type-safe proxy definitions.
174
+ */
175
+ readonly proxies: RequiredProxies<TProxyTypes>;
176
+ }
177
+ /**
178
+ * The core entity interface representing a composition of components and relationships.
179
+ * Entities are immutable containers that store data (components) and maintain relationships (proxies) to other entities.
180
+ * State modifications occur exclusively through system operations, maintaining data integrity and enabling safe concurrent access.
181
+ *
182
+ * Implementations should provide strongly-typed accessors for components and proxies specific to their entity type,
183
+ * enhancing IDE support and type safety without adding behavior beyond data access.
184
+ */
185
+ interface IEntity {
186
+ /**
187
+ * The set of components attached to this entity.
188
+ * Components are the primary data storage mechanism, mapped by their unique type identifiers.
189
+ */
190
+ readonly components: ReadonlyMap<ComponentTypeUid, IComponent>;
191
+ /**
192
+ * The identity component containing core entity metadata and initialization information.
193
+ * Every entity has exactly one identity component that persists for the entity's lifetime.
194
+ */
195
+ readonly identity: Readonly<IdentityComponent<IEntityModel>>;
196
+ /**
197
+ * A reference to this entity's own proxy.
198
+ */
199
+ readonly myProxy: Readonly<EntityProxy<this>>;
200
+ }
201
+ //#endregion
202
+ //#region src/components/identity-component.d.ts
203
+ /**
204
+ * The `BasicComponentType` enum defines the types of basic components available.
205
+ */
206
+ declare enum BasicComponentType {
207
+ identity = "identity"
208
+ }
209
+ /**
210
+ * The mandatory metadata component for every entity.
211
+ * Contains core information that defines what an entity is and when it was last updated.
212
+ * This component is immutable after creation and uniquely identifies each entity.
213
+ *
214
+ * @template TModel - The entity model type containing initialization data.
215
+ */
216
+ interface IdentityComponent<TModel extends IEntityModel> extends IComponent {
217
+ /**
218
+ * The entity type classification.
219
+ * Categorizes entities into logical types, allowing systems to selectively operate on specific entity categories.
220
+ */
221
+ readonly entityType: EntityTypeUid;
222
+ /**
223
+ * The initialization model for this entity.
224
+ * Provides the minimal data structure used when the entity was first created.
225
+ * Serves as a reference point for the entity's initial configuration.
226
+ *
227
+ * @type {Immutable<TModel>}
228
+ */
229
+ readonly model: Immutable<TModel>;
230
+ /**
231
+ * The timestamp of the entity's last system update.
232
+ * Useful for calculating elapsed time (delta time) between consecutive updates.
233
+ * Helps systems make time-aware decisions.
234
+ *
235
+ * @type {Date | undefined}
236
+ */
237
+ readonly lastUpdated?: Date;
238
+ }
239
+ //#endregion
240
+ export { IEntity as a, EntityProxy as c, RequiredProxies as d, TypedEntityProxy as f, EntityUid as i, IEntityProxy as l, IComponent as m, IdentityComponent as n, IEntityModel as o, ComponentTypeUid as p, EntityTypeUid as r, IEntityModelWithRequiredProxies as s, BasicComponentType as t, IEntityProxyRepository as u };
241
+ //# sourceMappingURL=identity-component-5neFUd2Q.d.cts.map
@@ -0,0 +1,241 @@
1
+ import { n as Immutable } from "./types-CnDtpKsY.mjs";
2
+
3
+ //#region src/components/component.d.ts
4
+ type ComponentTypeUid = string | number;
5
+ /**
6
+ * The foundational data storage interface for all entity state.
7
+ * Components are pure data holders without behavior.
8
+ * They are the primary mechanism for organizing and accessing entity state.
9
+ * Systems read and modify components to drive entity behavior.
10
+ */
11
+ interface IComponent {
12
+ /**
13
+ * The unique type identifier for this component.
14
+ * Enables type-safe component retrieval and categorization.
15
+ */
16
+ readonly componentType: ComponentTypeUid;
17
+ /**
18
+ * Indicates whether this component's state should be included in entity snapshots.
19
+ * Set to false for local-only state (UI, caches, transient data).
20
+ * Set to true for state that needs replication or persistence.
21
+ */
22
+ readonly isSerializable: boolean;
23
+ /**
24
+ * Optional version number for this component.
25
+ * Useful for managing backwards-compatibility when component schemas evolve.
26
+ * Allows deserialization to handle multiple component versions.
27
+ */
28
+ readonly version?: number;
29
+ /**
30
+ * Optional custom serialization function.
31
+ * Converts the component to a transmittable or storable format.
32
+ * If not provided, standard JSON stringification is used.
33
+ * @returns Serialized representation of the component.
34
+ */
35
+ toJSON?(): string | object;
36
+ /**
37
+ * Optional custom deserialization function.
38
+ * Updates the component's state from a previously serialized form.
39
+ * If not provided, fields are overwritten directly from the target state.
40
+ * @param targetState The serialized state to restore.
41
+ */
42
+ load?(targetState: this): void;
43
+ }
44
+ //#endregion
45
+ //#region src/entities/entity-proxies.d.ts
46
+ /**
47
+ * Represents a reference (pointer) to another entity.
48
+ * Proxies are the primary mechanism for establishing and maintaining relationships between entities,
49
+ * enabling decoupled entity-to-entity communication without direct dependencies.
50
+ */
51
+ interface IEntityProxy {
52
+ /**
53
+ * The type identifier of the entity being referenced.
54
+ * Allows filtering and categorizing proxy relationships by entity type.
55
+ */
56
+ readonly entityType: EntityTypeUid;
57
+ /**
58
+ * The unique identifier of the referenced entity instance.
59
+ */
60
+ readonly entityUid: EntityUid;
61
+ }
62
+ /**
63
+ * A typed variant of `IEntityProxy` that carries compile-time type information.
64
+ * This allows IDEs to provide better type inference and type-checking when working with entity relationships.
65
+ *
66
+ * @template TEntity - The specific entity type that this proxy references.
67
+ */
68
+ interface EntityProxy<TEntity extends IEntity> extends IEntityProxy {}
69
+ /**
70
+ * A helper type to create a typed entity proxy.
71
+ */
72
+ type TypedEntityProxy<T extends EntityTypeUid> = {
73
+ entityType: T;
74
+ entityUid: EntityUid;
75
+ };
76
+ /**
77
+ * A mapped type that transforms an array of EntityType into an array of TypedEntityProxy.
78
+ */
79
+ type RequiredProxies<TProxyTypes extends readonly EntityTypeUid[]> = [...{ [I in keyof TProxyTypes]: TypedEntityProxy<TProxyTypes[I]> }, ...IEntityProxy[]];
80
+ /**
81
+ * Central registry for managing entity-to-entity relationships through proxies.
82
+ * Maintains bidirectional proxy links, ensuring consistency across all entity references.
83
+ * This is the authoritative source for proxy data and manages the complete relationship lifecycle.
84
+ */
85
+ interface IEntityProxyRepository {
86
+ /**
87
+ * Establishes a bidirectional proxy relationship between two entities.
88
+ * @param source - The entity establishing the reference.
89
+ * @param target - The entity being referenced.
90
+ * @param cleanup - If true, removes existing proxies of the same type before registering new relationship.
91
+ */
92
+ register(source: IEntityProxy, target: IEntityProxy, cleanup?: boolean): void;
93
+ /**
94
+ * Establishes multiple bidirectional proxy relationships for a source entity.
95
+ * Efficiently batch-registers relationships to multiple target entities.
96
+ * @param source - The entity establishing the references.
97
+ * @param targets - The entities being referenced.
98
+ * @param cleanup - If true, removes existing proxies of matching types before registering new relationships.
99
+ */
100
+ registerMany(source: IEntityProxy, targets: readonly IEntityProxy[], cleanup?: boolean): void;
101
+ /**
102
+ * Removes a bidirectional proxy relationship between two entities.
103
+ * @param source - The entity from which the reference is removed.
104
+ * @param target - The entity whose reference is being removed.
105
+ */
106
+ remove(source: IEntityProxy, target: IEntityProxy): void;
107
+ /**
108
+ * Removes all proxies from an entity, optionally filtered by target entity type.
109
+ * Also cleans up corresponding back-references from target entities.
110
+ * @param source - The entity from which proxies are removed.
111
+ * @param targetType - Optional entity type filter. If provided, only proxies to entities of this type are removed.
112
+ */
113
+ removeAllFor(source: IEntityProxy, targetType?: EntityTypeUid): void;
114
+ /**
115
+ * Retrieves a single proxy of a specific type for a source entity.
116
+ * If multiple proxies of the same type exist, it returns the first one found.
117
+ * @param source - The proxy of the source entity.
118
+ * @param targetType - The entity type of the target proxy to retrieve.
119
+ * @returns The entity proxy, or null if not found.
120
+ */
121
+ get(source: IEntityProxy, targetType: EntityTypeUid): IEntityProxy | null;
122
+ /**
123
+ * Retrieves all proxies of a specific type for a source entity.
124
+ * @param source - The proxy of the source entity.
125
+ * @param targetType - The entity type of the target proxies to retrieve.
126
+ * @returns A readonly array of entity proxies.
127
+ */
128
+ getMany(source: IEntityProxy, targetType: EntityTypeUid): Readonly<IEntityProxy[]>;
129
+ /**
130
+ * Retrieves all proxies for a source entity.
131
+ * @param source - The proxy of the source entity.
132
+ * @returns A readonly map of entity type UIDs to an array of their proxies.
133
+ */
134
+ getAll(source: IEntityProxy): ReadonlyMap<EntityTypeUid, Readonly<IEntityProxy[]>>;
135
+ }
136
+ //#endregion
137
+ //#region src/entities/entity.d.ts
138
+ /**
139
+ * Represents the unique identifier for an entity type.
140
+ * Can be either a string or a number.
141
+ */
142
+ type EntityTypeUid = string | number;
143
+ /**
144
+ * Represents the unique identifier for an entity.
145
+ * Can be either a string or a number.
146
+ */
147
+ type EntityUid = string | number;
148
+ /**
149
+ * Represents the core identification and initialization data for an entity.
150
+ * Every entity must have a model containing the minimal information needed for instantiation.
151
+ * Models are immutable and define the entity's initial structure.
152
+ */
153
+ interface IEntityModel {
154
+ /**
155
+ * The unique identifier for this entity instance.
156
+ */
157
+ readonly uid: EntityUid;
158
+ /**
159
+ * Optional array of proxies (references) to other entities.
160
+ * Used to establish relationships at entity creation time.
161
+ */
162
+ readonly proxies?: readonly IEntityProxy[];
163
+ }
164
+ /**
165
+ * Entity model with enforced required proxy relationships.
166
+ * Used when an entity requires specific relationships to be present from creation.
167
+ *
168
+ * @template TProxyTypes - A readonly array of entity type IDs that must be provided as proxies.
169
+ */
170
+ interface IEntityModelWithRequiredProxies<TProxyTypes extends readonly EntityTypeUid[]> extends IEntityModel {
171
+ /**
172
+ * Required proxies for this entity.
173
+ * The array structure matches the TProxyTypes template to ensure type-safe proxy definitions.
174
+ */
175
+ readonly proxies: RequiredProxies<TProxyTypes>;
176
+ }
177
+ /**
178
+ * The core entity interface representing a composition of components and relationships.
179
+ * Entities are immutable containers that store data (components) and maintain relationships (proxies) to other entities.
180
+ * State modifications occur exclusively through system operations, maintaining data integrity and enabling safe concurrent access.
181
+ *
182
+ * Implementations should provide strongly-typed accessors for components and proxies specific to their entity type,
183
+ * enhancing IDE support and type safety without adding behavior beyond data access.
184
+ */
185
+ interface IEntity {
186
+ /**
187
+ * The set of components attached to this entity.
188
+ * Components are the primary data storage mechanism, mapped by their unique type identifiers.
189
+ */
190
+ readonly components: ReadonlyMap<ComponentTypeUid, IComponent>;
191
+ /**
192
+ * The identity component containing core entity metadata and initialization information.
193
+ * Every entity has exactly one identity component that persists for the entity's lifetime.
194
+ */
195
+ readonly identity: Readonly<IdentityComponent<IEntityModel>>;
196
+ /**
197
+ * A reference to this entity's own proxy.
198
+ */
199
+ readonly myProxy: Readonly<EntityProxy<this>>;
200
+ }
201
+ //#endregion
202
+ //#region src/components/identity-component.d.ts
203
+ /**
204
+ * The `BasicComponentType` enum defines the types of basic components available.
205
+ */
206
+ declare enum BasicComponentType {
207
+ identity = "identity"
208
+ }
209
+ /**
210
+ * The mandatory metadata component for every entity.
211
+ * Contains core information that defines what an entity is and when it was last updated.
212
+ * This component is immutable after creation and uniquely identifies each entity.
213
+ *
214
+ * @template TModel - The entity model type containing initialization data.
215
+ */
216
+ interface IdentityComponent<TModel extends IEntityModel> extends IComponent {
217
+ /**
218
+ * The entity type classification.
219
+ * Categorizes entities into logical types, allowing systems to selectively operate on specific entity categories.
220
+ */
221
+ readonly entityType: EntityTypeUid;
222
+ /**
223
+ * The initialization model for this entity.
224
+ * Provides the minimal data structure used when the entity was first created.
225
+ * Serves as a reference point for the entity's initial configuration.
226
+ *
227
+ * @type {Immutable<TModel>}
228
+ */
229
+ readonly model: Immutable<TModel>;
230
+ /**
231
+ * The timestamp of the entity's last system update.
232
+ * Useful for calculating elapsed time (delta time) between consecutive updates.
233
+ * Helps systems make time-aware decisions.
234
+ *
235
+ * @type {Date | undefined}
236
+ */
237
+ readonly lastUpdated?: Date;
238
+ }
239
+ //#endregion
240
+ export { IEntity as a, EntityProxy as c, RequiredProxies as d, TypedEntityProxy as f, EntityUid as i, IEntityProxy as l, IComponent as m, IdentityComponent as n, IEntityModel as o, ComponentTypeUid as p, EntityTypeUid as r, IEntityModelWithRequiredProxies as s, BasicComponentType as t, IEntityProxyRepository as u };
241
+ //# sourceMappingURL=identity-component-BCmEilvk.d.mts.map