@contrail/flexplm 1.1.67-alpha.1 → 1.1.67-alpha.2

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.
@@ -3,6 +3,7 @@ export declare enum EventShortMessageStatus {
3
3
  FAILURE = "Failure",
4
4
  CREATED = "Created",
5
5
  ITEM_FAMILY_ID_MISSING = "Item_family_id_missing",
6
+ ITEM_FAMILY_NOT_FOUND = "Item_family_not_found",
6
7
  PROJECT_ITEM_NOT_FOUND = "Project_item_not_found",
7
8
  MISSING_IDENTIFIER_PROPERTIES = "Missing_identifier_properties",
8
9
  MISSING_INPUT = "Missing_input",
@@ -7,6 +7,7 @@ var EventShortMessageStatus;
7
7
  EventShortMessageStatus["FAILURE"] = "Failure";
8
8
  EventShortMessageStatus["CREATED"] = "Created";
9
9
  EventShortMessageStatus["ITEM_FAMILY_ID_MISSING"] = "Item_family_id_missing";
10
+ EventShortMessageStatus["ITEM_FAMILY_NOT_FOUND"] = "Item_family_not_found";
10
11
  EventShortMessageStatus["PROJECT_ITEM_NOT_FOUND"] = "Project_item_not_found";
11
12
  EventShortMessageStatus["MISSING_IDENTIFIER_PROPERTIES"] = "Missing_identifier_properties";
12
13
  EventShortMessageStatus["MISSING_INPUT"] = "Missing_input";
@@ -154,7 +154,12 @@ exports.mapping = {
154
154
  }
155
155
  },
156
156
  prefix: {
157
- isInboundCreatable: () => true,
157
+ isInboundCreatable: (object, context) => {
158
+ if (context && context.skipPrefix) {
159
+ return false;
160
+ }
161
+ return true;
162
+ },
158
163
  vibe2flex: {
159
164
  transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
160
165
  rekey: {
@@ -15,6 +15,6 @@ export declare class TypeConversionUtils {
15
15
  static getIdentifierPropertiesFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any): Promise<string[]>;
16
16
  static getInformationalPropertiesFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any): Promise<string[]>;
17
17
  static getMapKeyFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any, direction: string): Promise<string>;
18
- static isInboundCreatableFromObject(fileId: string, mapFileUtil: MapFileUtil, object: any): Promise<boolean>;
18
+ static isInboundCreatableFromObject(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean>;
19
19
  static getObjectType(object: any): any;
20
20
  }
@@ -180,13 +180,13 @@ class TypeConversionUtils {
180
180
  return type;
181
181
  }
182
182
  }
183
- static async isInboundCreatableFromObject(fileId, mapFileUtil, object) {
183
+ static async isInboundCreatableFromObject(fileId, mapFileUtil, object, context) {
184
184
  let isInboundCreatable = false;
185
185
  if (fileId) {
186
186
  const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
187
187
  const mapData = await map_utils_1.MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
188
188
  if (mapData && mapData['isInboundCreatable']) {
189
- isInboundCreatable = await mapData['isInboundCreatable'](object);
189
+ isInboundCreatable = await mapData['isInboundCreatable'](object, context);
190
190
  }
191
191
  }
192
192
  return isInboundCreatable;
@@ -580,5 +580,40 @@ describe('conversion-utils', () => {
580
580
  spy.mockRestore();
581
581
  }
582
582
  });
583
+ it('should pass context to isInboundCreatable function', async () => {
584
+ const spy = jest.spyOn(mapFileUtil, 'getMapFile')
585
+ .mockImplementation(async () => {
586
+ return mapping;
587
+ });
588
+ const object = {
589
+ flexPLMObjectClass: 'LCSRevisableEntity',
590
+ flexPLMTypePath: 'Revisable Entity\\prefix'
591
+ };
592
+ const context = { skipPrefix: true };
593
+ try {
594
+ const results = await type_conversion_utils_1.TypeConversionUtils.isInboundCreatableFromObject(TRANSFORM_MAP_FILE, mapFileUtil, object, context);
595
+ expect(results).toBeFalsy();
596
+ }
597
+ finally {
598
+ spy.mockRestore();
599
+ }
600
+ });
601
+ it('should work without context parameter', async () => {
602
+ const spy = jest.spyOn(mapFileUtil, 'getMapFile')
603
+ .mockImplementation(async () => {
604
+ return mapping;
605
+ });
606
+ const object = {
607
+ flexPLMObjectClass: 'LCSRevisableEntity',
608
+ flexPLMTypePath: 'Revisable Entity\\prefix'
609
+ };
610
+ try {
611
+ const results = await type_conversion_utils_1.TypeConversionUtils.isInboundCreatableFromObject(TRANSFORM_MAP_FILE, mapFileUtil, object);
612
+ expect(results).toBeTruthy();
613
+ }
614
+ finally {
615
+ spy.mockRestore();
616
+ }
617
+ });
583
618
  });
584
619
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/flexplm",
3
- "version": "1.1.67-alpha.1",
3
+ "version": "1.1.67-alpha.2",
4
4
  "description": "Library used for integration with flexplm.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",