1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | exports.InterceptorProviderDefaults = exports.InterceptorProviderBooter = 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 base_artifact_booter_1 = require("./base-artifact.booter");
|
14 | const debug = (0, debug_1.default)('loopback:boot:interceptor-booter');
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | let InterceptorProviderBooter = class InterceptorProviderBooter extends base_artifact_booter_1.BaseArtifactBooter {
|
25 | constructor(app, projectRoot, interceptorConfig = {}) {
|
26 | super(projectRoot,
|
27 |
|
28 | Object.assign({}, exports.InterceptorProviderDefaults, interceptorConfig));
|
29 | this.app = app;
|
30 | this.interceptorConfig = interceptorConfig;
|
31 | }
|
32 | |
33 |
|
34 |
|
35 |
|
36 | async load() {
|
37 | await super.load();
|
38 | this.interceptors = this.classes;
|
39 | for (const interceptor of this.interceptors) {
|
40 | debug('Bind interceptor: %s', interceptor.name);
|
41 | const binding = this.app.interceptor(interceptor);
|
42 | debug('Binding created for interceptor: %j', binding);
|
43 | }
|
44 | }
|
45 | };
|
46 | exports.InterceptorProviderBooter = InterceptorProviderBooter;
|
47 | exports.InterceptorProviderBooter = InterceptorProviderBooter = tslib_1.__decorate([
|
48 | (0, types_1.booter)('interceptors'),
|
49 | tslib_1.__param(0, (0, core_1.inject)(core_1.CoreBindings.APPLICATION_INSTANCE)),
|
50 | tslib_1.__param(1, (0, core_1.inject)(keys_1.BootBindings.PROJECT_ROOT)),
|
51 | tslib_1.__param(2, (0, core_1.config)()),
|
52 | tslib_1.__metadata("design:paramtypes", [core_1.Application, String, Object])
|
53 | ], InterceptorProviderBooter);
|
54 |
|
55 |
|
56 |
|
57 | exports.InterceptorProviderDefaults = {
|
58 | dirs: ['interceptors'],
|
59 | extensions: ['.interceptor.js'],
|
60 | nested: true,
|
61 | };
|
62 |
|
\ | No newline at end of file |