quidproquo-core 0.0.142 → 0.0.144
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/config/settings/secret.d.ts +6 -4
- package/lib/commonjs/config/settings/secret.js +3 -3
- package/lib/commonjs/qpqCoreUtils.d.ts +2 -2
- package/lib/commonjs/qpqCoreUtils.js +32 -18
- package/lib/commonjs/stories/askProcessEvent.js +1 -1
- package/lib/commonjs/types/StorySession.d.ts +2 -1
- package/lib/commonjs/types/StorySession.js +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CrossModuleOwner } from '../../types';
|
|
2
|
+
import { QPQConfigAdvancedSettings, QPQConfigSetting } from '../QPQConfig';
|
|
3
|
+
export interface QPQConfigAdvancedSecretSettings extends QPQConfigAdvancedSettings {
|
|
4
|
+
owner?: CrossModuleOwner<'secretName'>;
|
|
5
|
+
}
|
|
2
6
|
export interface SecretQPQConfigSetting extends QPQConfigSetting {
|
|
3
7
|
key: string;
|
|
4
|
-
value: string;
|
|
5
|
-
owned: boolean;
|
|
6
8
|
}
|
|
7
|
-
export declare const defineSecret: (key: string,
|
|
9
|
+
export declare const defineSecret: (key: string, options?: QPQConfigAdvancedSecretSettings) => SecretQPQConfigSetting;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineSecret = void 0;
|
|
4
|
+
const qpqCoreUtils_1 = require("../../qpqCoreUtils");
|
|
4
5
|
const QPQConfig_1 = require("../QPQConfig");
|
|
5
|
-
const defineSecret = (key,
|
|
6
|
+
const defineSecret = (key, options) => ({
|
|
6
7
|
configSettingType: QPQConfig_1.QPQCoreConfigSettingType.secret,
|
|
7
8
|
uniqueKey: key,
|
|
8
9
|
key,
|
|
9
|
-
|
|
10
|
-
owned,
|
|
10
|
+
owner: (0, qpqCoreUtils_1.convertCrossModuleOwnerToGenericResourceNameOverride)(options === null || options === void 0 ? void 0 : options.owner),
|
|
11
11
|
});
|
|
12
12
|
exports.defineSecret = defineSecret;
|
|
@@ -63,11 +63,11 @@ export declare const getScheduleEvents: (configs: QPQConfig) => ScheduleQPQConfi
|
|
|
63
63
|
export declare const getQueueSrcEntries: (configs: QPQConfig) => string[];
|
|
64
64
|
export declare const getUserDirectorySrcEntries: (qpqConfig: QPQConfig) => string[];
|
|
65
65
|
export declare const getAllSrcEntries: (qpqConfig: QPQConfig) => string[];
|
|
66
|
-
export declare const
|
|
66
|
+
export declare const getSecretByName: (secretName: string, qpqConfig: QPQConfig) => SecretQPQConfigSetting;
|
|
67
|
+
export declare const getOwnedSecrets: (qpqConfig: QPQConfig) => SecretQPQConfigSetting[];
|
|
67
68
|
export declare const getGlobalConfigValue: <T>(qpqConfig: QPQConfig, name: string) => T;
|
|
68
69
|
export declare const getUserDirectories: (configs: QPQConfig) => UserDirectoryQPQConfigSetting[];
|
|
69
70
|
export declare const getParameterConfigs: (qpqConfig: QPQConfig) => ParameterQPQConfigSetting[];
|
|
70
|
-
export declare const getSharedSecrets: (configs: QPQConfig) => SecretQPQConfigSetting[];
|
|
71
71
|
export declare const getUniqueKeyForSetting: (setting: QPQConfigSetting) => string;
|
|
72
72
|
export declare const getScheduleEntryFullPath: (qpqConfig: QPQConfig, scheduleConfig: ScheduleQPQConfigSetting) => string;
|
|
73
73
|
export declare const getStorageDriveEntryFullPath: (qpqConfig: QPQConfig, storageDriveConfig: StorageDriveQPQConfigSetting) => string;
|
|
@@ -34,7 +34,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
34
34
|
return t;
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.convertCrossModuleOwnerToGenericResourceNameOverride = exports.getQueueQueueProcessors = exports.getUserDirectoryEntryFullPath = exports.getQueueEntryFullPath = exports.getStorageDriveUploadFullPath = exports.getDeployEventFullPath = exports.getStorageDriveEntryFullPath = exports.getScheduleEntryFullPath = exports.getUniqueKeyForSetting = exports.
|
|
37
|
+
exports.convertCrossModuleOwnerToGenericResourceNameOverride = exports.getQueueQueueProcessors = exports.getUserDirectoryEntryFullPath = exports.getQueueEntryFullPath = exports.getStorageDriveUploadFullPath = exports.getDeployEventFullPath = exports.getStorageDriveEntryFullPath = exports.getScheduleEntryFullPath = exports.getUniqueKeyForSetting = exports.getParameterConfigs = exports.getUserDirectories = exports.getGlobalConfigValue = exports.getOwnedSecrets = exports.getSecretByName = exports.getAllSrcEntries = exports.getUserDirectorySrcEntries = exports.getQueueSrcEntries = exports.getScheduleEvents = exports.getUserDirectoryEmailTemplates = exports.getActionProcessorSources = exports.getKeyValueStoreByName = exports.resolveCrossServiceResourceName = exports.getOwnedStorageDrives = exports.getOwnedKeyValueStores = exports.getDeployEventConfigs = exports.getAllKeyValueStores = exports.getOwnedItems = exports.getEventBusConfigByName = exports.getOwnedEventBusConfigs = exports.getAllEventBusConfigs = exports.getStorageDriveNames = exports.getQueues = exports.getStorageDriveByName = exports.getStorageDrives = exports.getApplicationModuleDeployRegion = exports.getApplicationModuleEnvironment = exports.getConfigRoot = exports.getApplicationModuleFeature = exports.getApplicationModuleName = exports.getApplicationName = exports.getApplicationModuleSetting = exports.getConfigSetting = exports.getConfigSettings = exports.flattenQpqConfig = void 0;
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
39
|
const QPQConfig_1 = require("./config/QPQConfig");
|
|
40
40
|
/**
|
|
@@ -148,7 +148,7 @@ const getStorageDrives = (configs) => {
|
|
|
148
148
|
};
|
|
149
149
|
exports.getStorageDrives = getStorageDrives;
|
|
150
150
|
const getStorageDriveByName = (storageDriveName, configs) => {
|
|
151
|
-
return (0, exports.getStorageDrives)(configs).find(sd => sd.storageDrive === storageDriveName);
|
|
151
|
+
return (0, exports.getStorageDrives)(configs).find((sd) => sd.storageDrive === storageDriveName);
|
|
152
152
|
};
|
|
153
153
|
exports.getStorageDriveByName = getStorageDriveByName;
|
|
154
154
|
const getQueues = (configs) => {
|
|
@@ -171,7 +171,7 @@ const getOwnedEventBusConfigs = (qpqConfig) => {
|
|
|
171
171
|
};
|
|
172
172
|
exports.getOwnedEventBusConfigs = getOwnedEventBusConfigs;
|
|
173
173
|
const getEventBusConfigByName = (eventBusName, qpqConfig) => {
|
|
174
|
-
const eventBusConfig = (0, exports.getAllEventBusConfigs)(qpqConfig).find(eb => eb.name === eventBusName);
|
|
174
|
+
const eventBusConfig = (0, exports.getAllEventBusConfigs)(qpqConfig).find((eb) => eb.name === eventBusName);
|
|
175
175
|
return eventBusConfig;
|
|
176
176
|
};
|
|
177
177
|
exports.getEventBusConfigByName = getEventBusConfigByName;
|
|
@@ -180,10 +180,13 @@ const getOwnedItems = (settings, qpqConfig) => {
|
|
|
180
180
|
const appName = (0, exports.getApplicationName)(qpqConfig);
|
|
181
181
|
const appFeature = (0, exports.getApplicationModuleFeature)(qpqConfig);
|
|
182
182
|
const appEnvironment = (0, exports.getApplicationModuleEnvironment)(qpqConfig);
|
|
183
|
-
return settings.filter((s) => !s.owner ||
|
|
184
|
-
(!s.owner.
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
return settings.filter((s) => !s.owner ||
|
|
184
|
+
((!s.owner.module || s.owner.module === appModuleName) &&
|
|
185
|
+
(!s.owner.application || s.owner.application === appName) &&
|
|
186
|
+
(s.owner.feature === undefined ||
|
|
187
|
+
(!s.owner.feature && !appFeature) ||
|
|
188
|
+
s.owner.feature === appFeature) &&
|
|
189
|
+
(!s.owner.environment || s.owner.environment === appEnvironment)));
|
|
187
190
|
};
|
|
188
191
|
exports.getOwnedItems = getOwnedItems;
|
|
189
192
|
const getAllKeyValueStores = (qpqConfig) => {
|
|
@@ -240,7 +243,12 @@ const getQueueSrcEntries = (configs) => {
|
|
|
240
243
|
exports.getQueueSrcEntries = getQueueSrcEntries;
|
|
241
244
|
const getUserDirectorySrcEntries = (qpqConfig) => {
|
|
242
245
|
const userConfigs = (0, exports.getUserDirectories)(qpqConfig);
|
|
243
|
-
return userConfigs
|
|
246
|
+
return userConfigs
|
|
247
|
+
.reduce((acc, ud) => [
|
|
248
|
+
...acc,
|
|
249
|
+
...Object.values(ud.emailTemplates).map((et) => et === null || et === void 0 ? void 0 : et.src),
|
|
250
|
+
], [])
|
|
251
|
+
.filter((src) => !!src);
|
|
244
252
|
};
|
|
245
253
|
exports.getUserDirectorySrcEntries = getUserDirectorySrcEntries;
|
|
246
254
|
// Used in bundlers to know where and what to build and index
|
|
@@ -250,17 +258,28 @@ const getAllSrcEntries = (qpqConfig) => {
|
|
|
250
258
|
...(0, exports.getQueueSrcEntries)(qpqConfig),
|
|
251
259
|
...(0, exports.getUserDirectorySrcEntries)(qpqConfig),
|
|
252
260
|
...(0, exports.getDeployEventConfigs)(qpqConfig).map((r) => r.src.src),
|
|
253
|
-
...(0, exports.getStorageDrives)(qpqConfig)
|
|
261
|
+
...(0, exports.getStorageDrives)(qpqConfig)
|
|
262
|
+
.flatMap((sd) => { var _a, _b, _c, _d; return [(_b = (_a = sd.onEvent) === null || _a === void 0 ? void 0 : _a.create) === null || _b === void 0 ? void 0 : _b.src, (_d = (_c = sd.onEvent) === null || _c === void 0 ? void 0 : _c.delete) === null || _d === void 0 ? void 0 : _d.src]; })
|
|
263
|
+
.filter((src) => !!src),
|
|
254
264
|
];
|
|
255
265
|
};
|
|
256
266
|
exports.getAllSrcEntries = getAllSrcEntries;
|
|
257
|
-
const
|
|
258
|
-
const secrets = (0, exports.getConfigSettings)(
|
|
259
|
-
|
|
267
|
+
const getSecretByName = (secretName, qpqConfig) => {
|
|
268
|
+
const secrets = (0, exports.getConfigSettings)(qpqConfig, QPQConfig_1.QPQCoreConfigSettingType.secret);
|
|
269
|
+
const secret = secrets.find((s) => s.key === secretName);
|
|
270
|
+
if (!secret) {
|
|
271
|
+
throw new Error(`Can not find secret [${secretName}]`);
|
|
272
|
+
}
|
|
273
|
+
return secret;
|
|
274
|
+
};
|
|
275
|
+
exports.getSecretByName = getSecretByName;
|
|
276
|
+
const getOwnedSecrets = (qpqConfig) => {
|
|
277
|
+
const secrets = (0, exports.getConfigSettings)(qpqConfig, QPQConfig_1.QPQCoreConfigSettingType.secret);
|
|
278
|
+
return (0, exports.getOwnedItems)(secrets, qpqConfig);
|
|
260
279
|
};
|
|
261
280
|
exports.getOwnedSecrets = getOwnedSecrets;
|
|
262
281
|
const getGlobalConfigValue = (qpqConfig, name) => {
|
|
263
|
-
const global = (0, exports.getConfigSettings)(qpqConfig, QPQConfig_1.QPQCoreConfigSettingType.global).find(g => g.key === name);
|
|
282
|
+
const global = (0, exports.getConfigSettings)(qpqConfig, QPQConfig_1.QPQCoreConfigSettingType.global).find((g) => g.key === name);
|
|
264
283
|
if (!global) {
|
|
265
284
|
throw new Error(`Global config ${name} not found`);
|
|
266
285
|
}
|
|
@@ -277,11 +296,6 @@ const getParameterConfigs = (qpqConfig) => {
|
|
|
277
296
|
return parameters;
|
|
278
297
|
};
|
|
279
298
|
exports.getParameterConfigs = getParameterConfigs;
|
|
280
|
-
const getSharedSecrets = (configs) => {
|
|
281
|
-
const secrets = (0, exports.getConfigSettings)(configs, QPQConfig_1.QPQCoreConfigSettingType.secret);
|
|
282
|
-
return secrets.filter((s) => !s.owned);
|
|
283
|
-
};
|
|
284
|
-
exports.getSharedSecrets = getSharedSecrets;
|
|
285
299
|
const getUniqueKeyForSetting = (setting) => {
|
|
286
300
|
const type = setting.configSettingType.split('/').pop();
|
|
287
301
|
const key = setting.uniqueKey;
|
|
@@ -13,7 +13,7 @@ function* askProcessEvent(...eventArguments) {
|
|
|
13
13
|
// See if we want to exit early (validation / auth etc)
|
|
14
14
|
const earlyExitResponse = yield* (0, event_1.askEventAutoRespond)(transformedEventParams, matchResult);
|
|
15
15
|
// Log the early exit response
|
|
16
|
-
yield* (0, actions_1.askLogCreate)(types_1.LogLevelEnum.Info, `earlyExitResponse [${earlyExitResponse}]`);
|
|
16
|
+
yield* (0, actions_1.askLogCreate)(types_1.LogLevelEnum.Info, `earlyExitResponse [${JSON.stringify(earlyExitResponse, null, 2)}]`);
|
|
17
17
|
if (earlyExitResponse) {
|
|
18
18
|
// Transform the early exit response if needed
|
|
19
19
|
return yield* (0, event_1.askEventTransformResponseResult)(earlyExitResponse, transformedEventParams);
|
|
@@ -50,7 +50,8 @@ export declare enum QpqRuntimeType {
|
|
|
50
50
|
SEND_EMAIL_EVENT = "SEND_EMAIL_EVENT",
|
|
51
51
|
WEBSOCKET_EVENT = "WEBSOCKET_EVENT",
|
|
52
52
|
DEPLOY_EVENT = "DEPLOY_EVENT",
|
|
53
|
-
STORAGEDRIVE_EVENT = "STORAGEDRIVE_EVENT"
|
|
53
|
+
STORAGEDRIVE_EVENT = "STORAGEDRIVE_EVENT",
|
|
54
|
+
CLOUD_FLARE_DEPLOY = "CLOUD_FLARE_DEPLOY"
|
|
54
55
|
}
|
|
55
56
|
export interface StoryResult<TArgs extends Array<any>, TResult = any> {
|
|
56
57
|
input: TArgs;
|
|
@@ -13,4 +13,5 @@ var QpqRuntimeType;
|
|
|
13
13
|
QpqRuntimeType["WEBSOCKET_EVENT"] = "WEBSOCKET_EVENT";
|
|
14
14
|
QpqRuntimeType["DEPLOY_EVENT"] = "DEPLOY_EVENT";
|
|
15
15
|
QpqRuntimeType["STORAGEDRIVE_EVENT"] = "STORAGEDRIVE_EVENT";
|
|
16
|
+
QpqRuntimeType["CLOUD_FLARE_DEPLOY"] = "CLOUD_FLARE_DEPLOY";
|
|
16
17
|
})(QpqRuntimeType = exports.QpqRuntimeType || (exports.QpqRuntimeType = {}));
|