1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | exports.RepositoryDefaults = exports.RepositoryBooter = void 0;
|
8 | const tslib_1 = require("tslib");
|
9 | const core_1 = require("@loopback/core");
|
10 | const keys_1 = require("../keys");
|
11 | const types_1 = require("../types");
|
12 | const base_artifact_booter_1 = require("./base-artifact.booter");
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | let RepositoryBooter = class RepositoryBooter extends base_artifact_booter_1.BaseArtifactBooter {
|
25 | constructor(app, projectRoot, repositoryOptions = {}) {
|
26 | super(projectRoot,
|
27 |
|
28 | Object.assign({}, exports.RepositoryDefaults, repositoryOptions));
|
29 | this.app = app;
|
30 | this.repositoryOptions = repositoryOptions;
|
31 | }
|
32 | |
33 |
|
34 |
|
35 |
|
36 | async load() {
|
37 | await super.load();
|
38 | |
39 |
|
40 |
|
41 |
|
42 |
|
43 | if (this.classes.length > 0) {
|
44 | if (!this.app.repository) {
|
45 | console.warn('app.repository() function is needed for RepositoryBooter. You can add ' +
|
46 | 'it to your Application using RepositoryMixin from @loopback/repository.');
|
47 | }
|
48 | else {
|
49 | this.classes.forEach(cls => {
|
50 | this.app.repository(cls);
|
51 | });
|
52 | }
|
53 | }
|
54 | }
|
55 | };
|
56 | RepositoryBooter = tslib_1.__decorate([
|
57 | (0, types_1.booter)('repositories'),
|
58 | tslib_1.__param(0, (0, core_1.inject)(core_1.CoreBindings.APPLICATION_INSTANCE)),
|
59 | tslib_1.__param(1, (0, core_1.inject)(keys_1.BootBindings.PROJECT_ROOT)),
|
60 | tslib_1.__param(2, (0, core_1.config)()),
|
61 | tslib_1.__metadata("design:paramtypes", [Object, String, Object])
|
62 | ], RepositoryBooter);
|
63 | exports.RepositoryBooter = RepositoryBooter;
|
64 |
|
65 |
|
66 |
|
67 | exports.RepositoryDefaults = {
|
68 | dirs: ['repositories'],
|
69 | extensions: ['.repository.js'],
|
70 | nested: true,
|
71 | };
|
72 |
|
\ | No newline at end of file |