quidproquo-core 0.0.25 → 0.0.27
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/event/EventTransformResponseResultActionRequester.d.ts +1 -1
- package/lib/actions/event/EventTransformResponseResultActionRequester.js +2 -2
- package/lib/actions/event/EventTransformResponseResultActionTypes.d.ts +1 -0
- package/lib/config/settings/appName.d.ts +3 -2
- package/lib/config/settings/appName.js +2 -1
- package/lib/qpqCoreUtils.d.ts +1 -0
- package/lib/qpqCoreUtils.js +7 -1
- package/lib/qpqRuntime.js +2 -0
- package/lib/stories/askProcessEvent.js +2 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { EventTransformResponseResultActionRequester } from './EventTransformResponseResultActionTypes';
|
|
2
|
-
export declare function askEventTransformResponseResult<TOutputRes, TInputRes>(response: TInputRes): EventTransformResponseResultActionRequester<TOutputRes>;
|
|
2
|
+
export declare function askEventTransformResponseResult<TOutputRes, TInputRes, TTransformedEventParams>(response: TInputRes, transformedEventParams: TTransformedEventParams): EventTransformResponseResultActionRequester<TOutputRes>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.askEventTransformResponseResult = void 0;
|
|
4
4
|
const EventActionType_1 = require("./EventActionType");
|
|
5
|
-
function* askEventTransformResponseResult(response) {
|
|
5
|
+
function* askEventTransformResponseResult(response, transformedEventParams) {
|
|
6
6
|
return yield {
|
|
7
7
|
type: EventActionType_1.EventActionType.TransformResponseResult,
|
|
8
|
-
payload: { response },
|
|
8
|
+
payload: { response, transformedEventParams },
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
exports.askEventTransformResponseResult = askEventTransformResponseResult;
|
|
@@ -2,6 +2,7 @@ import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
|
|
|
2
2
|
import { EventActionType } from './EventActionType';
|
|
3
3
|
export interface EventTransformResponseResultActionPayload {
|
|
4
4
|
response: any;
|
|
5
|
+
transformedEventParams: any;
|
|
5
6
|
}
|
|
6
7
|
export interface EventTransformResponseResultAction extends Action<EventTransformResponseResultActionPayload> {
|
|
7
8
|
type: EventActionType.TransformResponseResult;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { QPQConfigSetting } from
|
|
1
|
+
import { QPQConfigSetting } from '../QPQConfig';
|
|
2
2
|
export interface AppNameQPQConfigSetting extends QPQConfigSetting {
|
|
3
3
|
appName: string;
|
|
4
|
+
featureName?: string;
|
|
4
5
|
}
|
|
5
|
-
export declare const defineAppName: (appName: string) => AppNameQPQConfigSetting;
|
|
6
|
+
export declare const defineAppName: (appName: string, featureName?: string) => AppNameQPQConfigSetting;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineAppName = void 0;
|
|
4
4
|
const QPQConfig_1 = require("../QPQConfig");
|
|
5
|
-
const defineAppName = (appName) => ({
|
|
5
|
+
const defineAppName = (appName, featureName) => ({
|
|
6
6
|
configSettingType: QPQConfig_1.QPQCoreConfigSettingType.appName,
|
|
7
7
|
appName,
|
|
8
|
+
featureName,
|
|
8
9
|
});
|
|
9
10
|
exports.defineAppName = defineAppName;
|
package/lib/qpqCoreUtils.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ScheduleQPQConfigSetting, SecretQPQConfigSetting, ParameterQPQConfigSet
|
|
|
3
3
|
export declare const getConfigSettings: <T extends QPQConfigSetting>(configs: QPQConfig, configSettingType: string) => T[];
|
|
4
4
|
export declare const getConfigSetting: <T extends QPQConfigSetting>(configs: QPQConfig, serviceInfrastructureConfigType: string) => T | undefined;
|
|
5
5
|
export declare const getAppName: (configs: QPQConfig) => string;
|
|
6
|
+
export declare const getAppFeature: (configs: QPQConfig) => string;
|
|
6
7
|
export declare const getStorageDriveNames: (configs: QPQConfig) => string[];
|
|
7
8
|
export declare const getScheduleEvents: (configs: QPQConfig) => ScheduleQPQConfigSetting[];
|
|
8
9
|
export declare const getAllSrcEntries: (configs: QPQConfig) => string[];
|
package/lib/qpqCoreUtils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSharedSecrets = exports.getOwnedParameters = exports.getOwnedSecrets = exports.getAllSrcEntries = exports.getScheduleEvents = exports.getStorageDriveNames = exports.getAppName = exports.getConfigSetting = exports.getConfigSettings = void 0;
|
|
3
|
+
exports.getSharedSecrets = exports.getOwnedParameters = exports.getOwnedSecrets = exports.getAllSrcEntries = exports.getScheduleEvents = exports.getStorageDriveNames = exports.getAppFeature = exports.getAppName = exports.getConfigSetting = exports.getConfigSettings = void 0;
|
|
4
4
|
const QPQConfig_1 = require("./config/QPQConfig");
|
|
5
5
|
const getConfigSettings = (configs, configSettingType) => {
|
|
6
6
|
return configs.filter((c) => c.configSettingType === configSettingType);
|
|
@@ -20,6 +20,12 @@ const getAppName = (configs) => {
|
|
|
20
20
|
return appName;
|
|
21
21
|
};
|
|
22
22
|
exports.getAppName = getAppName;
|
|
23
|
+
const getAppFeature = (configs) => {
|
|
24
|
+
var _a;
|
|
25
|
+
const featureName = ((_a = (0, exports.getConfigSetting)(configs, QPQConfig_1.QPQCoreConfigSettingType.appName)) === null || _a === void 0 ? void 0 : _a.featureName) || 'production';
|
|
26
|
+
return featureName;
|
|
27
|
+
};
|
|
28
|
+
exports.getAppFeature = getAppFeature;
|
|
23
29
|
const getStorageDriveNames = (configs) => {
|
|
24
30
|
const storageDriveNames = (0, exports.getConfigSettings)(configs, QPQConfig_1.QPQCoreConfigSettingType.storageDrive).map((sd) => sd.storageDrive);
|
|
25
31
|
return storageDriveNames;
|
package/lib/qpqRuntime.js
CHANGED
|
@@ -56,6 +56,7 @@ const createRuntime = (session, actionProcessors, getTimeNow, logger, newGuid) =
|
|
|
56
56
|
console.log(`${action.value.type}: took ${new Date(history.finishedAt).getTime() - new Date(history.startedAt).getTime()}ms`);
|
|
57
57
|
response.history.push(history);
|
|
58
58
|
if ((0, actionLogic_1.isErroredActionResult)(actionResult)) {
|
|
59
|
+
console.log('Caught Error: ', JSON.stringify((0, actionLogic_1.resolveActionResultError)(actionResult)));
|
|
59
60
|
return Object.assign(Object.assign({}, response), { finishedAt: getTimeNow(), error: (0, actionLogic_1.resolveActionResultError)(actionResult) });
|
|
60
61
|
}
|
|
61
62
|
action = reader.next((0, actionLogic_1.resolveActionResult)(actionResult));
|
|
@@ -64,6 +65,7 @@ const createRuntime = (session, actionProcessors, getTimeNow, logger, newGuid) =
|
|
|
64
65
|
catch (err) {
|
|
65
66
|
// Dev Only ~ Todo
|
|
66
67
|
if (err instanceof Error) {
|
|
68
|
+
console.log('Uncaught Error: ', err.message.toString());
|
|
67
69
|
return Object.assign(Object.assign({}, response), { finishedAt: getTimeNow(), error: {
|
|
68
70
|
errorText: err.message.toString(),
|
|
69
71
|
errorType: ErrorTypeEnum_1.ErrorTypeEnum.GenericError, // resolve error type from err type?
|
|
@@ -10,13 +10,13 @@ function* askProcessEvent(...eventArguments) {
|
|
|
10
10
|
const earlyExitResponse = yield* (0, event_1.askEventAutoRespond)(transformedEventParams);
|
|
11
11
|
if (earlyExitResponse) {
|
|
12
12
|
// Transform the early exit response if needed
|
|
13
|
-
return yield* (0, event_1.askEventTransformResponseResult)(earlyExitResponse);
|
|
13
|
+
return yield* (0, event_1.askEventTransformResponseResult)(earlyExitResponse, transformedEventParams);
|
|
14
14
|
}
|
|
15
15
|
// Try and match a story to execute
|
|
16
16
|
const { src, runtime, options } = yield* (0, event_1.askEventMatchStory)(transformedEventParams);
|
|
17
17
|
// Execute the story
|
|
18
18
|
const result = yield* (0, system_1.askExecuteStory)('route', src, runtime, [transformedEventParams, options]);
|
|
19
19
|
// return the result of the story back to the event caller
|
|
20
|
-
return yield* (0, event_1.askEventTransformResponseResult)(result);
|
|
20
|
+
return yield* (0, event_1.askEventTransformResponseResult)(result, transformedEventParams);
|
|
21
21
|
}
|
|
22
22
|
exports.askProcessEvent = askProcessEvent;
|