quidproquo-webserver 0.0.51 → 0.0.52
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/config/QPQConfig.d.ts +3 -2
- package/lib/config/QPQConfig.js +2 -1
- package/lib/config/settings/api.d.ts +12 -0
- package/lib/config/settings/api.js +16 -0
- package/lib/config/settings/defaultRouteOptions.d.ts +1 -1
- package/lib/config/settings/defaultRouteOptions.js +2 -1
- package/lib/config/settings/dns.d.ts +1 -1
- package/lib/config/settings/dns.js +1 -0
- package/lib/config/settings/index.d.ts +2 -1
- package/lib/config/settings/index.js +2 -1
- package/lib/config/settings/openApi.js +1 -0
- package/lib/config/settings/route.js +1 -0
- package/lib/config/settings/seo.js +1 -0
- package/lib/config/settings/subdomainRedirect.js +1 -0
- package/lib/config/settings/webEntry.d.ts +7 -0
- package/lib/config/settings/webEntry.js +12 -0
- package/lib/qpqWebServerUtils.d.ts +6 -1
- package/lib/qpqWebServerUtils.js +55 -7
- package/package.json +1 -1
- package/lib/config/settings/deployRegion.d.ts +0 -5
- package/lib/config/settings/deployRegion.js +0 -11
|
@@ -4,6 +4,7 @@ export declare enum QPQWebServerConfigSettingType {
|
|
|
4
4
|
Dns = "@quidproquo-webserver/config/Dns",
|
|
5
5
|
OpenApi = "@quidproquo-webserver/config/OpenApi",
|
|
6
6
|
Seo = "@quidproquo-webserver/config/Seo",
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
SubdomainRedirect = "@quidproquo-webserver/config/SubdomainRedirect",
|
|
8
|
+
WebEntry = "@quidproquo-webserver/config/WebEntry",
|
|
9
|
+
Api = "@quidproquo-webserver/config/Api"
|
|
9
10
|
}
|
package/lib/config/QPQConfig.js
CHANGED
|
@@ -8,6 +8,7 @@ var QPQWebServerConfigSettingType;
|
|
|
8
8
|
QPQWebServerConfigSettingType["Dns"] = "@quidproquo-webserver/config/Dns";
|
|
9
9
|
QPQWebServerConfigSettingType["OpenApi"] = "@quidproquo-webserver/config/OpenApi";
|
|
10
10
|
QPQWebServerConfigSettingType["Seo"] = "@quidproquo-webserver/config/Seo";
|
|
11
|
-
QPQWebServerConfigSettingType["DeployRegion"] = "@quidproquo-webserver/config/DeployRegion";
|
|
12
11
|
QPQWebServerConfigSettingType["SubdomainRedirect"] = "@quidproquo-webserver/config/SubdomainRedirect";
|
|
12
|
+
QPQWebServerConfigSettingType["WebEntry"] = "@quidproquo-webserver/config/WebEntry";
|
|
13
|
+
QPQWebServerConfigSettingType["Api"] = "@quidproquo-webserver/config/Api";
|
|
13
14
|
})(QPQWebServerConfigSettingType = exports.QPQWebServerConfigSettingType || (exports.QPQWebServerConfigSettingType = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QPQConfigSetting, QPQConfigAdvancedSettings } from 'quidproquo-core';
|
|
2
|
+
export interface QPQConfigAdvancedApiSettings extends QPQConfigAdvancedSettings {
|
|
3
|
+
onRootDomain?: boolean;
|
|
4
|
+
apiName?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ApiQPQWebServerConfigSetting extends QPQConfigSetting {
|
|
7
|
+
apiSubdomain: string;
|
|
8
|
+
onRootDomain: boolean;
|
|
9
|
+
apiName: string;
|
|
10
|
+
buildPath: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const defineApi: (apiSubdomain: string, buildPath: string, options?: QPQConfigAdvancedApiSettings) => ApiQPQWebServerConfigSetting;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineApi = void 0;
|
|
4
|
+
const QPQConfig_1 = require("../QPQConfig");
|
|
5
|
+
const defineApi = (apiSubdomain, buildPath, options) => {
|
|
6
|
+
return {
|
|
7
|
+
configSettingType: QPQConfig_1.QPQWebServerConfigSettingType.Api,
|
|
8
|
+
uniqueKey: apiSubdomain,
|
|
9
|
+
apiSubdomain,
|
|
10
|
+
buildPath,
|
|
11
|
+
// advanced
|
|
12
|
+
onRootDomain: (options === null || options === void 0 ? void 0 : options.onRootDomain) || false,
|
|
13
|
+
apiName: (options === null || options === void 0 ? void 0 : options.apiName) || 'api',
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.defineApi = defineApi;
|
|
@@ -3,4 +3,4 @@ import { RouteOptions } from './route';
|
|
|
3
3
|
export interface DefaultRouteOptionsQPQWebServerConfigSetting extends QPQConfigSetting {
|
|
4
4
|
routeOptions: RouteOptions;
|
|
5
5
|
}
|
|
6
|
-
export declare const defineDefaultRouteOptions: (routeOptions: RouteOptions) => DefaultRouteOptionsQPQWebServerConfigSetting;
|
|
6
|
+
export declare const defineDefaultRouteOptions: (groupName: string, routeOptions: RouteOptions) => DefaultRouteOptionsQPQWebServerConfigSetting;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineDefaultRouteOptions = void 0;
|
|
4
4
|
const QPQConfig_1 = require("../QPQConfig");
|
|
5
|
-
const defineDefaultRouteOptions = (routeOptions) => ({
|
|
5
|
+
const defineDefaultRouteOptions = (groupName, routeOptions) => ({
|
|
6
6
|
configSettingType: QPQConfig_1.QPQWebServerConfigSettingType.DefaultRouteOptions,
|
|
7
|
+
uniqueKey: groupName,
|
|
7
8
|
routeOptions,
|
|
8
9
|
});
|
|
9
10
|
exports.defineDefaultRouteOptions = defineDefaultRouteOptions;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export * from './api';
|
|
1
2
|
export * from './defaultRouteOptions';
|
|
2
|
-
export * from './deployRegion';
|
|
3
3
|
export * from './dns';
|
|
4
4
|
export * from './openApi';
|
|
5
5
|
export * from './route';
|
|
6
6
|
export * from './seo';
|
|
7
7
|
export * from './subdomainRedirect';
|
|
8
|
+
export * from './webEntry';
|
|
@@ -14,10 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api"), exports);
|
|
17
18
|
__exportStar(require("./defaultRouteOptions"), exports);
|
|
18
|
-
__exportStar(require("./deployRegion"), exports);
|
|
19
19
|
__exportStar(require("./dns"), exports);
|
|
20
20
|
__exportStar(require("./openApi"), exports);
|
|
21
21
|
__exportStar(require("./route"), exports);
|
|
22
22
|
__exportStar(require("./seo"), exports);
|
|
23
23
|
__exportStar(require("./subdomainRedirect"), exports);
|
|
24
|
+
__exportStar(require("./webEntry"), exports);
|
|
@@ -4,6 +4,7 @@ exports.defineSubdomainRedirect = void 0;
|
|
|
4
4
|
const QPQConfig_1 = require("../QPQConfig");
|
|
5
5
|
const defineSubdomainRedirect = (subdomain, redirectUrl, addFeatureEnvironment = false) => ({
|
|
6
6
|
configSettingType: QPQConfig_1.QPQWebServerConfigSettingType.SubdomainRedirect,
|
|
7
|
+
uniqueKey: subdomain,
|
|
7
8
|
subdomain,
|
|
8
9
|
redirectUrl,
|
|
9
10
|
addFeatureEnvironment,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QPQConfigSetting } from 'quidproquo-core';
|
|
2
|
+
export interface WebEntryQPQWebServerConfigSetting extends QPQConfigSetting {
|
|
3
|
+
name: string;
|
|
4
|
+
buildPath: string;
|
|
5
|
+
seoBuildPath?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const defineWebEntry: (name: string, buildPath: string, seoBuildPath?: string) => WebEntryQPQWebServerConfigSetting;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineWebEntry = void 0;
|
|
4
|
+
const QPQConfig_1 = require("../QPQConfig");
|
|
5
|
+
const defineWebEntry = (name, buildPath, seoBuildPath) => ({
|
|
6
|
+
configSettingType: QPQConfig_1.QPQWebServerConfigSettingType.WebEntry,
|
|
7
|
+
uniqueKey: name,
|
|
8
|
+
name,
|
|
9
|
+
buildPath,
|
|
10
|
+
seoBuildPath,
|
|
11
|
+
});
|
|
12
|
+
exports.defineWebEntry = defineWebEntry;
|
|
@@ -5,14 +5,19 @@ import { SubdomainRedirectQPQWebServerConfigSetting } from './config/settings/su
|
|
|
5
5
|
import { OpenApiQPQWebServerConfigSetting } from './config/settings/openApi';
|
|
6
6
|
import { HttpEventHeaders, HTTPEventParams, HTTPEventResponse } from './types/HTTPEvent';
|
|
7
7
|
import { RouteOptions } from './config/settings/route';
|
|
8
|
+
import { WebEntryQPQWebServerConfigSetting, ApiQPQWebServerConfigSetting } from './config';
|
|
8
9
|
export declare const getAllRoutes: (configs: QPQConfig) => RouteQPQWebServerConfigSetting[];
|
|
9
10
|
export declare const getAllSeo: (configs: QPQConfig) => SeoQPQWebServerConfigSetting[];
|
|
10
|
-
export declare const getDeployRegion: (configs: QPQConfig) => string;
|
|
11
11
|
export declare const getAllOpenApiSpecs: (configs: QPQConfig) => OpenApiQPQWebServerConfigSetting[];
|
|
12
12
|
export declare const getAllSrcEntries: (configs: QPQConfig) => string[];
|
|
13
13
|
export declare const getDomainName: (configs: QPQConfig) => string;
|
|
14
|
+
export declare const getWebEntry: (configs: QPQConfig) => string;
|
|
15
|
+
export declare const getWebEntryFullPath: (qpqConfig: QPQConfig, webEntryQPQWebServerConfigSetting: WebEntryQPQWebServerConfigSetting) => string;
|
|
16
|
+
export declare const getWebEntrySeoFullPath: (qpqConfig: QPQConfig, webEntryQPQWebServerConfigSetting: WebEntryQPQWebServerConfigSetting) => string;
|
|
17
|
+
export declare const getApiEntryFullPath: (qpqConfig: QPQConfig, apiConfig: ApiQPQWebServerConfigSetting) => string;
|
|
14
18
|
export declare const getSubdomainRedirects: (configs: QPQConfig) => SubdomainRedirectQPQWebServerConfigSetting[];
|
|
15
19
|
export declare const getFeatureDomainName: (configs: QPQConfig) => string;
|
|
20
|
+
export declare const getServiceDomainName: (qpqConfig: QPQConfig) => string;
|
|
16
21
|
export declare const getHeaderValue: (header: string, headers: HttpEventHeaders) => string | null;
|
|
17
22
|
export declare const getAllowedOrigins: (configs: QPQConfig, route: RouteOptions) => string[];
|
|
18
23
|
export declare const getCorsHeaders: (configs: QPQConfig, route: RouteOptions, reqHeaders: HttpEventHeaders) => HttpEventHeaders;
|
package/lib/qpqWebServerUtils.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toJsonEventResponse = exports.fromJsonEventRequest = exports.getCorsHeaders = exports.getAllowedOrigins = exports.getHeaderValue = exports.getFeatureDomainName = exports.getSubdomainRedirects = exports.
|
|
26
|
+
exports.toJsonEventResponse = exports.fromJsonEventRequest = exports.getCorsHeaders = exports.getAllowedOrigins = exports.getHeaderValue = exports.getServiceDomainName = exports.getFeatureDomainName = exports.getSubdomainRedirects = exports.getApiEntryFullPath = exports.getWebEntrySeoFullPath = exports.getWebEntryFullPath = exports.getWebEntry = exports.getDomainName = exports.getAllSrcEntries = exports.getAllOpenApiSpecs = exports.getAllSeo = exports.getAllRoutes = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
4
28
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
29
|
const QPQConfig_1 = require("./config/QPQConfig");
|
|
6
30
|
const qpqCoreUtils_1 = require("quidproquo-core/lib/qpqCoreUtils");
|
|
@@ -14,12 +38,6 @@ const getAllSeo = (configs) => {
|
|
|
14
38
|
return seoConfigs;
|
|
15
39
|
};
|
|
16
40
|
exports.getAllSeo = getAllSeo;
|
|
17
|
-
const getDeployRegion = (configs) => {
|
|
18
|
-
var _a;
|
|
19
|
-
const deployRegions = quidproquo_core_1.qpqCoreUtils.getConfigSettings(configs, QPQConfig_1.QPQWebServerConfigSettingType.DeployRegion);
|
|
20
|
-
return ((_a = deployRegions[0]) === null || _a === void 0 ? void 0 : _a.deployRegion) || 'ap-southeast-2';
|
|
21
|
-
};
|
|
22
|
-
exports.getDeployRegion = getDeployRegion;
|
|
23
41
|
const getAllOpenApiSpecs = (configs) => {
|
|
24
42
|
const openApiSpecs = quidproquo_core_1.qpqCoreUtils.getConfigSettings(configs, QPQConfig_1.QPQWebServerConfigSettingType.OpenApi);
|
|
25
43
|
return openApiSpecs;
|
|
@@ -40,6 +58,30 @@ const getDomainName = (configs) => {
|
|
|
40
58
|
return (dnsSettings === null || dnsSettings === void 0 ? void 0 : dnsSettings.dnsBase) || '';
|
|
41
59
|
};
|
|
42
60
|
exports.getDomainName = getDomainName;
|
|
61
|
+
const getWebEntry = (configs) => {
|
|
62
|
+
const webEntry = quidproquo_core_1.qpqCoreUtils.getConfigSetting(configs, QPQConfig_1.QPQWebServerConfigSettingType.WebEntry);
|
|
63
|
+
if (!(webEntry === null || webEntry === void 0 ? void 0 : webEntry.buildPath)) {
|
|
64
|
+
throw new Error('please use defineWebEntry in your qpq config');
|
|
65
|
+
}
|
|
66
|
+
return webEntry === null || webEntry === void 0 ? void 0 : webEntry.buildPath;
|
|
67
|
+
};
|
|
68
|
+
exports.getWebEntry = getWebEntry;
|
|
69
|
+
const getWebEntryFullPath = (qpqConfig, webEntryQPQWebServerConfigSetting) => {
|
|
70
|
+
return path.join(quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig), webEntryQPQWebServerConfigSetting.buildPath);
|
|
71
|
+
};
|
|
72
|
+
exports.getWebEntryFullPath = getWebEntryFullPath;
|
|
73
|
+
const getWebEntrySeoFullPath = (qpqConfig, webEntryQPQWebServerConfigSetting) => {
|
|
74
|
+
return path.join(quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig), webEntryQPQWebServerConfigSetting.seoBuildPath || webEntryQPQWebServerConfigSetting.buildPath);
|
|
75
|
+
};
|
|
76
|
+
exports.getWebEntrySeoFullPath = getWebEntrySeoFullPath;
|
|
77
|
+
const getApiEntryFullPath = (qpqConfig, apiConfig) => {
|
|
78
|
+
const apiEntry = apiConfig.buildPath;
|
|
79
|
+
if (!apiEntry) {
|
|
80
|
+
throw new Error('please use defineWebEntry in your qpq config');
|
|
81
|
+
}
|
|
82
|
+
return path.join(quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig), apiEntry);
|
|
83
|
+
};
|
|
84
|
+
exports.getApiEntryFullPath = getApiEntryFullPath;
|
|
43
85
|
const getSubdomainRedirects = (configs) => {
|
|
44
86
|
const subdomainRedirects = quidproquo_core_1.qpqCoreUtils.getConfigSettings(configs, QPQConfig_1.QPQWebServerConfigSettingType.SubdomainRedirect);
|
|
45
87
|
return subdomainRedirects;
|
|
@@ -54,6 +96,12 @@ const getFeatureDomainName = (configs) => {
|
|
|
54
96
|
return `${feature}.${apexDomainName}`;
|
|
55
97
|
};
|
|
56
98
|
exports.getFeatureDomainName = getFeatureDomainName;
|
|
99
|
+
const getServiceDomainName = (qpqConfig) => {
|
|
100
|
+
const appName = quidproquo_core_1.qpqCoreUtils.getAppName(qpqConfig);
|
|
101
|
+
const featureDomain = (0, exports.getFeatureDomainName)(qpqConfig);
|
|
102
|
+
return `${appName}.${featureDomain}`;
|
|
103
|
+
};
|
|
104
|
+
exports.getServiceDomainName = getServiceDomainName;
|
|
57
105
|
const getHeaderValue = (header, headers) => {
|
|
58
106
|
const headerAsLower = header.toLowerCase();
|
|
59
107
|
const realHeaderKey = Object.keys(headers).find((k) => k.toLowerCase() === headerAsLower);
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineDeployRegion = void 0;
|
|
4
|
-
const QPQConfig_1 = require("../QPQConfig");
|
|
5
|
-
const defineDeployRegion = (deployRegion) => {
|
|
6
|
-
return {
|
|
7
|
-
configSettingType: QPQConfig_1.QPQWebServerConfigSettingType.DeployRegion,
|
|
8
|
-
deployRegion,
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
exports.defineDeployRegion = defineDeployRegion;
|