1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | const types_1 = __importDefault(require("../types"));
|
7 | const middleware_component_1 = require("../middleware/middleware-component");
|
8 | const webapp_component_1 = require("../webapp/webapp-component");
|
9 | const libs_1 = require("../libs");
|
10 | const iso_plugin_1 = require("./iso-plugin");
|
11 | const webapp_plugin_1 = require("../webapp/webapp-plugin");
|
12 | const environment_plugin_1 = require("../environment/environment-plugin");
|
13 | const datalayer_plugin_1 = require("../datalayer/datalayer-plugin");
|
14 | const identity_plugin_1 = require("../identity/identity-plugin");
|
15 | const authentication_plugin_1 = require("../authentication/authentication-plugin");
|
16 | const datalayer_component_1 = require("../datalayer/datalayer-component");
|
17 | const service_plugin_1 = require("../service/service-plugin");
|
18 | const service_component_1 = require("../service/service-component");
|
19 | exports.ISOMORPHIC_INSTANCE_TYPE = "IsomorphicComponent";
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | exports.default = (props) => {
|
26 |
|
27 | const infProps = {
|
28 |
|
29 | infrastructureType: types_1.default.INFRASTRUCTURE_TYPE_CONFIGURATION,
|
30 | instanceId: props.stackName,
|
31 | instanceType: exports.ISOMORPHIC_INSTANCE_TYPE,
|
32 |
|
33 | createPlugins: (configPath, stage, parserMode) => props.infrastructureMode === "COMPILATION" ? [
|
34 |
|
35 | iso_plugin_1.IsoPlugin({
|
36 | parserMode: parserMode,
|
37 | buildPath: props.buildPath,
|
38 | configFilePath: configPath
|
39 | }),
|
40 | datalayer_plugin_1.DataLayerPlugin({
|
41 | buildPath: props.buildPath,
|
42 | configFilePath: configPath,
|
43 | }),
|
44 |
|
45 | webapp_plugin_1.WebAppPlugin({
|
46 | parserMode: parserMode,
|
47 | buildPath: props.buildPath,
|
48 | configFilePath: configPath,
|
49 | assetsPath: props.assetsPath
|
50 | }),
|
51 | service_plugin_1.ServicePlugin({}),
|
52 |
|
53 | environment_plugin_1.EnvironmentPlugin({
|
54 | stage: stage,
|
55 | parserMode: parserMode
|
56 | }),
|
57 | identity_plugin_1.IdentityPlugin({}),
|
58 | authentication_plugin_1.AuthenticationPlugin({})
|
59 | ] : []
|
60 | };
|
61 | const isoProps = {
|
62 | middlewares: libs_1.findComponentRecursively(props.children, middleware_component_1.isMiddleware),
|
63 | webApps: libs_1.findComponentRecursively(props.children, webapp_component_1.isWebApp),
|
64 | services: libs_1.findComponentRecursively(props.children, service_component_1.isService),
|
65 | dataLayerId: libs_1.findComponentRecursively(props.children, datalayer_component_1.isDataLayer).reduce((res, dl) => res ? res : dl.id, undefined)
|
66 | };
|
67 |
|
68 | return Object.assign(props, infProps, isoProps);
|
69 | };
|
70 | function isIsomorphicApp(component) {
|
71 | return component !== undefined &&
|
72 | component.instanceType === exports.ISOMORPHIC_INSTANCE_TYPE;
|
73 | }
|
74 | exports.isIsomorphicApp = isIsomorphicApp;
|
75 |
|
\ | No newline at end of file |