@lendi/integrations-transform 1.5.3 → 1.5.4

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/index.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
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);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -1,8 +1,9 @@
1
- import { PayloadClass as ApplicationWorkflow } from '../types/events/application-workflow';
1
+ import { PayloadClass as ApplicationWorkflowEventPayload } from '../types/events/application-workflow';
2
2
  /**
3
- * Generates a partial internal request from a partial application workflow event.
3
+ * Generates a partial application from an ApplicationWorkflow event
4
4
  *
5
- * @return partialApplication: A partial internal request.
6
- * @param applicationWorkflow: ApplicationWorkflow object.
5
+ * @param applicationWorkflowEventPayload ApplicationWorkflow event payload
6
+ *
7
+ * @returns A partial application
7
8
  */
8
- export declare function transformApplicationWorkflow(applicationWorkflow: ApplicationWorkflow): {};
9
+ export declare function transformApplicationWorkflow(applicationWorkflowEventPayload: ApplicationWorkflowEventPayload): {};
@@ -4,29 +4,21 @@ exports.transformApplicationWorkflow = void 0;
4
4
  var application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
5
5
  var lodash_1 = require("lodash");
6
6
  /**
7
- * Generates a partial internal request from a partial application workflow event.
7
+ * Generates a partial application from an ApplicationWorkflow event
8
8
  *
9
- * @return partialApplication: A partial internal request.
10
- * @param applicationWorkflow: ApplicationWorkflow object.
9
+ * @param applicationWorkflowEventPayload ApplicationWorkflow event payload
10
+ *
11
+ * @returns A partial application
11
12
  */
12
- function transformApplicationWorkflow(applicationWorkflow) {
13
- var partialApplication = {};
14
- var opportunityMapping = {
15
- applicationId: application_paths_1.paths.ApplicationId,
16
- stage: application_paths_1.paths.Instructions
13
+ function transformApplicationWorkflow(applicationWorkflowEventPayload) {
14
+ var stage = applicationWorkflowEventPayload.stage, applicationStage = applicationWorkflowEventPayload.applicationStage, applicationId = applicationWorkflowEventPayload.applicationId, partialApplication = {};
15
+ (0, lodash_1.set)(partialApplication, application_paths_1.paths.ApplicationId, applicationId);
16
+ // The stage being defaulted to Unknown caters for LGSF application workflow events having stage as an optional attribute in the future
17
+ var instructionDetails = {
18
+ '@UniqueID': "".concat(applicationId, "-stage"),
19
+ '@Details': applicationStage || stage || 'Unknown'
17
20
  };
18
- for (var _i = 0, _a = Object.entries(applicationWorkflow); _i < _a.length; _i++) {
19
- var _b = _a[_i], key = _b[0], value = _b[1];
20
- if (opportunityMapping[key]) {
21
- if (key === 'stage') {
22
- (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Instructions, ".@UniqueID"), "".concat(applicationWorkflow.applicationId, "-stage"));
23
- (0, lodash_1.set)(partialApplication, "".concat(opportunityMapping[key], ".@Details"), value || 'Unknown');
24
- }
25
- else {
26
- (0, lodash_1.set)(partialApplication, opportunityMapping[key], value);
27
- }
28
- }
29
- }
21
+ (0, lodash_1.set)(partialApplication, application_paths_1.paths.Instructions, instructionDetails);
30
22
  return partialApplication;
31
23
  }
32
24
  exports.transformApplicationWorkflow = transformApplicationWorkflow;
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
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);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lendi/integrations-transform",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "Library for kafka event data transforming",
5
5
  "author": "Integrations <integrations@lendi.com.au>",
6
6
  "homepage": "https://bitbucket.org/lendi-dev/integrations-shared-packages#readme",