@contrail/flexplm 1.1.2 → 1.1.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.
@@ -9,10 +9,10 @@ export declare class DataConverter {
9
9
  private objRefCache;
10
10
  constructor(config: FCConfig, mapFileUtil: MapFileUtil);
11
11
  getFlexPLMObjectDataFromEvent(event: any, dataToSkip: string[]): Promise<{}>;
12
- getFlexPLMObjectData(newData: any, dataToSkip: string[], expandObjRef: boolean): Promise<{}>;
13
- getFlexPLMValue(prop: any, newData: any, expandObjRef: boolean): Promise<any>;
12
+ getFlexPLMObjectData(newData: any, dataToSkip: string[], inflateObjRef: boolean): Promise<{}>;
13
+ getFlexPLMValue(prop: any, newData: any, inflateObjRef: boolean): Promise<any>;
14
14
  getEnumerationValue(prop: any, nd: any): any;
15
- getObjectReferenceValue(prop: any, newData: any, expandObjRef?: boolean): Promise<any>;
15
+ getObjectReferenceValue(prop: any, newData: any, inflateObjRef?: boolean): Promise<any>;
16
16
  getMappingClass(entity: object, mapping: any): string;
17
17
  setEntityValues(entity: any, data: any, keysToSkip?: string[]): Promise<any>;
18
18
  getEntityValues(objectClass: string, data: any, keysToSkip?: string[]): Promise<{}>;
@@ -21,7 +21,7 @@ class DataConverter {
21
21
  async getFlexPLMObjectDataFromEvent(event, dataToSkip) {
22
22
  return this.getFlexPLMObjectData(event.newData, dataToSkip, true);
23
23
  }
24
- async getFlexPLMObjectData(newData, dataToSkip, expandObjRef) {
24
+ async getFlexPLMObjectData(newData, dataToSkip, inflateObjRef) {
25
25
  if (app_framework_1.Logger.isDebugOn()) {
26
26
  console.debug('newData: ' + JSON.stringify(newData));
27
27
  }
@@ -39,14 +39,14 @@ class DataConverter {
39
39
  if (dataToSkip.includes(slug)) {
40
40
  continue;
41
41
  }
42
- data[slug] = await this.getFlexPLMValue(prop, newData, expandObjRef);
42
+ data[slug] = await this.getFlexPLMValue(prop, newData, inflateObjRef);
43
43
  }
44
44
  if (app_framework_1.Logger.isDebugOn()) {
45
45
  console.debug('getFlexPLMObjectData-data: ' + JSON.stringify(data));
46
46
  }
47
47
  return data;
48
48
  }
49
- async getFlexPLMValue(prop, newData, expandObjRef) {
49
+ async getFlexPLMValue(prop, newData, inflateObjRef) {
50
50
  const propertyType = prop['propertyType'];
51
51
  const slug = prop['slug'];
52
52
  const nd = newData[slug];
@@ -75,7 +75,7 @@ class DataConverter {
75
75
  value = this.getEnumerationValue(prop, nd);
76
76
  }
77
77
  else if ('object_reference' === propertyType) {
78
- value = await this.getObjectReferenceValue(prop, newData, expandObjRef);
78
+ value = await this.getObjectReferenceValue(prop, newData, inflateObjRef);
79
79
  if (app_framework_1.Logger.isDebugOn()) {
80
80
  console.debug('object_reference: ' + JSON.stringify(value));
81
81
  }
@@ -94,7 +94,7 @@ class DataConverter {
94
94
  const propertyType = prop['propertyType'];
95
95
  let value;
96
96
  if (['choice', 'multi_select'].includes(propertyType)) {
97
- const options = prop['options'];
97
+ const options = prop['options'] || [];
98
98
  if ('choice' === propertyType) {
99
99
  if (nd) {
100
100
  const option = options.find(option => option.value == nd);
@@ -102,7 +102,7 @@ class DataConverter {
102
102
  value = Object.assign({}, option);
103
103
  }
104
104
  }
105
- else {
105
+ if (!value) {
106
106
  value = {};
107
107
  }
108
108
  }
@@ -128,13 +128,13 @@ class DataConverter {
128
128
  }
129
129
  return value;
130
130
  }
131
- async getObjectReferenceValue(prop, newData, expandObjRef = false) {
131
+ async getObjectReferenceValue(prop, newData, inflateObjRef = false) {
132
132
  const slug = prop['slug'];
133
133
  console.debug('getObjectReferenceValue-prop: ' + slug);
134
134
  let value = newData[slug];
135
135
  const entityType = prop['referencedTypeRootSlug'];
136
136
  const entityId = newData[slug + 'Id'];
137
- if ((!value || typeof value === 'string') && expandObjRef) {
137
+ if ((!value || typeof value === 'string') && inflateObjRef) {
138
138
  if (entityId) {
139
139
  if (this.objRefCache[entityId]) {
140
140
  console.log('cache hit: ' + entityId);
@@ -33,7 +33,12 @@ class TypeDefaults {
33
33
  objectClass = 'LCSSeason';
34
34
  }
35
35
  else if ('assortment' === entityType) {
36
- objectClass = 'SeasonGroup';
36
+ if ('LCSSeason' === entity.flex2vibeMapKeyRoot || entity.publishToFlexPLM) {
37
+ objectClass = 'LCSSeason';
38
+ }
39
+ else {
40
+ objectClass = 'SeasonGroup';
41
+ }
37
42
  }
38
43
  return objectClass;
39
44
  }
@@ -51,12 +56,17 @@ class TypeDefaults {
51
56
  case 'custom-entity':
52
57
  typePath = 'Revisable Entity';
53
58
  break;
54
- case 'assortment':
55
- typePath = 'Season Group';
56
- break;
57
59
  case 'project':
58
60
  typePath = 'Season';
59
61
  break;
62
+ case 'assortment':
63
+ if ('LCSSeason' === entity.flex2vibeMapKeyRoot || entity.publishToFlexPLM) {
64
+ typePath = 'Season';
65
+ }
66
+ else {
67
+ typePath = 'Season Group';
68
+ }
69
+ break;
60
70
  }
61
71
  return typePath;
62
72
  }
@@ -71,7 +81,12 @@ class TypeDefaults {
71
81
  identifierProps.push('flexPLMSeasonName');
72
82
  break;
73
83
  case 'assortment':
74
- identifierProps.push('seasonGroupName');
84
+ if ('LCSSeason' === entity.flex2vibeMapKeyRoot || entity.publishToFlexPLM) {
85
+ identifierProps.push('flexPLMSeasonName');
86
+ }
87
+ else {
88
+ identifierProps.push('seasonGroupName');
89
+ }
75
90
  break;
76
91
  case 'color':
77
92
  case 'custom-entity':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/flexplm",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Library used for integration with flexplm.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",