@alterior/runtime 3.11.1 → 3.13.4
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/app-options.d.ts +65 -65
- package/dist/app-options.js +26 -26
- package/dist/app-options.js.map +1 -1
- package/dist/application.d.ts +52 -52
- package/dist/application.js +172 -171
- package/dist/application.js.map +1 -1
- package/dist/args.d.ts +7 -7
- package/dist/args.js +13 -13
- package/dist/expose.d.ts +12 -12
- package/dist/expose.d.ts.map +1 -1
- package/dist/expose.js +36 -36
- package/dist/expose.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +12 -12
- package/dist/lifecycle.d.ts +24 -24
- package/dist/lifecycle.js +2 -2
- package/dist/module.test.d.ts +1 -1
- package/dist/modules.d.ts +120 -120
- package/dist/modules.js +282 -282
- package/dist/modules.js.map +1 -1
- package/dist/reflector.d.ts +123 -123
- package/dist/reflector.js +306 -306
- package/dist/reflector.js.map +1 -1
- package/dist/roles.service.d.ts +79 -79
- package/dist/roles.service.js +124 -124
- package/dist/roles.service.js.map +1 -1
- package/dist/service.d.ts +24 -24
- package/dist/service.js +19 -19
- package/dist/service.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/dist.esm/app-options.d.ts +65 -65
- package/dist.esm/app-options.js +23 -23
- package/dist.esm/app-options.js.map +1 -1
- package/dist.esm/application.d.ts +52 -52
- package/dist.esm/application.js +167 -166
- package/dist.esm/application.js.map +1 -1
- package/dist.esm/args.d.ts +7 -7
- package/dist.esm/args.js +9 -9
- package/dist.esm/expose.d.ts +12 -12
- package/dist.esm/expose.d.ts.map +1 -1
- package/dist.esm/expose.js +31 -31
- package/dist.esm/expose.js.map +1 -1
- package/dist.esm/index.d.ts +9 -9
- package/dist.esm/index.js +9 -9
- package/dist.esm/lifecycle.d.ts +24 -24
- package/dist.esm/lifecycle.js +1 -1
- package/dist.esm/module.test.d.ts +1 -1
- package/dist.esm/modules.d.ts +120 -120
- package/dist.esm/modules.js +276 -276
- package/dist.esm/modules.js.map +1 -1
- package/dist.esm/reflector.d.ts +123 -123
- package/dist.esm/reflector.js +296 -296
- package/dist.esm/reflector.js.map +1 -1
- package/dist.esm/roles.service.d.ts +79 -79
- package/dist.esm/roles.service.js +121 -121
- package/dist.esm/roles.service.js.map +1 -1
- package/dist.esm/service.d.ts +24 -24
- package/dist.esm/service.js +15 -15
- package/dist.esm/service.js.map +1 -1
- package/dist.esm/test.d.ts +1 -1
- package/package.json +11 -11
- package/src/application.ts +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -0
- package/tsconfig.json +0 -2
- package/tsconfig.tsbuildinfo +1 -5546
package/dist.esm/modules.js
CHANGED
|
@@ -1,277 +1,277 @@
|
|
|
1
|
-
import { __awaiter, __decorate } from "tslib";
|
|
2
|
-
import { ModuleAnnotation, Module } from "@alterior/di";
|
|
3
|
-
import { ReflectiveInjector } from "@alterior/di";
|
|
4
|
-
import { Environment } from "@alterior/common";
|
|
5
|
-
import { RolesService } from "./roles.service";
|
|
6
|
-
/**
|
|
7
|
-
* Combines a module annotation and a target class into a single
|
|
8
|
-
* object for storage purposes in Runtime and related objects.
|
|
9
|
-
*/
|
|
10
|
-
export class ModuleDefinition {
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Represents a live instance of a module.
|
|
14
|
-
* Contains both the module definition as well
|
|
15
|
-
* as a reference to the module instance itself.
|
|
16
|
-
*/
|
|
17
|
-
export class ModuleInstance {
|
|
18
|
-
constructor(definition, instance) {
|
|
19
|
-
this.definition = definition;
|
|
20
|
-
this.instance = instance;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Used to construct a runtime environment for a given entry module.
|
|
25
|
-
* Handles resolving the module tree into an injector as well as constructing
|
|
26
|
-
* the module instances and running lifecycle events.
|
|
27
|
-
*/
|
|
28
|
-
export class Runtime {
|
|
29
|
-
constructor(entryModule) {
|
|
30
|
-
this.definitions = [];
|
|
31
|
-
this.visited = [];
|
|
32
|
-
this.instances = null;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieve the providers that were collected from the
|
|
35
|
-
* module graph and used to create the primary injector.
|
|
36
|
-
*/
|
|
37
|
-
this.providers = [];
|
|
38
|
-
this._selfTest = false;
|
|
39
|
-
this._injector = null;
|
|
40
|
-
this.resolveModule(entryModule);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Get a specific service from the dependency injector.
|
|
44
|
-
* @param ctor
|
|
45
|
-
*/
|
|
46
|
-
getService(ctor) {
|
|
47
|
-
return this.injector.get(ctor);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Iterate over the module definitions which are part of this
|
|
51
|
-
* runtime and append to the given array the set of dependency injection
|
|
52
|
-
* providers which are specified in the module definitions.
|
|
53
|
-
*
|
|
54
|
-
* @param providers An array which will be populated
|
|
55
|
-
*/
|
|
56
|
-
contributeProviders(providers) {
|
|
57
|
-
providers.push({ provide: Runtime, useValue: this });
|
|
58
|
-
this.definitions
|
|
59
|
-
.filter(defn => defn.metadata && defn.metadata.providers)
|
|
60
|
-
.forEach(defn => providers.push(...defn.metadata.providers));
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Perform runtime configuration steps
|
|
64
|
-
*/
|
|
65
|
-
configure() {
|
|
66
|
-
let roleEnv = this.injector.get(Environment)
|
|
67
|
-
.get();
|
|
68
|
-
let roleMode = 'default';
|
|
69
|
-
let roles = [];
|
|
70
|
-
if (roleEnv.ALT_ROLES_ONLY) {
|
|
71
|
-
roleMode = 'only';
|
|
72
|
-
roles = roleEnv.ALT_ROLES_ONLY.split(',');
|
|
73
|
-
}
|
|
74
|
-
else if (roleEnv.ALT_ROLES_ALL_EXCEPT) {
|
|
75
|
-
roleMode = 'all-except';
|
|
76
|
-
roles = roleEnv.ALT_ROLES_ALL_EXCEPT.split(',');
|
|
77
|
-
}
|
|
78
|
-
else if (roleEnv.ALT_ROLES_DEFAULT_EXCEPT) {
|
|
79
|
-
roleMode = 'default-except';
|
|
80
|
-
roles = roleEnv.ALT_ROLES_DEFAULT_EXCEPT.split(',');
|
|
81
|
-
}
|
|
82
|
-
let rolesService = this.injector.get(RolesService);
|
|
83
|
-
if (roleMode !== 'default') {
|
|
84
|
-
rolesService.configure({ mode: roleMode, roles });
|
|
85
|
-
}
|
|
86
|
-
if (typeof process !== 'undefined' && process.argv) {
|
|
87
|
-
this.processCommandLine(process.argv.slice(2));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* True if the `--self-test` option was used to launch the application.
|
|
92
|
-
*/
|
|
93
|
-
get selfTest() {
|
|
94
|
-
return this._selfTest;
|
|
95
|
-
}
|
|
96
|
-
processCommandLine(args) {
|
|
97
|
-
let argIndex = 0;
|
|
98
|
-
let optionValue = () => {
|
|
99
|
-
let arg = args[argIndex];
|
|
100
|
-
if (argIndex + 1 >= args.length)
|
|
101
|
-
throw new Error(`You must specify a value for option ${arg}`);
|
|
102
|
-
let value = args[++argIndex];
|
|
103
|
-
if (value.startsWith('-')) {
|
|
104
|
-
throw new Error(`You must specify a value for option ${arg} (encountered option '${value}' instead)`);
|
|
105
|
-
}
|
|
106
|
-
return value;
|
|
107
|
-
};
|
|
108
|
-
let roleMode = 'default';
|
|
109
|
-
let roles;
|
|
110
|
-
for (; argIndex < args.length; ++argIndex) {
|
|
111
|
-
let arg = args[argIndex];
|
|
112
|
-
if (arg === '--self-test') {
|
|
113
|
-
this._selfTest = true;
|
|
114
|
-
}
|
|
115
|
-
else if (arg == '-r' || arg == '--roles-only') {
|
|
116
|
-
roleMode = 'only';
|
|
117
|
-
roles = optionValue().split(',');
|
|
118
|
-
}
|
|
119
|
-
else if (arg == '-x' || arg == '--roles-skip') {
|
|
120
|
-
roleMode = 'default-except';
|
|
121
|
-
roles = optionValue().split(',');
|
|
122
|
-
}
|
|
123
|
-
else if (arg == '-R' || arg == '--roles-all-except') {
|
|
124
|
-
roleMode = 'all-except';
|
|
125
|
-
roles = optionValue().split(',');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
let rolesService = this.injector.get(RolesService);
|
|
129
|
-
if (roleMode !== 'default') {
|
|
130
|
-
rolesService.configure({ mode: 'only', roles });
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Fire an event to all modules which understand it. Should be upper-camel-case, meaning
|
|
135
|
-
* to fire the altOnStart() method, send "OnStart".
|
|
136
|
-
* @param eventName
|
|
137
|
-
*/
|
|
138
|
-
fireEvent(eventName) {
|
|
139
|
-
for (let modInstance of this.instances) {
|
|
140
|
-
if (modInstance.instance[`alt${eventName}`])
|
|
141
|
-
modInstance.instance[`alt${eventName}`]();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Get the runtime's dependency injector. This injector can provide all dependencies specified
|
|
146
|
-
* in the imported modules' `providers` definitions.
|
|
147
|
-
*/
|
|
148
|
-
get injector() {
|
|
149
|
-
return this._injector;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Instantiate the modules of this runtime using the given dependency injector.
|
|
153
|
-
* The injector will be inherited into an injector that provides the dependencies
|
|
154
|
-
* specified in the imported modules' `providers` definitions.
|
|
155
|
-
*
|
|
156
|
-
* @param injector
|
|
157
|
-
*/
|
|
158
|
-
load(injector) {
|
|
159
|
-
if (this.instances)
|
|
160
|
-
return;
|
|
161
|
-
let ownInjector;
|
|
162
|
-
let providers = this.definitions.map(x => x.target);
|
|
163
|
-
try {
|
|
164
|
-
ownInjector = ReflectiveInjector.resolveAndCreate(providers, injector);
|
|
165
|
-
}
|
|
166
|
-
catch (e) {
|
|
167
|
-
console.error(`Failed to construct injector:`);
|
|
168
|
-
console.error(`Providers:`);
|
|
169
|
-
console.dir(providers);
|
|
170
|
-
console.error(`Definitions:`);
|
|
171
|
-
console.dir(this.definitions);
|
|
172
|
-
throw e;
|
|
173
|
-
}
|
|
174
|
-
this._injector = ownInjector;
|
|
175
|
-
let moduleInstances = this.definitions.map(defn => new ModuleInstance(defn, ownInjector.get(defn.target)));
|
|
176
|
-
this.instances = moduleInstances;
|
|
177
|
-
return this.instances;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Stop any services, as defined by imported modules of this runtime. For instance, if you import WebServerModule
|
|
181
|
-
* from @alterior/web-server, calling this will instruct the module to stop serving on the configured port.
|
|
182
|
-
* Also builds in a timeout to allow for all services and operations to stop before resolving.
|
|
183
|
-
*
|
|
184
|
-
* This will send the `OnStop` lifecycle event to all modules, which triggers the `altOnStop()` method of any module
|
|
185
|
-
* which implements it to be called. It also instructs the RolesService to stop any roles which are currently running.
|
|
186
|
-
* For more information about Roles, see the documentation for RolesService.
|
|
187
|
-
*/
|
|
188
|
-
stop() {
|
|
189
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
-
this.fireEvent('OnStop');
|
|
191
|
-
let rolesService = this.injector.get(RolesService);
|
|
192
|
-
rolesService.stopAll();
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Start any services, as defined by modules. For instance, if you import WebServerModule from @alterior/web-server,
|
|
197
|
-
* calling this will instruct the module to begin serving on the configured port.
|
|
198
|
-
*
|
|
199
|
-
* This will send the `OnStart` lifecycle event to all modules, which triggers the `altOnStart()` method of any module
|
|
200
|
-
* which implements it to be called. It also instructs the RolesService to start roles as per it's configuration.
|
|
201
|
-
* For more information about Roles, see the documentation for RolesService.
|
|
202
|
-
*/
|
|
203
|
-
start() {
|
|
204
|
-
this.fireEvent('OnStart');
|
|
205
|
-
let rolesService = this.injector.get(RolesService);
|
|
206
|
-
rolesService.startAll();
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Stop all running services and shut down the process
|
|
210
|
-
*/
|
|
211
|
-
shutdown() {
|
|
212
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
-
yield this.stop();
|
|
214
|
-
process.exit();
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Retrieve the ModuleAnnotation for a given Module definition, whether it be a class annotated
|
|
219
|
-
* with `@Module()` or a plain object with `$module` which configures a module class.
|
|
220
|
-
*
|
|
221
|
-
* This is an alias of ModuleAnnotation.getForClass(module)
|
|
222
|
-
*
|
|
223
|
-
* @param module
|
|
224
|
-
*/
|
|
225
|
-
getMetadataForModule(module) {
|
|
226
|
-
return ModuleAnnotation.getForClass(module);
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Resolves the given module, adding it to this runtime.
|
|
230
|
-
* Calls itself for all imports. Visited modules are tracked per runtime,
|
|
231
|
-
* so resolveModule() on the same runtime object will not work, preventing
|
|
232
|
-
* loops.
|
|
233
|
-
*/
|
|
234
|
-
resolveModule(module) {
|
|
235
|
-
// Prevent infinite recursion
|
|
236
|
-
if (this.visited.includes(module))
|
|
237
|
-
return;
|
|
238
|
-
this.visited.push(module);
|
|
239
|
-
// Construct this compilation unit
|
|
240
|
-
let isExtension = false;
|
|
241
|
-
if (module['$module']) {
|
|
242
|
-
isExtension = true;
|
|
243
|
-
// This is a mask
|
|
244
|
-
module = Object.assign({}, module);
|
|
245
|
-
let parentModule = module['$module'];
|
|
246
|
-
let options = Object.assign({}, module);
|
|
247
|
-
delete module['$module'];
|
|
248
|
-
if (!options.imports)
|
|
249
|
-
options.imports = [];
|
|
250
|
-
options.imports.push(parentModule);
|
|
251
|
-
let subModule = class subModule {
|
|
252
|
-
};
|
|
253
|
-
subModule = __decorate([
|
|
254
|
-
Module(options)
|
|
255
|
-
], subModule);
|
|
256
|
-
;
|
|
257
|
-
module = subModule;
|
|
258
|
-
let metadata = this.getMetadataForModule(module);
|
|
259
|
-
}
|
|
260
|
-
let metadata = this.getMetadataForModule(module);
|
|
261
|
-
if (metadata && metadata.imports) {
|
|
262
|
-
let position = 0;
|
|
263
|
-
for (let importedModule of metadata.imports) {
|
|
264
|
-
if (!importedModule) {
|
|
265
|
-
throw new Error(`Failed to resolve module referenced in position ${position} by ${module.toString()}`);
|
|
266
|
-
}
|
|
267
|
-
this.resolveModule(importedModule);
|
|
268
|
-
++position;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
this.definitions.push({
|
|
272
|
-
target: module,
|
|
273
|
-
metadata,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
}
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
|
+
import { ModuleAnnotation, Module } from "@alterior/di";
|
|
3
|
+
import { ReflectiveInjector } from "@alterior/di";
|
|
4
|
+
import { Environment } from "@alterior/common";
|
|
5
|
+
import { RolesService } from "./roles.service";
|
|
6
|
+
/**
|
|
7
|
+
* Combines a module annotation and a target class into a single
|
|
8
|
+
* object for storage purposes in Runtime and related objects.
|
|
9
|
+
*/
|
|
10
|
+
export class ModuleDefinition {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Represents a live instance of a module.
|
|
14
|
+
* Contains both the module definition as well
|
|
15
|
+
* as a reference to the module instance itself.
|
|
16
|
+
*/
|
|
17
|
+
export class ModuleInstance {
|
|
18
|
+
constructor(definition, instance) {
|
|
19
|
+
this.definition = definition;
|
|
20
|
+
this.instance = instance;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Used to construct a runtime environment for a given entry module.
|
|
25
|
+
* Handles resolving the module tree into an injector as well as constructing
|
|
26
|
+
* the module instances and running lifecycle events.
|
|
27
|
+
*/
|
|
28
|
+
export class Runtime {
|
|
29
|
+
constructor(entryModule) {
|
|
30
|
+
this.definitions = [];
|
|
31
|
+
this.visited = [];
|
|
32
|
+
this.instances = null;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve the providers that were collected from the
|
|
35
|
+
* module graph and used to create the primary injector.
|
|
36
|
+
*/
|
|
37
|
+
this.providers = [];
|
|
38
|
+
this._selfTest = false;
|
|
39
|
+
this._injector = null;
|
|
40
|
+
this.resolveModule(entryModule);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get a specific service from the dependency injector.
|
|
44
|
+
* @param ctor
|
|
45
|
+
*/
|
|
46
|
+
getService(ctor) {
|
|
47
|
+
return this.injector.get(ctor);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Iterate over the module definitions which are part of this
|
|
51
|
+
* runtime and append to the given array the set of dependency injection
|
|
52
|
+
* providers which are specified in the module definitions.
|
|
53
|
+
*
|
|
54
|
+
* @param providers An array which will be populated
|
|
55
|
+
*/
|
|
56
|
+
contributeProviders(providers) {
|
|
57
|
+
providers.push({ provide: Runtime, useValue: this });
|
|
58
|
+
this.definitions
|
|
59
|
+
.filter(defn => defn.metadata && defn.metadata.providers)
|
|
60
|
+
.forEach(defn => providers.push(...defn.metadata.providers));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Perform runtime configuration steps
|
|
64
|
+
*/
|
|
65
|
+
configure() {
|
|
66
|
+
let roleEnv = this.injector.get(Environment)
|
|
67
|
+
.get();
|
|
68
|
+
let roleMode = 'default';
|
|
69
|
+
let roles = [];
|
|
70
|
+
if (roleEnv.ALT_ROLES_ONLY) {
|
|
71
|
+
roleMode = 'only';
|
|
72
|
+
roles = roleEnv.ALT_ROLES_ONLY.split(',');
|
|
73
|
+
}
|
|
74
|
+
else if (roleEnv.ALT_ROLES_ALL_EXCEPT) {
|
|
75
|
+
roleMode = 'all-except';
|
|
76
|
+
roles = roleEnv.ALT_ROLES_ALL_EXCEPT.split(',');
|
|
77
|
+
}
|
|
78
|
+
else if (roleEnv.ALT_ROLES_DEFAULT_EXCEPT) {
|
|
79
|
+
roleMode = 'default-except';
|
|
80
|
+
roles = roleEnv.ALT_ROLES_DEFAULT_EXCEPT.split(',');
|
|
81
|
+
}
|
|
82
|
+
let rolesService = this.injector.get(RolesService);
|
|
83
|
+
if (roleMode !== 'default') {
|
|
84
|
+
rolesService.configure({ mode: roleMode, roles });
|
|
85
|
+
}
|
|
86
|
+
if (typeof process !== 'undefined' && process.argv) {
|
|
87
|
+
this.processCommandLine(process.argv.slice(2));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* True if the `--self-test` option was used to launch the application.
|
|
92
|
+
*/
|
|
93
|
+
get selfTest() {
|
|
94
|
+
return this._selfTest;
|
|
95
|
+
}
|
|
96
|
+
processCommandLine(args) {
|
|
97
|
+
let argIndex = 0;
|
|
98
|
+
let optionValue = () => {
|
|
99
|
+
let arg = args[argIndex];
|
|
100
|
+
if (argIndex + 1 >= args.length)
|
|
101
|
+
throw new Error(`You must specify a value for option ${arg}`);
|
|
102
|
+
let value = args[++argIndex];
|
|
103
|
+
if (value.startsWith('-')) {
|
|
104
|
+
throw new Error(`You must specify a value for option ${arg} (encountered option '${value}' instead)`);
|
|
105
|
+
}
|
|
106
|
+
return value;
|
|
107
|
+
};
|
|
108
|
+
let roleMode = 'default';
|
|
109
|
+
let roles;
|
|
110
|
+
for (; argIndex < args.length; ++argIndex) {
|
|
111
|
+
let arg = args[argIndex];
|
|
112
|
+
if (arg === '--self-test') {
|
|
113
|
+
this._selfTest = true;
|
|
114
|
+
}
|
|
115
|
+
else if (arg == '-r' || arg == '--roles-only') {
|
|
116
|
+
roleMode = 'only';
|
|
117
|
+
roles = optionValue().split(',');
|
|
118
|
+
}
|
|
119
|
+
else if (arg == '-x' || arg == '--roles-skip') {
|
|
120
|
+
roleMode = 'default-except';
|
|
121
|
+
roles = optionValue().split(',');
|
|
122
|
+
}
|
|
123
|
+
else if (arg == '-R' || arg == '--roles-all-except') {
|
|
124
|
+
roleMode = 'all-except';
|
|
125
|
+
roles = optionValue().split(',');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
let rolesService = this.injector.get(RolesService);
|
|
129
|
+
if (roleMode !== 'default') {
|
|
130
|
+
rolesService.configure({ mode: 'only', roles });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Fire an event to all modules which understand it. Should be upper-camel-case, meaning
|
|
135
|
+
* to fire the altOnStart() method, send "OnStart".
|
|
136
|
+
* @param eventName
|
|
137
|
+
*/
|
|
138
|
+
fireEvent(eventName) {
|
|
139
|
+
for (let modInstance of this.instances) {
|
|
140
|
+
if (modInstance.instance[`alt${eventName}`])
|
|
141
|
+
modInstance.instance[`alt${eventName}`]();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get the runtime's dependency injector. This injector can provide all dependencies specified
|
|
146
|
+
* in the imported modules' `providers` definitions.
|
|
147
|
+
*/
|
|
148
|
+
get injector() {
|
|
149
|
+
return this._injector;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Instantiate the modules of this runtime using the given dependency injector.
|
|
153
|
+
* The injector will be inherited into an injector that provides the dependencies
|
|
154
|
+
* specified in the imported modules' `providers` definitions.
|
|
155
|
+
*
|
|
156
|
+
* @param injector
|
|
157
|
+
*/
|
|
158
|
+
load(injector) {
|
|
159
|
+
if (this.instances)
|
|
160
|
+
return;
|
|
161
|
+
let ownInjector;
|
|
162
|
+
let providers = this.definitions.map(x => x.target);
|
|
163
|
+
try {
|
|
164
|
+
ownInjector = ReflectiveInjector.resolveAndCreate(providers, injector);
|
|
165
|
+
}
|
|
166
|
+
catch (e) {
|
|
167
|
+
console.error(`Failed to construct injector:`);
|
|
168
|
+
console.error(`Providers:`);
|
|
169
|
+
console.dir(providers);
|
|
170
|
+
console.error(`Definitions:`);
|
|
171
|
+
console.dir(this.definitions);
|
|
172
|
+
throw e;
|
|
173
|
+
}
|
|
174
|
+
this._injector = ownInjector;
|
|
175
|
+
let moduleInstances = this.definitions.map(defn => new ModuleInstance(defn, ownInjector.get(defn.target)));
|
|
176
|
+
this.instances = moduleInstances;
|
|
177
|
+
return this.instances;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Stop any services, as defined by imported modules of this runtime. For instance, if you import WebServerModule
|
|
181
|
+
* from @alterior/web-server, calling this will instruct the module to stop serving on the configured port.
|
|
182
|
+
* Also builds in a timeout to allow for all services and operations to stop before resolving.
|
|
183
|
+
*
|
|
184
|
+
* This will send the `OnStop` lifecycle event to all modules, which triggers the `altOnStop()` method of any module
|
|
185
|
+
* which implements it to be called. It also instructs the RolesService to stop any roles which are currently running.
|
|
186
|
+
* For more information about Roles, see the documentation for RolesService.
|
|
187
|
+
*/
|
|
188
|
+
stop() {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
this.fireEvent('OnStop');
|
|
191
|
+
let rolesService = this.injector.get(RolesService);
|
|
192
|
+
rolesService.stopAll();
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Start any services, as defined by modules. For instance, if you import WebServerModule from @alterior/web-server,
|
|
197
|
+
* calling this will instruct the module to begin serving on the configured port.
|
|
198
|
+
*
|
|
199
|
+
* This will send the `OnStart` lifecycle event to all modules, which triggers the `altOnStart()` method of any module
|
|
200
|
+
* which implements it to be called. It also instructs the RolesService to start roles as per it's configuration.
|
|
201
|
+
* For more information about Roles, see the documentation for RolesService.
|
|
202
|
+
*/
|
|
203
|
+
start() {
|
|
204
|
+
this.fireEvent('OnStart');
|
|
205
|
+
let rolesService = this.injector.get(RolesService);
|
|
206
|
+
rolesService.startAll();
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Stop all running services and shut down the process
|
|
210
|
+
*/
|
|
211
|
+
shutdown() {
|
|
212
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
+
yield this.stop();
|
|
214
|
+
process.exit();
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Retrieve the ModuleAnnotation for a given Module definition, whether it be a class annotated
|
|
219
|
+
* with `@Module()` or a plain object with `$module` which configures a module class.
|
|
220
|
+
*
|
|
221
|
+
* This is an alias of ModuleAnnotation.getForClass(module)
|
|
222
|
+
*
|
|
223
|
+
* @param module
|
|
224
|
+
*/
|
|
225
|
+
getMetadataForModule(module) {
|
|
226
|
+
return ModuleAnnotation.getForClass(module);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Resolves the given module, adding it to this runtime.
|
|
230
|
+
* Calls itself for all imports. Visited modules are tracked per runtime,
|
|
231
|
+
* so resolveModule() on the same runtime object will not work, preventing
|
|
232
|
+
* loops.
|
|
233
|
+
*/
|
|
234
|
+
resolveModule(module) {
|
|
235
|
+
// Prevent infinite recursion
|
|
236
|
+
if (this.visited.includes(module))
|
|
237
|
+
return;
|
|
238
|
+
this.visited.push(module);
|
|
239
|
+
// Construct this compilation unit
|
|
240
|
+
let isExtension = false;
|
|
241
|
+
if (module['$module']) {
|
|
242
|
+
isExtension = true;
|
|
243
|
+
// This is a mask
|
|
244
|
+
module = Object.assign({}, module);
|
|
245
|
+
let parentModule = module['$module'];
|
|
246
|
+
let options = Object.assign({}, module);
|
|
247
|
+
delete module['$module'];
|
|
248
|
+
if (!options.imports)
|
|
249
|
+
options.imports = [];
|
|
250
|
+
options.imports.push(parentModule);
|
|
251
|
+
let subModule = class subModule {
|
|
252
|
+
};
|
|
253
|
+
subModule = __decorate([
|
|
254
|
+
Module(options)
|
|
255
|
+
], subModule);
|
|
256
|
+
;
|
|
257
|
+
module = subModule;
|
|
258
|
+
let metadata = this.getMetadataForModule(module);
|
|
259
|
+
}
|
|
260
|
+
let metadata = this.getMetadataForModule(module);
|
|
261
|
+
if (metadata && metadata.imports) {
|
|
262
|
+
let position = 0;
|
|
263
|
+
for (let importedModule of metadata.imports) {
|
|
264
|
+
if (!importedModule) {
|
|
265
|
+
throw new Error(`Failed to resolve module referenced in position ${position} by ${module.toString()}`);
|
|
266
|
+
}
|
|
267
|
+
this.resolveModule(importedModule);
|
|
268
|
+
++position;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
this.definitions.push({
|
|
272
|
+
target: module,
|
|
273
|
+
metadata,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
277
|
//# sourceMappingURL=modules.js.map
|
package/dist.esm/modules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAiB,MAAM,EAAc,MAAM,cAAc,CAAC;AACnF,OAAO,EAAsB,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAW,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAoC,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACjF;;;GAGG;AACH,MAAM,OAAO,gBAAgB;CAG5B;AAED;;;;GAIG;AACH,MAAM,OAAO,cAAc;IACvB,YACa,UAA6B,EAC7B,QAAc;QADd,eAAU,GAAV,UAAU,CAAmB;QAC7B,aAAQ,GAAR,QAAQ,CAAM;IAE3B,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAO,OAAO;IAChB,YAAY,WAAsB;QAIlC,gBAAW,GAAwB,EAAE,CAAC;QACtC,YAAO,GAAkB,EAAE,CAAC;QAC5B,cAAS,GAAsB,IAAI,CAAC;QAUpC;;;WAGG;QACH,cAAS,GAAgB,EAAE,CAAC;QAqDpB,cAAS,GAAG,KAAK,CAAC;QAgElB,cAAS,GAAc,IAAI,CAAC;QAxIhC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACpC,CAAC;IAMD;;;OAGG;IACH,UAAU,CAAI,IAA2B;QACrC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAQD;;;;;;OAMG;IACH,mBAAmB,CAAC,SAAsB;QACtC,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,IAAI,CAAC,WAAW;aACX,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ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