@reltio/components 1.4.2230 → 1.4.2232

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 (126) hide show
  1. package/HierarchyNodeTitle/HierarchyNodeTitle.d.ts +2 -1
  2. package/HierarchyNodeTitle/HierarchyNodeTitle.js +2 -2
  3. package/InlineComplexAttribute/InlineComplexAttribute.js +2 -2
  4. package/InlineComplexAttribute/InlineComplexAttribute.test.js +7 -7
  5. package/ProfileCard/components/ProfileCardContent/styles.d.ts +1 -1
  6. package/ReadOnlyAttributesList/ReadOnlyAttributesList.d.ts +5 -2
  7. package/ReadOnlyAttributesList/ReadOnlyAttributesList.js +2 -2
  8. package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.d.ts +5 -2
  9. package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +3 -3
  10. package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.d.ts +5 -2
  11. package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.js +15 -11
  12. package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.d.ts +5 -2
  13. package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.js +13 -11
  14. package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +5 -2
  15. package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +24 -12
  16. package/SimpleAttribute/SimpleAttribute.js +3 -2
  17. package/SyncedValueHeight/ValueHeightConsumer.js +12 -0
  18. package/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.js +12 -6
  19. package/cjs/HierarchyNodeTitle/HierarchyNodeTitle.d.ts +2 -1
  20. package/cjs/HierarchyNodeTitle/HierarchyNodeTitle.js +2 -2
  21. package/cjs/InlineComplexAttribute/InlineComplexAttribute.js +2 -2
  22. package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +7 -7
  23. package/cjs/ProfileCard/components/ProfileCardContent/styles.d.ts +1 -1
  24. package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.d.ts +5 -2
  25. package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.js +2 -2
  26. package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.d.ts +5 -2
  27. package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +3 -3
  28. package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.d.ts +5 -2
  29. package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.js +15 -11
  30. package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.d.ts +5 -2
  31. package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.js +13 -11
  32. package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +5 -2
  33. package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +23 -11
  34. package/cjs/SimpleAttribute/SimpleAttribute.js +3 -2
  35. package/cjs/SyncedValueHeight/ValueHeightConsumer.js +39 -0
  36. package/cjs/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.js +11 -5
  37. package/cjs/contexts/AutoExpandedAttributesContext/index.d.ts +8 -0
  38. package/cjs/contexts/{ExpandedAttributesContext → AutoExpandedAttributesContext}/index.js +8 -8
  39. package/cjs/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.js → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.js} +3 -3
  40. package/cjs/contexts/SyncedExpandedAttributesContext/index.d.ts +12 -0
  41. package/cjs/contexts/SyncedExpandedAttributesContext/index.js +56 -0
  42. package/{features/crosswalks/contexts/SyncedValueHeightsContext.d.ts → cjs/contexts/SyncedValueHeightsContext/index.d.ts} +2 -2
  43. package/cjs/{features/crosswalks/contexts/SyncedValueHeightsContext.js → contexts/SyncedValueHeightsContext/index.js} +10 -15
  44. package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +5 -3
  45. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +1 -1
  46. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.js +93 -34
  47. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +290 -56
  48. package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.d.ts +11 -0
  49. package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.js +32 -0
  50. package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.module.css.js +9 -0
  51. package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/index.d.ts +1 -0
  52. package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/index.js +5 -0
  53. package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.d.ts +10 -0
  54. package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.js +60 -0
  55. package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.module.css.js +9 -0
  56. package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/index.d.ts +1 -0
  57. package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/index.js +5 -0
  58. package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +1 -1
  59. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
  60. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +5 -64
  61. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +2 -2
  62. package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.d.ts +10 -0
  63. package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.js +94 -0
  64. package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.module.css.js +9 -0
  65. package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/index.d.ts +1 -0
  66. package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/index.js +5 -0
  67. package/cjs/features/crosswalks/AttributesTable/helpers.d.ts +1 -2
  68. package/cjs/features/crosswalks/AttributesTable/helpers.js +82 -56
  69. package/cjs/features/crosswalks/AttributesTable/helpers.test.js +539 -360
  70. package/cjs/features/crosswalks/AttributesTable/types.d.ts +17 -10
  71. package/cjs/features/crosswalks/AttributesTable/types.js +6 -0
  72. package/cjs/index.d.ts +1 -1
  73. package/cjs/index.js +4 -4
  74. package/contexts/AutoExpandedAttributesContext/index.d.ts +8 -0
  75. package/contexts/AutoExpandedAttributesContext/index.js +11 -0
  76. package/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.js → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.js} +4 -4
  77. package/contexts/SyncedExpandedAttributesContext/index.d.ts +12 -0
  78. package/contexts/SyncedExpandedAttributesContext/index.js +28 -0
  79. package/{cjs/features/crosswalks/contexts/SyncedValueHeightsContext.d.ts → contexts/SyncedValueHeightsContext/index.d.ts} +2 -2
  80. package/{features/crosswalks/contexts/SyncedValueHeightsContext.js → contexts/SyncedValueHeightsContext/index.js} +9 -13
  81. package/features/crosswalks/AttributesTable/AttributesTable.js +5 -3
  82. package/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +1 -1
  83. package/features/crosswalks/AttributesTable/AttributesTable.test-data.js +91 -32
  84. package/features/crosswalks/AttributesTable/AttributesTable.test.js +291 -57
  85. package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.d.ts +11 -0
  86. package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.js +25 -0
  87. package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.module.css.js +9 -0
  88. package/features/crosswalks/AttributesTable/components/AttributeRule/index.d.ts +1 -0
  89. package/features/crosswalks/AttributesTable/components/AttributeRule/index.js +1 -0
  90. package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.d.ts +10 -0
  91. package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.js +30 -0
  92. package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.module.css.js +9 -0
  93. package/features/crosswalks/AttributesTable/components/ComplexRule/index.d.ts +1 -0
  94. package/features/crosswalks/AttributesTable/components/ComplexRule/index.js +1 -0
  95. package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +1 -1
  96. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
  97. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +6 -65
  98. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +2 -2
  99. package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.d.ts +10 -0
  100. package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.js +64 -0
  101. package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.module.css.js +9 -0
  102. package/features/crosswalks/AttributesTable/components/SimpleRule/index.d.ts +1 -0
  103. package/features/crosswalks/AttributesTable/components/SimpleRule/index.js +1 -0
  104. package/features/crosswalks/AttributesTable/helpers.d.ts +1 -2
  105. package/features/crosswalks/AttributesTable/helpers.js +82 -55
  106. package/features/crosswalks/AttributesTable/helpers.test.js +540 -361
  107. package/features/crosswalks/AttributesTable/types.d.ts +17 -10
  108. package/features/crosswalks/AttributesTable/types.js +5 -1
  109. package/index.d.ts +1 -1
  110. package/index.js +1 -1
  111. package/package.json +2 -2
  112. package/cjs/contexts/ExpandedAttributesContext/index.d.ts +0 -8
  113. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +0 -15
  114. package/contexts/ExpandedAttributesContext/index.d.ts +0 -8
  115. package/contexts/ExpandedAttributesContext/index.js +0 -11
  116. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +0 -8
  117. /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightConsumer.d.ts +0 -0
  118. /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.d.ts +0 -0
  119. /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.d.ts +0 -0
  120. /package/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.js +0 -0
  121. /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/ValueHeightConsumer.d.ts +0 -0
  122. /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/ValueHeightReporter.d.ts +0 -0
  123. /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/index.d.ts +0 -0
  124. /package/cjs/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.js +0 -0
  125. /package/cjs/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.d.ts → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.d.ts} +0 -0
  126. /package/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.d.ts → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.d.ts} +0 -0
@@ -11,6 +11,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
13
13
  var helpers_1 = require("./helpers");
14
+ var types_1 = require("./types");
14
15
  var HeadCellRenderer_1 = require("./components/HeadCellRenderer");
15
16
  var AttributesHeadCellRenderer_1 = require("./components/AttributesHeadCellRenderer");
16
17
  var OvValuesRenderer_1 = require("./components/OvValuesRenderer");
@@ -270,21 +271,9 @@ describe('helpers tests', function () {
270
271
  crosswalks: [crosswalks[0]]
271
272
  },
272
273
  ruleType: {
273
- ruleTypes: [
274
- {
275
- data: {
276
- strategy: {
277
- uri: 'configuration/survivorshipStrategies/LUD',
278
- label: 'Recency'
279
- },
280
- comparisonAttributeUri: undefined,
281
- primaryAttributeUri: undefined,
282
- sourcesUriOrder: undefined
283
- },
284
- type: 'rule',
285
- valueUri: 'entities/1/attributes/CountryCode/1'
286
- }
287
- ]
274
+ attributeType: attrTypes[0],
275
+ attributeValues: [],
276
+ getRuleTypeData: expect.any(Function)
288
277
  },
289
278
  count: 2,
290
279
  values: {
@@ -303,21 +292,9 @@ describe('helpers tests', function () {
303
292
  crosswalks: []
304
293
  },
305
294
  ruleType: {
306
- ruleTypes: [
307
- {
308
- data: {
309
- strategy: {
310
- uri: 'configuration/survivorshipStrategies/Frequency',
311
- label: 'Frequency'
312
- },
313
- comparisonAttributeUri: undefined,
314
- primaryAttributeUri: undefined,
315
- sourcesUriOrder: undefined
316
- },
317
- type: 'rule',
318
- valueUri: 'entities/1/attributes/Date/1'
319
- }
320
- ]
295
+ attributeType: attrTypes[1],
296
+ attributeValues: [],
297
+ getRuleTypeData: expect.any(Function)
321
298
  },
322
299
  count: 2,
323
300
  values: {
@@ -336,21 +313,9 @@ describe('helpers tests', function () {
336
313
  crosswalks: attributes['Address'][0]['refRelation']['crosswalks']
337
314
  },
338
315
  ruleType: {
339
- ruleTypes: [
340
- {
341
- data: {
342
- strategy: {
343
- uri: 'configuration/survivorshipStrategies/LUD',
344
- label: 'Recency'
345
- },
346
- comparisonAttributeUri: undefined,
347
- primaryAttributeUri: undefined,
348
- sourcesUriOrder: undefined
349
- },
350
- type: 'rule',
351
- valueUri: 'entities/1/attributes/Address/1'
352
- }
353
- ]
316
+ attributeType: attrTypes[2],
317
+ attributeValues: [],
318
+ getRuleTypeData: expect.any(Function)
354
319
  },
355
320
  count: 1,
356
321
  values: {
@@ -421,7 +386,7 @@ describe('helpers tests', function () {
421
386
  expect((0, helpers_1.countAttributeValues)(mdm_sdk_1.DataTypes.TYPE_NESTED, undefined, crosswalksMap)).toBe(0);
422
387
  });
423
388
  });
424
- describe('getRuleTypeValues', function () {
389
+ describe('get rule type values', function () {
425
390
  var metadata = {
426
391
  entityTypes: [
427
392
  {
@@ -527,6 +492,7 @@ describe('helpers tests', function () {
527
492
  }
528
493
  ]
529
494
  };
495
+ var crosswalksMap = { entity: {}, relation: {} };
530
496
  it('should return correct simple rule type', function () {
531
497
  var attributeType = {
532
498
  uri: 'configuration/entityTypes/HCP/attributes/Int',
@@ -534,30 +500,34 @@ describe('helpers tests', function () {
534
500
  name: 'Int',
535
501
  label: 'Int'
536
502
  };
537
- var attributeValues = [
538
- {
539
- uri: 'entities/1/attributes/Int/1',
540
- type: 'configuration/entityTypes/HCP/attributes/Int',
541
- value: '1005',
542
- ov: true
543
- }
544
- ];
545
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
546
- ruleTypes: [
503
+ var attributes = {
504
+ Int: [
547
505
  {
548
- data: {
549
- strategy: {
550
- uri: 'configuration/survivorshipStrategies/Aggregation',
551
- label: 'Aggregation'
552
- },
553
- comparisonAttributeUri: undefined,
554
- primaryAttributeUri: undefined,
555
- sourcesUriOrder: undefined
556
- },
557
- type: 'rule',
558
- valueUri: 'entities/1/attributes/Int/1'
506
+ uri: 'entities/1/attributes/Int/1',
507
+ type: 'configuration/entityTypes/HCP/attributes/Int',
508
+ value: '1005',
509
+ ov: true
559
510
  }
560
511
  ]
512
+ };
513
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
514
+ var result = rows[0].ruleType;
515
+ expect(result).toEqual({
516
+ attributeType: attributeType,
517
+ attributeValues: [],
518
+ getRuleTypeData: expect.any(Function)
519
+ });
520
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
521
+ type: types_1.RuleItemType.Rule,
522
+ data: {
523
+ strategy: {
524
+ uri: 'configuration/survivorshipStrategies/Aggregation',
525
+ label: 'Aggregation'
526
+ },
527
+ comparisonAttributeUri: undefined,
528
+ primaryAttributeUri: undefined,
529
+ sourcesUriOrder: undefined
530
+ }
561
531
  });
562
532
  });
563
533
  it('should return correct rule type based on active strategy', function () {
@@ -567,30 +537,34 @@ describe('helpers tests', function () {
567
537
  name: 'Int',
568
538
  label: 'Int'
569
539
  };
570
- var attributeValues = [
571
- {
572
- uri: 'entities/1/attributes/Int/1',
573
- type: 'configuration/entityTypes/HCP/attributes/Int',
574
- value: '1005',
575
- ov: true
576
- }
577
- ];
578
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues, 'configuration/entityTypes/HCP/survivorshipGroups/allRecency')).toEqual({
579
- ruleTypes: [
540
+ var attributes = {
541
+ Int: [
580
542
  {
581
- data: {
582
- strategy: {
583
- uri: 'configuration/survivorshipStrategies/LUD',
584
- label: 'Recency'
585
- },
586
- comparisonAttributeUri: undefined,
587
- primaryAttributeUri: undefined,
588
- sourcesUriOrder: undefined
589
- },
590
- type: 'rule',
591
- valueUri: 'entities/1/attributes/Int/1'
543
+ uri: 'entities/1/attributes/Int/1',
544
+ type: 'configuration/entityTypes/HCP/attributes/Int',
545
+ value: '1005',
546
+ ov: true
592
547
  }
593
548
  ]
549
+ };
550
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes, 'configuration/entityTypes/HCP/survivorshipGroups/allRecency');
551
+ var result = rows[0].ruleType;
552
+ expect(result).toEqual({
553
+ attributeType: attributeType,
554
+ attributeValues: [],
555
+ getRuleTypeData: expect.any(Function)
556
+ });
557
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
558
+ type: types_1.RuleItemType.Rule,
559
+ data: {
560
+ strategy: {
561
+ uri: 'configuration/survivorshipStrategies/LUD',
562
+ label: 'Recency'
563
+ },
564
+ comparisonAttributeUri: undefined,
565
+ primaryAttributeUri: undefined,
566
+ sourcesUriOrder: undefined
567
+ }
594
568
  });
595
569
  });
596
570
  it('should use default one if strategy url is incorrect', function () {
@@ -600,30 +574,34 @@ describe('helpers tests', function () {
600
574
  name: 'Int',
601
575
  label: 'Int'
602
576
  };
603
- var attributeValues = [
604
- {
605
- uri: 'entities/1/attributes/Int/1',
606
- type: 'configuration/entityTypes/HCP/attributes/Int',
607
- value: '1005',
608
- ov: true
609
- }
610
- ];
611
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues, 'configuration/entityTypes/HCP/survivorshipGroups/unexisting')).toEqual({
612
- ruleTypes: [
577
+ var attributes = {
578
+ Int: [
613
579
  {
614
- data: {
615
- strategy: {
616
- uri: 'configuration/survivorshipStrategies/Aggregation',
617
- label: 'Aggregation'
618
- },
619
- comparisonAttributeUri: undefined,
620
- primaryAttributeUri: undefined,
621
- sourcesUriOrder: undefined
622
- },
623
- type: 'rule',
624
- valueUri: 'entities/1/attributes/Int/1'
580
+ uri: 'entities/1/attributes/Int/1',
581
+ type: 'configuration/entityTypes/HCP/attributes/Int',
582
+ value: '1005',
583
+ ov: true
625
584
  }
626
585
  ]
586
+ };
587
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes, 'configuration/entityTypes/HCP/survivorshipGroups/unexisting');
588
+ var result = rows[0].ruleType;
589
+ expect(result).toEqual({
590
+ attributeType: attributeType,
591
+ attributeValues: [],
592
+ getRuleTypeData: expect.any(Function)
593
+ });
594
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
595
+ type: types_1.RuleItemType.Rule,
596
+ data: {
597
+ strategy: {
598
+ uri: 'configuration/survivorshipStrategies/Aggregation',
599
+ label: 'Aggregation'
600
+ },
601
+ comparisonAttributeUri: undefined,
602
+ primaryAttributeUri: undefined,
603
+ sourcesUriOrder: undefined
604
+ }
627
605
  });
628
606
  });
629
607
  it('should return correct rule type with sourcesUriOrder', function () {
@@ -633,30 +611,34 @@ describe('helpers tests', function () {
633
611
  name: 'Gender',
634
612
  label: 'Gender'
635
613
  };
636
- var attributeValues = [
637
- {
638
- uri: 'entities/1/attributes/Gender/1',
639
- type: 'configuration/entityTypes/HCP/attributes/Gender',
640
- value: 'F',
641
- ov: true
642
- }
643
- ];
644
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
645
- ruleTypes: [
614
+ var attributes = {
615
+ Gender: [
646
616
  {
647
- data: {
648
- strategy: {
649
- uri: 'configuration/survivorshipStrategies/SRC_SYS',
650
- label: 'Source system'
651
- },
652
- comparisonAttributeUri: undefined,
653
- primaryAttributeUri: undefined,
654
- sourcesUriOrder: ['configuration/sources/TEST', 'configuration/sources/Reltio']
655
- },
656
- type: 'rule',
657
- valueUri: 'entities/1/attributes/Gender/1'
617
+ uri: 'entities/1/attributes/Gender/1',
618
+ type: 'configuration/entityTypes/HCP/attributes/Gender',
619
+ value: 'F',
620
+ ov: true
658
621
  }
659
622
  ]
623
+ };
624
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
625
+ var result = rows[0].ruleType;
626
+ expect(result).toEqual({
627
+ attributeType: attributeType,
628
+ attributeValues: [],
629
+ getRuleTypeData: expect.any(Function)
630
+ });
631
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
632
+ type: types_1.RuleItemType.Rule,
633
+ data: {
634
+ strategy: {
635
+ uri: 'configuration/survivorshipStrategies/SRC_SYS',
636
+ label: 'Source system'
637
+ },
638
+ comparisonAttributeUri: undefined,
639
+ primaryAttributeUri: undefined,
640
+ sourcesUriOrder: ['configuration/sources/TEST', 'configuration/sources/Reltio']
641
+ }
660
642
  });
661
643
  });
662
644
  it('should return correct rule type with primaryAttributeUri', function () {
@@ -666,30 +648,34 @@ describe('helpers tests', function () {
666
648
  name: 'ScheduledDrug',
667
649
  label: 'ScheduledDrug'
668
650
  };
669
- var attributeValues = [
670
- {
671
- uri: 'entities/1/attributes/ScheduledDrug/1',
672
- type: 'configuration/entityTypes/HCP/attributes/ScheduledDrug',
673
- value: 'Aspirin',
674
- ov: true
675
- }
676
- ];
677
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
678
- ruleTypes: [
651
+ var attributes = {
652
+ ScheduledDrug: [
679
653
  {
680
- data: {
681
- strategy: {
682
- uri: 'configuration/survivorshipStrategies/OtherAttributeWinnerCrosswalk',
683
- label: 'Other Attribute Winner Crosswalk'
684
- },
685
- comparisonAttributeUri: undefined,
686
- primaryAttributeUri: 'configuration/entityTypes/HCP/attributes/CountryCode',
687
- sourcesUriOrder: undefined
688
- },
689
- type: 'rule',
690
- valueUri: 'entities/1/attributes/ScheduledDrug/1'
654
+ uri: 'entities/1/attributes/ScheduledDrug/1',
655
+ type: 'configuration/entityTypes/HCP/attributes/ScheduledDrug',
656
+ value: 'Aspirin',
657
+ ov: true
691
658
  }
692
659
  ]
660
+ };
661
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
662
+ var result = rows[0].ruleType;
663
+ expect(result).toEqual({
664
+ attributeType: attributeType,
665
+ attributeValues: [],
666
+ getRuleTypeData: expect.any(Function)
667
+ });
668
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
669
+ type: types_1.RuleItemType.Rule,
670
+ data: {
671
+ strategy: {
672
+ uri: 'configuration/survivorshipStrategies/OtherAttributeWinnerCrosswalk',
673
+ label: 'Other Attribute Winner Crosswalk'
674
+ },
675
+ comparisonAttributeUri: undefined,
676
+ primaryAttributeUri: 'configuration/entityTypes/HCP/attributes/CountryCode',
677
+ sourcesUriOrder: undefined
678
+ }
693
679
  });
694
680
  });
695
681
  it('should return correct rule type with comparisonAttributeUri', function () {
@@ -700,30 +686,34 @@ describe('helpers tests', function () {
700
686
  label: 'Address',
701
687
  referencedAttributeURIs: ['configuration/relationTypes/HasAddress/attributes/Status']
702
688
  };
703
- var attributeValues = [
704
- {
705
- uri: 'entities/1/attributes/Address/1',
706
- type: 'configuration/entityTypes/HCP/attributes/Address',
707
- value: {},
708
- ov: true
709
- }
710
- ];
711
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
712
- ruleTypes: [
689
+ var attributes = {
690
+ Address: [
713
691
  {
714
- data: {
715
- strategy: {
716
- uri: 'configuration/survivorshipStrategies/MinValue',
717
- label: 'Minimum value'
718
- },
719
- comparisonAttributeUri: 'configuration/relationTypes/HasAddress/attributes/Status',
720
- primaryAttributeUri: undefined,
721
- sourcesUriOrder: undefined
722
- },
723
- type: 'rule',
724
- valueUri: 'entities/1/attributes/Address/1'
692
+ uri: 'entities/1/attributes/Address/1',
693
+ type: 'configuration/entityTypes/HCP/attributes/Address',
694
+ value: {},
695
+ ov: true
725
696
  }
726
697
  ]
698
+ };
699
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
700
+ var result = rows[0].ruleType;
701
+ expect(result).toEqual({
702
+ attributeType: attributeType,
703
+ attributeValues: [],
704
+ getRuleTypeData: expect.any(Function)
705
+ });
706
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
707
+ type: types_1.RuleItemType.Rule,
708
+ data: {
709
+ strategy: {
710
+ uri: 'configuration/survivorshipStrategies/MinValue',
711
+ label: 'Minimum value'
712
+ },
713
+ comparisonAttributeUri: 'configuration/relationTypes/HasAddress/attributes/Status',
714
+ primaryAttributeUri: undefined,
715
+ sourcesUriOrder: undefined
716
+ }
727
717
  });
728
718
  });
729
719
  it('should return rule type with fallback labels if last applied survivorship rules differ from default one', function () {
@@ -733,36 +723,51 @@ describe('helpers tests', function () {
733
723
  name: 'Int',
734
724
  label: 'Int'
735
725
  };
736
- var attributeValues = [
737
- {
738
- uri: 'entities/123abc/attributes/Int/345fgh',
739
- type: 'configuration/entityTypes/HCP/attributes/Int',
740
- value: '1005',
741
- ov: true,
742
- ovDetails: {
743
- participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
744
- appliedSurvivorshipRules: {
745
- SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, { SRC_SYS: ['LUD'] }, 'Frequency']
726
+ var attributes = {
727
+ Int: [
728
+ {
729
+ uri: 'entities/123abc/attributes/Int/345fgh',
730
+ type: 'configuration/entityTypes/HCP/attributes/Int',
731
+ value: '1005',
732
+ ov: true,
733
+ ovDetails: {
734
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
735
+ appliedSurvivorshipRules: {
736
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, { SRC_SYS: ['LUD'] }, 'Frequency']
737
+ }
746
738
  }
747
739
  }
748
- }
749
- ];
750
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
751
- ruleTypes: [
740
+ ]
741
+ };
742
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
743
+ var result = rows[0].ruleType;
744
+ expect(result).toEqual({
745
+ attributeType: attributeType,
746
+ attributeValues: [
752
747
  {
753
- data: {
754
- strategy: {
755
- uri: 'configuration/survivorshipStrategies/Frequency',
756
- label: 'Frequency'
757
- },
758
- comparisonAttributeUri: undefined,
759
- primaryAttributeUri: undefined,
760
- sourcesUriOrder: undefined
761
- },
762
- type: 'rule',
763
- valueUri: 'entities/123abc/attributes/Int/345fgh'
748
+ uri: 'entities/123abc/attributes/Int/345fgh',
749
+ value: '1005',
750
+ ovDetails: {
751
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
752
+ appliedSurvivorshipRules: {
753
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, { SRC_SYS: ['LUD'] }, 'Frequency']
754
+ }
755
+ }
764
756
  }
765
- ]
757
+ ],
758
+ getRuleTypeData: expect.any(Function)
759
+ });
760
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
761
+ type: types_1.RuleItemType.Rule,
762
+ data: {
763
+ strategy: {
764
+ uri: 'configuration/survivorshipStrategies/Frequency',
765
+ label: 'Frequency'
766
+ },
767
+ comparisonAttributeUri: undefined,
768
+ primaryAttributeUri: undefined,
769
+ sourcesUriOrder: undefined
770
+ }
766
771
  });
767
772
  });
768
773
  it('should return rule types per OV value with duplicates and ignore non-OV values', function () {
@@ -772,98 +777,119 @@ describe('helpers tests', function () {
772
777
  name: 'Int',
773
778
  label: 'Int'
774
779
  };
775
- var attributeValues = [
776
- {
777
- uri: 'entities/123abc/attributes/Int/345fgh',
778
- type: 'configuration/entityTypes/HCP/attributes/Int',
779
- value: '1005',
780
- ov: true,
781
- ovDetails: {
782
- participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
783
- appliedSurvivorshipRules: {
784
- SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Frequency']
780
+ var attributes = {
781
+ Int: [
782
+ {
783
+ uri: 'entities/123abc/attributes/Int/345fgh',
784
+ type: 'configuration/entityTypes/HCP/attributes/Int',
785
+ value: '1005',
786
+ ov: true,
787
+ ovDetails: {
788
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
789
+ appliedSurvivorshipRules: {
790
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Frequency']
791
+ }
785
792
  }
786
- }
787
- },
788
- {
789
- uri: 'entities/123abc/attributes/Int/ghj565',
790
- type: 'configuration/entityTypes/HCP/attributes/Int',
791
- value: '1006',
792
- ov: true,
793
- ovDetails: {
794
- participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
795
- appliedSurvivorshipRules: {
796
- SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Frequency']
793
+ },
794
+ {
795
+ uri: 'entities/123abc/attributes/Int/ghj565',
796
+ type: 'configuration/entityTypes/HCP/attributes/Int',
797
+ value: '1006',
798
+ ov: true,
799
+ ovDetails: {
800
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
801
+ appliedSurvivorshipRules: {
802
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Frequency']
803
+ }
797
804
  }
798
- }
799
- },
800
- {
801
- uri: 'entities/123abc/attributes/Int/nonOvValue',
802
- type: 'configuration/entityTypes/HCP/attributes/Int',
803
- value: '1006-non-ov',
804
- ov: false,
805
- ovDetails: {
806
- participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
807
- appliedSurvivorshipRules: {
808
- SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Aggregation']
805
+ },
806
+ {
807
+ uri: 'entities/123abc/attributes/Int/nonOvValue',
808
+ type: 'configuration/entityTypes/HCP/attributes/Int',
809
+ value: '1006-non-ov',
810
+ ov: false,
811
+ ovDetails: {
812
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
813
+ appliedSurvivorshipRules: {
814
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Aggregation']
815
+ }
809
816
  }
810
- }
811
- },
812
- {
813
- uri: 'entities/123abc/attributes/Int/xfjhy6',
814
- type: 'configuration/entityTypes/HCP/attributes/Int',
815
- value: '1007',
816
- ov: true,
817
- ovDetails: {
818
- participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
819
- appliedSurvivorshipRules: {
820
- SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, { SRC_SYS: ['LUD'] }]
817
+ },
818
+ {
819
+ uri: 'entities/123abc/attributes/Int/xfjhy6',
820
+ type: 'configuration/entityTypes/HCP/attributes/Int',
821
+ value: '1007',
822
+ ov: true,
823
+ ovDetails: {
824
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
825
+ appliedSurvivorshipRules: {
826
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, { SRC_SYS: ['LUD'] }]
827
+ }
821
828
  }
822
829
  }
823
- }
824
- ];
825
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
826
- ruleTypes: [
830
+ ]
831
+ };
832
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
833
+ var result = rows[0].ruleType;
834
+ expect(result).toEqual({
835
+ attributeType: attributeType,
836
+ attributeValues: [
827
837
  {
828
- data: {
829
- strategy: {
830
- uri: 'configuration/survivorshipStrategies/Frequency',
831
- label: 'Frequency'
832
- },
833
- comparisonAttributeUri: undefined,
834
- primaryAttributeUri: undefined,
835
- sourcesUriOrder: undefined
836
- },
837
- type: 'rule',
838
- valueUri: 'entities/123abc/attributes/Int/345fgh'
838
+ uri: 'entities/123abc/attributes/Int/345fgh',
839
+ value: '1005',
840
+ ovDetails: {
841
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
842
+ appliedSurvivorshipRules: {
843
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Frequency']
844
+ }
845
+ }
839
846
  },
840
847
  {
841
- data: {
842
- strategy: {
843
- uri: 'configuration/survivorshipStrategies/Frequency',
844
- label: 'Frequency'
845
- },
846
- comparisonAttributeUri: undefined,
847
- primaryAttributeUri: undefined,
848
- sourcesUriOrder: undefined
849
- },
850
- type: 'rule',
851
- valueUri: 'entities/123abc/attributes/Int/ghj565'
848
+ uri: 'entities/123abc/attributes/Int/ghj565',
849
+ value: '1006',
850
+ ovDetails: {
851
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
852
+ appliedSurvivorshipRules: {
853
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Frequency']
854
+ }
855
+ }
852
856
  },
853
857
  {
854
- data: {
855
- strategy: {
856
- uri: 'configuration/survivorshipStrategies/LUD',
857
- label: 'Recency'
858
- },
859
- comparisonAttributeUri: undefined,
860
- primaryAttributeUri: undefined,
861
- sourcesUriOrder: undefined
862
- },
863
- type: 'rule',
864
- valueUri: 'entities/123abc/attributes/Int/xfjhy6'
858
+ uri: 'entities/123abc/attributes/Int/xfjhy6',
859
+ value: '1007',
860
+ ovDetails: {
861
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
862
+ appliedSurvivorshipRules: {
863
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, { SRC_SYS: ['LUD'] }]
864
+ }
865
+ }
865
866
  }
866
- ]
867
+ ],
868
+ getRuleTypeData: expect.any(Function)
869
+ });
870
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
871
+ type: types_1.RuleItemType.Rule,
872
+ data: {
873
+ strategy: {
874
+ uri: 'configuration/survivorshipStrategies/Frequency',
875
+ label: 'Frequency'
876
+ },
877
+ comparisonAttributeUri: undefined,
878
+ primaryAttributeUri: undefined,
879
+ sourcesUriOrder: undefined
880
+ }
881
+ });
882
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[2])).toEqual({
883
+ type: types_1.RuleItemType.Rule,
884
+ data: {
885
+ strategy: {
886
+ uri: 'configuration/survivorshipStrategies/LUD',
887
+ label: 'Recency'
888
+ },
889
+ comparisonAttributeUri: undefined,
890
+ primaryAttributeUri: undefined,
891
+ sourcesUriOrder: undefined
892
+ }
867
893
  });
868
894
  });
869
895
  it('should return default rule type if applied survivorship rules are invalid', function () {
@@ -873,34 +899,47 @@ describe('helpers tests', function () {
873
899
  name: 'Int',
874
900
  label: 'Int'
875
901
  };
876
- var attributeValues = [
877
- {
878
- uri: 'entities/123abc/attributes/Int/345fgh',
879
- type: 'configuration/entityTypes/HCP/attributes/Int',
880
- value: '1005',
881
- ov: true,
882
- ovDetails: {
883
- participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
884
- appliedSurvivorshipRules: 'N/A'
885
- }
886
- }
887
- ];
888
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
889
- ruleTypes: [
902
+ var attributes = {
903
+ Int: [
890
904
  {
891
- data: {
892
- strategy: {
893
- uri: 'configuration/survivorshipStrategies/Aggregation',
894
- label: 'Aggregation'
895
- },
896
- comparisonAttributeUri: undefined,
897
- primaryAttributeUri: undefined,
898
- sourcesUriOrder: undefined
899
- },
900
- type: 'rule',
901
- valueUri: 'entities/123abc/attributes/Int/345fgh'
905
+ uri: 'entities/123abc/attributes/Int/345fgh',
906
+ type: 'configuration/entityTypes/HCP/attributes/Int',
907
+ value: '1005',
908
+ ov: true,
909
+ ovDetails: {
910
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
911
+ appliedSurvivorshipRules: 'N/A'
912
+ }
902
913
  }
903
914
  ]
915
+ };
916
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
917
+ var result = rows[0].ruleType;
918
+ expect(result).toEqual({
919
+ attributeType: attributeType,
920
+ attributeValues: [
921
+ {
922
+ uri: 'entities/123abc/attributes/Int/345fgh',
923
+ value: '1005',
924
+ ovDetails: {
925
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
926
+ appliedSurvivorshipRules: 'N/A'
927
+ }
928
+ }
929
+ ],
930
+ getRuleTypeData: expect.any(Function)
931
+ });
932
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
933
+ type: types_1.RuleItemType.Rule,
934
+ data: {
935
+ strategy: {
936
+ uri: 'configuration/survivorshipStrategies/Aggregation',
937
+ label: 'Aggregation'
938
+ },
939
+ comparisonAttributeUri: undefined,
940
+ primaryAttributeUri: undefined,
941
+ sourcesUriOrder: undefined
942
+ }
904
943
  });
905
944
  });
906
945
  it('should return rule type with sourcesUriOrder from applied survivorship rules', function () {
@@ -910,37 +949,50 @@ describe('helpers tests', function () {
910
949
  name: 'Int',
911
950
  label: 'Int'
912
951
  };
913
- var attributeValues = [
914
- {
915
- uri: 'entities/123abc/attributes/Int/345fgh',
916
- type: 'configuration/entityTypes/HCP/attributes/Int',
917
- value: '1005',
918
- ov: true,
919
- ovDetails: {
920
- participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
921
- appliedSurvivorshipRules: 'SRC_SYS'
922
- }
923
- }
924
- ];
925
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
926
- ruleTypes: [
952
+ var attributes = {
953
+ Int: [
927
954
  {
928
- data: {
929
- strategy: {
930
- uri: 'configuration/survivorshipStrategies/SRC_SYS',
931
- label: 'Source system'
932
- },
933
- comparisonAttributeUri: undefined,
934
- primaryAttributeUri: undefined,
935
- sourcesUriOrder: ['configuration/sources/TEST', 'configuration/sources/Reltio']
936
- },
937
- type: 'rule',
938
- valueUri: 'entities/123abc/attributes/Int/345fgh'
955
+ uri: 'entities/123abc/attributes/Int/345fgh',
956
+ type: 'configuration/entityTypes/HCP/attributes/Int',
957
+ value: '1005',
958
+ ov: true,
959
+ ovDetails: {
960
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
961
+ appliedSurvivorshipRules: 'SRC_SYS'
962
+ }
939
963
  }
940
964
  ]
965
+ };
966
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
967
+ var result = rows[0].ruleType;
968
+ expect(result).toEqual({
969
+ attributeType: attributeType,
970
+ attributeValues: [
971
+ {
972
+ uri: 'entities/123abc/attributes/Int/345fgh',
973
+ value: '1005',
974
+ ovDetails: {
975
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
976
+ appliedSurvivorshipRules: 'SRC_SYS'
977
+ }
978
+ }
979
+ ],
980
+ getRuleTypeData: expect.any(Function)
981
+ });
982
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
983
+ type: types_1.RuleItemType.Rule,
984
+ data: {
985
+ strategy: {
986
+ uri: 'configuration/survivorshipStrategies/SRC_SYS',
987
+ label: 'Source system'
988
+ },
989
+ comparisonAttributeUri: undefined,
990
+ primaryAttributeUri: undefined,
991
+ sourcesUriOrder: ['configuration/sources/TEST', 'configuration/sources/Reltio']
992
+ }
941
993
  });
942
994
  });
943
- it('should return default rule type for complex attribute even if there are different applied survivorship rules', function () {
995
+ it('should return applied survivorship rule type for reference attribute', function () {
944
996
  var attributeType = {
945
997
  uri: 'configuration/entityTypes/HCP/attributes/Address',
946
998
  type: 'Reference',
@@ -948,42 +1000,169 @@ describe('helpers tests', function () {
948
1000
  label: 'Address',
949
1001
  referencedAttributeURIs: ['configuration/relationTypes/HasAddress/attributes/Status']
950
1002
  };
951
- var attributeValues = [
952
- {
953
- uri: 'entities/123abc/attributes/Address/345fgh',
954
- type: 'configuration/entityTypes/HCP/attributes/Address',
955
- value: {
956
- Status: [
957
- {
958
- uri: 'entities/123abc/attributes/Status/345fgh',
959
- type: 'configuration/relationTypes/HasAddress/attributes/Status',
960
- value: '1005'
961
- }
962
- ]
963
- },
964
- ov: true,
965
- ovDetails: {
966
- participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
967
- appliedSurvivorshipRules: 'Aggregation'
1003
+ var attributes = {
1004
+ Address: [
1005
+ {
1006
+ uri: 'entities/123abc/attributes/Address/345fgh',
1007
+ type: 'configuration/entityTypes/HCP/attributes/Address',
1008
+ value: {
1009
+ Status: [
1010
+ {
1011
+ uri: 'entities/123abc/attributes/Status/345fgh',
1012
+ type: 'configuration/relationTypes/HasAddress/attributes/Status',
1013
+ value: '1005'
1014
+ }
1015
+ ]
1016
+ },
1017
+ ov: true,
1018
+ ovDetails: {
1019
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
1020
+ appliedSurvivorshipRules: 'Aggregation'
1021
+ }
1022
+ }
1023
+ ]
1024
+ };
1025
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
1026
+ var result = rows[0].ruleType;
1027
+ expect(result).toEqual({
1028
+ attributeType: attributeType,
1029
+ attributeValues: [
1030
+ {
1031
+ uri: 'entities/123abc/attributes/Address/345fgh',
1032
+ value: {
1033
+ Status: [
1034
+ {
1035
+ uri: 'entities/123abc/attributes/Status/345fgh',
1036
+ type: 'configuration/relationTypes/HasAddress/attributes/Status',
1037
+ value: '1005'
1038
+ }
1039
+ ]
1040
+ },
1041
+ ovDetails: {
1042
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
1043
+ appliedSurvivorshipRules: 'Aggregation'
1044
+ }
1045
+ }
1046
+ ],
1047
+ getRuleTypeData: expect.any(Function)
1048
+ });
1049
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
1050
+ type: types_1.RuleItemType.Rule,
1051
+ data: {
1052
+ strategy: {
1053
+ uri: 'configuration/survivorshipStrategies/Aggregation',
1054
+ label: 'Aggregation'
968
1055
  }
969
1056
  }
970
- ];
971
- expect((0, helpers_1.getRuleTypeValues)(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
972
- ruleTypes: [
1057
+ });
1058
+ });
1059
+ it('should return empty attributeValues when input attributeValues is undefined', function () {
1060
+ var attributeType = {
1061
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
1062
+ type: 'Int',
1063
+ name: 'Int',
1064
+ label: 'Int'
1065
+ };
1066
+ var attributes = {};
1067
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
1068
+ var result = rows[0].ruleType;
1069
+ expect(result).toEqual({
1070
+ attributeType: attributeType,
1071
+ attributeValues: [],
1072
+ getRuleTypeData: expect.any(Function)
1073
+ });
1074
+ });
1075
+ it('should return correct rule types for nested attribute', function () {
1076
+ var attributeType = {
1077
+ uri: 'configuration/entityTypes/HCP/attributes/NestedTest',
1078
+ type: 'Nested',
1079
+ name: 'NestedTest',
1080
+ attributes: [
1081
+ {
1082
+ uri: 'configuration/entityTypes/HCP/attributes/NestedTest/attributes/TextField',
1083
+ type: 'String',
1084
+ name: 'TextField'
1085
+ }
1086
+ ]
1087
+ };
1088
+ var nestedAttrType = {
1089
+ uri: 'configuration/entityTypes/HCP/attributes/NestedTest/attributes/TextField',
1090
+ type: 'String',
1091
+ name: 'TextField'
1092
+ };
1093
+ var attributes = {
1094
+ NestedTest: [
973
1095
  {
974
- data: {
975
- strategy: {
976
- uri: 'configuration/survivorshipStrategies/MinValue',
977
- label: 'Minimum value'
978
- },
979
- comparisonAttributeUri: 'configuration/relationTypes/HasAddress/attributes/Status',
980
- primaryAttributeUri: undefined,
981
- sourcesUriOrder: undefined
1096
+ label: 'Nested value 1',
1097
+ uri: 'entities/123abc/attributes/NestedTest/345fgh',
1098
+ value: {
1099
+ TextField: [
1100
+ {
1101
+ type: 'configuration/entityTypes/HCP/attributes/NestedTest/attributes/TextField',
1102
+ uri: 'entities/123abc/attributes/NestedTest/345fgh/TextField/1',
1103
+ value: 'TextField value 1',
1104
+ ov: true,
1105
+ ovDetails: {
1106
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
1107
+ appliedSurvivorshipRules: 'Frequency'
1108
+ }
1109
+ },
1110
+ {
1111
+ type: 'configuration/entityTypes/HCP/attributes/NestedTest/attributes/TextField',
1112
+ uri: 'entities/123abc/attributes/NestedTest/345fgh/TextField/2',
1113
+ value: 'TextField value 2',
1114
+ ov: true,
1115
+ ovDetails: {
1116
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
1117
+ appliedSurvivorshipRules: 'LUD'
1118
+ }
1119
+ }
1120
+ ]
982
1121
  },
983
- type: 'rule',
984
- valueUri: 'entities/123abc/attributes/Address/345fgh'
1122
+ ov: true,
1123
+ ovDetails: {
1124
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
1125
+ appliedSurvivorshipRules: 'Aggregation'
1126
+ }
985
1127
  }
986
1128
  ]
1129
+ };
1130
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
1131
+ var result = rows[0].ruleType;
1132
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
1133
+ type: types_1.RuleItemType.Rule,
1134
+ data: {
1135
+ strategy: {
1136
+ uri: 'configuration/survivorshipStrategies/Aggregation',
1137
+ label: 'Aggregation'
1138
+ }
1139
+ }
1140
+ });
1141
+ var textFieldValue1 = result.attributeValues[0].value['TextField'][0];
1142
+ expect(result.getRuleTypeData(nestedAttrType, textFieldValue1)).toEqual({
1143
+ type: types_1.RuleItemType.Rule,
1144
+ data: {
1145
+ strategy: {
1146
+ uri: 'configuration/survivorshipStrategies/Frequency',
1147
+ label: 'Frequency'
1148
+ },
1149
+ comparisonAttributeUri: undefined,
1150
+ primaryAttributeUri: undefined,
1151
+ sourcesUriOrder: undefined
1152
+ }
1153
+ });
1154
+ var textFieldValue2 = result.attributeValues[0].value['TextField'][1];
1155
+ expect(result.getRuleTypeData(nestedAttrType, textFieldValue2)).toEqual({
1156
+ type: types_1.RuleItemType.Rule,
1157
+ data: {
1158
+ strategy: {
1159
+ uri: 'configuration/survivorshipStrategies/LUD',
1160
+ label: 'Recency'
1161
+ },
1162
+ comparisonAttributeUri: undefined,
1163
+ primaryAttributeUri: undefined,
1164
+ sourcesUriOrder: undefined
1165
+ }
987
1166
  });
988
1167
  });
989
1168
  });