@lendi/integrations-transform 1.5.1 → 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.
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { PayloadClass as
|
|
1
|
+
import { PayloadClass as ApplicationWorkflowEventPayload } from '../types/events/application-workflow';
|
|
2
2
|
/**
|
|
3
|
-
* Generates a partial
|
|
3
|
+
* Generates a partial application from an ApplicationWorkflow event
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
6
|
-
*
|
|
5
|
+
* @param applicationWorkflowEventPayload ApplicationWorkflow event payload
|
|
6
|
+
*
|
|
7
|
+
* @returns A partial application
|
|
7
8
|
*/
|
|
8
|
-
export declare function transformApplicationWorkflow(
|
|
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
|
|
7
|
+
* Generates a partial application from an ApplicationWorkflow event
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
9
|
+
* @param applicationWorkflowEventPayload ApplicationWorkflow event payload
|
|
10
|
+
*
|
|
11
|
+
* @returns A partial application
|
|
11
12
|
*/
|
|
12
|
-
function transformApplicationWorkflow(
|
|
13
|
-
var partialApplication = {};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lendi/integrations-transform",
|
|
3
|
-
"version": "1.5.
|
|
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",
|