1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | exports.mountComponent = void 0;
|
8 | const context_1 = require("@loopback/context");
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | function mountComponent(app, component) {
|
16 | if (component.classes) {
|
17 | for (const classKey in component.classes) {
|
18 | const binding = (0, context_1.createBindingFromClass)(component.classes[classKey], {
|
19 | key: classKey,
|
20 | });
|
21 | app.add(binding);
|
22 | }
|
23 | }
|
24 | if (component.providers) {
|
25 | for (const providerKey in component.providers) {
|
26 | const binding = (0, context_1.createBindingFromClass)(component.providers[providerKey], {
|
27 | key: providerKey,
|
28 | });
|
29 | app.add(binding);
|
30 | }
|
31 | }
|
32 | if (component.bindings) {
|
33 | for (const binding of component.bindings) {
|
34 | app.add(binding);
|
35 | }
|
36 | }
|
37 | if (component.controllers) {
|
38 | for (const controllerCtor of component.controllers) {
|
39 | app.controller(controllerCtor);
|
40 | }
|
41 | }
|
42 | if (component.servers) {
|
43 | for (const serverKey in component.servers) {
|
44 | app.server(component.servers[serverKey], serverKey);
|
45 | }
|
46 | }
|
47 | if (component.lifeCycleObservers) {
|
48 | for (const observer of component.lifeCycleObservers) {
|
49 | app.lifeCycleObserver(observer);
|
50 | }
|
51 | }
|
52 | if (component.services) {
|
53 | for (const service of component.services) {
|
54 | app.service(service);
|
55 | }
|
56 | }
|
57 | }
|
58 | exports.mountComponent = mountComponent;
|
59 |
|
\ | No newline at end of file |