quidproquo-webserver 0.0.85 → 0.0.86
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/actions/index.d.ts +1 -0
- package/lib/actions/index.js +1 -0
- package/lib/actions/serviceFunction/ServiceFunctionActionType.d.ts +3 -0
- package/lib/actions/serviceFunction/ServiceFunctionActionType.js +7 -0
- package/lib/actions/serviceFunction/ServiceFunctionExecuteActionRequester.d.ts +2 -0
- package/lib/actions/serviceFunction/ServiceFunctionExecuteActionRequester.js +15 -0
- package/lib/actions/serviceFunction/ServiceFunctionExecuteActionTypes.d.ts +13 -0
- package/lib/actions/serviceFunction/ServiceFunctionExecuteActionTypes.js +2 -0
- package/lib/actions/serviceFunction/index.d.ts +3 -0
- package/lib/actions/serviceFunction/index.js +19 -0
- package/lib/config/QPQConfig.d.ts +2 -1
- package/lib/config/QPQConfig.js +1 -0
- package/lib/config/settings/index.d.ts +1 -0
- package/lib/config/settings/index.js +1 -0
- package/lib/config/settings/serviceFunction.d.ts +11 -0
- package/lib/config/settings/serviceFunction.js +16 -0
- package/lib/types/ExecuteServiceFunctionEvent.d.ts +4 -0
- package/lib/types/ExecuteServiceFunctionEvent.js +2 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/utils/qpqConfigAccessorsUtils.d.ts +3 -1
- package/lib/utils/qpqConfigAccessorsUtils.js +15 -1
- package/package.json +1 -1
package/lib/actions/index.d.ts
CHANGED
package/lib/actions/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./genericDataResource"), exports);
|
|
18
18
|
__exportStar(require("./openApiSpec"), exports);
|
|
19
|
+
__exportStar(require("./serviceFunction"), exports);
|
|
19
20
|
__exportStar(require("./webEntry"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceFunctionActionType = void 0;
|
|
4
|
+
var ServiceFunctionActionType;
|
|
5
|
+
(function (ServiceFunctionActionType) {
|
|
6
|
+
ServiceFunctionActionType["Execute"] = "@quidproquo-webserver/ServiceFunction/Execute";
|
|
7
|
+
})(ServiceFunctionActionType = exports.ServiceFunctionActionType || (exports.ServiceFunctionActionType = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askServiceFunctionExecute = void 0;
|
|
4
|
+
const ServiceFunctionActionType_1 = require("./ServiceFunctionActionType");
|
|
5
|
+
function* askServiceFunctionExecute(service, functionName, payload) {
|
|
6
|
+
return yield {
|
|
7
|
+
type: ServiceFunctionActionType_1.ServiceFunctionActionType.Execute,
|
|
8
|
+
payload: {
|
|
9
|
+
functionName,
|
|
10
|
+
service,
|
|
11
|
+
payload,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.askServiceFunctionExecute = askServiceFunctionExecute;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Action, ActionProcessor, ActionRequester } from 'quidproquo-core';
|
|
2
|
+
import { ServiceFunctionActionType } from './ServiceFunctionActionType';
|
|
3
|
+
export interface ServiceFunctionExecuteActionPayload<T> {
|
|
4
|
+
service: string;
|
|
5
|
+
functionName: string;
|
|
6
|
+
payload: T;
|
|
7
|
+
}
|
|
8
|
+
export interface ServiceFunctionExecuteAction<T> extends Action<ServiceFunctionExecuteActionPayload<T>> {
|
|
9
|
+
type: ServiceFunctionActionType.Execute;
|
|
10
|
+
payload: ServiceFunctionExecuteActionPayload<T>;
|
|
11
|
+
}
|
|
12
|
+
export type ServiceFunctionExecuteActionProcessor<R, T> = ActionProcessor<ServiceFunctionExecuteAction<T>, R>;
|
|
13
|
+
export type ServiceFunctionExecuteActionRequester<R, T> = ActionRequester<ServiceFunctionExecuteAction<T>, R>;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ServiceFunctionActionType"), exports);
|
|
18
|
+
__exportStar(require("./ServiceFunctionExecuteActionRequester"), exports);
|
|
19
|
+
__exportStar(require("./ServiceFunctionExecuteActionTypes"), exports);
|
|
@@ -7,7 +7,8 @@ export declare enum QPQWebServerConfigSettingType {
|
|
|
7
7
|
SubdomainRedirect = "@quidproquo-webserver/config/SubdomainRedirect",
|
|
8
8
|
WebEntry = "@quidproquo-webserver/config/WebEntry",
|
|
9
9
|
Api = "@quidproquo-webserver/config/Api",
|
|
10
|
-
ApiKey = "@quidproquo-webserver/config/ApiKey"
|
|
10
|
+
ApiKey = "@quidproquo-webserver/config/ApiKey",
|
|
11
|
+
ServiceFunction = "@quidproquo-webserver/config/ServiceFunction"
|
|
11
12
|
}
|
|
12
13
|
export interface CacheSettings {
|
|
13
14
|
minTTLInSeconds: number;
|
package/lib/config/QPQConfig.js
CHANGED
|
@@ -12,4 +12,5 @@ var QPQWebServerConfigSettingType;
|
|
|
12
12
|
QPQWebServerConfigSettingType["WebEntry"] = "@quidproquo-webserver/config/WebEntry";
|
|
13
13
|
QPQWebServerConfigSettingType["Api"] = "@quidproquo-webserver/config/Api";
|
|
14
14
|
QPQWebServerConfigSettingType["ApiKey"] = "@quidproquo-webserver/config/ApiKey";
|
|
15
|
+
QPQWebServerConfigSettingType["ServiceFunction"] = "@quidproquo-webserver/config/ServiceFunction";
|
|
15
16
|
})(QPQWebServerConfigSettingType = exports.QPQWebServerConfigSettingType || (exports.QPQWebServerConfigSettingType = {}));
|
|
@@ -18,6 +18,7 @@ __exportStar(require("./api"), exports);
|
|
|
18
18
|
__exportStar(require("./apiKey"), exports);
|
|
19
19
|
__exportStar(require("./defaultRouteOptions"), exports);
|
|
20
20
|
__exportStar(require("./dns"), exports);
|
|
21
|
+
__exportStar(require("./serviceFunction"), exports);
|
|
21
22
|
__exportStar(require("./openApi"), exports);
|
|
22
23
|
__exportStar(require("./route"), exports);
|
|
23
24
|
__exportStar(require("./seo"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { QPQConfigSetting, QPQConfigAdvancedSettings } from 'quidproquo-core';
|
|
2
|
+
export interface QPQConfigAdvancedServiceFunctionSettings extends QPQConfigAdvancedSettings {
|
|
3
|
+
functionName?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ServiceFunctionQPQWebServerConfigSetting extends QPQConfigSetting {
|
|
6
|
+
src: string;
|
|
7
|
+
runtime: string;
|
|
8
|
+
buildPath: string;
|
|
9
|
+
functionName: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const defineServiceFunction: (buildPath: string, src: string, runtime: string, options?: QPQConfigAdvancedServiceFunctionSettings) => ServiceFunctionQPQWebServerConfigSetting;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineServiceFunction = void 0;
|
|
4
|
+
const QPQConfig_1 = require("../QPQConfig");
|
|
5
|
+
const defineServiceFunction = (buildPath, src, runtime, options) => {
|
|
6
|
+
const functionName = (options === null || options === void 0 ? void 0 : options.functionName) || runtime;
|
|
7
|
+
return {
|
|
8
|
+
configSettingType: QPQConfig_1.QPQWebServerConfigSettingType.ServiceFunction,
|
|
9
|
+
uniqueKey: functionName,
|
|
10
|
+
buildPath,
|
|
11
|
+
src,
|
|
12
|
+
runtime,
|
|
13
|
+
functionName: functionName,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.defineServiceFunction = defineServiceFunction;
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./HTTPEvent"), exports);
|
|
18
|
+
__exportStar(require("./ExecuteServiceFunctionEvent"), exports);
|
|
18
19
|
__exportStar(require("./QueueEvent"), exports);
|
|
19
20
|
__exportStar(require("./SEOEvent"), exports);
|
|
20
21
|
__exportStar(require("./constants"), exports);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
-
import { ApiKeyQPQWebServerConfigSetting, RouteQPQWebServerConfigSetting, DnsQPQWebServerConfigSetting, SeoQPQWebServerConfigSetting, SubdomainRedirectQPQWebServerConfigSetting, OpenApiQPQWebServerConfigSetting, DefaultRouteOptionsQPQWebServerConfigSetting } from '../config';
|
|
2
|
+
import { ApiKeyQPQWebServerConfigSetting, RouteQPQWebServerConfigSetting, DnsQPQWebServerConfigSetting, SeoQPQWebServerConfigSetting, SubdomainRedirectQPQWebServerConfigSetting, OpenApiQPQWebServerConfigSetting, DefaultRouteOptionsQPQWebServerConfigSetting, ServiceFunctionQPQWebServerConfigSetting } from '../config';
|
|
3
3
|
import { WebEntryQPQWebServerConfigSetting, ApiQPQWebServerConfigSetting } from '../config';
|
|
4
4
|
export declare const getAllRoutes: (qpqConfig: QPQConfig) => RouteQPQWebServerConfigSetting[];
|
|
5
5
|
export declare const getAllRoutesForApi: (apiName: string, qpqConfig: QPQConfig) => RouteQPQWebServerConfigSetting[];
|
|
6
6
|
export declare const getAllApiKeyConfigs: (qpqConfig: QPQConfig) => ApiKeyQPQWebServerConfigSetting[];
|
|
7
7
|
export declare const getAllSeo: (qpqConfig: QPQConfig) => SeoQPQWebServerConfigSetting[];
|
|
8
|
+
export declare const getAllServiceFunctions: (qpqConfig: QPQConfig) => ServiceFunctionQPQWebServerConfigSetting[];
|
|
8
9
|
export declare const getAllOpenApiSpecs: (configs: QPQConfig) => OpenApiQPQWebServerConfigSetting[];
|
|
9
10
|
export declare const getAllSrcEntries: (configs: QPQConfig) => string[];
|
|
10
11
|
export declare const getDomainName: (configs: QPQConfig) => string;
|
|
@@ -12,6 +13,7 @@ export declare const getWebEntry: (configs: QPQConfig) => string;
|
|
|
12
13
|
export declare const getWebEntryFullPath: (qpqConfig: QPQConfig, webEntryQPQWebServerConfigSetting: WebEntryQPQWebServerConfigSetting) => string;
|
|
13
14
|
export declare const getWebEntrySeoFullPath: (qpqConfig: QPQConfig, webEntryQPQWebServerConfigSetting: WebEntryQPQWebServerConfigSetting) => string;
|
|
14
15
|
export declare const getApiEntryFullPath: (qpqConfig: QPQConfig, apiConfig: ApiQPQWebServerConfigSetting) => string;
|
|
16
|
+
export declare const getServiceFunctionFullPath: (qpqConfig: QPQConfig, serviceFunctionConfig: ServiceFunctionQPQWebServerConfigSetting) => string;
|
|
15
17
|
export declare const getRedirectApiBuildFullPath: (qpqConfig: QPQConfig, redirectConfig: SubdomainRedirectQPQWebServerConfigSetting) => string;
|
|
16
18
|
export declare const getSubdomainRedirects: (configs: QPQConfig) => SubdomainRedirectQPQWebServerConfigSetting[];
|
|
17
19
|
export declare const getApiConfigs: (configs: QPQConfig) => ApiQPQWebServerConfigSetting[];
|
|
@@ -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.getDefaultRouteSettings = exports.getServiceDomainName = exports.getBaseDomainName = exports.getEnvironmentDomainName = exports.getWebEntryConfigs = exports.getDnsConfigs = exports.getApiConfigs = exports.getSubdomainRedirects = exports.getRedirectApiBuildFullPath = exports.getApiEntryFullPath = exports.getWebEntrySeoFullPath = exports.getWebEntryFullPath = exports.getWebEntry = exports.getDomainName = exports.getAllSrcEntries = exports.getAllOpenApiSpecs = exports.getAllSeo = exports.getAllApiKeyConfigs = exports.getAllRoutesForApi = exports.getAllRoutes = void 0;
|
|
26
|
+
exports.getDefaultRouteSettings = exports.getServiceDomainName = exports.getBaseDomainName = exports.getEnvironmentDomainName = exports.getWebEntryConfigs = exports.getDnsConfigs = exports.getApiConfigs = exports.getSubdomainRedirects = exports.getRedirectApiBuildFullPath = exports.getServiceFunctionFullPath = exports.getApiEntryFullPath = exports.getWebEntrySeoFullPath = exports.getWebEntryFullPath = exports.getWebEntry = exports.getDomainName = exports.getAllSrcEntries = exports.getAllOpenApiSpecs = exports.getAllServiceFunctions = exports.getAllSeo = exports.getAllApiKeyConfigs = exports.getAllRoutesForApi = exports.getAllRoutes = void 0;
|
|
27
27
|
const path = __importStar(require("path"));
|
|
28
28
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
29
29
|
const config_1 = require("../config");
|
|
@@ -47,6 +47,11 @@ const getAllSeo = (qpqConfig) => {
|
|
|
47
47
|
return seoConfigs;
|
|
48
48
|
};
|
|
49
49
|
exports.getAllSeo = getAllSeo;
|
|
50
|
+
const getAllServiceFunctions = (qpqConfig) => {
|
|
51
|
+
const serviceFunctions = quidproquo_core_1.qpqCoreUtils.getConfigSettings(qpqConfig, config_1.QPQWebServerConfigSettingType.ServiceFunction);
|
|
52
|
+
return serviceFunctions;
|
|
53
|
+
};
|
|
54
|
+
exports.getAllServiceFunctions = getAllServiceFunctions;
|
|
50
55
|
const getAllOpenApiSpecs = (configs) => {
|
|
51
56
|
const openApiSpecs = quidproquo_core_1.qpqCoreUtils.getConfigSettings(configs, config_1.QPQWebServerConfigSettingType.OpenApi);
|
|
52
57
|
return openApiSpecs;
|
|
@@ -59,6 +64,7 @@ const getAllSrcEntries = (configs) => {
|
|
|
59
64
|
...(0, exports.getAllRoutes)(configs).map((r) => r.src),
|
|
60
65
|
...(0, exports.getAllOpenApiSpecs)(configs).map((r) => r.openApiSpecPath),
|
|
61
66
|
...(0, exports.getAllSeo)(configs).map((seo) => seo.src),
|
|
67
|
+
...(0, exports.getAllServiceFunctions)(configs).map((sf) => sf.src),
|
|
62
68
|
];
|
|
63
69
|
};
|
|
64
70
|
exports.getAllSrcEntries = getAllSrcEntries;
|
|
@@ -93,6 +99,14 @@ const getApiEntryFullPath = (qpqConfig, apiConfig) => {
|
|
|
93
99
|
return path.join(quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig), apiEntry);
|
|
94
100
|
};
|
|
95
101
|
exports.getApiEntryFullPath = getApiEntryFullPath;
|
|
102
|
+
const getServiceFunctionFullPath = (qpqConfig, serviceFunctionConfig) => {
|
|
103
|
+
const buildPath = serviceFunctionConfig.buildPath;
|
|
104
|
+
if (!buildPath) {
|
|
105
|
+
throw new Error('please use defineWebEntry in your qpq config');
|
|
106
|
+
}
|
|
107
|
+
return path.join(quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig), buildPath);
|
|
108
|
+
};
|
|
109
|
+
exports.getServiceFunctionFullPath = getServiceFunctionFullPath;
|
|
96
110
|
const getRedirectApiBuildFullPath = (qpqConfig, redirectConfig) => {
|
|
97
111
|
const apiEntry = redirectConfig.apiBuildPath;
|
|
98
112
|
return path.join(quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig), apiEntry);
|