quidproquo-dev-server 0.0.249 → 0.0.251
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/commonjs/implementations/apiImplementation.js +4 -1
- package/lib/commonjs/implementations/queueImplementation.js +1 -1
- package/lib/commonjs/implementations/serviceFunctionImplementation.js +1 -1
- package/lib/commonjs/implementations/webSocket/webSocketImplementation.js +4 -1
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +1 -0
- package/lib/commonjs/logic/processEvent.d.ts +2 -2
- package/lib/commonjs/logic/processEvent.js +4 -6
- package/lib/commonjs/main.d.ts +4 -2
- package/lib/commonjs/main.js +23 -7
- package/lib/commonjs/types/DevServerConfig.d.ts +6 -0
- package/lib/esm/implementations/apiImplementation.js +4 -1
- package/lib/esm/implementations/queueImplementation.js +1 -1
- package/lib/esm/implementations/serviceFunctionImplementation.js +1 -1
- package/lib/esm/implementations/webSocket/webSocketImplementation.js +4 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/logic/processEvent.d.ts +2 -2
- package/lib/esm/logic/processEvent.js +5 -5
- package/lib/esm/main.d.ts +4 -2
- package/lib/esm/main.js +24 -6
- package/lib/esm/types/DevServerConfig.d.ts +6 -0
- package/package.json +6 -6
|
@@ -119,7 +119,10 @@ const apiImplementation = (devServerConfig) => __awaiter(void 0, void 0, void 0,
|
|
|
119
119
|
mimetype: file.mimetype,
|
|
120
120
|
}));
|
|
121
121
|
}
|
|
122
|
-
const response = yield (0, logic_1.processEvent)(event, apiConfig.qpqConfig, getDynamicModuleLoader(apiConfig.qpqConfig, devServerConfig), actionProcessor_1.getExpressApiEventEventProcessor, quidproquo_core_1.QpqRuntimeType.API)
|
|
122
|
+
const response = yield (0, logic_1.processEvent)(event, apiConfig.qpqConfig, getDynamicModuleLoader(apiConfig.qpqConfig, devServerConfig), actionProcessor_1.getExpressApiEventEventProcessor, quidproquo_core_1.QpqRuntimeType.API, () => ({
|
|
123
|
+
depth: 0,
|
|
124
|
+
context: {},
|
|
125
|
+
}));
|
|
123
126
|
if (response.result) {
|
|
124
127
|
for (const [header, value] of Object.entries(response.result.headers)) {
|
|
125
128
|
res.set(header, value);
|
|
@@ -32,7 +32,7 @@ const processQueueMessages = (qpqConfig, payload, devServerConfig) => __awaiter(
|
|
|
32
32
|
if ((!!payload.targetFeature || !!feature) && payload.targetFeature !== feature) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
yield (0, logic_1.processEvent)(payload, qpqConfig, getDynamicModuleLoader(qpqConfig, devServerConfig), queue_1.getQueueEventProcessor, quidproquo_core_1.QpqRuntimeType.QUEUE_EVENT);
|
|
35
|
+
yield (0, logic_1.processEvent)(payload, qpqConfig, getDynamicModuleLoader(qpqConfig, devServerConfig), queue_1.getQueueEventProcessor, quidproquo_core_1.QpqRuntimeType.QUEUE_EVENT, (e) => e.storySession);
|
|
36
36
|
});
|
|
37
37
|
const processQueueEventBusSubscriptions = (qpqConfig, ebMessage) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
38
|
var _a, _b, _c, _d;
|
|
@@ -22,7 +22,7 @@ const serviceFunctionImplementation = (devServerConfig) => __awaiter(void 0, voi
|
|
|
22
22
|
logic_1.eventBus.on(quidproquo_webserver_1.ServiceFunctionActionType.Execute, (payload, correlation) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
// We need to find the qpqConfig for this service.
|
|
24
24
|
const qpqConfig = devServerConfig.qpqConfigs.find((qpqConfig) => quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig) === payload.serviceName);
|
|
25
|
-
const eventPromise = yield (0, logic_1.processEvent)(payload, qpqConfig, getDynamicModuleLoader(qpqConfig, devServerConfig), actionProcessor_1.getNodeServiceFunctionEventProcessor, quidproquo_core_1.QpqRuntimeType.SERVICE_FUNCTION_EXE);
|
|
25
|
+
const eventPromise = yield (0, logic_1.processEvent)(payload, qpqConfig, getDynamicModuleLoader(qpqConfig, devServerConfig), actionProcessor_1.getNodeServiceFunctionEventProcessor, quidproquo_core_1.QpqRuntimeType.SERVICE_FUNCTION_EXE, (e) => e.storySession);
|
|
26
26
|
if (correlation) {
|
|
27
27
|
// Emit the response back on the unique responseEvent channel
|
|
28
28
|
logic_1.eventBus.emit(correlation, eventPromise);
|
|
@@ -45,7 +45,10 @@ const startServer = (settingsMap, devServerConfig) => {
|
|
|
45
45
|
const userAgent = req.headers['user-agent'] || 'unknown agent';
|
|
46
46
|
const server = findConnection(settingsMap.service, settingsMap.apiName);
|
|
47
47
|
server.connections[connectionId] = ws;
|
|
48
|
-
const processWsEvent = (wsEvent) => (0, logic_1.processEvent)(wsEvent, settingsMap.qpqConfig, getDynamicModuleLoader(settingsMap.qpqConfig, devServerConfig), actionProcessor_1.getWsWebsocketEventEventProcessor, quidproquo_core_1.QpqRuntimeType.WEBSOCKET_EVENT)
|
|
48
|
+
const processWsEvent = (wsEvent) => (0, logic_1.processEvent)(wsEvent, settingsMap.qpqConfig, getDynamicModuleLoader(settingsMap.qpqConfig, devServerConfig), actionProcessor_1.getWsWebsocketEventEventProcessor, quidproquo_core_1.QpqRuntimeType.WEBSOCKET_EVENT, () => ({
|
|
49
|
+
depth: 0,
|
|
50
|
+
context: {},
|
|
51
|
+
}));
|
|
49
52
|
const onConnectEvent = {
|
|
50
53
|
apiName: settingsMap.apiName,
|
|
51
54
|
service: settingsMap.service,
|
package/lib/commonjs/index.d.ts
CHANGED
package/lib/commonjs/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./config"), exports);
|
|
18
18
|
__exportStar(require("./main"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver, DynamicModuleLoader, QPQConfig, QpqRuntimeType, StoryResult } from 'quidproquo-core';
|
|
2
|
-
export declare const processEvent: <E, ER>(expressEvent: E, qpqConfig: QPQConfig, dynamicModuleLoader: DynamicModuleLoader, getActionProcessors: ActionProcessorListResolver, qpqRuntimeType: QpqRuntimeType) => Promise<StoryResult<[E], ER>>;
|
|
1
|
+
import { ActionProcessorListResolver, DynamicModuleLoader, QPQConfig, QpqRuntimeType, StoryResult, StorySession } from 'quidproquo-core';
|
|
2
|
+
export declare const processEvent: <E, ER>(expressEvent: E, qpqConfig: QPQConfig, dynamicModuleLoader: DynamicModuleLoader, getActionProcessors: ActionProcessorListResolver, qpqRuntimeType: QpqRuntimeType, getStorySession: (event: E) => StorySession) => Promise<StoryResult<[E], ER>>;
|
|
@@ -11,19 +11,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.processEvent = void 0;
|
|
13
13
|
const quidproquo_actionprocessor_awslambda_1 = require("quidproquo-actionprocessor-awslambda");
|
|
14
|
+
const quidproquo_actionprocessor_node_1 = require("quidproquo-actionprocessor-node");
|
|
14
15
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
15
16
|
const crypto_1 = require("crypto");
|
|
16
17
|
const actionProcessor_1 = require("../actionProcessor");
|
|
17
18
|
// TODO: Make this a util or something based on server time or something..
|
|
18
19
|
const getDateNow = () => new Date().toISOString();
|
|
19
|
-
const processEvent = (expressEvent, qpqConfig, dynamicModuleLoader, getActionProcessors, qpqRuntimeType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
const processEvent = (expressEvent, qpqConfig, dynamicModuleLoader, getActionProcessors, qpqRuntimeType, getStorySession) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
21
|
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
21
22
|
const logger = (0, quidproquo_actionprocessor_awslambda_1.getLogger)(qpqConfig);
|
|
22
|
-
const resolveStory = (0, quidproquo_core_1.createRuntime)(qpqConfig, {
|
|
23
|
-
|
|
24
|
-
context: {},
|
|
25
|
-
}, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
-
return (Object.assign(Object.assign({}, (yield (0, actionProcessor_1.getDevServerActionProcessors)(qpqConfig, dynamicModuleLoader))), (yield getActionProcessors(qpqConfig, dynamicModuleLoader))));
|
|
23
|
+
const resolveStory = (0, quidproquo_core_1.createRuntime)(qpqConfig, getStorySession(expressEvent), () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
return (Object.assign(Object.assign(Object.assign({}, (yield (0, actionProcessor_1.getDevServerActionProcessors)(qpqConfig, dynamicModuleLoader))), (yield getActionProcessors(qpqConfig, dynamicModuleLoader))), (yield (0, quidproquo_actionprocessor_node_1.getCustomActionActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
27
25
|
}), getDateNow, logger, `${serviceName}::${(0, crypto_1.randomUUID)()}`, qpqRuntimeType, dynamicModuleLoader, []);
|
|
28
26
|
const result = yield resolveStory(quidproquo_core_1.askProcessEvent, [expressEvent]);
|
|
29
27
|
yield logger.waitToFinishWriting();
|
package/lib/commonjs/main.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { DevServerConfig, DevServerConfigOverrides } from './types';
|
|
2
3
|
export * from './implementations';
|
|
3
|
-
export declare const
|
|
4
|
+
export declare const getDevConfigs: (qpqConfigs: QPQConfig[], devServerConfigOverrides?: DevServerConfigOverrides) => QPQConfig[];
|
|
5
|
+
export declare const startDevServer: (devServerConfig: DevServerConfig, devServerConfigOverrides?: DevServerConfigOverrides) => Promise<void>;
|
package/lib/commonjs/main.js
CHANGED
|
@@ -23,17 +23,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.startDevServer = void 0;
|
|
26
|
+
exports.startDevServer = exports.getDevConfigs = void 0;
|
|
27
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
27
28
|
const implementations_1 = require("./implementations");
|
|
28
29
|
__exportStar(require("./implementations"), exports);
|
|
29
|
-
const
|
|
30
|
+
const getDevConfigs = (qpqConfigs, devServerConfigOverrides) => {
|
|
31
|
+
return qpqConfigs.map((qpqConfig) => {
|
|
32
|
+
return [
|
|
33
|
+
// Base config
|
|
34
|
+
...qpqConfig,
|
|
35
|
+
// all service override
|
|
36
|
+
...((devServerConfigOverrides === null || devServerConfigOverrides === void 0 ? void 0 : devServerConfigOverrides.allServices) || []),
|
|
37
|
+
// specific service override
|
|
38
|
+
...(((devServerConfigOverrides === null || devServerConfigOverrides === void 0 ? void 0 : devServerConfigOverrides.byService) || {})[quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig)] || []),
|
|
39
|
+
];
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
exports.getDevConfigs = getDevConfigs;
|
|
43
|
+
const startDevServer = (devServerConfig, devServerConfigOverrides) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
44
|
console.log('Starting QPQ Dev Server!!!');
|
|
45
|
+
// Add ovverrides for dev server
|
|
46
|
+
const updatedDevServerConfig = Object.assign(Object.assign({}, devServerConfig), { qpqConfigs: (0, exports.getDevConfigs)(devServerConfig.qpqConfigs) });
|
|
31
47
|
yield Promise.all([
|
|
32
|
-
(0, implementations_1.apiImplementation)(
|
|
33
|
-
(0, implementations_1.serviceFunctionImplementation)(
|
|
34
|
-
(0, implementations_1.eventBusImplementation)(
|
|
35
|
-
(0, implementations_1.queueImplementation)(
|
|
36
|
-
(0, implementations_1.webSocketImplementation)(
|
|
48
|
+
(0, implementations_1.apiImplementation)(updatedDevServerConfig),
|
|
49
|
+
(0, implementations_1.serviceFunctionImplementation)(updatedDevServerConfig),
|
|
50
|
+
(0, implementations_1.eventBusImplementation)(updatedDevServerConfig),
|
|
51
|
+
(0, implementations_1.queueImplementation)(updatedDevServerConfig),
|
|
52
|
+
(0, implementations_1.webSocketImplementation)(updatedDevServerConfig),
|
|
37
53
|
]);
|
|
38
54
|
});
|
|
39
55
|
exports.startDevServer = startDevServer;
|
|
@@ -6,3 +6,9 @@ export type DevServerConfig = {
|
|
|
6
6
|
dynamicModuleLoader: <T = any>(serviceName: string, modulePath: QpqFunctionRuntime) => Promise<T>;
|
|
7
7
|
qpqConfigs: QPQConfig[];
|
|
8
8
|
};
|
|
9
|
+
export type DevServerConfigOverrides = {
|
|
10
|
+
allServices?: QPQConfig;
|
|
11
|
+
byService?: {
|
|
12
|
+
[key: string]: QPQConfig;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -104,7 +104,10 @@ export const apiImplementation = async (devServerConfig) => {
|
|
|
104
104
|
mimetype: file.mimetype,
|
|
105
105
|
}));
|
|
106
106
|
}
|
|
107
|
-
const response = await processEvent(event, apiConfig.qpqConfig, getDynamicModuleLoader(apiConfig.qpqConfig, devServerConfig), getExpressApiEventEventProcessor, QpqRuntimeType.API)
|
|
107
|
+
const response = await processEvent(event, apiConfig.qpqConfig, getDynamicModuleLoader(apiConfig.qpqConfig, devServerConfig), getExpressApiEventEventProcessor, QpqRuntimeType.API, () => ({
|
|
108
|
+
depth: 0,
|
|
109
|
+
context: {},
|
|
110
|
+
}));
|
|
108
111
|
if (response.result) {
|
|
109
112
|
for (const [header, value] of Object.entries(response.result.headers)) {
|
|
110
113
|
res.set(header, value);
|
|
@@ -20,7 +20,7 @@ const processQueueMessages = async (qpqConfig, payload, devServerConfig) => {
|
|
|
20
20
|
if ((!!payload.targetFeature || !!feature) && payload.targetFeature !== feature) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
await processEvent(payload, qpqConfig, getDynamicModuleLoader(qpqConfig, devServerConfig), getQueueEventProcessor, QpqRuntimeType.QUEUE_EVENT);
|
|
23
|
+
await processEvent(payload, qpqConfig, getDynamicModuleLoader(qpqConfig, devServerConfig), getQueueEventProcessor, QpqRuntimeType.QUEUE_EVENT, (e) => e.storySession);
|
|
24
24
|
};
|
|
25
25
|
const processQueueEventBusSubscriptions = async (qpqConfig, ebMessage) => {
|
|
26
26
|
const thisServiceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
@@ -10,7 +10,7 @@ export const serviceFunctionImplementation = async (devServerConfig) => {
|
|
|
10
10
|
eventBus.on(ServiceFunctionActionType.Execute, async (payload, correlation) => {
|
|
11
11
|
// We need to find the qpqConfig for this service.
|
|
12
12
|
const qpqConfig = devServerConfig.qpqConfigs.find((qpqConfig) => qpqCoreUtils.getApplicationModuleName(qpqConfig) === payload.serviceName);
|
|
13
|
-
const eventPromise = await processEvent(payload, qpqConfig, getDynamicModuleLoader(qpqConfig, devServerConfig), getNodeServiceFunctionEventProcessor, QpqRuntimeType.SERVICE_FUNCTION_EXE);
|
|
13
|
+
const eventPromise = await processEvent(payload, qpqConfig, getDynamicModuleLoader(qpqConfig, devServerConfig), getNodeServiceFunctionEventProcessor, QpqRuntimeType.SERVICE_FUNCTION_EXE, (e) => e.storySession);
|
|
14
14
|
if (correlation) {
|
|
15
15
|
// Emit the response back on the unique responseEvent channel
|
|
16
16
|
eventBus.emit(correlation, eventPromise);
|
|
@@ -31,7 +31,10 @@ const startServer = (settingsMap, devServerConfig) => {
|
|
|
31
31
|
const userAgent = req.headers['user-agent'] || 'unknown agent';
|
|
32
32
|
const server = findConnection(settingsMap.service, settingsMap.apiName);
|
|
33
33
|
server.connections[connectionId] = ws;
|
|
34
|
-
const processWsEvent = (wsEvent) => processEvent(wsEvent, settingsMap.qpqConfig, getDynamicModuleLoader(settingsMap.qpqConfig, devServerConfig), getWsWebsocketEventEventProcessor, QpqRuntimeType.WEBSOCKET_EVENT)
|
|
34
|
+
const processWsEvent = (wsEvent) => processEvent(wsEvent, settingsMap.qpqConfig, getDynamicModuleLoader(settingsMap.qpqConfig, devServerConfig), getWsWebsocketEventEventProcessor, QpqRuntimeType.WEBSOCKET_EVENT, () => ({
|
|
35
|
+
depth: 0,
|
|
36
|
+
context: {},
|
|
37
|
+
}));
|
|
35
38
|
const onConnectEvent = {
|
|
36
39
|
apiName: settingsMap.apiName,
|
|
37
40
|
service: settingsMap.service,
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver, DynamicModuleLoader, QPQConfig, QpqRuntimeType, StoryResult } from 'quidproquo-core';
|
|
2
|
-
export declare const processEvent: <E, ER>(expressEvent: E, qpqConfig: QPQConfig, dynamicModuleLoader: DynamicModuleLoader, getActionProcessors: ActionProcessorListResolver, qpqRuntimeType: QpqRuntimeType) => Promise<StoryResult<[E], ER>>;
|
|
1
|
+
import { ActionProcessorListResolver, DynamicModuleLoader, QPQConfig, QpqRuntimeType, StoryResult, StorySession } from 'quidproquo-core';
|
|
2
|
+
export declare const processEvent: <E, ER>(expressEvent: E, qpqConfig: QPQConfig, dynamicModuleLoader: DynamicModuleLoader, getActionProcessors: ActionProcessorListResolver, qpqRuntimeType: QpqRuntimeType, getStorySession: (event: E) => StorySession) => Promise<StoryResult<[E], ER>>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { getLogger } from 'quidproquo-actionprocessor-awslambda';
|
|
2
|
+
import { getCustomActionActionProcessor } from 'quidproquo-actionprocessor-node';
|
|
2
3
|
import { askProcessEvent, createRuntime, qpqCoreUtils, } from 'quidproquo-core';
|
|
3
4
|
import { randomUUID } from 'crypto';
|
|
4
5
|
import { getDevServerActionProcessors } from '../actionProcessor';
|
|
5
6
|
// TODO: Make this a util or something based on server time or something..
|
|
6
7
|
const getDateNow = () => new Date().toISOString();
|
|
7
|
-
export const processEvent = async (expressEvent, qpqConfig, dynamicModuleLoader, getActionProcessors, qpqRuntimeType) => {
|
|
8
|
+
export const processEvent = async (expressEvent, qpqConfig, dynamicModuleLoader, getActionProcessors, qpqRuntimeType, getStorySession) => {
|
|
8
9
|
const serviceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
9
10
|
const logger = getLogger(qpqConfig);
|
|
10
|
-
const resolveStory = createRuntime(qpqConfig, {
|
|
11
|
-
depth: 0,
|
|
12
|
-
context: {},
|
|
13
|
-
}, async () => ({
|
|
11
|
+
const resolveStory = createRuntime(qpqConfig, getStorySession(expressEvent), async () => ({
|
|
14
12
|
...(await getDevServerActionProcessors(qpqConfig, dynamicModuleLoader)),
|
|
15
13
|
...(await getActionProcessors(qpqConfig, dynamicModuleLoader)),
|
|
14
|
+
// Always done last, so they can ovveride the default ones if the user wants.
|
|
15
|
+
...(await getCustomActionActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
16
16
|
}), getDateNow, logger, `${serviceName}::${randomUUID()}`, qpqRuntimeType, dynamicModuleLoader, []);
|
|
17
17
|
const result = await resolveStory(askProcessEvent, [expressEvent]);
|
|
18
18
|
await logger.waitToFinishWriting();
|
package/lib/esm/main.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { DevServerConfig, DevServerConfigOverrides } from './types';
|
|
2
3
|
export * from './implementations';
|
|
3
|
-
export declare const
|
|
4
|
+
export declare const getDevConfigs: (qpqConfigs: QPQConfig[], devServerConfigOverrides?: DevServerConfigOverrides) => QPQConfig[];
|
|
5
|
+
export declare const startDevServer: (devServerConfig: DevServerConfig, devServerConfigOverrides?: DevServerConfigOverrides) => Promise<void>;
|
package/lib/esm/main.js
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
|
+
import { qpqCoreUtils } from 'quidproquo-core';
|
|
1
2
|
import { apiImplementation, eventBusImplementation, queueImplementation, serviceFunctionImplementation, webSocketImplementation, } from './implementations';
|
|
2
3
|
export * from './implementations';
|
|
3
|
-
export const
|
|
4
|
+
export const getDevConfigs = (qpqConfigs, devServerConfigOverrides) => {
|
|
5
|
+
return qpqConfigs.map((qpqConfig) => {
|
|
6
|
+
return [
|
|
7
|
+
// Base config
|
|
8
|
+
...qpqConfig,
|
|
9
|
+
// all service override
|
|
10
|
+
...(devServerConfigOverrides?.allServices || []),
|
|
11
|
+
// specific service override
|
|
12
|
+
...((devServerConfigOverrides?.byService || {})[qpqCoreUtils.getApplicationModuleName(qpqConfig)] || []),
|
|
13
|
+
];
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export const startDevServer = async (devServerConfig, devServerConfigOverrides) => {
|
|
4
17
|
console.log('Starting QPQ Dev Server!!!');
|
|
18
|
+
// Add ovverrides for dev server
|
|
19
|
+
const updatedDevServerConfig = {
|
|
20
|
+
...devServerConfig,
|
|
21
|
+
qpqConfigs: getDevConfigs(devServerConfig.qpqConfigs),
|
|
22
|
+
};
|
|
5
23
|
await Promise.all([
|
|
6
|
-
apiImplementation(
|
|
7
|
-
serviceFunctionImplementation(
|
|
8
|
-
eventBusImplementation(
|
|
9
|
-
queueImplementation(
|
|
10
|
-
webSocketImplementation(
|
|
24
|
+
apiImplementation(updatedDevServerConfig),
|
|
25
|
+
serviceFunctionImplementation(updatedDevServerConfig),
|
|
26
|
+
eventBusImplementation(updatedDevServerConfig),
|
|
27
|
+
queueImplementation(updatedDevServerConfig),
|
|
28
|
+
webSocketImplementation(updatedDevServerConfig),
|
|
11
29
|
]);
|
|
12
30
|
};
|
|
@@ -6,3 +6,9 @@ export type DevServerConfig = {
|
|
|
6
6
|
dynamicModuleLoader: <T = any>(serviceName: string, modulePath: QpqFunctionRuntime) => Promise<T>;
|
|
7
7
|
qpqConfigs: QPQConfig[];
|
|
8
8
|
};
|
|
9
|
+
export type DevServerConfigOverrides = {
|
|
10
|
+
allServices?: QPQConfig;
|
|
11
|
+
byService?: {
|
|
12
|
+
[key: string]: QPQConfig;
|
|
13
|
+
};
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-dev-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.251",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"chalk": "^4.1.2",
|
|
36
36
|
"multer": "^1.4.5-lts.1",
|
|
37
|
-
"quidproquo-actionprocessor-awslambda": "0.0.
|
|
38
|
-
"quidproquo-actionprocessor-node": "0.0.
|
|
39
|
-
"quidproquo-core": "0.0.
|
|
40
|
-
"quidproquo-webserver": "0.0.
|
|
37
|
+
"quidproquo-actionprocessor-awslambda": "0.0.251",
|
|
38
|
+
"quidproquo-actionprocessor-node": "0.0.251",
|
|
39
|
+
"quidproquo-core": "0.0.251",
|
|
40
|
+
"quidproquo-webserver": "0.0.251",
|
|
41
41
|
"ws": "^8.18.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/multer": "^1.4.12",
|
|
45
|
-
"quidproquo-tsconfig": "0.0.
|
|
45
|
+
"quidproquo-tsconfig": "0.0.251",
|
|
46
46
|
"typescript": "^4.9.3"
|
|
47
47
|
}
|
|
48
48
|
}
|