@awesome-ecs/abstract 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs.map +1 -1
- package/dist/entities/index.cjs.map +1 -1
- package/dist/entities/index.d.cts +3 -3
- package/dist/entities/index.d.mts +3 -3
- package/dist/entities/index.mjs.map +1 -1
- package/dist/factories/index.cjs +1 -1
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +1 -1
- package/dist/factories/index.d.mts +1 -1
- package/dist/factories/index.mjs +1 -1
- package/dist/factories/index.mjs.map +1 -1
- package/dist/{index-zohK7ftH.d.cts → index-B1OYkMOx.d.cts} +197 -350
- package/dist/{index-BguFn1Xj.d.cts → index-BGLTfuj8.d.cts} +24 -4
- package/dist/{identity-component-CuWHf7jX.d.mts → index-C0jDrUBA.d.cts} +81 -70
- package/dist/{index-kNcUiDBd.d.mts → index-C1hRAjM-.d.mts} +24 -4
- package/dist/index-CeqaKmWR.d.mts +218 -0
- package/dist/{index-DZlhICMZ.d.mts → index-D3rS2RFG.d.mts} +197 -350
- package/dist/index-DMTkNY1e.d.cts +218 -0
- package/dist/{identity-component-DLDaOTyK.d.cts → index-b5BtWAvO.d.mts} +81 -70
- package/dist/pipelines/index.d.cts +1 -1
- package/dist/pipelines/index.d.mts +1 -1
- package/dist/systems/index.cjs +9 -4
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +2 -2
- package/dist/systems/index.d.mts +2 -2
- package/dist/systems/index.mjs +9 -4
- package/dist/systems/index.mjs.map +1 -1
- package/dist/types-Bbmnq4ni.d.cts +74 -0
- package/dist/types-C1ojaDL4.d.mts +74 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +3 -3
- package/dist/utils/index.d.mts +3 -3
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import {
|
|
1
|
+
import { _ as ConfigRecord, a as IEntity, c as IEntityProxy, f as ComponentTypeUid, i as EntityUid, l as IEntityProxyRepository, o as IEntityModel, r as EntityTypeUid, s as EntityProxy } from "./index-C0jDrUBA.cjs";
|
|
2
|
+
import { r as Immutable } from "./types-Bbmnq4ni.cjs";
|
|
3
|
+
import { c as IEntitySnapshot, d as EntityEventSubscriptionOptions, f as EntityEventUid, g as IEventData, o as IEntityUpdate, p as IEntityEvent, v as IEntityConfigSnapshot } from "./index-BGLTfuj8.cjs";
|
|
4
|
+
import { c as IMiddleware, l as IPipelineContext, o as IPipeline, u as PipelineRuntime } from "./index-DMTkNY1e.cjs";
|
|
3
5
|
|
|
4
|
-
//#region src/utils/dispatch-sequential.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Executes a function for each item in an iterable, sequentially.
|
|
7
|
-
*
|
|
8
|
-
* Uses a sync fast-path: iterates synchronously until the first Promise is
|
|
9
|
-
* encountered, then switches to async for the remainder. If no item produces
|
|
10
|
-
* a Promise, the entire call stays synchronous with zero async overhead.
|
|
11
|
-
*
|
|
12
|
-
* @param items - The iterable to iterate over.
|
|
13
|
-
* @param fn - The function to call for each item. May return void or a Promise.
|
|
14
|
-
* @returns void if all calls were synchronous, or a Promise if any were async.
|
|
15
|
-
*/
|
|
16
|
-
declare function dispatchSequential<T>(items: Iterable<T>, fn: (item: T) => void | Promise<void>): void | Promise<void>;
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/utils/json-serializer.d.ts
|
|
19
|
-
/**
|
|
20
|
-
* Custom JSON serialization and deserialization interface.
|
|
21
|
-
* Allows different serialization strategies for handling complex types.
|
|
22
|
-
* Used for entity snapshots, events, and any data needing JSON conversion.
|
|
23
|
-
*/
|
|
24
|
-
interface IJsonSerializer {
|
|
25
|
-
/**
|
|
26
|
-
* Converts an object to a serializable JSON representation.
|
|
27
|
-
* Handles types that don't serialize naturally (dates, maps, custom objects, etc.).
|
|
28
|
-
* @param value - The object to serialize.
|
|
29
|
-
* @returns A JSON-serializable representation.
|
|
30
|
-
*/
|
|
31
|
-
serializeCustom(value: object): string;
|
|
32
|
-
/**
|
|
33
|
-
* Converts a JSON string back to its original object type.
|
|
34
|
-
* Reconstructs complex types from their serialized form.
|
|
35
|
-
* @template TObject - The target object type.
|
|
36
|
-
* @param text - The JSON string to deserialize.
|
|
37
|
-
* @returns The deserialized object of the specified type.
|
|
38
|
-
*/
|
|
39
|
-
parseCustom<TObject>(text: string): TObject;
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
6
|
//#region src/utils/logger.d.ts
|
|
43
7
|
/**
|
|
44
8
|
* Logger interface for debug and diagnostic output.
|
|
@@ -114,320 +78,55 @@ interface ILoggerOptions {
|
|
|
114
78
|
enabled: Map<LogLevel, boolean>;
|
|
115
79
|
}
|
|
116
80
|
//#endregion
|
|
117
|
-
//#region src/
|
|
118
|
-
type TickMetricEntry = {
|
|
119
|
-
name: string;
|
|
120
|
-
category: string;
|
|
121
|
-
totalMs: number;
|
|
122
|
-
count: number;
|
|
123
|
-
};
|
|
124
|
-
type TickSnapshot = {
|
|
125
|
-
tickIndex: number;
|
|
126
|
-
tickDurationMs: number;
|
|
127
|
-
fps: number;
|
|
128
|
-
queueSize: number;
|
|
129
|
-
timestamp: number;
|
|
130
|
-
metrics: TickMetricEntry[];
|
|
131
|
-
render?: RenderSnapshot;
|
|
132
|
-
};
|
|
133
|
-
type RenderSnapshot = {
|
|
134
|
-
frameTimeMs: number;
|
|
135
|
-
renderTimeMs: number;
|
|
136
|
-
gpuFrameTimeMs: number;
|
|
137
|
-
drawCalls: number;
|
|
138
|
-
activeMeshesEvalMs: number;
|
|
139
|
-
cameraRenderMs: number;
|
|
140
|
-
totalVertices: number;
|
|
141
|
-
activeIndices: number;
|
|
142
|
-
};
|
|
143
|
-
type MiddlewareMetricsSummary = {
|
|
144
|
-
name: string;
|
|
145
|
-
category: PipelineCategoryName;
|
|
146
|
-
count: number;
|
|
147
|
-
totalMs: number;
|
|
148
|
-
avgMs: number;
|
|
149
|
-
minMs: number;
|
|
150
|
-
maxMs: number;
|
|
151
|
-
lastMs: number;
|
|
152
|
-
};
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/utils/performance-timer.d.ts
|
|
155
|
-
/**
|
|
156
|
-
* Unique identifier for a timer instance.
|
|
157
|
-
*/
|
|
158
|
-
type PerformanceTimerUid = number;
|
|
159
|
-
/**
|
|
160
|
-
* Options for identifying and categorizing performance metrics.
|
|
161
|
-
* Used by pipeline factories and performance decorators.
|
|
162
|
-
*/
|
|
163
|
-
type PerformanceMetricOptions = {
|
|
164
|
-
name?: string;
|
|
165
|
-
category?: string;
|
|
166
|
-
};
|
|
167
|
-
/**
|
|
168
|
-
* Record of a completed timer measurement.
|
|
169
|
-
* Captures timing information for performance analysis and profiling.
|
|
170
|
-
*/
|
|
171
|
-
interface PerformanceTimeEntry {
|
|
172
|
-
/**
|
|
173
|
-
* The name identifying this timer.
|
|
174
|
-
*/
|
|
175
|
-
name: string;
|
|
176
|
-
/**
|
|
177
|
-
* The category of this metric (e.g. 'module', 'runtime', 'system').
|
|
178
|
-
*/
|
|
179
|
-
category?: string;
|
|
180
|
-
/**
|
|
181
|
-
* Timestamp in milliseconds when the timer started.
|
|
182
|
-
*/
|
|
183
|
-
startedAt: number;
|
|
184
|
-
/**
|
|
185
|
-
* Timestamp in milliseconds when the timer ended.
|
|
186
|
-
*/
|
|
187
|
-
endedAt?: number;
|
|
188
|
-
/**
|
|
189
|
-
* Duration in milliseconds that elapsed.
|
|
190
|
-
*/
|
|
191
|
-
msPassed?: number;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Interface for measuring operation duration.
|
|
195
|
-
* Provides start/stop functionality for performance profiling.
|
|
196
|
-
* Used throughout the system to collect timing metrics.
|
|
197
|
-
*/
|
|
198
|
-
interface IPerformanceTimer {
|
|
199
|
-
/**
|
|
200
|
-
* Starts a new timer.
|
|
201
|
-
* @param name - Label for this timer (used in results).
|
|
202
|
-
* @param category - Optional category for grouping metrics.
|
|
203
|
-
* @returns A unique identifier for this timer instance.
|
|
204
|
-
*/
|
|
205
|
-
startTimer(name: string, category?: string): PerformanceTimerUid;
|
|
206
|
-
/**
|
|
207
|
-
* Stops a timer and returns the recorded metrics.
|
|
208
|
-
* @param timerUid - The timer identifier returned by startTimer.
|
|
209
|
-
* @returns Complete timing entry with start, end, and duration.
|
|
210
|
-
*/
|
|
211
|
-
endTimer(timerUid: PerformanceTimerUid): PerformanceTimeEntry;
|
|
212
|
-
}
|
|
213
|
-
//#endregion
|
|
214
|
-
//#region src/pipelines/pipeline-context.d.ts
|
|
215
|
-
/**
|
|
216
|
-
* Base interface for all pipeline context objects.
|
|
217
|
-
* Provides hooks for runtime state and control flow during pipeline execution.
|
|
218
|
-
*/
|
|
219
|
-
interface IPipelineContext {
|
|
220
|
-
/**
|
|
221
|
-
* The runtime state and control interface for the pipeline.
|
|
222
|
-
* Allows middleware to query and influence pipeline behavior.
|
|
223
|
-
*/
|
|
224
|
-
readonly runtime?: PipelineRuntime;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Runtime state and control interface for pipeline execution.
|
|
228
|
-
* Allows middleware to query status and influence pipeline flow.
|
|
229
|
-
*/
|
|
230
|
-
type PipelineRuntime = {
|
|
231
|
-
/**
|
|
232
|
-
* Flag to request pipeline halt.
|
|
233
|
-
* Set to true to stop executing remaining middleware (cleanup still runs).
|
|
234
|
-
*/
|
|
235
|
-
shouldStop?: boolean;
|
|
236
|
-
/**
|
|
237
|
-
* Optional error state if an exception occurred during execution.
|
|
238
|
-
*/
|
|
239
|
-
error?: any;
|
|
240
|
-
/**
|
|
241
|
-
* Results collected from middleware execution.
|
|
242
|
-
* Typically includes performance metrics and operational results.
|
|
243
|
-
*/
|
|
244
|
-
readonly metrics?: PerformanceTimeEntry[];
|
|
245
|
-
};
|
|
246
|
-
//#endregion
|
|
247
|
-
//#region src/pipelines/middleware.d.ts
|
|
248
|
-
/**
|
|
249
|
-
* The basic unit of work in a pipeline.
|
|
250
|
-
* Middleware are chained together to form processing pipelines.
|
|
251
|
-
* Each middleware can inspect/modify context during dispatch and perform cleanup on their changes.
|
|
252
|
-
*
|
|
253
|
-
* @template TContext The context type passed through the middleware chain.
|
|
254
|
-
*/
|
|
255
|
-
interface IMiddleware<TContext extends IPipelineContext> {
|
|
256
|
-
/**
|
|
257
|
-
* Optional name for debugging and logging purposes.
|
|
258
|
-
*/
|
|
259
|
-
readonly name?: string;
|
|
260
|
-
/**
|
|
261
|
-
* Optional guard condition before running the action.
|
|
262
|
-
* Allows middleware to skip execution based on context state.
|
|
263
|
-
* @param context The current pipeline context.
|
|
264
|
-
* @returns True to execute action, false to skip.
|
|
265
|
-
*/
|
|
266
|
-
shouldRun?(context: TContext): boolean;
|
|
267
|
-
/**
|
|
268
|
-
* The main unit of work executed as part of the pipeline.
|
|
269
|
-
* Middlewares execute in registration order during dispatch phase.
|
|
270
|
-
* Can read and modify the context to influence downstream middleware and results.
|
|
271
|
-
* @param context The pipeline context containing all relevant state.
|
|
272
|
-
*/
|
|
273
|
-
action(context: TContext): void | Promise<void>;
|
|
274
|
-
/**
|
|
275
|
-
* Optional cleanup function executed during pipeline teardown.
|
|
276
|
-
* Middlewares execute in reverse registration order during cleanup phase.
|
|
277
|
-
* Used to release resources, clear temporary state, and perform final operations.
|
|
278
|
-
* @param context The pipeline context (may be in modified state from action phases).
|
|
279
|
-
*/
|
|
280
|
-
cleanup?(context: TContext): void | Promise<void>;
|
|
281
|
-
}
|
|
282
|
-
//#endregion
|
|
283
|
-
//#region src/pipelines/middleware-runner.d.ts
|
|
284
|
-
/**
|
|
285
|
-
* Customizes how middleware is executed within a pipeline.
|
|
286
|
-
* Allows decorators to wrap, intercept, or modify middleware execution behavior.
|
|
287
|
-
* Useful for implementing middleware decorators (logging, timing, error handling, etc.).
|
|
288
|
-
*
|
|
289
|
-
* @template TContext The type of context passed to middleware.
|
|
290
|
-
*/
|
|
291
|
-
interface IMiddlewareRunner<TContext extends IPipelineContext> {
|
|
292
|
-
/**
|
|
293
|
-
* Decides how to execute a middleware's action.
|
|
294
|
-
* Can add pre/post processing, error handling, or performance tracking around the middleware.
|
|
295
|
-
* @param context The current pipeline context.
|
|
296
|
-
* @param middleware The middleware whose action should be executed.
|
|
297
|
-
*/
|
|
298
|
-
dispatch(context: TContext, middleware: IMiddleware<TContext>): void | Promise<void>;
|
|
299
|
-
/**
|
|
300
|
-
* Decides how to execute a middleware's cleanup.
|
|
301
|
-
* Can add pre/post processing or error handling around cleanup operations.
|
|
302
|
-
* @param context The current pipeline context.
|
|
303
|
-
* @param middleware The middleware whose cleanup should be executed.
|
|
304
|
-
*/
|
|
305
|
-
cleanup(context: TContext, middleware: IMiddleware<TContext>): void | Promise<void>;
|
|
306
|
-
}
|
|
307
|
-
//#endregion
|
|
308
|
-
//#region src/pipelines/pipeline.d.ts
|
|
309
|
-
/**
|
|
310
|
-
* A composable middleware chain for ordered execution of operations.
|
|
311
|
-
* Pipelines provide a framework for registering and executing middleware with dispatch and cleanup phases.
|
|
312
|
-
* Used throughout the ECS system for entity initialization, updates, rendering, and synchronization.
|
|
313
|
-
*
|
|
314
|
-
* @template TContext - The context type passed to all registered middleware.
|
|
315
|
-
*/
|
|
316
|
-
interface IPipeline<TContext extends IPipelineContext> {
|
|
317
|
-
/**
|
|
318
|
-
* The pipeline's name, useful for debugging and logging.
|
|
319
|
-
*/
|
|
320
|
-
readonly name?: string;
|
|
321
|
-
/**
|
|
322
|
-
* The number of middleware currently registered in this pipeline.
|
|
323
|
-
*/
|
|
324
|
-
readonly length?: number;
|
|
325
|
-
/**
|
|
326
|
-
* Direct access to the ordered list of registered middleware.
|
|
327
|
-
* Allows inspection of the execution chain.
|
|
328
|
-
*/
|
|
329
|
-
readonly middleware?: Immutable<IMiddleware<TContext>[]>;
|
|
330
|
-
/**
|
|
331
|
-
* Registers middleware to be executed as part of this pipeline.
|
|
332
|
-
* Middleware is added to the end of the chain and executed in registration order during dispatch.
|
|
333
|
-
* @param middleware - The middleware to register.
|
|
334
|
-
* @returns This instance for method chaining.
|
|
335
|
-
*/
|
|
336
|
-
use(middleware: Immutable<IMiddleware<TContext>>): this;
|
|
337
|
-
/**
|
|
338
|
-
* Executes the dispatch phase with all registered middleware in order.
|
|
339
|
-
* Each middleware's action is called, allowing modifications to context state.
|
|
340
|
-
* Execution continues until all middleware complete or a middleware requests early termination.
|
|
341
|
-
* @param context - The context object passed to all middleware.
|
|
342
|
-
*/
|
|
343
|
-
dispatch(context: Partial<TContext>): void | Promise<void>;
|
|
344
|
-
/**
|
|
345
|
-
* Executes the cleanup phase with all registered middleware in reverse order.
|
|
346
|
-
* Allows middleware to perform resource cleanup and final operations.
|
|
347
|
-
* Typically called after dispatch to ensure proper teardown.
|
|
348
|
-
*
|
|
349
|
-
* @param context - The context object that will be passed to each middleware function.
|
|
350
|
-
*/
|
|
351
|
-
cleanup(context: Partial<TContext>): void | Promise<void>;
|
|
352
|
-
}
|
|
353
|
-
//#endregion
|
|
354
|
-
//#region src/pipelines/pipeline-nested.d.ts
|
|
81
|
+
//#region src/systems/pipeline/system-context-config.d.ts
|
|
355
82
|
/**
|
|
356
|
-
*
|
|
357
|
-
* Allows coordination between outer and inner pipeline execution.
|
|
83
|
+
* Config-specific API for the current system execution.
|
|
358
84
|
*
|
|
359
|
-
*
|
|
85
|
+
* The runtime applies config patches before the config phase runs. This context
|
|
86
|
+
* records the component config values immediately before the patch was applied,
|
|
87
|
+
* then exposes both previous and current values to config middleware.
|
|
360
88
|
*/
|
|
361
|
-
interface
|
|
89
|
+
interface ISystemContextConfigReadonly {
|
|
362
90
|
/**
|
|
363
|
-
*
|
|
91
|
+
* Returns true when the current entity update included a config patch for
|
|
92
|
+
* this component type.
|
|
364
93
|
*/
|
|
365
|
-
|
|
94
|
+
hasChanged(componentType: ComponentTypeUid): boolean;
|
|
366
95
|
/**
|
|
367
|
-
*
|
|
368
|
-
*
|
|
96
|
+
* Returns the component's current config values after the runtime-applied
|
|
97
|
+
* config patch.
|
|
369
98
|
*/
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Context for a nested pipeline.
|
|
374
|
-
* Provides access to both current and previous nested context data plus the parent context.
|
|
375
|
-
*
|
|
376
|
-
* @template P - The context type of the parent pipeline.
|
|
377
|
-
*/
|
|
378
|
-
interface INestedContext<P extends IParentContext<any>> extends IPipelineContext {
|
|
99
|
+
getCurrentValue<TConfig extends ConfigRecord>(componentType: ComponentTypeUid): Immutable<TConfig> | undefined;
|
|
379
100
|
/**
|
|
380
|
-
*
|
|
101
|
+
* Returns the component config values captured immediately before the
|
|
102
|
+
* runtime-applied config patch, or undefined when the component did not
|
|
103
|
+
* change in this update.
|
|
381
104
|
*/
|
|
382
|
-
|
|
105
|
+
getPreviousValue<TConfig extends ConfigRecord>(componentType: ComponentTypeUid): Immutable<TConfig> | undefined;
|
|
383
106
|
/**
|
|
384
|
-
*
|
|
107
|
+
* Queues a config update for an entity. Config updates use the normal entity
|
|
108
|
+
* update path, but carry only component config patches.
|
|
385
109
|
*/
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Reference back to the parent pipeline context.
|
|
389
|
-
*/
|
|
390
|
-
readonly parent: P;
|
|
110
|
+
updateConfig<TConfig extends ConfigRecord>(target: IEntityProxy, config: IEntityConfigSnapshot<TConfig>): void;
|
|
391
111
|
}
|
|
392
112
|
/**
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
* @template P - The context type of the parent pipeline.
|
|
396
|
-
*/
|
|
397
|
-
type INestedMiddleware<P extends IParentContext<any>> = IMiddleware<INestedContext<P>>;
|
|
398
|
-
/**
|
|
399
|
-
* Middleware executing within a parent pipeline (containing nested pipelines).
|
|
113
|
+
* Config-specific API for the current system execution.
|
|
400
114
|
*
|
|
401
|
-
*
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
//#endregion
|
|
405
|
-
//#region src/pipelines/pipeline-runner.d.ts
|
|
406
|
-
/**
|
|
407
|
-
* Executes an array of middleware in a controlled sequence.
|
|
408
|
-
* Supports custom execution strategies through implementation flexibility.
|
|
409
|
-
* Used by pipelines to manage complex middleware chains with features like early termination and nested pipelines.
|
|
115
|
+
* The runtime applies config patches before the config phase runs. This context
|
|
116
|
+
* records the component config values immediately before the patch was applied,
|
|
117
|
+
* then exposes both previous and current values to config middleware.
|
|
410
118
|
*
|
|
411
|
-
*
|
|
119
|
+
* The mutable API includes an `applyConfig` method for the runtime to set the current update,
|
|
120
|
+
* apply its config patch, and capture previous values.
|
|
121
|
+
* Systems middleware should use the readonly variant.
|
|
412
122
|
*/
|
|
413
|
-
interface
|
|
123
|
+
interface ISystemContextConfig extends ISystemContextConfigReadonly {
|
|
414
124
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
* @param context - The context passed to each middleware action.
|
|
419
|
-
* @param middleware - The ordered middleware array to execute.
|
|
420
|
-
* @param startIndex - Optional starting position in the middleware array (default: 0).
|
|
125
|
+
* Sets the current entity update, applies its config patch, and captures previous values for change detection.
|
|
126
|
+
* @param update The current entity update.
|
|
127
|
+
* @param isInitializing Specify whether the entity is initializing.
|
|
421
128
|
*/
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Executes the cleanup phase of all middleware in reverse order.
|
|
425
|
-
* All middleware cleanup functions are called (if defined), regardless of errors.
|
|
426
|
-
* Allows proper resource release and final state management.
|
|
427
|
-
* @param context - The context passed to each middleware cleanup.
|
|
428
|
-
* @param middleware - The ordered middleware array for cleanup (reversed during execution).
|
|
429
|
-
*/
|
|
430
|
-
cleanup(context: Partial<TContext>, middleware: IMiddleware<TContext>[]): void | Promise<void>;
|
|
129
|
+
applyConfig(update: IEntityUpdate | undefined, isInitializing?: boolean): void;
|
|
431
130
|
}
|
|
432
131
|
//#endregion
|
|
433
132
|
//#region src/systems/pipeline/system-middleware.d.ts
|
|
@@ -672,7 +371,7 @@ interface ISystemContextRepository {
|
|
|
672
371
|
*/
|
|
673
372
|
getEntity<TEntity extends IEntity>(proxy: EntityProxy<TEntity> | EntityTypeUid): Immutable<TEntity>;
|
|
674
373
|
/**
|
|
675
|
-
*
|
|
374
|
+
* Enqueues an entity for update.
|
|
676
375
|
* Triggers the update pipeline for the entity.
|
|
677
376
|
* @param target - Optional specific entity to update. Defaults to current entity in context.
|
|
678
377
|
*/
|
|
@@ -693,7 +392,7 @@ interface ISystemContextRepository {
|
|
|
693
392
|
*/
|
|
694
393
|
interface ISystemContextScheduler {
|
|
695
394
|
/**
|
|
696
|
-
* Schedules an entity
|
|
395
|
+
* Schedules or replaces an entity update schedule.
|
|
697
396
|
* If no target is specified, schedules the current entity.
|
|
698
397
|
* If no interval is specified, schedules on a default interval.
|
|
699
398
|
* @param target - Optional entity to schedule. Defaults to current entity in context.
|
|
@@ -714,6 +413,30 @@ interface ISystemContextScheduler {
|
|
|
714
413
|
hasSchedule(target?: IEntityProxy): boolean;
|
|
715
414
|
}
|
|
716
415
|
//#endregion
|
|
416
|
+
//#region src/utils/json-serializer.d.ts
|
|
417
|
+
/**
|
|
418
|
+
* Custom JSON serialization and deserialization interface.
|
|
419
|
+
* Allows different serialization strategies for handling complex types.
|
|
420
|
+
* Used for entity snapshots, events, and any data needing JSON conversion.
|
|
421
|
+
*/
|
|
422
|
+
interface IJsonSerializer {
|
|
423
|
+
/**
|
|
424
|
+
* Converts an object to a serializable JSON representation.
|
|
425
|
+
* Handles types that don't serialize naturally (dates, maps, custom objects, etc.).
|
|
426
|
+
* @param value - The object to serialize.
|
|
427
|
+
* @returns A JSON-serializable representation.
|
|
428
|
+
*/
|
|
429
|
+
serializeCustom(value: object): string;
|
|
430
|
+
/**
|
|
431
|
+
* Converts a JSON string back to its original object type.
|
|
432
|
+
* Reconstructs complex types from their serialized form.
|
|
433
|
+
* @template TObject - The target object type.
|
|
434
|
+
* @param text - The JSON string to deserialize.
|
|
435
|
+
* @returns The deserialized object of the specified type.
|
|
436
|
+
*/
|
|
437
|
+
parseCustom<TObject>(text: string): TObject;
|
|
438
|
+
}
|
|
439
|
+
//#endregion
|
|
717
440
|
//#region src/systems/pipeline/system-context-snapshot.d.ts
|
|
718
441
|
/**
|
|
719
442
|
* System context API for entity serialization and state transfer.
|
|
@@ -766,6 +489,10 @@ interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
|
|
|
766
489
|
* The entity currently being processed by this middleware.
|
|
767
490
|
*/
|
|
768
491
|
readonly entity: Immutable<TEntity>;
|
|
492
|
+
/**
|
|
493
|
+
* Config metadata and config-update API for the current update.
|
|
494
|
+
*/
|
|
495
|
+
readonly config: Immutable<ISystemContextConfigReadonly>;
|
|
769
496
|
/**
|
|
770
497
|
* Information about the update triggering this system execution.
|
|
771
498
|
* Contains type (update/remove) and optional model/snapshot data.
|
|
@@ -787,10 +514,6 @@ interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
|
|
|
787
514
|
* Repository access API for querying and modifying entity storage.
|
|
788
515
|
*/
|
|
789
516
|
readonly repository: Immutable<ISystemContextRepository>;
|
|
790
|
-
/**
|
|
791
|
-
* The per-entity runtime state and control interface for this system context.
|
|
792
|
-
*/
|
|
793
|
-
readonly runtime: PipelineRuntime;
|
|
794
517
|
/**
|
|
795
518
|
* Scheduling API for requesting follow-up entity updates.
|
|
796
519
|
*/
|
|
@@ -803,6 +526,10 @@ interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
|
|
|
803
526
|
* Control API for enabling/disabling the current system or entire module during execution.
|
|
804
527
|
*/
|
|
805
528
|
readonly systems: Immutable<ISystemContextControl>;
|
|
529
|
+
/**
|
|
530
|
+
* The per-entity runtime state and control interface for this system context.
|
|
531
|
+
*/
|
|
532
|
+
readonly runtime: PipelineRuntime;
|
|
806
533
|
}
|
|
807
534
|
//#endregion
|
|
808
535
|
//#region src/systems/pipeline/system-context-mutable.d.ts
|
|
@@ -819,6 +546,117 @@ interface IMutableSystemContext<TEntity extends IEntity> extends ISystemContext<
|
|
|
819
546
|
setRuntime(runtime: PipelineRuntime): void;
|
|
820
547
|
}
|
|
821
548
|
//#endregion
|
|
549
|
+
//#region src/utils/dispatch-sequential.d.ts
|
|
550
|
+
/**
|
|
551
|
+
* Executes a function for each item in an iterable, sequentially.
|
|
552
|
+
*
|
|
553
|
+
* Uses a sync fast-path: iterates synchronously until the first Promise is
|
|
554
|
+
* encountered, then switches to async for the remainder. If no item produces
|
|
555
|
+
* a Promise, the entire call stays synchronous with zero async overhead.
|
|
556
|
+
*
|
|
557
|
+
* @param items - The iterable to iterate over.
|
|
558
|
+
* @param fn - The function to call for each item. May return void or a Promise.
|
|
559
|
+
* @returns void if all calls were synchronous, or a Promise if any were async.
|
|
560
|
+
*/
|
|
561
|
+
declare function dispatchSequential<T>(items: Iterable<T>, fn: (item: T) => void | Promise<void>): void | Promise<void>;
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region src/utils/performance.d.ts
|
|
564
|
+
type TickMetricEntry = {
|
|
565
|
+
name: string;
|
|
566
|
+
category: string;
|
|
567
|
+
totalMs: number;
|
|
568
|
+
count: number;
|
|
569
|
+
};
|
|
570
|
+
type TickSnapshot = {
|
|
571
|
+
tickIndex: number;
|
|
572
|
+
tickDurationMs: number;
|
|
573
|
+
fps: number;
|
|
574
|
+
queueSize: number;
|
|
575
|
+
timestamp: number;
|
|
576
|
+
metrics: TickMetricEntry[];
|
|
577
|
+
render?: RenderSnapshot;
|
|
578
|
+
};
|
|
579
|
+
type RenderSnapshot = {
|
|
580
|
+
frameTimeMs: number;
|
|
581
|
+
renderTimeMs: number;
|
|
582
|
+
gpuFrameTimeMs: number;
|
|
583
|
+
drawCalls: number;
|
|
584
|
+
activeMeshesEvalMs: number;
|
|
585
|
+
cameraRenderMs: number;
|
|
586
|
+
totalVertices: number;
|
|
587
|
+
activeIndices: number;
|
|
588
|
+
};
|
|
589
|
+
type MiddlewareMetricsSummary = {
|
|
590
|
+
name: string;
|
|
591
|
+
category: PipelineCategoryName;
|
|
592
|
+
count: number;
|
|
593
|
+
totalMs: number;
|
|
594
|
+
avgMs: number;
|
|
595
|
+
minMs: number;
|
|
596
|
+
maxMs: number;
|
|
597
|
+
lastMs: number;
|
|
598
|
+
};
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region src/utils/performance-timer.d.ts
|
|
601
|
+
/**
|
|
602
|
+
* Unique identifier for a timer instance.
|
|
603
|
+
*/
|
|
604
|
+
type PerformanceTimerUid = number;
|
|
605
|
+
/**
|
|
606
|
+
* Options for identifying and categorizing performance metrics.
|
|
607
|
+
* Used by pipeline factories and performance decorators.
|
|
608
|
+
*/
|
|
609
|
+
type PerformanceMetricOptions = {
|
|
610
|
+
name?: string;
|
|
611
|
+
category?: string;
|
|
612
|
+
};
|
|
613
|
+
/**
|
|
614
|
+
* Record of a completed timer measurement.
|
|
615
|
+
* Captures timing information for performance analysis and profiling.
|
|
616
|
+
*/
|
|
617
|
+
interface PerformanceTimeEntry {
|
|
618
|
+
/**
|
|
619
|
+
* The name identifying this timer.
|
|
620
|
+
*/
|
|
621
|
+
name: string;
|
|
622
|
+
/**
|
|
623
|
+
* The category of this metric (e.g. 'module', 'runtime', 'system').
|
|
624
|
+
*/
|
|
625
|
+
category?: string;
|
|
626
|
+
/**
|
|
627
|
+
* Timestamp in milliseconds when the timer started.
|
|
628
|
+
*/
|
|
629
|
+
startedAt: number;
|
|
630
|
+
/**
|
|
631
|
+
* Timestamp in milliseconds when the timer ended.
|
|
632
|
+
*/
|
|
633
|
+
endedAt?: number;
|
|
634
|
+
/**
|
|
635
|
+
* Duration in milliseconds that elapsed.
|
|
636
|
+
*/
|
|
637
|
+
msPassed?: number;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Interface for measuring operation duration.
|
|
641
|
+
* Provides start/stop functionality for performance profiling.
|
|
642
|
+
* Used throughout the system to collect timing metrics.
|
|
643
|
+
*/
|
|
644
|
+
interface IPerformanceTimer {
|
|
645
|
+
/**
|
|
646
|
+
* Starts a new timer.
|
|
647
|
+
* @param name - Label for this timer (used in results).
|
|
648
|
+
* @param category - Optional category for grouping metrics.
|
|
649
|
+
* @returns A unique identifier for this timer instance.
|
|
650
|
+
*/
|
|
651
|
+
startTimer(name: string, category?: string): PerformanceTimerUid;
|
|
652
|
+
/**
|
|
653
|
+
* Stops a timer and returns the recorded metrics.
|
|
654
|
+
* @param timerUid - The timer identifier returned by startTimer.
|
|
655
|
+
* @returns Complete timing entry with start, end, and duration.
|
|
656
|
+
*/
|
|
657
|
+
endTimer(timerUid: PerformanceTimerUid): PerformanceTimeEntry;
|
|
658
|
+
}
|
|
659
|
+
//#endregion
|
|
822
660
|
//#region src/factories/context-factory.d.ts
|
|
823
661
|
/**
|
|
824
662
|
* Creates and caches per-entity system contexts.
|
|
@@ -862,7 +700,7 @@ type PipelineCategoryName = string;
|
|
|
862
700
|
/**
|
|
863
701
|
* Built-in metric categories for classifying pipeline and middleware performance entries.
|
|
864
702
|
*
|
|
865
|
-
* - `module` — System module pipelines (initialize, update, render, sync phases).
|
|
703
|
+
* - `module` — System module pipelines (initialize, config, update, render, sync phases).
|
|
866
704
|
* - `runtime` — Runtime orchestration pipeline and its middleware.
|
|
867
705
|
* - `system` — Individual system middleware within a module pipeline.
|
|
868
706
|
*/
|
|
@@ -896,7 +734,7 @@ interface IPipelineFactory {
|
|
|
896
734
|
//#endregion
|
|
897
735
|
//#region src/systems/system-type.d.ts
|
|
898
736
|
/**
|
|
899
|
-
* The
|
|
737
|
+
* The five phases of entity system execution in each frame.
|
|
900
738
|
* Each phase serves a specific purpose in the entity lifecycle and can be extended by custom system types.
|
|
901
739
|
* The runtime handles each phase in order, allowing systems to perform stage-specific operations.
|
|
902
740
|
*/
|
|
@@ -906,21 +744,26 @@ declare enum SystemType {
|
|
|
906
744
|
* Runs once when the entity is first created or initialized.
|
|
907
745
|
*/
|
|
908
746
|
initialize = 0,
|
|
747
|
+
/**
|
|
748
|
+
* Config application and config-dependent resource reconciliation.
|
|
749
|
+
* Runs on entity creation and on updates that carry a config payload.
|
|
750
|
+
*/
|
|
751
|
+
config = 1,
|
|
909
752
|
/**
|
|
910
753
|
* Main logic and state updates for the entity.
|
|
911
754
|
* Runs on every update to change entity behavior and properties.
|
|
912
755
|
*/
|
|
913
|
-
update =
|
|
756
|
+
update = 2,
|
|
914
757
|
/**
|
|
915
758
|
* Output and visualization operations.
|
|
916
759
|
* Runs after updates to render or display the entity state.
|
|
917
760
|
*/
|
|
918
|
-
render =
|
|
761
|
+
render = 3,
|
|
919
762
|
/**
|
|
920
763
|
* Synchronization and persistence.
|
|
921
764
|
* Runs last to synchronize state with external systems or storage.
|
|
922
765
|
*/
|
|
923
|
-
sync =
|
|
766
|
+
sync = 4
|
|
924
767
|
}
|
|
925
768
|
//#endregion
|
|
926
769
|
//#region src/systems/module/systems-module-builder.d.ts
|
|
@@ -958,7 +801,7 @@ interface ISystemsModuleBuilder<TEntity extends IEntity> extends ISystemsModuleB
|
|
|
958
801
|
/**
|
|
959
802
|
* Registers middleware systems for a specific pipeline stage.
|
|
960
803
|
* The middleware are added to the pipeline in the order provided.
|
|
961
|
-
* @param type - The pipeline stage (initialize, update, render, sync).
|
|
804
|
+
* @param type - The pipeline stage (initialize, config, update, render, sync).
|
|
962
805
|
* @param systems - Array of middleware to add.
|
|
963
806
|
* @returns This builder for method chaining.
|
|
964
807
|
*/
|
|
@@ -1070,6 +913,10 @@ interface ISystemsRuntimeContext<TEntity extends IEntity> extends IPipelineConte
|
|
|
1070
913
|
* Indicates if the system pipeline should perform initialization for the current entity.
|
|
1071
914
|
*/
|
|
1072
915
|
readonly shouldInitialize?: boolean;
|
|
916
|
+
/**
|
|
917
|
+
* Indicates if the config system phase should run for the current entity.
|
|
918
|
+
*/
|
|
919
|
+
readonly shouldConfigure?: boolean;
|
|
1073
920
|
/**
|
|
1074
921
|
* The systems module for the current entity type.
|
|
1075
922
|
*/
|
|
@@ -1133,5 +980,5 @@ interface ISystemsFactory {
|
|
|
1133
980
|
createSystemsModuleBuilder<TEntity extends IEntity>(name: string): ISystemsModuleBuilder<TEntity>;
|
|
1134
981
|
}
|
|
1135
982
|
//#endregion
|
|
1136
|
-
export {
|
|
1137
|
-
//# sourceMappingURL=index-
|
|
983
|
+
export { ISystemContextRepository as A, SystemModuleName as B, TickSnapshot as C, ISystemContextSnapshot as D, ISystemContext as E, SystemContextControlState as F, LogLevel as G, ISystemContextConfigReadonly as H, ISystemMiddleware as I, MiddlewareRegistry as L, ISystemContextEvents as M, ISystemContextControl as N, IJsonSerializer as O, ISystemContextControlState as P, MiddlewareRegistryReadonly as R, TickMetricEntry as S, IMutableSystemContext as T, ILogger as U, ISystemContextConfig as V, ILoggerOptions as W, PerformanceMetricOptions as _, ISystemsRuntime as a, MiddlewareMetricsSummary as b, ISystemsModuleBuilder as c, IPipelineFactory as d, PipelineCategory as f, IPerformanceTimer as g, IContextFactory as h, ISystemsRuntimeContext as i, ISystemContextProxies as j, ISystemContextScheduler as k, ISystemsModuleBuilderReadonly as l, PipelineOptions as m, IRuntimeFactory as n, ISystemsModuleRepository as o, PipelineCategoryName as p, ISystemsRuntimeMiddleware as r, ISystemsModule as s, ISystemsFactory as t, SystemType as u, PerformanceTimeEntry as v, dispatchSequential as w, RenderSnapshot as x, PerformanceTimerUid as y, SystemMiddlewareName as z };
|
|
984
|
+
//# sourceMappingURL=index-B1OYkMOx.d.cts.map
|