@contrail/flexplm 1.1.19 → 1.1.21
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/entity-processor/base-entity-processor.js +2 -2
- package/lib/util/data-converter.js +2 -1
- package/lib/util/type-defaults.d.ts +2 -0
- package/lib/util/type-defaults.js +9 -1
- package/package.json +1 -1
- package/src/entity-processor/base-entity-processor.ts +2 -2
- package/src/util/data-converter.ts +3 -1
- package/src/util/type-defaults.ts +12 -4
|
@@ -110,7 +110,7 @@ class BaseEntityProcessor {
|
|
|
110
110
|
entityName: entityName,
|
|
111
111
|
object: changes,
|
|
112
112
|
};
|
|
113
|
-
console.log("
|
|
113
|
+
console.log("createEntity: " + JSON.stringify(options));
|
|
114
114
|
return await new sdk_1.Entities().create(options);
|
|
115
115
|
}
|
|
116
116
|
async updateEntity(entityName, entity, diffs) {
|
|
@@ -119,7 +119,7 @@ class BaseEntityProcessor {
|
|
|
119
119
|
id: entity['id'],
|
|
120
120
|
object: diffs
|
|
121
121
|
};
|
|
122
|
-
console.log('
|
|
122
|
+
console.log('updateEntity: ' + JSON.stringify(options));
|
|
123
123
|
return await new sdk_1.Entities().update(options);
|
|
124
124
|
}
|
|
125
125
|
async outbound(event) {
|
|
@@ -344,6 +344,7 @@ class DataConverter {
|
|
|
344
344
|
let userOrg = undefined;
|
|
345
345
|
let count = 0;
|
|
346
346
|
let size = 0;
|
|
347
|
+
let emailInput = nd?.email.toLowerCase();
|
|
347
348
|
const entities = new sdk_1.Entities();
|
|
348
349
|
const getOptionsCriteria = {
|
|
349
350
|
entityName: 'user-org',
|
|
@@ -351,7 +352,7 @@ class DataConverter {
|
|
|
351
352
|
};
|
|
352
353
|
do {
|
|
353
354
|
const userBatch = await entities.get(getOptionsCriteria);
|
|
354
|
-
userOrg = userBatch.find(uo => uo?.userEmail ===
|
|
355
|
+
userOrg = userBatch.find(uo => uo?.userEmail.toLowerCase() === emailInput);
|
|
355
356
|
} while (!userOrg && size == getOptionsCriteria.take && count < 15);
|
|
356
357
|
return userOrg?.user;
|
|
357
358
|
}
|
|
@@ -139,9 +139,11 @@ class TypeDefaults {
|
|
|
139
139
|
else if (['LCSSeason', 'SeasonGroup'].includes(objectClass)) {
|
|
140
140
|
entityClass = 'assortment';
|
|
141
141
|
}
|
|
142
|
-
else if (['LCSRevisableEntity', 'LCSLifecycleManaged'].includes(objectClass)) {
|
|
142
|
+
else if (['LCSRevisableEntity', 'LCSLifecycleManaged', 'LCSLast', 'LCSMaterial'].includes(objectClass)) {
|
|
143
143
|
entityClass = 'custom-entity';
|
|
144
144
|
}
|
|
145
|
+
if (entityClass === '')
|
|
146
|
+
throw Error(TypeDefaults.NO_OBJECT_CLASS);
|
|
145
147
|
return entityClass;
|
|
146
148
|
}
|
|
147
149
|
static getDefaultEntityTypePath(object) {
|
|
@@ -158,6 +160,8 @@ class TypeDefaults {
|
|
|
158
160
|
typePath = 'color';
|
|
159
161
|
break;
|
|
160
162
|
}
|
|
163
|
+
if (typePath === '')
|
|
164
|
+
throw Error(TypeDefaults.NO_TYPE_PATH);
|
|
161
165
|
return typePath;
|
|
162
166
|
}
|
|
163
167
|
static getDefaultIdentifierPropertiesFromObject(object) {
|
|
@@ -177,6 +181,8 @@ class TypeDefaults {
|
|
|
177
181
|
case 'LCSColor':
|
|
178
182
|
case 'LCSRevisableEntity':
|
|
179
183
|
case 'LCSLifecycleManaged':
|
|
184
|
+
case 'LCSLast':
|
|
185
|
+
case 'LCSMaterial':
|
|
180
186
|
identifierProps.push('name');
|
|
181
187
|
break;
|
|
182
188
|
}
|
|
@@ -202,3 +208,5 @@ class TypeDefaults {
|
|
|
202
208
|
}
|
|
203
209
|
exports.TypeDefaults = TypeDefaults;
|
|
204
210
|
TypeDefaults.NO_ENTITY_TYPE = 'Not able to determine the entity type of the entity object';
|
|
211
|
+
TypeDefaults.NO_OBJECT_CLASS = 'Please ensure that the flexPLMObjectClass property is provided.';
|
|
212
|
+
TypeDefaults.NO_TYPE_PATH = 'Please ensure that the flexPLMTypePath property is provided.';
|
package/package.json
CHANGED
|
@@ -142,7 +142,7 @@ export abstract class BaseEntityProcessor {
|
|
|
142
142
|
entityName: entityName,
|
|
143
143
|
object: changes,
|
|
144
144
|
};
|
|
145
|
-
console.log("
|
|
145
|
+
console.log("createEntity: " + JSON.stringify(options));
|
|
146
146
|
|
|
147
147
|
return await new Entities().create(options);
|
|
148
148
|
}
|
|
@@ -153,7 +153,7 @@ export abstract class BaseEntityProcessor {
|
|
|
153
153
|
id: entity['id'],
|
|
154
154
|
object: diffs
|
|
155
155
|
};
|
|
156
|
-
console.log('
|
|
156
|
+
console.log('updateEntity: ' + JSON.stringify(options));
|
|
157
157
|
|
|
158
158
|
return await new Entities().update(options);
|
|
159
159
|
}
|
|
@@ -437,6 +437,8 @@ export class DataConverter {
|
|
|
437
437
|
let userOrg = undefined;
|
|
438
438
|
let count =0;
|
|
439
439
|
let size = 0;
|
|
440
|
+
let emailInput = nd?.email.toLowerCase();
|
|
441
|
+
|
|
440
442
|
const entities = new Entities();
|
|
441
443
|
const getOptionsCriteria = {
|
|
442
444
|
entityName: 'user-org',
|
|
@@ -445,7 +447,7 @@ export class DataConverter {
|
|
|
445
447
|
|
|
446
448
|
do {
|
|
447
449
|
const userBatch: [any] = await entities.get(getOptionsCriteria);
|
|
448
|
-
userOrg = userBatch.find(uo => uo?.userEmail ===
|
|
450
|
+
userOrg = userBatch.find(uo => uo?.userEmail.toLowerCase() === emailInput);
|
|
449
451
|
|
|
450
452
|
}while( !userOrg && size == getOptionsCriteria.take && count < 15);
|
|
451
453
|
return userOrg?.user
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { MapFileUtil } from "@contrail/transform-data";
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
export class TypeDefaults {
|
|
5
2
|
static NO_ENTITY_TYPE = 'Not able to determine the entity type of the entity object';
|
|
3
|
+
static NO_OBJECT_CLASS = 'Please ensure that the flexPLMObjectClass property is provided.';
|
|
4
|
+
static NO_TYPE_PATH = 'Please ensure that the flexPLMTypePath property is provided.';
|
|
6
5
|
constructor() {
|
|
7
6
|
}
|
|
8
7
|
/**Takes in full entity and returs the default FlexPLM
|
|
@@ -175,10 +174,13 @@ export class TypeDefaults {
|
|
|
175
174
|
entityClass = 'color';
|
|
176
175
|
} else if(['LCSSeason', 'SeasonGroup'].includes(objectClass)) {
|
|
177
176
|
entityClass = 'assortment';
|
|
178
|
-
} else if(['LCSRevisableEntity', 'LCSLifecycleManaged'].includes(objectClass)) {
|
|
177
|
+
} else if(['LCSRevisableEntity', 'LCSLifecycleManaged', 'LCSLast', 'LCSMaterial'].includes(objectClass)) {
|
|
179
178
|
entityClass = 'custom-entity';
|
|
180
179
|
}
|
|
181
180
|
|
|
181
|
+
if(entityClass === '')
|
|
182
|
+
throw Error(TypeDefaults.NO_OBJECT_CLASS);
|
|
183
|
+
|
|
182
184
|
return entityClass;
|
|
183
185
|
}
|
|
184
186
|
|
|
@@ -203,6 +205,10 @@ export class TypeDefaults {
|
|
|
203
205
|
typePath = 'color';
|
|
204
206
|
break;
|
|
205
207
|
}
|
|
208
|
+
|
|
209
|
+
if(typePath === '')
|
|
210
|
+
throw Error(TypeDefaults.NO_TYPE_PATH);
|
|
211
|
+
|
|
206
212
|
return typePath;
|
|
207
213
|
}
|
|
208
214
|
|
|
@@ -232,6 +238,8 @@ export class TypeDefaults {
|
|
|
232
238
|
case 'LCSColor':
|
|
233
239
|
case 'LCSRevisableEntity':
|
|
234
240
|
case 'LCSLifecycleManaged':
|
|
241
|
+
case 'LCSLast':
|
|
242
|
+
case 'LCSMaterial':
|
|
235
243
|
identifierProps.push('name');
|
|
236
244
|
break;
|
|
237
245
|
}
|