quidproquo-core 0.0.70 → 0.0.72
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/EventActionType.d.ts +7 -0
- package/lib/actions/event/EventAutoRespondActionRequester.d.ts +2 -1
- package/lib/actions/event/EventAutoRespondActionRequester.js +2 -2
- package/lib/actions/event/EventAutoRespondActionTypes.d.ts +7 -6
- package/lib/actions/event/EventMatchStoryActionRequester.d.ts +2 -1
- package/lib/actions/event/EventMatchStoryActionTypes.d.ts +3 -10
- package/lib/actions/index.d.ts +2 -0
- package/lib/actions/index.js +2 -0
- package/lib/actions/queue/QueueActionType.d.ts +3 -0
- package/lib/actions/queue/QueueActionType.js +7 -0
- package/lib/actions/queue/QueueSendMessageActionRequester.d.ts +2 -0
- package/lib/actions/queue/QueueSendMessageActionRequester.js +21 -0
- package/lib/actions/queue/QueueSendMessageActionTypes.d.ts +16 -0
- package/lib/actions/queue/QueueSendMessageActionTypes.js +2 -0
- package/lib/actions/queue/index.d.ts +3 -0
- package/lib/actions/queue/index.js +19 -0
- package/lib/actions/userDirectory/UserDirectoryActionType.d.ts +20 -0
- package/lib/actions/userDirectory/UserDirectoryActionType.js +13 -0
- package/lib/actions/userDirectory/UserDirectoryAuthenticateUserActionRequester.d.ts +2 -0
- package/lib/actions/userDirectory/UserDirectoryAuthenticateUserActionRequester.js +14 -0
- package/lib/actions/userDirectory/UserDirectoryAuthenticateUserActionTypes.d.ts +16 -0
- package/lib/actions/userDirectory/UserDirectoryAuthenticateUserActionTypes.js +2 -0
- package/lib/actions/userDirectory/UserDirectoryCreateUserActionRequester.d.ts +2 -0
- package/lib/actions/userDirectory/UserDirectoryCreateUserActionRequester.js +14 -0
- package/lib/actions/userDirectory/UserDirectoryCreateUserActionTypes.d.ts +17 -0
- package/lib/actions/userDirectory/UserDirectoryCreateUserActionTypes.js +2 -0
- package/lib/actions/userDirectory/index.d.ts +5 -0
- package/lib/actions/userDirectory/index.js +21 -0
- package/lib/config/QPQConfig.d.ts +3 -1
- package/lib/config/QPQConfig.js +2 -0
- package/lib/config/settings/index.d.ts +2 -0
- package/lib/config/settings/index.js +2 -0
- package/lib/config/settings/queue.d.ts +28 -0
- package/lib/config/settings/queue.js +18 -0
- package/lib/config/settings/userDirectory.d.ts +11 -0
- package/lib/config/settings/userDirectory.js +12 -0
- package/lib/qpqCoreUtils.d.ts +8 -2
- package/lib/qpqCoreUtils.js +32 -5
- package/lib/qpqRuntime.js +1 -0
- package/lib/stories/askProcessEvent.d.ts +1 -1
- package/lib/stories/askProcessEvent.js +12 -4
- package/package.json +1 -1
|
@@ -4,3 +4,10 @@ export declare enum EventActionType {
|
|
|
4
4
|
AutoRespond = "@quidproquo-core/event/AutoRespond",
|
|
5
5
|
MatchStory = "@quidproquo-core/event/MatchStory"
|
|
6
6
|
}
|
|
7
|
+
export type MatchStoryResult<MatchOptions, Config> = {
|
|
8
|
+
src?: string;
|
|
9
|
+
runtime?: string;
|
|
10
|
+
runtimeOptions?: MatchOptions;
|
|
11
|
+
config?: Config;
|
|
12
|
+
};
|
|
13
|
+
export type AnyMatchStoryResult = MatchStoryResult<any, any>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { EventAutoRespondActionRequester } from './EventAutoRespondActionTypes';
|
|
2
|
-
|
|
2
|
+
import { AnyMatchStoryResult } from './EventActionType';
|
|
3
|
+
export declare function askEventAutoRespond<T, MSR extends AnyMatchStoryResult, TRes>(transformedEventParams: T, matchResult: MSR): EventAutoRespondActionRequester<T, MSR, TRes>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.askEventAutoRespond = void 0;
|
|
4
4
|
const EventActionType_1 = require("./EventActionType");
|
|
5
|
-
function* askEventAutoRespond(transformedEventParams) {
|
|
5
|
+
function* askEventAutoRespond(transformedEventParams, matchResult) {
|
|
6
6
|
return yield {
|
|
7
7
|
type: EventActionType_1.EventActionType.AutoRespond,
|
|
8
|
-
payload: { transformedEventParams },
|
|
8
|
+
payload: { transformedEventParams, matchResult },
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
exports.askEventAutoRespond = askEventAutoRespond;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
|
|
2
|
-
import { EventActionType } from './EventActionType';
|
|
3
|
-
export interface EventAutoRespondActionPayload<T> {
|
|
2
|
+
import { EventActionType, AnyMatchStoryResult } from './EventActionType';
|
|
3
|
+
export interface EventAutoRespondActionPayload<T, MSR extends AnyMatchStoryResult> {
|
|
4
4
|
transformedEventParams: T;
|
|
5
|
+
matchResult: MSR;
|
|
5
6
|
}
|
|
6
|
-
export interface EventAutoRespondAction<T> extends Action<EventAutoRespondActionPayload<T>> {
|
|
7
|
+
export interface EventAutoRespondAction<T, MSR extends AnyMatchStoryResult> extends Action<EventAutoRespondActionPayload<T, MSR>> {
|
|
7
8
|
type: EventActionType.AutoRespond;
|
|
8
|
-
payload: EventAutoRespondActionPayload<T>;
|
|
9
|
+
payload: EventAutoRespondActionPayload<T, MSR>;
|
|
9
10
|
}
|
|
10
|
-
export type EventAutoRespondActionProcessor<T> = ActionProcessor<EventAutoRespondAction<T>,
|
|
11
|
-
export type EventAutoRespondActionRequester<T> = ActionRequester<EventAutoRespondAction<T>,
|
|
11
|
+
export type EventAutoRespondActionProcessor<T, MSR extends AnyMatchStoryResult, TRes> = ActionProcessor<EventAutoRespondAction<T, MSR>, TRes>;
|
|
12
|
+
export type EventAutoRespondActionRequester<T, MSR extends AnyMatchStoryResult, TRes> = ActionRequester<EventAutoRespondAction<T, MSR>, TRes>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { EventMatchStoryActionRequester } from './EventMatchStoryActionTypes';
|
|
2
|
-
|
|
2
|
+
import { AnyMatchStoryResult } from './EventActionType';
|
|
3
|
+
export declare function askEventMatchStory<T, MSR extends AnyMatchStoryResult>(transformedEventParams: T): EventMatchStoryActionRequester<T, MSR>;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
|
|
2
|
-
import { EventActionType } from './EventActionType';
|
|
3
|
-
export type MatchStoryResult = {
|
|
4
|
-
src?: string;
|
|
5
|
-
runtime?: string;
|
|
6
|
-
options?: {
|
|
7
|
-
[key: string]: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
2
|
+
import { EventActionType, AnyMatchStoryResult } from './EventActionType';
|
|
10
3
|
export interface EventMatchStoryActionPayload<T> {
|
|
11
4
|
transformedEventParams: T;
|
|
12
5
|
}
|
|
@@ -14,5 +7,5 @@ export interface EventMatchStoryAction<T> extends Action<EventMatchStoryActionPa
|
|
|
14
7
|
type: EventActionType.MatchStory;
|
|
15
8
|
payload: EventMatchStoryActionPayload<T>;
|
|
16
9
|
}
|
|
17
|
-
export type EventMatchStoryActionProcessor<T> = ActionProcessor<EventMatchStoryAction<T>,
|
|
18
|
-
export type EventMatchStoryActionRequester<T> = ActionRequester<EventMatchStoryAction<T>,
|
|
10
|
+
export type EventMatchStoryActionProcessor<T, MSR extends AnyMatchStoryResult> = ActionProcessor<EventMatchStoryAction<T>, MSR>;
|
|
11
|
+
export type EventMatchStoryActionRequester<T, MSR extends AnyMatchStoryResult> = ActionRequester<EventMatchStoryAction<T>, MSR>;
|
package/lib/actions/index.d.ts
CHANGED
package/lib/actions/index.js
CHANGED
|
@@ -24,4 +24,6 @@ __exportStar(require("./log"), exports);
|
|
|
24
24
|
__exportStar(require("./math"), exports);
|
|
25
25
|
__exportStar(require("./network"), exports);
|
|
26
26
|
__exportStar(require("./platform"), exports);
|
|
27
|
+
__exportStar(require("./queue"), exports);
|
|
27
28
|
__exportStar(require("./system"), exports);
|
|
29
|
+
__exportStar(require("./userDirectory"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueueActionType = void 0;
|
|
4
|
+
var QueueActionType;
|
|
5
|
+
(function (QueueActionType) {
|
|
6
|
+
QueueActionType["SendMessages"] = "@quidproquo-core/Queue/SendMessage";
|
|
7
|
+
})(QueueActionType = exports.QueueActionType || (exports.QueueActionType = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askQueueSendMessages = void 0;
|
|
4
|
+
const QueueActionType_1 = require("./QueueActionType");
|
|
5
|
+
function* askQueueSendMessages(queueName, ...queueMessages) {
|
|
6
|
+
return yield {
|
|
7
|
+
type: QueueActionType_1.QueueActionType.SendMessages,
|
|
8
|
+
payload: {
|
|
9
|
+
queueMessages,
|
|
10
|
+
queueName,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.askQueueSendMessages = askQueueSendMessages;
|
|
15
|
+
// export function* askQueueSendMessagesUnordered<T>(
|
|
16
|
+
// queueName: string,
|
|
17
|
+
// ...queueMessages: QueueMessage<T>[]
|
|
18
|
+
// ): QueueSendMessageActionRequester<T> {
|
|
19
|
+
// // Breakup the messages in batches of 10
|
|
20
|
+
// const batches = [];
|
|
21
|
+
// }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
|
|
2
|
+
import { QueueActionType } from './QueueActionType';
|
|
3
|
+
export interface QueueMessage<T = null> {
|
|
4
|
+
type: string;
|
|
5
|
+
payload: T;
|
|
6
|
+
}
|
|
7
|
+
export interface QueueSendMessageActionPayload<T> {
|
|
8
|
+
queueName: string;
|
|
9
|
+
queueMessages: QueueMessage<T>[];
|
|
10
|
+
}
|
|
11
|
+
export interface QueueSendMessageAction<T> extends Action<QueueSendMessageActionPayload<T>> {
|
|
12
|
+
type: QueueActionType.SendMessages;
|
|
13
|
+
payload: QueueSendMessageActionPayload<T>;
|
|
14
|
+
}
|
|
15
|
+
export type QueueSendMessageActionProcessor<T> = ActionProcessor<QueueSendMessageAction<T>, void>;
|
|
16
|
+
export type QueueSendMessageActionRequester<T> = ActionRequester<QueueSendMessageAction<T>, void>;
|
|
@@ -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("./QueueActionType"), exports);
|
|
18
|
+
__exportStar(require("./QueueSendMessageActionRequester"), exports);
|
|
19
|
+
__exportStar(require("./QueueSendMessageActionTypes"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum UserDirectoryActionType {
|
|
2
|
+
CreateUser = "@quidproquo-core/UserDirectory/CreateUser",
|
|
3
|
+
AuthenticateUser = "@quidproquo-core/UserDirectory/AuthenticateUser"
|
|
4
|
+
}
|
|
5
|
+
export declare enum AuthenticateUserChallenge {
|
|
6
|
+
NONE = "NONE",
|
|
7
|
+
RESET_PASSWORD = "RESET_PASSWORD"
|
|
8
|
+
}
|
|
9
|
+
export interface AuthenticationInfo {
|
|
10
|
+
accessToken?: string;
|
|
11
|
+
expiresIn?: number;
|
|
12
|
+
idToken?: string;
|
|
13
|
+
refreshToken?: string;
|
|
14
|
+
tokenType?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AuthenticateUserResponse {
|
|
17
|
+
challenge: AuthenticateUserChallenge;
|
|
18
|
+
authenticationInfo?: AuthenticationInfo;
|
|
19
|
+
session?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthenticateUserChallenge = exports.UserDirectoryActionType = void 0;
|
|
4
|
+
var UserDirectoryActionType;
|
|
5
|
+
(function (UserDirectoryActionType) {
|
|
6
|
+
UserDirectoryActionType["CreateUser"] = "@quidproquo-core/UserDirectory/CreateUser";
|
|
7
|
+
UserDirectoryActionType["AuthenticateUser"] = "@quidproquo-core/UserDirectory/AuthenticateUser";
|
|
8
|
+
})(UserDirectoryActionType = exports.UserDirectoryActionType || (exports.UserDirectoryActionType = {}));
|
|
9
|
+
var AuthenticateUserChallenge;
|
|
10
|
+
(function (AuthenticateUserChallenge) {
|
|
11
|
+
AuthenticateUserChallenge["NONE"] = "NONE";
|
|
12
|
+
AuthenticateUserChallenge["RESET_PASSWORD"] = "RESET_PASSWORD";
|
|
13
|
+
})(AuthenticateUserChallenge = exports.AuthenticateUserChallenge || (exports.AuthenticateUserChallenge = {}));
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { UserDirectoryAuthenticateUserActionRequester, AuthenticateUserRequest } from './UserDirectoryAuthenticateUserActionTypes';
|
|
2
|
+
export declare function askUserDirectoryAuthenticateUser(userDirectoryName: string, authenticateUserRequest: AuthenticateUserRequest): UserDirectoryAuthenticateUserActionRequester;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askUserDirectoryAuthenticateUser = void 0;
|
|
4
|
+
const UserDirectoryActionType_1 = require("./UserDirectoryActionType");
|
|
5
|
+
function* askUserDirectoryAuthenticateUser(userDirectoryName, authenticateUserRequest) {
|
|
6
|
+
return yield {
|
|
7
|
+
type: UserDirectoryActionType_1.UserDirectoryActionType.AuthenticateUser,
|
|
8
|
+
payload: {
|
|
9
|
+
userDirectoryName,
|
|
10
|
+
authenticateUserRequest,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.askUserDirectoryAuthenticateUser = askUserDirectoryAuthenticateUser;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
|
|
2
|
+
import { UserDirectoryActionType, AuthenticateUserResponse } from './UserDirectoryActionType';
|
|
3
|
+
export interface AuthenticateUserRequest {
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UserDirectoryAuthenticateUserActionPayload {
|
|
8
|
+
userDirectoryName: string;
|
|
9
|
+
authenticateUserRequest: AuthenticateUserRequest;
|
|
10
|
+
}
|
|
11
|
+
export interface UserDirectoryAuthenticateUserAction extends Action<UserDirectoryAuthenticateUserActionPayload> {
|
|
12
|
+
type: UserDirectoryActionType.AuthenticateUser;
|
|
13
|
+
payload: UserDirectoryAuthenticateUserActionPayload;
|
|
14
|
+
}
|
|
15
|
+
export type UserDirectoryAuthenticateUserActionProcessor = ActionProcessor<UserDirectoryAuthenticateUserAction, AuthenticateUserResponse>;
|
|
16
|
+
export type UserDirectoryAuthenticateUserActionRequester = ActionRequester<UserDirectoryAuthenticateUserAction, AuthenticateUserResponse>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askUserDirectoryCreateUser = void 0;
|
|
4
|
+
const UserDirectoryActionType_1 = require("./UserDirectoryActionType");
|
|
5
|
+
function* askUserDirectoryCreateUser(userDirectoryName, createUserRequest) {
|
|
6
|
+
return yield {
|
|
7
|
+
type: UserDirectoryActionType_1.UserDirectoryActionType.CreateUser,
|
|
8
|
+
payload: {
|
|
9
|
+
userDirectoryName,
|
|
10
|
+
createUserRequest,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.askUserDirectoryCreateUser = askUserDirectoryCreateUser;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
|
|
2
|
+
import { UserDirectoryActionType } from './UserDirectoryActionType';
|
|
3
|
+
export interface CreateUserRequest {
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
phone?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UserDirectoryCreateUserActionPayload {
|
|
9
|
+
userDirectoryName: string;
|
|
10
|
+
createUserRequest: CreateUserRequest;
|
|
11
|
+
}
|
|
12
|
+
export interface UserDirectoryCreateUserAction extends Action<UserDirectoryCreateUserActionPayload> {
|
|
13
|
+
type: UserDirectoryActionType.CreateUser;
|
|
14
|
+
payload: UserDirectoryCreateUserActionPayload;
|
|
15
|
+
}
|
|
16
|
+
export type UserDirectoryCreateUserActionProcessor = ActionProcessor<UserDirectoryCreateUserAction, string>;
|
|
17
|
+
export type UserDirectoryCreateUserActionRequester = ActionRequester<UserDirectoryCreateUserAction, string>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './UserDirectoryActionType';
|
|
2
|
+
export * from './UserDirectoryAuthenticateUserActionRequester';
|
|
3
|
+
export * from './UserDirectoryAuthenticateUserActionTypes';
|
|
4
|
+
export * from './UserDirectoryCreateUserActionRequester';
|
|
5
|
+
export * from './UserDirectoryCreateUserActionTypes';
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./UserDirectoryActionType"), exports);
|
|
18
|
+
__exportStar(require("./UserDirectoryAuthenticateUserActionRequester"), exports);
|
|
19
|
+
__exportStar(require("./UserDirectoryAuthenticateUserActionTypes"), exports);
|
|
20
|
+
__exportStar(require("./UserDirectoryCreateUserActionRequester"), exports);
|
|
21
|
+
__exportStar(require("./UserDirectoryCreateUserActionTypes"), exports);
|
|
@@ -5,7 +5,9 @@ export declare enum QPQCoreConfigSettingType {
|
|
|
5
5
|
secret = "@quidproquo-core/config/secret",
|
|
6
6
|
parameter = "@quidproquo-core/config/parameter",
|
|
7
7
|
actionProcessors = "@quidproquo-core/config/actionProcessors",
|
|
8
|
-
buildPath = "@quidproquo-core/config/buildPath"
|
|
8
|
+
buildPath = "@quidproquo-core/config/buildPath",
|
|
9
|
+
queue = "@quidproquo-core/config/Queue",
|
|
10
|
+
userDirectory = "@quidproquo-core/config/UserDirectory"
|
|
9
11
|
}
|
|
10
12
|
export interface QPQConfigSetting {
|
|
11
13
|
configSettingType: string;
|
package/lib/config/QPQConfig.js
CHANGED
|
@@ -10,4 +10,6 @@ var QPQCoreConfigSettingType;
|
|
|
10
10
|
QPQCoreConfigSettingType["parameter"] = "@quidproquo-core/config/parameter";
|
|
11
11
|
QPQCoreConfigSettingType["actionProcessors"] = "@quidproquo-core/config/actionProcessors";
|
|
12
12
|
QPQCoreConfigSettingType["buildPath"] = "@quidproquo-core/config/buildPath";
|
|
13
|
+
QPQCoreConfigSettingType["queue"] = "@quidproquo-core/config/Queue";
|
|
14
|
+
QPQCoreConfigSettingType["userDirectory"] = "@quidproquo-core/config/UserDirectory";
|
|
13
15
|
})(QPQCoreConfigSettingType = exports.QPQCoreConfigSettingType || (exports.QPQCoreConfigSettingType = {}));
|
|
@@ -2,6 +2,8 @@ export * from './actionProcessors';
|
|
|
2
2
|
export * from './applicationModule';
|
|
3
3
|
export * from './buildPath';
|
|
4
4
|
export * from './parameter';
|
|
5
|
+
export * from './queue';
|
|
5
6
|
export * from './schedule';
|
|
6
7
|
export * from './secret';
|
|
7
8
|
export * from './storageDrive';
|
|
9
|
+
export * from './userDirectory';
|
|
@@ -18,6 +18,8 @@ __exportStar(require("./actionProcessors"), exports);
|
|
|
18
18
|
__exportStar(require("./applicationModule"), exports);
|
|
19
19
|
__exportStar(require("./buildPath"), exports);
|
|
20
20
|
__exportStar(require("./parameter"), exports);
|
|
21
|
+
__exportStar(require("./queue"), exports);
|
|
21
22
|
__exportStar(require("./schedule"), exports);
|
|
22
23
|
__exportStar(require("./secret"), exports);
|
|
23
24
|
__exportStar(require("./storageDrive"), exports);
|
|
25
|
+
__exportStar(require("./userDirectory"), exports);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { QPQConfigSetting, QPQConfigAdvancedSettings } from '../QPQConfig';
|
|
2
|
+
export interface QpqSourceEntry {
|
|
3
|
+
src: string;
|
|
4
|
+
runtime: string;
|
|
5
|
+
}
|
|
6
|
+
export interface QpqQueueProcessors {
|
|
7
|
+
[type: string]: QpqSourceEntry;
|
|
8
|
+
}
|
|
9
|
+
export interface QPQConfigAdvancedQueueSettings extends QPQConfigAdvancedSettings {
|
|
10
|
+
batchSize?: number;
|
|
11
|
+
batchWindowInSeconds?: number;
|
|
12
|
+
concurrency?: number;
|
|
13
|
+
maxRetry?: number;
|
|
14
|
+
ttRetryInSeconds?: number;
|
|
15
|
+
hasDeadLetterQueue?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface QueueQPQConfigSetting extends QPQConfigSetting {
|
|
18
|
+
name: string;
|
|
19
|
+
buildPath: string;
|
|
20
|
+
batchSize: number;
|
|
21
|
+
batchWindowInSeconds: number;
|
|
22
|
+
concurrency: number;
|
|
23
|
+
maxRetry: number;
|
|
24
|
+
ttRetryInSeconds: number;
|
|
25
|
+
hasDeadLetterQueue: boolean;
|
|
26
|
+
qpqQueueProcessors: QpqQueueProcessors;
|
|
27
|
+
}
|
|
28
|
+
export declare const defineQueue: (name: string, buildPath: string, processors: QpqQueueProcessors, options?: QPQConfigAdvancedQueueSettings) => QueueQPQConfigSetting;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineQueue = void 0;
|
|
4
|
+
const QPQConfig_1 = require("../QPQConfig");
|
|
5
|
+
const defineQueue = (name, buildPath, processors, options) => ({
|
|
6
|
+
configSettingType: QPQConfig_1.QPQCoreConfigSettingType.queue,
|
|
7
|
+
uniqueKey: name,
|
|
8
|
+
name,
|
|
9
|
+
buildPath,
|
|
10
|
+
batchSize: (options === null || options === void 0 ? void 0 : options.batchSize) || 1,
|
|
11
|
+
batchWindowInSeconds: (options === null || options === void 0 ? void 0 : options.batchWindowInSeconds) || 5,
|
|
12
|
+
concurrency: (options === null || options === void 0 ? void 0 : options.concurrency) || 1,
|
|
13
|
+
maxRetry: (options === null || options === void 0 ? void 0 : options.maxRetry) || 3,
|
|
14
|
+
ttRetryInSeconds: Math.min((options === null || options === void 0 ? void 0 : options.ttRetryInSeconds) || 300, 30),
|
|
15
|
+
hasDeadLetterQueue: (options === null || options === void 0 ? void 0 : options.hasDeadLetterQueue) || true,
|
|
16
|
+
qpqQueueProcessors: processors,
|
|
17
|
+
});
|
|
18
|
+
exports.defineQueue = defineQueue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { QPQConfigSetting, QPQConfigAdvancedSettings } from '../QPQConfig';
|
|
2
|
+
export interface QPQConfigAdvancedUserDirectorySettings extends QPQConfigAdvancedSettings {
|
|
3
|
+
phoneRequired?: boolean;
|
|
4
|
+
selfSignUpEnabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface UserDirectoryQPQConfigSetting extends QPQConfigSetting {
|
|
7
|
+
name: string;
|
|
8
|
+
phoneRequired: boolean;
|
|
9
|
+
selfSignUpEnabled: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const defineUserDirectory: (name: string, options?: QPQConfigAdvancedUserDirectorySettings) => UserDirectoryQPQConfigSetting;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineUserDirectory = void 0;
|
|
4
|
+
const QPQConfig_1 = require("../QPQConfig");
|
|
5
|
+
const defineUserDirectory = (name, options) => ({
|
|
6
|
+
configSettingType: QPQConfig_1.QPQCoreConfigSettingType.userDirectory,
|
|
7
|
+
uniqueKey: name,
|
|
8
|
+
name,
|
|
9
|
+
phoneRequired: (options === null || options === void 0 ? void 0 : options.phoneRequired) || false,
|
|
10
|
+
selfSignUpEnabled: (options === null || options === void 0 ? void 0 : options.selfSignUpEnabled) || true,
|
|
11
|
+
});
|
|
12
|
+
exports.defineUserDirectory = defineUserDirectory;
|
package/lib/qpqCoreUtils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QPQConfig, QPQConfigSetting } from './config/QPQConfig';
|
|
2
|
-
import { ApplicationModuleQPQConfigSetting, StorageDriveQPQConfigSetting, ScheduleQPQConfigSetting, SecretQPQConfigSetting, ParameterQPQConfigSetting } from './config/settings';
|
|
2
|
+
import { ApplicationModuleQPQConfigSetting, StorageDriveQPQConfigSetting, ScheduleQPQConfigSetting, SecretQPQConfigSetting, ParameterQPQConfigSetting, QueueQPQConfigSetting, QpqQueueProcessors, UserDirectoryQPQConfigSetting } from './config/settings';
|
|
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 getApplicationModuleSetting: (qpqConfig: QPQConfig) => ApplicationModuleQPQConfigSetting;
|
|
@@ -9,14 +9,20 @@ export declare const getApplicationModuleFeature: (qpqConfig: QPQConfig) => stri
|
|
|
9
9
|
export declare const getConfigRoot: (qpqConfig: QPQConfig) => string;
|
|
10
10
|
export declare const getApplicationModuleEnvironment: (qpqConfig: QPQConfig) => string;
|
|
11
11
|
export declare const getApplicationModuleDeployRegion: (qpqConfig: QPQConfig) => string;
|
|
12
|
+
export declare const getStorageDrives: (configs: QPQConfig) => StorageDriveQPQConfigSetting[];
|
|
13
|
+
export declare const getQueues: (configs: QPQConfig) => QueueQPQConfigSetting[];
|
|
12
14
|
export declare const getStorageDriveNames: (configs: QPQConfig) => string[];
|
|
13
15
|
export declare const getActionProcessorSources: (configs: QPQConfig) => string[];
|
|
14
16
|
export declare const getScheduleEvents: (configs: QPQConfig) => ScheduleQPQConfigSetting[];
|
|
15
|
-
export declare const
|
|
17
|
+
export declare const getQueueSrcEntries: (configs: QPQConfig) => string[];
|
|
18
|
+
export declare const getAllSrcEntries: (qpqConfig: QPQConfig) => string[];
|
|
16
19
|
export declare const getOwnedSecrets: (configs: QPQConfig) => SecretQPQConfigSetting[];
|
|
20
|
+
export declare const getUserDirectories: (configs: QPQConfig) => UserDirectoryQPQConfigSetting[];
|
|
17
21
|
export declare const getOwnedParameters: (configs: QPQConfig) => ParameterQPQConfigSetting[];
|
|
18
22
|
export declare const getSharedSecrets: (configs: QPQConfig) => SecretQPQConfigSetting[];
|
|
19
23
|
export declare const getBuildPath: (configs: QPQConfig) => string;
|
|
20
24
|
export declare const getUniqueKeyForSetting: (setting: QPQConfigSetting) => string;
|
|
21
25
|
export declare const getScheduleEntryFullPath: (qpqConfig: QPQConfig, scheduleConfig: ScheduleQPQConfigSetting) => string;
|
|
22
26
|
export declare const getStorageDriveUploadFullPath: (qpqConfig: QPQConfig, storageDriveConfig: StorageDriveQPQConfigSetting) => string;
|
|
27
|
+
export declare const getQueueEntryFullPath: (qpqConfig: QPQConfig, queueConfig: QueueQPQConfigSetting) => string;
|
|
28
|
+
export declare const getQueueQueueProcessors: (name: string, qpqConfig: QPQConfig) => QpqQueueProcessors;
|
package/lib/qpqCoreUtils.js
CHANGED
|
@@ -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.getStorageDriveUploadFullPath = exports.getScheduleEntryFullPath = exports.getUniqueKeyForSetting = exports.getBuildPath = exports.getSharedSecrets = exports.getOwnedParameters = exports.getOwnedSecrets = exports.getAllSrcEntries = exports.getScheduleEvents = exports.getActionProcessorSources = exports.getStorageDriveNames = exports.getApplicationModuleDeployRegion = exports.getApplicationModuleEnvironment = exports.getConfigRoot = exports.getApplicationModuleFeature = exports.getApplicationModuleName = exports.getApplicationName = exports.getApplicationModuleSetting = exports.getConfigSetting = exports.getConfigSettings = void 0;
|
|
26
|
+
exports.getQueueQueueProcessors = exports.getQueueEntryFullPath = exports.getStorageDriveUploadFullPath = exports.getScheduleEntryFullPath = exports.getUniqueKeyForSetting = exports.getBuildPath = exports.getSharedSecrets = exports.getOwnedParameters = exports.getUserDirectories = exports.getOwnedSecrets = exports.getAllSrcEntries = exports.getQueueSrcEntries = exports.getScheduleEvents = exports.getActionProcessorSources = exports.getStorageDriveNames = exports.getQueues = exports.getStorageDrives = exports.getApplicationModuleDeployRegion = exports.getApplicationModuleEnvironment = exports.getConfigRoot = exports.getApplicationModuleFeature = exports.getApplicationModuleName = exports.getApplicationName = exports.getApplicationModuleSetting = exports.getConfigSetting = exports.getConfigSettings = void 0;
|
|
27
27
|
const path = __importStar(require("path"));
|
|
28
28
|
const QPQConfig_1 = require("./config/QPQConfig");
|
|
29
29
|
const getConfigSettings = (configs, configSettingType) => {
|
|
@@ -67,6 +67,14 @@ const getApplicationModuleDeployRegion = (qpqConfig) => {
|
|
|
67
67
|
return (0, exports.getApplicationModuleSetting)(qpqConfig).deployRegion || 'us-east-1';
|
|
68
68
|
};
|
|
69
69
|
exports.getApplicationModuleDeployRegion = getApplicationModuleDeployRegion;
|
|
70
|
+
const getStorageDrives = (configs) => {
|
|
71
|
+
return (0, exports.getConfigSettings)(configs, QPQConfig_1.QPQCoreConfigSettingType.storageDrive);
|
|
72
|
+
};
|
|
73
|
+
exports.getStorageDrives = getStorageDrives;
|
|
74
|
+
const getQueues = (configs) => {
|
|
75
|
+
return (0, exports.getConfigSettings)(configs, QPQConfig_1.QPQCoreConfigSettingType.queue);
|
|
76
|
+
};
|
|
77
|
+
exports.getQueues = getQueues;
|
|
70
78
|
const getStorageDriveNames = (configs) => {
|
|
71
79
|
const storageDriveNames = (0, exports.getConfigSettings)(configs, QPQConfig_1.QPQCoreConfigSettingType.storageDrive).map((sd) => sd.storageDrive);
|
|
72
80
|
return storageDriveNames;
|
|
@@ -78,13 +86,17 @@ const getActionProcessorSources = (configs) => {
|
|
|
78
86
|
};
|
|
79
87
|
exports.getActionProcessorSources = getActionProcessorSources;
|
|
80
88
|
const getScheduleEvents = (configs) => {
|
|
81
|
-
|
|
82
|
-
return scheduleEvents;
|
|
89
|
+
return (0, exports.getConfigSettings)(configs, QPQConfig_1.QPQCoreConfigSettingType.schedule);
|
|
83
90
|
};
|
|
84
91
|
exports.getScheduleEvents = getScheduleEvents;
|
|
92
|
+
const getQueueSrcEntries = (configs) => {
|
|
93
|
+
const queueConfigs = (0, exports.getConfigSettings)(configs, QPQConfig_1.QPQCoreConfigSettingType.queue);
|
|
94
|
+
return queueConfigs.reduce((acc, qc) => [...acc, ...Object.values(qc.qpqQueueProcessors).map((q) => q.src)], []);
|
|
95
|
+
};
|
|
96
|
+
exports.getQueueSrcEntries = getQueueSrcEntries;
|
|
85
97
|
// Used in bundlers to know where and what to build and index
|
|
86
|
-
const getAllSrcEntries = (
|
|
87
|
-
return [...(0, exports.getScheduleEvents)(
|
|
98
|
+
const getAllSrcEntries = (qpqConfig) => {
|
|
99
|
+
return [...(0, exports.getScheduleEvents)(qpqConfig).map((r) => r.src), ...(0, exports.getQueueSrcEntries)(qpqConfig)];
|
|
88
100
|
};
|
|
89
101
|
exports.getAllSrcEntries = getAllSrcEntries;
|
|
90
102
|
const getOwnedSecrets = (configs) => {
|
|
@@ -92,6 +104,11 @@ const getOwnedSecrets = (configs) => {
|
|
|
92
104
|
return secrets.filter((s) => s.owned);
|
|
93
105
|
};
|
|
94
106
|
exports.getOwnedSecrets = getOwnedSecrets;
|
|
107
|
+
const getUserDirectories = (configs) => {
|
|
108
|
+
const userDirectories = (0, exports.getConfigSettings)(configs, QPQConfig_1.QPQCoreConfigSettingType.userDirectory);
|
|
109
|
+
return userDirectories;
|
|
110
|
+
};
|
|
111
|
+
exports.getUserDirectories = getUserDirectories;
|
|
95
112
|
const getOwnedParameters = (configs) => {
|
|
96
113
|
const secrets = (0, exports.getConfigSettings)(configs, QPQConfig_1.QPQCoreConfigSettingType.parameter);
|
|
97
114
|
return secrets.filter((s) => s.owned);
|
|
@@ -125,3 +142,13 @@ const getStorageDriveUploadFullPath = (qpqConfig, storageDriveConfig) => {
|
|
|
125
142
|
return path.join((0, exports.getConfigRoot)(qpqConfig), storageDriveConfig.copyPath || '');
|
|
126
143
|
};
|
|
127
144
|
exports.getStorageDriveUploadFullPath = getStorageDriveUploadFullPath;
|
|
145
|
+
const getQueueEntryFullPath = (qpqConfig, queueConfig) => {
|
|
146
|
+
return path.join((0, exports.getConfigRoot)(qpqConfig), queueConfig.buildPath);
|
|
147
|
+
};
|
|
148
|
+
exports.getQueueEntryFullPath = getQueueEntryFullPath;
|
|
149
|
+
const getQueueQueueProcessors = (name, qpqConfig) => {
|
|
150
|
+
const seoConfigs = (0, exports.getConfigSettings)(qpqConfig, QPQConfig_1.QPQCoreConfigSettingType.queue);
|
|
151
|
+
const queueConfig = seoConfigs.find((c) => c.name === name);
|
|
152
|
+
return (queueConfig === null || queueConfig === void 0 ? void 0 : queueConfig.qpqQueueProcessors) || {};
|
|
153
|
+
};
|
|
154
|
+
exports.getQueueQueueProcessors = getQueueQueueProcessors;
|
package/lib/qpqRuntime.js
CHANGED
|
@@ -68,6 +68,7 @@ const createRuntime = (session, actionProcessors, getTimeNow, logger, newGuid) =
|
|
|
68
68
|
console.log('Caught Error: ', JSON.stringify((0, actionLogic_1.resolveActionResultError)(actionResult)));
|
|
69
69
|
return Object.assign(Object.assign({}, response), { finishedAt: getTimeNow(), error: (0, actionLogic_1.resolveActionResultError)(actionResult) });
|
|
70
70
|
}
|
|
71
|
+
// TODO: Catch errors here ~ business logic
|
|
71
72
|
action = reader.next((0, actionLogic_1.resolveActionResult)(actionResult));
|
|
72
73
|
}
|
|
73
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function askProcessEvent(...eventArguments: any): Generator<import("../actions/event").EventTransformEventParamsAction<any> | import("../actions/event").
|
|
1
|
+
export declare function askProcessEvent(...eventArguments: any): Generator<import("../actions/event").EventTransformEventParamsAction<any> | import("../actions/event").EventMatchStoryAction<unknown> | import("../actions/event").EventAutoRespondAction<unknown, import("../actions/event").AnyMatchStoryResult> | import("../actions/system").SystemExecuteStoryAction<any[]> | import("../actions/event").EventTransformResponseResultAction<any, unknown>, unknown, any>;
|
|
@@ -6,16 +6,24 @@ const system_1 = require("../actions/system");
|
|
|
6
6
|
function* askProcessEvent(...eventArguments) {
|
|
7
7
|
// Transform event params
|
|
8
8
|
const transformedEventParams = yield* (0, event_1.askEventTransformEventParams)(...eventArguments);
|
|
9
|
+
// Try and match a story to execute
|
|
10
|
+
const matchResult = yield* (0, event_1.askEventMatchStory)(transformedEventParams);
|
|
11
|
+
console.log(matchResult.src);
|
|
12
|
+
console.log(matchResult.runtime);
|
|
13
|
+
console.log(matchResult.runtimeOptions);
|
|
14
|
+
console.log(matchResult.config);
|
|
9
15
|
// See if we want to exit early (validation / auth etc)
|
|
10
|
-
const earlyExitResponse = yield* (0, event_1.askEventAutoRespond)(transformedEventParams);
|
|
16
|
+
const earlyExitResponse = yield* (0, event_1.askEventAutoRespond)(transformedEventParams, matchResult);
|
|
17
|
+
console.log('earlyExitResponse', earlyExitResponse);
|
|
11
18
|
if (earlyExitResponse) {
|
|
12
19
|
// Transform the early exit response if needed
|
|
13
20
|
return yield* (0, event_1.askEventTransformResponseResult)(earlyExitResponse, transformedEventParams);
|
|
14
21
|
}
|
|
15
|
-
// Try and match a story to execute
|
|
16
|
-
const { src, runtime, options } = yield* (0, event_1.askEventMatchStory)(transformedEventParams);
|
|
17
22
|
// Execute the story
|
|
18
|
-
const result = yield* (0, system_1.askExecuteStory)('route', src, runtime, [
|
|
23
|
+
const result = yield* (0, system_1.askExecuteStory)('route', matchResult.src, matchResult.runtime, [
|
|
24
|
+
transformedEventParams,
|
|
25
|
+
matchResult.runtimeOptions,
|
|
26
|
+
]);
|
|
19
27
|
// return the result of the story back to the event caller
|
|
20
28
|
return yield* (0, event_1.askEventTransformResponseResult)(result, transformedEventParams);
|
|
21
29
|
}
|