@loopback/boot 2.1.1 → 2.3.1
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/CHANGELOG.md +42 -0
- package/dist/.sandbox/{11889PRvhvm → 635411GGsm1}/model-endpoints/no-entity.rest-config.js +0 -0
- package/dist/.sandbox/635411GGsm1/models/no-entity.model.js +28 -0
- package/dist/.sandbox/{11889wtTpPA → 635415cxfJi}/service-provider.artifact.js +1 -0
- package/dist/.sandbox/{118893KtxoA → 635419mu8mo}/application.js +1 -0
- package/dist/.sandbox/{11889S6GDvS → 635419mu8mo}/services/bindable-classes.service.js +26 -19
- package/dist/.sandbox/{11889S6GDvS → 635419mu8mo}/services/geocoder.service.js +1 -0
- package/dist/.sandbox/{11889S6GDvS → 635419mu8mo}/services/greeting.service.js +1 -0
- package/dist/.sandbox/{11889K8KL2J → 635419t6TqH}/datasource.artifact.js +9 -5
- package/dist/.sandbox/63541BtDxTa/multiple.artifact.js +45 -0
- package/dist/.sandbox/{11889CQQ0nI → 63541DlS0Ic}/application.js +1 -0
- package/dist/.sandbox/63541DlS0Ic/repositories/multiple.repository.js +45 -0
- package/dist/.sandbox/{118896Rj4ze → 63541DshyBF}/application.js +1 -0
- package/dist/.sandbox/{118893KtxoA → 63541DshyBF}/observers/lifecycle-observer.observer.js +1 -0
- package/dist/.sandbox/{11889DQbyT8 → 63541IEce5V}/application.js +1 -0
- package/dist/.sandbox/{11889zAsxZb → 63541IEce5V}/datasources/db.datasource.js +9 -5
- package/dist/.sandbox/63541ik89oh/application.js +20 -0
- package/dist/.sandbox/63541ik89oh/models/multiple-models.model.js +16 -0
- package/dist/.sandbox/63541ik89oh/models/no-entity.model.js +28 -0
- package/dist/.sandbox/63541ik89oh/models/product.model.js +28 -0
- package/dist/.sandbox/63541meTxP7/application.js +20 -0
- package/dist/.sandbox/63541meTxP7/controllers/multiple.controller.js +45 -0
- package/dist/.sandbox/{11889DQbyT8 → 63541meTxP7}/package.json +0 -0
- package/dist/.sandbox/63541nGmQFL/application.js +20 -0
- package/dist/.sandbox/63541nGmQFL/controllers/multiple.controller.js +45 -0
- package/dist/.sandbox/{11889mdaOd9 → 63541odlHvc}/model-endpoints/product.rest-config.js +0 -0
- package/dist/.sandbox/63541odlHvc/models/product.model.js +28 -0
- package/dist/.sandbox/63541ruUDNf/application.js +20 -0
- package/dist/.sandbox/63541ruUDNf/interceptors/interceptor.interceptor.js +54 -0
- package/dist/.sandbox/63541ruUDNf/interceptors/non-global-interceptor.interceptor.js +54 -0
- package/dist/.sandbox/63541vSi6af/multiple.artifact.js +45 -0
- package/dist/.sandbox/application.js +20 -0
- package/dist/.sandbox/controllers/multiple.controller.js +45 -0
- package/dist/boot.component.d.ts +2 -2
- package/dist/boot.component.js +34 -29
- package/dist/boot.component.js.map +1 -1
- package/dist/booters/application-metadata.booter.js +23 -19
- package/dist/booters/application-metadata.booter.js.map +1 -1
- package/dist/booters/base-artifact.booter.js +1 -0
- package/dist/booters/base-artifact.booter.js.map +1 -1
- package/dist/booters/booter-utils.js +1 -0
- package/dist/booters/booter-utils.js.map +1 -1
- package/dist/booters/component-application.booter.d.ts +25 -0
- package/dist/booters/component-application.booter.js +99 -0
- package/dist/booters/component-application.booter.js.map +1 -0
- package/dist/booters/controller.booter.js +30 -26
- package/dist/booters/controller.booter.js.map +1 -1
- package/dist/booters/datasource.booter.d.ts +1 -1
- package/dist/booters/datasource.booter.js +40 -36
- package/dist/booters/datasource.booter.js.map +1 -1
- package/dist/booters/index.d.ts +2 -0
- package/dist/booters/index.js +2 -0
- package/dist/booters/index.js.map +1 -1
- package/dist/booters/interceptor.booter.js +32 -31
- package/dist/booters/interceptor.booter.js.map +1 -1
- package/dist/booters/lifecyle-observer.booter.js +32 -28
- package/dist/booters/lifecyle-observer.booter.js.map +1 -1
- package/dist/booters/model-api.booter.js +67 -63
- package/dist/booters/model-api.booter.js.map +1 -1
- package/dist/booters/model.booter.d.ts +26 -0
- package/dist/booters/model.booter.js +74 -0
- package/dist/booters/model.booter.js.map +1 -0
- package/dist/booters/repository.booter.js +39 -35
- package/dist/booters/repository.booter.js.map +1 -1
- package/dist/booters/service.booter.d.ts +1 -1
- package/dist/booters/service.booter.js +34 -30
- package/dist/booters/service.booter.js.map +1 -1
- package/dist/bootstrapper.js +85 -81
- package/dist/bootstrapper.js.map +1 -1
- package/dist/keys.js +1 -0
- package/dist/keys.js.map +1 -1
- package/dist/mixins/boot.mixin.d.ts +84 -15
- package/dist/mixins/boot.mixin.js +40 -20
- package/dist/mixins/boot.mixin.js.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +17 -17
- package/src/boot.component.ts +2 -0
- package/src/booters/component-application.booter.ts +123 -0
- package/src/booters/datasource.booter.ts +1 -1
- package/src/booters/index.ts +2 -0
- package/src/booters/interceptor.booter.ts +1 -6
- package/src/booters/model.booter.ts +76 -0
- package/src/booters/service.booter.ts +1 -1
- package/src/mixins/boot.mixin.ts +84 -20
- package/dist/.sandbox/118896Rj4ze/repositories/multiple.repository.js +0 -38
- package/dist/.sandbox/11889CQQ0nI/controllers/multiple.controller.js +0 -38
- package/dist/.sandbox/11889DQbyT8/controllers/multiple.controller.js +0 -38
- package/dist/.sandbox/11889PRvhvm/models/no-entity.model.js +0 -24
- package/dist/.sandbox/11889S6GDvS/application.js +0 -19
- package/dist/.sandbox/11889SgiPny/multiple.artifact.js +0 -38
- package/dist/.sandbox/11889SuGYhr/application.js +0 -19
- package/dist/.sandbox/11889SuGYhr/interceptors/interceptor.interceptor.js +0 -50
- package/dist/.sandbox/11889SuGYhr/interceptors/non-global-interceptor.interceptor.js +0 -50
- package/dist/.sandbox/11889mdaOd9/models/product.model.js +0 -24
- package/dist/.sandbox/11889t5aVl4/multiple.artifact.js +0 -38
- package/dist/.sandbox/11889zAsxZb/application.js +0 -19
- package/dist/.sandbox/dist/application.js +0 -19
- package/index.d.ts +0 -6
- package/index.js +0 -6
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.RepositoryDefaults = exports.RepositoryBooter = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const context_1 = require("@loopback/context");
|
|
9
10
|
const core_1 = require("@loopback/core");
|
|
@@ -21,45 +22,48 @@ const base_artifact_booter_1 = require("./base-artifact.booter");
|
|
|
21
22
|
* @param projectRoot - Root of User Project relative to which all paths are resolved
|
|
22
23
|
* @param bootConfig - Repository Artifact Options Object
|
|
23
24
|
*/
|
|
24
|
-
let RepositoryBooter = class
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* Uses super method to get a list of Artifact classes. Boot each class by
|
|
34
|
-
* binding it to the application using `app.repository(repository);` if present.
|
|
35
|
-
*/
|
|
36
|
-
async load() {
|
|
37
|
-
await super.load();
|
|
25
|
+
let RepositoryBooter = /** @class */ (() => {
|
|
26
|
+
let RepositoryBooter = class RepositoryBooter extends base_artifact_booter_1.BaseArtifactBooter {
|
|
27
|
+
constructor(app, projectRoot, repositoryOptions = {}) {
|
|
28
|
+
super(projectRoot,
|
|
29
|
+
// Set Repository Booter Options if passed in via bootConfig
|
|
30
|
+
Object.assign({}, exports.RepositoryDefaults, repositoryOptions));
|
|
31
|
+
this.app = app;
|
|
32
|
+
this.repositoryOptions = repositoryOptions;
|
|
33
|
+
}
|
|
38
34
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* Repository Class.
|
|
35
|
+
* Uses super method to get a list of Artifact classes. Boot each class by
|
|
36
|
+
* binding it to the application using `app.repository(repository);` if present.
|
|
42
37
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
async load() {
|
|
39
|
+
await super.load();
|
|
40
|
+
/**
|
|
41
|
+
* If Repository Classes were discovered, we need to make sure RepositoryMixin
|
|
42
|
+
* was used (so we have `app.repository()`) to perform the binding of a
|
|
43
|
+
* Repository Class.
|
|
44
|
+
*/
|
|
45
|
+
if (this.classes.length > 0) {
|
|
46
|
+
if (!this.app.repository) {
|
|
47
|
+
console.warn('app.repository() function is needed for RepositoryBooter. You can add ' +
|
|
48
|
+
'it to your Application using RepositoryMixin from @loopback/repository.');
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.classes.forEach(cls => {
|
|
52
|
+
this.app.repository(cls);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
};
|
|
58
|
+
RepositoryBooter = tslib_1.__decorate([
|
|
59
|
+
types_1.booter('repositories'),
|
|
60
|
+
tslib_1.__param(0, context_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
|
|
61
|
+
tslib_1.__param(1, context_1.inject(keys_1.BootBindings.PROJECT_ROOT)),
|
|
62
|
+
tslib_1.__param(2, context_1.config()),
|
|
63
|
+
tslib_1.__metadata("design:paramtypes", [Object, String, Object])
|
|
64
|
+
], RepositoryBooter);
|
|
65
|
+
return RepositoryBooter;
|
|
66
|
+
})();
|
|
63
67
|
exports.RepositoryBooter = RepositoryBooter;
|
|
64
68
|
/**
|
|
65
69
|
* Default ArtifactOptions for RepositoryBooter.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.booter.js","sourceRoot":"","sources":["../../src/booters/repository.booter.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3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CAuC5B;IAAD,uBAAC;KAAA;AAvCY,4CAAgB;AAyC7B;;GAEG;AACU,QAAA,kBAAkB,GAAoB;IACjD,IAAI,EAAE,CAAC,cAAc,CAAC;IACtB,UAAU,EAAE,CAAC,gBAAgB,CAAC;IAC9B,MAAM,EAAE,IAAI;CACb,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { ArtifactOptions } from '../types';
|
|
|
3
3
|
import { BaseArtifactBooter } from './base-artifact.booter';
|
|
4
4
|
/**
|
|
5
5
|
* A class that extends BaseArtifactBooter to boot the 'Service' artifact type.
|
|
6
|
-
* Discovered
|
|
6
|
+
* Discovered services are bound using `app.service()`.
|
|
7
7
|
*
|
|
8
8
|
* Supported phases: configure, discover, load
|
|
9
9
|
*
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ServiceDefaults = exports.ServiceBooter = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const context_1 = require("@loopback/context");
|
|
9
10
|
const core_1 = require("@loopback/core");
|
|
@@ -14,7 +15,7 @@ const base_artifact_booter_1 = require("./base-artifact.booter");
|
|
|
14
15
|
const debug = debug_1.default('loopback:boot:service-booter');
|
|
15
16
|
/**
|
|
16
17
|
* A class that extends BaseArtifactBooter to boot the 'Service' artifact type.
|
|
17
|
-
* Discovered
|
|
18
|
+
* Discovered services are bound using `app.service()`.
|
|
18
19
|
*
|
|
19
20
|
* Supported phases: configure, discover, load
|
|
20
21
|
*
|
|
@@ -22,36 +23,39 @@ const debug = debug_1.default('loopback:boot:service-booter');
|
|
|
22
23
|
* @param projectRoot - Root of User Project relative to which all paths are resolved
|
|
23
24
|
* @param bootConfig - Service Artifact Options Object
|
|
24
25
|
*/
|
|
25
|
-
let ServiceBooter = class
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Uses super method to get a list of Artifact classes. Boot each file by
|
|
35
|
-
* creating a DataSourceConstructor and binding it to the application class.
|
|
36
|
-
*/
|
|
37
|
-
async load() {
|
|
38
|
-
await super.load();
|
|
39
|
-
for (const cls of this.classes) {
|
|
40
|
-
if (!isBindableClass(cls))
|
|
41
|
-
continue;
|
|
42
|
-
debug('Bind class: %s', cls.name);
|
|
43
|
-
const binding = this.app.service(cls);
|
|
44
|
-
debug('Binding created for class: %j', binding);
|
|
26
|
+
let ServiceBooter = /** @class */ (() => {
|
|
27
|
+
let ServiceBooter = class ServiceBooter extends base_artifact_booter_1.BaseArtifactBooter {
|
|
28
|
+
constructor(app, projectRoot, serviceConfig = {}) {
|
|
29
|
+
super(projectRoot,
|
|
30
|
+
// Set Service Booter Options if passed in via bootConfig
|
|
31
|
+
Object.assign({}, exports.ServiceDefaults, serviceConfig));
|
|
32
|
+
this.app = app;
|
|
33
|
+
this.serviceConfig = serviceConfig;
|
|
45
34
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Uses super method to get a list of Artifact classes. Boot each file by
|
|
37
|
+
* creating a DataSourceConstructor and binding it to the application class.
|
|
38
|
+
*/
|
|
39
|
+
async load() {
|
|
40
|
+
await super.load();
|
|
41
|
+
for (const cls of this.classes) {
|
|
42
|
+
if (!isBindableClass(cls))
|
|
43
|
+
continue;
|
|
44
|
+
debug('Bind class: %s', cls.name);
|
|
45
|
+
const binding = this.app.service(cls);
|
|
46
|
+
debug('Binding created for class: %j', binding);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
ServiceBooter = tslib_1.__decorate([
|
|
51
|
+
types_1.booter('services'),
|
|
52
|
+
tslib_1.__param(0, context_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
|
|
53
|
+
tslib_1.__param(1, context_1.inject(keys_1.BootBindings.PROJECT_ROOT)),
|
|
54
|
+
tslib_1.__param(2, context_1.config()),
|
|
55
|
+
tslib_1.__metadata("design:paramtypes", [Object, String, Object])
|
|
56
|
+
], ServiceBooter);
|
|
57
|
+
return ServiceBooter;
|
|
58
|
+
})();
|
|
55
59
|
exports.ServiceBooter = ServiceBooter;
|
|
56
60
|
/**
|
|
57
61
|
* Default ArtifactOptions for DataSourceBooter.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.booter.js","sourceRoot":"","sources":["../../src/booters/service.booter.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"service.booter.js","sourceRoot":"","sources":["../../src/booters/service.booter.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,+CAM2B;AAC3B,yCAA4C;AAE5C,0DAAiC;AACjC,kCAAqC;AACrC,oCAAiD;AACjD,iEAA0D;AAE1D,MAAM,KAAK,GAAG,eAAY,CAAC,8BAA8B,CAAC,CAAC;AAE3D;;;;;;;;;GASG;AAEH;IAAA,IAAa,aAAa,GAA1B,MAAa,aAAc,SAAQ,yCAAkB;QACnD,YAES,GAA4B,EACA,WAAmB,EAE/C,gBAAiC,EAAE;YAE1C,KAAK,CACH,WAAW;YACX,yDAAyD;YACzD,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,uBAAe,EAAE,aAAa,CAAC,CAClD,CAAC;YATK,QAAG,GAAH,GAAG,CAAyB;YAG5B,kBAAa,GAAb,aAAa,CAAsB;QAO5C,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,IAAI;YACR,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;YAEnB,KAAK,MAAM,GAAG,IAAI,IAAI,C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AyC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3D,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/bootstrapper.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Bootstrapper = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const context_1 = require("@loopback/context");
|
|
9
10
|
const core_1 = require("@loopback/core");
|
|
@@ -24,90 +25,93 @@ const debug = debug_1.default('loopback:boot:bootstrapper');
|
|
|
24
25
|
* @param projectRoot - The root directory of the project, relative to which all other paths are resolved
|
|
25
26
|
* @param bootOptions - The BootOptions describing the conventions to be used by various Booters
|
|
26
27
|
*/
|
|
27
|
-
let Bootstrapper = class
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Function is responsible for calling all registered Booter classes that
|
|
41
|
-
* are bound to the Application instance. Each phase of an instance must
|
|
42
|
-
* complete before the next phase is started.
|
|
43
|
-
*
|
|
44
|
-
* @param execOptions - Execution options for boot. These
|
|
45
|
-
* determine the phases and booters that are run.
|
|
46
|
-
* @param ctx - Optional Context to use to resolve bindings. This is
|
|
47
|
-
* primarily useful when running app.boot() again but with different settings
|
|
48
|
-
* (in particular phases) such as 'start' / 'stop'. Using a returned Context from
|
|
49
|
-
* a previous boot call allows DI to retrieve the same instances of Booters previously
|
|
50
|
-
* used as they are bound using a CONTEXT scope. This is important as Booter instances
|
|
51
|
-
* may maintain state.
|
|
52
|
-
*/
|
|
53
|
-
async boot(execOptions, ctx) {
|
|
54
|
-
const bootCtx = ctx !== null && ctx !== void 0 ? ctx : new context_1.Context(this.app);
|
|
55
|
-
// Bind booters passed in as a part of BootOptions
|
|
56
|
-
// We use _bindBooter so this Class can be used without the Mixin
|
|
57
|
-
if (execOptions === null || execOptions === void 0 ? void 0 : execOptions.booters) {
|
|
58
|
-
execOptions.booters.forEach(booter => mixins_1._bindBooter(this.app, booter));
|
|
28
|
+
let Bootstrapper = /** @class */ (() => {
|
|
29
|
+
let Bootstrapper = class Bootstrapper {
|
|
30
|
+
constructor(app, projectRoot, bootOptions = {}) {
|
|
31
|
+
this.app = app;
|
|
32
|
+
this.projectRoot = projectRoot;
|
|
33
|
+
this.bootOptions = bootOptions;
|
|
34
|
+
// Resolve path to projectRoot and re-bind
|
|
35
|
+
this.projectRoot = path_1.resolve(this.projectRoot);
|
|
36
|
+
app.bind(keys_1.BootBindings.PROJECT_ROOT).to(this.projectRoot);
|
|
37
|
+
// This is re-bound for testing reasons where this value may be passed directly
|
|
38
|
+
// and needs to be propagated to the Booters via DI
|
|
39
|
+
app.bind(keys_1.BootBindings.BOOT_OPTIONS).to(this.bootOptions);
|
|
59
40
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Function is responsible for calling all registered Booter classes that
|
|
43
|
+
* are bound to the Application instance. Each phase of an instance must
|
|
44
|
+
* complete before the next phase is started.
|
|
45
|
+
*
|
|
46
|
+
* @param execOptions - Execution options for boot. These
|
|
47
|
+
* determine the phases and booters that are run.
|
|
48
|
+
* @param ctx - Optional Context to use to resolve bindings. This is
|
|
49
|
+
* primarily useful when running app.boot() again but with different settings
|
|
50
|
+
* (in particular phases) such as 'start' / 'stop'. Using a returned Context from
|
|
51
|
+
* a previous boot call allows DI to retrieve the same instances of Booters previously
|
|
52
|
+
* used as they are bound using a CONTEXT scope. This is important as Booter instances
|
|
53
|
+
* may maintain state.
|
|
54
|
+
*/
|
|
55
|
+
async boot(execOptions, ctx) {
|
|
56
|
+
const bootCtx = ctx !== null && ctx !== void 0 ? ctx : new context_1.Context(this.app);
|
|
57
|
+
// Bind booters passed in as a part of BootOptions
|
|
58
|
+
// We use _bindBooter so this Class can be used without the Mixin
|
|
59
|
+
if (execOptions === null || execOptions === void 0 ? void 0 : execOptions.booters) {
|
|
60
|
+
execOptions.booters.forEach(booter => mixins_1._bindBooter(this.app, booter));
|
|
61
|
+
}
|
|
62
|
+
// Determine the phases to be run. If a user set a phases filter, those
|
|
63
|
+
// are selected otherwise we run the default phases (BOOTER_PHASES).
|
|
64
|
+
const phases = execOptions
|
|
65
|
+
? execOptions.filter && execOptions.filter.phases
|
|
66
|
+
? execOptions.filter.phases
|
|
67
|
+
: types_1.BOOTER_PHASES
|
|
68
|
+
: types_1.BOOTER_PHASES;
|
|
69
|
+
// Find booters registered to the BOOTERS_TAG by getting the bindings
|
|
70
|
+
const bindings = bootCtx.findByTag(keys_1.BootTags.BOOTER);
|
|
71
|
+
// Prefix length. +1 because of `.` => 'booters.'
|
|
72
|
+
const prefixLength = keys_1.BootBindings.BOOTER_PREFIX.length + 1;
|
|
73
|
+
// Names of all registered booters.
|
|
74
|
+
const defaultBooterNames = bindings.map(binding => binding.key.slice(prefixLength));
|
|
75
|
+
// Determining the booters to be run. If a user set a booters filter (class
|
|
76
|
+
// names of booters that should be run), that is the value, otherwise it
|
|
77
|
+
// is all the registered booters by default.
|
|
78
|
+
const names = execOptions
|
|
79
|
+
? execOptions.filter && execOptions.filter.booters
|
|
80
|
+
? execOptions.filter.booters
|
|
81
|
+
: defaultBooterNames
|
|
82
|
+
: defaultBooterNames;
|
|
83
|
+
// Filter bindings by names
|
|
84
|
+
const filteredBindings = bindings.filter(binding => names.includes(binding.key.slice(prefixLength)));
|
|
85
|
+
// Resolve Booter Instances
|
|
86
|
+
const booterInsts = await context_1.resolveList(filteredBindings, binding =>
|
|
87
|
+
// We cannot use Booter interface here because "filter.booters"
|
|
88
|
+
// allows arbitrary string values, not only the phases defined
|
|
89
|
+
// by Booter interface
|
|
90
|
+
bootCtx.get(binding.key));
|
|
91
|
+
// Run phases of booters
|
|
92
|
+
for (const phase of phases) {
|
|
93
|
+
for (const inst of booterInsts) {
|
|
94
|
+
const instName = inst.constructor.name;
|
|
95
|
+
if (inst[phase]) {
|
|
96
|
+
debug(`${instName} phase: ${phase} starting.`);
|
|
97
|
+
await inst[phase]();
|
|
98
|
+
debug(`${instName} phase: ${phase} complete.`);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
debug(`${instName} phase: ${phase} not implemented.`);
|
|
102
|
+
}
|
|
100
103
|
}
|
|
101
104
|
}
|
|
105
|
+
return bootCtx;
|
|
102
106
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
};
|
|
108
|
+
Bootstrapper = tslib_1.__decorate([
|
|
109
|
+
tslib_1.__param(0, context_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
|
|
110
|
+
tslib_1.__param(1, context_1.inject(keys_1.BootBindings.PROJECT_ROOT)),
|
|
111
|
+
tslib_1.__param(2, context_1.inject(keys_1.BootBindings.BOOT_OPTIONS, { optional: true })),
|
|
112
|
+
tslib_1.__metadata("design:paramtypes", [Object, String, Object])
|
|
113
|
+
], Bootstrapper);
|
|
114
|
+
return Bootstrapper;
|
|
115
|
+
})();
|
|
112
116
|
exports.Bootstrapper = Bootstrapper;
|
|
113
117
|
//# sourceMappingURL=bootstrapper.js.map
|
package/dist/bootstrapper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrapper.js","sourceRoot":"","sources":["../src/bootstrapper.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"bootstrapper.js","sourceRoot":"","sources":["../src/bootstrapper.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,+CAA+D;AAC/D,yCAAyD;AACzD,0DAAgC;AAChC,+BAA6B;AAC7B,iCAA8C;AAC9C,qCAAqC;AACrC,mCAKiB;AAEjB,MAAM,KAAK,GAAG,eAAW,CAAC,4BAA4B,CAAC,CAAC;AAExD;;;;;;;;;;GAUG;AACH;IAAA,IAAa,YAAY,GAAzB,MAAa,YAAY;QACvB,YAEU,GAA2B,EACQ,WAAmB,EAEtD,cAA2B,EAAE;YAH7B,QAAG,GAAH,GAAG,CAAwB;YACQ,gBAAW,GAAX,WAAW,CAAQ;YAEtD,gBAAW,GAAX,WAAW,CAAkB;YAErC,0CAA0C;YAC1C,IAAI,CAAC,WAAW,GAAG,cAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC7C,GAAG,CAAC,IAAI,CAAC,mBAAY,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAEzD,+EAA+E;YAC/E,mDAAmD;YACnD,GAAG,CAAC,IAAI,CAAC,mBAAY,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3D,CAAC;QAED;;;;;;;;;;;;;WAaG;QACH,KAAK,CAAC,IAAI,CACR,WAAkC,E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5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.BootTags = exports.BootBindings = void 0;
|
|
7
8
|
const context_1 = require("@loopback/context");
|
|
8
9
|
/**
|
|
9
10
|
* Namespace for boot related binding keys
|
package/dist/keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;;AAEhE,+CAA6C;AAI7C;;GAEG;AACH,IAAiB,YAAY,CAkB5B;AAlBD,WAAiB,YAAY;IAC3B;;OAEG;IACU,yBAAY,GAAG,oBAAU,CAAC,MAAM,CAAc,cAAc,CAAC,CAAC;IAC3E;;OAEG;IACU,yBAAY,GAAG,oBAAU,CAAC,MAAM,CAAS,mBAAmB,CAAC,CAAC;IAE3E;;OAEG;IACU,6BAAgB,GAAG,oBAAU,CAAC,MAAM,CAC/C,0BAA0B,CAC3B,CAAC;IAEW,0BAAa,GAAG,SAAS,CAAC;AACzC,CAAC,EAlBgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAkB5B;AAED;;GAEG;AACH,IAAiB,QAAQ,CAMxB;AAND,WAAiB,QAAQ;IACV,eAAM,GAAG,QAAQ,CAAC;IAC/B;;OAEG;IACU,mBAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;AAC5C,CAAC,EANgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAMxB"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { Binding, Constructor, Context } from '@loopback/context';
|
|
2
|
-
import {
|
|
1
|
+
import { Binding, BindingFilter, BindingFromClassOptions, Constructor, Context } from '@loopback/context';
|
|
2
|
+
import { Application, Component, MixinTarget } from '@loopback/core';
|
|
3
|
+
import { Bootable, Booter, BootOptions } from '../types';
|
|
4
|
+
import { BindingAddress, JSONObject, Provider, ContextSubscriptionManager, ContextEvent, Interceptor, InterceptorBindingOptions, ResolutionOptions, BindingKey, ValueOrPromise, ContextEventObserver, ContextObserver, Subscription, BindingComparator, ContextView, ResolutionSession, BindingCreationPolicy, ContextInspectOptions } from '@loopback/context';
|
|
5
|
+
import { Server, ApplicationConfig, ApplicationMetadata, LifeCycleObserver, ServiceOptions } from '@loopback/core';
|
|
3
6
|
export { Binding };
|
|
4
7
|
/**
|
|
5
8
|
* Mixin for @loopback/boot. This Mixin provides the following:
|
|
@@ -12,19 +15,9 @@ export { Binding };
|
|
|
12
15
|
* - Provides the `booter()` convenience method to bind a Booter(s) to the Application
|
|
13
16
|
* - Override `component()` to call `mountComponentBooters`
|
|
14
17
|
* - Adds `mountComponentBooters` which binds Booters to the application from `component.booters[]`
|
|
15
|
-
*
|
|
16
|
-
* ******************** NOTE ********************
|
|
17
|
-
* Trying to constrain the type of this Mixin (or any Mixin) will cause errors.
|
|
18
|
-
* For example, constraining this Mixin to type Application require all types using by
|
|
19
|
-
* Application to be imported (including it's dependencies such as ResolutionSession).
|
|
20
|
-
* Another issue was that if a Mixin that is type constrained is used with another Mixin
|
|
21
|
-
* that is not, it will result in an error.
|
|
22
|
-
* Example (class MyApp extends BootMixin(RepositoryMixin(Application))) {};
|
|
23
|
-
********************* END OF NOTE ********************
|
|
24
18
|
*/
|
|
25
|
-
export declare function BootMixin<T extends
|
|
19
|
+
export declare function BootMixin<T extends MixinTarget<Application>>(superClass: T): {
|
|
26
20
|
new (...args: any[]): {
|
|
27
|
-
[x: string]: any;
|
|
28
21
|
projectRoot: string;
|
|
29
22
|
bootOptions?: BootOptions | undefined;
|
|
30
23
|
/**
|
|
@@ -42,7 +35,16 @@ export declare function BootMixin<T extends Constructor<any>>(superClass: T): {
|
|
|
42
35
|
* app.booters(MyBooter, MyOtherBooter)
|
|
43
36
|
* ```
|
|
44
37
|
*/
|
|
45
|
-
booters(...booterCls: Constructor<Booter>[]): Binding
|
|
38
|
+
booters(...booterCls: Constructor<Booter>[]): Binding[];
|
|
39
|
+
/**
|
|
40
|
+
* Register a booter to boot a sub-application. See
|
|
41
|
+
* {@link createComponentApplicationBooterBinding} for more details.
|
|
42
|
+
*
|
|
43
|
+
* @param subApp - A sub-application with artifacts to be booted
|
|
44
|
+
* @param filter - A binding filter to select what bindings from the sub
|
|
45
|
+
* application should be added to the main application.
|
|
46
|
+
*/
|
|
47
|
+
applicationBooter(subApp: Application & Bootable, filter?: BindingFilter | undefined): Binding<Booter>;
|
|
46
48
|
/**
|
|
47
49
|
* Override to ensure any Booter's on a Component are also mounted.
|
|
48
50
|
*
|
|
@@ -62,7 +64,7 @@ export declare function BootMixin<T extends Constructor<any>>(superClass: T): {
|
|
|
62
64
|
* app.component(ProductComponent);
|
|
63
65
|
* ```
|
|
64
66
|
*/
|
|
65
|
-
component(
|
|
67
|
+
component<C extends Component = Component>(componentCtor: Constructor<C>, nameOrOptions?: string | BindingFromClassOptions | undefined): Binding<C>;
|
|
66
68
|
/**
|
|
67
69
|
* Get an instance of a component and mount all it's
|
|
68
70
|
* booters. This function is intended to be used internally
|
|
@@ -71,6 +73,73 @@ export declare function BootMixin<T extends Constructor<any>>(superClass: T): {
|
|
|
71
73
|
* @param component - The component to mount booters of
|
|
72
74
|
*/
|
|
73
75
|
mountComponentBooters(component: Constructor<{}>): void;
|
|
76
|
+
readonly options: ApplicationConfig;
|
|
77
|
+
readonly state: string;
|
|
78
|
+
controller: <T_1>(controllerCtor: Constructor<T_1>, nameOrOptions?: string | BindingFromClassOptions | undefined) => Binding<T_1>;
|
|
79
|
+
server: <T_2 extends Server>(ctor: Constructor<T_2>, nameOrOptions?: string | BindingFromClassOptions | undefined) => Binding<T_2>;
|
|
80
|
+
servers: <T_3 extends Server>(ctors: Constructor<T_3>[]) => Binding<any>[];
|
|
81
|
+
getServer: <T_4 extends Server>(target: string | Constructor<T_4>) => Promise<T_4>;
|
|
82
|
+
start: () => Promise<void>;
|
|
83
|
+
stop: () => Promise<void>;
|
|
84
|
+
setMetadata: (metadata: ApplicationMetadata) => void;
|
|
85
|
+
lifeCycleObserver: <T_5 extends LifeCycleObserver>(ctor: Constructor<T_5>, nameOrOptions?: string | BindingFromClassOptions | undefined) => Binding<T_5>;
|
|
86
|
+
service: <S>(cls: Constructor<S | Provider<S>>, nameOrOptions?: string | ServiceOptions | undefined) => Binding<S>;
|
|
87
|
+
interceptor: (interceptor: Interceptor | Constructor<Provider<Interceptor>>, nameOrOptions?: string | InterceptorBindingOptions | undefined) => Binding<Interceptor>;
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly subscriptionManager: ContextSubscriptionManager;
|
|
90
|
+
readonly parent: Context | undefined;
|
|
91
|
+
emitEvent: <T_6 extends ContextEvent>(type: string, event: T_6) => void;
|
|
92
|
+
emitError: (err: unknown) => void;
|
|
93
|
+
bind: <ValueType = any>(key: BindingAddress<ValueType>) => Binding<ValueType>;
|
|
94
|
+
add: (binding: Binding<unknown>) => Application;
|
|
95
|
+
configure: <ConfigValueType = any>(key?: string | BindingKey<unknown> | undefined) => Binding<ConfigValueType>;
|
|
96
|
+
getConfigAsValueOrPromise: <ConfigValueType_1>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: ResolutionOptions | undefined) => ValueOrPromise<ConfigValueType_1 | undefined>;
|
|
97
|
+
getConfig: <ConfigValueType_2>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: ResolutionOptions | undefined) => Promise<ConfigValueType_2 | undefined>;
|
|
98
|
+
getConfigSync: <ConfigValueType_3>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: ResolutionOptions | undefined) => ConfigValueType_3 | undefined;
|
|
99
|
+
unbind: (key: BindingAddress<unknown>) => boolean;
|
|
100
|
+
subscribe: (observer: ContextEventObserver) => Subscription;
|
|
101
|
+
unsubscribe: (observer: ContextEventObserver) => boolean;
|
|
102
|
+
close: () => void;
|
|
103
|
+
isSubscribed: (observer: ContextObserver) => boolean;
|
|
104
|
+
createView: <T_7 = unknown>(filter: BindingFilter, comparator?: BindingComparator | undefined) => ContextView<T_7>;
|
|
105
|
+
contains: (key: BindingAddress<unknown>) => boolean;
|
|
106
|
+
isBound: (key: BindingAddress<unknown>) => boolean;
|
|
107
|
+
getOwnerContext: (key: BindingAddress<unknown>) => Context | undefined;
|
|
108
|
+
find: <ValueType_1 = any>(pattern?: string | RegExp | BindingFilter | undefined) => Readonly<Binding<ValueType_1>>[];
|
|
109
|
+
findByTag: <ValueType_2 = any>(tagFilter: string | RegExp | Record<string, any>) => Readonly<Binding<ValueType_2>>[];
|
|
110
|
+
get: {
|
|
111
|
+
<ValueType_3>(keyWithPath: BindingAddress<ValueType_3>, session?: ResolutionSession | undefined): Promise<ValueType_3>;
|
|
112
|
+
<ValueType_4>(keyWithPath: BindingAddress<ValueType_4>, options: ResolutionOptions): Promise<ValueType_4 | undefined>;
|
|
113
|
+
};
|
|
114
|
+
getSync: {
|
|
115
|
+
<ValueType_5>(keyWithPath: BindingAddress<ValueType_5>, session?: ResolutionSession | undefined): ValueType_5;
|
|
116
|
+
<ValueType_6>(keyWithPath: BindingAddress<ValueType_6>, options?: ResolutionOptions | undefined): ValueType_6 | undefined;
|
|
117
|
+
};
|
|
118
|
+
getBinding: {
|
|
119
|
+
<ValueType_7 = any>(key: BindingAddress<ValueType_7>): Binding<ValueType_7>;
|
|
120
|
+
<ValueType_8>(key: BindingAddress<ValueType_8>, options?: {
|
|
121
|
+
optional?: boolean | undefined;
|
|
122
|
+
} | undefined): Binding<ValueType_8> | undefined;
|
|
123
|
+
};
|
|
124
|
+
findOrCreateBinding: <T_8>(key: BindingAddress<T_8>, policy?: BindingCreationPolicy | undefined) => Binding<T_8>;
|
|
125
|
+
getValueOrPromise: <ValueType_9>(keyWithPath: BindingAddress<ValueType_9>, optionsOrSession?: ResolutionSession | ResolutionOptions | undefined) => ValueOrPromise<ValueType_9 | undefined>;
|
|
126
|
+
toJSON: () => JSONObject;
|
|
127
|
+
inspect: (options?: ContextInspectOptions | undefined) => JSONObject;
|
|
128
|
+
addListener: (event: string | symbol, listener: (...args: any[]) => void) => Application;
|
|
129
|
+
on: (event: string | symbol, listener: (...args: any[]) => void) => Application;
|
|
130
|
+
once: (event: string | symbol, listener: (...args: any[]) => void) => Application;
|
|
131
|
+
prependListener: (event: string | symbol, listener: (...args: any[]) => void) => Application;
|
|
132
|
+
prependOnceListener: (event: string | symbol, listener: (...args: any[]) => void) => Application;
|
|
133
|
+
removeListener: (event: string | symbol, listener: (...args: any[]) => void) => Application;
|
|
134
|
+
off: (event: string | symbol, listener: (...args: any[]) => void) => Application;
|
|
135
|
+
removeAllListeners: (event?: string | symbol | undefined) => Application;
|
|
136
|
+
setMaxListeners: (n: number) => Application;
|
|
137
|
+
getMaxListeners: () => number;
|
|
138
|
+
listeners: (event: string | symbol) => Function[];
|
|
139
|
+
rawListeners: (event: string | symbol) => Function[];
|
|
140
|
+
emit: (event: string | symbol, ...args: any[]) => boolean;
|
|
141
|
+
eventNames: () => (string | symbol)[];
|
|
142
|
+
listenerCount: (type: string | symbol) => number;
|
|
74
143
|
};
|
|
75
144
|
} & T;
|
|
76
145
|
/**
|