quidproquo-core 0.0.14 → 0.0.16

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.
@@ -1,15 +1,22 @@
1
- export declare function resolveStory(story: any, args: Array<any>, session: any, actionProcessors: any): Promise<{
2
- error: string;
1
+ export declare function resolveStory(story: any, args: Array<any>, session: any, actionProcessors: any, resolveNow: any, logger: any, newGuid: any): Promise<{
2
+ finishedAt: any;
3
+ result: any;
3
4
  input: any[];
4
5
  session: any;
5
6
  history: any[];
6
- result: null;
7
+ startedAt: any;
8
+ error: null;
7
9
  errorTrace: null;
10
+ fromCorrelation: any;
11
+ correlation: any;
8
12
  } | {
9
- result: any;
13
+ error: string;
10
14
  input: any[];
11
15
  session: any;
12
16
  history: any[];
13
- error: null;
17
+ startedAt: any;
18
+ result: null;
14
19
  errorTrace: null;
20
+ fromCorrelation: any;
21
+ correlation: any;
15
22
  }>;
@@ -29,7 +29,7 @@ function processAction(action, actionProcessors, session) {
29
29
  return yield processor(action.payload, session);
30
30
  });
31
31
  }
32
- function resolveStory(story, args, session, actionProcessors) {
32
+ function resolveStory(story, args, session, actionProcessors, resolveNow, logger, newGuid) {
33
33
  return __awaiter(this, void 0, void 0, function* () {
34
34
  const reader = story(...args);
35
35
  const history = [];
@@ -38,29 +38,38 @@ function resolveStory(story, args, session, actionProcessors) {
38
38
  input: args,
39
39
  session,
40
40
  history,
41
+ startedAt: resolveNow(),
41
42
  result: null,
42
43
  error: null,
43
44
  errorTrace: null,
45
+ fromCorrelation: session.correlation,
46
+ correlation: newGuid(),
44
47
  };
48
+ const newSession = Object.assign({}, session);
45
49
  try {
46
50
  action = reader.next();
47
51
  while (!action.done) {
52
+ const executionTime = resolveNow();
48
53
  const actionResult = yield processAction(action.value, actionProcessors, session);
49
54
  history.push({
50
55
  act: action.value,
51
56
  res: actionResult,
57
+ startedAt: executionTime,
58
+ finishedAt: resolveNow(),
52
59
  });
53
60
  action = reader.next(actionResult);
54
61
  }
55
62
  }
56
63
  catch (err) {
57
- console.log("story Error: ", err);
64
+ console.log('story Error: ', err);
58
65
  if (err instanceof Error) {
59
66
  return Object.assign(Object.assign({}, response), { error: err.message.toString() });
60
67
  }
61
- return Object.assign(Object.assign({}, response), { error: "unknown error has occurred" });
68
+ return Object.assign(Object.assign({}, response), { error: 'unknown error has occurred' });
62
69
  }
63
- return Object.assign(Object.assign({}, response), { result: action.value });
70
+ const storyResult = Object.assign(Object.assign({}, response), { finishedAt: resolveNow(), result: action.value });
71
+ yield logger(storyResult);
72
+ return storyResult;
64
73
  });
65
74
  }
66
75
  exports.resolveStory = resolveStory;
package/lib/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- export { DateActionTypeEnum } from "./actions/date/DateActionTypeEnum";
2
- export { GuidActionTypeEnum } from "./actions/guid/GuidActionTypeEnum";
3
- export { EventActionTypeEnum } from "./actions/event/EventActionTypeEnum";
4
- export { MathActionTypeEnum } from "./actions/math/MathActionTypeEnum";
5
- export { PlatformActionTypeEnum } from "./actions/platform/PlatformActionTypeEnum";
6
- export { SystemActionTypeEnum } from "./actions/system/SystemActionTypeEnum";
7
- export { defineAppName, AppNameQPQConfigSetting, } from "./config/settings/appName";
8
- export { QPQCoreConfigSettingType, QPQConfigSetting, QPQConfig, } from "./config/QPQConfig";
9
- export * as qpqCoreUtils from "./qpqCoreUtils";
1
+ export { DateActionTypeEnum } from './actions/date/DateActionTypeEnum';
2
+ export { GuidActionTypeEnum } from './actions/guid/GuidActionTypeEnum';
3
+ export { EventActionTypeEnum } from './actions/event/EventActionTypeEnum';
4
+ export { MathActionTypeEnum } from './actions/math/MathActionTypeEnum';
5
+ export { PlatformActionTypeEnum } from './actions/platform/PlatformActionTypeEnum';
6
+ export { SystemActionTypeEnum } from './actions/system/SystemActionTypeEnum';
7
+ export { defineAppName, AppNameQPQConfigSetting } from './config/settings/appName';
8
+ export { QPQCoreConfigSettingType, QPQConfigSetting, QPQConfig } from './config/QPQConfig';
9
+ export * as qpqCoreUtils from './qpqCoreUtils';
10
+ export * from './stories';
11
+ export { resolveStory } from './actionProcessor';
package/lib/index.js CHANGED
@@ -22,8 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.qpqCoreUtils = exports.QPQCoreConfigSettingType = exports.defineAppName = exports.SystemActionTypeEnum = exports.PlatformActionTypeEnum = exports.MathActionTypeEnum = exports.EventActionTypeEnum = exports.GuidActionTypeEnum = exports.DateActionTypeEnum = void 0;
29
+ exports.resolveStory = exports.qpqCoreUtils = exports.QPQCoreConfigSettingType = exports.defineAppName = exports.SystemActionTypeEnum = exports.PlatformActionTypeEnum = exports.MathActionTypeEnum = exports.EventActionTypeEnum = exports.GuidActionTypeEnum = exports.DateActionTypeEnum = void 0;
27
30
  var DateActionTypeEnum_1 = require("./actions/date/DateActionTypeEnum");
28
31
  Object.defineProperty(exports, "DateActionTypeEnum", { enumerable: true, get: function () { return DateActionTypeEnum_1.DateActionTypeEnum; } });
29
32
  var GuidActionTypeEnum_1 = require("./actions/guid/GuidActionTypeEnum");
@@ -41,3 +44,6 @@ Object.defineProperty(exports, "defineAppName", { enumerable: true, get: functio
41
44
  var QPQConfig_1 = require("./config/QPQConfig");
42
45
  Object.defineProperty(exports, "QPQCoreConfigSettingType", { enumerable: true, get: function () { return QPQConfig_1.QPQCoreConfigSettingType; } });
43
46
  exports.qpqCoreUtils = __importStar(require("./qpqCoreUtils"));
47
+ __exportStar(require("./stories"), exports);
48
+ var actionProcessor_1 = require("./actionProcessor");
49
+ Object.defineProperty(exports, "resolveStory", { enumerable: true, get: function () { return actionProcessor_1.resolveStory; } });
@@ -0,0 +1 @@
1
+ export * from './askProcessEvent';
@@ -0,0 +1,17 @@
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("./askProcessEvent"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-core",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.js",