quidproquo-actionprocessor-awslambda 0.0.30 → 0.0.32

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.
@@ -4,4 +4,3 @@ export interface UrlMatch {
4
4
  params: Record<string, string> | null;
5
5
  }
6
6
  export declare const matchUrl: (path: string, url: string) => UrlMatch;
7
- export declare const loadModule: (src: string) => Promise<any>;
@@ -1,15 +1,6 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.loadModule = exports.matchUrl = exports.randomGuid = void 0;
3
+ exports.matchUrl = exports.randomGuid = void 0;
13
4
  const crypto_1 = require("crypto");
14
5
  const node_match_path_1 = require("node-match-path");
15
6
  const randomGuid = () => {
@@ -26,11 +17,3 @@ const matchUrl = (path, url) => {
26
17
  };
27
18
  };
28
19
  exports.matchUrl = matchUrl;
29
- const loadModule = (src) => __awaiter(void 0, void 0, void 0, function* () {
30
- try {
31
- return require(src);
32
- }
33
- catch (_a) { }
34
- return null;
35
- });
36
- exports.loadModule = loadModule;
@@ -1,7 +1,7 @@
1
1
  import { SystemExecuteStoryActionProcessor } from 'quidproquo-core';
2
- import { QPQAWSLambdaConfig } from '../../../runtimeConfig/QPQAWSLambdaConfig';
2
+ import { DynamicModuleLoader } from '../../../types/DynamicLoader';
3
3
  export declare const getDateNow: () => string;
4
- declare const _default: (runtimeConfig: QPQAWSLambdaConfig) => {
4
+ declare const _default: (dynamicModuleLoader: DynamicModuleLoader) => {
5
5
  "@quidproquo-core/System/ExecuteStory": SystemExecuteStoryActionProcessor<any[]>;
6
6
  };
7
7
  export default _default;
@@ -14,9 +14,9 @@ const quidproquo_core_1 = require("quidproquo-core");
14
14
  const awsLambdaUtils_1 = require("./../../../awsLambdaUtils");
15
15
  const getDateNow = () => new Date().toISOString();
16
16
  exports.getDateNow = getDateNow;
17
- const getProcessExecuteStory = (runtimeConfig) => {
17
+ const getProcessExecuteStory = (dynamicModuleLoader) => {
18
18
  return (payload, session, actionProcessors) => __awaiter(void 0, void 0, void 0, function* () {
19
- let module = yield (0, awsLambdaUtils_1.loadModule)(payload.src);
19
+ let module = yield dynamicModuleLoader(payload.src);
20
20
  if (module === null) {
21
21
  return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Module not found [${payload.src}]`);
22
22
  }
@@ -38,9 +38,8 @@ const getProcessExecuteStory = (runtimeConfig) => {
38
38
  });
39
39
  });
40
40
  };
41
- exports.default = (runtimeConfig) => {
42
- // const appName = qpqCoreUtils.getAppName(config);
41
+ exports.default = (dynamicModuleLoader) => {
43
42
  return {
44
- [quidproquo_core_1.SystemActionType.ExecuteStory]: getProcessExecuteStory(runtimeConfig),
43
+ [quidproquo_core_1.SystemActionType.ExecuteStory]: getProcessExecuteStory(dynamicModuleLoader),
45
44
  };
46
45
  };
@@ -1,5 +1,5 @@
1
- import { QPQAWSLambdaConfig } from '../../../runtimeConfig/QPQAWSLambdaConfig';
2
- declare const _default: (runtimeConfig: QPQAWSLambdaConfig) => {
1
+ import { DynamicModuleLoader } from '../../../types/DynamicLoader';
2
+ declare const _default: (dynamicModuleLoader: DynamicModuleLoader) => {
3
3
  "@quidproquo-core/System/ExecuteStory": import("quidproquo-core/lib").SystemExecuteStoryActionProcessor<any[]>;
4
4
  };
5
5
  export default _default;
@@ -4,4 +4,4 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const getExecuteStoryActionProcessor_1 = __importDefault(require("./getExecuteStoryActionProcessor"));
7
- exports.default = (runtimeConfig) => (Object.assign({}, (0, getExecuteStoryActionProcessor_1.default)(runtimeConfig)));
7
+ exports.default = (dynamicModuleLoader) => (Object.assign({}, (0, getExecuteStoryActionProcessor_1.default)(dynamicModuleLoader)));
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './getActionProcessor';
2
2
  export * as awsLambdaUtils from './awsLambdaUtils';
3
3
  export * from './runtimeConfig/QPQAWSLambdaConfig';
4
+ export * from './types/DynamicLoader';
package/lib/index.js CHANGED
@@ -30,3 +30,4 @@ exports.awsLambdaUtils = void 0;
30
30
  __exportStar(require("./getActionProcessor"), exports);
31
31
  exports.awsLambdaUtils = __importStar(require("./awsLambdaUtils"));
32
32
  __exportStar(require("./runtimeConfig/QPQAWSLambdaConfig"), exports);
33
+ __exportStar(require("./types/DynamicLoader"), exports);
@@ -0,0 +1 @@
1
+ export type DynamicModuleLoader = (src: string) => Promise<any>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-actionprocessor-awslambda",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.js",