@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.
Files changed (37) hide show
  1. package/dist/components/index.cjs.map +1 -1
  2. package/dist/components/index.d.cts +2 -2
  3. package/dist/components/index.d.mts +2 -2
  4. package/dist/components/index.mjs.map +1 -1
  5. package/dist/entities/index.cjs.map +1 -1
  6. package/dist/entities/index.d.cts +3 -3
  7. package/dist/entities/index.d.mts +3 -3
  8. package/dist/entities/index.mjs.map +1 -1
  9. package/dist/factories/index.cjs +1 -1
  10. package/dist/factories/index.cjs.map +1 -1
  11. package/dist/factories/index.d.cts +1 -1
  12. package/dist/factories/index.d.mts +1 -1
  13. package/dist/factories/index.mjs +1 -1
  14. package/dist/factories/index.mjs.map +1 -1
  15. package/dist/{index-zohK7ftH.d.cts → index-B1OYkMOx.d.cts} +197 -350
  16. package/dist/{index-BguFn1Xj.d.cts → index-BGLTfuj8.d.cts} +24 -4
  17. package/dist/{identity-component-CuWHf7jX.d.mts → index-C0jDrUBA.d.cts} +81 -70
  18. package/dist/{index-kNcUiDBd.d.mts → index-C1hRAjM-.d.mts} +24 -4
  19. package/dist/index-CeqaKmWR.d.mts +218 -0
  20. package/dist/{index-DZlhICMZ.d.mts → index-D3rS2RFG.d.mts} +197 -350
  21. package/dist/index-DMTkNY1e.d.cts +218 -0
  22. package/dist/{identity-component-DLDaOTyK.d.cts → index-b5BtWAvO.d.mts} +81 -70
  23. package/dist/pipelines/index.d.cts +1 -1
  24. package/dist/pipelines/index.d.mts +1 -1
  25. package/dist/systems/index.cjs +9 -4
  26. package/dist/systems/index.cjs.map +1 -1
  27. package/dist/systems/index.d.cts +2 -2
  28. package/dist/systems/index.d.mts +2 -2
  29. package/dist/systems/index.mjs +9 -4
  30. package/dist/systems/index.mjs.map +1 -1
  31. package/dist/types-Bbmnq4ni.d.cts +74 -0
  32. package/dist/types-C1ojaDL4.d.mts +74 -0
  33. package/dist/utils/index.cjs.map +1 -1
  34. package/dist/utils/index.d.cts +3 -3
  35. package/dist/utils/index.d.mts +3 -3
  36. package/dist/utils/index.mjs.map +1 -1
  37. package/package.json +2 -2
@@ -1,5 +1,19 @@
1
- import { S as IComponent, _ as IEntityProxy, f as EntityTypeUid, h as IEntityModel, m as IEntity, n as IdentityComponent, p as EntityUid } from "./identity-component-DLDaOTyK.cjs";
1
+ import { _ as ConfigRecord, a as IEntity, c as IEntityProxy, f as ComponentTypeUid, i as EntityUid, n as IdentityComponent, o as IEntityModel, p as IComponent, r as EntityTypeUid } from "./index-C0jDrUBA.cjs";
2
+ import { n as DeepPartial } from "./types-Bbmnq4ni.cjs";
2
3
 
4
+ //#region src/entities/entity-config.d.ts
5
+ /**
6
+ * Config-only entity state update.
7
+ *
8
+ * Unlike an entity snapshot, this payload is only for component-backed config
9
+ * values. Runtime patches the matching component's `config` object after the
10
+ * regular snapshot payload, then runs the config system phase before the normal
11
+ * update/render/sync phases.
12
+ */
13
+ interface IEntityConfigSnapshot<TConfig extends ConfigRecord = ConfigRecord> {
14
+ readonly components: Record<ComponentTypeUid, DeepPartial<TConfig>>;
15
+ }
16
+ //#endregion
3
17
  //#region src/entities/entity-context-cache.d.ts
4
18
  /**
5
19
  * A generic per-entity key-value store for runtime contexts.
@@ -280,6 +294,12 @@ interface IEntityUpdate {
280
294
  * Optional serialized state to apply to the entity.
281
295
  */
282
296
  readonly snapshot?: IEntitySnapshot;
297
+ /**
298
+ * Optional config-only component state to apply to the entity.
299
+ * When present on an update, the runtime applies it after `snapshot` and
300
+ * includes the config system phase in the same tick.
301
+ */
302
+ readonly config?: IEntityConfigSnapshot;
283
303
  }
284
304
  /**
285
305
  * Queue interface for managing pending entity updates.
@@ -430,7 +450,7 @@ interface IEntityScheduler {
430
450
  */
431
451
  readonly isPaused: boolean;
432
452
  /**
433
- * Registers an entity for updates.
453
+ * Registers or replaces an entity schedule.
434
454
  * @param entityProxy - The entity to schedule.
435
455
  * @param intervalMs - Update frequency in milliseconds. If omitted, the entity is scheduled per-frame.
436
456
  */
@@ -470,5 +490,5 @@ interface IEntityScheduler {
470
490
  resume(): void;
471
491
  }
472
492
  //#endregion
473
- export { IEntityContextCache as _, EntityUpdateType as a, IEntitySnapshot as c, EntityEventSubscriptionOptions as d, EntityEventUid as f, IEventData as g, IEntityEventsManager as h, IEntityRepository as i, IEntitySnapshotProvider as l, IEntityEventsDispatcher as m, IEntityScheduler as n, IEntityUpdate as o, IEntityEvent as p, SchedulerPauseType as r, IEntityUpdateQueue as s, EntitySchedule as t, EntityEventSubscriptionFilter as u };
474
- //# sourceMappingURL=index-BguFn1Xj.d.cts.map
493
+ export { IEntityContextCache as _, EntityUpdateType as a, IEntitySnapshot as c, EntityEventSubscriptionOptions as d, EntityEventUid as f, IEventData as g, IEntityEventsManager as h, IEntityRepository as i, IEntitySnapshotProvider as l, IEntityEventsDispatcher as m, IEntityScheduler as n, IEntityUpdate as o, IEntityEvent as p, SchedulerPauseType as r, IEntityUpdateQueue as s, EntitySchedule as t, EntityEventSubscriptionFilter as u, IEntityConfigSnapshot as v };
494
+ //# sourceMappingURL=index-BGLTfuj8.d.cts.map
@@ -1,3 +1,73 @@
1
+ import { r as Immutable } from "./types-Bbmnq4ni.cjs";
2
+
3
+ //#region src/components/config.d.ts
4
+ /**
5
+ * Extension point for application-specific config controls.
6
+ *
7
+ * Consumers can augment this interface to add extra controls while still
8
+ * preserving value-aware option typing.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * declare module '@awesome-ecs/abstract/components' {
13
+ * interface ConfigCustomControlOptions<TValue> {
14
+ * slider: NonNullable<TValue> extends number
15
+ * ? { readonly min?: number; readonly max?: number; readonly step?: number }
16
+ * : never;
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ interface ConfigCustomControlOptions<TValue> {}
22
+ /**
23
+ * A generic configuration object for a component, where keys are config paths and values are the corresponding config values.
24
+ */
25
+ type ConfigRecord = Record<string, unknown>;
26
+ /**
27
+ * Defines a single configuration option for a specific key in a component's config record.
28
+ * If the config value is itself a nested config record, it can include an `inner` array of further config options.
29
+ */
30
+ type ConfigOption<TConfig extends object> = keyof TConfig & string extends infer K ? K extends keyof TConfig & string ? ConfigOptionForKey<TConfig, K> : never : never;
31
+ type ConfigOptionForKey<TConfig extends object, K extends keyof TConfig & string> = ConfigOptionForValue<NonNullable<TConfig[K]>, K>;
32
+ type ConfigOptionForValue<TValue, K extends string> = ConfigNestedOptionForValue<TValue, K> | ConfigLeafOptionForValue<TValue, K> | ConfigCustomControlOption<TValue, K>;
33
+ type ConfigNestedOptionForValue<TValue, K extends string> = TValue extends readonly unknown[] ? never : TValue extends ((...args: never[]) => unknown) ? never : TValue extends object ? ConfigNestedOption<TValue, K> : never;
34
+ type ConfigLeafOptionForValue<TValue, K extends string> = [TValue] extends [number] ? ConfigNumberOption<K> | ConfigChoiceOption<K, Extract<TValue, ConfigChoiceValue>> : [TValue] extends [boolean] ? ConfigBooleanOption<K> | ConfigChoiceOption<K, Extract<TValue, ConfigChoiceValue>> : [TValue] extends [string] ? ConfigStringOption<K> | ConfigColorOption<K> | ConfigChoiceOption<K, Extract<TValue, ConfigChoiceValue>> : never;
35
+ type ConfigCustomControlOption<TValue, K extends string> = { [TControl in keyof ConfigCustomControlOptions<TValue> & string]: ConfigOptionBase<K> & {
36
+ readonly control: TControl;
37
+ } & ConfigCustomControlOptions<TValue>[TControl] }[keyof ConfigCustomControlOptions<TValue> & string];
38
+ type ConfigNumberOption<K extends string> = ConfigOptionBase<K> & {
39
+ readonly control: 'number';
40
+ readonly min?: number;
41
+ readonly max?: number;
42
+ readonly step?: number;
43
+ };
44
+ type ConfigBooleanOption<K extends string> = ConfigOptionBase<K> & {
45
+ readonly control: 'boolean';
46
+ };
47
+ type ConfigStringOption<K extends string> = ConfigOptionBase<K> & {
48
+ readonly control: 'string';
49
+ };
50
+ type ConfigColorOption<K extends string> = ConfigOptionBase<K> & {
51
+ readonly control: 'color';
52
+ };
53
+ type ConfigNestedOption<TValue extends object, K extends string> = ConfigOptionBase<K> & {
54
+ readonly inner?: ConfigOption<TValue>[];
55
+ };
56
+ type ConfigChoiceOption<K extends string, TValue extends ConfigChoiceValue = ConfigChoiceValue> = ConfigOptionBase<K> & {
57
+ readonly control: 'select' | 'radio';
58
+ readonly options: ReadonlyArray<ConfigChoice<TValue>>;
59
+ };
60
+ type ConfigOptionBase<K extends string> = {
61
+ readonly key: K;
62
+ readonly label: string;
63
+ readonly group?: string;
64
+ };
65
+ type ConfigChoice<TValue extends ConfigChoiceValue = ConfigChoiceValue> = {
66
+ readonly label: string;
67
+ readonly value: TValue;
68
+ };
69
+ type ConfigChoiceValue = string | number | boolean;
70
+ //#endregion
1
71
  //#region src/components/component.d.ts
2
72
  type ComponentTypeUid = string | number;
3
73
  /**
@@ -39,6 +109,15 @@ interface IComponent {
39
109
  */
40
110
  load?(targetState: this): void;
41
111
  }
112
+ /**
113
+ * Component variant that exposes live, mutable configuration values.
114
+ *
115
+ * `config` is the runtime value object systems read from and config
116
+ * updates patch into.
117
+ */
118
+ interface IComponentWithConfig<TConfig extends ConfigRecord> extends IComponent {
119
+ readonly config: TConfig;
120
+ }
42
121
  //#endregion
43
122
  //#region src/entities/entity-proxies.d.ts
44
123
  /**
@@ -210,74 +289,6 @@ interface IEntity {
210
289
  readonly myProxy: Readonly<EntityProxy<this>>;
211
290
  }
212
291
  //#endregion
213
- //#region src/utils/types.d.ts
214
- /**
215
- * Maps all properties of a type to boolean flags.
216
- * Useful for feature flags, capability indicators, or boolean option sets.
217
- *
218
- * @template T - The type whose properties are mapped to booleans.
219
- * @example type Features = BooleanProps<{health: any; armor: any}>; // => {health: boolean, armor: boolean}
220
- */
221
- type BooleanProps<T> = { [Property in keyof T]: boolean };
222
- /**
223
- * Removes readonly modifiers from all properties, making them mutable.
224
- * One level of immutability removal (see MutableDeep for recursive removal).
225
- *
226
- * @template T - The type to make mutable.
227
- * @example type Mut = Mutable<{readonly x: number}>; // => {x: number}
228
- */
229
- type Mutable<T> = { -readonly [K in keyof T]: T[K] };
230
- /**
231
- * Recursively removes readonly modifiers from all properties at all nesting levels.
232
- * Makes entire object graph mutable.
233
- *
234
- * @template T - The type to make mutable recursively.
235
- */
236
- type MutableDeep<T> = { -readonly [K in keyof T]: Mutable<T[K]> };
237
- type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
238
- /**
239
- * Makes a type fully immutable at the top level only.
240
- * Primitives and functions remain unchanged.
241
- * Collections (Array, Map, Set) become readonly.
242
- * Objects have their properties made readonly.
243
- *
244
- * @template T - The type to make immutable.
245
- * @example type Imm = Immutable<{x: number}>; // => {readonly x: number}
246
- */
247
- type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
248
- /**
249
- * Readonly array variant for use in Immutable type transformation.
250
- *
251
- * @template T - Element type of the array.
252
- */
253
- type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
254
- /**
255
- * Readonly map variant for use in Immutable type transformation.
256
- *
257
- * @template K - Key type of the map.
258
- * @template V - Value type of the map.
259
- */
260
- type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
261
- /**
262
- * Readonly set variant for use in Immutable type transformation.
263
- *
264
- * @template T - Element type of the set.
265
- */
266
- type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
267
- /**
268
- * Makes all object properties readonly (one level only).
269
- *
270
- * @template T - The type to make immutable.
271
- */
272
- type ImmutableObject<T> = { readonly [K in keyof T]: T[K] };
273
- /**
274
- * Recursively makes all properties readonly at all nesting levels.
275
- * Provides complete immutability guarantee for the entire object graph.
276
- *
277
- * @template T - The type to make deeply immutable.
278
- */
279
- type ImmutableObjectDeep<T> = { readonly [K in keyof T]: Immutable<T[K]> };
280
- //#endregion
281
292
  //#region src/components/identity-component.d.ts
282
293
  /**
283
294
  * The `BasicComponentType` enum defines the types of basic components available.
@@ -316,5 +327,5 @@ interface IdentityComponent<TModel extends IEntityModel> extends IComponent {
316
327
  readonly lastUpdated?: Date;
317
328
  }
318
329
  //#endregion
319
- export { IComponent as S, IEntityProxy as _, ImmutableArray as a, TypedEntityProxy as b, ImmutableObjectDeep as c, MutableDeep as d, EntityTypeUid as f, EntityProxy as g, IEntityModel as h, Immutable as i, ImmutableSet as l, IEntity as m, IdentityComponent as n, ImmutableMap as o, EntityUid as p, BooleanProps as r, ImmutableObject as s, BasicComponentType as t, Mutable as u, IEntityProxyRepository as v, ComponentTypeUid as x, RequiredProxies as y };
320
- //# sourceMappingURL=identity-component-CuWHf7jX.d.mts.map
330
+ export { ConfigRecord as _, IEntity as a, IEntityProxy as c, TypedEntityProxy as d, ComponentTypeUid as f, ConfigOption as g, ConfigCustomControlOptions as h, EntityUid as i, IEntityProxyRepository as l, IComponentWithConfig as m, IdentityComponent as n, IEntityModel as o, IComponent as p, EntityTypeUid as r, EntityProxy as s, BasicComponentType as t, RequiredProxies as u };
331
+ //# sourceMappingURL=index-C0jDrUBA.d.cts.map
@@ -1,5 +1,19 @@
1
- import { S as IComponent, _ as IEntityProxy, f as EntityTypeUid, h as IEntityModel, m as IEntity, n as IdentityComponent, p as EntityUid } from "./identity-component-CuWHf7jX.mjs";
1
+ import { _ as ConfigRecord, a as IEntity, c as IEntityProxy, f as ComponentTypeUid, i as EntityUid, n as IdentityComponent, o as IEntityModel, p as IComponent, r as EntityTypeUid } from "./index-b5BtWAvO.mjs";
2
+ import { n as DeepPartial } from "./types-C1ojaDL4.mjs";
2
3
 
4
+ //#region src/entities/entity-config.d.ts
5
+ /**
6
+ * Config-only entity state update.
7
+ *
8
+ * Unlike an entity snapshot, this payload is only for component-backed config
9
+ * values. Runtime patches the matching component's `config` object after the
10
+ * regular snapshot payload, then runs the config system phase before the normal
11
+ * update/render/sync phases.
12
+ */
13
+ interface IEntityConfigSnapshot<TConfig extends ConfigRecord = ConfigRecord> {
14
+ readonly components: Record<ComponentTypeUid, DeepPartial<TConfig>>;
15
+ }
16
+ //#endregion
3
17
  //#region src/entities/entity-context-cache.d.ts
4
18
  /**
5
19
  * A generic per-entity key-value store for runtime contexts.
@@ -280,6 +294,12 @@ interface IEntityUpdate {
280
294
  * Optional serialized state to apply to the entity.
281
295
  */
282
296
  readonly snapshot?: IEntitySnapshot;
297
+ /**
298
+ * Optional config-only component state to apply to the entity.
299
+ * When present on an update, the runtime applies it after `snapshot` and
300
+ * includes the config system phase in the same tick.
301
+ */
302
+ readonly config?: IEntityConfigSnapshot;
283
303
  }
284
304
  /**
285
305
  * Queue interface for managing pending entity updates.
@@ -430,7 +450,7 @@ interface IEntityScheduler {
430
450
  */
431
451
  readonly isPaused: boolean;
432
452
  /**
433
- * Registers an entity for updates.
453
+ * Registers or replaces an entity schedule.
434
454
  * @param entityProxy - The entity to schedule.
435
455
  * @param intervalMs - Update frequency in milliseconds. If omitted, the entity is scheduled per-frame.
436
456
  */
@@ -470,5 +490,5 @@ interface IEntityScheduler {
470
490
  resume(): void;
471
491
  }
472
492
  //#endregion
473
- export { IEntityContextCache as _, EntityUpdateType as a, IEntitySnapshot as c, EntityEventSubscriptionOptions as d, EntityEventUid as f, IEventData as g, IEntityEventsManager as h, IEntityRepository as i, IEntitySnapshotProvider as l, IEntityEventsDispatcher as m, IEntityScheduler as n, IEntityUpdate as o, IEntityEvent as p, SchedulerPauseType as r, IEntityUpdateQueue as s, EntitySchedule as t, EntityEventSubscriptionFilter as u };
474
- //# sourceMappingURL=index-kNcUiDBd.d.mts.map
493
+ export { IEntityContextCache as _, EntityUpdateType as a, IEntitySnapshot as c, EntityEventSubscriptionOptions as d, EntityEventUid as f, IEventData as g, IEntityEventsManager as h, IEntityRepository as i, IEntitySnapshotProvider as l, IEntityEventsDispatcher as m, IEntityScheduler as n, IEntityUpdate as o, IEntityEvent as p, SchedulerPauseType as r, IEntityUpdateQueue as s, EntitySchedule as t, EntityEventSubscriptionFilter as u, IEntityConfigSnapshot as v };
494
+ //# sourceMappingURL=index-C1hRAjM-.d.mts.map
@@ -0,0 +1,218 @@
1
+ import { r as Immutable } from "./types-C1ojaDL4.mjs";
2
+
3
+ //#region src/pipelines/pipeline-context.d.ts
4
+ /**
5
+ * Base interface for all pipeline context objects.
6
+ * Provides hooks for runtime state and control flow during pipeline execution.
7
+ */
8
+ interface IPipelineContext {
9
+ /**
10
+ * The runtime state and control interface for the pipeline.
11
+ * Allows middleware to query and influence pipeline behavior.
12
+ */
13
+ readonly runtime?: PipelineRuntime;
14
+ }
15
+ /**
16
+ * Runtime state and control interface for pipeline execution.
17
+ * Allows middleware to query status and influence pipeline flow.
18
+ */
19
+ type PipelineRuntime = {
20
+ /**
21
+ * Flag to request pipeline halt.
22
+ * Set to true to stop executing remaining middleware (cleanup still runs).
23
+ */
24
+ shouldStop?: boolean;
25
+ /**
26
+ * Optional error state if an exception occurred during execution.
27
+ */
28
+ error?: any;
29
+ };
30
+ //#endregion
31
+ //#region src/pipelines/middleware.d.ts
32
+ /**
33
+ * The basic unit of work in a pipeline.
34
+ * Middleware are chained together to form processing pipelines.
35
+ * Each middleware can inspect/modify context during dispatch and perform cleanup on their changes.
36
+ *
37
+ * @template TContext The context type passed through the middleware chain.
38
+ */
39
+ interface IMiddleware<TContext extends IPipelineContext> {
40
+ /**
41
+ * Optional name for debugging and logging purposes.
42
+ */
43
+ readonly name?: string;
44
+ /**
45
+ * Optional guard condition before running the action.
46
+ * Allows middleware to skip execution based on context state.
47
+ * @param context The current pipeline context.
48
+ * @returns True to execute action, false to skip.
49
+ */
50
+ shouldRun?(context: TContext): boolean;
51
+ /**
52
+ * The main unit of work executed as part of the pipeline.
53
+ * Middlewares execute in registration order during dispatch phase.
54
+ * Can read and modify the context to influence downstream middleware and results.
55
+ * @param context The pipeline context containing all relevant state.
56
+ */
57
+ action(context: TContext): void | Promise<void>;
58
+ /**
59
+ * Optional cleanup function executed during pipeline teardown.
60
+ * Middlewares execute in reverse registration order during cleanup phase.
61
+ * Used to release resources, clear temporary state, and perform final operations.
62
+ * @param context The pipeline context (may be in modified state from action phases).
63
+ */
64
+ cleanup?(context: TContext): void | Promise<void>;
65
+ }
66
+ //#endregion
67
+ //#region src/pipelines/middleware-runner.d.ts
68
+ /**
69
+ * Customizes how middleware is executed within a pipeline.
70
+ * Allows decorators to wrap, intercept, or modify middleware execution behavior.
71
+ * Useful for implementing middleware decorators (logging, timing, error handling, etc.).
72
+ *
73
+ * @template TContext The type of context passed to middleware.
74
+ */
75
+ interface IMiddlewareRunner<TContext extends IPipelineContext> {
76
+ /**
77
+ * Decides how to execute a middleware's action.
78
+ * Can add pre/post processing, error handling, or performance tracking around the middleware.
79
+ * @param context The current pipeline context.
80
+ * @param middleware The middleware whose action should be executed.
81
+ */
82
+ dispatch(context: TContext, middleware: IMiddleware<TContext>): void | Promise<void>;
83
+ /**
84
+ * Decides how to execute a middleware's cleanup.
85
+ * Can add pre/post processing or error handling around cleanup operations.
86
+ * @param context The current pipeline context.
87
+ * @param middleware The middleware whose cleanup should be executed.
88
+ */
89
+ cleanup(context: TContext, middleware: IMiddleware<TContext>): void | Promise<void>;
90
+ }
91
+ //#endregion
92
+ //#region src/pipelines/pipeline.d.ts
93
+ /**
94
+ * A composable middleware chain for ordered execution of operations.
95
+ * Pipelines provide a framework for registering and executing middleware with dispatch and cleanup phases.
96
+ * Used throughout the ECS system for entity initialization, updates, rendering, and synchronization.
97
+ *
98
+ * @template TContext - The context type passed to all registered middleware.
99
+ */
100
+ interface IPipeline<TContext extends IPipelineContext> {
101
+ /**
102
+ * The pipeline's name, useful for debugging and logging.
103
+ */
104
+ readonly name?: string;
105
+ /**
106
+ * The number of middleware currently registered in this pipeline.
107
+ */
108
+ readonly length?: number;
109
+ /**
110
+ * Direct access to the ordered list of registered middleware.
111
+ * Allows inspection of the execution chain.
112
+ */
113
+ readonly middleware?: Immutable<IMiddleware<TContext>[]>;
114
+ /**
115
+ * Registers middleware to be executed as part of this pipeline.
116
+ * Middleware is added to the end of the chain and executed in registration order during dispatch.
117
+ * @param middleware - The middleware to register.
118
+ * @returns This instance for method chaining.
119
+ */
120
+ use(middleware: Immutable<IMiddleware<TContext>>): this;
121
+ /**
122
+ * Executes the dispatch phase with all registered middleware in order.
123
+ * Each middleware's action is called, allowing modifications to context state.
124
+ * Execution continues until all middleware complete or a middleware requests early termination.
125
+ * @param context - The context object passed to all middleware.
126
+ */
127
+ dispatch(context: Partial<TContext>): void | Promise<void>;
128
+ /**
129
+ * Executes the cleanup phase with all registered middleware in reverse order.
130
+ * Allows middleware to perform resource cleanup and final operations.
131
+ * Typically called after dispatch to ensure proper teardown.
132
+ *
133
+ * @param context - The context object that will be passed to each middleware function.
134
+ */
135
+ cleanup(context: Partial<TContext>): void | Promise<void>;
136
+ }
137
+ //#endregion
138
+ //#region src/pipelines/pipeline-nested.d.ts
139
+ /**
140
+ * Context for a parent pipeline containing nested pipelines.
141
+ * Allows coordination between outer and inner pipeline execution.
142
+ *
143
+ * @template N - The context type for the nested pipelines.
144
+ */
145
+ interface IParentContext<N extends IPipelineContext> extends IPipelineContext {
146
+ /**
147
+ * The nested pipeline to execute for each context in nestedContexts.
148
+ */
149
+ readonly nestedPipeline: IPipeline<INestedContext<this>>;
150
+ /**
151
+ * Contexts to pass to the nested pipeline.
152
+ * The parent pipeline iterates these and executes the nested pipeline for each.
153
+ */
154
+ readonly nestedContexts: Partial<N>[];
155
+ }
156
+ /**
157
+ * Context for a nested pipeline.
158
+ * Provides access to both current and previous nested context data plus the parent context.
159
+ *
160
+ * @template P - The context type of the parent pipeline.
161
+ */
162
+ interface INestedContext<P extends IParentContext<any>> extends IPipelineContext {
163
+ /**
164
+ * The current context item being processed in the nested pipeline.
165
+ */
166
+ readonly current: P extends IParentContext<infer N> ? N : never;
167
+ /**
168
+ * The previous context item (if this is not the first iteration).
169
+ */
170
+ readonly previous?: P extends IParentContext<infer N> ? N : never;
171
+ /**
172
+ * Reference back to the parent pipeline context.
173
+ */
174
+ readonly parent: P;
175
+ }
176
+ /**
177
+ * Middleware executing within a nested pipeline.
178
+ *
179
+ * @template P - The context type of the parent pipeline.
180
+ */
181
+ type INestedMiddleware<P extends IParentContext<any>> = IMiddleware<INestedContext<P>>;
182
+ /**
183
+ * Middleware executing within a parent pipeline (containing nested pipelines).
184
+ *
185
+ * @template P - The context type of the parent pipeline.
186
+ */
187
+ type IParentMiddleware<P extends IParentContext<any>> = IMiddleware<P>;
188
+ //#endregion
189
+ //#region src/pipelines/pipeline-runner.d.ts
190
+ /**
191
+ * Executes an array of middleware in a controlled sequence.
192
+ * Supports custom execution strategies through implementation flexibility.
193
+ * Used by pipelines to manage complex middleware chains with features like early termination and nested pipelines.
194
+ *
195
+ * @template TContext - The context type passed to all middleware.
196
+ */
197
+ interface IPipelineRunner<TContext extends IPipelineContext> {
198
+ /**
199
+ * Executes the action phase of all middleware in sequence.
200
+ * Middleware at startIndex and onward are executed in order.
201
+ * Execution may terminate early if middleware requests it via context.runtime.shouldStop.
202
+ * @param context - The context passed to each middleware action.
203
+ * @param middleware - The ordered middleware array to execute.
204
+ * @param startIndex - Optional starting position in the middleware array (default: 0).
205
+ */
206
+ dispatch(context: Partial<TContext>, middleware: IMiddleware<TContext>[], startIndex?: number): void | Promise<void>;
207
+ /**
208
+ * Executes the cleanup phase of all middleware in reverse order.
209
+ * All middleware cleanup functions are called (if defined), regardless of errors.
210
+ * Allows proper resource release and final state management.
211
+ * @param context - The context passed to each middleware cleanup.
212
+ * @param middleware - The ordered middleware array for cleanup (reversed during execution).
213
+ */
214
+ cleanup(context: Partial<TContext>, middleware: IMiddleware<TContext>[]): void | Promise<void>;
215
+ }
216
+ //#endregion
217
+ export { IParentMiddleware as a, IMiddleware as c, IParentContext as i, IPipelineContext as l, INestedContext as n, IPipeline as o, INestedMiddleware as r, IMiddlewareRunner as s, IPipelineRunner as t, PipelineRuntime as u };
218
+ //# sourceMappingURL=index-CeqaKmWR.d.mts.map