@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.
Files changed (65) hide show
  1. package/dist/app-options.d.ts +65 -65
  2. package/dist/app-options.js +26 -26
  3. package/dist/app-options.js.map +1 -1
  4. package/dist/application.d.ts +52 -52
  5. package/dist/application.js +172 -171
  6. package/dist/application.js.map +1 -1
  7. package/dist/args.d.ts +7 -7
  8. package/dist/args.js +13 -13
  9. package/dist/expose.d.ts +12 -12
  10. package/dist/expose.d.ts.map +1 -1
  11. package/dist/expose.js +36 -36
  12. package/dist/expose.js.map +1 -1
  13. package/dist/index.d.ts +9 -9
  14. package/dist/index.js +12 -12
  15. package/dist/lifecycle.d.ts +24 -24
  16. package/dist/lifecycle.js +2 -2
  17. package/dist/module.test.d.ts +1 -1
  18. package/dist/modules.d.ts +120 -120
  19. package/dist/modules.js +282 -282
  20. package/dist/modules.js.map +1 -1
  21. package/dist/reflector.d.ts +123 -123
  22. package/dist/reflector.js +306 -306
  23. package/dist/reflector.js.map +1 -1
  24. package/dist/roles.service.d.ts +79 -79
  25. package/dist/roles.service.js +124 -124
  26. package/dist/roles.service.js.map +1 -1
  27. package/dist/service.d.ts +24 -24
  28. package/dist/service.js +19 -19
  29. package/dist/service.js.map +1 -1
  30. package/dist/test.d.ts +1 -1
  31. package/dist.esm/app-options.d.ts +65 -65
  32. package/dist.esm/app-options.js +23 -23
  33. package/dist.esm/app-options.js.map +1 -1
  34. package/dist.esm/application.d.ts +52 -52
  35. package/dist.esm/application.js +167 -166
  36. package/dist.esm/application.js.map +1 -1
  37. package/dist.esm/args.d.ts +7 -7
  38. package/dist.esm/args.js +9 -9
  39. package/dist.esm/expose.d.ts +12 -12
  40. package/dist.esm/expose.d.ts.map +1 -1
  41. package/dist.esm/expose.js +31 -31
  42. package/dist.esm/expose.js.map +1 -1
  43. package/dist.esm/index.d.ts +9 -9
  44. package/dist.esm/index.js +9 -9
  45. package/dist.esm/lifecycle.d.ts +24 -24
  46. package/dist.esm/lifecycle.js +1 -1
  47. package/dist.esm/module.test.d.ts +1 -1
  48. package/dist.esm/modules.d.ts +120 -120
  49. package/dist.esm/modules.js +276 -276
  50. package/dist.esm/modules.js.map +1 -1
  51. package/dist.esm/reflector.d.ts +123 -123
  52. package/dist.esm/reflector.js +296 -296
  53. package/dist.esm/reflector.js.map +1 -1
  54. package/dist.esm/roles.service.d.ts +79 -79
  55. package/dist.esm/roles.service.js +121 -121
  56. package/dist.esm/roles.service.js.map +1 -1
  57. package/dist.esm/service.d.ts +24 -24
  58. package/dist.esm/service.js +15 -15
  59. package/dist.esm/service.js.map +1 -1
  60. package/dist.esm/test.d.ts +1 -1
  61. package/package.json +11 -11
  62. package/src/application.ts +1 -1
  63. package/tsconfig.esm.tsbuildinfo +1 -0
  64. package/tsconfig.json +0 -2
  65. package/tsconfig.tsbuildinfo +1 -5546
@@ -1,66 +1,66 @@
1
- import { Annotation } from '@alterior/annotations';
2
- import { Injector, Provider } from '@alterior/di';
3
- export interface ApplicationOptions {
4
- /**
5
- * Specify a human readable name for your application.
6
- */
7
- name?: string;
8
- /**
9
- * Version of the service
10
- */
11
- version?: string;
12
- /**
13
- * The computer-readable name for your application. Should match your NPM package name.
14
- */
15
- packageName?: string;
16
- /**
17
- * A long-form description for your application, when necessary. If you implement only one,
18
- * implement summary instead.
19
- */
20
- description?: string;
21
- /**
22
- * A shorter-form description for your application, when necessary. If you implement only one,
23
- * implement this instead of description.
24
- */
25
- summary?: string;
26
- /**
27
- * A set of string tags related to your application.
28
- */
29
- tags?: string[];
30
- group?: string;
31
- /**
32
- * Enable verbose console logging for Alterior
33
- */
34
- verbose?: boolean;
35
- /**
36
- * Whether to start the service immediately on startup.
37
- * Defaults to true.
38
- */
39
- autostart?: boolean;
40
- /**
41
- * Turn off all console output
42
- */
43
- silent?: boolean;
44
- /**
45
- * Additional dependency injection providers to include in the application's injector.
46
- */
47
- providers?: Provider[];
48
- /**
49
- * An injector to use as the parent of the application injector. Optional, useful when doing more complex
50
- * application bootstrapping.
51
- */
52
- parentInjector?: Injector;
53
- }
54
- /**
55
- * Used to attach an ApplicationOptions object onto a class definition.
56
- */
57
- export declare class AppOptionsAnnotation extends Annotation {
58
- readonly options?: ApplicationOptions;
59
- constructor(options?: ApplicationOptions);
60
- }
61
- /**
62
- * Use this decorator to define the options for your application,
63
- * either on the entry module, or service class when using `@alterior/web-server`.
64
- */
65
- export declare const AppOptions: (options?: ApplicationOptions) => ClassDecorator;
1
+ import { Annotation } from '@alterior/annotations';
2
+ import { Injector, Provider } from '@alterior/di';
3
+ export interface ApplicationOptions {
4
+ /**
5
+ * Specify a human readable name for your application.
6
+ */
7
+ name?: string;
8
+ /**
9
+ * Version of the service
10
+ */
11
+ version?: string;
12
+ /**
13
+ * The computer-readable name for your application. Should match your NPM package name.
14
+ */
15
+ packageName?: string;
16
+ /**
17
+ * A long-form description for your application, when necessary. If you implement only one,
18
+ * implement summary instead.
19
+ */
20
+ description?: string;
21
+ /**
22
+ * A shorter-form description for your application, when necessary. If you implement only one,
23
+ * implement this instead of description.
24
+ */
25
+ summary?: string;
26
+ /**
27
+ * A set of string tags related to your application.
28
+ */
29
+ tags?: string[];
30
+ group?: string;
31
+ /**
32
+ * Enable verbose console logging for Alterior
33
+ */
34
+ verbose?: boolean;
35
+ /**
36
+ * Whether to start the service immediately on startup.
37
+ * Defaults to true.
38
+ */
39
+ autostart?: boolean;
40
+ /**
41
+ * Turn off all console output
42
+ */
43
+ silent?: boolean;
44
+ /**
45
+ * Additional dependency injection providers to include in the application's injector.
46
+ */
47
+ providers?: Provider[];
48
+ /**
49
+ * An injector to use as the parent of the application injector. Optional, useful when doing more complex
50
+ * application bootstrapping.
51
+ */
52
+ parentInjector?: Injector;
53
+ }
54
+ /**
55
+ * Used to attach an ApplicationOptions object onto a class definition.
56
+ */
57
+ export declare class AppOptionsAnnotation extends Annotation {
58
+ readonly options?: ApplicationOptions;
59
+ constructor(options?: ApplicationOptions);
60
+ }
61
+ /**
62
+ * Use this decorator to define the options for your application,
63
+ * either on the entry module, or service class when using `@alterior/web-server`.
64
+ */
65
+ export declare const AppOptions: (options?: ApplicationOptions) => ClassDecorator;
66
66
  //# sourceMappingURL=app-options.d.ts.map
@@ -1,24 +1,24 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { Annotation, MetadataName } from '@alterior/annotations';
3
- /**
4
- * Used to attach an ApplicationOptions object onto a class definition.
5
- */
6
- let AppOptionsAnnotation = class AppOptionsAnnotation extends Annotation {
7
- constructor(options) {
8
- super();
9
- this.options = options;
10
- }
11
- };
12
- AppOptionsAnnotation = __decorate([
13
- MetadataName('@alterior/di:Application'),
14
- __metadata("design:paramtypes", [Object])
15
- ], AppOptionsAnnotation);
16
- export { AppOptionsAnnotation };
17
- /**
18
- * Use this decorator to define the options for your application,
19
- * either on the entry module, or service class when using `@alterior/web-server`.
20
- */
21
- export const AppOptions = AppOptionsAnnotation.decorator({
22
- validTargets: ['class']
23
- });
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { Annotation, MetadataName } from '@alterior/annotations';
3
+ /**
4
+ * Used to attach an ApplicationOptions object onto a class definition.
5
+ */
6
+ let AppOptionsAnnotation = class AppOptionsAnnotation extends Annotation {
7
+ constructor(options) {
8
+ super();
9
+ this.options = options;
10
+ }
11
+ };
12
+ AppOptionsAnnotation = __decorate([
13
+ MetadataName('@alterior/di:Application'),
14
+ __metadata("design:paramtypes", [Object])
15
+ ], AppOptionsAnnotation);
16
+ export { AppOptionsAnnotation };
17
+ /**
18
+ * Use this decorator to define the options for your application,
19
+ * either on the entry module, or service class when using `@alterior/web-server`.
20
+ */
21
+ export const AppOptions = AppOptionsAnnotation.decorator({
22
+ validTargets: ['class']
23
+ });
24
24
  //# sourceMappingURL=app-options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-options.js","sourceRoot":"","sources":["../src/app-options.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAmEtF;;GAEG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU;IACnD,YAAqB,OAA4B;QAChD,KAAK,EAAE,CAAC;QADY,YAAO,GAAP,OAAO,CAAqB;IAEjD,CAAC;CACD,CAAA;AAJY,oBAAoB;IADhC,YAAY,CAAC,0BAA0B,CAAC;;GAC5B,oBAAoB,CAIhC;SAJY,oBAAoB;AAMjC;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAC,SAAS,CAAC;IACxD,YAAY,EAAE,CAAC,OAAO,CAAC;CACvB,CAAC,CAAC"}
1
+ {"version":3,"file":"app-options.js","sourceRoot":"","sources":["../src/app-options.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAmEtF;;GAEG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU;IACnD,YAAqB,OAA4B;QAChD,KAAK,EAAE,CAAC;QADY,YAAO,GAAP,OAAO,CAAqB;IAEjD,CAAC;CACD,CAAA;AAJY,oBAAoB;IADhC,YAAY,CAAC,0BAA0B,CAAC;;GAC5B,oBAAoB,CAIhC;;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAC,SAAS,CAAC;IACxD,YAAY,EAAE,CAAC,OAAO,CAAC;CACvB,CAAC,CAAC"}
@@ -1,53 +1,53 @@
1
- import 'reflect-metadata';
2
- import { ApplicationOptions } from './app-options';
3
- import { Runtime } from './modules';
4
- export declare class ApplicationOptionsRef {
5
- constructor(options: ApplicationOptions);
6
- readonly options: ApplicationOptions;
7
- }
8
- /**
9
- * Represents the current runtime execution context.
10
- * This is exposed via a zone-local variable, and the Runtime
11
- * populates it with useful information as it becomes available.
12
- */
13
- export declare class ExecutionContext {
14
- /**
15
- * Retrieve the Alterior application which is currently being executed.
16
- * If an application has not been bootstrapped yet, the value is null.
17
- */
18
- application: Application;
19
- static readonly ZONE_LOCAL_NAME = "@alterior/runtime:ExecutionContext";
20
- /**
21
- * Get the current execution context, if any.
22
- */
23
- static get current(): ExecutionContext;
24
- /**
25
- * Execute the given function in a new zone which has
26
- * this ExecutionContext instance as the current execution context.
27
- */
28
- run<T>(callback: () => Promise<T>): Promise<T>;
29
- runSync<T>(callback: () => T): T;
30
- }
31
- /**
32
- * Handles bootstrapping the application.
33
- */
34
- export declare class Application {
35
- readonly runtime: Runtime;
36
- private _optionsRef;
37
- private _args;
38
- start(): void;
39
- stop(): void;
40
- get injector(): import("@alterior/di").Injector;
41
- inject<T>(ctor: {
42
- new (...args: any[]): T;
43
- }, notFoundValue?: T): T;
44
- get args(): string[];
45
- get options(): ApplicationOptions;
46
- private static loadOptions;
47
- private static validateEntryModule;
48
- /**
49
- * Bootstrap an Alterior application.
50
- */
51
- static bootstrap(entryModule: Function, options?: ApplicationOptions): Application;
52
- }
1
+ import 'reflect-metadata';
2
+ import { ApplicationOptions } from './app-options';
3
+ import { Runtime } from './modules';
4
+ export declare class ApplicationOptionsRef {
5
+ constructor(options: ApplicationOptions);
6
+ readonly options: ApplicationOptions;
7
+ }
8
+ /**
9
+ * Represents the current runtime execution context.
10
+ * This is exposed via a zone-local variable, and the Runtime
11
+ * populates it with useful information as it becomes available.
12
+ */
13
+ export declare class ExecutionContext {
14
+ /**
15
+ * Retrieve the Alterior application which is currently being executed.
16
+ * If an application has not been bootstrapped yet, the value is null.
17
+ */
18
+ application: Application;
19
+ static readonly ZONE_LOCAL_NAME = "@alterior/runtime:ExecutionContext";
20
+ /**
21
+ * Get the current execution context, if any.
22
+ */
23
+ static get current(): ExecutionContext;
24
+ /**
25
+ * Execute the given function in a new zone which has
26
+ * this ExecutionContext instance as the current execution context.
27
+ */
28
+ run<T>(callback: () => Promise<T>): Promise<T>;
29
+ runSync<T>(callback: () => T): T;
30
+ }
31
+ /**
32
+ * Handles bootstrapping the application.
33
+ */
34
+ export declare class Application {
35
+ readonly runtime: Runtime;
36
+ private _optionsRef;
37
+ private _args;
38
+ start(): void;
39
+ stop(): void;
40
+ get injector(): import("@alterior/di").Injector;
41
+ inject<T>(ctor: {
42
+ new (...args: any[]): T;
43
+ }, notFoundValue?: T): T;
44
+ get args(): string[];
45
+ get options(): ApplicationOptions;
46
+ private static loadOptions;
47
+ private static validateEntryModule;
48
+ /**
49
+ * Bootstrap an Alterior application.
50
+ */
51
+ static bootstrap(entryModule: Function, options?: ApplicationOptions): Application;
52
+ }
53
53
  //# sourceMappingURL=application.d.ts.map
@@ -1,167 +1,168 @@
1
- var Application_1;
2
- import { __awaiter, __decorate } from "tslib";
3
- import 'reflect-metadata';
4
- import { Environment, Time } from '@alterior/common';
5
- import { inject, Injectable, ModuleAnnotation, ReflectiveInjector } from '@alterior/di';
6
- import { AppOptionsAnnotation } from './app-options';
7
- import { ApplicationArgs } from './args';
8
- import { Runtime } from './modules';
9
- import { RolesService } from './roles.service';
10
- export class ApplicationOptionsRef {
11
- constructor(options) {
12
- this.options = Object.assign({}, options);
13
- }
14
- }
15
- /**
16
- * Represents the current runtime execution context.
17
- * This is exposed via a zone-local variable, and the Runtime
18
- * populates it with useful information as it becomes available.
19
- */
20
- export class ExecutionContext {
21
- constructor() {
22
- /**
23
- * Retrieve the Alterior application which is currently being executed.
24
- * If an application has not been bootstrapped yet, the value is null.
25
- */
26
- this.application = null;
27
- }
28
- /**
29
- * Get the current execution context, if any.
30
- */
31
- static get current() {
32
- return Zone.current.get(ExecutionContext.ZONE_LOCAL_NAME);
33
- }
34
- /**
35
- * Execute the given function in a new zone which has
36
- * this ExecutionContext instance as the current execution context.
37
- */
38
- run(callback) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- let zone = Zone.current.fork({
41
- name: `AlteriorExecutionContext`,
42
- properties: {
43
- [ExecutionContext.ZONE_LOCAL_NAME]: this
44
- }
45
- });
46
- return yield zone.run(() => callback());
47
- });
48
- }
49
- runSync(callback) {
50
- let zone = Zone.current.fork({
51
- name: `AlteriorExecutionContext`,
52
- properties: {
53
- [ExecutionContext.ZONE_LOCAL_NAME]: this
54
- }
55
- });
56
- return zone.run(() => callback());
57
- }
58
- }
59
- ExecutionContext.ZONE_LOCAL_NAME = '@alterior/runtime:ExecutionContext';
60
- /**
61
- * Handles bootstrapping the application.
62
- */
63
- let Application = Application_1 = class Application {
64
- constructor() {
65
- this.runtime = inject(Runtime);
66
- this._optionsRef = inject(ApplicationOptionsRef);
67
- this._args = inject(ApplicationArgs);
68
- }
69
- start() {
70
- this.runtime.start();
71
- }
72
- stop() {
73
- this.runtime.stop();
74
- }
75
- get injector() {
76
- return this.runtime.injector;
77
- }
78
- inject(ctor, notFoundValue) {
79
- return this.injector.get(ctor, notFoundValue);
80
- }
81
- get args() {
82
- return this._args.get();
83
- }
84
- get options() {
85
- return this._optionsRef.options;
86
- }
87
- static loadOptions(entryModule, bootstrapOptions) {
88
- // Read an @AppOptions() decorator if any, and merge providers from it
89
- // into the bootstrapped providers
90
- let appOptionsAnnotation = AppOptionsAnnotation.getForClass(entryModule);
91
- let appProvidedOptions = appOptionsAnnotation ? appOptionsAnnotation.options : {} || {};
92
- return Object.assign({
93
- version: '0.0.0',
94
- verbose: false,
95
- silent: false,
96
- autostart: true,
97
- providers: []
98
- }, appProvidedOptions, bootstrapOptions);
99
- }
100
- static validateEntryModule(module) {
101
- if (typeof module !== 'function') {
102
- throw new Error(`You must pass a Module class as the first parameter `
103
- + `to bootstrap(). You provided: `
104
- + `${typeof module} with value '${module}'`);
105
- }
106
- let moduleMetadata = ModuleAnnotation.getForClass(module);
107
- if (!moduleMetadata)
108
- throw new Error(`You must pass a module class decorated by @Module()`);
109
- }
110
- /**
111
- * Bootstrap an Alterior application.
112
- */
113
- static bootstrap(entryModule, options) {
114
- let executionContext = new ExecutionContext();
115
- return executionContext.runSync(() => {
116
- var _a;
117
- this.validateEntryModule(entryModule);
118
- options = this.loadOptions(entryModule, options);
119
- let runtime = new Runtime(entryModule);
120
- let providers = [
121
- ApplicationArgs,
122
- RolesService,
123
- Environment,
124
- Time
125
- ];
126
- runtime.contributeProviders(providers);
127
- providers.push({
128
- provide: ApplicationOptionsRef,
129
- useValue: new ApplicationOptionsRef(options)
130
- });
131
- providers.push(Application_1);
132
- providers.push((_a = options.providers) !== null && _a !== void 0 ? _a : []);
133
- runtime.providers = providers;
134
- let injector;
135
- try {
136
- injector = ReflectiveInjector.resolveAndCreate(providers, options.parentInjector);
137
- }
138
- catch (e) {
139
- console.error(`Failed to resolve injector:`);
140
- console.error(e);
141
- console.error(`Providers:`);
142
- console.dir(providers);
143
- console.error(`Modules:`);
144
- console.dir(runtime.definitions);
145
- throw e;
146
- }
147
- injector.get(RolesService).silent = options.silent;
148
- runtime.load(injector);
149
- executionContext.application = runtime.getService(Application_1);
150
- runtime.fireEvent('OnInit');
151
- runtime.configure();
152
- if (runtime.selfTest) {
153
- console.log(`[Self Test] ✔ Looks good!`);
154
- process.exit(0);
155
- }
156
- if (options.autostart)
157
- runtime.start();
158
- runtime.fireEvent('AfterStart');
159
- return executionContext.application;
160
- });
161
- }
162
- };
163
- Application = Application_1 = __decorate([
164
- Injectable()
165
- ], Application);
166
- export { Application };
1
+ var Application_1;
2
+ import { __awaiter, __decorate } from "tslib";
3
+ import 'reflect-metadata';
4
+ import { Environment, Time } from '@alterior/common';
5
+ import { inject, Injectable, ModuleAnnotation, ReflectiveInjector } from '@alterior/di';
6
+ import { AppOptionsAnnotation } from './app-options';
7
+ import { ApplicationArgs } from './args';
8
+ import { Runtime } from './modules';
9
+ import { RolesService } from './roles.service';
10
+ export class ApplicationOptionsRef {
11
+ constructor(options) {
12
+ this.options = Object.assign({}, options);
13
+ }
14
+ }
15
+ /**
16
+ * Represents the current runtime execution context.
17
+ * This is exposed via a zone-local variable, and the Runtime
18
+ * populates it with useful information as it becomes available.
19
+ */
20
+ export class ExecutionContext {
21
+ constructor() {
22
+ /**
23
+ * Retrieve the Alterior application which is currently being executed.
24
+ * If an application has not been bootstrapped yet, the value is null.
25
+ */
26
+ this.application = null;
27
+ }
28
+ /**
29
+ * Get the current execution context, if any.
30
+ */
31
+ static get current() {
32
+ return Zone.current.get(ExecutionContext.ZONE_LOCAL_NAME);
33
+ }
34
+ /**
35
+ * Execute the given function in a new zone which has
36
+ * this ExecutionContext instance as the current execution context.
37
+ */
38
+ run(callback) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ let zone = Zone.current.fork({
41
+ name: `AlteriorExecutionContext`,
42
+ properties: {
43
+ [ExecutionContext.ZONE_LOCAL_NAME]: this
44
+ }
45
+ });
46
+ return yield zone.run(() => callback());
47
+ });
48
+ }
49
+ runSync(callback) {
50
+ let zone = Zone.current.fork({
51
+ name: `AlteriorExecutionContext`,
52
+ properties: {
53
+ [ExecutionContext.ZONE_LOCAL_NAME]: this
54
+ }
55
+ });
56
+ return zone.run(() => callback());
57
+ }
58
+ }
59
+ ExecutionContext.ZONE_LOCAL_NAME = '@alterior/runtime:ExecutionContext';
60
+ /**
61
+ * Handles bootstrapping the application.
62
+ */
63
+ let Application = Application_1 = class Application {
64
+ constructor() {
65
+ this.runtime = inject(Runtime);
66
+ this._optionsRef = inject(ApplicationOptionsRef);
67
+ this._args = inject(ApplicationArgs);
68
+ }
69
+ start() {
70
+ this.runtime.start();
71
+ }
72
+ stop() {
73
+ this.runtime.stop();
74
+ }
75
+ get injector() {
76
+ return this.runtime.injector;
77
+ }
78
+ inject(ctor, notFoundValue) {
79
+ return this.injector.get(ctor, notFoundValue);
80
+ }
81
+ get args() {
82
+ return this._args.get();
83
+ }
84
+ get options() {
85
+ return this._optionsRef.options;
86
+ }
87
+ static loadOptions(entryModule, bootstrapOptions) {
88
+ // Read an @AppOptions() decorator if any, and merge providers from it
89
+ // into the bootstrapped providers
90
+ var _a;
91
+ let appOptionsAnnotation = AppOptionsAnnotation.getForClass(entryModule);
92
+ let appProvidedOptions = (_a = appOptionsAnnotation === null || appOptionsAnnotation === void 0 ? void 0 : appOptionsAnnotation.options) !== null && _a !== void 0 ? _a : {};
93
+ return Object.assign({
94
+ version: '0.0.0',
95
+ verbose: false,
96
+ silent: false,
97
+ autostart: true,
98
+ providers: []
99
+ }, appProvidedOptions, bootstrapOptions);
100
+ }
101
+ static validateEntryModule(module) {
102
+ if (typeof module !== 'function') {
103
+ throw new Error(`You must pass a Module class as the first parameter `
104
+ + `to bootstrap(). You provided: `
105
+ + `${typeof module} with value '${module}'`);
106
+ }
107
+ let moduleMetadata = ModuleAnnotation.getForClass(module);
108
+ if (!moduleMetadata)
109
+ throw new Error(`You must pass a module class decorated by @Module()`);
110
+ }
111
+ /**
112
+ * Bootstrap an Alterior application.
113
+ */
114
+ static bootstrap(entryModule, options) {
115
+ let executionContext = new ExecutionContext();
116
+ return executionContext.runSync(() => {
117
+ var _a;
118
+ this.validateEntryModule(entryModule);
119
+ options = this.loadOptions(entryModule, options);
120
+ let runtime = new Runtime(entryModule);
121
+ let providers = [
122
+ ApplicationArgs,
123
+ RolesService,
124
+ Environment,
125
+ Time
126
+ ];
127
+ runtime.contributeProviders(providers);
128
+ providers.push({
129
+ provide: ApplicationOptionsRef,
130
+ useValue: new ApplicationOptionsRef(options)
131
+ });
132
+ providers.push(Application_1);
133
+ providers.push((_a = options.providers) !== null && _a !== void 0 ? _a : []);
134
+ runtime.providers = providers;
135
+ let injector;
136
+ try {
137
+ injector = ReflectiveInjector.resolveAndCreate(providers, options.parentInjector);
138
+ }
139
+ catch (e) {
140
+ console.error(`Failed to resolve injector:`);
141
+ console.error(e);
142
+ console.error(`Providers:`);
143
+ console.dir(providers);
144
+ console.error(`Modules:`);
145
+ console.dir(runtime.definitions);
146
+ throw e;
147
+ }
148
+ injector.get(RolesService).silent = options.silent;
149
+ runtime.load(injector);
150
+ executionContext.application = runtime.getService(Application_1);
151
+ runtime.fireEvent('OnInit');
152
+ runtime.configure();
153
+ if (runtime.selfTest) {
154
+ console.log(`[Self Test] ✔ Looks good!`);
155
+ process.exit(0);
156
+ }
157
+ if (options.autostart)
158
+ runtime.start();
159
+ runtime.fireEvent('AfterStart');
160
+ return executionContext.application;
161
+ });
162
+ }
163
+ };
164
+ Application = Application_1 = __decorate([
165
+ Injectable()
166
+ ], Application);
167
+ export { Application };
167
168
  //# sourceMappingURL=application.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":";;AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACN,MAAM,EACN,UAAU,EACV,gBAAgB,EAEhB,kBAAkB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAsB,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,qBAAqB;IACjC,YACC,OAA2B;QAE3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CAGD;AAED;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QACC;;;WAGG;QACI,gBAAW,GAAgB,IAAI,CAAC;IAoCxC,CAAC;IAhCA;;OAEG;IACI,MAAM,KAAK,OAAO;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAC3D,CAAC;IAED;;;OAGG;IACU,GAAG,CAAI,QAA0B;;YAC7C,IAAI,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC5B,IAAI,EAAE,0BAA0B;gBAChC,UAAU,EAAE;oBACX,CAAC,gBAAgB,CAAC,eAAe,CAAC,EAAE,IAAI;iBACxC;aACD,CAA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