@awesome-ecs/abstract 0.32.0 → 0.33.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/README.md +124 -125
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.mts +1 -1
- package/dist/components/index.mjs.map +1 -1
- package/dist/entities/index.cjs +1 -19
- 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 +1 -19
- package/dist/entities/index.mjs.map +1 -1
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +2 -2
- package/dist/factories/index.d.mts +2 -2
- package/dist/factories/index.mjs.map +1 -1
- package/dist/{index-BGLTfuj8.d.cts → index--9JJtMKF.d.mts} +83 -254
- package/dist/{index-C1hRAjM-.d.mts → index-0hg5PXZe.d.cts} +83 -254
- package/dist/{index-B1OYkMOx.d.cts → index-BOS-47DQ.d.mts} +137 -298
- package/dist/{index-CeqaKmWR.d.mts → index-Bl7Cf9gi.d.cts} +11 -11
- package/dist/{index-D3rS2RFG.d.mts → index-CPGVaS-_.d.cts} +137 -298
- package/dist/{index-DMTkNY1e.d.cts → index-DXbpfhHa.d.mts} +11 -11
- package/dist/{index-b5BtWAvO.d.mts → index-HeCQLTSE.d.cts} +16 -7
- package/dist/{index-C0jDrUBA.d.cts → index-Tznk33g6.d.mts} +16 -7
- package/dist/pipelines/index.d.cts +2 -2
- package/dist/pipelines/index.d.mts +2 -2
- package/dist/systems/index.cjs +8 -5
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +84 -2
- package/dist/systems/index.d.mts +84 -2
- package/dist/systems/index.mjs +8 -5
- package/dist/systems/index.mjs.map +1 -1
- package/dist/{types-Bbmnq4ni.d.cts → types-COxeVghs.d.cts} +19 -4
- package/dist/{types-C1ojaDL4.d.mts → types-UnqKSA14.d.mts} +19 -4
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +2 -2
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,125 +1,124 @@
|
|
|
1
|
-
# Awesome ECS - Abstract Package
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The Abstract package defines all core interfaces and abstractions for the Entity-Component-System (ECS) framework. It provides the foundational contracts that all other packages implement, including:
|
|
6
|
-
|
|
7
|
-
- **Components**: Data-storage contracts
|
|
8
|
-
- **Entities**: Container contracts for components and relationships
|
|
9
|
-
- **Pipelines**: Middleware-based execution chains
|
|
10
|
-
- **Systems**: Modular logic execution patterns
|
|
11
|
-
- **Utilities**: Serialization, events, and scheduling
|
|
12
|
-
|
|
13
|
-
This package has **zero external dependencies** and serves as the contract layer for the entire ECS framework.
|
|
14
|
-
|
|
15
|
-
## Core Concepts
|
|
16
|
-
|
|
17
|
-
### Components (`src/components/`)
|
|
18
|
-
|
|
19
|
-
Components are **data-only containers**. They should never contain business logic.
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
import { IComponent } from "@awesome-ecs/abstract";
|
|
23
|
-
|
|
24
|
-
export class HealthComponent implements IComponent {
|
|
25
|
-
readonly componentType = ComponentType.health;
|
|
26
|
-
readonly isSerializable = true; // Include in snapshots
|
|
27
|
-
|
|
28
|
-
current: number = 100;
|
|
29
|
-
max: number = 100;
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**Key interfaces:**
|
|
34
|
-
- `IComponent`: Base component interface with `componentType` and `isSerializable`
|
|
35
|
-
- `IdentityComponent`: Mandatory component tracking entity UID and model
|
|
36
|
-
|
|
37
|
-
### Entities (`src/entities/`)
|
|
38
|
-
|
|
39
|
-
Entities are immutable **containers of components** and **proxies to other entities**. They never directly reference other entities—they use proxies for loose coupling.
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
export class GridEntity extends EntityBase<GridModel> {
|
|
43
|
-
// Strongly-typed component getters
|
|
44
|
-
get coordinates(): CoordinatesComponent {
|
|
45
|
-
return this.getComponent(ComponentType.coordinates);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Entity proxies for relationships (not direct references)
|
|
49
|
-
get sceneProxy(): EntityProxy<SceneEntity> {
|
|
50
|
-
return this.getProxy(EntityType.scene);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**Key files:**
|
|
56
|
-
- `entity.ts`: Base `IEntity` interface and `EntityTypeUid` types
|
|
57
|
-
- `entity-proxies.ts`: `EntityProxy` for loose-coupling relationships
|
|
58
|
-
- `entity-snapshot.ts`: `IEntitySnapshot` for serialization
|
|
59
|
-
- `entity-
|
|
60
|
-
- `entity-repository.ts`: `IEntityRepository` for entity lookups
|
|
61
|
-
- `entity-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
- `
|
|
81
|
-
- `middleware.ts`:
|
|
82
|
-
- `
|
|
83
|
-
- `pipeline-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- `system-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- `systems-module.ts`: `
|
|
96
|
-
- `systems-module-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
- `systems-runtime.ts`:
|
|
101
|
-
- `systems-runtime-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
- `
|
|
107
|
-
- `
|
|
108
|
-
- `
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
- AI patterns (→ @awesome-ecs/ai)
|
|
1
|
+
# Awesome ECS - Abstract Package
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Abstract package defines all core interfaces and abstractions for the Entity-Component-System (ECS) framework. It provides the foundational contracts that all other packages implement, including:
|
|
6
|
+
|
|
7
|
+
- **Components**: Data-storage contracts
|
|
8
|
+
- **Entities**: Container contracts for components and relationships
|
|
9
|
+
- **Pipelines**: Middleware-based execution chains
|
|
10
|
+
- **Systems**: Modular logic execution patterns
|
|
11
|
+
- **Utilities**: Serialization, events, and scheduling
|
|
12
|
+
|
|
13
|
+
This package has **zero external dependencies** and serves as the contract layer for the entire ECS framework.
|
|
14
|
+
|
|
15
|
+
## Core Concepts
|
|
16
|
+
|
|
17
|
+
### Components (`src/components/`)
|
|
18
|
+
|
|
19
|
+
Components are **data-only containers**. They should never contain business logic.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { IComponent } from "@awesome-ecs/abstract";
|
|
23
|
+
|
|
24
|
+
export class HealthComponent implements IComponent {
|
|
25
|
+
readonly componentType = ComponentType.health;
|
|
26
|
+
readonly isSerializable = true; // Include in snapshots
|
|
27
|
+
|
|
28
|
+
current: number = 100;
|
|
29
|
+
max: number = 100;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Key interfaces:**
|
|
34
|
+
- `IComponent`: Base component interface with `componentType` and `isSerializable`
|
|
35
|
+
- `IdentityComponent`: Mandatory component tracking entity UID and model
|
|
36
|
+
|
|
37
|
+
### Entities (`src/entities/`)
|
|
38
|
+
|
|
39
|
+
Entities are immutable **containers of components** and **proxies to other entities**. They never directly reference other entities—they use proxies for loose coupling.
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
export class GridEntity extends EntityBase<GridModel> {
|
|
43
|
+
// Strongly-typed component getters
|
|
44
|
+
get coordinates(): CoordinatesComponent {
|
|
45
|
+
return this.getComponent(ComponentType.coordinates);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Entity proxies for relationships (not direct references)
|
|
49
|
+
get sceneProxy(): EntityProxy<SceneEntity> {
|
|
50
|
+
return this.getProxy(EntityType.scene);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Key files:**
|
|
56
|
+
- `entity.ts`: Base `IEntity` interface and `EntityTypeUid` types
|
|
57
|
+
- `entity-proxies.ts`: `EntityProxy` for loose-coupling relationships
|
|
58
|
+
- `entity-snapshot.ts`: `IEntitySnapshot` for serialization
|
|
59
|
+
- `entity-runtime-scheduler.ts`: `IEntityUpdate` and `IEntityRuntimeScheduler` for dirty mailboxes, cadence, and batched runtime dispatch
|
|
60
|
+
- `entity-repository.ts`: `IEntityRepository` for entity lookups
|
|
61
|
+
- `entity-events.ts`: `IEntityEvents` for reactive patterns
|
|
62
|
+
|
|
63
|
+
### Pipelines (`src/pipelines/`)
|
|
64
|
+
|
|
65
|
+
Pipelines execute **middleware chains** with two phases:
|
|
66
|
+
|
|
67
|
+
1. **dispatch(context)**: Main execution phase
|
|
68
|
+
2. **cleanup(context)**: Resource cleanup phase
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
export interface IPipeline<TContext extends IPipelineContext> {
|
|
72
|
+
use(middleware: IMiddleware<TContext>): this;
|
|
73
|
+
dispatch(context: Partial<TContext>): void | Promise<void>;
|
|
74
|
+
cleanup(context: Partial<TContext>): void | Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Key files:**
|
|
79
|
+
- `pipeline.ts`: Core `IPipeline` interface
|
|
80
|
+
- `middleware.ts`: `IMiddleware` contract (action + optional cleanup)
|
|
81
|
+
- `middleware-runner.ts`: Middleware execution engine
|
|
82
|
+
- `pipeline-context.ts`: Context passed to middleware
|
|
83
|
+
- `pipeline-runner.ts`: Pipeline execution orchestration
|
|
84
|
+
|
|
85
|
+
### Systems (`src/systems/`)
|
|
86
|
+
|
|
87
|
+
Systems are **modular logic units** that operate on entities. They implement the middleware pattern.
|
|
88
|
+
|
|
89
|
+
**Pipeline-based systems:**
|
|
90
|
+
- `system-middleware.ts`: `ISystemMiddleware<TEntity>` - middleware for a specific entity type
|
|
91
|
+
- `system-context.ts`: Context passed to system middleware (entity, events, repository, etc.)
|
|
92
|
+
|
|
93
|
+
**Module-based organization:**
|
|
94
|
+
- `systems-module.ts`: `ISystemsModule<TEntity>` - groups related systems targeting an entity type
|
|
95
|
+
- `systems-module-builder.ts`: `ISystemsModuleBuilder<TEntity>` - fluent builder for pipeline registration
|
|
96
|
+
- `systems-module-repository.ts`: Module lifecycle and registration
|
|
97
|
+
|
|
98
|
+
**Runtime execution:**
|
|
99
|
+
- `systems-runtime.ts`: `ISystemsRuntime` - core tick-based execution loop
|
|
100
|
+
- `systems-runtime-context.ts`: Context for runtime execution
|
|
101
|
+
- `systems-runtime-middleware.ts`: Middleware for runtime operations
|
|
102
|
+
|
|
103
|
+
### Utilities (`src/utils/`)
|
|
104
|
+
|
|
105
|
+
- `types.ts`: Common types (`Immutable`, `BooleanProps`, `Readonly`)
|
|
106
|
+
- `json-serializer.ts`: JSON serialization contracts
|
|
107
|
+
- `logger.ts`: Logging interface
|
|
108
|
+
- `performance-timer.ts`: Performance measurement
|
|
109
|
+
|
|
110
|
+
## Key Design Principles
|
|
111
|
+
|
|
112
|
+
1. **Components are data-only** - no behavior, just properties
|
|
113
|
+
2. **Entities are immutable** - modifications through systems only
|
|
114
|
+
3. **Relationships use proxies** - loose coupling between entities
|
|
115
|
+
4. **Systems are middleware** - pluggable into pipelines
|
|
116
|
+
5. **Pipelines are composable** - middleware chains with dispatch + cleanup
|
|
117
|
+
|
|
118
|
+
## What's NOT in Abstract
|
|
119
|
+
|
|
120
|
+
- Concrete entity implementations (→ @awesome-ecs/core)
|
|
121
|
+
- System module base classes (→ @awesome-ecs/core)
|
|
122
|
+
- Component factories (→ @awesome-ecs/core)
|
|
123
|
+
- Multi-threading (→ @awesome-ecs/workers)
|
|
124
|
+
- AI patterns (→ @awesome-ecs/ai)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/components/identity-component.ts"],"sourcesContent":["import { EntityTypeUid, IEntityModel } from '../entities/entity';\
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/components/identity-component.ts"],"sourcesContent":["import { EntityTypeUid, IEntityModel } from '../entities/entity';\nimport { Immutable } from '../utils/types';\nimport { IComponent } from './component';\n\n/**\n * The `BasicComponentType` enum defines the types of basic components available.\n */\nexport enum BasicComponentType {\n identity = 'identity'\n}\n\n/**\n * The mandatory metadata component for every entity.\n * Contains core information that defines what an entity is and when it was last updated.\n * This component is immutable after creation and uniquely identifies each entity.\n *\n * @template TModel - The entity model type containing initialization data.\n */\nexport interface IdentityComponent<TModel extends IEntityModel> extends IComponent {\n /**\n * The entity type classification.\n * Categorizes entities into logical types, allowing systems to selectively operate on specific entity categories.\n */\n readonly entityType: EntityTypeUid;\n\n /**\n * The initialization model for this entity.\n * Provides the minimal data structure used when the entity was first created.\n * Serves as a reference point for the entity's initial configuration.\n *\n * @type {Immutable<TModel>}\n */\n readonly model: Immutable<TModel>;\n\n /**\n * The timestamp of the entity's last system update.\n * Useful for calculating elapsed time (delta time) between consecutive updates.\n * Helps systems make time-aware decisions.\n *\n * @type {Date | undefined}\n */\n readonly lastUpdated?: Date;\n}\n"],"mappings":";;;;;AAOA,IAAY,qBAAL,yBAAA,oBAAA;CACL,mBAAA,cAAA;;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as ConfigOption, g as ConfigCustomControlOptions, h as IComponentWithConfig, m as IComponent, n as IdentityComponent, p as ComponentTypeUid, t as BasicComponentType, v as ConfigRecord } from "../index-HeCQLTSE.cjs";
|
|
2
2
|
export { BasicComponentType, ComponentTypeUid, ConfigCustomControlOptions, ConfigOption, ConfigRecord, IComponent, IComponentWithConfig, IdentityComponent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as ConfigOption, g as ConfigCustomControlOptions, h as IComponentWithConfig, m as IComponent, n as IdentityComponent, p as ComponentTypeUid, t as BasicComponentType, v as ConfigRecord } from "../index-Tznk33g6.mjs";
|
|
2
2
|
export { BasicComponentType, ComponentTypeUid, ConfigCustomControlOptions, ConfigOption, ConfigRecord, IComponent, IComponentWithConfig, IdentityComponent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/components/identity-component.ts"],"sourcesContent":["import { EntityTypeUid, IEntityModel } from '../entities/entity';\
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/components/identity-component.ts"],"sourcesContent":["import { EntityTypeUid, IEntityModel } from '../entities/entity';\nimport { Immutable } from '../utils/types';\nimport { IComponent } from './component';\n\n/**\n * The `BasicComponentType` enum defines the types of basic components available.\n */\nexport enum BasicComponentType {\n identity = 'identity'\n}\n\n/**\n * The mandatory metadata component for every entity.\n * Contains core information that defines what an entity is and when it was last updated.\n * This component is immutable after creation and uniquely identifies each entity.\n *\n * @template TModel - The entity model type containing initialization data.\n */\nexport interface IdentityComponent<TModel extends IEntityModel> extends IComponent {\n /**\n * The entity type classification.\n * Categorizes entities into logical types, allowing systems to selectively operate on specific entity categories.\n */\n readonly entityType: EntityTypeUid;\n\n /**\n * The initialization model for this entity.\n * Provides the minimal data structure used when the entity was first created.\n * Serves as a reference point for the entity's initial configuration.\n *\n * @type {Immutable<TModel>}\n */\n readonly model: Immutable<TModel>;\n\n /**\n * The timestamp of the entity's last system update.\n * Useful for calculating elapsed time (delta time) between consecutive updates.\n * Helps systems make time-aware decisions.\n *\n * @type {Date | undefined}\n */\n readonly lastUpdated?: Date;\n}\n"],"mappings":";;;;AAOA,IAAY,qBAAL,yBAAA,oBAAA;CACL,mBAAA,cAAA;;AACF,EAAA,CAAA,CAAA"}
|
package/dist/entities/index.cjs
CHANGED
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region src/entities/entity-
|
|
3
|
-
/**
|
|
4
|
-
* Specifies the action to be performed on an entity.
|
|
5
|
-
* Updates are categorized to enable different processing paths in the runtime.
|
|
6
|
-
*/
|
|
2
|
+
//#region src/entities/entity-scheduler.ts
|
|
7
3
|
let EntityUpdateType = /* @__PURE__ */ function(EntityUpdateType) {
|
|
8
|
-
/**
|
|
9
|
-
* Indicates the entity should be updated with new data.
|
|
10
|
-
*/
|
|
11
4
|
EntityUpdateType["update"] = "update";
|
|
12
|
-
/**
|
|
13
|
-
* Indicates the entity should be removed from the system.
|
|
14
|
-
*/
|
|
15
5
|
EntityUpdateType["remove"] = "remove";
|
|
16
6
|
return EntityUpdateType;
|
|
17
7
|
}({});
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region src/entities/entity-scheduler.ts
|
|
20
|
-
/**
|
|
21
|
-
* Controls which scheduling modes are paused.
|
|
22
|
-
*/
|
|
23
8
|
let SchedulerPauseType = /* @__PURE__ */ function(SchedulerPauseType) {
|
|
24
|
-
/** Pause both interval timers and frame subscriptions. */
|
|
25
9
|
SchedulerPauseType["full"] = "full";
|
|
26
|
-
/** Pause only frame subscriptions. Interval timers continue firing. */
|
|
27
10
|
SchedulerPauseType["perFrame"] = "perFrame";
|
|
28
|
-
/** Pause only interval timers. Frame subscriptions continue. */
|
|
29
11
|
SchedulerPauseType["intervals"] = "intervals";
|
|
30
12
|
return SchedulerPauseType;
|
|
31
13
|
}({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/entities/entity-
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/entities/entity-scheduler.ts"],"sourcesContent":["import { EntityTypeUid, EntityUid, IEntity, IEntityModel } from './entity';\nimport { IEntityConfigSnapshot } from './entity-config';\nimport { IEntityEvent, IEventData } from './entity-events';\nimport { IEntityProxy } from './entity-proxies';\nimport { IEntitySnapshot } from './entity-snapshot';\n\nexport enum EntityUpdateType {\n update = 'update',\n remove = 'remove'\n}\n\nexport interface IEntityUpdate {\n readonly type: EntityUpdateType;\n readonly entity: IEntityProxy;\n readonly model?: IEntityModel;\n readonly snapshot?: IEntitySnapshot;\n readonly config?: IEntityConfigSnapshot;\n}\n\nexport interface IEntityDispatchGroup {\n readonly entityType: EntityTypeUid;\n readonly updates: ReadonlyArray<IEntityUpdate>;\n readonly dirtyUpdates: number;\n readonly scheduledUpdates: number;\n readonly removeUpdates: number;\n readonly pipelineMask?: number;\n}\n\nexport type EntityRuntimePendingGroupOptions = {\n readonly includeFrameSubscriptions?: boolean;\n};\n\nexport type EntitySchedule = {\n readonly proxy: IEntityProxy;\n readonly intervalMs?: number;\n};\n\nexport type EntityPriorityModel = {\n readonly defaultPriority?: number;\n readonly entityTypes?: ReadonlyMap<EntityTypeUid, number>;\n};\n\nexport enum SchedulerPauseType {\n full = 'full',\n perFrame = 'perFrame',\n intervals = 'intervals'\n}\n\nexport interface IEntityRuntimeScheduler {\n readonly dirtyCount: number;\n readonly rawDirtyCount: number;\n readonly pendingCount: number;\n\n enqueue(update: IEntityUpdate): void;\n enqueueEvent(entity: IEntityProxy, event: IEntityEvent<IEventData>): void;\n enqueueEvents(entity: IEntityProxy, events: ReadonlyArray<IEntityEvent<IEventData>>): void;\n\n schedule(proxy: IEntityProxy, intervalMs?: number): void;\n removeSchedule(proxy: IEntityProxy): void;\n hasSchedule(proxy: IEntityProxy): boolean;\n\n takePendingGroups(\n maxItems?: number,\n options?: EntityRuntimePendingGroupOptions\n ): ReadonlyArray<IEntityDispatchGroup>;\n}\n"],"mappings":";;AAMA,IAAY,mBAAL,yBAAA,kBAAA;CACL,iBAAA,YAAA;CACA,iBAAA,YAAA;;AACF,EAAA,CAAA,CAAA;AAiCA,IAAY,qBAAL,yBAAA,oBAAA;CACL,mBAAA,UAAA;CACA,mBAAA,cAAA;CACA,mBAAA,eAAA;;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as IEntity, c as IEntityProxy, d as TypedEntityProxy, i as EntityUid, l as IEntityProxyRepository, o as IEntityModel, r as EntityTypeUid, s as EntityProxy, u as
|
|
2
|
-
import { _ as
|
|
3
|
-
export { EntityEventSubscriptionFilter, EntityEventSubscriptionOptions, EntityEventUid, EntityProxy, EntitySchedule, EntityTypeUid, EntityUid, EntityUpdateType, IEntity, IEntityConfigSnapshot, IEntityContextCache, IEntityEvent, IEntityEventsDispatcher, IEntityEventsManager, IEntityModel, IEntityProxy, IEntityProxyRepository, IEntityRepository,
|
|
1
|
+
import { a as IEntity, c as IEntityProxy, d as RequiredProxies, f as TypedEntityProxy, i as EntityUid, l as IEntityProxyRepository, o as IEntityModel, r as EntityTypeUid, s as EntityProxy, u as ProxyTypesOf } from "../index-HeCQLTSE.cjs";
|
|
2
|
+
import { _ as IEntityEventsManager, a as IEntityDispatchGroup, b as IEntityConfigSnapshot, c as SchedulerPauseType, d as IEntityRepository, f as EntityEventSubscriptionFilter, g as IEntityEventsDispatcher, h as IEntityEvent, i as EntityUpdateType, l as IEntitySnapshot, m as EntityEventUid, n as EntityRuntimePendingGroupOptions, o as IEntityRuntimeScheduler, p as EntityEventSubscriptionOptions, r as EntitySchedule, s as IEntityUpdate, t as EntityPriorityModel, u as IEntitySnapshotProvider, v as IEventData, y as IEntityContextCache } from "../index-0hg5PXZe.cjs";
|
|
3
|
+
export { EntityEventSubscriptionFilter, EntityEventSubscriptionOptions, EntityEventUid, EntityPriorityModel, EntityProxy, EntityRuntimePendingGroupOptions, EntitySchedule, EntityTypeUid, EntityUid, EntityUpdateType, IEntity, IEntityConfigSnapshot, IEntityContextCache, IEntityDispatchGroup, IEntityEvent, IEntityEventsDispatcher, IEntityEventsManager, IEntityModel, IEntityProxy, IEntityProxyRepository, IEntityRepository, IEntityRuntimeScheduler, IEntitySnapshot, IEntitySnapshotProvider, IEntityUpdate, IEventData, ProxyTypesOf, RequiredProxies, SchedulerPauseType, TypedEntityProxy };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as IEntity, c as IEntityProxy, d as TypedEntityProxy, i as EntityUid, l as IEntityProxyRepository, o as IEntityModel, r as EntityTypeUid, s as EntityProxy, u as
|
|
2
|
-
import { _ as
|
|
3
|
-
export { EntityEventSubscriptionFilter, EntityEventSubscriptionOptions, EntityEventUid, EntityProxy, EntitySchedule, EntityTypeUid, EntityUid, EntityUpdateType, IEntity, IEntityConfigSnapshot, IEntityContextCache, IEntityEvent, IEntityEventsDispatcher, IEntityEventsManager, IEntityModel, IEntityProxy, IEntityProxyRepository, IEntityRepository,
|
|
1
|
+
import { a as IEntity, c as IEntityProxy, d as RequiredProxies, f as TypedEntityProxy, i as EntityUid, l as IEntityProxyRepository, o as IEntityModel, r as EntityTypeUid, s as EntityProxy, u as ProxyTypesOf } from "../index-Tznk33g6.mjs";
|
|
2
|
+
import { _ as IEntityEventsManager, a as IEntityDispatchGroup, b as IEntityConfigSnapshot, c as SchedulerPauseType, d as IEntityRepository, f as EntityEventSubscriptionFilter, g as IEntityEventsDispatcher, h as IEntityEvent, i as EntityUpdateType, l as IEntitySnapshot, m as EntityEventUid, n as EntityRuntimePendingGroupOptions, o as IEntityRuntimeScheduler, p as EntityEventSubscriptionOptions, r as EntitySchedule, s as IEntityUpdate, t as EntityPriorityModel, u as IEntitySnapshotProvider, v as IEventData, y as IEntityContextCache } from "../index--9JJtMKF.mjs";
|
|
3
|
+
export { EntityEventSubscriptionFilter, EntityEventSubscriptionOptions, EntityEventUid, EntityPriorityModel, EntityProxy, EntityRuntimePendingGroupOptions, EntitySchedule, EntityTypeUid, EntityUid, EntityUpdateType, IEntity, IEntityConfigSnapshot, IEntityContextCache, IEntityDispatchGroup, IEntityEvent, IEntityEventsDispatcher, IEntityEventsManager, IEntityModel, IEntityProxy, IEntityProxyRepository, IEntityRepository, IEntityRuntimeScheduler, IEntitySnapshot, IEntitySnapshotProvider, IEntityUpdate, IEventData, ProxyTypesOf, RequiredProxies, SchedulerPauseType, TypedEntityProxy };
|
package/dist/entities/index.mjs
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
|
-
//#region src/entities/entity-
|
|
2
|
-
/**
|
|
3
|
-
* Specifies the action to be performed on an entity.
|
|
4
|
-
* Updates are categorized to enable different processing paths in the runtime.
|
|
5
|
-
*/
|
|
1
|
+
//#region src/entities/entity-scheduler.ts
|
|
6
2
|
let EntityUpdateType = /* @__PURE__ */ function(EntityUpdateType) {
|
|
7
|
-
/**
|
|
8
|
-
* Indicates the entity should be updated with new data.
|
|
9
|
-
*/
|
|
10
3
|
EntityUpdateType["update"] = "update";
|
|
11
|
-
/**
|
|
12
|
-
* Indicates the entity should be removed from the system.
|
|
13
|
-
*/
|
|
14
4
|
EntityUpdateType["remove"] = "remove";
|
|
15
5
|
return EntityUpdateType;
|
|
16
6
|
}({});
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/entities/entity-scheduler.ts
|
|
19
|
-
/**
|
|
20
|
-
* Controls which scheduling modes are paused.
|
|
21
|
-
*/
|
|
22
7
|
let SchedulerPauseType = /* @__PURE__ */ function(SchedulerPauseType) {
|
|
23
|
-
/** Pause both interval timers and frame subscriptions. */
|
|
24
8
|
SchedulerPauseType["full"] = "full";
|
|
25
|
-
/** Pause only frame subscriptions. Interval timers continue firing. */
|
|
26
9
|
SchedulerPauseType["perFrame"] = "perFrame";
|
|
27
|
-
/** Pause only interval timers. Frame subscriptions continue. */
|
|
28
10
|
SchedulerPauseType["intervals"] = "intervals";
|
|
29
11
|
return SchedulerPauseType;
|
|
30
12
|
}({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/entities/entity-
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/entities/entity-scheduler.ts"],"sourcesContent":["import { EntityTypeUid, EntityUid, IEntity, IEntityModel } from './entity';\nimport { IEntityConfigSnapshot } from './entity-config';\nimport { IEntityEvent, IEventData } from './entity-events';\nimport { IEntityProxy } from './entity-proxies';\nimport { IEntitySnapshot } from './entity-snapshot';\n\nexport enum EntityUpdateType {\n update = 'update',\n remove = 'remove'\n}\n\nexport interface IEntityUpdate {\n readonly type: EntityUpdateType;\n readonly entity: IEntityProxy;\n readonly model?: IEntityModel;\n readonly snapshot?: IEntitySnapshot;\n readonly config?: IEntityConfigSnapshot;\n}\n\nexport interface IEntityDispatchGroup {\n readonly entityType: EntityTypeUid;\n readonly updates: ReadonlyArray<IEntityUpdate>;\n readonly dirtyUpdates: number;\n readonly scheduledUpdates: number;\n readonly removeUpdates: number;\n readonly pipelineMask?: number;\n}\n\nexport type EntityRuntimePendingGroupOptions = {\n readonly includeFrameSubscriptions?: boolean;\n};\n\nexport type EntitySchedule = {\n readonly proxy: IEntityProxy;\n readonly intervalMs?: number;\n};\n\nexport type EntityPriorityModel = {\n readonly defaultPriority?: number;\n readonly entityTypes?: ReadonlyMap<EntityTypeUid, number>;\n};\n\nexport enum SchedulerPauseType {\n full = 'full',\n perFrame = 'perFrame',\n intervals = 'intervals'\n}\n\nexport interface IEntityRuntimeScheduler {\n readonly dirtyCount: number;\n readonly rawDirtyCount: number;\n readonly pendingCount: number;\n\n enqueue(update: IEntityUpdate): void;\n enqueueEvent(entity: IEntityProxy, event: IEntityEvent<IEventData>): void;\n enqueueEvents(entity: IEntityProxy, events: ReadonlyArray<IEntityEvent<IEventData>>): void;\n\n schedule(proxy: IEntityProxy, intervalMs?: number): void;\n removeSchedule(proxy: IEntityProxy): void;\n hasSchedule(proxy: IEntityProxy): boolean;\n\n takePendingGroups(\n maxItems?: number,\n options?: EntityRuntimePendingGroupOptions\n ): ReadonlyArray<IEntityDispatchGroup>;\n}\n"],"mappings":";AAMA,IAAY,mBAAL,yBAAA,kBAAA;CACL,iBAAA,YAAA;CACA,iBAAA,YAAA;;AACF,EAAA,CAAA,CAAA;AAiCA,IAAY,qBAAL,yBAAA,oBAAA;CACL,mBAAA,UAAA;CACA,mBAAA,cAAA;CACA,mBAAA,eAAA;;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/factories/pipeline-factory.ts"],"sourcesContent":["import { IPipelineContext } from '../pipelines';\
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/factories/pipeline-factory.ts"],"sourcesContent":["import type { IPipelineContext } from '../pipelines';\nimport { IPipeline } from '../pipelines/pipeline';\n\n/**\n * Category identifier for grouping performance metrics.\n * Typed as string to allow extension beyond the built-in {@link PipelineCategory} values.\n */\nexport type PipelineCategoryName = string;\n\n/**\n * Built-in metric categories for classifying pipeline and middleware performance entries.\n *\n * - `module` — System module pipelines (initialize, config, update, render, sync phases).\n * - `runtime` — Runtime orchestration pipeline and its middleware.\n * - `system` — Individual system middleware within a module pipeline.\n */\nexport enum PipelineCategory {\n module = 'module',\n runtime = 'runtime',\n system = 'system'\n}\n\n/**\n * Options for identifying and categorizing performance metrics on pipelines.\n */\nexport type PipelineOptions = {\n /** Display name for the pipeline in performance metrics. */\n pipelineName: string;\n /** Category assigned to pipeline-level metric entries. */\n pipelineCategory: PipelineCategoryName;\n /** Category assigned to per-middleware metric entries within this pipeline. */\n middlewareCategory: PipelineCategoryName;\n};\n\n/**\n * Creates pipeline instances for various contexts.\n * Abstracts pipeline creation to support different implementations.\n * Used by the system to instantiate pipelines without coupling to specific implementations.\n */\nexport interface IPipelineFactory {\n /**\n * Creates a new pipeline for the specified context type.\n * @template TContext - The context type for the pipeline. Must extend IPipelineContext.\n * @param options - Optional performance metric options (name, category) for the pipeline.\n * @returns A new pipeline instance ready for middleware registration.\n */\n createPipeline<TContext extends IPipelineContext>(options?: PipelineOptions): IPipeline<TContext>;\n}\n"],"mappings":";;;;;;;;;AAgBA,IAAY,mBAAL,yBAAA,kBAAA;CACL,iBAAA,YAAA;CACA,iBAAA,aAAA;CACA,iBAAA,YAAA;;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { IContextFactory, IPipelineFactory,
|
|
1
|
+
import { _ as PipelineCategoryName, g as PipelineCategory, h as IPipelineFactory, t as ISystemsFactory, v as PipelineOptions, y as IContextFactory } from "../index-CPGVaS-_.cjs";
|
|
2
|
+
export { IContextFactory, IPipelineFactory, ISystemsFactory, PipelineCategory, PipelineCategoryName, PipelineOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { IContextFactory, IPipelineFactory,
|
|
1
|
+
import { _ as PipelineCategoryName, g as PipelineCategory, h as IPipelineFactory, t as ISystemsFactory, v as PipelineOptions, y as IContextFactory } from "../index-BOS-47DQ.mjs";
|
|
2
|
+
export { IContextFactory, IPipelineFactory, ISystemsFactory, PipelineCategory, PipelineCategoryName, PipelineOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/factories/pipeline-factory.ts"],"sourcesContent":["import { IPipelineContext } from '../pipelines';\
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/factories/pipeline-factory.ts"],"sourcesContent":["import type { IPipelineContext } from '../pipelines';\nimport { IPipeline } from '../pipelines/pipeline';\n\n/**\n * Category identifier for grouping performance metrics.\n * Typed as string to allow extension beyond the built-in {@link PipelineCategory} values.\n */\nexport type PipelineCategoryName = string;\n\n/**\n * Built-in metric categories for classifying pipeline and middleware performance entries.\n *\n * - `module` — System module pipelines (initialize, config, update, render, sync phases).\n * - `runtime` — Runtime orchestration pipeline and its middleware.\n * - `system` — Individual system middleware within a module pipeline.\n */\nexport enum PipelineCategory {\n module = 'module',\n runtime = 'runtime',\n system = 'system'\n}\n\n/**\n * Options for identifying and categorizing performance metrics on pipelines.\n */\nexport type PipelineOptions = {\n /** Display name for the pipeline in performance metrics. */\n pipelineName: string;\n /** Category assigned to pipeline-level metric entries. */\n pipelineCategory: PipelineCategoryName;\n /** Category assigned to per-middleware metric entries within this pipeline. */\n middlewareCategory: PipelineCategoryName;\n};\n\n/**\n * Creates pipeline instances for various contexts.\n * Abstracts pipeline creation to support different implementations.\n * Used by the system to instantiate pipelines without coupling to specific implementations.\n */\nexport interface IPipelineFactory {\n /**\n * Creates a new pipeline for the specified context type.\n * @template TContext - The context type for the pipeline. Must extend IPipelineContext.\n * @param options - Optional performance metric options (name, category) for the pipeline.\n * @returns A new pipeline instance ready for middleware registration.\n */\n createPipeline<TContext extends IPipelineContext>(options?: PipelineOptions): IPipeline<TContext>;\n}\n"],"mappings":";;;;;;;;AAgBA,IAAY,mBAAL,yBAAA,kBAAA;CACL,iBAAA,YAAA;CACA,iBAAA,aAAA;CACA,iBAAA,YAAA;;AACF,EAAA,CAAA,CAAA"}
|