@contrail/flexplm 1.1.12 → 1.1.14

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 (67) hide show
  1. package/.github/pull_request_template.md +30 -0
  2. package/.github/workflows/flexplm-lib.yml +27 -0
  3. package/lib/flexplm-utils.spec.d.ts +1 -0
  4. package/lib/flexplm-utils.spec.js +26 -0
  5. package/lib/publish/base-process-publish-assortment.js +2 -4
  6. package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -0
  7. package/lib/publish/base-process-publish-assortment.spec.js +1053 -0
  8. package/lib/util/config-defaults.spec.d.ts +1 -0
  9. package/lib/util/config-defaults.spec.js +264 -0
  10. package/lib/util/data-converter.spec.d.ts +1 -0
  11. package/lib/util/data-converter.spec.js +591 -0
  12. package/lib/util/map-utils.d.ts +2 -2
  13. package/lib/util/map-utils.js +5 -28
  14. package/lib/util/map-utils.spec.d.ts +1 -0
  15. package/lib/util/map-utils.spec.js +89 -0
  16. package/lib/util/thumbnail-util.spec.d.ts +1 -0
  17. package/lib/util/thumbnail-util.spec.js +132 -0
  18. package/lib/util/type-conversion-utils-spec-mockData.js +21 -0
  19. package/lib/util/type-conversion-utils.d.ts +7 -0
  20. package/lib/util/type-conversion-utils.js +88 -4
  21. package/lib/util/type-conversion-utils.spec.d.ts +1 -0
  22. package/lib/util/type-conversion-utils.spec.js +547 -0
  23. package/lib/util/type-defaults.d.ts +5 -0
  24. package/lib/util/type-defaults.js +66 -0
  25. package/lib/util/type-defaults.spec.d.ts +1 -0
  26. package/lib/util/type-defaults.spec.js +460 -0
  27. package/lib/util/type-utils.spec.d.ts +1 -0
  28. package/lib/util/type-utils.spec.js +190 -0
  29. package/package.json +2 -2
  30. package/publish.bat +5 -0
  31. package/publish.sh +5 -0
  32. package/src/entity-processor/base-entity-processor.ts +183 -0
  33. package/src/flexplm-request.ts +28 -0
  34. package/src/flexplm-utils.spec.ts +27 -0
  35. package/src/flexplm-utils.ts +29 -0
  36. package/src/index.ts +20 -0
  37. package/src/interfaces/interfaces.ts +120 -0
  38. package/src/interfaces/item-family-changes.ts +67 -0
  39. package/src/interfaces/publish-change-data.ts +43 -0
  40. package/src/publish/base-process-publish-assortment-callback.ts +23 -0
  41. package/src/publish/base-process-publish-assortment.spec.ts +1239 -0
  42. package/src/publish/base-process-publish-assortment.ts +1024 -0
  43. package/src/publish/mockData.ts +4561 -0
  44. package/src/transform/identifier-conversion.ts +226 -0
  45. package/src/util/config-defaults.spec.ts +315 -0
  46. package/src/util/config-defaults.ts +79 -0
  47. package/src/util/data-converter-spec-mockData.ts +231 -0
  48. package/src/util/data-converter.spec.ts +872 -0
  49. package/src/util/data-converter.ts +389 -0
  50. package/src/util/federation.ts +172 -0
  51. package/src/util/flexplm-connect.ts +169 -0
  52. package/src/util/logger-config.ts +20 -0
  53. package/src/util/map-util-spec-mockData.ts +231 -0
  54. package/src/util/map-utils.spec.ts +103 -0
  55. package/src/util/map-utils.ts +40 -0
  56. package/src/util/mockData.ts +98 -0
  57. package/src/util/thumbnail-util.spec.ts +152 -0
  58. package/src/util/thumbnail-util.ts +128 -0
  59. package/src/util/type-conversion-utils-spec-mockData.ts +238 -0
  60. package/src/util/type-conversion-utils.spec.ts +601 -0
  61. package/src/util/type-conversion-utils.ts +345 -0
  62. package/src/util/type-defaults.spec.ts +592 -0
  63. package/src/util/type-defaults.ts +261 -0
  64. package/src/util/type-utils.spec.ts +227 -0
  65. package/src/util/type-utils.ts +124 -0
  66. package/tsconfig.json +27 -0
  67. package/tslint.json +57 -0
@@ -0,0 +1,30 @@
1
+ ## What
2
+ - [ ] Bugfix
3
+ - [ ] Feature
4
+ - [ ] Enhancement
5
+
6
+ Description:
7
+ <!--
8
+ Describe the functional changes of the PR.
9
+
10
+ If the mechanism of your change are complex, describe them in detail as you
11
+ would if you were explaining them to a team mate.
12
+
13
+ If the PR is simple, there is no need to repeat yourself. A small description
14
+ is sufficient.
15
+ -->
16
+
17
+ ## Why
18
+ <!--
19
+ why is this change needed? Same rules as with #What
20
+ -->
21
+
22
+
23
+ ## Testing added
24
+ <!--
25
+ Describe the testing you added to this PR
26
+ -->
27
+
28
+
29
+ ## Link to Jira ticket(s)
30
+
@@ -0,0 +1,27 @@
1
+ name: flexplm-lib-tests
2
+ on:
3
+ pull_request:
4
+ workflow_dispatch: # allow running in github actions manually
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-20.04
8
+ strategy:
9
+ matrix:
10
+ node-version: [16.17.0]
11
+ steps:
12
+ - name: Node.js
13
+ uses: actions/setup-node@v3
14
+ with:
15
+ node-version: ${{ matrix.node-version }}
16
+
17
+ - uses: actions/checkout@v3
18
+
19
+ - name: NPM Install
20
+ env:
21
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
22
+ run: npm ci
23
+
24
+ - name: Unit Tests -
25
+ env:
26
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
27
+ run: npm test
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const flexplm_utils_1 = require("./flexplm-utils");
4
+ describe('Types Controller', () => {
5
+ beforeEach(async () => {
6
+ });
7
+ it('should convert a type path', () => {
8
+ expect(flexplm_utils_1.FlexPLMUtils.convertTypePath('Product')).toEqual('product');
9
+ expect(flexplm_utils_1.FlexPLMUtils.convertTypePath('Product\\Apparel')).toEqual('product:apparel');
10
+ expect(flexplm_utils_1.FlexPLMUtils.convertTypePath('Product\\Skin Care')).toEqual('product:skin_care');
11
+ expect(flexplm_utils_1.FlexPLMUtils.convertTypePath('Product\\Apparel\\Shirt')).toEqual('product:apparel:shirt');
12
+ expect(flexplm_utils_1.FlexPLMUtils.convertTypePath('Product\\Apparel\\[Shirt]')).toEqual('product:apparel:*shirt*');
13
+ expect(flexplm_utils_1.FlexPLMUtils.convertTypePath('')).toBeNull();
14
+ });
15
+ it('should compute level in tree', () => {
16
+ expect(flexplm_utils_1.FlexPLMUtils.computeLevelFromPath('product')).toEqual(1);
17
+ expect(flexplm_utils_1.FlexPLMUtils.computeLevelFromPath('product:apparel')).toEqual(2);
18
+ expect(flexplm_utils_1.FlexPLMUtils.computeLevelFromPath('product:apparel:dress:mini')).toEqual(4);
19
+ });
20
+ it('should get a parent type path', () => {
21
+ expect(flexplm_utils_1.FlexPLMUtils.getParentTypePath('product')).toBeNull();
22
+ expect(flexplm_utils_1.FlexPLMUtils.getParentTypePath('product:apparel')).toEqual('product');
23
+ expect(flexplm_utils_1.FlexPLMUtils.getParentTypePath('product:apparel:stuff')).toEqual('product:apparel');
24
+ expect(flexplm_utils_1.FlexPLMUtils.getParentTypePath('Product\\Apparel')).toEqual('product');
25
+ });
26
+ });
@@ -739,10 +739,8 @@ class BaseProcessPublishAssortment {
739
739
  }
740
740
  if (id === itemFamilyChanges.itemFamilyId && Object.keys(projectItem).length == 0) {
741
741
  for (const asstItem of itemFamilyChanges.assortmentItemFullChangeMap.values()) {
742
- const item = asstItem?.item;
743
- if (item?.roles?.includes('color') && asstItem?.projectItem) {
744
- projectItem = Object.assign({}, asstItem?.projectItem);
745
- projectItem.roles = ['family'];
742
+ if (asstItem?.familyProjectItem) {
743
+ projectItem = asstItem?.familyProjectItem;
746
744
  break;
747
745
  }
748
746
  }