@venizia/ignis-boot 0.0.1-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/LICENSE.md +75 -0
- package/dist/cjs/base/base-artifact-booter.d.ts +18 -0
- package/dist/cjs/base/base-artifact-booter.d.ts.map +1 -0
- package/dist/cjs/base/base-artifact-booter.js +89 -0
- package/dist/cjs/base/base-artifact-booter.js.map +1 -0
- package/dist/cjs/base/index.d.ts +2 -0
- package/dist/cjs/base/index.d.ts.map +1 -0
- package/dist/cjs/base/index.js +18 -0
- package/dist/cjs/base/index.js.map +1 -0
- package/dist/cjs/boot.mixin.d.ts +54 -0
- package/dist/cjs/boot.mixin.d.ts.map +1 -0
- package/dist/cjs/boot.mixin.js +25 -0
- package/dist/cjs/boot.mixin.js.map +1 -0
- package/dist/cjs/booters/controller.booter.d.ts +10 -0
- package/dist/cjs/booters/controller.booter.d.ts.map +1 -0
- package/dist/cjs/booters/controller.booter.js +48 -0
- package/dist/cjs/booters/controller.booter.js.map +1 -0
- package/dist/cjs/booters/datasource.booter.d.ts +10 -0
- package/dist/cjs/booters/datasource.booter.d.ts.map +1 -0
- package/dist/cjs/booters/datasource.booter.js +48 -0
- package/dist/cjs/booters/datasource.booter.js.map +1 -0
- package/dist/cjs/booters/index.d.ts +5 -0
- package/dist/cjs/booters/index.d.ts.map +1 -0
- package/dist/cjs/booters/index.js +21 -0
- package/dist/cjs/booters/index.js.map +1 -0
- package/dist/cjs/booters/repository.booter.d.ts +10 -0
- package/dist/cjs/booters/repository.booter.d.ts.map +1 -0
- package/dist/cjs/booters/repository.booter.js +48 -0
- package/dist/cjs/booters/repository.booter.js.map +1 -0
- package/dist/cjs/booters/service.booter.d.ts +10 -0
- package/dist/cjs/booters/service.booter.d.ts.map +1 -0
- package/dist/cjs/booters/service.booter.js +48 -0
- package/dist/cjs/booters/service.booter.js.map +1 -0
- package/dist/cjs/bootstrapper.d.ts +22 -0
- package/dist/cjs/bootstrapper.d.ts.map +1 -0
- package/dist/cjs/bootstrapper.js +98 -0
- package/dist/cjs/bootstrapper.js.map +1 -0
- package/dist/cjs/common/constants.d.ts +6 -0
- package/dist/cjs/common/constants.d.ts.map +1 -0
- package/dist/cjs/common/constants.js +10 -0
- package/dist/cjs/common/constants.js.map +1 -0
- package/dist/cjs/common/index.d.ts +3 -0
- package/dist/cjs/common/index.d.ts.map +1 -0
- package/dist/cjs/common/index.js +19 -0
- package/dist/cjs/common/index.js.map +1 -0
- package/dist/cjs/common/types.d.ts +52 -0
- package/dist/cjs/common/types.d.ts.map +1 -0
- package/dist/cjs/common/types.js +5 -0
- package/dist/cjs/common/types.js.map +1 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/utilities/boot.utility.d.ts +31 -0
- package/dist/cjs/utilities/boot.utility.d.ts.map +1 -0
- package/dist/cjs/utilities/boot.utility.js +67 -0
- package/dist/cjs/utilities/boot.utility.js.map +1 -0
- package/dist/cjs/utilities/index.d.ts +2 -0
- package/dist/cjs/utilities/index.d.ts.map +1 -0
- package/dist/cjs/utilities/index.js +18 -0
- package/dist/cjs/utilities/index.js.map +1 -0
- package/dist/esm/base/base-artifact-booter.d.ts +18 -0
- package/dist/esm/base/base-artifact-booter.d.ts.map +1 -0
- package/dist/esm/base/base-artifact-booter.js +85 -0
- package/dist/esm/base/base-artifact-booter.js.map +1 -0
- package/dist/esm/base/index.d.ts +2 -0
- package/dist/esm/base/index.d.ts.map +1 -0
- package/dist/esm/base/index.js +2 -0
- package/dist/esm/base/index.js.map +1 -0
- package/dist/esm/boot.mixin.d.ts +54 -0
- package/dist/esm/boot.mixin.d.ts.map +1 -0
- package/dist/esm/boot.mixin.js +21 -0
- package/dist/esm/boot.mixin.js.map +1 -0
- package/dist/esm/booters/controller.booter.d.ts +10 -0
- package/dist/esm/booters/controller.booter.d.ts.map +1 -0
- package/dist/esm/booters/controller.booter.js +45 -0
- package/dist/esm/booters/controller.booter.js.map +1 -0
- package/dist/esm/booters/datasource.booter.d.ts +10 -0
- package/dist/esm/booters/datasource.booter.d.ts.map +1 -0
- package/dist/esm/booters/datasource.booter.js +45 -0
- package/dist/esm/booters/datasource.booter.js.map +1 -0
- package/dist/esm/booters/index.d.ts +5 -0
- package/dist/esm/booters/index.d.ts.map +1 -0
- package/dist/esm/booters/index.js +5 -0
- package/dist/esm/booters/index.js.map +1 -0
- package/dist/esm/booters/repository.booter.d.ts +10 -0
- package/dist/esm/booters/repository.booter.d.ts.map +1 -0
- package/dist/esm/booters/repository.booter.js +45 -0
- package/dist/esm/booters/repository.booter.js.map +1 -0
- package/dist/esm/booters/service.booter.d.ts +10 -0
- package/dist/esm/booters/service.booter.d.ts.map +1 -0
- package/dist/esm/booters/service.booter.js +45 -0
- package/dist/esm/booters/service.booter.js.map +1 -0
- package/dist/esm/bootstrapper.d.ts +22 -0
- package/dist/esm/bootstrapper.d.ts.map +1 -0
- package/dist/esm/bootstrapper.js +95 -0
- package/dist/esm/bootstrapper.js.map +1 -0
- package/dist/esm/common/constants.d.ts +6 -0
- package/dist/esm/common/constants.d.ts.map +1 -0
- package/dist/esm/common/constants.js +6 -0
- package/dist/esm/common/constants.js.map +1 -0
- package/dist/esm/common/index.d.ts +3 -0
- package/dist/esm/common/index.d.ts.map +1 -0
- package/dist/esm/common/index.js +3 -0
- package/dist/esm/common/index.js.map +1 -0
- package/dist/esm/common/types.d.ts +52 -0
- package/dist/esm/common/types.d.ts.map +1 -0
- package/dist/esm/common/types.js +2 -0
- package/dist/esm/common/types.js.map +1 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/utilities/boot.utility.d.ts +31 -0
- package/dist/esm/utilities/boot.utility.d.ts.map +1 -0
- package/dist/esm/utilities/boot.utility.js +61 -0
- package/dist/esm/utilities/boot.utility.js.map +1 -0
- package/dist/esm/utilities/index.d.ts +2 -0
- package/dist/esm/utilities/index.d.ts.map +1 -0
- package/dist/esm/utilities/index.js +2 -0
- package/dist/esm/utilities/index.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Bootstrapper, ControllerBooter, DatasourceBooter, RepositoryBooter, ServiceBooter, } from '@venizia/ignis-boot';
|
|
2
|
+
import { BindingScopes } from '@venizia/ignis-inversion';
|
|
3
|
+
export const BootMixin = (baseClass) => {
|
|
4
|
+
class Mixed extends baseClass {
|
|
5
|
+
constructor(...args) {
|
|
6
|
+
super(...args);
|
|
7
|
+
this.bind({ key: `@app/boot-options` }).toValue(this.bootOptions ?? {});
|
|
8
|
+
this.bind({ key: 'booter.DatasourceBooter' }).toClass(DatasourceBooter).setTags('booter');
|
|
9
|
+
this.bind({ key: 'booter.RepositoryBooter' }).toClass(RepositoryBooter).setTags('booter');
|
|
10
|
+
this.bind({ key: 'booter.ServiceBooter' }).toClass(ServiceBooter).setTags('booter');
|
|
11
|
+
this.bind({ key: 'booter.ControllerBooter' }).toClass(ControllerBooter).setTags('booter');
|
|
12
|
+
this.bind({ key: 'bootstrapper' }).toClass(Bootstrapper).setScope(BindingScopes.SINGLETON);
|
|
13
|
+
}
|
|
14
|
+
boot() {
|
|
15
|
+
const bootstrapper = this.get({ key: 'bootstrapper' });
|
|
16
|
+
return bootstrapper.boot({});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return Mixed;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=boot.mixin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.mixin.js","sourceRoot":"","sources":["../../src/boot.mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAIhB,gBAAgB,EAChB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EA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AC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseArtifactBooter } from '../base';
|
|
2
|
+
import { IApplication, IBootOptions } from '../common';
|
|
3
|
+
export declare class ControllerBooter extends BaseArtifactBooter {
|
|
4
|
+
private readonly application;
|
|
5
|
+
constructor(root: string, application: IApplication, bootOptions: IBootOptions);
|
|
6
|
+
protected getDefaultDirs(): string[];
|
|
7
|
+
protected getDefaultExtensions(): string[];
|
|
8
|
+
protected bind(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=controller.booter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.booter.d.ts","sourceRoot":"","sources":["../../../src/booters/controller.booter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtD,qBAAa,gBAAiB,SAAQ,kBAAkB;IAGlB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADxB,IAAI,EAAE,MAAM,EACC,WAAW,EAAE,YAAY,EACtC,WAAW,EAAE,YAAY;cAM9C,cAAc,IAAI,MAAM,EAAE;cAK1B,oBAAoB,IAAI,MAAM,EAAE;cAK1B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var ControllerBooter_1;
|
|
14
|
+
import { BaseArtifactBooter } from '../base';
|
|
15
|
+
import { BindingKeys, inject } from '@venizia/ignis-inversion';
|
|
16
|
+
let ControllerBooter = ControllerBooter_1 = class ControllerBooter extends BaseArtifactBooter {
|
|
17
|
+
constructor(root, application, bootOptions) {
|
|
18
|
+
super({ scope: ControllerBooter_1.name, root, artifactOptions: bootOptions.controllers ?? {} });
|
|
19
|
+
this.application = application;
|
|
20
|
+
}
|
|
21
|
+
// --------------------------------------------------------------------------------
|
|
22
|
+
getDefaultDirs() {
|
|
23
|
+
return ['controllers'];
|
|
24
|
+
}
|
|
25
|
+
// --------------------------------------------------------------------------------
|
|
26
|
+
getDefaultExtensions() {
|
|
27
|
+
return ['.controller.js'];
|
|
28
|
+
}
|
|
29
|
+
// --------------------------------------------------------------------------------
|
|
30
|
+
async bind() {
|
|
31
|
+
for (const cls of this.loadedClasses) {
|
|
32
|
+
const key = BindingKeys.build({ namespace: 'controllers', key: cls.name });
|
|
33
|
+
this.application.bind({ key }).toClass(cls).setTags('controllers');
|
|
34
|
+
this.logger.debug('[bind] Bound key: %s', key);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
ControllerBooter = ControllerBooter_1 = __decorate([
|
|
39
|
+
__param(0, inject({ key: '@app/project_root' })),
|
|
40
|
+
__param(1, inject({ key: '@app/instance' })),
|
|
41
|
+
__param(2, inject({ key: '@app/boot-options' })),
|
|
42
|
+
__metadata("design:paramtypes", [String, Object, Object])
|
|
43
|
+
], ControllerBooter);
|
|
44
|
+
export { ControllerBooter };
|
|
45
|
+
//# sourceMappingURL=controller.booter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.booter.js","sourceRoot":"","sources":["../../../src/booters/controller.booter.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAE/D,IAAa,gBAAgB,wBAA7B,MAAa,gBAAiB,SAAQ,kBAAkB;IACtD,YACwC,IAAY,EACC,WAAyB,EACtC,WAAyB;QAE/D,KAAK,CAAC,EAAE,KAAK,EAAE,kBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,WAAW,IAAI,EAAE,EAAE,CAAC,CAAC;QAH3C,gBAAW,GAAX,WAAW,CAAc;IAI9E,CAAC;IAED,mFAAmF;IAChE,cAAc;QAC/B,OAAO,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;IAED,mFAAmF;IAChE,oBAAoB;QACrC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5B,CAAC;IAED,mFAAmF;IAChE,KAAK,CAAC,IAAI;QAC3B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAC3E,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACnE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF,CAAA;AA3BY,gBAAgB;IAExB,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAA;IACpC,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAA;IAChC,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAA;;GAJ5B,gBAAgB,CA2B5B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseArtifactBooter } from '../base';
|
|
2
|
+
import { IApplication, IBootOptions } from '../common';
|
|
3
|
+
export declare class DatasourceBooter extends BaseArtifactBooter {
|
|
4
|
+
private readonly application;
|
|
5
|
+
constructor(root: string, application: IApplication, bootOptions: IBootOptions);
|
|
6
|
+
protected getDefaultDirs(): string[];
|
|
7
|
+
protected getDefaultExtensions(): string[];
|
|
8
|
+
protected bind(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=datasource.booter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasource.booter.d.ts","sourceRoot":"","sources":["../../../src/booters/datasource.booter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtD,qBAAa,gBAAiB,SAAQ,kBAAkB;IAGlB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADxB,IAAI,EAAE,MAAM,EACC,WAAW,EAAE,YAAY,EACtC,WAAW,EAAE,YAAY;cAM9C,cAAc,IAAI,MAAM,EAAE;cAK1B,oBAAoB,IAAI,MAAM,EAAE;cAK1B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var DatasourceBooter_1;
|
|
14
|
+
import { BaseArtifactBooter } from '../base';
|
|
15
|
+
import { BindingKeys, inject } from '@venizia/ignis-inversion';
|
|
16
|
+
let DatasourceBooter = DatasourceBooter_1 = class DatasourceBooter extends BaseArtifactBooter {
|
|
17
|
+
constructor(root, application, bootOptions) {
|
|
18
|
+
super({ scope: DatasourceBooter_1.name, root, artifactOptions: bootOptions.datasources ?? {} });
|
|
19
|
+
this.application = application;
|
|
20
|
+
}
|
|
21
|
+
// --------------------------------------------------------------------------------
|
|
22
|
+
getDefaultDirs() {
|
|
23
|
+
return ['datasources'];
|
|
24
|
+
}
|
|
25
|
+
// --------------------------------------------------------------------------------
|
|
26
|
+
getDefaultExtensions() {
|
|
27
|
+
return ['.datasource.js'];
|
|
28
|
+
}
|
|
29
|
+
// --------------------------------------------------------------------------------
|
|
30
|
+
async bind() {
|
|
31
|
+
for (const cls of this.loadedClasses) {
|
|
32
|
+
const key = BindingKeys.build({ namespace: 'datasources', key: cls.name });
|
|
33
|
+
this.application.bind({ key }).toClass(cls).setTags('datasources').setScope('singleton');
|
|
34
|
+
this.logger.debug('[bind] Bound key: %s', key);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
DatasourceBooter = DatasourceBooter_1 = __decorate([
|
|
39
|
+
__param(0, inject({ key: '@app/project_root' })),
|
|
40
|
+
__param(1, inject({ key: '@app/instance' })),
|
|
41
|
+
__param(2, inject({ key: '@app/boot-options' })),
|
|
42
|
+
__metadata("design:paramtypes", [String, Object, Object])
|
|
43
|
+
], DatasourceBooter);
|
|
44
|
+
export { DatasourceBooter };
|
|
45
|
+
//# sourceMappingURL=datasource.booter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasource.booter.js","sourceRoot":"","sources":["../../../src/booters/datasource.booter.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAE/D,IAAa,gBAAgB,wBAA7B,MAAa,gBAAiB,SAAQ,kBAAkB;IACtD,YACwC,IAAY,EACC,WAAyB,EACtC,WAAyB;QAE/D,KAAK,CAAC,EAAE,KAAK,EAAE,kBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,WAAW,IAAI,EAAE,EAAE,CAAC,CAAC;QAH3C,gBAAW,GAAX,WAAW,CAAc;IAI9E,CAAC;IAED,mFAAmF;IAChE,cAAc;QAC/B,OAAO,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;IAED,mFAAmF;IAChE,oBAAoB;QACrC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5B,CAAC;IAED,mFAAmF;IAChE,KAAK,CAAC,IAAI;QAC3B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAC3E,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YACzF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF,CAAA;AA3BY,gBAAgB;IAExB,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAA;IACpC,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAA;IAChC,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAA;;GAJ5B,gBAAgB,CA2B5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/booters/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/booters/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseArtifactBooter } from '../base';
|
|
2
|
+
import { IApplication, IBootOptions } from '../common';
|
|
3
|
+
export declare class RepositoryBooter extends BaseArtifactBooter {
|
|
4
|
+
protected application: IApplication;
|
|
5
|
+
constructor(root: string, application: IApplication, bootOptions: IBootOptions);
|
|
6
|
+
protected getDefaultDirs(): string[];
|
|
7
|
+
protected getDefaultExtensions(): string[];
|
|
8
|
+
protected bind(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=repository.booter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.booter.d.ts","sourceRoot":"","sources":["../../../src/booters/repository.booter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtD,qBAAa,gBAAiB,SAAQ,kBAAkB;IAGlB,SAAS,CAAC,WAAW,EAAE,YAAY;gBAD/B,IAAI,EAAE,MAAM,EACN,WAAW,EAAE,YAAY,EAC/B,WAAW,EAAE,YAAY;cAK9C,cAAc,IAAI,MAAM,EAAE;cAK1B,oBAAoB,IAAI,MAAM,EAAE;cAK1B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var RepositoryBooter_1;
|
|
14
|
+
import { BaseArtifactBooter } from '../base';
|
|
15
|
+
import { BindingKeys, inject } from '@venizia/ignis-inversion';
|
|
16
|
+
let RepositoryBooter = RepositoryBooter_1 = class RepositoryBooter extends BaseArtifactBooter {
|
|
17
|
+
constructor(root, application, bootOptions) {
|
|
18
|
+
super({ scope: RepositoryBooter_1.name, root, artifactOptions: bootOptions.repositories ?? {} });
|
|
19
|
+
this.application = application;
|
|
20
|
+
}
|
|
21
|
+
// --------------------------------------------------------------------------------
|
|
22
|
+
getDefaultDirs() {
|
|
23
|
+
return ['repositories'];
|
|
24
|
+
}
|
|
25
|
+
// --------------------------------------------------------------------------------
|
|
26
|
+
getDefaultExtensions() {
|
|
27
|
+
return ['.repository.js'];
|
|
28
|
+
}
|
|
29
|
+
// --------------------------------------------------------------------------------
|
|
30
|
+
async bind() {
|
|
31
|
+
for (const cls of this.loadedClasses) {
|
|
32
|
+
const key = BindingKeys.build({ namespace: 'repositories', key: cls.name });
|
|
33
|
+
this.application.bind({ key }).toClass(cls).setTags('repositories');
|
|
34
|
+
this.logger.debug('[bind] Bound key: %s', key);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
RepositoryBooter = RepositoryBooter_1 = __decorate([
|
|
39
|
+
__param(0, inject({ key: '@app/project_root' })),
|
|
40
|
+
__param(1, inject({ key: '@app/instance' })),
|
|
41
|
+
__param(2, inject({ key: '@app/boot-options' })),
|
|
42
|
+
__metadata("design:paramtypes", [String, Object, Object])
|
|
43
|
+
], RepositoryBooter);
|
|
44
|
+
export { RepositoryBooter };
|
|
45
|
+
//# sourceMappingURL=repository.booter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.booter.js","sourceRoot":"","sources":["../../../src/booters/repository.booter.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAE/D,IAAa,gBAAgB,wBAA7B,MAAa,gBAAiB,SAAQ,kBAAkB;IACtD,YACwC,IAAY,EACN,WAAyB,EAC/B,WAAyB;QAE/D,KAAK,CAAC,EAAE,KAAK,EAAE,kBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC,CAAC;QAHnD,gBAAW,GAAX,WAAW,CAAc;IAIvE,CAAC;IACD,mFAAmF;IAChE,cAAc;QAC/B,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1B,CAAC;IAED,mFAAmF;IAChE,oBAAoB;QACrC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5B,CAAC;IAED,mFAAmF;IAChE,KAAK,CAAC,IAAI;QAC3B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5E,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YACpE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF,CAAA;AA1BY,gBAAgB;IAExB,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAA;IACpC,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAA;IAChC,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAA;;GAJ5B,gBAAgB,CA0B5B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseArtifactBooter } from '../base';
|
|
2
|
+
import { IApplication, IBootOptions } from '../common';
|
|
3
|
+
export declare class ServiceBooter extends BaseArtifactBooter {
|
|
4
|
+
protected application: IApplication;
|
|
5
|
+
constructor(root: string, application: IApplication, bootOptions: IBootOptions);
|
|
6
|
+
protected getDefaultDirs(): string[];
|
|
7
|
+
protected getDefaultExtensions(): string[];
|
|
8
|
+
protected bind(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=service.booter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.booter.d.ts","sourceRoot":"","sources":["../../../src/booters/service.booter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtD,qBAAa,aAAc,SAAQ,kBAAkB;IAGf,SAAS,CAAC,WAAW,EAAE,YAAY;gBAD/B,IAAI,EAAE,MAAM,EACN,WAAW,EAAE,YAAY,EAC/B,WAAW,EAAE,YAAY;cAM9C,cAAc,IAAI,MAAM,EAAE;cAK1B,oBAAoB,IAAI,MAAM,EAAE;cAK1B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var ServiceBooter_1;
|
|
14
|
+
import { BaseArtifactBooter } from '../base';
|
|
15
|
+
import { BindingKeys, inject } from '@venizia/ignis-inversion';
|
|
16
|
+
let ServiceBooter = ServiceBooter_1 = class ServiceBooter extends BaseArtifactBooter {
|
|
17
|
+
constructor(root, application, bootOptions) {
|
|
18
|
+
super({ scope: ServiceBooter_1.name, root, artifactOptions: bootOptions.services ?? {} });
|
|
19
|
+
this.application = application;
|
|
20
|
+
}
|
|
21
|
+
// --------------------------------------------------------------------------------
|
|
22
|
+
getDefaultDirs() {
|
|
23
|
+
return ['services'];
|
|
24
|
+
}
|
|
25
|
+
// --------------------------------------------------------------------------------
|
|
26
|
+
getDefaultExtensions() {
|
|
27
|
+
return ['.service.js'];
|
|
28
|
+
}
|
|
29
|
+
// --------------------------------------------------------------------------------
|
|
30
|
+
async bind() {
|
|
31
|
+
for (const cls of this.loadedClasses) {
|
|
32
|
+
const key = BindingKeys.build({ namespace: 'services', key: cls.name });
|
|
33
|
+
this.application.bind({ key }).toClass(cls).setTags('services');
|
|
34
|
+
this.logger.debug('[bind] Bound key: %s', key);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
ServiceBooter = ServiceBooter_1 = __decorate([
|
|
39
|
+
__param(0, inject({ key: '@app/project_root' })),
|
|
40
|
+
__param(1, inject({ key: '@app/instance' })),
|
|
41
|
+
__param(2, inject({ key: '@app/boot-options' })),
|
|
42
|
+
__metadata("design:paramtypes", [String, Object, Object])
|
|
43
|
+
], ServiceBooter);
|
|
44
|
+
export { ServiceBooter };
|
|
45
|
+
//# sourceMappingURL=service.booter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.booter.js","sourceRoot":"","sources":["../../../src/booters/service.booter.ts"],"names":[],"mappings":";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AAC,CAAA;;GAJ5B,aAAa,CA2BzB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IApplication, IBootExecutionOptions, IBootReport, IBootstrapper } from './common/types';
|
|
2
|
+
import { BaseHelper } from '@venizia/ignis-helpers';
|
|
3
|
+
/**
|
|
4
|
+
* BaseBootstrapper orchestrates the boot process
|
|
5
|
+
*
|
|
6
|
+
* Responsibilities:
|
|
7
|
+
* 1. Discover all booters
|
|
8
|
+
* 2. Run boot phases (configure, discover, load)
|
|
9
|
+
* 3. Generate boot report
|
|
10
|
+
*/
|
|
11
|
+
export declare class Bootstrapper extends BaseHelper implements IBootstrapper {
|
|
12
|
+
private readonly application;
|
|
13
|
+
private booters;
|
|
14
|
+
private phaseStartTimings;
|
|
15
|
+
private phaseEndTimings;
|
|
16
|
+
constructor(application: IApplication);
|
|
17
|
+
boot(opts: IBootExecutionOptions): Promise<IBootReport>;
|
|
18
|
+
private discoverBooters;
|
|
19
|
+
private runPhase;
|
|
20
|
+
private generateReport;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=bootstrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrapper.d.ts","sourceRoot":"","sources":["../../src/bootstrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAEZ,qBAAqB,EACrB,WAAW,EACX,aAAa,EAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAY,MAAM,wBAAwB,CAAC;AAG9D;;;;;;;GAOG;AACH,qBAAa,YAAa,SAAQ,UAAW,YAAW,aAAa;IAKrB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAJ1E,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,OAAO,CAAC,eAAe,CAAkC;gBAEM,WAAW,EAAE,YAAY;IAKlF,IAAI,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;YAY/C,eAAe;YAUf,QAAQ;IAqDtB,OAAO,CAAC,cAAc;CAMvB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var Bootstrapper_1;
|
|
14
|
+
import { BOOT_PHASES, } from './common/types';
|
|
15
|
+
import { BaseHelper, getError } from '@venizia/ignis-helpers';
|
|
16
|
+
import { inject } from '@venizia/ignis-inversion';
|
|
17
|
+
/**
|
|
18
|
+
* BaseBootstrapper orchestrates the boot process
|
|
19
|
+
*
|
|
20
|
+
* Responsibilities:
|
|
21
|
+
* 1. Discover all booters
|
|
22
|
+
* 2. Run boot phases (configure, discover, load)
|
|
23
|
+
* 3. Generate boot report
|
|
24
|
+
*/
|
|
25
|
+
let Bootstrapper = Bootstrapper_1 = class Bootstrapper extends BaseHelper {
|
|
26
|
+
constructor(application) {
|
|
27
|
+
super({ scope: Bootstrapper_1.name });
|
|
28
|
+
this.application = application;
|
|
29
|
+
this.booters = [];
|
|
30
|
+
this.phaseStartTimings = new Map();
|
|
31
|
+
this.phaseEndTimings = new Map();
|
|
32
|
+
}
|
|
33
|
+
// --------------------------------------------------------------------------------
|
|
34
|
+
async boot(opts) {
|
|
35
|
+
const { phases = BOOT_PHASES, booters } = opts;
|
|
36
|
+
await this.discoverBooters();
|
|
37
|
+
this.logger.debug(`[boot] Starting boot | Number of booters: %d`, this.booters.length);
|
|
38
|
+
for (const phase of phases) {
|
|
39
|
+
await this.runPhase({ phase, booterNames: booters });
|
|
40
|
+
}
|
|
41
|
+
return this.generateReport();
|
|
42
|
+
}
|
|
43
|
+
// --------------------------------------------------------------------------------
|
|
44
|
+
async discoverBooters() {
|
|
45
|
+
const booterBindings = this.application.findByTag({ tag: 'booter' });
|
|
46
|
+
for (const binding of booterBindings) {
|
|
47
|
+
this.booters.push(binding.getValue(this.application));
|
|
48
|
+
this.logger.debug(`[discoverBooters] Discovered booter: %s`, binding.key);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// --------------------------------------------------------------------------------
|
|
52
|
+
async runPhase(opts) {
|
|
53
|
+
const { phase } = opts; // TODO: booterNames filtering can be implemented later
|
|
54
|
+
this.phaseStartTimings.set(phase, performance.now());
|
|
55
|
+
this.logger.debug(`[runPhase] Starting phase: %s`, phase.toUpperCase());
|
|
56
|
+
for (const booter of this.booters) {
|
|
57
|
+
const phaseMethod = booter[phase];
|
|
58
|
+
if (!phaseMethod) {
|
|
59
|
+
this.logger.debug(`[runPhase] SKIP not implemented booter | Phase: %s | Booter: %s`, phase, booter.constructor.name);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (typeof phaseMethod !== 'function') {
|
|
63
|
+
this.logger.debug(`[runPhase] SKIP not a function booter | Phase: %s | Booter: %s`, phase, booter.constructor.name);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
this.logger.debug(`[runPhase] Running | Phase: %s | Booter: %s`, phase, booter.constructor.name);
|
|
68
|
+
await phaseMethod.call(booter);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const errorMessage = error?.message || String(error);
|
|
72
|
+
throw getError({
|
|
73
|
+
message: `[Bootstrapper][runPhase] Error during phase '${phase}' on booter '${booter.constructor.name}': ${errorMessage}`,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
this.phaseEndTimings.set(phase, performance.now());
|
|
78
|
+
const start = this.phaseStartTimings.get(phase) ?? 0;
|
|
79
|
+
const end = this.phaseEndTimings.get(phase) ?? 0;
|
|
80
|
+
const duration = end - start;
|
|
81
|
+
this.logger.debug(`[DEBUG][runPhase] Completed phase: %s | Took: %d ms`, phase.toUpperCase(), duration);
|
|
82
|
+
}
|
|
83
|
+
// --------------------------------------------------------------------------------
|
|
84
|
+
generateReport() {
|
|
85
|
+
const report = {};
|
|
86
|
+
this.logger.debug(`[generateReport] Boot report: %j`, report);
|
|
87
|
+
return report;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
Bootstrapper = Bootstrapper_1 = __decorate([
|
|
91
|
+
__param(0, inject({ key: '@app/instance' })),
|
|
92
|
+
__metadata("design:paramtypes", [Object])
|
|
93
|
+
], Bootstrapper);
|
|
94
|
+
export { Bootstrapper };
|
|
95
|
+
//# sourceMappingURL=bootstrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrapper.js","sourceRoot":"","sources":["../../src/bootstrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EACL,WAAW,GAOZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD;;;;;;;GAOG;AACH,IAAa,YAAY,oBAAzB,MAAa,YAAa,SAAQ,UAAU;IAK1C,YAA8C,WAA0C;QACtF,KAAK,CAAC,EAAE,KAAK,EAAE,cAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QADyB,gB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G,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,QAAQ,GAAG,GAAG,GAAG,KAAK,CAAC;QAE7B,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,qDAAqD,EACrD,KAAK,CAAC,WAAW,EAAE,EACnB,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,mFAAmF;IAC3E,cAAc;QACpB,MAAM,MAAM,GAAgB,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;QAE9D,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AA3FY,YAAY;IAKV,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAA;;GALlC,YAAY,CA2FxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,MAAM,CAAC,QAAQ,CAAC,SAAS,eAAe;IACxC,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAc;IACtC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAU;aACL,cAAS,GAAG,WAAW,CAAC;aACxB,aAAQ,GAAG,UAAU,CAAC;aACtB,SAAI,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { TConstValue, ValueOrPromise } from '@venizia/ignis-helpers';
|
|
2
|
+
import { Container } from '@venizia/ignis-inversion';
|
|
3
|
+
import { BootPhases } from './constants';
|
|
4
|
+
export interface IArtifactOptions {
|
|
5
|
+
dirs?: string[];
|
|
6
|
+
extensions?: string[];
|
|
7
|
+
isNested?: boolean;
|
|
8
|
+
glob?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IBootOptions {
|
|
11
|
+
controllers?: IArtifactOptions;
|
|
12
|
+
services?: IArtifactOptions;
|
|
13
|
+
repositories?: IArtifactOptions;
|
|
14
|
+
datasources?: IArtifactOptions;
|
|
15
|
+
[artifactType: string]: IArtifactOptions | undefined;
|
|
16
|
+
}
|
|
17
|
+
export type TBootPhase = TConstValue<typeof BootPhases>;
|
|
18
|
+
export declare const BOOT_PHASES: TBootPhase[];
|
|
19
|
+
export interface IApplication extends Container {
|
|
20
|
+
getProjectRoot(): string;
|
|
21
|
+
}
|
|
22
|
+
export interface IBootableApplication {
|
|
23
|
+
boot(): Promise<IBootReport>;
|
|
24
|
+
}
|
|
25
|
+
export interface IBooterOptions {
|
|
26
|
+
scope: string;
|
|
27
|
+
root: string;
|
|
28
|
+
artifactOptions: IArtifactOptions;
|
|
29
|
+
}
|
|
30
|
+
export interface IBooter {
|
|
31
|
+
configure(): ValueOrPromise<void>;
|
|
32
|
+
discover(): ValueOrPromise<void>;
|
|
33
|
+
load(): ValueOrPromise<void>;
|
|
34
|
+
}
|
|
35
|
+
export interface IBootExecutionOptions {
|
|
36
|
+
/**
|
|
37
|
+
* Phases to execute
|
|
38
|
+
* @default ['configure', 'discover', 'load']
|
|
39
|
+
*/
|
|
40
|
+
phases?: TBootPhase[];
|
|
41
|
+
/**
|
|
42
|
+
* Specific booters to run (by name)
|
|
43
|
+
* If not specified, all booters are run
|
|
44
|
+
*/
|
|
45
|
+
booters?: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface IBootstrapper {
|
|
48
|
+
boot(opts: IBootExecutionOptions): Promise<IBootReport>;
|
|
49
|
+
}
|
|
50
|
+
export interface IBootReport {
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,CAAC,YAAY,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,UAAU,CAAC,CAAC;AAExD,eAAO,MAAM,WAAW,EAAE,UAAU,EAAsC,CAAC;AAE3E,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,cAAc,IAAI,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,gBAAgB,CAAC;CACnC;AAED,MAAM,WAAW,OAAO;IACtB,SAAS,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,QAAQ,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACzD;AAGD,MAAM,WAAW,WAAW;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAC,MAAM,WAAW,GAAiB,CAAC,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AnyType, TClass } from '@venizia/ignis-helpers';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a value is a class constructor
|
|
4
|
+
*
|
|
5
|
+
* @param target - Target to check
|
|
6
|
+
* @returns True if target is a class
|
|
7
|
+
*/
|
|
8
|
+
export declare const isClass: <T>(target: AnyType) => target is TClass<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Discover files matching a glob pattern
|
|
11
|
+
*
|
|
12
|
+
* @param pattern - Glob pattern
|
|
13
|
+
* @param root - Root directory
|
|
14
|
+
* @returns Array of absolute file paths
|
|
15
|
+
*/
|
|
16
|
+
export declare const discoverFiles: (opts: {
|
|
17
|
+
pattern: string;
|
|
18
|
+
root: string;
|
|
19
|
+
}) => Promise<string[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Load classes from files
|
|
22
|
+
*
|
|
23
|
+
* @param files - Array of file paths
|
|
24
|
+
* @param root - Root directory (for relative paths in errors)
|
|
25
|
+
* @returns Array of class constructors
|
|
26
|
+
*/
|
|
27
|
+
export declare const loadClasses: (opts: {
|
|
28
|
+
files: string[];
|
|
29
|
+
root: string;
|
|
30
|
+
}) => Promise<AnyType[]>;
|
|
31
|
+
//# sourceMappingURL=boot.utility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.utility.d.ts","sourceRoot":"","sources":["../../../src/utilities/boot.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGnE;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,QAAQ,OAAO,KAAG,MAAM,IAAI,MAAM,CAAC,CAAC,CAE9D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,CAAC,IAAI,EAAE;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,KAAK,OAAO,CAAC,MAAM,EAAE,CAYrB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,IAAI,EAAE;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,KAAK,OAAO,CAAC,OAAO,EAAE,CAuBtB,CAAC"}
|