quidproquo-actionprocessor-awslambda 0.0.220 → 0.0.221

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.
Files changed (43) hide show
  1. package/lib/commonjs/awsLambdaUtils.js +9 -8
  2. package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/matchStory.js +0 -1
  3. package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/matchStory.js +3 -6
  4. package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/matchStory.js +0 -1
  5. package/lib/commonjs/getActionProcessor/core/event/cognito/createAuthChallenge/matchStory.js +4 -5
  6. package/lib/commonjs/getActionProcessor/core/event/cognito/customMessage/autoRespond.js +3 -4
  7. package/lib/commonjs/getActionProcessor/core/event/cognito/customMessage/matchStory.js +3 -7
  8. package/lib/commonjs/getActionProcessor/core/event/cognito/defineAuthChallenge/matchStory.js +3 -4
  9. package/lib/commonjs/getActionProcessor/core/event/cognito/verifyAuthChallenge/matchStory.js +4 -5
  10. package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/matchStory.js +1 -2
  11. package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/matchStory.js +0 -1
  12. package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/matchStory.js +0 -1
  13. package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/matchStory.js +3 -1
  14. package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/types.d.ts +2 -2
  15. package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/types.js +2 -1
  16. package/lib/commonjs/getActionProcessor/core/event/sqs/queue/autoRespond.js +2 -2
  17. package/lib/commonjs/getActionProcessor/core/event/sqs/queue/matchStory.js +4 -4
  18. package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreUpsertActionProcessor.js +1 -0
  19. package/lib/commonjs/getActionProcessor/core/system/getExecuteStoryActionProcessor.js +7 -9
  20. package/lib/commonjs/runtimeConfig/QPQAWSResourceMap.d.ts +2 -2
  21. package/lib/commonjs/types/DynamicLoader.d.ts +2 -1
  22. package/lib/esm/awsLambdaUtils.js +9 -8
  23. package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/matchStory.js +0 -1
  24. package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/websocket/matchStory.js +3 -6
  25. package/lib/esm/getActionProcessor/core/event/cloudFrontOriginRequest/matchStory.js +0 -1
  26. package/lib/esm/getActionProcessor/core/event/cognito/createAuthChallenge/matchStory.js +3 -4
  27. package/lib/esm/getActionProcessor/core/event/cognito/customMessage/autoRespond.js +3 -3
  28. package/lib/esm/getActionProcessor/core/event/cognito/customMessage/matchStory.js +3 -6
  29. package/lib/esm/getActionProcessor/core/event/cognito/defineAuthChallenge/matchStory.js +3 -4
  30. package/lib/esm/getActionProcessor/core/event/cognito/verifyAuthChallenge/matchStory.js +3 -4
  31. package/lib/esm/getActionProcessor/core/event/eventBridgeEvent/deployStack/matchStory.js +1 -2
  32. package/lib/esm/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/matchStory.js +0 -1
  33. package/lib/esm/getActionProcessor/core/event/lambda/serviceFunction/matchStory.js +0 -1
  34. package/lib/esm/getActionProcessor/core/event/s3/fileEvent/matchStory.js +3 -1
  35. package/lib/esm/getActionProcessor/core/event/s3/fileEvent/types.d.ts +2 -2
  36. package/lib/esm/getActionProcessor/core/event/s3/fileEvent/types.js +2 -1
  37. package/lib/esm/getActionProcessor/core/event/sqs/queue/autoRespond.js +2 -2
  38. package/lib/esm/getActionProcessor/core/event/sqs/queue/matchStory.js +4 -4
  39. package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreUpsertActionProcessor.js +1 -0
  40. package/lib/esm/getActionProcessor/core/system/getExecuteStoryActionProcessor.js +7 -9
  41. package/lib/esm/runtimeConfig/QPQAWSResourceMap.d.ts +2 -2
  42. package/lib/esm/types/DynamicLoader.d.ts +2 -1
  43. package/package.json +5 -5
@@ -9,6 +9,7 @@ const randomGuid = () => {
9
9
  };
10
10
  exports.randomGuid = randomGuid;
11
11
  const matchUrl = (path, url) => {
12
+ console.log('Matching: ', path);
12
13
  // /attempt/{attemptUuid}/result/{test} => /attempt/:attemptUuid/result/:test
13
14
  const modifiedPath = path.replaceAll(/{(.+?)}/g, (m, g) => `:${g}`);
14
15
  const matchResult = (0, node_match_path_1.match)(modifiedPath, url);
@@ -21,21 +22,21 @@ exports.matchUrl = matchUrl;
21
22
  const getS3BucketStorageClassFromStorageDriveTier = (driveTier) => {
22
23
  switch (driveTier) {
23
24
  case quidproquo_core_1.StorageDriveTier.REGULAR:
24
- return "STANDARD";
25
+ return 'STANDARD';
25
26
  case quidproquo_core_1.StorageDriveTier.OCCASIONAL_ACCESS:
26
- return "STANDARD_IA";
27
+ return 'STANDARD_IA';
27
28
  case quidproquo_core_1.StorageDriveTier.SINGLE_ZONE_OCCASIONAL_ACCESS:
28
- return "ONEZONE_IA";
29
+ return 'ONEZONE_IA';
29
30
  case quidproquo_core_1.StorageDriveTier.COLD_STORAGE:
30
- return "GLACIER";
31
+ return 'GLACIER';
31
32
  case quidproquo_core_1.StorageDriveTier.COLD_STORAGE_INSTANT_ACCESS:
32
- return "GLACIER_IR";
33
+ return 'GLACIER_IR';
33
34
  case quidproquo_core_1.StorageDriveTier.DEEP_COLD_STORAGE:
34
- return "DEEP_ARCHIVE";
35
+ return 'DEEP_ARCHIVE';
35
36
  case quidproquo_core_1.StorageDriveTier.SMART_TIERING:
36
- return "INTELLIGENT_TIERING";
37
+ return 'INTELLIGENT_TIERING';
37
38
  default:
38
- return "INTELLIGENT_TIERING";
39
+ return 'INTELLIGENT_TIERING';
39
40
  }
40
41
  };
41
42
  exports.getS3BucketStorageClassFromStorageDriveTier = getS3BucketStorageClassFromStorageDriveTier;
@@ -30,7 +30,6 @@ const getProcessMatchStory = (qpqConfig) => {
30
30
  return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `route not found [${qpqEventRecord.path}] - [${quidproquo_webserver_1.qpqWebServerUtils.getHeaderValue('user-agent', qpqEventRecord.headers)}]`);
31
31
  }
32
32
  return (0, quidproquo_core_1.actionResult)({
33
- src: matchedRoute.route.src,
34
33
  runtime: matchedRoute.route.runtime,
35
34
  runtimeOptions: matchedRoute.match.params || {},
36
35
  // TODO: Make this aware of the API that we are eventing
@@ -18,18 +18,15 @@ const getProcessMatchStory = (qpqConfig) => {
18
18
  switch (qpqEventRecord.eventType) {
19
19
  case quidproquo_webserver_1.WebSocketEventType.Connect:
20
20
  return (0, quidproquo_core_1.actionResult)({
21
- src: userDirectoryConfig.eventProcessors.onConnect.src,
22
- runtime: userDirectoryConfig.eventProcessors.onConnect.runtime,
21
+ runtime: userDirectoryConfig.eventProcessors.onConnect,
23
22
  });
24
23
  case quidproquo_webserver_1.WebSocketEventType.Disconnect:
25
24
  return (0, quidproquo_core_1.actionResult)({
26
- src: userDirectoryConfig.eventProcessors.onDisconnect.src,
27
- runtime: userDirectoryConfig.eventProcessors.onDisconnect.runtime,
25
+ runtime: userDirectoryConfig.eventProcessors.onDisconnect,
28
26
  });
29
27
  case quidproquo_webserver_1.WebSocketEventType.Message:
30
28
  return (0, quidproquo_core_1.actionResult)({
31
- src: userDirectoryConfig.eventProcessors.onMessage.src,
32
- runtime: userDirectoryConfig.eventProcessors.onMessage.runtime,
29
+ runtime: userDirectoryConfig.eventProcessors.onMessage,
33
30
  });
34
31
  default:
35
32
  return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Websocket lambda not implemented for ${qpqEventRecord.eventType}`);
@@ -29,7 +29,6 @@ const getProcessMatchStory = (qpqConfig) => {
29
29
  return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `seo not found [${qpqEventRecord.path}]`);
30
30
  }
31
31
  return (0, quidproquo_core_1.actionResult)({
32
- src: matchedSeoConfig.route.src,
33
32
  runtime: matchedSeoConfig.route.runtime,
34
33
  runtimeOptions: matchedSeoConfig.match.params || {},
35
34
  config: matchedSeoConfig.route,
@@ -16,13 +16,12 @@ const GLOBAL_USER_DIRECTORY_NAME = process.env.userDirectoryName;
16
16
  const getProcessMatchStory = (qpqConfig) => {
17
17
  const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
18
18
  return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
19
- var _a, _b;
20
- if (!((_b = (_a = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.customAuthRuntime) === null || _a === void 0 ? void 0 : _a.createAuthChallenge) === null || _b === void 0 ? void 0 : _b.src)) {
21
- return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.createAuthChallenge.src in [${GLOBAL_USER_DIRECTORY_NAME}]`);
19
+ var _a;
20
+ if (!((_a = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.customAuthRuntime) === null || _a === void 0 ? void 0 : _a.createAuthChallenge)) {
21
+ return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.createAuthChallenge in [${GLOBAL_USER_DIRECTORY_NAME}]`);
22
22
  }
23
23
  return (0, quidproquo_core_2.actionResult)({
24
- src: userDirectoryConfig.customAuthRuntime.createAuthChallenge.src,
25
- runtime: userDirectoryConfig.customAuthRuntime.createAuthChallenge.runtime,
24
+ runtime: userDirectoryConfig.customAuthRuntime.createAuthChallenge,
26
25
  });
27
26
  });
28
27
  };
@@ -15,21 +15,20 @@ const quidproquo_webserver_1 = require("quidproquo-webserver");
15
15
  const getProcessAutoRespond = (qpqConfig) => {
16
16
  const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === types_1.GLOBAL_USER_DIRECTORY_NAME);
17
17
  return ({ qpqEventRecord, matchResult }) => __awaiter(void 0, void 0, void 0, function* () {
18
- var _a, _b, _c, _d, _e, _f;
19
18
  const getErrorResult = () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Email lambda not implemented for ${qpqEventRecord.eventType}`);
20
19
  switch (qpqEventRecord.eventType) {
21
20
  case quidproquo_webserver_1.EmailSendEventType.ResetPassword:
22
- if (!((_a = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword) === null || _a === void 0 ? void 0 : _a.src) || !((_b = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword) === null || _b === void 0 ? void 0 : _b.runtime)) {
21
+ if (!(userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword)) {
23
22
  return getErrorResult();
24
23
  }
25
24
  break;
26
25
  case quidproquo_webserver_1.EmailSendEventType.ResetPasswordAdmin:
27
- if (!((_c = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin) === null || _c === void 0 ? void 0 : _c.src) || !((_d = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin) === null || _d === void 0 ? void 0 : _d.runtime)) {
26
+ if (!(userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin)) {
28
27
  return getErrorResult();
29
28
  }
30
29
  break;
31
30
  case quidproquo_webserver_1.EmailSendEventType.VerifyEmail:
32
- if (!((_e = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail) === null || _e === void 0 ? void 0 : _e.src) || !((_f = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail) === null || _f === void 0 ? void 0 : _f.runtime)) {
31
+ if (!(userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail)) {
33
32
  return getErrorResult();
34
33
  }
35
34
  break;
@@ -16,22 +16,18 @@ const GLOBAL_USER_DIRECTORY_NAME = process.env.userDirectoryName;
16
16
  const getProcessMatchStory = (qpqConfig) => {
17
17
  const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
18
18
  return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
19
- var _a, _b, _c, _d, _e, _f;
20
19
  switch (qpqEventRecord.eventType) {
21
20
  case quidproquo_webserver_1.EmailSendEventType.ResetPassword:
22
21
  return (0, quidproquo_core_1.actionResult)({
23
- src: (_a = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword) === null || _a === void 0 ? void 0 : _a.src,
24
- runtime: (_b = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword) === null || _b === void 0 ? void 0 : _b.runtime,
22
+ runtime: userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword,
25
23
  });
26
24
  case quidproquo_webserver_1.EmailSendEventType.ResetPasswordAdmin:
27
25
  return (0, quidproquo_core_1.actionResult)({
28
- src: (_c = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin) === null || _c === void 0 ? void 0 : _c.src,
29
- runtime: (_d = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin) === null || _d === void 0 ? void 0 : _d.runtime,
26
+ runtime: userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin,
30
27
  });
31
28
  case quidproquo_webserver_1.EmailSendEventType.VerifyEmail:
32
29
  return (0, quidproquo_core_1.actionResult)({
33
- src: (_e = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail) === null || _e === void 0 ? void 0 : _e.src,
34
- runtime: (_f = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail) === null || _f === void 0 ? void 0 : _f.runtime,
30
+ runtime: userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail,
35
31
  });
36
32
  default:
37
33
  return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Email lambda not implemented for ${qpqEventRecord.eventType}`);
@@ -17,12 +17,11 @@ const getProcessMatchStory = (qpqConfig) => {
17
17
  const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
18
18
  return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
19
19
  var _a;
20
- if (!userDirectoryConfig || !((_a = userDirectoryConfig.customAuthRuntime) === null || _a === void 0 ? void 0 : _a.defineAuthChallenge.src)) {
21
- return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.defineAuthChallenge.src in [${GLOBAL_USER_DIRECTORY_NAME}]`);
20
+ if (!userDirectoryConfig || !((_a = userDirectoryConfig.customAuthRuntime) === null || _a === void 0 ? void 0 : _a.defineAuthChallenge)) {
21
+ return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.defineAuthChallenge in [${GLOBAL_USER_DIRECTORY_NAME}]`);
22
22
  }
23
23
  return (0, quidproquo_core_2.actionResult)({
24
- src: userDirectoryConfig.customAuthRuntime.defineAuthChallenge.src,
25
- runtime: userDirectoryConfig.customAuthRuntime.defineAuthChallenge.runtime,
24
+ runtime: userDirectoryConfig.customAuthRuntime.defineAuthChallenge,
26
25
  });
27
26
  });
28
27
  };
@@ -16,13 +16,12 @@ const GLOBAL_USER_DIRECTORY_NAME = process.env.userDirectoryName;
16
16
  const getProcessMatchStory = (qpqConfig) => {
17
17
  const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
18
18
  return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
19
- var _a, _b;
20
- if (!((_b = (_a = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.customAuthRuntime) === null || _a === void 0 ? void 0 : _a.verifyAuthChallenge) === null || _b === void 0 ? void 0 : _b.src)) {
21
- return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.verifyAuthChallenge.src in [${GLOBAL_USER_DIRECTORY_NAME}]`);
19
+ var _a;
20
+ if (!((_a = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.customAuthRuntime) === null || _a === void 0 ? void 0 : _a.verifyAuthChallenge)) {
21
+ return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.verifyAuthChallenge in [${GLOBAL_USER_DIRECTORY_NAME}]`);
22
22
  }
23
23
  return (0, quidproquo_core_2.actionResult)({
24
- src: userDirectoryConfig.customAuthRuntime.verifyAuthChallenge.src,
25
- runtime: userDirectoryConfig.customAuthRuntime.verifyAuthChallenge.runtime,
24
+ runtime: userDirectoryConfig.customAuthRuntime.verifyAuthChallenge,
26
25
  });
27
26
  });
28
27
  };
@@ -19,8 +19,7 @@ const getProcessMatchStory = (qpqConfig) => {
19
19
  return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Could not find deploy event config ${GLOBAL_DEPLOY_EVENT_NAME}`);
20
20
  }
21
21
  return (0, quidproquo_core_1.actionResult)({
22
- src: deployConfig.src.src,
23
- runtime: deployConfig.src.runtime,
22
+ runtime: deployConfig.runtime,
24
23
  });
25
24
  });
26
25
  };
@@ -15,7 +15,6 @@ const lambdaRuntimeConfig = JSON.parse(process.env.lambdaRuntimeConfig || '{}');
15
15
  const getProcessMatchStory = (qpqConfig) => {
16
16
  return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
17
17
  return (0, quidproquo_core_1.actionResult)({
18
- src: lambdaRuntimeConfig.src,
19
18
  runtime: lambdaRuntimeConfig.runtime,
20
19
  runtimeOptions: {},
21
20
  });
@@ -20,7 +20,6 @@ const getProcessMatchStory = (qpqConfig) => {
20
20
  return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `service function not found [${qpqEventRecord.functionName}]`);
21
21
  }
22
22
  return (0, quidproquo_core_1.actionResult)({
23
- src: matchedRoute.src,
24
23
  runtime: matchedRoute.runtime,
25
24
  });
26
25
  });
@@ -13,7 +13,9 @@ const quidproquo_core_1 = require("quidproquo-core");
13
13
  const types_1 = require("./types");
14
14
  const getProcessMatchStory = (qpqConfig) => {
15
15
  return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
16
- return (0, quidproquo_core_1.actionResult)(types_1.GLOBAL_STORAGE_DRIVE_RUNTIME);
16
+ return (0, quidproquo_core_1.actionResult)({
17
+ runtime: types_1.GLOBAL_STORAGE_DRIVE_RUNTIME,
18
+ });
17
19
  });
18
20
  };
19
21
  exports.default = (qpqConfig) => {
@@ -1,8 +1,8 @@
1
1
  import { StorageDriveEvent, StorageDriveEventResponse } from 'quidproquo-webserver';
2
2
  import { S3Event, Context } from 'aws-lambda';
3
- import { MatchStoryResult, QpqSourceEntry } from 'quidproquo-core';
3
+ import { MatchStoryResult, QpqFunctionRuntime } from 'quidproquo-core';
4
4
  export declare const GLOBAL_STORAGE_DRIVE_NAME: string;
5
- export declare const GLOBAL_STORAGE_DRIVE_RUNTIME: QpqSourceEntry;
5
+ export declare const GLOBAL_STORAGE_DRIVE_RUNTIME: QpqFunctionRuntime;
6
6
  export type EventInput = [S3Event, Context];
7
7
  export type EventOutput = void;
8
8
  export type InternalEventRecord = StorageDriveEvent;
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GLOBAL_STORAGE_DRIVE_RUNTIME = exports.GLOBAL_STORAGE_DRIVE_NAME = void 0;
4
4
  // Customs
5
5
  exports.GLOBAL_STORAGE_DRIVE_NAME = process.env.storageDriveName;
6
- exports.GLOBAL_STORAGE_DRIVE_RUNTIME = JSON.parse(process.env.storageDriveEntry || '{}');
6
+ // TODO: Get this from the storageDriveConfig.
7
+ exports.GLOBAL_STORAGE_DRIVE_RUNTIME = JSON.parse(process.env.storageDriveEntry || '"/::"');
@@ -11,9 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const quidproquo_core_1 = require("quidproquo-core");
13
13
  const getProcessAutoRespond = (qpqConfig) => {
14
- return ({ qpqEventRecord, matchResult }) => __awaiter(void 0, void 0, void 0, function* () {
14
+ return ({ matchResult }) => __awaiter(void 0, void 0, void 0, function* () {
15
15
  // If we could not match, we can just auto respond...
16
- if (!matchResult.src || !matchResult.runtime) {
16
+ if (!matchResult.runtime) {
17
17
  // Just say we have finished gracefully.
18
18
  return (0, quidproquo_core_1.actionResult)(true);
19
19
  }
@@ -21,9 +21,10 @@ exports.getQueueConfigSetting = getQueueConfigSetting;
21
21
  const getProcessMatchStory = (qpqConfig) => {
22
22
  // TODO: Get this out of the qpqconfig like the other event processors
23
23
  const queueQPQConfigSetting = (0, exports.getQueueConfigSetting)();
24
+ const queueQueueProcessors = quidproquo_core_1.qpqCoreUtils.getQueueQueueProcessors(queueQPQConfigSetting.name, qpqConfig);
25
+ const queueTypes = Object.keys(queueQueueProcessors).sort();
24
26
  return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
25
- const queueQueueProcessors = quidproquo_core_1.qpqCoreUtils.getQueueQueueProcessors(queueQPQConfigSetting.name, qpqConfig);
26
- const queueTypes = Object.keys(queueQueueProcessors).sort();
27
+ console.log('qpqEventRecord', JSON.stringify(qpqEventRecord, null, 2));
27
28
  // Find the most relevant match
28
29
  const matchedQueueType = queueTypes
29
30
  .map((qt) => ({
@@ -41,8 +42,7 @@ const getProcessMatchStory = (qpqConfig) => {
41
42
  }
42
43
  const sourceEntry = queueQueueProcessors[matchedQueueType.queueType];
43
44
  return (0, quidproquo_core_1.actionResult)({
44
- src: sourceEntry.src,
45
- runtime: sourceEntry.runtime,
45
+ runtime: sourceEntry,
46
46
  runtimeOptions: matchedQueueType.match.params || {},
47
47
  config: matchedQueueType.queueType,
48
48
  });
@@ -36,6 +36,7 @@ const getProcessKeyValueStoreUpsert = (qpqConfig) => {
36
36
  catch (error) {
37
37
  return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
38
38
  InternalServerError: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_2.KeyValueStoreUpsertErrorTypeEnum.ServiceUnavailable, 'KVS Service Unavailable'),
39
+ ResourceNotFoundException: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_2.KeyValueStoreUpsertErrorTypeEnum.ResourceNotFound, 'KVS Resource Not Found'),
39
40
  });
40
41
  }
41
42
  });
@@ -18,13 +18,12 @@ const getProcessExecuteStory = (qpqConfig, dynamicModuleLoader) => {
18
18
  const moduleName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
19
19
  return (payload, session, actionProcessors, logger) => __awaiter(void 0, void 0, void 0, function* () {
20
20
  var _a, _b, _c, _d;
21
- let module = yield dynamicModuleLoader(payload.src);
22
- if (module === null) {
23
- return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Module not found [${payload.src}]`);
24
- }
25
- const story = module[payload.runtime];
21
+ console.log('Trying to load module');
22
+ let story = yield dynamicModuleLoader(payload.runtime);
23
+ console.log('After - Trying to load module');
26
24
  if (!story) {
27
- return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `[${payload.runtime}] not found in module [${payload.src}]`);
25
+ console.log('No story');
26
+ return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Unable to dynamically load: [${payload.runtime}]`);
28
27
  }
29
28
  const resolveStory = (0, quidproquo_core_1.createRuntime)(qpqConfig, {
30
29
  context: ((_a = payload.storySession) === null || _a === void 0 ? void 0 : _a.context) || session.context,
@@ -33,11 +32,10 @@ const getProcessExecuteStory = (qpqConfig, dynamicModuleLoader) => {
33
32
  correlation: ((_d = payload.storySession) === null || _d === void 0 ? void 0 : _d.correlation) || session.correlation,
34
33
  }, actionProcessors, exports.getDateNow, logger,
35
34
  // TODO: Share this logic.
36
- `${moduleName}::${(0, awsLambdaUtils_1.randomGuid)()}`, quidproquo_core_1.QpqRuntimeType.EXECUTE_STORY, [`${payload.src}::${payload.runtime}`]);
35
+ `${moduleName}::${(0, awsLambdaUtils_1.randomGuid)()}`, quidproquo_core_1.QpqRuntimeType.EXECUTE_STORY, [payload.runtime]);
37
36
  const storyResult = yield resolveStory(story, payload.params);
38
37
  if (storyResult.error) {
39
- const stack = `${payload.src}::${payload.runtime}`;
40
- return (0, quidproquo_core_1.actionResultError)(storyResult.error.errorType, storyResult.error.errorText, storyResult.error.errorStack ? `${stack} -> [${storyResult.error.errorStack}]` : stack);
38
+ return (0, quidproquo_core_1.actionResultError)(storyResult.error.errorType, storyResult.error.errorText, storyResult.error.errorStack ? `${payload.runtime} -> [${storyResult.error.errorStack}]` : payload.runtime);
41
39
  }
42
40
  return (0, quidproquo_core_1.actionResult)(storyResult.result);
43
41
  });
@@ -1,4 +1,4 @@
1
+ import { QpqFunctionRuntime } from 'quidproquo-core';
1
2
  export interface LambdaRuntimeConfig {
2
- src: string;
3
- runtime: string;
3
+ runtime: QpqFunctionRuntime;
4
4
  }
@@ -1 +1,2 @@
1
- export type DynamicModuleLoader = (src: string) => Promise<any>;
1
+ import { QpqFunctionRuntime } from 'quidproquo-core';
2
+ export type DynamicModuleLoader = (runtime: QpqFunctionRuntime) => Promise<any>;
@@ -5,6 +5,7 @@ export const randomGuid = () => {
5
5
  return randomUUID();
6
6
  };
7
7
  export const matchUrl = (path, url) => {
8
+ console.log('Matching: ', path);
8
9
  // /attempt/{attemptUuid}/result/{test} => /attempt/:attemptUuid/result/:test
9
10
  const modifiedPath = path.replaceAll(/{(.+?)}/g, (m, g) => `:${g}`);
10
11
  const matchResult = match(modifiedPath, url);
@@ -16,20 +17,20 @@ export const matchUrl = (path, url) => {
16
17
  export const getS3BucketStorageClassFromStorageDriveTier = (driveTier) => {
17
18
  switch (driveTier) {
18
19
  case StorageDriveTier.REGULAR:
19
- return "STANDARD";
20
+ return 'STANDARD';
20
21
  case StorageDriveTier.OCCASIONAL_ACCESS:
21
- return "STANDARD_IA";
22
+ return 'STANDARD_IA';
22
23
  case StorageDriveTier.SINGLE_ZONE_OCCASIONAL_ACCESS:
23
- return "ONEZONE_IA";
24
+ return 'ONEZONE_IA';
24
25
  case StorageDriveTier.COLD_STORAGE:
25
- return "GLACIER";
26
+ return 'GLACIER';
26
27
  case StorageDriveTier.COLD_STORAGE_INSTANT_ACCESS:
27
- return "GLACIER_IR";
28
+ return 'GLACIER_IR';
28
29
  case StorageDriveTier.DEEP_COLD_STORAGE:
29
- return "DEEP_ARCHIVE";
30
+ return 'DEEP_ARCHIVE';
30
31
  case StorageDriveTier.SMART_TIERING:
31
- return "INTELLIGENT_TIERING";
32
+ return 'INTELLIGENT_TIERING';
32
33
  default:
33
- return "INTELLIGENT_TIERING";
34
+ return 'INTELLIGENT_TIERING';
34
35
  }
35
36
  };
@@ -19,7 +19,6 @@ const getProcessMatchStory = (qpqConfig) => {
19
19
  return actionResultError(ErrorTypeEnum.NotFound, `route not found [${qpqEventRecord.path}] - [${qpqWebServerUtils.getHeaderValue('user-agent', qpqEventRecord.headers)}]`);
20
20
  }
21
21
  return actionResult({
22
- src: matchedRoute.route.src,
23
22
  runtime: matchedRoute.route.runtime,
24
23
  runtimeOptions: matchedRoute.match.params || {},
25
24
  // TODO: Make this aware of the API that we are eventing
@@ -7,18 +7,15 @@ const getProcessMatchStory = (qpqConfig) => {
7
7
  switch (qpqEventRecord.eventType) {
8
8
  case WebSocketEventType.Connect:
9
9
  return actionResult({
10
- src: userDirectoryConfig.eventProcessors.onConnect.src,
11
- runtime: userDirectoryConfig.eventProcessors.onConnect.runtime,
10
+ runtime: userDirectoryConfig.eventProcessors.onConnect,
12
11
  });
13
12
  case WebSocketEventType.Disconnect:
14
13
  return actionResult({
15
- src: userDirectoryConfig.eventProcessors.onDisconnect.src,
16
- runtime: userDirectoryConfig.eventProcessors.onDisconnect.runtime,
14
+ runtime: userDirectoryConfig.eventProcessors.onDisconnect,
17
15
  });
18
16
  case WebSocketEventType.Message:
19
17
  return actionResult({
20
- src: userDirectoryConfig.eventProcessors.onMessage.src,
21
- runtime: userDirectoryConfig.eventProcessors.onMessage.runtime,
18
+ runtime: userDirectoryConfig.eventProcessors.onMessage,
22
19
  });
23
20
  default:
24
21
  return actionResultError(ErrorTypeEnum.NotFound, `Websocket lambda not implemented for ${qpqEventRecord.eventType}`);
@@ -18,7 +18,6 @@ const getProcessMatchStory = (qpqConfig) => {
18
18
  return actionResultError(ErrorTypeEnum.NotFound, `seo not found [${qpqEventRecord.path}]`);
19
19
  }
20
20
  return actionResult({
21
- src: matchedSeoConfig.route.src,
22
21
  runtime: matchedSeoConfig.route.runtime,
23
22
  runtimeOptions: matchedSeoConfig.match.params || {},
24
23
  config: matchedSeoConfig.route,
@@ -5,12 +5,11 @@ const GLOBAL_USER_DIRECTORY_NAME = process.env.userDirectoryName;
5
5
  const getProcessMatchStory = (qpqConfig) => {
6
6
  const userDirectoryConfig = qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
7
7
  return async ({ qpqEventRecord }) => {
8
- if (!userDirectoryConfig?.customAuthRuntime?.createAuthChallenge?.src) {
9
- return actionResultError(ErrorTypeEnum.NotFound, `Missing customAuthRuntime.createAuthChallenge.src in [${GLOBAL_USER_DIRECTORY_NAME}]`);
8
+ if (!userDirectoryConfig?.customAuthRuntime?.createAuthChallenge) {
9
+ return actionResultError(ErrorTypeEnum.NotFound, `Missing customAuthRuntime.createAuthChallenge in [${GLOBAL_USER_DIRECTORY_NAME}]`);
10
10
  }
11
11
  return actionResult({
12
- src: userDirectoryConfig.customAuthRuntime.createAuthChallenge.src,
13
- runtime: userDirectoryConfig.customAuthRuntime.createAuthChallenge.runtime,
12
+ runtime: userDirectoryConfig.customAuthRuntime.createAuthChallenge,
14
13
  });
15
14
  };
16
15
  };
@@ -7,17 +7,17 @@ const getProcessAutoRespond = (qpqConfig) => {
7
7
  const getErrorResult = () => actionResultError(ErrorTypeEnum.NotFound, `Email lambda not implemented for ${qpqEventRecord.eventType}`);
8
8
  switch (qpqEventRecord.eventType) {
9
9
  case EmailSendEventType.ResetPassword:
10
- if (!userDirectoryConfig?.emailTemplates.resetPassword?.src || !userDirectoryConfig?.emailTemplates.resetPassword?.runtime) {
10
+ if (!userDirectoryConfig?.emailTemplates.resetPassword) {
11
11
  return getErrorResult();
12
12
  }
13
13
  break;
14
14
  case EmailSendEventType.ResetPasswordAdmin:
15
- if (!userDirectoryConfig?.emailTemplates.resetPasswordAdmin?.src || !userDirectoryConfig?.emailTemplates.resetPasswordAdmin?.runtime) {
15
+ if (!userDirectoryConfig?.emailTemplates.resetPasswordAdmin) {
16
16
  return getErrorResult();
17
17
  }
18
18
  break;
19
19
  case EmailSendEventType.VerifyEmail:
20
- if (!userDirectoryConfig?.emailTemplates.verifyEmail?.src || !userDirectoryConfig?.emailTemplates.verifyEmail?.runtime) {
20
+ if (!userDirectoryConfig?.emailTemplates.verifyEmail) {
21
21
  return getErrorResult();
22
22
  }
23
23
  break;
@@ -8,18 +8,15 @@ const getProcessMatchStory = (qpqConfig) => {
8
8
  switch (qpqEventRecord.eventType) {
9
9
  case EmailSendEventType.ResetPassword:
10
10
  return actionResult({
11
- src: userDirectoryConfig?.emailTemplates.resetPassword?.src,
12
- runtime: userDirectoryConfig?.emailTemplates.resetPassword?.runtime,
11
+ runtime: userDirectoryConfig?.emailTemplates.resetPassword,
13
12
  });
14
13
  case EmailSendEventType.ResetPasswordAdmin:
15
14
  return actionResult({
16
- src: userDirectoryConfig?.emailTemplates.resetPasswordAdmin?.src,
17
- runtime: userDirectoryConfig?.emailTemplates.resetPasswordAdmin?.runtime,
15
+ runtime: userDirectoryConfig?.emailTemplates.resetPasswordAdmin,
18
16
  });
19
17
  case EmailSendEventType.VerifyEmail:
20
18
  return actionResult({
21
- src: userDirectoryConfig?.emailTemplates.verifyEmail?.src,
22
- runtime: userDirectoryConfig?.emailTemplates.verifyEmail?.runtime,
19
+ runtime: userDirectoryConfig?.emailTemplates.verifyEmail,
23
20
  });
24
21
  default:
25
22
  return actionResultError(ErrorTypeEnum.NotFound, `Email lambda not implemented for ${qpqEventRecord.eventType}`);
@@ -5,12 +5,11 @@ const GLOBAL_USER_DIRECTORY_NAME = process.env.userDirectoryName;
5
5
  const getProcessMatchStory = (qpqConfig) => {
6
6
  const userDirectoryConfig = qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
7
7
  return async ({ qpqEventRecord }) => {
8
- if (!userDirectoryConfig || !userDirectoryConfig.customAuthRuntime?.defineAuthChallenge.src) {
9
- return actionResultError(ErrorTypeEnum.NotFound, `Missing customAuthRuntime.defineAuthChallenge.src in [${GLOBAL_USER_DIRECTORY_NAME}]`);
8
+ if (!userDirectoryConfig || !userDirectoryConfig.customAuthRuntime?.defineAuthChallenge) {
9
+ return actionResultError(ErrorTypeEnum.NotFound, `Missing customAuthRuntime.defineAuthChallenge in [${GLOBAL_USER_DIRECTORY_NAME}]`);
10
10
  }
11
11
  return actionResult({
12
- src: userDirectoryConfig.customAuthRuntime.defineAuthChallenge.src,
13
- runtime: userDirectoryConfig.customAuthRuntime.defineAuthChallenge.runtime,
12
+ runtime: userDirectoryConfig.customAuthRuntime.defineAuthChallenge,
14
13
  });
15
14
  };
16
15
  };
@@ -5,12 +5,11 @@ const GLOBAL_USER_DIRECTORY_NAME = process.env.userDirectoryName;
5
5
  const getProcessMatchStory = (qpqConfig) => {
6
6
  const userDirectoryConfig = qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
7
7
  return async ({ qpqEventRecord }) => {
8
- if (!userDirectoryConfig?.customAuthRuntime?.verifyAuthChallenge?.src) {
9
- return actionResultError(ErrorTypeEnum.NotFound, `Missing customAuthRuntime.verifyAuthChallenge.src in [${GLOBAL_USER_DIRECTORY_NAME}]`);
8
+ if (!userDirectoryConfig?.customAuthRuntime?.verifyAuthChallenge) {
9
+ return actionResultError(ErrorTypeEnum.NotFound, `Missing customAuthRuntime.verifyAuthChallenge in [${GLOBAL_USER_DIRECTORY_NAME}]`);
10
10
  }
11
11
  return actionResult({
12
- src: userDirectoryConfig.customAuthRuntime.verifyAuthChallenge.src,
13
- runtime: userDirectoryConfig.customAuthRuntime.verifyAuthChallenge.runtime,
12
+ runtime: userDirectoryConfig.customAuthRuntime.verifyAuthChallenge,
14
13
  });
15
14
  };
16
15
  };
@@ -8,8 +8,7 @@ const getProcessMatchStory = (qpqConfig) => {
8
8
  return actionResultError(ErrorTypeEnum.NotFound, `Could not find deploy event config ${GLOBAL_DEPLOY_EVENT_NAME}`);
9
9
  }
10
10
  return actionResult({
11
- src: deployConfig.src.src,
12
- runtime: deployConfig.src.runtime,
11
+ runtime: deployConfig.runtime,
13
12
  });
14
13
  };
15
14
  };
@@ -4,7 +4,6 @@ const lambdaRuntimeConfig = JSON.parse(process.env.lambdaRuntimeConfig || '{}');
4
4
  const getProcessMatchStory = (qpqConfig) => {
5
5
  return async ({ qpqEventRecord }) => {
6
6
  return actionResult({
7
- src: lambdaRuntimeConfig.src,
8
7
  runtime: lambdaRuntimeConfig.runtime,
9
8
  runtimeOptions: {},
10
9
  });
@@ -9,7 +9,6 @@ const getProcessMatchStory = (qpqConfig) => {
9
9
  return actionResultError(ErrorTypeEnum.NotFound, `service function not found [${qpqEventRecord.functionName}]`);
10
10
  }
11
11
  return actionResult({
12
- src: matchedRoute.src,
13
12
  runtime: matchedRoute.runtime,
14
13
  });
15
14
  };
@@ -2,7 +2,9 @@ import { EventActionType, actionResult } from 'quidproquo-core';
2
2
  import { GLOBAL_STORAGE_DRIVE_RUNTIME } from './types';
3
3
  const getProcessMatchStory = (qpqConfig) => {
4
4
  return async ({ qpqEventRecord }) => {
5
- return actionResult(GLOBAL_STORAGE_DRIVE_RUNTIME);
5
+ return actionResult({
6
+ runtime: GLOBAL_STORAGE_DRIVE_RUNTIME,
7
+ });
6
8
  };
7
9
  };
8
10
  export default (qpqConfig) => {
@@ -1,8 +1,8 @@
1
1
  import { StorageDriveEvent, StorageDriveEventResponse } from 'quidproquo-webserver';
2
2
  import { S3Event, Context } from 'aws-lambda';
3
- import { MatchStoryResult, QpqSourceEntry } from 'quidproquo-core';
3
+ import { MatchStoryResult, QpqFunctionRuntime } from 'quidproquo-core';
4
4
  export declare const GLOBAL_STORAGE_DRIVE_NAME: string;
5
- export declare const GLOBAL_STORAGE_DRIVE_RUNTIME: QpqSourceEntry;
5
+ export declare const GLOBAL_STORAGE_DRIVE_RUNTIME: QpqFunctionRuntime;
6
6
  export type EventInput = [S3Event, Context];
7
7
  export type EventOutput = void;
8
8
  export type InternalEventRecord = StorageDriveEvent;
@@ -1,3 +1,4 @@
1
1
  // Customs
2
2
  export const GLOBAL_STORAGE_DRIVE_NAME = process.env.storageDriveName;
3
- export const GLOBAL_STORAGE_DRIVE_RUNTIME = JSON.parse(process.env.storageDriveEntry || '{}');
3
+ // TODO: Get this from the storageDriveConfig.
4
+ export const GLOBAL_STORAGE_DRIVE_RUNTIME = JSON.parse(process.env.storageDriveEntry || '"/::"');
@@ -1,8 +1,8 @@
1
1
  import { EventActionType, actionResult } from 'quidproquo-core';
2
2
  const getProcessAutoRespond = (qpqConfig) => {
3
- return async ({ qpqEventRecord, matchResult }) => {
3
+ return async ({ matchResult }) => {
4
4
  // If we could not match, we can just auto respond...
5
- if (!matchResult.src || !matchResult.runtime) {
5
+ if (!matchResult.runtime) {
6
6
  // Just say we have finished gracefully.
7
7
  return actionResult(true);
8
8
  }
@@ -8,9 +8,10 @@ export const getQueueConfigSetting = () => {
8
8
  const getProcessMatchStory = (qpqConfig) => {
9
9
  // TODO: Get this out of the qpqconfig like the other event processors
10
10
  const queueQPQConfigSetting = getQueueConfigSetting();
11
+ const queueQueueProcessors = qpqCoreUtils.getQueueQueueProcessors(queueQPQConfigSetting.name, qpqConfig);
12
+ const queueTypes = Object.keys(queueQueueProcessors).sort();
11
13
  return async ({ qpqEventRecord }) => {
12
- const queueQueueProcessors = qpqCoreUtils.getQueueQueueProcessors(queueQPQConfigSetting.name, qpqConfig);
13
- const queueTypes = Object.keys(queueQueueProcessors).sort();
14
+ console.log('qpqEventRecord', JSON.stringify(qpqEventRecord, null, 2));
14
15
  // Find the most relevant match
15
16
  const matchedQueueType = queueTypes
16
17
  .map((qt) => ({
@@ -28,8 +29,7 @@ const getProcessMatchStory = (qpqConfig) => {
28
29
  }
29
30
  const sourceEntry = queueQueueProcessors[matchedQueueType.queueType];
30
31
  return actionResult({
31
- src: sourceEntry.src,
32
- runtime: sourceEntry.runtime,
32
+ runtime: sourceEntry,
33
33
  runtimeOptions: matchedQueueType.match.params || {},
34
34
  config: matchedQueueType.queueType,
35
35
  });
@@ -25,6 +25,7 @@ const getProcessKeyValueStoreUpsert = (qpqConfig) => {
25
25
  catch (error) {
26
26
  return actionResultErrorFromCaughtError(error, {
27
27
  InternalServerError: () => actionResultError(KeyValueStoreUpsertErrorTypeEnum.ServiceUnavailable, 'KVS Service Unavailable'),
28
+ ResourceNotFoundException: () => actionResultError(KeyValueStoreUpsertErrorTypeEnum.ResourceNotFound, 'KVS Resource Not Found'),
28
29
  });
29
30
  }
30
31
  };
@@ -4,13 +4,12 @@ export const getDateNow = () => new Date().toISOString();
4
4
  const getProcessExecuteStory = (qpqConfig, dynamicModuleLoader) => {
5
5
  const moduleName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
6
6
  return async (payload, session, actionProcessors, logger) => {
7
- let module = await dynamicModuleLoader(payload.src);
8
- if (module === null) {
9
- return actionResultError(ErrorTypeEnum.NotFound, `Module not found [${payload.src}]`);
10
- }
11
- const story = module[payload.runtime];
7
+ console.log('Trying to load module');
8
+ let story = await dynamicModuleLoader(payload.runtime);
9
+ console.log('After - Trying to load module');
12
10
  if (!story) {
13
- return actionResultError(ErrorTypeEnum.NotFound, `[${payload.runtime}] not found in module [${payload.src}]`);
11
+ console.log('No story');
12
+ return actionResultError(ErrorTypeEnum.NotFound, `Unable to dynamically load: [${payload.runtime}]`);
14
13
  }
15
14
  const resolveStory = createRuntime(qpqConfig, {
16
15
  context: payload.storySession?.context || session.context,
@@ -19,11 +18,10 @@ const getProcessExecuteStory = (qpqConfig, dynamicModuleLoader) => {
19
18
  correlation: payload.storySession?.correlation || session.correlation,
20
19
  }, actionProcessors, getDateNow, logger,
21
20
  // TODO: Share this logic.
22
- `${moduleName}::${randomGuid()}`, QpqRuntimeType.EXECUTE_STORY, [`${payload.src}::${payload.runtime}`]);
21
+ `${moduleName}::${randomGuid()}`, QpqRuntimeType.EXECUTE_STORY, [payload.runtime]);
23
22
  const storyResult = await resolveStory(story, payload.params);
24
23
  if (storyResult.error) {
25
- const stack = `${payload.src}::${payload.runtime}`;
26
- return actionResultError(storyResult.error.errorType, storyResult.error.errorText, storyResult.error.errorStack ? `${stack} -> [${storyResult.error.errorStack}]` : stack);
24
+ return actionResultError(storyResult.error.errorType, storyResult.error.errorText, storyResult.error.errorStack ? `${payload.runtime} -> [${storyResult.error.errorStack}]` : payload.runtime);
27
25
  }
28
26
  return actionResult(storyResult.result);
29
27
  };
@@ -1,4 +1,4 @@
1
+ import { QpqFunctionRuntime } from 'quidproquo-core';
1
2
  export interface LambdaRuntimeConfig {
2
- src: string;
3
- runtime: string;
3
+ runtime: QpqFunctionRuntime;
4
4
  }
@@ -1 +1,2 @@
1
- export type DynamicModuleLoader = (src: string) => Promise<any>;
1
+ import { QpqFunctionRuntime } from 'quidproquo-core';
2
+ export type DynamicModuleLoader = (runtime: QpqFunctionRuntime) => Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-actionprocessor-awslambda",
3
- "version": "0.0.220",
3
+ "version": "0.0.221",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -51,9 +51,9 @@
51
51
  "lodash": "^4.17.21",
52
52
  "node-cache": "^5.1.2",
53
53
  "node-match-path": "^0.6.3",
54
- "quidproquo-config-aws": "0.0.220",
55
- "quidproquo-core": "0.0.220",
56
- "quidproquo-webserver": "0.0.220"
54
+ "quidproquo-config-aws": "0.0.221",
55
+ "quidproquo-core": "0.0.221",
56
+ "quidproquo-webserver": "0.0.221"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/aws-lambda": "^8.10.109",
@@ -61,7 +61,7 @@
61
61
  "@types/jsonwebtoken": "^9.0.2",
62
62
  "@types/lodash": "^4.14.194",
63
63
  "@types/node": "^18.11.9",
64
- "quidproquo-tsconfig": "0.0.220",
64
+ "quidproquo-tsconfig": "0.0.221",
65
65
  "typescript": "^4.9.3"
66
66
  }
67
67
  }