@awesome-ecs/abstract 0.5.4 → 0.7.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 (38) hide show
  1. package/LICENSE.md +201 -201
  2. package/README.md +99 -99
  3. package/dist/components/component.d.ts +17 -17
  4. package/dist/components/component.js +2 -2
  5. package/dist/components/identity-component.d.ts +19 -19
  6. package/dist/components/identity-component.js +7 -7
  7. package/dist/entities/entity-events.d.ts +37 -37
  8. package/dist/entities/entity-events.js +2 -2
  9. package/dist/entities/entity-proxy.d.ts +14 -14
  10. package/dist/entities/entity-proxy.js +2 -2
  11. package/dist/entities/entity-queue.d.ts +30 -30
  12. package/dist/entities/entity-queue.js +11 -11
  13. package/dist/entities/entity-repository.d.ts +24 -23
  14. package/dist/entities/entity-repository.js +2 -2
  15. package/dist/entities/entity-scheduler.d.ts +11 -11
  16. package/dist/entities/entity-scheduler.js +2 -2
  17. package/dist/entities/entity.d.ts +17 -17
  18. package/dist/entities/entity.js +2 -2
  19. package/dist/index.d.ts +16 -16
  20. package/dist/index.js +32 -32
  21. package/dist/pipelines/middleware.d.ts +26 -26
  22. package/dist/pipelines/middleware.js +2 -2
  23. package/dist/pipelines/pipeline.d.ts +27 -18
  24. package/dist/pipelines/pipeline.js +8 -2
  25. package/dist/pipelines/pipeline.js.map +1 -1
  26. package/dist/systems/system-middleware.d.ts +8 -8
  27. package/dist/systems/system-middleware.js +2 -2
  28. package/dist/systems/system-pipeline-context.d.ts +39 -39
  29. package/dist/systems/system-pipeline-context.js +2 -2
  30. package/dist/systems/system-pipeline-type.d.ts +6 -6
  31. package/dist/systems/system-pipeline-type.js +10 -10
  32. package/dist/systems/systems-module.d.ts +25 -21
  33. package/dist/systems/systems-module.js +2 -2
  34. package/dist/systems/systems-runtime.d.ts +26 -26
  35. package/dist/systems/systems-runtime.js +2 -2
  36. package/dist/utils/performance-timer.d.ts +11 -10
  37. package/dist/utils/performance-timer.js +2 -2
  38. package/package.json +2 -2
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=component.js.map
@@ -1,19 +1,19 @@
1
- import { IComponent } from "./component";
2
- import { EntityTypeUid, IEntityModel } from "../entities/entity";
3
- export declare enum BasicComponentType {
4
- identity = "identity"
5
- }
6
- /**
7
- * Each Entity will have an Identity, containing basic information regarding what makes the current Entity unique.
8
- */
9
- export interface IdentityComponent<TModel extends IEntityModel> extends IComponent {
10
- /**
11
- * The Entity Type that defines what Category type the Entity is part of. There can be multiple Entities sharing the same EntityType.
12
- */
13
- readonly entityType: EntityTypeUid;
14
- /**
15
- * The Model is the basic information needed to create an Entity when it's first initialized.
16
- * It provides a first snapshot of information needed for the successful creation of an Entity instance.
17
- */
18
- readonly model: TModel;
19
- }
1
+ import { IComponent } from "./component";
2
+ import { EntityTypeUid, IEntityModel } from "../entities/entity";
3
+ export declare enum BasicComponentType {
4
+ identity = "identity"
5
+ }
6
+ /**
7
+ * Each Entity will have an Identity, containing basic information regarding what makes the current Entity unique.
8
+ */
9
+ export interface IdentityComponent<TModel extends IEntityModel> extends IComponent {
10
+ /**
11
+ * The Entity Type that defines what Category type the Entity is part of. There can be multiple Entities sharing the same EntityType.
12
+ */
13
+ readonly entityType: EntityTypeUid;
14
+ /**
15
+ * The Model is the basic information needed to create an Entity when it's first initialized.
16
+ * It provides a first snapshot of information needed for the successful creation of an Entity instance.
17
+ */
18
+ readonly model: TModel;
19
+ }
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BasicComponentType = void 0;
4
- var BasicComponentType;
5
- (function (BasicComponentType) {
6
- BasicComponentType["identity"] = "identity";
7
- })(BasicComponentType = exports.BasicComponentType || (exports.BasicComponentType = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasicComponentType = void 0;
4
+ var BasicComponentType;
5
+ (function (BasicComponentType) {
6
+ BasicComponentType["identity"] = "identity";
7
+ })(BasicComponentType = exports.BasicComponentType || (exports.BasicComponentType = {}));
8
8
  //# sourceMappingURL=identity-component.js.map
@@ -1,37 +1,37 @@
1
- import { IEntityProxy } from "./entity-proxy";
2
- export declare type EntityEventUid = string | number;
3
- export declare type EntityEventSubscriptionFilter = (event: IEntityEvent<IEventData>) => boolean;
4
- export interface IEventData {
5
- uid: EntityEventUid;
6
- }
7
- /**
8
- * Entity Events represent the basic building blocks for a Pub/Sub pattern, to synchronize
9
- * state between multiple Entities.
10
- *
11
- * The Events are past actions that already happened within a state. They are scheduled as part of the EntityUpdate model.
12
- * Other Systems subscribe and receive updates with the Events included in their SystemContext model.
13
- */
14
- export interface IEntityEvent<TEventData extends IEventData> {
15
- origin: IEntityProxy;
16
- target?: IEntityProxy;
17
- data: TEventData;
18
- }
19
- /**
20
- * The EntityEventsManager represents the Pub/Sub broker for EntityEvents.
21
- */
22
- export interface IEntityEventsManager {
23
- subscribe(uid: EntityEventUid, entity: IEntityProxy, filter?: EntityEventSubscriptionFilter): void;
24
- unsubscribe(uid: EntityEventUid, entity: IEntityProxy): void;
25
- getSubscriptions(event: IEntityEvent<IEventData>): IEntityProxy[];
26
- clearSubscriptions(uid?: EntityEventUid): void;
27
- }
28
- /**
29
- * The EntityEventsDispatcher is the main access point for dispatching events to Entities.
30
- *
31
- * It can leverage the IEntityEvents manager to find Subscribers, and the IEntityUpdateQueue to register events
32
- * into the Entity's next update.
33
- */
34
- export interface IEntityEventsDispatcher {
35
- dispatchEvent(event: IEntityEvent<IEventData>, ...targets: IEntityProxy[]): void;
36
- dispatchEvents(events: IEntityEvent<IEventData>[], ...targets: IEntityProxy[]): void;
37
- }
1
+ import { IEntityProxy } from "./entity-proxy";
2
+ export declare type EntityEventUid = string | number;
3
+ export declare type EntityEventSubscriptionFilter = (event: IEntityEvent<IEventData>) => boolean;
4
+ export interface IEventData {
5
+ uid: EntityEventUid;
6
+ }
7
+ /**
8
+ * Entity Events represent the basic building blocks for a Pub/Sub pattern, to synchronize
9
+ * state between multiple Entities.
10
+ *
11
+ * The Events are past actions that already happened within a state. They are scheduled as part of the EntityUpdate model.
12
+ * Other Systems subscribe and receive updates with the Events included in their SystemContext model.
13
+ */
14
+ export interface IEntityEvent<TEventData extends IEventData> {
15
+ origin: IEntityProxy;
16
+ target?: IEntityProxy;
17
+ data: TEventData;
18
+ }
19
+ /**
20
+ * The EntityEventsManager represents the Pub/Sub broker for EntityEvents.
21
+ */
22
+ export interface IEntityEventsManager {
23
+ subscribe(uid: EntityEventUid, entity: IEntityProxy, filter?: EntityEventSubscriptionFilter): void;
24
+ unsubscribe(uid: EntityEventUid, entity: IEntityProxy): void;
25
+ getSubscriptions(event: IEntityEvent<IEventData>): IEntityProxy[];
26
+ clearSubscriptions(uid?: EntityEventUid): void;
27
+ }
28
+ /**
29
+ * The EntityEventsDispatcher is the main access point for dispatching events to Entities.
30
+ *
31
+ * It can leverage the IEntityEvents manager to find Subscribers, and the IEntityUpdateQueue to register events
32
+ * into the Entity's next update.
33
+ */
34
+ export interface IEntityEventsDispatcher {
35
+ dispatchEvent(event: IEntityEvent<IEventData>, ...targets: IEntityProxy[]): void;
36
+ dispatchEvents(events: IEntityEvent<IEventData>[], ...targets: IEntityProxy[]): void;
37
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=entity-events.js.map
@@ -1,14 +1,14 @@
1
- import { EntityTypeUid, EntityUid, IEntity } from "./entity";
2
- /**
3
- * Represents a pointer to another Entity.
4
- */
5
- export interface IEntityProxy {
6
- readonly entityType: EntityTypeUid;
7
- readonly entityUid: EntityUid;
8
- }
9
- /**
10
- * A utility extension of IEntityProxy.
11
- * Useful for providing Type information when using the IEntityProxy.
12
- */
13
- export interface EntityProxy<TEntity extends IEntity> extends IEntityProxy {
14
- }
1
+ import { EntityTypeUid, EntityUid, IEntity } from "./entity";
2
+ /**
3
+ * Represents a pointer to another Entity.
4
+ */
5
+ export interface IEntityProxy {
6
+ readonly entityType: EntityTypeUid;
7
+ readonly entityUid: EntityUid;
8
+ }
9
+ /**
10
+ * A utility extension of IEntityProxy.
11
+ * Useful for providing Type information when using the IEntityProxy.
12
+ */
13
+ export interface EntityProxy<TEntity extends IEntity> extends IEntityProxy {
14
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=entity-proxy.js.map
@@ -1,30 +1,30 @@
1
- import { IEntityModel } from "./entity";
2
- import { IEntityEvent, IEventData } from "./entity-events";
3
- import { IEntityProxy } from "./entity-proxy";
4
- /**
5
- * The Entity update state for this change.
6
- */
7
- export declare enum EntityUpdateType {
8
- update = "update",
9
- remove = "remove"
10
- }
11
- /**
12
- * Represents an Entity update that should be applied over an (existing) Entity.
13
- */
14
- export interface IEntityUpdate {
15
- type: EntityUpdateType;
16
- entity: IEntityProxy;
17
- model?: IEntityModel;
18
- events?: IEntityEvent<IEventData>[];
19
- }
20
- /**
21
- * The Entity Updates will be queued up, and can be picked up in order.
22
- * The interface can be implemented using a simple queue mechanism, or perhaps, a Priority Queue.
23
- */
24
- export interface IEntityUpdateQueue {
25
- readonly size: number;
26
- enqueue(change: IEntityUpdate): void;
27
- dequeue(): IEntityUpdate;
28
- peek(): IEntityUpdate;
29
- clear(): void;
30
- }
1
+ import { IEntityModel } from "./entity";
2
+ import { IEntityEvent, IEventData } from "./entity-events";
3
+ import { IEntityProxy } from "./entity-proxy";
4
+ /**
5
+ * The Entity update state for this change.
6
+ */
7
+ export declare enum EntityUpdateType {
8
+ update = "update",
9
+ remove = "remove"
10
+ }
11
+ /**
12
+ * Represents an Entity update that should be applied over an (existing) Entity.
13
+ */
14
+ export interface IEntityUpdate {
15
+ type: EntityUpdateType;
16
+ entity: IEntityProxy;
17
+ model?: IEntityModel;
18
+ events?: IEntityEvent<IEventData>[];
19
+ }
20
+ /**
21
+ * The Entity Updates will be queued up, and can be picked up in order.
22
+ * The interface can be implemented using a simple queue mechanism, or perhaps, a Priority Queue.
23
+ */
24
+ export interface IEntityUpdateQueue {
25
+ readonly size: number;
26
+ enqueue(change: IEntityUpdate): void;
27
+ dequeue(): IEntityUpdate;
28
+ peek(): IEntityUpdate;
29
+ clear(): void;
30
+ }
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityUpdateType = void 0;
4
- /**
5
- * The Entity update state for this change.
6
- */
7
- var EntityUpdateType;
8
- (function (EntityUpdateType) {
9
- EntityUpdateType["update"] = "update";
10
- EntityUpdateType["remove"] = "remove";
11
- })(EntityUpdateType = exports.EntityUpdateType || (exports.EntityUpdateType = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityUpdateType = void 0;
4
+ /**
5
+ * The Entity update state for this change.
6
+ */
7
+ var EntityUpdateType;
8
+ (function (EntityUpdateType) {
9
+ EntityUpdateType["update"] = "update";
10
+ EntityUpdateType["remove"] = "remove";
11
+ })(EntityUpdateType = exports.EntityUpdateType || (exports.EntityUpdateType = {}));
12
12
  //# sourceMappingURL=entity-queue.js.map
@@ -1,23 +1,24 @@
1
- import { EntityUid, EntityTypeUid, IEntity } from "./entity";
2
- /**
3
- * The Entity Repository internal structure. Holds the Entity as well as LastUpdate time.
4
- */
5
- export interface StoredEntity<TEntity extends IEntity> {
6
- entity: TEntity;
7
- lastUpdate: Date;
8
- }
9
- /**
10
- * The Entity Repository is the main storage for keeping track of existing Entities.
11
- * It provides basic CRUD functionality.
12
- */
13
- export interface IEntityRepository {
14
- has(type: EntityTypeUid, uid: EntityUid): boolean;
15
- get<TEntity extends IEntity>(type: EntityTypeUid, uid: EntityUid): TEntity;
16
- getWithTime<TEntity extends IEntity>(type: EntityTypeUid, uid: EntityUid): StoredEntity<TEntity>;
17
- getAll<TEntity extends IEntity>(type: EntityTypeUid): TEntity[];
18
- set(entity: IEntity): void;
19
- delete(type: EntityTypeUid, uid: EntityUid): void;
20
- clear(entityType: EntityTypeUid): void;
21
- onEntitySetCallback?: (entity: IEntity) => void;
22
- onEntityDeletedCallback?: (entity: IEntity) => void;
23
- }
1
+ import { EntityUid, EntityTypeUid, IEntity } from "./entity";
2
+ /**
3
+ * The Entity Repository internal structure. Holds the Entity as well as LastUpdate time.
4
+ */
5
+ export interface StoredEntity<TEntity extends IEntity> {
6
+ entity: TEntity;
7
+ lastUpdate: Date;
8
+ }
9
+ /**
10
+ * The Entity Repository is the main storage for keeping track of existing Entities.
11
+ * It provides basic CRUD functionality.
12
+ */
13
+ export interface IEntityRepository {
14
+ has(type: EntityTypeUid, uid: EntityUid): boolean;
15
+ get<TEntity extends IEntity>(type: EntityTypeUid, uid: EntityUid): TEntity;
16
+ getWithTime<TEntity extends IEntity>(type: EntityTypeUid, uid: EntityUid): StoredEntity<TEntity>;
17
+ getAll<TEntity extends IEntity>(type: EntityTypeUid): TEntity[];
18
+ listAll(): StoredEntity<IEntity>[];
19
+ set(entity: IEntity): void;
20
+ delete(type: EntityTypeUid, uid: EntityUid): void;
21
+ clear(entityType: EntityTypeUid): void;
22
+ onEntitySetCallback?: (entity: IEntity) => void;
23
+ onEntityDeletedCallback?: (entity: IEntity) => void;
24
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=entity-repository.js.map
@@ -1,11 +1,11 @@
1
- import { IEntityProxy } from "./entity-proxy";
2
- /**
3
- * The Entity Scheduler is the main way of scheduling Entity Updates on a Time Interval.
4
- * It usually reads the Entities from the Entity Repository,
5
- * and uses the Entity Update Queue to enqueue Entity updates.
6
- */
7
- export interface IEntityScheduler {
8
- schedule(entityProxy: IEntityProxy, intervalMs?: number): void;
9
- remove(entityProxy: IEntityProxy): void;
10
- has(entityProxy: IEntityProxy): boolean;
11
- }
1
+ import { IEntityProxy } from "./entity-proxy";
2
+ /**
3
+ * The Entity Scheduler is the main way of scheduling Entity Updates on a Time Interval.
4
+ * It usually reads the Entities from the Entity Repository,
5
+ * and uses the Entity Update Queue to enqueue Entity updates.
6
+ */
7
+ export interface IEntityScheduler {
8
+ schedule(entityProxy: IEntityProxy, intervalMs?: number): void;
9
+ remove(entityProxy: IEntityProxy): void;
10
+ has(entityProxy: IEntityProxy): boolean;
11
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=entity-scheduler.js.map
@@ -1,17 +1,17 @@
1
- import { IdentityComponent } from "../components/identity-component";
2
- import { ComponentTypeUid, IComponent } from "../components/component";
3
- import { IEntityProxy } from "./entity-proxy";
4
- export declare type EntityTypeUid = string | number;
5
- export declare type EntityUid = string | number;
6
- export interface IEntityModel {
7
- uid: EntityUid;
8
- }
9
- /**
10
- * An Entity is a container of Components and Entity Proxies. Only Systems can manipulate the internal state of the Entity.
11
- */
12
- export interface IEntity {
13
- readonly components: Map<ComponentTypeUid, IComponent>;
14
- readonly proxies: Map<EntityTypeUid, Map<EntityUid, IEntityProxy>>;
15
- readonly identity: IdentityComponent<IEntityModel>;
16
- readonly myProxy: IEntityProxy;
17
- }
1
+ import { IdentityComponent } from "../components/identity-component";
2
+ import { ComponentTypeUid, IComponent } from "../components/component";
3
+ import { IEntityProxy } from "./entity-proxy";
4
+ export declare type EntityTypeUid = string | number;
5
+ export declare type EntityUid = string | number;
6
+ export interface IEntityModel {
7
+ uid: EntityUid;
8
+ }
9
+ /**
10
+ * An Entity is a container of Components and Entity Proxies. Only Systems can manipulate the internal state of the Entity.
11
+ */
12
+ export interface IEntity {
13
+ readonly components: Map<ComponentTypeUid, IComponent>;
14
+ readonly proxies: Map<EntityTypeUid, Map<EntityUid, IEntityProxy>>;
15
+ readonly identity: IdentityComponent<IEntityModel>;
16
+ readonly myProxy: IEntityProxy;
17
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=entity.js.map
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
- export * from './components/component';
2
- export * from './components/identity-component';
3
- export * from './entities/entity';
4
- export * from './entities/entity-events';
5
- export * from './entities/entity-proxy';
6
- export * from './entities/entity-queue';
7
- export * from './entities/entity-repository';
8
- export * from './entities/entity-scheduler';
9
- export * from './pipelines/middleware';
10
- export * from './pipelines/pipeline';
11
- export * from './systems/system-middleware';
12
- export * from './systems/systems-module';
13
- export * from './systems/system-pipeline-context';
14
- export * from './systems/system-pipeline-type';
15
- export * from './systems/systems-runtime';
16
- export * from './utils/performance-timer';
1
+ export * from './components/component';
2
+ export * from './components/identity-component';
3
+ export * from './entities/entity';
4
+ export * from './entities/entity-events';
5
+ export * from './entities/entity-proxy';
6
+ export * from './entities/entity-queue';
7
+ export * from './entities/entity-repository';
8
+ export * from './entities/entity-scheduler';
9
+ export * from './pipelines/middleware';
10
+ export * from './pipelines/pipeline';
11
+ export * from './systems/system-middleware';
12
+ export * from './systems/systems-module';
13
+ export * from './systems/system-pipeline-context';
14
+ export * from './systems/system-pipeline-type';
15
+ export * from './systems/systems-runtime';
16
+ export * from './utils/performance-timer';
package/dist/index.js CHANGED
@@ -1,33 +1,33 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./components/component"), exports);
18
- __exportStar(require("./components/identity-component"), exports);
19
- __exportStar(require("./entities/entity"), exports);
20
- __exportStar(require("./entities/entity-events"), exports);
21
- __exportStar(require("./entities/entity-proxy"), exports);
22
- __exportStar(require("./entities/entity-queue"), exports);
23
- __exportStar(require("./entities/entity-repository"), exports);
24
- __exportStar(require("./entities/entity-scheduler"), exports);
25
- __exportStar(require("./pipelines/middleware"), exports);
26
- __exportStar(require("./pipelines/pipeline"), exports);
27
- __exportStar(require("./systems/system-middleware"), exports);
28
- __exportStar(require("./systems/systems-module"), exports);
29
- __exportStar(require("./systems/system-pipeline-context"), exports);
30
- __exportStar(require("./systems/system-pipeline-type"), exports);
31
- __exportStar(require("./systems/systems-runtime"), exports);
32
- __exportStar(require("./utils/performance-timer"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./components/component"), exports);
18
+ __exportStar(require("./components/identity-component"), exports);
19
+ __exportStar(require("./entities/entity"), exports);
20
+ __exportStar(require("./entities/entity-events"), exports);
21
+ __exportStar(require("./entities/entity-proxy"), exports);
22
+ __exportStar(require("./entities/entity-queue"), exports);
23
+ __exportStar(require("./entities/entity-repository"), exports);
24
+ __exportStar(require("./entities/entity-scheduler"), exports);
25
+ __exportStar(require("./pipelines/middleware"), exports);
26
+ __exportStar(require("./pipelines/pipeline"), exports);
27
+ __exportStar(require("./systems/system-middleware"), exports);
28
+ __exportStar(require("./systems/systems-module"), exports);
29
+ __exportStar(require("./systems/system-pipeline-context"), exports);
30
+ __exportStar(require("./systems/system-pipeline-type"), exports);
31
+ __exportStar(require("./systems/systems-runtime"), exports);
32
+ __exportStar(require("./utils/performance-timer"), exports);
33
33
  //# sourceMappingURL=index.js.map
@@ -1,26 +1,26 @@
1
- /**
2
- * 'Stop' function, passed to a middleware. Call it to break the pipeline execution.
3
- */
4
- export declare type Stop = () => void;
5
- /**
6
- * A middleware, the building block of a Pipeline. The middlewares will get called in the same order they get registered in the Pipeline.
7
- */
8
- export interface IMiddleware<TContext> {
9
- /**
10
- * This (optional) function gets called before executing the middleware. It acts as a boolean gateway whether enough conditions are
11
- * being met so this middleware's action should run.
12
- * @param context The Context to determine whether the run condition is satisfied.
13
- */
14
- shouldRun?(context: TContext): Promise<boolean> | boolean;
15
- /**
16
- * The function gets called as part of the pipeline, based on the registration order.
17
- * @param context The Context can be read or updated. The Context holds all the state necessary for the execution of the middleware.
18
- * @param stop The function to halt the execution of the Pipeline. The next Middlewares won't be called anymore.
19
- */
20
- action(context: TContext, stop: Stop): Promise<void> | void;
21
- /**
22
- * This (optional) function gets called when the cleanup of the Pipeline is necessary, based on reverse order of Middleware registration.
23
- * @param context Part of the Context should be cleaned, and any allocated resources in the Action, should be disposed.
24
- */
25
- cleanup?(context: TContext): Promise<void> | void;
26
- }
1
+ /**
2
+ * 'Stop' function, passed to a middleware. Call it to break the pipeline execution.
3
+ */
4
+ export declare type Stop = () => void;
5
+ /**
6
+ * A middleware, the building block of a Pipeline. The middlewares will get called in the same order they get registered in the Pipeline.
7
+ */
8
+ export interface IMiddleware<TContext> {
9
+ /**
10
+ * This (optional) function gets called before executing the middleware. It acts as a boolean gateway whether enough conditions are
11
+ * being met so this middleware's action should run.
12
+ * @param context The Context to determine whether the run condition is satisfied.
13
+ */
14
+ shouldRun?(context: TContext): Promise<boolean> | boolean;
15
+ /**
16
+ * The function gets called as part of the pipeline, based on the registration order.
17
+ * @param context The Context can be read or updated. The Context holds all the state necessary for the execution of the middleware.
18
+ * @param stop The function to halt the execution of the Pipeline. The next Middlewares won't be called anymore.
19
+ */
20
+ action(context: TContext, stop: Stop): Promise<void> | void;
21
+ /**
22
+ * This (optional) function gets called when the cleanup of the Pipeline is necessary, based on reverse order of Middleware registration.
23
+ * @param context Part of the Context should be cleaned, and any allocated resources in the Action, should be disposed.
24
+ */
25
+ cleanup?(context: TContext): Promise<void> | void;
26
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=middleware.js.map
@@ -1,18 +1,27 @@
1
- import { IMiddleware } from "./middleware";
2
- /**
3
- * A middleware container and dispatcher.
4
- */
5
- export interface IPipeline<TContext> {
6
- /**
7
- * Register middlewares for this pipeline, in order.
8
- */
9
- use(...mw: IMiddleware<TContext>[]): void;
10
- /**
11
- * Execute the chain of middlewares, in the order they were added on a given Context.
12
- */
13
- dispatch(context: TContext): boolean;
14
- /**
15
- * Runs the Cleanup function on all middlewares.
16
- */
17
- cleanup(context: TContext): void;
18
- }
1
+ import { PerformanceTimeEntry } from "../utils/performance-timer";
2
+ import { IMiddleware } from "./middleware";
3
+ export declare enum PipelineStatus {
4
+ completed = 0,
5
+ halted = 1
6
+ }
7
+ export interface IPipelineResult {
8
+ readonly status: PipelineStatus;
9
+ readonly metrics: PerformanceTimeEntry[];
10
+ }
11
+ /**
12
+ * A middleware container and dispatcher.
13
+ */
14
+ export interface IPipeline<TContext> {
15
+ /**
16
+ * Register middlewares for this pipeline, in order.
17
+ */
18
+ use(...middleware: IMiddleware<TContext>[]): void;
19
+ /**
20
+ * Execute the chain of middlewares, in the order they were added on a given Context.
21
+ */
22
+ dispatch(context: TContext): IPipelineResult | Promise<IPipelineResult>;
23
+ /**
24
+ * Runs the Cleanup function on all middlewares.
25
+ */
26
+ cleanup(context: TContext): IPipelineResult | Promise<IPipelineResult>;
27
+ }
@@ -1,3 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PipelineStatus = void 0;
4
+ var PipelineStatus;
5
+ (function (PipelineStatus) {
6
+ PipelineStatus[PipelineStatus["completed"] = 0] = "completed";
7
+ PipelineStatus[PipelineStatus["halted"] = 1] = "halted";
8
+ })(PipelineStatus = exports.PipelineStatus || (exports.PipelineStatus = {}));
3
9
  //# sourceMappingURL=pipeline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/pipelines/pipeline.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/pipelines/pipeline.ts"],"names":[],"mappings":";;;AAGA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6DAAS,CAAA;IACT,uDAAM,CAAA;AACR,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB"}