@contrail/flexplm 1.3.0 → 1.3.1-alpha.3e8dbdd

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.
Files changed (149) hide show
  1. package/lib/cli/commands/compile.d.ts +1 -0
  2. package/lib/cli/commands/compile.js +71 -0
  3. package/lib/cli/commands/compile.spec.d.ts +1 -0
  4. package/lib/cli/commands/compile.spec.js +80 -0
  5. package/lib/cli/commands/create.d.ts +1 -0
  6. package/lib/cli/commands/create.js +75 -0
  7. package/lib/cli/commands/create.spec.d.ts +1 -0
  8. package/lib/cli/commands/create.spec.js +78 -0
  9. package/lib/cli/commands/upload.d.ts +10 -0
  10. package/lib/cli/commands/upload.js +226 -0
  11. package/lib/cli/commands/upload.spec.d.ts +1 -0
  12. package/lib/cli/commands/upload.spec.js +88 -0
  13. package/lib/cli/index.d.ts +2 -0
  14. package/lib/cli/index.js +64 -0
  15. package/lib/cli/index.spec.d.ts +1 -0
  16. package/lib/cli/index.spec.js +79 -0
  17. package/lib/cli/template/mapping-template.ts.template +62 -0
  18. package/lib/entity-processor/base-entity-processor.d.ts +89 -42
  19. package/lib/entity-processor/base-entity-processor.js +438 -385
  20. package/lib/entity-processor/base-entity-processor.spec.d.ts +1 -1
  21. package/lib/entity-processor/base-entity-processor.spec.js +398 -397
  22. package/lib/flexplm-request.d.ts +3 -3
  23. package/lib/flexplm-request.js +34 -34
  24. package/lib/flexplm-utils.d.ts +5 -5
  25. package/lib/flexplm-utils.js +33 -33
  26. package/lib/flexplm-utils.spec.d.ts +1 -1
  27. package/lib/flexplm-utils.spec.js +26 -26
  28. package/lib/index.d.ts +23 -22
  29. package/lib/index.js +39 -38
  30. package/lib/interfaces/interfaces.d.ts +105 -105
  31. package/lib/interfaces/interfaces.js +2 -2
  32. package/lib/interfaces/item-family-changes.d.ts +20 -20
  33. package/lib/interfaces/item-family-changes.js +56 -56
  34. package/lib/interfaces/mapping-file.d.ts +460 -0
  35. package/lib/interfaces/mapping-file.js +2 -0
  36. package/lib/interfaces/publish-change-data.d.ts +19 -19
  37. package/lib/interfaces/publish-change-data.js +32 -32
  38. package/lib/publish/base-process-publish-assortment-callback.d.ts +9 -9
  39. package/lib/publish/base-process-publish-assortment-callback.js +38 -38
  40. package/lib/publish/base-process-publish-assortment.d.ts +118 -93
  41. package/lib/publish/base-process-publish-assortment.js +998 -944
  42. package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -1
  43. package/lib/publish/base-process-publish-assortment.spec.js +1688 -1670
  44. package/lib/publish/mockData.d.ts +1389 -1389
  45. package/lib/publish/mockData.js +4524 -4519
  46. package/lib/transform/identifier-conversion-spec-mockData.js +472 -444
  47. package/lib/transform/identifier-conversion.d.ts +51 -15
  48. package/lib/transform/identifier-conversion.js +248 -212
  49. package/lib/transform/identifier-conversion.spec.d.ts +1 -1
  50. package/lib/transform/identifier-conversion.spec.js +343 -339
  51. package/lib/util/config-defaults.d.ts +8 -8
  52. package/lib/util/config-defaults.js +88 -85
  53. package/lib/util/config-defaults.spec.d.ts +1 -1
  54. package/lib/util/config-defaults.spec.js +302 -293
  55. package/lib/util/data-converter-spec-mockData.js +219 -205
  56. package/lib/util/data-converter.d.ts +136 -39
  57. package/lib/util/data-converter.js +718 -592
  58. package/lib/util/data-converter.spec.d.ts +1 -1
  59. package/lib/util/data-converter.spec.js +906 -904
  60. package/lib/util/error-response-object.d.ts +9 -4
  61. package/lib/util/error-response-object.js +54 -47
  62. package/lib/util/error-response-object.spec.d.ts +1 -1
  63. package/lib/util/error-response-object.spec.js +99 -99
  64. package/lib/util/event-short-message-status.d.ts +19 -19
  65. package/lib/util/event-short-message-status.js +24 -23
  66. package/lib/util/federation.d.ts +15 -15
  67. package/lib/util/federation.js +157 -149
  68. package/lib/util/flexplm-connect.d.ts +29 -22
  69. package/lib/util/flexplm-connect.js +190 -176
  70. package/lib/util/flexplm-connect.spec.d.ts +1 -1
  71. package/lib/util/flexplm-connect.spec.js +88 -88
  72. package/lib/util/logger-config.d.ts +1 -1
  73. package/lib/util/logger-config.js +27 -26
  74. package/lib/util/map-util-spec-mockData.js +219 -205
  75. package/lib/util/map-utils.d.ts +33 -6
  76. package/lib/util/map-utils.js +42 -15
  77. package/lib/util/map-utils.spec.d.ts +1 -1
  78. package/lib/util/map-utils.spec.js +89 -89
  79. package/lib/util/mockData.d.ts +80 -80
  80. package/lib/util/mockData.js +103 -103
  81. package/lib/util/thumbnail-util.d.ts +55 -34
  82. package/lib/util/thumbnail-util.js +242 -215
  83. package/lib/util/thumbnail-util.spec.d.ts +1 -1
  84. package/lib/util/thumbnail-util.spec.js +440 -434
  85. package/lib/util/type-conversion-utils-spec-mockData.js +259 -259
  86. package/lib/util/type-conversion-utils.d.ts +163 -23
  87. package/lib/util/type-conversion-utils.js +408 -265
  88. package/lib/util/type-conversion-utils.spec.d.ts +1 -1
  89. package/lib/util/type-conversion-utils.spec.js +868 -868
  90. package/lib/util/type-defaults.d.ts +74 -16
  91. package/lib/util/type-defaults.js +279 -221
  92. package/lib/util/type-defaults.spec.d.ts +1 -1
  93. package/lib/util/type-defaults.spec.js +516 -516
  94. package/lib/util/type-utils.d.ts +34 -13
  95. package/lib/util/type-utils.js +137 -114
  96. package/lib/util/type-utils.spec.d.ts +1 -1
  97. package/lib/util/type-utils.spec.js +192 -190
  98. package/package.json +21 -6
  99. package/scripts/copy-template.js +10 -0
  100. package/.claude/settings.local.json +0 -8
  101. package/.github/pull_request_template.md +0 -31
  102. package/.github/workflows/flexplm-lib.yml +0 -27
  103. package/.github/workflows/publish-to-npm.yml +0 -124
  104. package/CHANGELOG.md +0 -32
  105. package/publish.bat +0 -5
  106. package/publish.sh +0 -5
  107. package/src/entity-processor/base-entity-processor.spec.ts +0 -460
  108. package/src/entity-processor/base-entity-processor.ts +0 -515
  109. package/src/flexplm-request.ts +0 -28
  110. package/src/flexplm-utils.spec.ts +0 -27
  111. package/src/flexplm-utils.ts +0 -29
  112. package/src/index.ts +0 -22
  113. package/src/interfaces/interfaces.ts +0 -122
  114. package/src/interfaces/item-family-changes.ts +0 -67
  115. package/src/interfaces/publish-change-data.ts +0 -43
  116. package/src/publish/base-process-publish-assortment-callback.ts +0 -50
  117. package/src/publish/base-process-publish-assortment.spec.ts +0 -1992
  118. package/src/publish/base-process-publish-assortment.ts +0 -1134
  119. package/src/publish/mockData.ts +0 -4561
  120. package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
  121. package/src/transform/identifier-conversion.spec.ts +0 -354
  122. package/src/transform/identifier-conversion.ts +0 -282
  123. package/src/util/config-defaults.spec.ts +0 -350
  124. package/src/util/config-defaults.ts +0 -93
  125. package/src/util/data-converter-spec-mockData.ts +0 -231
  126. package/src/util/data-converter.spec.ts +0 -1041
  127. package/src/util/data-converter.ts +0 -762
  128. package/src/util/error-response-object.spec.ts +0 -116
  129. package/src/util/error-response-object.ts +0 -50
  130. package/src/util/event-short-message-status.ts +0 -22
  131. package/src/util/federation.ts +0 -172
  132. package/src/util/flexplm-connect.spec.ts +0 -132
  133. package/src/util/flexplm-connect.ts +0 -208
  134. package/src/util/logger-config.ts +0 -20
  135. package/src/util/map-util-spec-mockData.ts +0 -231
  136. package/src/util/map-utils.spec.ts +0 -103
  137. package/src/util/map-utils.ts +0 -41
  138. package/src/util/mockData.ts +0 -101
  139. package/src/util/thumbnail-util.spec.ts +0 -508
  140. package/src/util/thumbnail-util.ts +0 -272
  141. package/src/util/type-conversion-utils-spec-mockData.ts +0 -271
  142. package/src/util/type-conversion-utils.spec.ts +0 -968
  143. package/src/util/type-conversion-utils.ts +0 -460
  144. package/src/util/type-defaults.spec.ts +0 -669
  145. package/src/util/type-defaults.ts +0 -281
  146. package/src/util/type-utils.spec.ts +0 -227
  147. package/src/util/type-utils.ts +0 -144
  148. package/tsconfig.json +0 -29
  149. package/tslint.json +0 -57
@@ -1,272 +0,0 @@
1
- import { Logger } from '@contrail/app-framework';
2
- import { Content, Entities } from '@contrail/sdk';
3
- import { FCConfig } from '../interfaces/interfaces';
4
- import { FlexPLMConnect } from './flexplm-connect';
5
-
6
- interface ContentCustomSize {
7
- id: string;
8
- slug: string;
9
- name: string;
10
- };
11
- export class ThumbnailUtil {
12
- /** The max_thumbnail_size is for limiting the size of the thumbnail being sent to FlexPLM. It is used when checking the size of the auto generated thumbnails (smallViewable, tinyViewable, etc.). */
13
- private max_thumbnail_size = 5 * 1_024 * 1_024;
14
- private entities: Entities;
15
- static NEW_THUMBNAIL_ID = 'NEW_THUMBNAIL_ID';
16
- static EXISTING_THUMBNAIL_ID = 'EXISTING_THUMBNAIL_ID';
17
- static REMOVE_THUMBNAIL = 'REMOVE_THUMBNAIL';
18
- static OOB_SIZES = [{ slug: 'largeViewable' }, { slug: 'mediumLargeViewable' }, { slug: 'mediumViewable' }, { slug: 'smallViewable' }, { slug: 'tinyViewable' }]
19
- constructor(private config: FCConfig){
20
- this.entities = new Entities();
21
- if(this.config['max_thumbnail_size']){
22
- this.max_thumbnail_size = this.config['max_thumbnail_size'];
23
- }
24
- }
25
- async setOutboundThumbnail(data, event){
26
- if(event?.newData?.primaryViewableId && event?.newData?.largeViewableDownloadUrl){
27
- const primaryViewableId = event.newData.primaryViewableId;
28
-
29
- //get custom sizes
30
- const fileId = await this.getFileId(primaryViewableId);
31
-
32
- if(fileId){
33
- const customSizes = await this.getCustomSizes();
34
- const key = (this.isThumbnailNew(event, customSizes))
35
- ? ThumbnailUtil.NEW_THUMBNAIL_ID
36
- : ThumbnailUtil.EXISTING_THUMBNAIL_ID;
37
- data[key] = fileId;
38
- }
39
- } else if(event?.propertyDiffs?.largeViewableDownloadUrl?.oldValue && !event?.propertyDiffs?.largeViewableDownloadUrl?.newValue){
40
- data[ThumbnailUtil.NEW_THUMBNAIL_ID] = ThumbnailUtil.REMOVE_THUMBNAIL;
41
-
42
- }
43
- return data;
44
- }
45
- /** Determines if a new image has been generated. If any viewable is new, there might be a better
46
- * sized image. So send the fileId as new.
47
- */
48
- public isThumbnailNew(event, customSizes: any[]): boolean {
49
- const propertyDiffs = event?.propertyDiffs;
50
- if(propertyDiffs){
51
- const diffKeys = Object.keys(propertyDiffs);
52
- const sizeKeys = ThumbnailUtil.OOB_SIZES.map( s => s.slug + 'DownloadUrl');
53
- if(customSizes){
54
- sizeKeys.push(...customSizes.map(s => s.slug+ 'Url'));
55
- }
56
- sizeKeys.push('primaryFileUrl');
57
- console.info('diffKeys: ' + JSON.stringify(diffKeys));
58
- console.info('sizeKeys: ' + JSON.stringify(sizeKeys));
59
- return diffKeys.some(s => sizeKeys.includes(s));
60
- }
61
- return false;
62
- }
63
-
64
- public async getFileId(primaryViewableId: string): Promise<string | undefined> {
65
- console.info('ThumbnailUtil.getFileId()-' + primaryViewableId);
66
- const sizes = await this.getCustomSizes();
67
-
68
- const OOBSizes = JSON.parse(JSON.stringify(ThumbnailUtil.OOB_SIZES));
69
- sizes.push(...OOBSizes);
70
- console.info('sizes: ' + JSON.stringify(sizes));
71
-
72
- //get Content
73
- const content = await this.getContentEntity(primaryViewableId, sizes);
74
- if (!content) {
75
- return undefined;
76
- }
77
-
78
- const contentKeys = Object.getOwnPropertyNames(content);
79
- const isDebugOn = Logger.isDebugOn();
80
-
81
- let fileId = undefined;
82
- let tempFileSize = 0;
83
-
84
- for(const size of sizes){
85
- const slug = size?.slug;
86
- if(contentKeys.includes(slug)){
87
- const file = content[slug];
88
- if(isDebugOn){
89
- console.debug('size: ' + slug);
90
- console.debug('fileId: ' + file['id']);
91
- }
92
- if(file && file['size'] > tempFileSize && file['size'] < this.max_thumbnail_size){
93
- tempFileSize = file['size'];
94
- fileId = file['id'];
95
- if(isDebugOn){
96
- console.debug('fileId: ' + fileId);
97
- }
98
- }
99
- }
100
- }
101
- console.info('ThumbnailUtil.getFileId(): returning-' + fileId);
102
- return fileId;
103
- }
104
-
105
- async getCustomSizes(): Promise<ContentCustomSize[]> {
106
- const customSizes = await this.entities.get({
107
- entityName: 'content-custom-size'
108
- });
109
- const sizes: ContentCustomSize[] = [];
110
- sizes.push(...customSizes);
111
- return sizes;
112
- }
113
-
114
- async getContentEntity(primaryViewableId: any, sizes: ContentCustomSize[]) {
115
- const relations = sizes.map(s => s.slug);
116
- relations.push('primaryFile');
117
- const content = await this.entities.get({
118
- entityName: 'content',
119
- id: primaryViewableId,
120
- relations
121
- });
122
- this.logContentResults(content, relations);
123
- return content;
124
- }
125
-
126
- /** This outputs the content entity, without the inflated file entities.
127
- * To help debugging issues with sending the thumbnail info.
128
- * The inflated entities are removed, because are large and cause
129
- * problems with log file size limits.
130
- *
131
- * @param content: the content with inflated objects
132
- * @param relations: string[] of the slugs for inflated objects
133
- */
134
- logContentResults(content: any, relations: string[]) {
135
- if(Logger.isDebugOn() && content && relations){
136
- const contentCopy = JSON.parse(JSON.stringify(content));
137
- relations.forEach(r => {
138
- delete contentCopy[r];
139
- });
140
- console.debug('content: ' + JSON.stringify(contentCopy));
141
- }
142
- }
143
-
144
- /** Syncs the thumbnail from FlexPLM to VibeIQ. Handles creating, replacing, or removing
145
- * the primary viewable content and persists the updates directly to the entity.
146
- *
147
- * @param entityId - The ID of the entity to update with thumbnail properties.
148
- * @param primaryViewableId - The existing primary viewable content ID, if any.
149
- * @param event - The inbound event containing thumbnail data (NEW_THUMBNAIL_ID / EXISTING_THUMBNAIL_ID).
150
- * @param entityName - The entity type name (e.g. 'item', 'color') used for API calls.
151
- * @returns The updated entity, or undefined if no thumbnail changes were needed.
152
- */
153
- async syncThumbnailToVibeIQ({ entityId, primaryViewableId, event, entityName }: { entityId: string; primaryViewableId?: string; event: any; entityName: string }): Promise<any> {
154
- console.debug(`syncThumbnailToVibeIQ: entityId=${entityId}, primaryViewableId=${primaryViewableId}, entityName=${entityName}`);
155
- const eventData = event.data || {};
156
- const newThumbnailId = eventData[ThumbnailUtil.NEW_THUMBNAIL_ID];
157
- const existingThumbnailId = eventData[ThumbnailUtil.EXISTING_THUMBNAIL_ID];
158
- const thumbnailUrl = newThumbnailId || existingThumbnailId;
159
-
160
- // Case 1: REMOVE_THUMBNAIL
161
- if (newThumbnailId === ThumbnailUtil.REMOVE_THUMBNAIL) {
162
- if (primaryViewableId) {
163
- await this.entities.delete({ entityName: 'content', id: primaryViewableId });
164
- }
165
- const clearUpdates = await this.getClearPrimaryViewableUpdates();
166
- const updatedEntity = await this.entities.update({ entityName, id: entityId, object: clearUpdates });
167
- console.debug(`syncThumbnailToVibeIQ: applied clear updates for entityId=${entityId}`);
168
- return updatedEntity;
169
- }
170
-
171
- // Early return if no thumbnail URL
172
- if (!thumbnailUrl) {
173
- console.debug(`syncThumbnailToVibeIQ: no thumbnail URL for entityId=${entityId}`);
174
- return undefined;
175
- }
176
-
177
- // Case 2: No existing primaryViewableId — create new content
178
- if (!primaryViewableId) {
179
- const content = await this.createContentFromFlexPLM(thumbnailUrl, entityId, entityName);
180
- await this.entities.update({ entityName: 'content', id: content.id, object: { flexplmThumbnailUrl: thumbnailUrl } });
181
- const primaryUpdates = await this.getPrimaryViewableUpdates(content);
182
- const updatedEntity = await this.entities.update({ entityName, id: entityId, object: primaryUpdates });
183
- console.debug(`syncThumbnailToVibeIQ: created new content ${content.id} for entityId=${entityId}`);
184
- return updatedEntity;
185
- }
186
-
187
- // Case 3: Has primaryViewableId — check if thumbnail changed
188
- const primaryViewable = await this.entities.get({ entityName: 'content', id: primaryViewableId });
189
- if (primaryViewable?.flexplmThumbnailUrl === thumbnailUrl) {
190
- console.debug(`syncThumbnailToVibeIQ: thumbnail already synced for entityId=${entityId}`);
191
- return undefined; // Already synced
192
- }
193
-
194
- const content = await this.createContentFromFlexPLM(thumbnailUrl, entityId, entityName);
195
- await this.entities.update({ entityName: 'content', id: content.id, object: { flexplmThumbnailUrl: thumbnailUrl } });
196
- const primaryUpdates = await this.getPrimaryViewableUpdates(content);
197
- const updatedEntity = await this.entities.update({ entityName, id: entityId, object: primaryUpdates });
198
- await this.entities.delete({ entityName: 'content', id: primaryViewableId });
199
- console.debug(`syncThumbnailToVibeIQ: replaced content ${primaryViewableId} with ${content.id} for entityId=${entityId}`);
200
- return updatedEntity;
201
- }
202
-
203
- private async createContentFromFlexPLM(thumbnailUrl: string, entityId: string, entityName: string): Promise<any> {
204
- const urlParts = thumbnailUrl.split('/');
205
- const fileName = urlParts[urlParts.length - 1] || 'thumbnail';
206
-
207
- const encodedUrl = urlParts.map(part => encodeURIComponent(part)).join('/');
208
- const flexPLMConnect = new FlexPLMConnect(this.config);
209
- const response = await flexPLMConnect.getRequest({
210
- urlPath: encodedUrl,
211
- includeUrlContext: false,
212
- returnFullResponse: true,
213
- }) as Response;
214
-
215
- const fileBuffer = await response.arrayBuffer();
216
- const buffer = Buffer.from(fileBuffer);
217
- const contentTypeHeader = response.headers.get('content-type');
218
- const contentType = contentTypeHeader ? contentTypeHeader.split(';')[0] : 'application/octet-stream';
219
-
220
- const contentHolderReference = `${entityName}:${entityId}`;
221
- const content = await new Content().create({
222
- fileBuffer: buffer,
223
- fileName,
224
- contentType,
225
- contentHolderReference,
226
- });
227
- return content;
228
- }
229
-
230
- private async getPrimaryViewableUpdates(content: any): Promise<any> {
231
- const updates: any = {
232
- primaryViewableId: content.id,
233
- contentType: content.contentType,
234
- fileName: content.fileName,
235
- primaryFileUrl: content.primaryFileUrl,
236
- largeViewableDownloadUrl: content.largeViewableUrl || content.primaryFileUrl,
237
- mediumLargeViewableDownloadUrl: content.mediumLargeViewableUrl || content.primaryFileUrl,
238
- mediumViewableDownloadUrl: content.mediumViewableUrl || content.primaryFileUrl,
239
- smallViewableDownloadUrl: content.smallViewableUrl || content.primaryFileUrl,
240
- tinyViewableDownloadUrl: content.tinyViewableUrl || content.primaryFileUrl,
241
- };
242
-
243
- const customSizes = await this.getCustomSizes();
244
- for (const size of customSizes) {
245
- updates[`${size.slug}DownloadUrl`] = content[`${size.slug}Url`] || content.primaryFileUrl;
246
- }
247
-
248
- return updates;
249
- }
250
-
251
- private async getClearPrimaryViewableUpdates(): Promise<any> {
252
- const updates: any = {
253
- primaryViewableId: null,
254
- contentType: null,
255
- fileName: null,
256
- primaryFileUrl: null,
257
- largeViewableDownloadUrl: null,
258
- mediumLargeViewableDownloadUrl: null,
259
- mediumViewableDownloadUrl: null,
260
- smallViewableDownloadUrl: null,
261
- tinyViewableDownloadUrl: null,
262
- };
263
-
264
- const customSizes = await this.getCustomSizes();
265
- for (const size of customSizes) {
266
- updates[`${size.slug}DownloadUrl`] = null;
267
- }
268
-
269
- return updates;
270
- }
271
-
272
- }
@@ -1,271 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- exports.mapping = {
4
- typeConversion: {
5
- vibe2flex: {
6
- 'custom-entity': {
7
- getMapKey: (entity) =>{
8
- const typePath = entity['typePath'];
9
- let mapKey = '';
10
- switch (typePath) {
11
- case 'custom-entity:pack':
12
- mapKey = 'packaging';
13
- break;
14
- case 'custom-entity:prefix':
15
- mapKey = 'prefix';
16
- break;
17
- case 'custom-entity:catName':
18
- mapKey = 'catName';
19
- break;
20
- case 'custom-entity:partnerOrg':
21
- mapKey = 'partnerOrg';
22
- break;
23
- case 'custom-entity:catFamily':
24
- mapKey = 'catFamily';
25
- break;
26
- case 'custom-entity:formName':
27
- mapKey = 'formName';
28
- break;
29
- }
30
-
31
- return mapKey;
32
- }
33
- }
34
- },
35
- flex2vibe: {
36
- LCSLast: {
37
- getMapKey: (object) =>{ return 'catName';}
38
- },
39
- LCSRevisableEntity : {
40
- getMapKey: (object) =>{
41
- const typePath = object['flexPLMTypePath'];
42
- let mapKey = '';
43
- switch (typePath) {
44
- case 'Revisable Entity\\packaging':
45
- mapKey = 'packaging';
46
- break
47
- case 'Revisable Entity\\prefix':
48
- mapKey = 'prefix';
49
- break
50
- };
51
- return mapKey;
52
- }
53
- }
54
- }
55
-
56
- },
57
- LCSProduct: {
58
- vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
59
- vibe2flex: {
60
- getClass: () => 'LCSProduct',
61
- getSoftType: (entity /*, dependencies*/) =>{
62
- const prodType = entity['prodType'];
63
- let val = '';
64
- switch (prodType) {
65
- case 'acc':
66
- val = 'Product\\Accesories';
67
- break;
68
- case 'app':
69
- val = 'Product\\Apparel';
70
- break;
71
- case 'eqp':
72
- val = 'Product\\Equipment';
73
- break;
74
- case 'foot':
75
- val = 'Product\\Footwear';
76
- break;
77
- }
78
-
79
- return val;
80
- },
81
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }, { processor: 'VALUE_TRANSFORM', functionTransformersKey: 'valueTransform' }],
82
- rekey: {
83
- productName: 'name',
84
- vibeIQIdentifier: 'itemNumber'
85
- },
86
- valueTransform: {
87
- transformEx: (row/*, dependencies*/) => {
88
- return row['otherProp'] + 'xxx';
89
- }
90
- }
91
-
92
- },
93
- flex2vibe: {
94
- getClass: () => 'item',
95
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
96
- rekey: {
97
- itemNumber: 'vibeIQIdentifier',
98
- name: 'productName',
99
- }
100
- }
101
- },
102
- LCSSKU: {
103
- vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
104
- vibe2flex: {
105
- getClass: () => 'LCSSKU',
106
- getSoftType: (entity /*, dependencies*/) =>{
107
- const prodType = entity['prodType'];
108
- let val = '';
109
- switch (prodType) {
110
- case 'acc':
111
- val = 'Product\\Accesories';
112
- break;
113
- case 'app':
114
- val = 'Product\\Apparel';
115
- break;
116
- case 'eqp':
117
- val = 'Product\\Equipment';
118
- break;
119
- case 'foot':
120
- val = 'Product\\Footwear';
121
- break;
122
- }
123
-
124
- return val;
125
- },
126
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
127
- rekey: {
128
- skuName: 'optionName',
129
- vibeIQIdentifier: 'itemNumber'
130
- }
131
- },
132
- flex2vibe: {
133
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
134
- rekey: {
135
- itemNumber: 'vibeIQIdentifier',
136
- optionName: 'skuName',
137
- }
138
- }
139
- },
140
-
141
- packaging: {
142
- isOutboundCreatable: (entity, context) => {
143
- return false;
144
- },
145
- syncInboundImages: (entity, context) => {
146
- return true;
147
- },
148
- syncOutboundImages: (entity, context) => {
149
- return false;
150
- },
151
- vibe2flex: {
152
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
153
- rekey: {
154
- retailPackType: 'packType',
155
- retailIntroDate: 'introDate'
156
- },
157
- getSoftType: () => 'Revisable Entity\\packaging',
158
- getClass: () => 'LCSRevisableEntity'
159
- },
160
- flex2vibe: {
161
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
162
- rekey: {
163
- packType: 'retailPackType',
164
- introDate: 'retailIntroDate'
165
- },
166
- getClass: () => 'custom-entity',
167
- getSoftType: () => 'custom-entity:pack',
168
-
169
- }
170
- },
171
- prefix: {
172
- isInboundCreatable: (object, context) => {
173
- if (context && context.skipPrefix) {
174
- return false;
175
- }
176
- return true;
177
- },
178
- isOutboundCreatable: (entity, context) => {
179
- if (context && context.skipPrefix) {
180
- return false;
181
- }
182
- return true;
183
- },
184
- syncInboundImages: (entity, context) => {
185
- if (context && context.skipImages) {
186
- return false;
187
- }
188
- return true;
189
- },
190
- syncOutboundImages: (entity, context) => {
191
- if (context && context.skipImages) {
192
- return false;
193
- }
194
- return true;
195
- },
196
- vibe2flex: {
197
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
198
- rekey: {
199
- retailOwner: 'owner',
200
- retailIntroDate: 'introDate'
201
- },
202
- getSoftType: () => 'Revisable Entity\\prefix',
203
- getClass: () => 'LCSRevisableEntity'
204
- },
205
- flex2vibe: {
206
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
207
- rekey: {
208
- owner: 'retailOwner',
209
- introDate: 'retailIntroDate'
210
- },
211
- getClass: () => 'custom-entity',
212
- getSoftType: () => 'custom-entity:prefix',
213
-
214
- }
215
- },
216
- catName: {
217
- getIdentifierProperties: () => ['catName', 'catNumber'],
218
- getInformationalProperties: () => ['longName'],
219
- vibe2flex: {
220
- transformOrder: [],
221
- getSoftType: () => 'Last\\catName',
222
- getClass: () => 'LCSLast'
223
- },
224
- flex2vibe: {
225
- transformOrder: [],
226
- getClass: () => 'custom-entity',
227
- getSoftType: () => 'custom-entity:catName',
228
-
229
- }
230
- },
231
- partnerOrg: {
232
- vibe2flex: {
233
- transformOrder: [],
234
- getSoftType: () => 'Business Object\\partnerOrg',
235
- getClass: () => 'LCSLifecycleManaged'
236
- },
237
- flex2vibe: {
238
- transformOrder: [],
239
- getClass: () => 'custom-entity',
240
- getSoftType: () => 'custom-entity:partnerOrg',
241
-
242
- }
243
- },
244
- catFamily: {
245
- vibe2flex: {
246
- transformOrder: [],
247
- getSoftType: () => 'Revisable Entity\\catFamily',
248
- getClass: () => 'LCSRevisableEntity'
249
- },
250
- flex2vibe: {
251
- transformOrder: [],
252
- getClass: () => 'custom-entity',
253
- getSoftType: () => 'custom-entity:catFamily',
254
-
255
- }
256
- },
257
- formName: {
258
- vibe2flex: {
259
- transformOrder: [],
260
- getSoftType: () => 'Material\\form',
261
- getClass: () => 'LCSMaterial'
262
- },
263
- flex2vibe: {
264
- transformOrder: [],
265
- getClass: () => 'custom-entity',
266
- getSoftType: () => 'custom-entity:formName',
267
-
268
- }
269
- },
270
-
271
- };