@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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2019. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/boot
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MyGlobalInterceptor = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const context_1 = require("@loopback/context");
|
|
10
|
+
/**
|
|
11
|
+
* This class will be bound to the application as a global `Interceptor` during
|
|
12
|
+
* `boot`
|
|
13
|
+
*/
|
|
14
|
+
let MyGlobalInterceptor = /** @class */ (() => {
|
|
15
|
+
let MyGlobalInterceptor = class MyGlobalInterceptor {
|
|
16
|
+
/*
|
|
17
|
+
constructor() {}
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* This method is used by LoopBack context to produce an interceptor function
|
|
21
|
+
* for the binding.
|
|
22
|
+
*
|
|
23
|
+
* @returns An interceptor function
|
|
24
|
+
*/
|
|
25
|
+
value() {
|
|
26
|
+
return this.intercept.bind(this);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The logic to intercept an invocation
|
|
30
|
+
* @param invocationCtx - Invocation context
|
|
31
|
+
* @param next - A function to invoke next interceptor or the target method
|
|
32
|
+
*/
|
|
33
|
+
async intercept(invocationCtx, next) {
|
|
34
|
+
// eslint-disable-next-line no-useless-catch
|
|
35
|
+
try {
|
|
36
|
+
// Add pre-invocation logic here
|
|
37
|
+
const result = await next();
|
|
38
|
+
// Add post-invocation logic here
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
// Add error handling logic here
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
MyGlobalInterceptor = tslib_1.__decorate([
|
|
48
|
+
context_1.globalInterceptor('auth', { tags: { name: 'myGlobalInterceptor' } })
|
|
49
|
+
], MyGlobalInterceptor);
|
|
50
|
+
return MyGlobalInterceptor;
|
|
51
|
+
})();
|
|
52
|
+
exports.MyGlobalInterceptor = MyGlobalInterceptor;
|
|
53
|
+
//# sourceMappingURL=interceptor.artifact.js.map
|
|
54
|
+
//# sourceMappingURL=/Users/rfeng/Projects/loopback4/loopback-next/packages/boot/dist/__tests__/fixtures/interceptor.artifact.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2019. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/boot
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MyInterceptor = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const context_1 = require("@loopback/context");
|
|
10
|
+
/**
|
|
11
|
+
* This class will be bound to the application as a global `Interceptor` during
|
|
12
|
+
* `boot`
|
|
13
|
+
*/
|
|
14
|
+
let MyInterceptor = /** @class */ (() => {
|
|
15
|
+
let MyInterceptor = class MyInterceptor {
|
|
16
|
+
/*
|
|
17
|
+
constructor() {}
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* This method is used by LoopBack context to produce an interceptor function
|
|
21
|
+
* for the binding.
|
|
22
|
+
*
|
|
23
|
+
* @returns An interceptor function
|
|
24
|
+
*/
|
|
25
|
+
value() {
|
|
26
|
+
return this.intercept.bind(this);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The logic to intercept an invocation
|
|
30
|
+
* @param invocationCtx - Invocation context
|
|
31
|
+
* @param next - A function to invoke next interceptor or the target method
|
|
32
|
+
*/
|
|
33
|
+
async intercept(invocationCtx, next) {
|
|
34
|
+
// eslint-disable-next-line no-useless-catch
|
|
35
|
+
try {
|
|
36
|
+
// Add pre-invocation logic here
|
|
37
|
+
const result = await next();
|
|
38
|
+
// Add post-invocation logic here
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
// Add error handling logic here
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
MyInterceptor = tslib_1.__decorate([
|
|
48
|
+
context_1.bind({ tags: { namespace: 'interceptors', name: 'myInterceptor' } })
|
|
49
|
+
], MyInterceptor);
|
|
50
|
+
return MyInterceptor;
|
|
51
|
+
})();
|
|
52
|
+
exports.MyInterceptor = MyInterceptor;
|
|
53
|
+
//# sourceMappingURL=non-global-interceptor.artifact.js.map
|
|
54
|
+
//# sourceMappingURL=/Users/rfeng/Projects/loopback4/loopback-next/packages/boot/dist/__tests__/fixtures/non-global-interceptor.artifact.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2019. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/boot
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.hello = exports.ArtifactTwo = exports.ArtifactOne = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const rest_1 = require("@loopback/rest");
|
|
10
|
+
let ArtifactOne = /** @class */ (() => {
|
|
11
|
+
class ArtifactOne {
|
|
12
|
+
one() {
|
|
13
|
+
return 'ControllerOne.one()';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
tslib_1.__decorate([
|
|
17
|
+
rest_1.get('/one'),
|
|
18
|
+
tslib_1.__metadata("design:type", Function),
|
|
19
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
20
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
21
|
+
], ArtifactOne.prototype, "one", null);
|
|
22
|
+
return ArtifactOne;
|
|
23
|
+
})();
|
|
24
|
+
exports.ArtifactOne = ArtifactOne;
|
|
25
|
+
let ArtifactTwo = /** @class */ (() => {
|
|
26
|
+
class ArtifactTwo {
|
|
27
|
+
two() {
|
|
28
|
+
return 'ControllerTwo.two()';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
rest_1.get('/two'),
|
|
33
|
+
tslib_1.__metadata("design:type", Function),
|
|
34
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
35
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
36
|
+
], ArtifactTwo.prototype, "two", null);
|
|
37
|
+
return ArtifactTwo;
|
|
38
|
+
})();
|
|
39
|
+
exports.ArtifactTwo = ArtifactTwo;
|
|
40
|
+
function hello() {
|
|
41
|
+
return 'hello world';
|
|
42
|
+
}
|
|
43
|
+
exports.hello = hello;
|
|
44
|
+
//# sourceMappingURL=multiple.artifact.js.map
|
|
45
|
+
//# sourceMappingURL=/Users/rfeng/Projects/loopback4/loopback-next/packages/boot/dist/__tests__/fixtures/multiple.artifact.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2019. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/boot
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.BooterApp = void 0;
|
|
8
|
+
const repository_1 = require("@loopback/repository");
|
|
9
|
+
const rest_1 = require("@loopback/rest");
|
|
10
|
+
const service_proxy_1 = require("@loopback/service-proxy");
|
|
11
|
+
const __1 = require("../..");
|
|
12
|
+
class BooterApp extends __1.BootMixin(service_proxy_1.ServiceMixin(repository_1.RepositoryMixin(rest_1.RestApplication))) {
|
|
13
|
+
constructor(options) {
|
|
14
|
+
super(options);
|
|
15
|
+
this.projectRoot = __dirname;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.BooterApp = BooterApp;
|
|
19
|
+
//# sourceMappingURL=application.js.map
|
|
20
|
+
//# sourceMappingURL=/Users/rfeng/Projects/loopback4/loopback-next/packages/boot/dist/__tests__/fixtures/application.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2019. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/boot
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.hello = exports.ArtifactTwo = exports.ArtifactOne = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const rest_1 = require("@loopback/rest");
|
|
10
|
+
let ArtifactOne = /** @class */ (() => {
|
|
11
|
+
class ArtifactOne {
|
|
12
|
+
one() {
|
|
13
|
+
return 'ControllerOne.one()';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
tslib_1.__decorate([
|
|
17
|
+
rest_1.get('/one'),
|
|
18
|
+
tslib_1.__metadata("design:type", Function),
|
|
19
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
20
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
21
|
+
], ArtifactOne.prototype, "one", null);
|
|
22
|
+
return ArtifactOne;
|
|
23
|
+
})();
|
|
24
|
+
exports.ArtifactOne = ArtifactOne;
|
|
25
|
+
let ArtifactTwo = /** @class */ (() => {
|
|
26
|
+
class ArtifactTwo {
|
|
27
|
+
two() {
|
|
28
|
+
return 'ControllerTwo.two()';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
rest_1.get('/two'),
|
|
33
|
+
tslib_1.__metadata("design:type", Function),
|
|
34
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
35
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
36
|
+
], ArtifactTwo.prototype, "two", null);
|
|
37
|
+
return ArtifactTwo;
|
|
38
|
+
})();
|
|
39
|
+
exports.ArtifactTwo = ArtifactTwo;
|
|
40
|
+
function hello() {
|
|
41
|
+
return 'hello world';
|
|
42
|
+
}
|
|
43
|
+
exports.hello = hello;
|
|
44
|
+
//# sourceMappingURL=multiple.artifact.js.map
|
|
45
|
+
//# sourceMappingURL=/Users/rfeng/Projects/loopback4/loopback-next/packages/boot/dist/__tests__/fixtures/multiple.artifact.js.map
|
package/dist/boot.component.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Application, Component } from '@loopback/core';
|
|
2
|
-
import { ApplicationMetadataBooter, ControllerBooter, DataSourceBooter, InterceptorProviderBooter, LifeCycleObserverBooter, ModelApiBooter, RepositoryBooter, ServiceBooter } from './booters';
|
|
2
|
+
import { ApplicationMetadataBooter, ControllerBooter, DataSourceBooter, InterceptorProviderBooter, LifeCycleObserverBooter, ModelApiBooter, ModelBooter, RepositoryBooter, ServiceBooter } from './booters';
|
|
3
3
|
/**
|
|
4
4
|
* BootComponent is used to export the default list of Booter's made
|
|
5
5
|
* available by this module as well as bind the BootStrapper to the app so it
|
|
6
6
|
* can be used to run the Booters.
|
|
7
7
|
*/
|
|
8
8
|
export declare class BootComponent implements Component {
|
|
9
|
-
booters: (typeof ApplicationMetadataBooter | typeof ControllerBooter | typeof DataSourceBooter | typeof InterceptorProviderBooter | typeof LifeCycleObserverBooter | typeof ModelApiBooter | typeof RepositoryBooter | typeof ServiceBooter)[];
|
|
9
|
+
booters: (typeof ApplicationMetadataBooter | typeof ControllerBooter | typeof DataSourceBooter | typeof InterceptorProviderBooter | typeof LifeCycleObserverBooter | typeof ModelApiBooter | typeof ModelBooter | typeof RepositoryBooter | typeof ServiceBooter)[];
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
12
12
|
* @param app - Application instance
|
package/dist/boot.component.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.BootComponent = 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");
|
|
@@ -15,34 +16,38 @@ const keys_1 = require("./keys");
|
|
|
15
16
|
* available by this module as well as bind the BootStrapper to the app so it
|
|
16
17
|
* can be used to run the Booters.
|
|
17
18
|
*/
|
|
18
|
-
let BootComponent = class
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
tslib_1.
|
|
46
|
-
|
|
19
|
+
let BootComponent = /** @class */ (() => {
|
|
20
|
+
let BootComponent = class BootComponent {
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param app - Application instance
|
|
24
|
+
*/
|
|
25
|
+
constructor(app) {
|
|
26
|
+
// Export a list of default booters in the component so they get bound
|
|
27
|
+
// automatically when this component is mounted.
|
|
28
|
+
this.booters = [
|
|
29
|
+
booters_1.ApplicationMetadataBooter,
|
|
30
|
+
booters_1.ControllerBooter,
|
|
31
|
+
booters_1.RepositoryBooter,
|
|
32
|
+
booters_1.ServiceBooter,
|
|
33
|
+
booters_1.DataSourceBooter,
|
|
34
|
+
booters_1.LifeCycleObserverBooter,
|
|
35
|
+
booters_1.InterceptorProviderBooter,
|
|
36
|
+
booters_1.ModelApiBooter,
|
|
37
|
+
booters_1.ModelBooter,
|
|
38
|
+
];
|
|
39
|
+
// Bound as a SINGLETON so it can be cached as it has no state
|
|
40
|
+
app
|
|
41
|
+
.bind(keys_1.BootBindings.BOOTSTRAPPER_KEY)
|
|
42
|
+
.toClass(bootstrapper_1.Bootstrapper)
|
|
43
|
+
.inScope(context_1.BindingScope.SINGLETON);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
BootComponent = tslib_1.__decorate([
|
|
47
|
+
tslib_1.__param(0, context_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
|
|
48
|
+
tslib_1.__metadata("design:paramtypes", [core_1.Application])
|
|
49
|
+
], BootComponent);
|
|
50
|
+
return BootComponent;
|
|
51
|
+
})();
|
|
47
52
|
exports.BootComponent = BootComponent;
|
|
48
53
|
//# sourceMappingURL=boot.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.component.js","sourceRoot":"","sources":["../src/boot.component.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"boot.component.js","sourceRoot":"","sources":["../src/boot.component.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,+CAAuD;AACvD,yCAAoE;AACpE,uCAUmB;AACnB,iDAA4C;AAC5C,iCAAoC;AAEpC;;;;GAIG;AACH;IAAA,IAAa,aAAa,GAA1B,MAAa,aAAa;QAexB;;;WAGG;QACH,YAAuD,GAAgB;YAlBvE,sEAAsE;YACtE,gDAAgD;YAChD,YAAO,GAAG;gBACR,mCAAyB;gBACzB,0BAAgB;gBAChB,0BAAgB;gBAChB,uBAAa;gBACb,0BAAgB;gBAChB,iCAAuB;gBACvB,mCAAyB;gBACzB,wBAAc;gBACd,qBAAW;aACZ,CAAC;YAOA,8DAA8D;YAC9D,GAAG;iBACA,IAAI,CAAC,mBAAY,CAAC,gBAAgB,CAAC;iBACnC,OAAO,CAAC,2BAAY,CAAC;iBACrB,OAAO,CAAC,sBAAY,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC;KACF,CAAA;IA1BY,aAAa;QAmBX,mBAAA,gBAAM,CAAC,mBAAY,CAAC,oBAAoB,CAAC,CAAA;iDAAM,kBAAW;OAnB5D,aAAa,CA0BzB;IAAD,oBAAC;KAAA;AA1BY,sCAAa"}
|
|
@@ -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.ApplicationMetadataBooter = 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");
|
|
@@ -18,26 +19,29 @@ const debug = debug_1.default('loopback:boot:booter:application-metadata');
|
|
|
18
19
|
* @param app - Application instance
|
|
19
20
|
* @param projectRoot - Root of User Project
|
|
20
21
|
*/
|
|
21
|
-
let ApplicationMetadataBooter = class
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
async configure() {
|
|
27
|
-
try {
|
|
28
|
-
// `this.projectRoot` points to `<project>/dist`
|
|
29
|
-
const pkg = require(path.resolve(this.projectRoot, '../package.json'));
|
|
30
|
-
this.app.setMetadata(pkg);
|
|
22
|
+
let ApplicationMetadataBooter = /** @class */ (() => {
|
|
23
|
+
let ApplicationMetadataBooter = class ApplicationMetadataBooter {
|
|
24
|
+
constructor(app, projectRoot) {
|
|
25
|
+
this.app = app;
|
|
26
|
+
this.projectRoot = projectRoot;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
async configure() {
|
|
29
|
+
try {
|
|
30
|
+
// `this.projectRoot` points to `<project>/dist`
|
|
31
|
+
const pkg = require(path.resolve(this.projectRoot, '../package.json'));
|
|
32
|
+
this.app.setMetadata(pkg);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
debug('package.json not found', err);
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
};
|
|
39
|
+
ApplicationMetadataBooter = tslib_1.__decorate([
|
|
40
|
+
tslib_1.__param(0, context_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
|
|
41
|
+
tslib_1.__param(1, context_1.inject(keys_1.BootBindings.PROJECT_ROOT)),
|
|
42
|
+
tslib_1.__metadata("design:paramtypes", [core_1.Application, String])
|
|
43
|
+
], ApplicationMetadataBooter);
|
|
44
|
+
return ApplicationMetadataBooter;
|
|
45
|
+
})();
|
|
42
46
|
exports.ApplicationMetadataBooter = ApplicationMetadataBooter;
|
|
43
47
|
//# sourceMappingURL=application-metadata.booter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-metadata.booter.js","sourceRoot":"","sources":["../../src/booters/application-metadata.booter.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"application-metadata.booter.js","sourceRoot":"","sources":["../../src/booters/application-metadata.booter.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,+CAAyC;AACzC,yCAAyD;AACzD,0DAAgC;AAChC,kCAAqC;AAErC,6BAA8B;AAE9B,MAAM,KAAK,GAAG,eAAW,CAAC,2CAA2C,CAAC,CAAC;AAEvE;;;;;;GAMG;AACH;IAAA,IAAa,yBAAyB,GAAtC,MAAa,yBAAyB;QACpC,YACoD,GAAgB,EACvB,WAAmB;YADZ,QAAG,GAAH,GAAG,CAAa;YACvB,gBAAW,GAAX,WAAW,CAAQ;QAC7D,CAAC;QAEJ,KAAK,CAAC,SAAS;YACb,IAAI;gBACF,gDAAgD;gBAChD,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;gBACvE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;aAC3B;YAAC,OAAO,GAAG,EAAE;gBACZ,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;aACtC;QACH,CAAC;KACF,CAAA;IAfY,yBAAyB;QAEjC,mBAAA,gBAAM,CAAC,mBAAY,CAAC,oBAAoB,CAAC,CAAA;QACzC,mBAAA,gBAAM,CAAC,mBAAY,CAAC,YAAY,CAAC,CAAA;iDADqB,kBAAW;OAFzD,yBAAyB,CAerC;IAAD,gCAAC;KAAA;AAfY,8DAAyB"}
|
|
@@ -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.BaseArtifactBooter = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
9
10
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-artifact.booter.js","sourceRoot":"","sources":["../../src/booters/base-artifact.booter.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"base-artifact.booter.js","sourceRoot":"","sources":["../../src/booters/base-artifact.booter.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;;;AAGhE,0DAAiC;AACjC,wDAAwB;AAExB,iDAAmE;AAEnE,MAAM,KAAK,GAAG,eAAY,CAAC,oCAAoC,CAAC,CAAC;AAEjE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,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CAAC,CAAC,GACjC,KAAK,UAAU,GAAG,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,KAAK,CACH,8CAA8C,EAC9C,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,IAAI,CACV,CAAC;QAEF,IAAI,CAAC,UAAU,GAAG,MAAM,4BAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAEnE,IAAI,KAAK,CAAC,OAAO,EAAE;YACjB,KAAK,CACH,0BAA0B,EAC1B,IAAI,CAAC,SAAS,CACZ,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,cAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAC5D,IAAI,EACJ,CAAC,CACF,CACF,CAAC;SACH;IACH,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,OAAO,GAAG,mCAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACzE,CAAC;CACF;AA/GD,gDA+GC"}
|
|
@@ -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.loadClassesFromFiles = exports.isClass = exports.discoverFiles = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
9
10
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booter-utils.js","sourceRoot":"","sources":["../../src/booters/booter-utils.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE
|
|
1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AI,CAAC,QAAQ,CAAC,CAAC;aACxB;iBAAM;gBACL,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;aACjC;SACF;KACF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AApBD,oDAoBC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Application, Binding, BindingFilter, Constructor } from '@loopback/core';
|
|
2
|
+
import { Bootable, Booter } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Binding keys excluded from a sub application. These bindings booted from the
|
|
5
|
+
* sub application won't be added to the main application.
|
|
6
|
+
*/
|
|
7
|
+
export declare const bindingKeysExcludedFromSubApp: string[];
|
|
8
|
+
/**
|
|
9
|
+
* Create a booter that boots the component application. Bindings that exist
|
|
10
|
+
* in the component application before `boot` are skipped. Locked bindings in
|
|
11
|
+
* the main application will not be overridden.
|
|
12
|
+
*
|
|
13
|
+
* @param componentApp - The application exposing a component
|
|
14
|
+
* @param filter Binding filter to selected bindings to be added
|
|
15
|
+
*/
|
|
16
|
+
export declare function createBooterForComponentApplication(componentApp: Application & Bootable, filter?: BindingFilter): Constructor<Booter>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a binding to register a booter that boots the component application.
|
|
19
|
+
* Bindings that exist in the component application before `boot` are skipped.
|
|
20
|
+
* Locked bindings in the main application will not be overridden.
|
|
21
|
+
*
|
|
22
|
+
* @param componentApp - The application exposing a component
|
|
23
|
+
* @param filter Binding filter to selected bindings to be added
|
|
24
|
+
*/
|
|
25
|
+
export declare function createComponentApplicationBooterBinding(componentApp: Application & Bootable, filter?: BindingFilter): Binding<Booter>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2020. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/boot
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createComponentApplicationBooterBinding = exports.createBooterForComponentApplication = exports.bindingKeysExcludedFromSubApp = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const core_1 = require("@loopback/core");
|
|
10
|
+
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
11
|
+
const keys_1 = require("../keys");
|
|
12
|
+
const types_1 = require("../types");
|
|
13
|
+
const debug = debug_1.default('loopback:boot:booter:component-application');
|
|
14
|
+
/**
|
|
15
|
+
* Binding keys excluded from a sub application. These bindings booted from the
|
|
16
|
+
* sub application won't be added to the main application.
|
|
17
|
+
*/
|
|
18
|
+
exports.bindingKeysExcludedFromSubApp = [
|
|
19
|
+
keys_1.BootBindings.BOOT_OPTIONS.key,
|
|
20
|
+
keys_1.BootBindings.PROJECT_ROOT.key,
|
|
21
|
+
keys_1.BootBindings.BOOTSTRAPPER_KEY.key,
|
|
22
|
+
core_1.CoreBindings.APPLICATION_CONFIG.key,
|
|
23
|
+
core_1.CoreBindings.APPLICATION_INSTANCE.key,
|
|
24
|
+
core_1.CoreBindings.APPLICATION_METADATA.key,
|
|
25
|
+
core_1.CoreBindings.LIFE_CYCLE_OBSERVER_REGISTRY.key,
|
|
26
|
+
core_1.CoreBindings.LIFE_CYCLE_OBSERVER_OPTIONS.key,
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Create a booter that boots the component application. Bindings that exist
|
|
30
|
+
* in the component application before `boot` are skipped. Locked bindings in
|
|
31
|
+
* the main application will not be overridden.
|
|
32
|
+
*
|
|
33
|
+
* @param componentApp - The application exposing a component
|
|
34
|
+
* @param filter Binding filter to selected bindings to be added
|
|
35
|
+
*/
|
|
36
|
+
function createBooterForComponentApplication(componentApp, filter = () => true) {
|
|
37
|
+
/**
|
|
38
|
+
* A booter to boot artifacts for the component application
|
|
39
|
+
*/
|
|
40
|
+
let ComponentApplicationBooter = /** @class */ (() => {
|
|
41
|
+
let ComponentApplicationBooter = class ComponentApplicationBooter {
|
|
42
|
+
constructor(mainApp) {
|
|
43
|
+
this.mainApp = mainApp;
|
|
44
|
+
}
|
|
45
|
+
async load() {
|
|
46
|
+
/**
|
|
47
|
+
* List all bindings before boot
|
|
48
|
+
*/
|
|
49
|
+
let bindings = componentApp.find(() => true);
|
|
50
|
+
const bindingsBeforeBoot = new Set(bindings);
|
|
51
|
+
// Boot the component application
|
|
52
|
+
await componentApp.boot();
|
|
53
|
+
/**
|
|
54
|
+
* Add bindings from the component application to the main application
|
|
55
|
+
*/
|
|
56
|
+
bindings = componentApp.find(filter);
|
|
57
|
+
for (const binding of bindings) {
|
|
58
|
+
// Exclude boot related bindings
|
|
59
|
+
if (exports.bindingKeysExcludedFromSubApp.includes(binding.key))
|
|
60
|
+
continue;
|
|
61
|
+
// Exclude bindings from the app before boot
|
|
62
|
+
if (bindingsBeforeBoot.has(binding)) {
|
|
63
|
+
debug('Skipping binding %s that exists before booting %s', binding.key, componentApp.name);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
// Do not override locked bindings
|
|
67
|
+
const locked = this.mainApp.find(binding.key).some(b => b.isLocked);
|
|
68
|
+
if (locked) {
|
|
69
|
+
debug('Skipping binding %s from %s - locked in %s', binding.key, componentApp.name, this.mainApp.name);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
debug('Adding binding from %s to %s', componentApp.name, this.mainApp.name, binding);
|
|
73
|
+
this.mainApp.add(binding);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
ComponentApplicationBooter = tslib_1.__decorate([
|
|
78
|
+
types_1.booter('componentApplications'),
|
|
79
|
+
tslib_1.__param(0, core_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
|
|
80
|
+
tslib_1.__metadata("design:paramtypes", [core_1.Application])
|
|
81
|
+
], ComponentApplicationBooter);
|
|
82
|
+
return ComponentApplicationBooter;
|
|
83
|
+
})();
|
|
84
|
+
return ComponentApplicationBooter;
|
|
85
|
+
}
|
|
86
|
+
exports.createBooterForComponentApplication = createBooterForComponentApplication;
|
|
87
|
+
/**
|
|
88
|
+
* Create a binding to register a booter that boots the component application.
|
|
89
|
+
* Bindings that exist in the component application before `boot` are skipped.
|
|
90
|
+
* Locked bindings in the main application will not be overridden.
|
|
91
|
+
*
|
|
92
|
+
* @param componentApp - The application exposing a component
|
|
93
|
+
* @param filter Binding filter to selected bindings to be added
|
|
94
|
+
*/
|
|
95
|
+
function createComponentApplicationBooterBinding(componentApp, filter) {
|
|
96
|
+
return core_1.createBindingFromClass(createBooterForComponentApplication(componentApp, filter));
|
|
97
|
+
}
|
|
98
|
+
exports.createComponentApplicationBooterBinding = createComponentApplicationBooterBinding;
|
|
99
|
+
//# sourceMappingURL=component-application.booter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-application.booter.js","sourceRoot":"","sources":["../../src/booters/component-application.booter.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,yCAQwB;AACxB,0DAAiC;AACjC,kCAAqC;AACrC,oCAAkD;AAElD,MAAM,KAAK,GAAG,eAAY,CAAC,4CAA4C,CAAC,CAAC;AAEzE;;;GAGG;AACU,QAAA,6BAA6B,GAAG;IAC3C,mBAAY,CAAC,YAAY,CAAC,GAAG;IAC7B,mBAAY,CAAC,YAAY,CAAC,GAAG;IAC7B,mBAAY,CAAC,gBAAgB,CAAC,GAAG;IACjC,mBAAY,CAAC,kBAAkB,CAAC,GAAG;IACnC,mBAAY,CAAC,oBAAoB,CAAC,GAAG;IACrC,mBAAY,CAAC,oBAAoB,CAAC,GAAG;IACrC,mBAAY,CAAC,4BAA4B,CAAC,GAAG;IAC7C,mBAAY,CAAC,2BAA2B,CAAC,GAAG;CAC7C,CAAC;AAEF;;;;;;;GAOG;AACH,SAAgB,mCAAmC,CACjD,YAAoC,EACpC,SAAwB,GAAG,EAAE,CAAC,IAAI;IAElC;;OAEG;I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AC,GAAG,CAAC,OAAkB,CAAC,CAAC;iBACtC;YACH,CAAC;SACF,CAAA;QApDK,0BAA0B;YAD/B,cAAM,CAAC,uBAAuB,CAAC;YAG3B,mBAAA,aAAM,CAAC,mBAAY,CAAC,oBAAoB,CAAC,CAAA;qDAAkB,kBAAW;WAFrE,0BAA0B,CAoD/B;QAAD,iCAAC;SAAA;IACD,OAAO,0BAA0B,CAAC;AACpC,CAAC;AA9DD,kFA8DC;AAED;;;;;;;GAOG;AACH,SAAgB,uCAAuC,CACrD,YAAoC,EACpC,MAAsB;IAEtB,OAAO,6BAAsB,CAC3B,mCAAmC,CAAC,YAAY,EAAE,MAAM,CAAC,CAC1D,CAAC;AACJ,CAAC;AAPD,0FAOC"}
|
|
@@ -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.ControllerDefaults = exports.ControllerBooter = 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");
|
|
@@ -20,32 +21,35 @@ const base_artifact_booter_1 = require("./base-artifact.booter");
|
|
|
20
21
|
* @param projectRoot - Root of User Project relative to which all paths are resolved
|
|
21
22
|
* @param bootConfig - Controller Artifact Options Object
|
|
22
23
|
*/
|
|
23
|
-
let ControllerBooter = class
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
24
|
+
let ControllerBooter = /** @class */ (() => {
|
|
25
|
+
let ControllerBooter = class ControllerBooter extends base_artifact_booter_1.BaseArtifactBooter {
|
|
26
|
+
constructor(app, projectRoot, controllerConfig = {}) {
|
|
27
|
+
super(projectRoot,
|
|
28
|
+
// Set Controller Booter Options if passed in via bootConfig
|
|
29
|
+
Object.assign({}, exports.ControllerDefaults, controllerConfig));
|
|
30
|
+
this.app = app;
|
|
31
|
+
this.controllerConfig = controllerConfig;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Uses super method to get a list of Artifact classes. Boot each class by
|
|
35
|
+
* binding it to the application using `app.controller(controller);`.
|
|
36
|
+
*/
|
|
37
|
+
async load() {
|
|
38
|
+
await super.load();
|
|
39
|
+
this.classes.forEach(cls => {
|
|
40
|
+
this.app.controller(cls);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
ControllerBooter = tslib_1.__decorate([
|
|
45
|
+
types_1.booter('controllers'),
|
|
46
|
+
tslib_1.__param(0, context_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
|
|
47
|
+
tslib_1.__param(1, context_1.inject(keys_1.BootBindings.PROJECT_ROOT)),
|
|
48
|
+
tslib_1.__param(2, context_1.config()),
|
|
49
|
+
tslib_1.__metadata("design:paramtypes", [core_1.Application, String, Object])
|
|
50
|
+
], ControllerBooter);
|
|
51
|
+
return ControllerBooter;
|
|
52
|
+
})();
|
|
49
53
|
exports.ControllerBooter = ControllerBooter;
|
|
50
54
|
/**
|
|
51
55
|
* Default ArtifactOptions for ControllerBooter.
|