@contrail/transform-data 1.0.14 → 1.0.15
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.
|
@@ -10,6 +10,6 @@ export declare class MapFileUtil {
|
|
|
10
10
|
getFullMapSection(transformMapFile: string, mapSectionKey: string): Promise<any>;
|
|
11
11
|
getMappingSection(fileId: string, mapSectionKey: string, direction: string): Promise<{}>;
|
|
12
12
|
getMapKey(fileId: any, data: any, type: string, direction: string): Promise<string>;
|
|
13
|
-
static getTransformTasks(directionalMapSection: object): TransformTask[];
|
|
14
|
-
applyTransformMap(fileId: any, data: any, mapSectionKey: string, direction: string): Promise<any>;
|
|
13
|
+
static getTransformTasks(directionalMapSection: object, orderKey?: string): TransformTask[];
|
|
14
|
+
applyTransformMap(fileId: any, data: any, mapSectionKey: string, direction: string, transformTaskOrderKey?: any): Promise<any>;
|
|
15
15
|
}
|
|
@@ -75,9 +75,9 @@ class MapFileUtil {
|
|
|
75
75
|
}
|
|
76
76
|
return undefined;
|
|
77
77
|
}
|
|
78
|
-
static getTransformTasks(directionalMapSection) {
|
|
78
|
+
static getTransformTasks(directionalMapSection, orderKey = 'transformOrder') {
|
|
79
79
|
const tasks = [];
|
|
80
|
-
const order = directionalMapSection[
|
|
80
|
+
const order = directionalMapSection[orderKey];
|
|
81
81
|
if (order) {
|
|
82
82
|
for (const step of order) {
|
|
83
83
|
const task = {
|
|
@@ -96,11 +96,11 @@ class MapFileUtil {
|
|
|
96
96
|
}
|
|
97
97
|
return tasks;
|
|
98
98
|
}
|
|
99
|
-
async applyTransformMap(fileId, data, mapSectionKey, direction) {
|
|
99
|
+
async applyTransformMap(fileId, data, mapSectionKey, direction, transformTaskOrderKey) {
|
|
100
100
|
if (fileId && data) {
|
|
101
101
|
const mapping = await this.getMappingSection(fileId, mapSectionKey, direction);
|
|
102
102
|
if (mapping) {
|
|
103
|
-
const tasks = MapFileUtil.getTransformTasks(mapping);
|
|
103
|
+
const tasks = MapFileUtil.getTransformTasks(mapping, transformTaskOrderKey);
|
|
104
104
|
if (tasks.length > 0) {
|
|
105
105
|
const convertedArray = processor_1.TransformProcessor.transformData([data], tasks);
|
|
106
106
|
data = convertedArray[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/transform-data",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Libraries for transforming data",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
10
10
|
"lint": "tslint --fix -p tsconfig.json",
|
|
11
|
-
"test": "jest"
|
|
11
|
+
"test": "jest",
|
|
12
|
+
"test:watch": "jest --watch"
|
|
12
13
|
},
|
|
13
14
|
"keywords": [],
|
|
14
15
|
"author": "",
|