@contrail/flexplm 1.1.13 → 1.1.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.
- package/.github/pull_request_template.md +30 -0
- package/.github/workflows/flexplm-lib.yml +27 -0
- package/lib/flexplm-utils.spec.d.ts +1 -0
- package/lib/flexplm-utils.spec.js +26 -0
- package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -0
- package/lib/publish/base-process-publish-assortment.spec.js +1053 -0
- package/lib/util/config-defaults.spec.d.ts +1 -0
- package/lib/util/config-defaults.spec.js +264 -0
- package/lib/util/data-converter.d.ts +4 -0
- package/lib/util/data-converter.js +88 -1
- package/lib/util/data-converter.spec.d.ts +1 -0
- package/lib/util/data-converter.spec.js +591 -0
- package/lib/util/map-utils.d.ts +2 -2
- package/lib/util/map-utils.js +5 -28
- package/lib/util/map-utils.spec.d.ts +1 -0
- package/lib/util/map-utils.spec.js +89 -0
- package/lib/util/thumbnail-util.spec.d.ts +1 -0
- package/lib/util/thumbnail-util.spec.js +132 -0
- package/lib/util/type-conversion-utils-spec-mockData.js +21 -0
- package/lib/util/type-conversion-utils.d.ts +7 -0
- package/lib/util/type-conversion-utils.js +88 -4
- package/lib/util/type-conversion-utils.spec.d.ts +1 -0
- package/lib/util/type-conversion-utils.spec.js +547 -0
- package/lib/util/type-defaults.d.ts +5 -0
- package/lib/util/type-defaults.js +66 -0
- package/lib/util/type-defaults.spec.d.ts +1 -0
- package/lib/util/type-defaults.spec.js +460 -0
- package/lib/util/type-utils.spec.d.ts +1 -0
- package/lib/util/type-utils.spec.js +190 -0
- package/package.json +2 -2
- package/publish.bat +5 -0
- package/publish.sh +5 -0
- package/src/entity-processor/base-entity-processor.ts +183 -0
- package/src/flexplm-request.ts +28 -0
- package/src/flexplm-utils.spec.ts +27 -0
- package/src/flexplm-utils.ts +29 -0
- package/src/index.ts +20 -0
- package/src/interfaces/interfaces.ts +120 -0
- package/src/interfaces/item-family-changes.ts +67 -0
- package/src/interfaces/publish-change-data.ts +43 -0
- package/src/publish/base-process-publish-assortment-callback.ts +23 -0
- package/src/publish/base-process-publish-assortment.spec.ts +1239 -0
- package/src/publish/base-process-publish-assortment.ts +1024 -0
- package/src/publish/mockData.ts +4561 -0
- package/src/transform/identifier-conversion.ts +226 -0
- package/src/util/config-defaults.spec.ts +315 -0
- package/src/util/config-defaults.ts +79 -0
- package/src/util/data-converter-spec-mockData.ts +231 -0
- package/src/util/data-converter.spec.ts +872 -0
- package/src/util/data-converter.ts +507 -0
- package/src/util/federation.ts +172 -0
- package/src/util/flexplm-connect.ts +169 -0
- package/src/util/logger-config.ts +20 -0
- package/src/util/map-util-spec-mockData.ts +231 -0
- package/src/util/map-utils.spec.ts +103 -0
- package/src/util/map-utils.ts +40 -0
- package/src/util/mockData.ts +98 -0
- package/src/util/thumbnail-util.spec.ts +152 -0
- package/src/util/thumbnail-util.ts +128 -0
- package/src/util/type-conversion-utils-spec-mockData.ts +238 -0
- package/src/util/type-conversion-utils.spec.ts +601 -0
- package/src/util/type-conversion-utils.ts +345 -0
- package/src/util/type-defaults.spec.ts +592 -0
- package/src/util/type-defaults.ts +261 -0
- package/src/util/type-utils.spec.ts +227 -0
- package/src/util/type-utils.ts +124 -0
- package/tsconfig.json +27 -0
- package/tslint.json +57 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const maps = require('./map-util-spec-mockData').mapping;
|
|
4
|
+
const mockData = {
|
|
5
|
+
file1: maps
|
|
6
|
+
};
|
|
7
|
+
const mockGetMapFileFunction = jest.fn(async (fileId) => {
|
|
8
|
+
return mockData[fileId];
|
|
9
|
+
});
|
|
10
|
+
const sdk_1 = require("@contrail/sdk");
|
|
11
|
+
const transform_data_1 = require("@contrail/transform-data");
|
|
12
|
+
const map_utils_1 = require("./map-utils");
|
|
13
|
+
describe('getMapKey', () => {
|
|
14
|
+
const transformMapFile = 'file1';
|
|
15
|
+
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
16
|
+
let spy;
|
|
17
|
+
beforeAll(() => {
|
|
18
|
+
spy = jest.spyOn(mapFileUtil, 'getMapFile').mockImplementation(mockGetMapFileFunction);
|
|
19
|
+
});
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
spy.mockClear();
|
|
22
|
+
});
|
|
23
|
+
afterAll(() => {
|
|
24
|
+
spy.mockRestore();
|
|
25
|
+
});
|
|
26
|
+
it('custom-entity:pack', async () => {
|
|
27
|
+
const entity = {
|
|
28
|
+
typePath: 'custom-entity:pack',
|
|
29
|
+
entityType: 'custom-entity'
|
|
30
|
+
};
|
|
31
|
+
const expectedMapKey = 'packaging';
|
|
32
|
+
const results = await map_utils_1.MapUtil.getMapKey(transformMapFile, mapFileUtil, entity, entity.entityType, 'vibe2flex');
|
|
33
|
+
;
|
|
34
|
+
expect(results).toEqual(expectedMapKey);
|
|
35
|
+
});
|
|
36
|
+
it('custom-entity:prefix', async () => {
|
|
37
|
+
const entity = {
|
|
38
|
+
typePath: 'custom-entity:prefix',
|
|
39
|
+
entityType: 'custom-entity'
|
|
40
|
+
};
|
|
41
|
+
const expectedMapKey = 'prefix';
|
|
42
|
+
const results = await map_utils_1.MapUtil.getMapKey(transformMapFile, mapFileUtil, entity, entity.entityType, 'vibe2flex');
|
|
43
|
+
;
|
|
44
|
+
expect(results).toEqual(expectedMapKey);
|
|
45
|
+
});
|
|
46
|
+
it('color - no mapping exists', async () => {
|
|
47
|
+
const entity = {
|
|
48
|
+
typePath: 'color',
|
|
49
|
+
entityType: 'color'
|
|
50
|
+
};
|
|
51
|
+
const expectedMapKey = undefined;
|
|
52
|
+
const results = await map_utils_1.MapUtil.getMapKey(transformMapFile, mapFileUtil, entity, entity.entityType, 'vibe2flex');
|
|
53
|
+
;
|
|
54
|
+
expect(results).toEqual(expectedMapKey);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe('getFullMapSection', () => {
|
|
58
|
+
const transformMapFile = 'file1';
|
|
59
|
+
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
60
|
+
let spy;
|
|
61
|
+
beforeAll(() => {
|
|
62
|
+
spy = jest.spyOn(mapFileUtil, 'getMapFile').mockImplementation(mockGetMapFileFunction);
|
|
63
|
+
});
|
|
64
|
+
beforeEach(() => {
|
|
65
|
+
spy.mockClear();
|
|
66
|
+
});
|
|
67
|
+
afterAll(() => {
|
|
68
|
+
spy.mockRestore();
|
|
69
|
+
});
|
|
70
|
+
it('custom-entity:pack', async () => {
|
|
71
|
+
const mapKey = 'packaging';
|
|
72
|
+
const mapSection = await map_utils_1.MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
|
|
73
|
+
expect(mapSection).toHaveProperty('vibe2flex');
|
|
74
|
+
expect(mapSection).toHaveProperty('flex2vibe');
|
|
75
|
+
});
|
|
76
|
+
it('custom-entity:catName', async () => {
|
|
77
|
+
const mapKey = 'catName';
|
|
78
|
+
const mapSection = await map_utils_1.MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
|
|
79
|
+
expect(mapSection).toHaveProperty('vibe2flex');
|
|
80
|
+
expect(mapSection).toHaveProperty('flex2vibe');
|
|
81
|
+
expect(mapSection).toHaveProperty('getIdentifierProperties');
|
|
82
|
+
expect(mapSection).toHaveProperty('getInformationalProperties');
|
|
83
|
+
});
|
|
84
|
+
it('color - no mapping exists', async () => {
|
|
85
|
+
const mapKey = 'color';
|
|
86
|
+
const mapSection = await map_utils_1.MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
|
|
87
|
+
expect(mapSection).toBeUndefined();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const thumbnail_util_1 = require("./thumbnail-util");
|
|
4
|
+
const mockData_1 = require("./mockData");
|
|
5
|
+
describe('ThumbnailUtil Tests', () => {
|
|
6
|
+
const config = {};
|
|
7
|
+
describe('setOutboundThumbnail()', () => {
|
|
8
|
+
const tu = new thumbnail_util_1.ThumbnailUtil(config);
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
jest.clearAllMocks();
|
|
11
|
+
});
|
|
12
|
+
it('no data', async () => {
|
|
13
|
+
const data = {};
|
|
14
|
+
const event = {};
|
|
15
|
+
const results = await tu.setOutboundThumbnail(data, event);
|
|
16
|
+
const keys = Object.keys(results);
|
|
17
|
+
expect(results).toEqual(data);
|
|
18
|
+
expect(keys.length).toEqual(0);
|
|
19
|
+
});
|
|
20
|
+
it('remove thumbnail', async () => {
|
|
21
|
+
const data = {};
|
|
22
|
+
const event = {
|
|
23
|
+
propertyDiffs: {
|
|
24
|
+
largeViewableDownloadUrl: {
|
|
25
|
+
oldValue: '123',
|
|
26
|
+
newValue: null
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const results = await tu.setOutboundThumbnail(data, event);
|
|
31
|
+
const keys = Object.keys(results);
|
|
32
|
+
expect(keys.length).toEqual(1);
|
|
33
|
+
expect(keys[0]).toEqual(thumbnail_util_1.ThumbnailUtil.NEW_THUMBNAIL_ID);
|
|
34
|
+
expect(results[thumbnail_util_1.ThumbnailUtil.NEW_THUMBNAIL_ID]).toEqual(thumbnail_util_1.ThumbnailUtil.REMOVE_THUMBNAIL);
|
|
35
|
+
});
|
|
36
|
+
it('calling getFileId - new thumbnail', async () => {
|
|
37
|
+
const data = {};
|
|
38
|
+
const newDownloadUrl = 'https://api.vibeiq.com/dev/api/files/downloadUrl/w3ckfeGAD8ViOZj-%2Fcontent:E1iBQuWbr74lcdcw%2F9e30ds9o-d34b-451e-ae59-b4km36018d5a.png';
|
|
39
|
+
const oldDownloadUrl = 'xxx';
|
|
40
|
+
const thumbnailId = 'Eey3ZOiqdrUA84F8';
|
|
41
|
+
const event = {
|
|
42
|
+
newData: {
|
|
43
|
+
primaryViewableId: 'm5bJa4RtTLUtKBP5',
|
|
44
|
+
largeViewableDownloadUrl: newDownloadUrl
|
|
45
|
+
},
|
|
46
|
+
propertyDiffs: {
|
|
47
|
+
largeViewableDownloadUrl: {
|
|
48
|
+
newValue: newDownloadUrl,
|
|
49
|
+
oldValue: oldDownloadUrl
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const spyGetFileId = jest.spyOn(tu, 'getFileId');
|
|
54
|
+
spyGetFileId.mockReturnValue(Promise.resolve(thumbnailId));
|
|
55
|
+
const results = await tu.setOutboundThumbnail(data, event);
|
|
56
|
+
const keys = Object.keys(results);
|
|
57
|
+
expect(keys.length).toEqual(1);
|
|
58
|
+
expect(keys[0]).toEqual(thumbnail_util_1.ThumbnailUtil.NEW_THUMBNAIL_ID);
|
|
59
|
+
const thumbnailValue = results[thumbnail_util_1.ThumbnailUtil.NEW_THUMBNAIL_ID];
|
|
60
|
+
expect(thumbnailValue).toEqual(thumbnailId);
|
|
61
|
+
});
|
|
62
|
+
it('calling getFileId - existing thumbnail', async () => {
|
|
63
|
+
const data = {};
|
|
64
|
+
const newDownloadUrl = 'https://api.vibeiq.com/dev/api/files/downloadUrl/w3ckfeGAD8ViOZj-%2Fcontent:E1iBQuWbr74lcdcw%2F9e30ds9o-d34b-451e-ae59-b4km36018d5a.png';
|
|
65
|
+
const thumbnailId = 'Eey3ZOiqdrUA84F8';
|
|
66
|
+
const event = {
|
|
67
|
+
newData: {
|
|
68
|
+
primaryViewableId: 'm5bJa4RtTLUtKBP5',
|
|
69
|
+
largeViewableDownloadUrl: newDownloadUrl
|
|
70
|
+
},
|
|
71
|
+
propertyDiffs: {}
|
|
72
|
+
};
|
|
73
|
+
const spyGetFileId = jest.spyOn(tu, 'getFileId');
|
|
74
|
+
spyGetFileId.mockReturnValue(Promise.resolve(thumbnailId));
|
|
75
|
+
const results = await tu.setOutboundThumbnail(data, event);
|
|
76
|
+
const keys = Object.keys(results);
|
|
77
|
+
expect(keys.length).toEqual(1);
|
|
78
|
+
expect(keys[0]).toEqual(thumbnail_util_1.ThumbnailUtil.EXISTING_THUMBNAIL_ID);
|
|
79
|
+
const thumbnailValue = results[thumbnail_util_1.ThumbnailUtil.EXISTING_THUMBNAIL_ID];
|
|
80
|
+
expect(thumbnailValue).toEqual(thumbnailId);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
describe('getFileId', () => {
|
|
84
|
+
const primaryFileId = 'yn2d5oHD4rXHRzyB';
|
|
85
|
+
beforeEach(() => {
|
|
86
|
+
jest.clearAllMocks();
|
|
87
|
+
});
|
|
88
|
+
it('no custom sizes, default max_thumbnail_size - result large', async () => {
|
|
89
|
+
const tu = new thumbnail_util_1.ThumbnailUtil(config);
|
|
90
|
+
const spyCustomSizes = jest.spyOn(tu, 'getCustomSizes');
|
|
91
|
+
spyCustomSizes.mockReturnValue(Promise.resolve(mockData_1.empty_custom_sizes));
|
|
92
|
+
const spyContentEntity = jest.spyOn(tu, 'getContentEntity');
|
|
93
|
+
const content = mockData_1.thumbnail_content_entity;
|
|
94
|
+
spyContentEntity.mockReturnValue(Promise.resolve(content));
|
|
95
|
+
const spyGetFileEntities = jest.spyOn(tu, 'getFileEntities');
|
|
96
|
+
spyGetFileEntities.mockReturnValue(Promise.resolve(mockData_1.cuRficeyoStwTF_f_fileEntities));
|
|
97
|
+
const results = await tu.getFileId(primaryFileId);
|
|
98
|
+
expect(results).toEqual('vo4N4mCd-tFrw101');
|
|
99
|
+
});
|
|
100
|
+
it('no custom sizes, 750 * 1_024 max_thumbnail_size - result medium', async () => {
|
|
101
|
+
const config1 = {
|
|
102
|
+
max_thumbnail_size: 750 * 1024
|
|
103
|
+
};
|
|
104
|
+
const tu = new thumbnail_util_1.ThumbnailUtil(config1);
|
|
105
|
+
const spyCustomSizes = jest.spyOn(tu, 'getCustomSizes');
|
|
106
|
+
spyCustomSizes.mockReturnValue(Promise.resolve(mockData_1.empty_custom_sizes));
|
|
107
|
+
const spyContentEntity = jest.spyOn(tu, 'getContentEntity');
|
|
108
|
+
const content = mockData_1.thumbnail_content_entity;
|
|
109
|
+
spyContentEntity.mockReturnValue(Promise.resolve(content));
|
|
110
|
+
const spyGetFileEntities = jest.spyOn(tu, 'getFileEntities');
|
|
111
|
+
spyGetFileEntities.mockReturnValue(Promise.resolve(mockData_1.cuRficeyoStwTF_f_fileEntities));
|
|
112
|
+
const results = await tu.getFileId(primaryFileId);
|
|
113
|
+
expect(results).toEqual('AsRvJenpeqxksUNW');
|
|
114
|
+
});
|
|
115
|
+
it('custom sizes, 750 * 1_024 max_thumbnail_size - result CS_500Id', async () => {
|
|
116
|
+
console.log('custom sizes, 750 * 1_024 max_thumbnail_size - result CS_500Id');
|
|
117
|
+
const config1 = {
|
|
118
|
+
max_thumbnail_size: 750 * 1024
|
|
119
|
+
};
|
|
120
|
+
const tu = new thumbnail_util_1.ThumbnailUtil(config1);
|
|
121
|
+
const spyCustomSizes = jest.spyOn(tu, 'getCustomSizes');
|
|
122
|
+
spyCustomSizes.mockReturnValue(Promise.resolve(mockData_1.four_custom_sizes));
|
|
123
|
+
const spyContentEntity = jest.spyOn(tu, 'getContentEntity');
|
|
124
|
+
const content = mockData_1.thumbnail_content_entity;
|
|
125
|
+
spyContentEntity.mockReturnValue(Promise.resolve(content));
|
|
126
|
+
const spyGetFileEntities = jest.spyOn(tu, 'getFileEntities');
|
|
127
|
+
spyGetFileEntities.mockReturnValue(Promise.resolve(mockData_1.cuRficeyoStwTF_f_fileEntities));
|
|
128
|
+
const results = await tu.getFileId(primaryFileId);
|
|
129
|
+
expect(results).toEqual('rBaHc1J2xdOWdbhI');
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
});
|
|
@@ -30,6 +30,27 @@ exports.mapping = {
|
|
|
30
30
|
return mapKey;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
},
|
|
34
|
+
flex2vibe: {
|
|
35
|
+
LCSLast: {
|
|
36
|
+
getMapKey: (object) => { return 'catName'; }
|
|
37
|
+
},
|
|
38
|
+
LCSRevisableEntity: {
|
|
39
|
+
getMapKey: (object) => {
|
|
40
|
+
const typePath = object['flexPLMTypePath'];
|
|
41
|
+
let mapKey = '';
|
|
42
|
+
switch (typePath) {
|
|
43
|
+
case 'Revisable Entity\\packaging':
|
|
44
|
+
mapKey = 'packaging';
|
|
45
|
+
break;
|
|
46
|
+
case 'Revisable Entity\\prefix':
|
|
47
|
+
mapKey = 'prefix';
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
;
|
|
51
|
+
return mapKey;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
33
54
|
}
|
|
34
55
|
},
|
|
35
56
|
LCSProduct: {
|
|
@@ -2,6 +2,7 @@ import { MapFileUtil } from '@contrail/transform-data';
|
|
|
2
2
|
export declare class TypeConversionUtils {
|
|
3
3
|
static NO_ENTITY_TYPE: string;
|
|
4
4
|
static VIBE2FLEX_DIRECTION: string;
|
|
5
|
+
static FLEX2VIBE_DIRECTION: string;
|
|
5
6
|
constructor();
|
|
6
7
|
static getObjectClass(transformMapFile: any, mapFileUtil: any, entity: any): Promise<string>;
|
|
7
8
|
static getObjectTypePath(transformMapFile: any, mapFileUtil: any, entity: any): Promise<string>;
|
|
@@ -9,4 +10,10 @@ export declare class TypeConversionUtils {
|
|
|
9
10
|
static getInformationalProperties(transformMapFile: any, mapFileUtil: any, entity: any): Promise<string[]>;
|
|
10
11
|
static getMapKey(transformMapFile: any, mapFileUtil: MapFileUtil, entity: any, direction: string): Promise<string>;
|
|
11
12
|
static getEntityType(entity: any): any;
|
|
13
|
+
static getEntityClassFromObject(fileId: any, mapFileUtil: any, object: any): Promise<string>;
|
|
14
|
+
static getEntityTypePathFromOjbect(fileId: any, mapFileUtil: any, object: any): Promise<string>;
|
|
15
|
+
static getIdentifierPropertiesFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any): Promise<string[]>;
|
|
16
|
+
static getInformationalPropertiesFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any): Promise<string[]>;
|
|
17
|
+
static getMapKeyFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any, direction: string): Promise<string>;
|
|
18
|
+
static getObjectType(object: any): any;
|
|
12
19
|
}
|
|
@@ -12,8 +12,8 @@ class TypeConversionUtils {
|
|
|
12
12
|
return objectClass;
|
|
13
13
|
}
|
|
14
14
|
if (transformMapFile) {
|
|
15
|
-
const
|
|
16
|
-
const mapData = await mapFileUtil.getMappingSection(transformMapFile,
|
|
15
|
+
const mapSectionKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
|
|
16
|
+
const mapData = await mapFileUtil.getMappingSection(transformMapFile, mapSectionKey, TypeConversionUtils.VIBE2FLEX_DIRECTION);
|
|
17
17
|
if (mapData['getClass']) {
|
|
18
18
|
objectClass = await mapData['getClass'](entity);
|
|
19
19
|
}
|
|
@@ -29,8 +29,8 @@ class TypeConversionUtils {
|
|
|
29
29
|
return typePath;
|
|
30
30
|
}
|
|
31
31
|
if (transformMapFile) {
|
|
32
|
-
const
|
|
33
|
-
const mapData = await mapFileUtil.getMappingSection(transformMapFile,
|
|
32
|
+
const mapSectionKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
|
|
33
|
+
const mapData = await mapFileUtil.getMappingSection(transformMapFile, mapSectionKey, TypeConversionUtils.VIBE2FLEX_DIRECTION);
|
|
34
34
|
if (mapData['getSoftType']) {
|
|
35
35
|
typePath = await mapData['getSoftType'](entity);
|
|
36
36
|
}
|
|
@@ -101,7 +101,91 @@ class TypeConversionUtils {
|
|
|
101
101
|
}
|
|
102
102
|
return entityType;
|
|
103
103
|
}
|
|
104
|
+
static async getEntityClassFromObject(fileId, mapFileUtil, object) {
|
|
105
|
+
let entityClass = object['vibeIQEntityClass'];
|
|
106
|
+
if (entityClass) {
|
|
107
|
+
return entityClass;
|
|
108
|
+
}
|
|
109
|
+
if (fileId) {
|
|
110
|
+
const mapSectionKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
|
|
111
|
+
const mapData = await mapFileUtil.getMappingSection(fileId, mapSectionKey, TypeConversionUtils.FLEX2VIBE_DIRECTION);
|
|
112
|
+
if (mapData['getClass']) {
|
|
113
|
+
entityClass = await mapData['getClass'](object);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (entityClass) {
|
|
117
|
+
return entityClass;
|
|
118
|
+
}
|
|
119
|
+
return type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
120
|
+
}
|
|
121
|
+
static async getEntityTypePathFromOjbect(fileId, mapFileUtil, object) {
|
|
122
|
+
let typePath = object['vibeIQTypePath'];
|
|
123
|
+
if (typePath) {
|
|
124
|
+
return typePath;
|
|
125
|
+
}
|
|
126
|
+
if (fileId) {
|
|
127
|
+
const mapSectionKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
|
|
128
|
+
const mapData = await mapFileUtil.getMappingSection(fileId, mapSectionKey, TypeConversionUtils.FLEX2VIBE_DIRECTION);
|
|
129
|
+
if (mapData['getSoftType']) {
|
|
130
|
+
typePath = await mapData['getSoftType'](object);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (typePath) {
|
|
134
|
+
return typePath;
|
|
135
|
+
}
|
|
136
|
+
return type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
137
|
+
}
|
|
138
|
+
static async getIdentifierPropertiesFromObject(fileId, mapFileUtil, object) {
|
|
139
|
+
let identifiers = object['vibeIQIdentifierProperties'];
|
|
140
|
+
if (identifiers) {
|
|
141
|
+
return identifiers;
|
|
142
|
+
}
|
|
143
|
+
if (fileId) {
|
|
144
|
+
const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
|
|
145
|
+
const mapData = await map_utils_1.MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
|
|
146
|
+
if (mapData && mapData['getIdentifierProperties']) {
|
|
147
|
+
identifiers = await mapData['getIdentifierProperties'](object);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (identifiers) {
|
|
151
|
+
return identifiers;
|
|
152
|
+
}
|
|
153
|
+
return type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
154
|
+
}
|
|
155
|
+
static async getInformationalPropertiesFromObject(fileId, mapFileUtil, object) {
|
|
156
|
+
let identifiers = object['vibeIQInformationalProperties'];
|
|
157
|
+
if (identifiers) {
|
|
158
|
+
return identifiers;
|
|
159
|
+
}
|
|
160
|
+
if (fileId) {
|
|
161
|
+
const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
|
|
162
|
+
const mapData = await map_utils_1.MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
|
|
163
|
+
if (mapData && mapData['getInformationalProperties']) {
|
|
164
|
+
identifiers = await mapData['getInformationalProperties'](object);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (identifiers) {
|
|
168
|
+
return identifiers;
|
|
169
|
+
}
|
|
170
|
+
return type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
|
|
171
|
+
}
|
|
172
|
+
static async getMapKeyFromObject(fileId, mapFileUtil, object, direction) {
|
|
173
|
+
const type = this.getObjectType(object);
|
|
174
|
+
if (fileId) {
|
|
175
|
+
const mappingData = await mapFileUtil.getMappingSection(fileId, 'typeConversion', direction);
|
|
176
|
+
if (mappingData && mappingData[type] && mappingData[type]['getMapKey']) {
|
|
177
|
+
const mapKey = await mappingData[type]['getMapKey'](object);
|
|
178
|
+
return mapKey;
|
|
179
|
+
}
|
|
180
|
+
return type;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
static getObjectType(object) {
|
|
184
|
+
let objectType = object['objectClass'];
|
|
185
|
+
return objectType;
|
|
186
|
+
}
|
|
104
187
|
}
|
|
105
188
|
exports.TypeConversionUtils = TypeConversionUtils;
|
|
106
189
|
TypeConversionUtils.NO_ENTITY_TYPE = 'Not able to determine the entity type of the entity object';
|
|
107
190
|
TypeConversionUtils.VIBE2FLEX_DIRECTION = 'vibe2flex';
|
|
191
|
+
TypeConversionUtils.FLEX2VIBE_DIRECTION = 'flex2vibe';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|