@loopback/boot 2.3.1 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/.sandbox/{63541odlHvc → 18043muTUQs}/model-endpoints/product.rest-config.js +0 -0
  3. package/dist/.sandbox/18043muTUQs/models/product.model.js +25 -0
  4. package/dist/.sandbox/{635419mu8mo → 18043wLA3S3}/application.js +0 -0
  5. package/dist/.sandbox/18043wLA3S3/controllers/multiple.controller.js +39 -0
  6. package/dist/.sandbox/{63541DlS0Ic → 18044FOwh70}/application.js +0 -0
  7. package/dist/.sandbox/18044FOwh70/interceptors/interceptor.interceptor.js +51 -0
  8. package/dist/.sandbox/18044FOwh70/interceptors/non-global-interceptor.interceptor.js +51 -0
  9. package/dist/.sandbox/{63541DshyBF → 18045Jt9E5K}/application.js +0 -0
  10. package/dist/.sandbox/{63541ik89oh → 18045Jt9E5K}/models/multiple-models.model.js +0 -0
  11. package/dist/.sandbox/18045Jt9E5K/models/no-entity.model.js +25 -0
  12. package/dist/.sandbox/18045Jt9E5K/models/product.model.js +25 -0
  13. package/dist/.sandbox/{63541IEce5V → 18045YaR1P2}/application.js +0 -0
  14. package/dist/.sandbox/{63541DshyBF → 18045YaR1P2}/observers/lifecycle-observer.observer.js +0 -0
  15. package/dist/.sandbox/{635415cxfJi → 18045e2CYyx}/service-provider.artifact.js +0 -0
  16. package/dist/.sandbox/18045hzRuQ4/dist/application.js +20 -0
  17. package/dist/.sandbox/{63541meTxP7 → 18045hzRuQ4}/package.json +1 -1
  18. package/dist/.sandbox/{635419t6TqH → 18045rgy7Ui}/datasource.artifact.js +5 -8
  19. package/dist/.sandbox/{63541ik89oh → 18046d8C54w}/application.js +0 -0
  20. package/dist/.sandbox/18046d8C54w/controllers/multiple.controller.js +39 -0
  21. package/dist/.sandbox/{package.json → 18046d8C54w/package.json} +1 -1
  22. package/dist/.sandbox/18046kEhstv/multiple.artifact.js +39 -0
  23. package/dist/.sandbox/18046obZENY/multiple.artifact.js +39 -0
  24. package/dist/.sandbox/{63541meTxP7 → 18047EeHfXu}/application.js +0 -0
  25. package/dist/.sandbox/18047EeHfXu/repositories/multiple.repository.js +39 -0
  26. package/dist/.sandbox/{63541nGmQFL → 18048e1iuZt}/application.js +0 -0
  27. package/dist/.sandbox/{635419mu8mo → 18048e1iuZt}/services/bindable-classes.service.js +19 -25
  28. package/dist/.sandbox/{635419mu8mo → 18048e1iuZt}/services/geocoder.service.js +0 -0
  29. package/dist/.sandbox/{635419mu8mo → 18048e1iuZt}/services/greeting.service.js +0 -0
  30. package/dist/.sandbox/18048urj9RP/application.js +20 -0
  31. package/dist/.sandbox/18048urj9RP/controllers/multiple.controller.js +39 -0
  32. package/dist/.sandbox/18048urj9RP/package.json +18 -0
  33. package/dist/.sandbox/{635411GGsm1 → 18049UriL05}/model-endpoints/no-entity.rest-config.js +0 -0
  34. package/dist/.sandbox/18049UriL05/models/no-entity.model.js +25 -0
  35. package/dist/.sandbox/{63541ruUDNf → 18049gfsPc4}/application.js +0 -0
  36. package/dist/.sandbox/{63541IEce5V → 18049gfsPc4}/datasources/db.datasource.js +5 -8
  37. package/dist/boot.component.js +30 -34
  38. package/dist/boot.component.js.map +1 -1
  39. package/dist/booters/application-metadata.booter.js +19 -23
  40. package/dist/booters/application-metadata.booter.js.map +1 -1
  41. package/dist/booters/base-artifact.booter.d.ts +1 -1
  42. package/dist/booters/base-artifact.booter.js +1 -1
  43. package/dist/booters/booter-utils.d.ts +1 -1
  44. package/dist/booters/component-application.booter.js +39 -42
  45. package/dist/booters/component-application.booter.js.map +1 -1
  46. package/dist/booters/controller.booter.js +26 -30
  47. package/dist/booters/controller.booter.js.map +1 -1
  48. package/dist/booters/datasource.booter.js +36 -40
  49. package/dist/booters/datasource.booter.js.map +1 -1
  50. package/dist/booters/interceptor.booter.d.ts +1 -2
  51. package/dist/booters/interceptor.booter.js +28 -32
  52. package/dist/booters/interceptor.booter.js.map +1 -1
  53. package/dist/booters/lifecyle-observer.booter.d.ts +1 -1
  54. package/dist/booters/lifecyle-observer.booter.js +29 -32
  55. package/dist/booters/lifecyle-observer.booter.js.map +1 -1
  56. package/dist/booters/model-api.booter.js +63 -66
  57. package/dist/booters/model-api.booter.js.map +1 -1
  58. package/dist/booters/model.booter.js +31 -35
  59. package/dist/booters/model.booter.js.map +1 -1
  60. package/dist/booters/repository.booter.js +35 -39
  61. package/dist/booters/repository.booter.js.map +1 -1
  62. package/dist/booters/service.booter.js +30 -34
  63. package/dist/booters/service.booter.js.map +1 -1
  64. package/dist/bootstrapper.d.ts +1 -2
  65. package/dist/bootstrapper.js +77 -85
  66. package/dist/bootstrapper.js.map +1 -1
  67. package/dist/keys.d.ts +1 -1
  68. package/dist/keys.js +4 -4
  69. package/dist/keys.js.map +1 -1
  70. package/dist/mixins/boot.mixin.d.ts +52 -41
  71. package/dist/mixins/boot.mixin.js +40 -18
  72. package/dist/mixins/boot.mixin.js.map +1 -1
  73. package/dist/types.d.ts +7 -1
  74. package/dist/types.js +2 -2
  75. package/dist/types.js.map +1 -1
  76. package/package.json +18 -19
  77. package/src/boot.component.ts +7 -2
  78. package/src/booters/application-metadata.booter.ts +1 -2
  79. package/src/booters/base-artifact.booter.ts +2 -2
  80. package/src/booters/booter-utils.ts +1 -1
  81. package/src/booters/controller.booter.ts +1 -2
  82. package/src/booters/datasource.booter.ts +2 -3
  83. package/src/booters/interceptor.booter.ts +3 -2
  84. package/src/booters/lifecyle-observer.booter.ts +1 -1
  85. package/src/booters/model.booter.ts +1 -2
  86. package/src/booters/repository.booter.ts +1 -2
  87. package/src/booters/service.booter.ts +2 -2
  88. package/src/bootstrapper.ts +11 -10
  89. package/src/keys.ts +1 -1
  90. package/src/mixins/boot.mixin.ts +50 -45
  91. package/src/types.ts +8 -1
  92. package/dist/.sandbox/635411GGsm1/models/no-entity.model.js +0 -28
  93. package/dist/.sandbox/63541BtDxTa/multiple.artifact.js +0 -45
  94. package/dist/.sandbox/63541DlS0Ic/repositories/multiple.repository.js +0 -45
  95. package/dist/.sandbox/63541ik89oh/models/no-entity.model.js +0 -28
  96. package/dist/.sandbox/63541ik89oh/models/product.model.js +0 -28
  97. package/dist/.sandbox/63541meTxP7/controllers/multiple.controller.js +0 -45
  98. package/dist/.sandbox/63541nGmQFL/controllers/multiple.controller.js +0 -45
  99. package/dist/.sandbox/63541odlHvc/models/product.model.js +0 -28
  100. package/dist/.sandbox/63541ruUDNf/interceptors/interceptor.interceptor.js +0 -54
  101. package/dist/.sandbox/63541ruUDNf/interceptors/non-global-interceptor.interceptor.js +0 -54
  102. package/dist/.sandbox/63541vSi6af/multiple.artifact.js +0 -45
  103. package/dist/.sandbox/application.js +0 -20
  104. package/dist/.sandbox/controllers/multiple.controller.js +0 -45
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "boot-test-app",
3
+ "version": "1.0.0",
4
+ "description": "boot-test-app",
5
+ "keywords": [
6
+ "loopback-application",
7
+ "loopback"
8
+ ],
9
+ "engines": {
10
+ "node": ">=10.16"
11
+ },
12
+ "scripts": {},
13
+ "repository": {
14
+ "type": "git"
15
+ },
16
+ "author": "IBM Corp.",
17
+ "license": "MIT"
18
+ }
@@ -0,0 +1,25 @@
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.NoEntity = void 0;
8
+ const tslib_1 = require("tslib");
9
+ const repository_1 = require("@loopback/repository");
10
+ let NoEntity = class NoEntity extends repository_1.Model {
11
+ };
12
+ tslib_1.__decorate([
13
+ repository_1.property({ id: true }),
14
+ tslib_1.__metadata("design:type", Number)
15
+ ], NoEntity.prototype, "id", void 0);
16
+ tslib_1.__decorate([
17
+ repository_1.property({ required: true }),
18
+ tslib_1.__metadata("design:type", String)
19
+ ], NoEntity.prototype, "name", void 0);
20
+ NoEntity = tslib_1.__decorate([
21
+ repository_1.model()
22
+ ], NoEntity);
23
+ exports.NoEntity = NoEntity;
24
+ //# sourceMappingURL=no-entity.model.js.map
25
+ //# sourceMappingURL=/Users/rfeng/Projects/loopback4/loopback-next/packages/boot/dist/__tests__/fixtures/no-entity.model.js.map
@@ -6,15 +6,12 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.DbDataSource = void 0;
8
8
  const repository_1 = require("@loopback/repository");
9
- let DbDataSource = /** @class */ (() => {
10
- class DbDataSource extends repository_1.juggler.DataSource {
11
- constructor() {
12
- super({ name: 'db' });
13
- }
9
+ class DbDataSource extends repository_1.juggler.DataSource {
10
+ constructor() {
11
+ super({ name: 'db' });
14
12
  }
15
- DbDataSource.dataSourceName = 'db';
16
- return DbDataSource;
17
- })();
13
+ }
18
14
  exports.DbDataSource = DbDataSource;
15
+ DbDataSource.dataSourceName = 'db';
19
16
  //# sourceMappingURL=datasource.artifact.js.map
20
17
  //# sourceMappingURL=/Users/rfeng/Projects/loopback4/loopback-next/packages/boot/dist/__tests__/fixtures/datasource.artifact.js.map
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.BootComponent = void 0;
8
8
  const tslib_1 = require("tslib");
9
- const context_1 = require("@loopback/context");
10
9
  const core_1 = require("@loopback/core");
11
10
  const booters_1 = require("./booters");
12
11
  const bootstrapper_1 = require("./bootstrapper");
@@ -16,38 +15,35 @@ const keys_1 = require("./keys");
16
15
  * available by this module as well as bind the BootStrapper to the app so it
17
16
  * can be used to run the Booters.
18
17
  */
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
- })();
18
+ let BootComponent = class BootComponent {
19
+ /**
20
+ *
21
+ * @param app - Application instance
22
+ */
23
+ constructor(app) {
24
+ // Export a list of default booters in the component so they get bound
25
+ // automatically when this component is mounted.
26
+ this.booters = [
27
+ booters_1.ApplicationMetadataBooter,
28
+ booters_1.ControllerBooter,
29
+ booters_1.RepositoryBooter,
30
+ booters_1.ServiceBooter,
31
+ booters_1.DataSourceBooter,
32
+ booters_1.LifeCycleObserverBooter,
33
+ booters_1.InterceptorProviderBooter,
34
+ booters_1.ModelApiBooter,
35
+ booters_1.ModelBooter,
36
+ ];
37
+ // Bound as a SINGLETON so it can be cached as it has no state
38
+ app
39
+ .bind(keys_1.BootBindings.BOOTSTRAPPER_KEY)
40
+ .toClass(bootstrapper_1.Bootstrapper)
41
+ .inScope(core_1.BindingScope.SINGLETON);
42
+ }
43
+ };
44
+ BootComponent = tslib_1.__decorate([
45
+ tslib_1.__param(0, core_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
46
+ tslib_1.__metadata("design:paramtypes", [core_1.Application])
47
+ ], BootComponent);
52
48
  exports.BootComponent = BootComponent;
53
49
  //# 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;;;;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"}
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,yCAMwB;AACxB,uCAUmB;AACnB,iDAA4C;AAC5C,iCAAoC;AAEpC;;;;GAIG;AACH,IAAa,aAAa,GAA1B,MAAa,aAAa;IAexB;;;OAGG;IACH,YAAuD,GAAgB;QAlBvE,sEAAsE;QACtE,gDAAgD;QAChD,YAAO,GAAG;YACR,mCAAyB;YACzB,0BAAgB;YAChB,0BAAgB;YAChB,uBAAa;YACb,0BAAgB;YAChB,iCAAuB;YACvB,mCAAyB;YACzB,wBAAc;YACd,qBAAW;SACZ,CAAC;QAOA,8DAA8D;QAC9D,GAAG;aACA,IAAI,CAAC,mBAAY,CAAC,gBAAgB,CAAC;aACnC,OAAO,CAAC,2BAAY,CAAC;aACrB,OAAO,CAAC,mBAAY,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;CACF,CAAA;AA1BY,aAAa;IAmBX,mBAAA,aAAM,CAAC,mBAAY,CAAC,oBAAoB,CAAC,CAAA;6CAAM,kBAAW;GAnB5D,aAAa,CA0BzB;AA1BY,sCAAa"}
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ApplicationMetadataBooter = void 0;
8
8
  const tslib_1 = require("tslib");
9
- const context_1 = require("@loopback/context");
10
9
  const core_1 = require("@loopback/core");
11
10
  const debug_1 = tslib_1.__importDefault(require("debug"));
12
11
  const keys_1 = require("../keys");
@@ -19,29 +18,26 @@ const debug = debug_1.default('loopback:boot:booter:application-metadata');
19
18
  * @param app - Application instance
20
19
  * @param projectRoot - Root of User Project
21
20
  */
22
- let ApplicationMetadataBooter = /** @class */ (() => {
23
- let ApplicationMetadataBooter = class ApplicationMetadataBooter {
24
- constructor(app, projectRoot) {
25
- this.app = app;
26
- this.projectRoot = projectRoot;
21
+ let ApplicationMetadataBooter = class ApplicationMetadataBooter {
22
+ constructor(app, projectRoot) {
23
+ this.app = app;
24
+ this.projectRoot = projectRoot;
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);
27
31
  }
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
- }
32
+ catch (err) {
33
+ debug('package.json not found', err);
37
34
  }
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
- })();
35
+ }
36
+ };
37
+ ApplicationMetadataBooter = tslib_1.__decorate([
38
+ tslib_1.__param(0, core_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
39
+ tslib_1.__param(1, core_1.inject(keys_1.BootBindings.PROJECT_ROOT)),
40
+ tslib_1.__metadata("design:paramtypes", [core_1.Application, String])
41
+ ], ApplicationMetadataBooter);
46
42
  exports.ApplicationMetadataBooter = ApplicationMetadataBooter;
47
43
  //# 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;;;;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"}
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,yCAAiE;AACjE,0DAAgC;AAChC,kCAAqC;AAErC,6BAA8B;AAE9B,MAAM,KAAK,GAAG,eAAW,CAAC,2CAA2C,CAAC,CAAC;AAEvE;;;;;;GAMG;AACH,IAAa,yBAAyB,GAAtC,MAAa,yBAAyB;IACpC,YACoD,GAAgB,EACvB,WAAmB;QADZ,QAAG,GAAH,GAAG,CAAa;QACvB,gBAAW,GAAX,WAAW,CAAQ;IAC7D,CAAC;IAEJ,KAAK,CAAC,SAAS;QACb,IAAI;YACF,gDAAgD;YAChD,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;YACvE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;SAC3B;QAAC,OAAO,GAAG,EAAE;YACZ,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;SACtC;IACH,CAAC;CACF,CAAA;AAfY,yBAAyB;IAEjC,mBAAA,aAAM,CAAC,mBAAY,CAAC,oBAAoB,CAAC,CAAA;IACzC,mBAAA,aAAM,CAAC,mBAAY,CAAC,YAAY,CAAC,CAAA;6CADqB,kBAAW;GAFzD,yBAAyB,CAerC;AAfY,8DAAyB"}
@@ -1,4 +1,4 @@
1
- import { Constructor } from '@loopback/context';
1
+ import { Constructor } from '@loopback/core';
2
2
  import { ArtifactOptions, Booter } from '../types';
3
3
  /**
4
4
  * This class serves as a base class for Booters which follow a pattern of
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright IBM Corp. 2018,2019. All Rights Reserved.
2
+ // Copyright IBM Corp. 2018,2020. All Rights Reserved.
3
3
  // Node module: @loopback/boot
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
@@ -1,4 +1,4 @@
1
- import { Constructor } from '@loopback/context';
1
+ import { Constructor } from '@loopback/core';
2
2
  /**
3
3
  * Returns all files matching the given glob pattern relative to root
4
4
  *
@@ -37,50 +37,47 @@ function createBooterForComponentApplication(componentApp, filter = () => true)
37
37
  /**
38
38
  * A booter to boot artifacts for the component application
39
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);
40
+ let ComponentApplicationBooter = class ComponentApplicationBooter {
41
+ constructor(mainApp) {
42
+ this.mainApp = mainApp;
43
+ }
44
+ async load() {
45
+ /**
46
+ * List all bindings before boot
47
+ */
48
+ let bindings = componentApp.find(() => true);
49
+ const bindingsBeforeBoot = new Set(bindings);
50
+ // Boot the component application
51
+ await componentApp.boot();
52
+ /**
53
+ * Add bindings from the component application to the main application
54
+ */
55
+ bindings = componentApp.find(filter);
56
+ for (const binding of bindings) {
57
+ // Exclude boot related bindings
58
+ if (exports.bindingKeysExcludedFromSubApp.includes(binding.key))
59
+ continue;
60
+ // Exclude bindings from the app before boot
61
+ if (bindingsBeforeBoot.has(binding)) {
62
+ debug('Skipping binding %s that exists before booting %s', binding.key, componentApp.name);
63
+ continue;
64
+ }
65
+ // Do not override locked bindings
66
+ const locked = this.mainApp.find(binding.key).some(b => b.isLocked);
67
+ if (locked) {
68
+ debug('Skipping binding %s from %s - locked in %s', binding.key, componentApp.name, this.mainApp.name);
69
+ continue;
74
70
  }
71
+ debug('Adding binding from %s to %s', componentApp.name, this.mainApp.name, binding);
72
+ this.mainApp.add(binding);
75
73
  }
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
- })();
74
+ }
75
+ };
76
+ ComponentApplicationBooter = tslib_1.__decorate([
77
+ types_1.booter('componentApplications'),
78
+ tslib_1.__param(0, core_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
79
+ tslib_1.__metadata("design:paramtypes", [core_1.Application])
80
+ ], ComponentApplicationBooter);
84
81
  return ComponentApplicationBooter;
85
82
  }
86
83
  exports.createBooterForComponentApplication = createBooterForComponentApplication;
@@ -1 +1 @@
1
- {"version":3,"file":"component-application.booter.js","sourceRoot":"","sources":["../../src/booters/component-application.booter.ts"],"names":[],"mappings":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AAS;oBAElE,4CAA4C;oBAC5C,IAAI,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;wBACnC,KAAK,CACH,mDAAmD,EACnD,OAAO,CAAC,GAAG,EACX,YAAY,CAAC,IAAI,CAClB,CAAC;wBACF,SAAS;qBACV;oBAED,kCAAkC;oBAClC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;oBACpE,IAAI,MAAM,EAAE;wBACV,KAAK,CACH,4CAA4C,EAC5C,OAAO,CAAC,GAAG,EACX,YAAY,CAAC,IAAI,EACjB,IAAI,CAAC,OAAO,CAAC,IAAI,CAClB,CAAC;wBACF,SAAS;qBACV;oBAED,KAAK,CACH,8BAA8B,EAC9B,YAAY,CAAC,IAAI,EACjB,IAAI,CAAC,OAAO,CAAC,IAAI,EACjB,OAAO,CACR,CAAC;oBACF,IAAI,CAAC,OAAO,CAAC,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"}
1
+ {"version":3,"file":"component-application.booter.js","sourceRoot":"","sources":["../../src/booters/component-application.booter.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,8BAA8B;AAC9B,+CA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,OAAO,CAAC,EAAE;oBACnC,KAAK,CACH,mDAAmD,EACnD,OAAO,CAAC,GAAG,EACX,YAAY,CAAC,IAAI,CAClB,CAAC;oBACF,SAAS;iBACV;gBAED,kCAAkC;gBAClC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;gBACpE,IAAI,MAAM,EAAE;oBACV,KAAK,CACH,4CAA4C,EAC5C,OAAO,CAAC,GAAG,EACX,YAAY,CAAC,IAAI,EACjB,IAAI,CAAC,OAAO,CAAC,IAAI,CAClB,CAAC;oBACF,SAAS;iBACV;gBAED,KAAK,CACH,8BAA8B,EAC9B,YAAY,CAAC,IAAI,EACjB,IAAI,CAAC,OAAO,CAAC,IAAI,EACjB,OAAO,CACR,CAAC;gBACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAkB,CAAC,CAAC;aACtC;QACH,CAAC;KACF,CAAA;IApDK,0BAA0B;QAD/B,cAAM,CAAC,uBAAuB,CAAC;QAG3B,mBAAA,aAAM,CAAC,mBAAY,CAAC,oBAAoB,CAAC,CAAA;iDAAkB,kBAAW;OAFrE,0BAA0B,CAoD/B;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"}
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ControllerDefaults = exports.ControllerBooter = void 0;
8
8
  const tslib_1 = require("tslib");
9
- const context_1 = require("@loopback/context");
10
9
  const core_1 = require("@loopback/core");
11
10
  const keys_1 = require("../keys");
12
11
  const types_1 = require("../types");
@@ -21,35 +20,32 @@ const base_artifact_booter_1 = require("./base-artifact.booter");
21
20
  * @param projectRoot - Root of User Project relative to which all paths are resolved
22
21
  * @param bootConfig - Controller Artifact Options Object
23
22
  */
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
- })();
23
+ let ControllerBooter = class ControllerBooter extends base_artifact_booter_1.BaseArtifactBooter {
24
+ constructor(app, projectRoot, controllerConfig = {}) {
25
+ super(projectRoot,
26
+ // Set Controller Booter Options if passed in via bootConfig
27
+ Object.assign({}, exports.ControllerDefaults, controllerConfig));
28
+ this.app = app;
29
+ this.controllerConfig = controllerConfig;
30
+ }
31
+ /**
32
+ * Uses super method to get a list of Artifact classes. Boot each class by
33
+ * binding it to the application using `app.controller(controller);`.
34
+ */
35
+ async load() {
36
+ await super.load();
37
+ this.classes.forEach(cls => {
38
+ this.app.controller(cls);
39
+ });
40
+ }
41
+ };
42
+ ControllerBooter = tslib_1.__decorate([
43
+ types_1.booter('controllers'),
44
+ tslib_1.__param(0, core_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
45
+ tslib_1.__param(1, core_1.inject(keys_1.BootBindings.PROJECT_ROOT)),
46
+ tslib_1.__param(2, core_1.config()),
47
+ tslib_1.__metadata("design:paramtypes", [core_1.Application, String, Object])
48
+ ], ControllerBooter);
53
49
  exports.ControllerBooter = ControllerBooter;
54
50
  /**
55
51
  * Default ArtifactOptions for ControllerBooter.
@@ -1 +1 @@
1
- {"version":3,"file":"controller.booter.js","sourceRoot":"","sources":["../../src/booters/controller.booter.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,+CAAiD;AACjD,yCAAyD;AACzD,kCAAqC;AACrC,oCAAiD;AACjD,iEAA0D;AAE1D;;;;;;;;;GASG;AAEH;IAAA,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,yCAAkB;QACtD,YACoD,GAAgB,EAC/B,WAAmB,EAE/C,mBAAoC,EAAE;YAE7C,KAAK,CACH,WAAW;YACX,4DAA4D;YAC5D,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,0BAAkB,EAAE,gBAAgB,CAAC,CACxD,CAAC;YATgD,QAAG,GAAH,GAAG,CAAa;YAG3D,qBAAgB,GAAhB,gBAAgB,CAAsB;QAO/C,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,IAAI;YACR,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACzB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAA;IAxBY,gBAAgB;QAD5B,cAAM,CAAC,aAAa,CAAC;QAGjB,mBAAA,gBAAM,CAAC,mBAAY,CAAC,oBAAoB,CAAC,CAAA;QACzC,mBAAA,gBAAM,CAAC,mBAAY,C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jC,mBAAA,aAAM,EAAE,CAAA;6CAF8C,kBAAW;GAFzD,gBAAgB,CAwB5B;AAxBY,4CAAgB;AA0B7B;;GAEG;AACU,QAAA,kBAAkB,GAAoB;IACjD,IAAI,EAAE,CAAC,aAAa,CAAC;IACrB,UAAU,EAAE,CAAC,gBAAgB,CAAC;IAC9B,MAAM,EAAE,IAAI;CACb,CAAC"}
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
- // Copyright IBM Corp. 2018,2019. All Rights Reserved.
2
+ // Copyright IBM Corp. 2018,2020. All Rights Reserved.
3
3
  // Node module: @loopback/boot
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
7
  exports.DataSourceDefaults = exports.DataSourceBooter = void 0;
8
8
  const tslib_1 = require("tslib");
9
- const context_1 = require("@loopback/context");
10
9
  const core_1 = require("@loopback/core");
11
10
  const keys_1 = require("../keys");
12
11
  const types_1 = require("../types");
@@ -21,48 +20,45 @@ const base_artifact_booter_1 = require("./base-artifact.booter");
21
20
  * @param projectRoot - Root of User Project relative to which all paths are resolved
22
21
  * @param bootConfig - DataSource Artifact Options Object
23
22
  */
24
- let DataSourceBooter = /** @class */ (() => {
25
- let DataSourceBooter = class DataSourceBooter extends base_artifact_booter_1.BaseArtifactBooter {
26
- constructor(app, projectRoot, datasourceConfig = {}) {
27
- super(projectRoot,
28
- // Set DataSource Booter Options if passed in via bootConfig
29
- Object.assign({}, exports.DataSourceDefaults, datasourceConfig));
30
- this.app = app;
31
- this.datasourceConfig = datasourceConfig;
32
- }
23
+ let DataSourceBooter = class DataSourceBooter extends base_artifact_booter_1.BaseArtifactBooter {
24
+ constructor(app, projectRoot, datasourceConfig = {}) {
25
+ super(projectRoot,
26
+ // Set DataSource Booter Options if passed in via bootConfig
27
+ Object.assign({}, exports.DataSourceDefaults, datasourceConfig));
28
+ this.app = app;
29
+ this.datasourceConfig = datasourceConfig;
30
+ }
31
+ /**
32
+ * Uses super method to get a list of Artifact classes. Boot each file by
33
+ * creating a DataSourceConstructor and binding it to the application class.
34
+ */
35
+ async load() {
36
+ await super.load();
33
37
  /**
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.
38
+ * If DataSource Classes were discovered, we need to make sure RepositoryMixin
39
+ * was used (so we have `app.dataSource()`) to perform the binding of a
40
+ * DataSource Class.
36
41
  */
37
- async load() {
38
- await super.load();
39
- /**
40
- * If DataSource Classes were discovered, we need to make sure RepositoryMixin
41
- * was used (so we have `app.dataSource()`) to perform the binding of a
42
- * DataSource Class.
43
- */
44
- if (this.classes.length > 0) {
45
- if (!this.app.dataSource) {
46
- console.warn('app.dataSource() function is needed for DataSourceBooter. You can add ' +
47
- 'it to your Application using RepositoryMixin from @loopback/repository.');
48
- }
49
- else {
50
- this.classes.forEach(cls => {
51
- this.app.dataSource(cls);
52
- });
53
- }
42
+ if (this.classes.length > 0) {
43
+ if (!this.app.dataSource) {
44
+ console.warn('app.dataSource() function is needed for DataSourceBooter. You can add ' +
45
+ 'it to your Application using RepositoryMixin from @loopback/repository.');
46
+ }
47
+ else {
48
+ this.classes.forEach(cls => {
49
+ this.app.dataSource(cls);
50
+ });
54
51
  }
55
52
  }
56
- };
57
- DataSourceBooter = tslib_1.__decorate([
58
- types_1.booter('datasources'),
59
- tslib_1.__param(0, context_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
60
- tslib_1.__param(1, context_1.inject(keys_1.BootBindings.PROJECT_ROOT)),
61
- tslib_1.__param(2, context_1.config()),
62
- tslib_1.__metadata("design:paramtypes", [Object, String, Object])
63
- ], DataSourceBooter);
64
- return DataSourceBooter;
65
- })();
53
+ }
54
+ };
55
+ DataSourceBooter = tslib_1.__decorate([
56
+ types_1.booter('datasources'),
57
+ tslib_1.__param(0, core_1.inject(core_1.CoreBindings.APPLICATION_INSTANCE)),
58
+ tslib_1.__param(1, core_1.inject(keys_1.BootBindings.PROJECT_ROOT)),
59
+ tslib_1.__param(2, core_1.config()),
60
+ tslib_1.__metadata("design:paramtypes", [Object, String, Object])
61
+ ], DataSourceBooter);
66
62
  exports.DataSourceBooter = DataSourceBooter;
67
63
  /**
68
64
  * Default ArtifactOptions for DataSourceBooter.
@@ -1 +1 @@
1
- {"version":3,"file":"datasource.booter.js","sourceRoot":"","sources":["../../src/booters/datasource.booter.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,+CAAiD;AACjD,yCAA4C;AAM5C,kCAAqC;AACrC,oCAAiD;AACjD,iEAA0D;AAE1D;;;;;;;;;GASG;AAEH;IAAA,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,yCAAkB;QACtD,YAES,GAAgC,EACJ,WAAmB,EAE/C,mBAAoC,EAAE;YAE7C,KAAK,CACH,WAAW;YACX,4DAA4D;YAC5D,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,0BAAkB,EAAE,gBAAgB,CAAC,CACxD,CAAC;YATK,QAAG,GAAH,GAAG,CAA6B;YAGhC,qBAAgB,GAAhB,gBAAgB,CAAsB;QAO/C,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,IAAI;YACR,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;YAEnB;;;;eAIG;YACH,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE;oBACxB,OAAO,CAAC,IAAI,CACV,wEAAwE;wBACtE,yEAAyE,CAC5E,CAAC;iBACH;qBAAM;oBACL,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;wBACzB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAgC,CAAC,CAAC;oBACxD,CAAC,CAAC,CAAC;iBACJ;aACF;QACH,CAAC;KACF,CAAA;IAxCY,gBAAgB;Q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,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;oBACzB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAgC,CAAC,CAAC;gBACxD,CAAC,CAAC,CAAC;aACJ;SACF;IACH,CAAC;CACF,CAAA;AAxCY,gBAAgB;IAD5B,cAAM,CAAC,aAAa,CAAC;IAGjB,mBAAA,aAAM,CAAC,mBAAY,CAAC,oBAAoB,CAAC,CAAA;IAEzC,mBAAA,aAAM,CAAC,mBAAY,CAAC,YAAY,CAAC,CAAA;IACjC,mBAAA,aAAM,EAAE,CAAA;;GALA,gBAAgB,CAwC5B;AAxCY,4CAAgB;AA0C7B;;GAEG;AACU,QAAA,kBAAkB,GAAoB;IACjD,IAAI,EAAE,CAAC,aAAa,CAAC;IACrB,UAAU,EAAE,CAAC,gBAAgB,CAAC;IAC9B,MAAM,EAAE,IAAI;CACb,CAAC"}
@@ -1,5 +1,4 @@
1
- import { Constructor, Interceptor, Provider } from '@loopback/context';
2
- import { Application } from '@loopback/core';
1
+ import { Application, Constructor, Interceptor, Provider } from '@loopback/core';
3
2
  import { ArtifactOptions } from '../types';
4
3
  import { BaseArtifactBooter } from './base-artifact.booter';
5
4
  declare type InterceptorProviderClass = Constructor<Provider<Interceptor>>;