@contrail/flexplm 1.7.3-alpha.2a95cdd → 1.7.3-alpha.865f4fc
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/interfaces/interfaces.d.ts +1 -0
- package/lib/interfaces/mapping-file.d.ts +0 -41
- package/lib/util/config-defaults.d.ts +1 -0
- package/lib/util/config-defaults.js +5 -0
- package/lib/util/data-converter.spec.js +30 -15
- package/lib/util/flexplm-connect.spec.js +1 -0
- package/lib/util/thumbnail-util.js +26 -5
- package/package.json +1 -1
|
@@ -776,47 +776,6 @@ interface MappingFileBase {
|
|
|
776
776
|
* },
|
|
777
777
|
* },
|
|
778
778
|
* };
|
|
779
|
-
*
|
|
780
|
-
* @example
|
|
781
|
-
* // Multi-Entry and Composite FlexPLM properties.
|
|
782
|
-
* //
|
|
783
|
-
* // FlexPLM sends both shapes as a single string whose values are joined by
|
|
784
|
-
* // the separator '|~*~|' (a trailing separator follows the last value):
|
|
785
|
-
* // Cuttable Width (multi-entry): '1MM Horizontal|~*~|2MM Vertical|~*~|'
|
|
786
|
-
* // Content (composite): '50.0% MetalProcessing|~*~|50.0% Cable|~*~|'
|
|
787
|
-
* //
|
|
788
|
-
* // VibeIQ stores these raw '|~*~|'-joined strings as-is, so no split/join is
|
|
789
|
-
* // needed — a plain REKEY carries the value through unchanged in both
|
|
790
|
-
* // directions. If you later need to store an array or a cleaned display
|
|
791
|
-
* // value instead, add a VALUE_TRANSFORM task to `transformOrder` and a
|
|
792
|
-
* // matching `valueTransform` entry (see {@link DirectionalSection.valueTransform})
|
|
793
|
-
* // that splits on / joins with '|~*~|'.
|
|
794
|
-
* export const mapping: MappingFile = {
|
|
795
|
-
* orgInfo: { appIdentifier: '@vibeiq/flexplm-connector', orgName: 'acme' },
|
|
796
|
-
* typeConversion: { vibe2flex: {}, flex2vibe: {} },
|
|
797
|
-
* LCSProduct: {
|
|
798
|
-
* vibe2flex: {
|
|
799
|
-
* transformOrder: [
|
|
800
|
-
* { processor: 'REKEY', rekeyDelete: true, rekeyKeepEmptyValues: true, rekeyTransformersKey: 'rekey' },
|
|
801
|
-
* ],
|
|
802
|
-
* // flexField: 'vibeSlug' — raw '|~*~|' strings pass straight through.
|
|
803
|
-
* rekey: {
|
|
804
|
-
* cuttableWidth: 'cuttableWidth', // multi-entry
|
|
805
|
-
* materialContent: 'materialContent', // composite (Flex 'Content')
|
|
806
|
-
* },
|
|
807
|
-
* },
|
|
808
|
-
* flex2vibe: {
|
|
809
|
-
* transformOrder: [
|
|
810
|
-
* { processor: 'REKEY', rekeyDelete: true, rekeyKeepEmptyValues: true, rekeyTransformersKey: 'rekey' },
|
|
811
|
-
* ],
|
|
812
|
-
* // vibeSlug: 'flexField'
|
|
813
|
-
* rekey: {
|
|
814
|
-
* cuttableWidth: 'cuttableWidth',
|
|
815
|
-
* materialContent: 'materialContent',
|
|
816
|
-
* },
|
|
817
|
-
* },
|
|
818
|
-
* },
|
|
819
|
-
* };
|
|
820
779
|
*/
|
|
821
780
|
export type MappingFile = MappingFileBase & {
|
|
822
781
|
[mapKey: string]: MappingSection | MappingFileBase[keyof MappingFileBase];
|
|
@@ -10,6 +10,10 @@ class ConfigDefaults {
|
|
|
10
10
|
if (!config.apiHost || !config.userName || !config.password) {
|
|
11
11
|
throw new Error(ConfigDefaults.NEED_CONFIG_VALUES);
|
|
12
12
|
}
|
|
13
|
+
if (config.complexConfig && typeof config.complexConfig === 'object') {
|
|
14
|
+
Object.assign(config, config.complexConfig);
|
|
15
|
+
delete config.complexConfig;
|
|
16
|
+
}
|
|
13
17
|
//List will be comma separated list in UI, so convert to array
|
|
14
18
|
if (config?.itemPreDevelopmentLifecycleStages && !(config?.itemPreDevelopmentLifecycleStages instanceof Array)) {
|
|
15
19
|
config.itemPreDevelopmentLifecycleStages = config.itemPreDevelopmentLifecycleStages.split(',');
|
|
@@ -49,6 +53,7 @@ class ConfigDefaults {
|
|
|
49
53
|
LCSMaterial: {
|
|
50
54
|
processAsItem: false
|
|
51
55
|
},
|
|
56
|
+
useDistinctRestEndPointForImages: true,
|
|
52
57
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
53
58
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
54
59
|
payloadDefaultAsArray: true
|
|
@@ -38,7 +38,8 @@ describe('getFlexPLMValue multi_select', () => {
|
|
|
38
38
|
urlContext: 'xxx',
|
|
39
39
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
40
40
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
41
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
41
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
42
|
+
useDistinctRestEndPointForImages: true
|
|
42
43
|
};
|
|
43
44
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
44
45
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -96,7 +97,8 @@ describe('getEnumerationValue', () => {
|
|
|
96
97
|
urlContext: 'xxx',
|
|
97
98
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
98
99
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
99
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
100
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
101
|
+
useDistinctRestEndPointForImages: true
|
|
100
102
|
};
|
|
101
103
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
102
104
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -153,7 +155,8 @@ describe('getEnumerationValue multi_select', () => {
|
|
|
153
155
|
urlContext: 'xxx',
|
|
154
156
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
155
157
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
156
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
158
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
159
|
+
useDistinctRestEndPointForImages: true
|
|
157
160
|
};
|
|
158
161
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
159
162
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -213,7 +216,8 @@ describe('getPersistableChanges', () => {
|
|
|
213
216
|
urlContext: 'xxx',
|
|
214
217
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
215
218
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
216
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
219
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
220
|
+
useDistinctRestEndPointForImages: true
|
|
217
221
|
};
|
|
218
222
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
219
223
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -298,7 +302,8 @@ describe('getObjectReferenceValue cache', () => {
|
|
|
298
302
|
urlContext: 'xxx',
|
|
299
303
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
300
304
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
301
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
305
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
306
|
+
useDistinctRestEndPointForImages: true
|
|
302
307
|
};
|
|
303
308
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
304
309
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -356,7 +361,8 @@ describe('getObjectReferenceValue bad value', () => {
|
|
|
356
361
|
urlContext: 'xxx',
|
|
357
362
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
358
363
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
359
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
364
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
365
|
+
useDistinctRestEndPointForImages: true
|
|
360
366
|
};
|
|
361
367
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
362
368
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -462,7 +468,8 @@ describe('setObjectReferenceValue - identity service', () => {
|
|
|
462
468
|
urlContext: 'xxx',
|
|
463
469
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
464
470
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
465
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
471
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
472
|
+
useDistinctRestEndPointForImages: true
|
|
466
473
|
});
|
|
467
474
|
const refProp = {
|
|
468
475
|
id: 'cJoZQvoj7dkfCBJq',
|
|
@@ -920,7 +927,8 @@ describe('getEntityValues', () => {
|
|
|
920
927
|
urlContext: 'xxx',
|
|
921
928
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
922
929
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
923
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
930
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
931
|
+
useDistinctRestEndPointForImages: true
|
|
924
932
|
};
|
|
925
933
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
926
934
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -961,7 +969,8 @@ describe('setEnumerationKeys', () => {
|
|
|
961
969
|
urlContext: 'xxx',
|
|
962
970
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
963
971
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
964
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
972
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
973
|
+
useDistinctRestEndPointForImages: true
|
|
965
974
|
};
|
|
966
975
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
967
976
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -1025,7 +1034,8 @@ describe('checkKeysAndValues', () => {
|
|
|
1025
1034
|
urlContext: 'xxx',
|
|
1026
1035
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
1027
1036
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
1028
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
1037
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
1038
|
+
useDistinctRestEndPointForImages: true
|
|
1029
1039
|
};
|
|
1030
1040
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
1031
1041
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -1102,7 +1112,8 @@ describe('filterOutArchivedAndTrashedEntities', () => {
|
|
|
1102
1112
|
urlContext: 'xxx',
|
|
1103
1113
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
1104
1114
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
1105
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
1115
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
1116
|
+
useDistinctRestEndPointForImages: true
|
|
1106
1117
|
};
|
|
1107
1118
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
1108
1119
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -1142,7 +1153,8 @@ describe('setUserListValue', () => {
|
|
|
1142
1153
|
urlContext: 'xxx',
|
|
1143
1154
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
1144
1155
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
1145
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
1156
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
1157
|
+
useDistinctRestEndPointForImages: true
|
|
1146
1158
|
};
|
|
1147
1159
|
const userListProp1 = {};
|
|
1148
1160
|
const userEmailMapping = [
|
|
@@ -1238,7 +1250,8 @@ describe('getUserListValue', () => {
|
|
|
1238
1250
|
urlContext: 'xxx',
|
|
1239
1251
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
1240
1252
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
1241
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
1253
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
1254
|
+
useDistinctRestEndPointForImages: true
|
|
1242
1255
|
};
|
|
1243
1256
|
const userListProp1 = {
|
|
1244
1257
|
slug: 'userList1'
|
|
@@ -1340,7 +1353,8 @@ describe('getFlexPLMValue size_range', () => {
|
|
|
1340
1353
|
urlContext: 'xxx',
|
|
1341
1354
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
1342
1355
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
1343
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
1356
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
1357
|
+
useDistinctRestEndPointForImages: true
|
|
1344
1358
|
};
|
|
1345
1359
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
1346
1360
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -1373,7 +1387,8 @@ describe('getEntityValue size_range', () => {
|
|
|
1373
1387
|
urlContext: 'xxx',
|
|
1374
1388
|
vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
|
|
1375
1389
|
csrfEndpoint: '/servlet/rest/security/csrf',
|
|
1376
|
-
itemPreDevelopmentLifecycleStages: ['concept']
|
|
1390
|
+
itemPreDevelopmentLifecycleStages: ['concept'],
|
|
1391
|
+
useDistinctRestEndPointForImages: true
|
|
1377
1392
|
};
|
|
1378
1393
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
1379
1394
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -181,11 +181,32 @@ class ThumbnailUtil {
|
|
|
181
181
|
const fileName = urlParts[urlParts.length - 1] || 'thumbnail';
|
|
182
182
|
const encodedUrl = urlParts.map(part => encodeURIComponent(part)).join('/');
|
|
183
183
|
const flexPLMConnect = new flexplm_connect_1.FlexPLMConnect(this.config);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
184
|
+
console.log('the useDistinctRestEndPointForImages is --> ' + this.config.useDistinctRestEndPointForImages);
|
|
185
|
+
let response;
|
|
186
|
+
if (this.config.useDistinctRestEndPointForImages) {
|
|
187
|
+
// Route through the connector endpoint (Basic auth + VIBEIQGROUP enforced there).
|
|
188
|
+
const imageEndpoint = '/rfa/vibeiq/image';
|
|
189
|
+
const urlPath = '/servlet/rest' + imageEndpoint + '?path=' + encodeURIComponent(thumbnailUrl);
|
|
190
|
+
response = await flexPLMConnect.getRequest({
|
|
191
|
+
urlPath,
|
|
192
|
+
includeUrlContext: true,
|
|
193
|
+
returnFullResponse: true,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
response = await flexPLMConnect.getRequest({
|
|
198
|
+
urlPath: encodedUrl,
|
|
199
|
+
includeUrlContext: false,
|
|
200
|
+
returnFullResponse: true,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
// Ensure we actually receive an image content type.
|
|
204
|
+
const contTypeHeader = response.headers.get('content-type');
|
|
205
|
+
const contType = contTypeHeader ? contTypeHeader.split(';')[0] : 'application/octet-stream';
|
|
206
|
+
if (!contType.startsWith('image/')) {
|
|
207
|
+
const message = `Expected image content from FlexPLM but received '${contType}' for ${thumbnailUrl}`;
|
|
208
|
+
throw new Error(message);
|
|
209
|
+
}
|
|
189
210
|
const fileBuffer = await response.arrayBuffer();
|
|
190
211
|
const buffer = Buffer.from(fileBuffer);
|
|
191
212
|
const contentTypeHeader = response.headers.get('content-type');
|