@bluelibs/runner 1.0.0 → 1.2.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 +231 -12
- package/dist/DependencyProcessor.d.ts +2 -2
- package/dist/DependencyProcessor.js +3 -3
- package/dist/DependencyProcessor.js.map +1 -1
- package/dist/EventManager.d.ts +4 -0
- package/dist/EventManager.js +15 -0
- package/dist/EventManager.js.map +1 -1
- package/dist/Store.d.ts +30 -2
- package/dist/Store.js +134 -29
- package/dist/Store.js.map +1 -1
- package/dist/TaskRunner.d.ts +3 -0
- package/dist/TaskRunner.js +3 -0
- package/dist/TaskRunner.js.map +1 -1
- package/dist/define.js +2 -7
- package/dist/define.js.map +1 -1
- package/dist/defs.d.ts +15 -4
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -1
- package/dist/globalEvents.d.ts +2 -0
- package/dist/globalEvents.js +3 -0
- package/dist/globalEvents.js.map +1 -1
- package/dist/globalResources.d.ts +8 -6
- package/dist/globalResources.js +9 -4
- package/dist/globalResources.js.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/models/DependencyProcessor.d.ts +49 -0
- package/dist/models/DependencyProcessor.js +178 -0
- package/dist/models/DependencyProcessor.js.map +1 -0
- package/dist/models/EventManager.d.ts +17 -0
- package/dist/models/EventManager.js +73 -0
- package/dist/models/EventManager.js.map +1 -0
- package/dist/models/Logger.d.ts +33 -0
- package/dist/models/Logger.js +76 -0
- package/dist/models/Logger.js.map +1 -0
- package/dist/models/ResourceInitializer.d.ts +13 -0
- package/dist/models/ResourceInitializer.js +54 -0
- package/dist/models/ResourceInitializer.js.map +1 -0
- package/dist/models/Store.d.ts +90 -0
- package/dist/models/Store.js +302 -0
- package/dist/models/Store.js.map +1 -0
- package/dist/models/TaskRunner.d.ts +25 -0
- package/dist/models/TaskRunner.js +96 -0
- package/dist/models/TaskRunner.js.map +1 -0
- package/dist/models/index.d.ts +5 -0
- package/dist/models/index.js +22 -0
- package/dist/models/index.js.map +1 -0
- package/dist/run.d.ts +4 -4
- package/dist/run.js +14 -7
- package/dist/run.js.map +1 -1
- package/package.json +1 -2
- package/src/__tests__/index.ts +8 -4
- package/src/__tests__/{EventManager.test.ts → models/EventManager.test.ts} +20 -2
- package/src/__tests__/models/Logger.test.ts +140 -0
- package/src/__tests__/{ResourceInitializer.test.ts → models/ResourceInitializer.test.ts} +4 -4
- package/src/__tests__/models/Store.test.ts +128 -0
- package/src/__tests__/{TaskRunner.test.ts → models/TaskRunner.test.ts} +5 -5
- package/src/__tests__/run.overrides.test.ts +392 -0
- package/src/__tests__/run.test.ts +28 -1
- package/src/define.ts +4 -8
- package/src/defs.ts +20 -4
- package/src/errors.ts +6 -0
- package/src/globalEvents.ts +4 -0
- package/src/globalResources.ts +18 -11
- package/src/index.ts +3 -3
- package/src/{DependencyProcessor.ts → models/DependencyProcessor.ts} +6 -6
- package/src/{EventManager.ts → models/EventManager.ts} +21 -1
- package/src/models/Logger.ts +100 -0
- package/src/{ResourceInitializer.ts → models/ResourceInitializer.ts} +2 -2
- package/src/{Store.ts → models/Store.ts} +181 -41
- package/src/{TaskRunner.ts → models/TaskRunner.ts} +6 -3
- package/src/models/index.ts +5 -0
- package/src/run.ts +17 -9
- package/src/__tests__/Store.test.ts +0 -143
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ const app = resource({
|
|
|
77
77
|
});
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
### When to use
|
|
80
|
+
### When to use each?
|
|
81
81
|
|
|
82
82
|
It is unrealistic to create a task for everything you're doing in your system, not only it will be tedious for the developer, but it will affect performance unnecessarily. The idea is to think of a task of something that you want trackable as an action, for example:
|
|
83
83
|
|
|
@@ -87,6 +87,47 @@ It is unrealistic to create a task for everything you're doing in your system, n
|
|
|
87
87
|
|
|
88
88
|
Resources are more like services, they are singletons, they are meant to be used as a shared functionality across your application. They can be constants, services, functions, etc.
|
|
89
89
|
|
|
90
|
+
### Resource dispose()
|
|
91
|
+
|
|
92
|
+
Resources can have a `dispose()` method that can be used to clean up resources. This is useful for cleaning up resources like closing database connections, etc. You typically want to use this when you have opened pending connections or you need to do some cleanup or a graceful shutdown.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import { task, run, resource } from "@bluelibs/runner";
|
|
96
|
+
|
|
97
|
+
const dbResource = resource({
|
|
98
|
+
async init(config, deps) {
|
|
99
|
+
const db = await connectToDatabase();
|
|
100
|
+
return db;
|
|
101
|
+
},
|
|
102
|
+
async dispose(db, config, deps) {
|
|
103
|
+
return db.close();
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
If you want to call dispose, you have to do it through the global store.
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { task, run, resource, globals } from "@bluelibs/runner";
|
|
112
|
+
|
|
113
|
+
const app = resource({
|
|
114
|
+
id: "app",
|
|
115
|
+
register: [dbResource],
|
|
116
|
+
dependencies: {
|
|
117
|
+
store: globals.resources.store,
|
|
118
|
+
},
|
|
119
|
+
async init(_, deps) {
|
|
120
|
+
return {
|
|
121
|
+
dispose: async () => deps.store.dispose(),
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const value = await run(app);
|
|
127
|
+
// To begin the disposal process.
|
|
128
|
+
await value.dispose();
|
|
129
|
+
```
|
|
130
|
+
|
|
90
131
|
## Encapsulation
|
|
91
132
|
|
|
92
133
|
We want to make sure that our tasks are not dependent on the outside world. This is why we have the `dependencies` object.
|
|
@@ -153,7 +194,7 @@ const root = resource({
|
|
|
153
194
|
|
|
154
195
|
There are only 2 ways to listen to events:
|
|
155
196
|
|
|
156
|
-
|
|
197
|
+
### `on` property
|
|
157
198
|
|
|
158
199
|
```ts
|
|
159
200
|
import { task, run, event } from "@bluelibs/runner";
|
|
@@ -184,10 +225,10 @@ const root = resource({
|
|
|
184
225
|
|
|
185
226
|
### `hooks` property
|
|
186
227
|
|
|
187
|
-
This
|
|
228
|
+
This can only be applied to a `resource()`.
|
|
188
229
|
|
|
189
230
|
```ts
|
|
190
|
-
import { task, resource, run, event } from "@bluelibs/runner";
|
|
231
|
+
import { task, resource, run, event, global } from "@bluelibs/runner";
|
|
191
232
|
|
|
192
233
|
const afterRegisterEvent = event<{ userId: string }>({
|
|
193
234
|
id: "app.user.registered",
|
|
@@ -196,14 +237,11 @@ const afterRegisterEvent = event<{ userId: string }>({
|
|
|
196
237
|
const root = resource({
|
|
197
238
|
id: "app",
|
|
198
239
|
register: [afterRegisterEvent],
|
|
199
|
-
dependencies: {
|
|
200
|
-
// ...
|
|
201
|
-
}
|
|
240
|
+
dependencies: {},
|
|
202
241
|
hooks: [
|
|
203
242
|
{
|
|
204
|
-
event:
|
|
243
|
+
event: global.events.afterInit,
|
|
205
244
|
async run(event, deps) {
|
|
206
|
-
// the dependencies from init() also arrive inside the hooks()
|
|
207
245
|
console.log("User has been registered!");
|
|
208
246
|
},
|
|
209
247
|
},
|
|
@@ -214,6 +252,10 @@ const root = resource({
|
|
|
214
252
|
});
|
|
215
253
|
```
|
|
216
254
|
|
|
255
|
+
When using hooks, inside resource() you benefit of autocompletion, in order to keep things clean, if your hooks become large and long consider switching to tasks and `on`. This is a more explicit way to listen to events, and your resource registers them.
|
|
256
|
+
|
|
257
|
+
The hooks from a `resource` are mostly used for configuration, and blending in the system.
|
|
258
|
+
|
|
217
259
|
## Middleware
|
|
218
260
|
|
|
219
261
|
Middleware is a way to intercept the execution of tasks. It's a powerful way to add additional functionality to your tasks. First middleware that gets registered is the first that runs, the last middleware that runs is 'closest' to the task, most likely the last element inside `middleware` array at task level.
|
|
@@ -763,6 +805,7 @@ const securityResource = resource({
|
|
|
763
805
|
securityConfigurationPhaseEvent,
|
|
764
806
|
},
|
|
765
807
|
async init(config: SecurityOptions) {
|
|
808
|
+
// Give the ability to other listeners to modify the configuration
|
|
766
809
|
securityConfigurationPhaseEvent(config);
|
|
767
810
|
|
|
768
811
|
return {
|
|
@@ -786,11 +829,187 @@ const app = resource({
|
|
|
786
829
|
});
|
|
787
830
|
```
|
|
788
831
|
|
|
789
|
-
##
|
|
832
|
+
## Logging
|
|
833
|
+
|
|
834
|
+
We expose through globals a logger that you can use to log things.
|
|
790
835
|
|
|
791
|
-
|
|
836
|
+
By default logs are not printed unless a resource listens to the log event. This is by design, when something is logged an event is emitted. You can listen to this event and print the logs.
|
|
837
|
+
|
|
838
|
+
```ts
|
|
839
|
+
import { task, run, event, globals } from "@bluelibs/runner";
|
|
840
|
+
|
|
841
|
+
const helloWorld = task({
|
|
842
|
+
id: "app.helloWorld",
|
|
843
|
+
dependencies: {
|
|
844
|
+
logger: globals.resources.logger,
|
|
845
|
+
},
|
|
846
|
+
run: async (_, { logger }) => {
|
|
847
|
+
await logger.info("Hello World!");
|
|
848
|
+
// or logger.log(level, data);
|
|
849
|
+
},
|
|
850
|
+
});
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
### Logs Summary Table
|
|
854
|
+
|
|
855
|
+
| Log Level | Description | Usage Example |
|
|
856
|
+
| ------------ | ----------------------------------------- | -------------------------------------- |
|
|
857
|
+
| **trace** | Very detailed logs, usually for debugging | "Entering function X with params Y." |
|
|
858
|
+
| **debug** | Detailed debug information | "Fetching user data: userId=123." |
|
|
859
|
+
| **info** | General application information | "Service started on port 8080." |
|
|
860
|
+
| **warn** | Indicates a potential issue | "Disk space running low." |
|
|
861
|
+
| **error** | Indicates a significant problem | "Unable to connect to database." |
|
|
862
|
+
| **critical** | Serious problem causing a crash | "System out of memory, shutting down." |
|
|
863
|
+
|
|
864
|
+
### Print logs
|
|
865
|
+
|
|
866
|
+
Logs don't get printed by default in this system.
|
|
867
|
+
|
|
868
|
+
```ts
|
|
869
|
+
import { task, run, event, globals, resource } from "@bluelibs/runner";
|
|
870
|
+
|
|
871
|
+
const printLog = task({
|
|
872
|
+
id: "app.task.printLog",
|
|
873
|
+
on: globals.events.log,
|
|
874
|
+
dependencies: {
|
|
875
|
+
logger: globals.resources.logger,
|
|
876
|
+
},
|
|
877
|
+
run: async (event, { logger }) => {
|
|
878
|
+
logger.print(event);
|
|
879
|
+
},
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
const app = resource({
|
|
883
|
+
id: "root",
|
|
884
|
+
register: [printLog],
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
// Now your app will print all logs
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
You can in theory do it in `hooks` as well, but as specified `hooks` are mostly used for configuration and blending in the system.
|
|
891
|
+
|
|
892
|
+
The logger's `log()` function is async as it works with events. If you don't want your system hanging on logs, simply omit the `await`
|
|
893
|
+
|
|
894
|
+
## Overrides
|
|
895
|
+
|
|
896
|
+
Previously, we explored how we can extend functionality through events. However, sometimes you want to override a resource with a new one or simply swap out a task or a middleware that you import from another package and they don't offer the ability.
|
|
897
|
+
|
|
898
|
+
```ts
|
|
899
|
+
import { resource, run, event } from "@bluelibs/runner";
|
|
900
|
+
|
|
901
|
+
// This example is for resources but override works for tasks, events, and middleware as well.
|
|
902
|
+
const securityResource = resource({
|
|
903
|
+
id: "app.security",
|
|
904
|
+
async init() {
|
|
905
|
+
// returns a security service
|
|
906
|
+
},
|
|
907
|
+
});
|
|
908
|
+
|
|
909
|
+
const override = resource({
|
|
910
|
+
...securityResource,
|
|
911
|
+
init: async () => {
|
|
912
|
+
// a new and custom service
|
|
913
|
+
},
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
const app = resource({
|
|
917
|
+
id: "app",
|
|
918
|
+
register: [securityResource], // this resource might be registered by any element in the dependency tree.
|
|
919
|
+
overrides: [override],
|
|
920
|
+
});
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
Now the `securityResource` will be overriden by the new one and whenever it's used it will use the new one.
|
|
924
|
+
|
|
925
|
+
Overrides can only happen once and only if the overriden resource is registered. If two resources try to override the same resource, an error will be thrown.
|
|
926
|
+
|
|
927
|
+
## Testing
|
|
928
|
+
|
|
929
|
+
### Unit Testing
|
|
930
|
+
|
|
931
|
+
You can easily test your resources and tasks by running them in a test environment.
|
|
932
|
+
|
|
933
|
+
The only bits that you need to test are the `run` function and the `init` functions with the propper dependencies.
|
|
934
|
+
|
|
935
|
+
```ts
|
|
936
|
+
import { task, resource } from "@bluelibs/runner";
|
|
937
|
+
|
|
938
|
+
const helloWorld = task({
|
|
939
|
+
id: "app.helloWorld",
|
|
940
|
+
run: async () => {
|
|
941
|
+
return "Hello World!";
|
|
942
|
+
},
|
|
943
|
+
});
|
|
944
|
+
|
|
945
|
+
const helloWorldResource = resource({
|
|
946
|
+
id: "app.helloWorldResource",
|
|
947
|
+
init: async () => {
|
|
948
|
+
return "Hello World!";
|
|
949
|
+
},
|
|
950
|
+
});
|
|
951
|
+
|
|
952
|
+
// sample tests for the task
|
|
953
|
+
describe("app.helloWorld", () => {
|
|
954
|
+
it("should return Hello World!", async () => {
|
|
955
|
+
const result = await helloWorld.run(input, dependencies); // pass in the arguments and the mocked dependencies.
|
|
956
|
+
expect(result).toBe("Hello World!");
|
|
957
|
+
});
|
|
958
|
+
});
|
|
959
|
+
|
|
960
|
+
// sample tests for the resource
|
|
961
|
+
describe("app.helloWorldResource", () => {
|
|
962
|
+
it("should return Hello World!", async () => {
|
|
963
|
+
const result = await helloWorldResource.init(config, dependencies); // pass in the arguments and the mocked dependencies.
|
|
964
|
+
expect(result).toBe("Hello World!");
|
|
965
|
+
});
|
|
966
|
+
});
|
|
967
|
+
```
|
|
968
|
+
|
|
969
|
+
### Integration
|
|
970
|
+
|
|
971
|
+
Unit testing can be very simply with mocks, since all dependencies are explicit. However, if you would like to run an integration test, and have a task be tested and within the full container.
|
|
972
|
+
|
|
973
|
+
```ts
|
|
974
|
+
import { task, resource, run, global } from "@bluelibs/runner";
|
|
975
|
+
|
|
976
|
+
const task = task({
|
|
977
|
+
id: "app.myTask",
|
|
978
|
+
run: async () => {
|
|
979
|
+
return "Hello World!";
|
|
980
|
+
},
|
|
981
|
+
});
|
|
982
|
+
|
|
983
|
+
const app = resource({
|
|
984
|
+
id: "app",
|
|
985
|
+
register: [myTask],
|
|
986
|
+
});
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
Then your tests can now be cleaner:
|
|
990
|
+
|
|
991
|
+
```ts
|
|
992
|
+
describe("app", () => {
|
|
993
|
+
it("an example to override a task or resource", async () => {
|
|
994
|
+
const testApp = resource({
|
|
995
|
+
id: "app.test",
|
|
996
|
+
register: [myApp], // wrap your existing app
|
|
997
|
+
overrides: [override], // apply the overrides
|
|
998
|
+
init: async (_, deps) => {
|
|
999
|
+
// you can now test a task simply by depending on it, and running it, then asserting the response of run()
|
|
1000
|
+
},
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
// Same concept applies for resources as well.
|
|
1004
|
+
|
|
1005
|
+
await run(testApp);
|
|
1006
|
+
});
|
|
1007
|
+
});
|
|
1008
|
+
```
|
|
1009
|
+
|
|
1010
|
+
## Support
|
|
792
1011
|
|
|
793
|
-
|
|
1012
|
+
This package is part of the [BlueLibs](https://www.bluelibs.com) family. If you enjoy this work, please show your support by starring [the main repository](https://github.com/bluelibs/runner).
|
|
794
1013
|
|
|
795
1014
|
## License
|
|
796
1015
|
|
|
@@ -29,13 +29,13 @@ export declare class DependencyProcessor {
|
|
|
29
29
|
* Processes all hooks, should run before emission of any event.
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
attachHooks(): void;
|
|
33
33
|
/**
|
|
34
34
|
* Processes the hooks for resources
|
|
35
35
|
* @param hooks
|
|
36
36
|
* @param deps
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
attachHooksToResource(resourceStoreElement: ResourceStoreElementType<any, any, {}>): void;
|
|
39
39
|
extractDependencies<T extends DependencyMapType>(map: T): Promise<DependencyValuesType<T>>;
|
|
40
40
|
extractDependency(object: any): Promise<any>;
|
|
41
41
|
/**
|
|
@@ -76,11 +76,11 @@ class DependencyProcessor {
|
|
|
76
76
|
* Processes all hooks, should run before emission of any event.
|
|
77
77
|
* @returns
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
attachHooks() {
|
|
80
80
|
// iterate through resources and send them to processHooks
|
|
81
81
|
for (const resource of this.store.resources.values()) {
|
|
82
82
|
if (resource.resource.hooks) {
|
|
83
|
-
this.
|
|
83
|
+
this.attachHooksToResource(resource);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -89,7 +89,7 @@ class DependencyProcessor {
|
|
|
89
89
|
* @param hooks
|
|
90
90
|
* @param deps
|
|
91
91
|
*/
|
|
92
|
-
|
|
92
|
+
attachHooksToResource(resourceStoreElement) {
|
|
93
93
|
let hooks = resourceStoreElement.resource.hooks;
|
|
94
94
|
if (typeof hooks === "function") {
|
|
95
95
|
hooks = hooks(resourceStoreElement.config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyProcessor.js","sourceRoot":"","sources":["../src/DependencyProcessor.ts"],"names":[],"mappings":";;;AASA,kCAAkC;AAElC,+DAA4D;AAE5D,qCAAkC;AAElC;;;;GAIG;AACH,MAAa,mBAAmB;IAIT;IACA;IACA;IALF,mBAAmB,CAAsB;IAE5D,YACqB,KAAY,EACZ,YAA0B,EAC1B,UAAsB;QAFtB,UAAK,GAAL,KAAK,CAAO;QACZ,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAAY;QAEzC,IAAI,CAAC,mBAAmB,GAAG,IAAI,yCAAmB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,sBAAsB;QAC1B,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC;YACzD,MAAM,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC,YAAiC,C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
|
4
4
|
filter?: (event: IEvent<T>) => boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare class EventManager {
|
|
7
|
+
#private;
|
|
7
8
|
private listeners;
|
|
8
9
|
private globalListeners;
|
|
10
|
+
get isLocked(): boolean;
|
|
11
|
+
lock(): void;
|
|
12
|
+
checkLock(): void;
|
|
9
13
|
emit<TInput>(eventDefinition: IEventDefinition<TInput>, ...args: TInput extends void ? [] : [TInput]): Promise<void>;
|
|
10
14
|
addListener<T>(event: IEventDefinition | Array<IEventDefinition>, handler: EventHandlerType<T>, options?: IEventHandlerOptions<T>): void;
|
|
11
15
|
addGlobalListener(handler: EventHandlerType, options?: IEventHandlerOptions): void;
|
package/dist/EventManager.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EventManager = void 0;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
4
5
|
const HandlerOptionsDefaults = { order: 0 };
|
|
5
6
|
class EventManager {
|
|
6
7
|
listeners = new Map();
|
|
7
8
|
globalListeners = [];
|
|
9
|
+
#isLocked = false;
|
|
10
|
+
get isLocked() {
|
|
11
|
+
return this.#isLocked;
|
|
12
|
+
}
|
|
13
|
+
lock() {
|
|
14
|
+
this.#isLocked = true;
|
|
15
|
+
}
|
|
16
|
+
checkLock() {
|
|
17
|
+
if (this.#isLocked) {
|
|
18
|
+
throw errors_1.Errors.locked("EventManager");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
8
21
|
async emit(eventDefinition, ...args) {
|
|
9
22
|
const data = args[0];
|
|
10
23
|
const eventListeners = this.listeners.get(eventDefinition.id) || [];
|
|
@@ -24,6 +37,7 @@ class EventManager {
|
|
|
24
37
|
}
|
|
25
38
|
}
|
|
26
39
|
addListener(event, handler, options = HandlerOptionsDefaults) {
|
|
40
|
+
this.checkLock();
|
|
27
41
|
if (Array.isArray(event)) {
|
|
28
42
|
event.forEach((id) => this.addListener(id, handler, options));
|
|
29
43
|
}
|
|
@@ -40,6 +54,7 @@ class EventManager {
|
|
|
40
54
|
}
|
|
41
55
|
}
|
|
42
56
|
addGlobalListener(handler, options = HandlerOptionsDefaults) {
|
|
57
|
+
this.checkLock();
|
|
43
58
|
const newListener = {
|
|
44
59
|
handler,
|
|
45
60
|
order: options.order || 0,
|
package/dist/EventManager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventManager.js","sourceRoot":"","sources":["../src/EventManager.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"EventManager.js","sourceRoot":"","sources":["../src/EventManager.ts"],"names":[],"mappings":";;;AACA,qCAAkC;AAElC,MAAM,sBAAsB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAa5C,MAAa,YAAY;IACf,SAAS,GAAoC,IAAI,GAAG,EAAE,CAAC;IACvD,eAAe,GAAuB,EAAE,CAAC;IACjD,SAAS,GAAG,KAAK,CAAC;IAElB,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAI;QACF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,SAAS;QACP,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,eAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CACR,eAAyC,EACzC,GAAG,IAAyC;QAE5C,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QACpE,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC;YACtC,GAAG,cAAc;YACjB,GAAG,IAAI,CAAC,eAAe;SACxB,CAAC,CAAC;QAEH,MAAM,KAAK,GAAW;Y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KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;YACzB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;QAEF,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC;YACxC,GAAG,IAAI,CAAC,eAAe;YACvB,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;IAEO,aAAa,CAAC,SAA6B;QACjD,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;CACF;AAvFD,oCAuFC"}
|
package/dist/Store.d.ts
CHANGED
|
@@ -21,16 +21,21 @@ export type EventStoreElementType = {
|
|
|
21
21
|
event: IEventDefinition;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Store class which is used to store all the resources, tasks, middleware and events.
|
|
25
25
|
*/
|
|
26
26
|
export declare class Store {
|
|
27
|
+
#private;
|
|
27
28
|
protected readonly eventManager: EventManager;
|
|
28
29
|
root: ResourceStoreElementType;
|
|
29
30
|
tasks: Map<string, TaskStoreElementType>;
|
|
30
31
|
resources: Map<string, ResourceStoreElementType>;
|
|
31
32
|
events: Map<string, EventStoreElementType>;
|
|
32
33
|
middlewares: Map<string, MiddlewareStoreElementType>;
|
|
34
|
+
overrides: Map<string, IResource | IMiddleware | ITask>;
|
|
33
35
|
constructor(eventManager: EventManager);
|
|
36
|
+
get isLocked(): boolean;
|
|
37
|
+
lock(): void;
|
|
38
|
+
checkLock(): void;
|
|
34
39
|
/**
|
|
35
40
|
* Store the root before beginning registration
|
|
36
41
|
* @param root
|
|
@@ -42,21 +47,44 @@ export declare class Store {
|
|
|
42
47
|
* @param element
|
|
43
48
|
* @param config
|
|
44
49
|
*/
|
|
45
|
-
|
|
50
|
+
private computeRegistrationDeeply;
|
|
51
|
+
/**
|
|
52
|
+
* @param element
|
|
53
|
+
*/
|
|
54
|
+
private storeOverridesDeeply;
|
|
46
55
|
/**
|
|
47
56
|
* middlewares are already stored in their final form and the check for them would be redundant
|
|
48
57
|
* @param id
|
|
49
58
|
*/
|
|
50
59
|
protected checkIfIDExists(id: string): void | never;
|
|
60
|
+
/**
|
|
61
|
+
* Cleanup
|
|
62
|
+
*/
|
|
63
|
+
dispose(): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* When this is called, all overrides should have been stored in the "overrides" store.
|
|
66
|
+
*/
|
|
67
|
+
processOverrides(): void;
|
|
51
68
|
getGlobalMiddlewares(excludingIds: string[]): IMiddleware[];
|
|
52
69
|
/**
|
|
53
70
|
* If you want to register something to the store you can use this function.
|
|
54
71
|
* @param item
|
|
55
72
|
*/
|
|
56
73
|
storeGenericItem<C>(item: RegisterableItems): void;
|
|
74
|
+
private storeMiddleware;
|
|
57
75
|
storeEvent<C>(item: IEventDefinition<void>): void;
|
|
58
76
|
private storeResourceWithConfig;
|
|
77
|
+
/**
|
|
78
|
+
* This is for storing a resource without a config.
|
|
79
|
+
* @param item
|
|
80
|
+
*/
|
|
59
81
|
private storeResource;
|
|
82
|
+
storeEventsForAllTasks(): void;
|
|
83
|
+
/**
|
|
84
|
+
* This is for storing a resource without a config.
|
|
85
|
+
* @param item
|
|
86
|
+
*/
|
|
87
|
+
private prepareResource;
|
|
60
88
|
private storeTask;
|
|
61
89
|
getDependentNodes(): IDependentNode[];
|
|
62
90
|
}
|