quidproquo-core 0.0.94 → 0.0.95
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/eventBus/EventBusSendMessageActionTypes.d.ts +2 -5
- package/lib/actions/queue/QueueSendMessageActionTypes.d.ts +2 -5
- package/lib/actions/userDirectory/UserDirectoryRefreshTokenActionRequester.d.ts +1 -1
- package/lib/actions/userDirectory/UserDirectoryRefreshTokenActionRequester.js +1 -2
- package/lib/actions/userDirectory/UserDirectoryRefreshTokenActionTypes.d.ts +0 -1
- package/lib/config/QPQConfig.d.ts +3 -3
- package/lib/config/QPQConfig.js +1 -0
- package/lib/config/settings/environmentSettings.d.ts +6 -0
- package/lib/config/settings/environmentSettings.js +11 -0
- package/lib/config/settings/index.d.ts +1 -0
- package/lib/config/settings/index.js +1 -0
- package/lib/qpqCoreUtils.d.ts +3 -1
- package/lib/qpqCoreUtils.js +15 -1
- package/lib/qpqExecuteLog.js +4 -1
- package/lib/qpqRuntime.d.ts +1 -1
- package/lib/qpqRuntime.js +10 -5
- package/lib/types/CrossModuleMessage.d.ts +4 -0
- package/lib/types/CrossModuleMessage.js +2 -0
- package/lib/types/StorySession.d.ts +3 -1
- package/lib/types/StorySession.js +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { Action, ActionProcessor, ActionRequester } from '../../types
|
|
1
|
+
import { Action, ActionProcessor, ActionRequester, CrossModuleMessage } from '../../types';
|
|
2
2
|
import { EventBusActionType } from './EventBusActionType';
|
|
3
|
-
export
|
|
4
|
-
type: string;
|
|
5
|
-
payload: T;
|
|
6
|
-
}
|
|
3
|
+
export type EventBusMessage<T> = CrossModuleMessage<T>;
|
|
7
4
|
export interface EventBusSendMessageActionPayload<T> {
|
|
8
5
|
eventBusName: string;
|
|
9
6
|
eventBusMessages: EventBusMessage<T>[];
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { Action, ActionProcessor, ActionRequester } from '../../types
|
|
1
|
+
import { Action, ActionProcessor, ActionRequester, CrossModuleMessage } from '../../types';
|
|
2
2
|
import { QueueActionType } from './QueueActionType';
|
|
3
|
-
export
|
|
4
|
-
type: string;
|
|
5
|
-
payload: T;
|
|
6
|
-
}
|
|
3
|
+
export type QueueMessage<T> = CrossModuleMessage<T>;
|
|
7
4
|
export interface QueueSendMessageActionPayload<T> {
|
|
8
5
|
queueName: string;
|
|
9
6
|
queueMessages: QueueMessage<T>[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UserDirectoryRefreshTokenActionRequester } from './UserDirectoryRefreshTokenActionTypes';
|
|
2
|
-
export declare function askUserDirectoryRefreshToken(userDirectoryName: string,
|
|
2
|
+
export declare function askUserDirectoryRefreshToken(userDirectoryName: string, refreshToken: string): UserDirectoryRefreshTokenActionRequester;
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.askUserDirectoryRefreshToken = void 0;
|
|
4
4
|
const UserDirectoryActionType_1 = require("./UserDirectoryActionType");
|
|
5
|
-
function* askUserDirectoryRefreshToken(userDirectoryName,
|
|
5
|
+
function* askUserDirectoryRefreshToken(userDirectoryName, refreshToken) {
|
|
6
6
|
return yield {
|
|
7
7
|
type: UserDirectoryActionType_1.UserDirectoryActionType.RefreshToken,
|
|
8
8
|
payload: {
|
|
9
9
|
userDirectoryName,
|
|
10
|
-
username,
|
|
11
10
|
refreshToken,
|
|
12
11
|
},
|
|
13
12
|
};
|
|
@@ -2,7 +2,6 @@ import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
|
|
|
2
2
|
import { UserDirectoryActionType, AuthenticateUserResponse } from './UserDirectoryActionType';
|
|
3
3
|
export interface UserDirectoryRefreshTokenActionPayload {
|
|
4
4
|
userDirectoryName: string;
|
|
5
|
-
username: string;
|
|
6
5
|
refreshToken: string;
|
|
7
6
|
}
|
|
8
7
|
export interface UserDirectoryRefreshTokenAction extends Action<UserDirectoryRefreshTokenActionPayload> {
|
|
@@ -10,7 +10,8 @@ export declare enum QPQCoreConfigSettingType {
|
|
|
10
10
|
eventBus = "@quidproquo-core/config/EventBus",
|
|
11
11
|
userDirectory = "@quidproquo-core/config/UserDirectory",
|
|
12
12
|
keyValueStore = "@quidproquo-core/config/KeyValueStore",
|
|
13
|
-
configValue = "@quidproquo-core/config/ConfigValue"
|
|
13
|
+
configValue = "@quidproquo-core/config/ConfigValue",
|
|
14
|
+
environmentSettings = "@quidproquo-core/config/EnvironmentSettings"
|
|
14
15
|
}
|
|
15
16
|
export interface QPQConfigSetting {
|
|
16
17
|
configSettingType: string;
|
|
@@ -19,6 +20,5 @@ export interface QPQConfigSetting {
|
|
|
19
20
|
export interface QPQConfigAdvancedSettings {
|
|
20
21
|
deprecated?: boolean;
|
|
21
22
|
}
|
|
22
|
-
export type
|
|
23
|
-
export type QPQConfigItem = QPQConfigSetting | QPQConfigSettings;
|
|
23
|
+
export type QPQConfigItem = QPQConfigSetting | QPQConfigItem[];
|
|
24
24
|
export type QPQConfig = QPQConfigItem[];
|
package/lib/config/QPQConfig.js
CHANGED
|
@@ -15,4 +15,5 @@ var QPQCoreConfigSettingType;
|
|
|
15
15
|
QPQCoreConfigSettingType["userDirectory"] = "@quidproquo-core/config/UserDirectory";
|
|
16
16
|
QPQCoreConfigSettingType["keyValueStore"] = "@quidproquo-core/config/KeyValueStore";
|
|
17
17
|
QPQCoreConfigSettingType["configValue"] = "@quidproquo-core/config/ConfigValue";
|
|
18
|
+
QPQCoreConfigSettingType["environmentSettings"] = "@quidproquo-core/config/EnvironmentSettings";
|
|
18
19
|
})(QPQCoreConfigSettingType = exports.QPQCoreConfigSettingType || (exports.QPQCoreConfigSettingType = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfigSetting } from '../QPQConfig';
|
|
2
|
+
export interface EnvironmentSettingsQPQConfigSetting extends QPQConfigSetting {
|
|
3
|
+
environment: string;
|
|
4
|
+
settings: QPQConfigSetting[];
|
|
5
|
+
}
|
|
6
|
+
export declare const defineEnvironmentSettings: (environment: string, settings: QPQConfigSetting[]) => EnvironmentSettingsQPQConfigSetting;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineEnvironmentSettings = void 0;
|
|
4
|
+
const QPQConfig_1 = require("../QPQConfig");
|
|
5
|
+
const defineEnvironmentSettings = (environment, settings) => ({
|
|
6
|
+
configSettingType: QPQConfig_1.QPQCoreConfigSettingType.environmentSettings,
|
|
7
|
+
uniqueKey: environment,
|
|
8
|
+
environment,
|
|
9
|
+
settings,
|
|
10
|
+
});
|
|
11
|
+
exports.defineEnvironmentSettings = defineEnvironmentSettings;
|
|
@@ -3,6 +3,7 @@ export * from './actionProcessors';
|
|
|
3
3
|
export * from './applicationModule';
|
|
4
4
|
export * from './buildPath';
|
|
5
5
|
export * from './configValue';
|
|
6
|
+
export * from './environmentSettings';
|
|
6
7
|
export * from './eventBus';
|
|
7
8
|
export * from './keyValueStore';
|
|
8
9
|
export * from './parameter';
|
|
@@ -19,6 +19,7 @@ __exportStar(require("./actionProcessors"), exports);
|
|
|
19
19
|
__exportStar(require("./applicationModule"), exports);
|
|
20
20
|
__exportStar(require("./buildPath"), exports);
|
|
21
21
|
__exportStar(require("./configValue"), exports);
|
|
22
|
+
__exportStar(require("./environmentSettings"), exports);
|
|
22
23
|
__exportStar(require("./eventBus"), exports);
|
|
23
24
|
__exportStar(require("./keyValueStore"), exports);
|
|
24
25
|
__exportStar(require("./parameter"), exports);
|
package/lib/qpqCoreUtils.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ import { ApplicationModuleQPQConfigSetting, StorageDriveQPQConfigSetting, EventB
|
|
|
3
3
|
import { EmailTemplates } from './config/settings/emailTemplates/types';
|
|
4
4
|
/**
|
|
5
5
|
* Flattens a QPQConfig array into a single array of QPQConfigSetting objects.
|
|
6
|
+
* If a QPQConfigItem has a configSettingType of QPQCoreConfigSettingType.environmentSettings,
|
|
7
|
+
* and its environment matches the current environment, its settings will be added to the flattened array.
|
|
6
8
|
* @function
|
|
7
9
|
* @param {QPQConfig} qpqConfig - The input QPQConfig array to be flattened.
|
|
8
|
-
* @returns {QPQConfigSetting[]} - The flattened array of QPQConfigSetting objects
|
|
10
|
+
* @returns {QPQConfigSetting[]} - The flattened array of QPQConfigSetting objects
|
|
9
11
|
*/
|
|
10
12
|
export declare const flattenQpqConfig: (qpqConfig: QPQConfig) => QPQConfigSetting[];
|
|
11
13
|
/**
|
package/lib/qpqCoreUtils.js
CHANGED
|
@@ -28,11 +28,14 @@ const path = __importStar(require("path"));
|
|
|
28
28
|
const QPQConfig_1 = require("./config/QPQConfig");
|
|
29
29
|
/**
|
|
30
30
|
* Flattens a QPQConfig array into a single array of QPQConfigSetting objects.
|
|
31
|
+
* If a QPQConfigItem has a configSettingType of QPQCoreConfigSettingType.environmentSettings,
|
|
32
|
+
* and its environment matches the current environment, its settings will be added to the flattened array.
|
|
31
33
|
* @function
|
|
32
34
|
* @param {QPQConfig} qpqConfig - The input QPQConfig array to be flattened.
|
|
33
|
-
* @returns {QPQConfigSetting[]} - The flattened array of QPQConfigSetting objects
|
|
35
|
+
* @returns {QPQConfigSetting[]} - The flattened array of QPQConfigSetting objects
|
|
34
36
|
*/
|
|
35
37
|
const flattenQpqConfig = (qpqConfig) => {
|
|
38
|
+
var environment = 'development';
|
|
36
39
|
/**
|
|
37
40
|
* A recursive helper function that flattens an array of QPQConfigItem objects.
|
|
38
41
|
* @function
|
|
@@ -46,6 +49,17 @@ const flattenQpqConfig = (qpqConfig) => {
|
|
|
46
49
|
return flatten(item, acc);
|
|
47
50
|
}
|
|
48
51
|
else {
|
|
52
|
+
// If its a appName config item, update the environment variable
|
|
53
|
+
if (item.configSettingType === QPQConfig_1.QPQCoreConfigSettingType.appName) {
|
|
54
|
+
environment = item.environment || 'development';
|
|
55
|
+
}
|
|
56
|
+
// Otherwise if its an environmentSettings config item, flatten out the child settings
|
|
57
|
+
else if (item.configSettingType === QPQConfig_1.QPQCoreConfigSettingType.environmentSettings) {
|
|
58
|
+
const envSetting = item;
|
|
59
|
+
const settings = envSetting.environment === environment ? envSetting.settings : [];
|
|
60
|
+
return flatten(settings, acc);
|
|
61
|
+
}
|
|
62
|
+
// Otherwise its just a regular config item, add it to the list
|
|
49
63
|
return [...acc, item];
|
|
50
64
|
}
|
|
51
65
|
}, accumulator);
|
package/lib/qpqExecuteLog.js
CHANGED
|
@@ -21,7 +21,10 @@ const qpqExecuteLog = (storyResult, runtime) => __awaiter(void 0, void 0, void 0
|
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
// Generate an empty story resolver
|
|
24
|
-
const resolveStory = (0, qpqRuntime_1.createRuntime)([(0, config_1.defineApplicationModule)('Debugger', storyResult.moduleName, 'development', __dirname)], {
|
|
24
|
+
const resolveStory = (0, qpqRuntime_1.createRuntime)([(0, config_1.defineApplicationModule)('Debugger', storyResult.moduleName, 'development', __dirname)], {
|
|
25
|
+
correlation: storyResult.fromCorrelation,
|
|
26
|
+
depth: 0,
|
|
27
|
+
}, storyActionProcessor, () => new Date().toISOString(), () => __awaiter(void 0, void 0, void 0, function* () { }), storyResult.correlation, storyResult.runtimeType);
|
|
25
28
|
// Execute it with the initial input
|
|
26
29
|
debugger;
|
|
27
30
|
const result = yield resolveStory(runtime, storyResult.input);
|
package/lib/qpqRuntime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Action, ActionProcessorList } from './types/Action';
|
|
2
2
|
import { StoryResult, StorySession, QpqRuntimeType } from './types/StorySession';
|
|
3
3
|
import { QPQConfig } from './config';
|
|
4
|
-
export declare const createRuntime: (qpqConfig: QPQConfig,
|
|
4
|
+
export declare const createRuntime: (qpqConfig: QPQConfig, callerSession: StorySession, actionProcessors: ActionProcessorList, getTimeNow: () => string, logger: (res: StoryResult<any>) => Promise<void>, runtimeCorrelation: string, runtimeType: QpqRuntimeType, initialTags?: string[]) => <TArgs extends any[]>(story: (...args: TArgs) => Generator<any, any, Action<any>>, args: TArgs) => Promise<StoryResult<any>>;
|
package/lib/qpqRuntime.js
CHANGED
|
@@ -38,28 +38,33 @@ function processAction(action, actionProcessors, session, logger) {
|
|
|
38
38
|
return yield processor(action.payload, session, actionProcessors, logger);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
const createRuntime = (qpqConfig,
|
|
41
|
+
const createRuntime = (qpqConfig, callerSession, actionProcessors, getTimeNow, logger, runtimeCorrelation, runtimeType, initialTags) => {
|
|
42
42
|
function resolveStory(story, args) {
|
|
43
43
|
var _a;
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
const reader = story(...args);
|
|
46
46
|
let action = null;
|
|
47
|
+
const storySession = {
|
|
48
|
+
correlation: runtimeCorrelation,
|
|
49
|
+
depth: callerSession.depth + 1,
|
|
50
|
+
accessToken: callerSession.accessToken,
|
|
51
|
+
};
|
|
47
52
|
const response = {
|
|
48
53
|
input: args,
|
|
49
|
-
session:
|
|
54
|
+
session: storySession,
|
|
50
55
|
history: [],
|
|
51
56
|
startedAt: getTimeNow(),
|
|
52
57
|
tags: initialTags || [],
|
|
53
58
|
moduleName: (0, qpqCoreUtils_1.getApplicationModuleName)(qpqConfig),
|
|
54
|
-
correlation:
|
|
55
|
-
fromCorrelation:
|
|
59
|
+
correlation: storySession.correlation,
|
|
60
|
+
fromCorrelation: callerSession.correlation,
|
|
56
61
|
runtimeType: runtimeType,
|
|
57
62
|
};
|
|
58
63
|
try {
|
|
59
64
|
action = reader.next();
|
|
60
65
|
while (!action.done) {
|
|
61
66
|
const executionTime = getTimeNow();
|
|
62
|
-
const actionResult = yield processAction(action.value, actionProcessors,
|
|
67
|
+
const actionResult = yield processAction(action.value, actionProcessors, storySession, logger);
|
|
63
68
|
const history = {
|
|
64
69
|
act: action.value,
|
|
65
70
|
res: actionResult,
|
|
@@ -2,6 +2,8 @@ import { ErrorTypeEnum } from './ErrorTypeEnum';
|
|
|
2
2
|
import { Action } from './Action';
|
|
3
3
|
export interface StorySession {
|
|
4
4
|
correlation?: string;
|
|
5
|
+
depth: number;
|
|
6
|
+
accessToken?: string;
|
|
5
7
|
}
|
|
6
8
|
export interface StoryError {
|
|
7
9
|
errorType: ErrorTypeEnum;
|
|
@@ -18,7 +20,7 @@ export interface ActionHistory<T = any> {
|
|
|
18
20
|
export declare enum QpqRuntimeType {
|
|
19
21
|
API = "API",
|
|
20
22
|
EXECUTE_STORY = "EXECUTE_STORY",
|
|
21
|
-
|
|
23
|
+
RECURRING_SCHEDULE = "RECURRING_SCHEDULE",
|
|
22
24
|
QUEUE_EVENT = "QUEUE_EVENT",
|
|
23
25
|
EVENT_SEO_OR = "EVENT_SEO_OR",
|
|
24
26
|
SERVICE_FUNCTION_EXE = "SERVICE_FUNCTION_EXE"
|
|
@@ -5,7 +5,7 @@ var QpqRuntimeType;
|
|
|
5
5
|
(function (QpqRuntimeType) {
|
|
6
6
|
QpqRuntimeType["API"] = "API";
|
|
7
7
|
QpqRuntimeType["EXECUTE_STORY"] = "EXECUTE_STORY";
|
|
8
|
-
QpqRuntimeType["
|
|
8
|
+
QpqRuntimeType["RECURRING_SCHEDULE"] = "RECURRING_SCHEDULE";
|
|
9
9
|
QpqRuntimeType["QUEUE_EVENT"] = "QUEUE_EVENT";
|
|
10
10
|
QpqRuntimeType["EVENT_SEO_OR"] = "EVENT_SEO_OR";
|
|
11
11
|
QpqRuntimeType["SERVICE_FUNCTION_EXE"] = "SERVICE_FUNCTION_EXE";
|
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("./Action"), exports);
|
|
18
|
+
__exportStar(require("./CrossModuleMessage"), exports);
|
|
18
19
|
__exportStar(require("./StorySession"), exports);
|
|
19
20
|
__exportStar(require("./ErrorTypeEnum"), exports);
|
|
20
21
|
__exportStar(require("./ScheduledEvent"), exports);
|