quidproquo-webserver 0.0.52 → 0.0.54
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.
- package/lib/qpqWebServerUtils.d.ts +2 -1
- package/lib/qpqWebServerUtils.js +19 -10
- package/package.json +1 -1
|
@@ -16,7 +16,8 @@ export declare const getWebEntryFullPath: (qpqConfig: QPQConfig, webEntryQPQWebS
|
|
|
16
16
|
export declare const getWebEntrySeoFullPath: (qpqConfig: QPQConfig, webEntryQPQWebServerConfigSetting: WebEntryQPQWebServerConfigSetting) => string;
|
|
17
17
|
export declare const getApiEntryFullPath: (qpqConfig: QPQConfig, apiConfig: ApiQPQWebServerConfigSetting) => string;
|
|
18
18
|
export declare const getSubdomainRedirects: (configs: QPQConfig) => SubdomainRedirectQPQWebServerConfigSetting[];
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const getEnvironmentDomainName: (configs: QPQConfig) => string;
|
|
20
|
+
export declare const getBaseDomainName: (qpqConfig: QPQConfig) => string;
|
|
20
21
|
export declare const getServiceDomainName: (qpqConfig: QPQConfig) => string;
|
|
21
22
|
export declare const getHeaderValue: (header: string, headers: HttpEventHeaders) => string | null;
|
|
22
23
|
export declare const getAllowedOrigins: (configs: QPQConfig, route: RouteOptions) => string[];
|
package/lib/qpqWebServerUtils.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.toJsonEventResponse = exports.fromJsonEventRequest = exports.getCorsHeaders = exports.getAllowedOrigins = exports.getHeaderValue = exports.getServiceDomainName = exports.
|
|
26
|
+
exports.toJsonEventResponse = exports.fromJsonEventRequest = exports.getCorsHeaders = exports.getAllowedOrigins = exports.getHeaderValue = exports.getServiceDomainName = exports.getBaseDomainName = exports.getEnvironmentDomainName = exports.getSubdomainRedirects = exports.getApiEntryFullPath = exports.getWebEntrySeoFullPath = exports.getWebEntryFullPath = exports.getWebEntry = exports.getDomainName = exports.getAllSrcEntries = exports.getAllOpenApiSpecs = exports.getAllSeo = exports.getAllRoutes = void 0;
|
|
27
27
|
const path = __importStar(require("path"));
|
|
28
28
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
29
29
|
const QPQConfig_1 = require("./config/QPQConfig");
|
|
@@ -87,19 +87,28 @@ const getSubdomainRedirects = (configs) => {
|
|
|
87
87
|
return subdomainRedirects;
|
|
88
88
|
};
|
|
89
89
|
exports.getSubdomainRedirects = getSubdomainRedirects;
|
|
90
|
-
const
|
|
91
|
-
const
|
|
90
|
+
const getEnvironmentDomainName = (configs) => {
|
|
91
|
+
const environment = (0, qpqCoreUtils_1.getApplicationModuleEnvironment)(configs);
|
|
92
92
|
const apexDomainName = (0, exports.getDomainName)(configs);
|
|
93
|
-
if (
|
|
93
|
+
if (environment === 'production') {
|
|
94
94
|
return apexDomainName;
|
|
95
95
|
}
|
|
96
|
-
return `${
|
|
96
|
+
return `${environment}.${apexDomainName}`;
|
|
97
|
+
};
|
|
98
|
+
exports.getEnvironmentDomainName = getEnvironmentDomainName;
|
|
99
|
+
const getBaseDomainName = (qpqConfig) => {
|
|
100
|
+
const environmentDomain = (0, exports.getEnvironmentDomainName)(qpqConfig);
|
|
101
|
+
const feature = quidproquo_core_1.qpqCoreUtils.getApplicationModuleFeature(qpqConfig);
|
|
102
|
+
if (feature) {
|
|
103
|
+
return `${feature}.${environmentDomain}`;
|
|
104
|
+
}
|
|
105
|
+
return environmentDomain;
|
|
97
106
|
};
|
|
98
|
-
exports.
|
|
107
|
+
exports.getBaseDomainName = getBaseDomainName;
|
|
99
108
|
const getServiceDomainName = (qpqConfig) => {
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
return `${
|
|
109
|
+
const service = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
110
|
+
const domainBase = (0, exports.getBaseDomainName)(qpqConfig);
|
|
111
|
+
return `${service}.${domainBase}`;
|
|
103
112
|
};
|
|
104
113
|
exports.getServiceDomainName = getServiceDomainName;
|
|
105
114
|
const getHeaderValue = (header, headers) => {
|
|
@@ -113,7 +122,7 @@ const getHeaderValue = (header, headers) => {
|
|
|
113
122
|
exports.getHeaderValue = getHeaderValue;
|
|
114
123
|
const getAllowedOrigins = (configs, route) => {
|
|
115
124
|
// Root domain
|
|
116
|
-
const rootDomain = `https://${(0, exports.
|
|
125
|
+
const rootDomain = `https://${(0, exports.getBaseDomainName)(configs)}`;
|
|
117
126
|
// generic settings
|
|
118
127
|
const defaultRouteSettings = quidproquo_core_1.qpqCoreUtils.getConfigSettings(configs, QPQConfig_1.QPQWebServerConfigSettingType.DefaultRouteOptions) || [];
|
|
119
128
|
const defaultAllowedOrigins = defaultRouteSettings.reduce((acc, cur) => [...acc, ...(cur.routeOptions.allowedOrigins || [])], []);
|