@reltio/components 1.4.2226 → 1.4.2228

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 (83) hide show
  1. package/AttributeVerificationStatus/AttributeVerificationStatus.module.css.js +2 -2
  2. package/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.d.ts +9 -1
  3. package/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.js +3 -3
  4. package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.module.css.js +1 -1
  5. package/SimpleAttribute/SimpleAttribute.d.ts +5 -2
  6. package/SimpleAttribute/SimpleAttribute.js +15 -7
  7. package/SimpleAttribute/SimpleAttribute.module.css.js +9 -0
  8. package/VerificationButton/VerificationButton.js +9 -17
  9. package/VerificationButton/VerificationButton.module.css.js +2 -2
  10. package/cjs/AttributeVerificationStatus/AttributeVerificationStatus.module.css.js +2 -2
  11. package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.d.ts +9 -1
  12. package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.js +3 -3
  13. package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.module.css.js +1 -1
  14. package/cjs/SimpleAttribute/SimpleAttribute.d.ts +5 -2
  15. package/cjs/SimpleAttribute/SimpleAttribute.js +19 -11
  16. package/cjs/SimpleAttribute/SimpleAttribute.module.css.js +9 -0
  17. package/cjs/VerificationButton/VerificationButton.js +9 -17
  18. package/cjs/VerificationButton/VerificationButton.module.css.js +2 -2
  19. package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +3 -1
  20. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +4 -1
  21. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.js +51 -21
  22. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +56 -0
  23. package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.d.ts +7 -0
  24. package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.js +31 -0
  25. package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.module.css.js +9 -0
  26. package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/index.d.ts +1 -0
  27. package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/index.js +5 -0
  28. package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +3 -1
  29. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.js +1 -1
  30. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
  31. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +65 -11
  32. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +9 -0
  33. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.d.ts +7 -0
  34. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +15 -0
  35. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.d.ts +7 -0
  36. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.js +53 -0
  37. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.d.ts +2 -0
  38. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.js +7 -0
  39. package/cjs/features/crosswalks/AttributesTable/helpers.d.ts +4 -2
  40. package/cjs/features/crosswalks/AttributesTable/helpers.js +96 -17
  41. package/cjs/features/crosswalks/AttributesTable/helpers.test.js +499 -50
  42. package/cjs/features/crosswalks/AttributesTable/types.d.ts +17 -3
  43. package/cjs/features/crosswalks/contexts/SyncedValueHeightsContext.d.ts +11 -0
  44. package/cjs/features/crosswalks/contexts/SyncedValueHeightsContext.js +66 -0
  45. package/features/crosswalks/AttributesTable/AttributesTable.js +3 -1
  46. package/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +4 -1
  47. package/features/crosswalks/AttributesTable/AttributesTable.test-data.js +49 -20
  48. package/features/crosswalks/AttributesTable/AttributesTable.test.js +58 -2
  49. package/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.d.ts +7 -0
  50. package/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.js +24 -0
  51. package/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.module.css.js +9 -0
  52. package/features/crosswalks/AttributesTable/components/FallbackIndicator/index.d.ts +1 -0
  53. package/features/crosswalks/AttributesTable/components/FallbackIndicator/index.js +1 -0
  54. package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +3 -1
  55. package/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.js +1 -1
  56. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
  57. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +65 -11
  58. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +9 -0
  59. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.d.ts +7 -0
  60. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +8 -0
  61. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.d.ts +7 -0
  62. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.js +23 -0
  63. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.d.ts +2 -0
  64. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.js +2 -0
  65. package/features/crosswalks/AttributesTable/helpers.d.ts +4 -2
  66. package/features/crosswalks/AttributesTable/helpers.js +95 -18
  67. package/features/crosswalks/AttributesTable/helpers.test.js +501 -52
  68. package/features/crosswalks/AttributesTable/types.d.ts +17 -3
  69. package/features/crosswalks/contexts/SyncedValueHeightsContext.d.ts +11 -0
  70. package/features/crosswalks/contexts/SyncedValueHeightsContext.js +38 -0
  71. package/package.json +2 -2
  72. package/SimpleAttribute/styles.d.ts +0 -1
  73. package/SimpleAttribute/styles.js +0 -42
  74. package/cjs/SimpleAttribute/styles.d.ts +0 -1
  75. package/cjs/SimpleAttribute/styles.js +0 -45
  76. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.d.ts +0 -1
  77. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.js +0 -13
  78. package/cjs/icons/VerifyAllIcon.d.ts +0 -3
  79. package/cjs/icons/VerifyAllIcon.js +0 -26
  80. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.d.ts +0 -1
  81. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.js +0 -10
  82. package/icons/VerifyAllIcon.d.ts +0 -3
  83. package/icons/VerifyAllIcon.js +0 -21
@@ -7,8 +7,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7
7
  }
8
8
  return to.concat(ar || Array.prototype.slice.call(from));
9
9
  };
10
- import { DataTypes } from '@reltio/mdm-sdk';
11
- import { COLUMNS_DATA, countAttributeValues, getBasicTableColumnsData, getBasicTableRowsData, getRuleTypeValues, getWinnerCrosswalks } from './helpers';
10
+ import { DataTypes, ParticipationStatus } from '@reltio/mdm-sdk';
11
+ import { COLUMNS_DATA, countAttributeValues, getBasicTableColumnsData, getBasicTableRowsData, getRuleTypeValues, getWinnerCrosswalks, collectRuleNames } from './helpers';
12
12
  import { HeadCellRenderer } from './components/HeadCellRenderer';
13
13
  import { AttributesHeadCellRenderer } from './components/AttributesHeadCellRenderer';
14
14
  import { OvValuesRenderer } from './components/OvValuesRenderer';
@@ -268,13 +268,21 @@ describe('helpers tests', function () {
268
268
  crosswalks: [crosswalks[0]]
269
269
  },
270
270
  ruleType: {
271
- ruleType: {
272
- uri: 'configuration/survivorshipStrategies/LUD',
273
- label: 'Recency'
274
- },
275
- comparisonAttributeUri: undefined,
276
- primaryAttributeUri: undefined,
277
- sourcesUriOrder: undefined
271
+ ruleTypes: [
272
+ {
273
+ data: {
274
+ strategy: {
275
+ uri: 'configuration/survivorshipStrategies/LUD',
276
+ label: 'Recency'
277
+ },
278
+ comparisonAttributeUri: undefined,
279
+ primaryAttributeUri: undefined,
280
+ sourcesUriOrder: undefined
281
+ },
282
+ type: 'rule',
283
+ valueUri: 'entities/1/attributes/CountryCode/1'
284
+ }
285
+ ]
278
286
  },
279
287
  count: 2,
280
288
  values: {
@@ -293,13 +301,21 @@ describe('helpers tests', function () {
293
301
  crosswalks: []
294
302
  },
295
303
  ruleType: {
296
- ruleType: {
297
- uri: 'configuration/survivorshipStrategies/Frequency',
298
- label: 'Frequency'
299
- },
300
- comparisonAttributeUri: undefined,
301
- primaryAttributeUri: undefined,
302
- sourcesUriOrder: undefined
304
+ ruleTypes: [
305
+ {
306
+ data: {
307
+ strategy: {
308
+ uri: 'configuration/survivorshipStrategies/Frequency',
309
+ label: 'Frequency'
310
+ },
311
+ comparisonAttributeUri: undefined,
312
+ primaryAttributeUri: undefined,
313
+ sourcesUriOrder: undefined
314
+ },
315
+ type: 'rule',
316
+ valueUri: 'entities/1/attributes/Date/1'
317
+ }
318
+ ]
303
319
  },
304
320
  count: 2,
305
321
  values: {
@@ -318,10 +334,21 @@ describe('helpers tests', function () {
318
334
  crosswalks: attributes['Address'][0]['refRelation']['crosswalks']
319
335
  },
320
336
  ruleType: {
321
- ruleType: {
322
- uri: 'configuration/survivorshipStrategies/LUD',
323
- label: 'Recency'
324
- }
337
+ ruleTypes: [
338
+ {
339
+ data: {
340
+ strategy: {
341
+ uri: 'configuration/survivorshipStrategies/LUD',
342
+ label: 'Recency'
343
+ },
344
+ comparisonAttributeUri: undefined,
345
+ primaryAttributeUri: undefined,
346
+ sourcesUriOrder: undefined
347
+ },
348
+ type: 'rule',
349
+ valueUri: 'entities/1/attributes/Address/1'
350
+ }
351
+ ]
325
352
  },
326
353
  count: 1,
327
354
  values: {
@@ -404,6 +431,12 @@ describe('helpers tests', function () {
404
431
  name: 'CountryCode',
405
432
  type: 'String',
406
433
  uri: 'configuration/entityTypes/HCP/attributes/CountryCode'
434
+ },
435
+ {
436
+ label: 'Int',
437
+ name: 'Int',
438
+ type: 'Int',
439
+ uri: 'configuration/entityTypes/HCP/attributes/Int'
407
440
  }
408
441
  ],
409
442
  survivorshipGroups: [
@@ -458,13 +491,17 @@ describe('helpers tests', function () {
458
491
  ],
459
492
  survivorshipStrategies: [
460
493
  {
461
- uri: 'configuration/survivorshipStrategies/Recency',
494
+ uri: 'configuration/survivorshipStrategies/LUD',
462
495
  label: 'Recency'
463
496
  },
464
497
  {
465
498
  uri: 'configuration/survivorshipStrategies/Aggregation',
466
499
  label: 'Aggregation'
467
500
  },
501
+ {
502
+ uri: 'configuration/survivorshipStrategies/Frequency',
503
+ label: 'Frequency'
504
+ },
468
505
  {
469
506
  uri: 'configuration/survivorshipStrategies/SRC_SYS',
470
507
  label: 'Source system'
@@ -495,11 +532,30 @@ describe('helpers tests', function () {
495
532
  name: 'Int',
496
533
  label: 'Int'
497
534
  };
498
- expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP')).toEqual({
499
- ruleType: {
500
- uri: 'configuration/survivorshipStrategies/Aggregation',
501
- label: 'Aggregation'
535
+ var attributeValues = [
536
+ {
537
+ uri: 'entities/1/attributes/Int/1',
538
+ type: 'configuration/entityTypes/HCP/attributes/Int',
539
+ value: '1005',
540
+ ov: true
502
541
  }
542
+ ];
543
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
544
+ ruleTypes: [
545
+ {
546
+ data: {
547
+ strategy: {
548
+ uri: 'configuration/survivorshipStrategies/Aggregation',
549
+ label: 'Aggregation'
550
+ },
551
+ comparisonAttributeUri: undefined,
552
+ primaryAttributeUri: undefined,
553
+ sourcesUriOrder: undefined
554
+ },
555
+ type: 'rule',
556
+ valueUri: 'entities/1/attributes/Int/1'
557
+ }
558
+ ]
503
559
  });
504
560
  });
505
561
  it('should return correct rule type based on active strategy', function () {
@@ -509,11 +565,30 @@ describe('helpers tests', function () {
509
565
  name: 'Int',
510
566
  label: 'Int'
511
567
  };
512
- expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', 'configuration/entityTypes/HCP/survivorshipGroups/allRecency')).toEqual({
513
- ruleType: {
514
- uri: 'configuration/survivorshipStrategies/Recency',
515
- label: 'Recency'
568
+ var attributeValues = [
569
+ {
570
+ uri: 'entities/1/attributes/Int/1',
571
+ type: 'configuration/entityTypes/HCP/attributes/Int',
572
+ value: '1005',
573
+ ov: true
516
574
  }
575
+ ];
576
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues, 'configuration/entityTypes/HCP/survivorshipGroups/allRecency')).toEqual({
577
+ ruleTypes: [
578
+ {
579
+ data: {
580
+ strategy: {
581
+ uri: 'configuration/survivorshipStrategies/LUD',
582
+ label: 'Recency'
583
+ },
584
+ comparisonAttributeUri: undefined,
585
+ primaryAttributeUri: undefined,
586
+ sourcesUriOrder: undefined
587
+ },
588
+ type: 'rule',
589
+ valueUri: 'entities/1/attributes/Int/1'
590
+ }
591
+ ]
517
592
  });
518
593
  });
519
594
  it('should use default one if strategy url is incorrect', function () {
@@ -523,41 +598,96 @@ describe('helpers tests', function () {
523
598
  name: 'Int',
524
599
  label: 'Int'
525
600
  };
526
- expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', 'configuration/entityTypes/HCP/survivorshipGroups/unexisting')).toEqual({
527
- ruleType: {
528
- uri: 'configuration/survivorshipStrategies/Aggregation',
529
- label: 'Aggregation'
601
+ var attributeValues = [
602
+ {
603
+ uri: 'entities/1/attributes/Int/1',
604
+ type: 'configuration/entityTypes/HCP/attributes/Int',
605
+ value: '1005',
606
+ ov: true
530
607
  }
608
+ ];
609
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues, 'configuration/entityTypes/HCP/survivorshipGroups/unexisting')).toEqual({
610
+ ruleTypes: [
611
+ {
612
+ data: {
613
+ strategy: {
614
+ uri: 'configuration/survivorshipStrategies/Aggregation',
615
+ label: 'Aggregation'
616
+ },
617
+ comparisonAttributeUri: undefined,
618
+ primaryAttributeUri: undefined,
619
+ sourcesUriOrder: undefined
620
+ },
621
+ type: 'rule',
622
+ valueUri: 'entities/1/attributes/Int/1'
623
+ }
624
+ ]
531
625
  });
532
626
  });
533
627
  it('should return correct rule type with sourcesUriOrder', function () {
534
628
  var attributeType = {
535
629
  uri: 'configuration/entityTypes/HCP/attributes/Gender',
536
- type: 'Gender',
630
+ type: 'String',
537
631
  name: 'Gender',
538
632
  label: 'Gender'
539
633
  };
540
- expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP')).toEqual({
541
- ruleType: {
542
- uri: 'configuration/survivorshipStrategies/SRC_SYS',
543
- label: 'Source system'
544
- },
545
- sourcesUriOrder: ['configuration/sources/TEST', 'configuration/sources/Reltio']
634
+ var attributeValues = [
635
+ {
636
+ uri: 'entities/1/attributes/Gender/1',
637
+ type: 'configuration/entityTypes/HCP/attributes/Gender',
638
+ value: 'F',
639
+ ov: true
640
+ }
641
+ ];
642
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
643
+ ruleTypes: [
644
+ {
645
+ data: {
646
+ strategy: {
647
+ uri: 'configuration/survivorshipStrategies/SRC_SYS',
648
+ label: 'Source system'
649
+ },
650
+ comparisonAttributeUri: undefined,
651
+ primaryAttributeUri: undefined,
652
+ sourcesUriOrder: ['configuration/sources/TEST', 'configuration/sources/Reltio']
653
+ },
654
+ type: 'rule',
655
+ valueUri: 'entities/1/attributes/Gender/1'
656
+ }
657
+ ]
546
658
  });
547
659
  });
548
660
  it('should return correct rule type with primaryAttributeUri', function () {
549
661
  var attributeType = {
550
662
  uri: 'configuration/entityTypes/HCP/attributes/ScheduledDrug',
551
- type: 'ScheduledDrug',
663
+ type: 'String',
552
664
  name: 'ScheduledDrug',
553
665
  label: 'ScheduledDrug'
554
666
  };
555
- expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP')).toEqual({
556
- ruleType: {
557
- uri: 'configuration/survivorshipStrategies/OtherAttributeWinnerCrosswalk',
558
- label: 'Other Attribute Winner Crosswalk'
559
- },
560
- primaryAttributeUri: 'configuration/entityTypes/HCP/attributes/CountryCode'
667
+ var attributeValues = [
668
+ {
669
+ uri: 'entities/1/attributes/ScheduledDrug/1',
670
+ type: 'configuration/entityTypes/HCP/attributes/ScheduledDrug',
671
+ value: 'Aspirin',
672
+ ov: true
673
+ }
674
+ ];
675
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
676
+ ruleTypes: [
677
+ {
678
+ data: {
679
+ strategy: {
680
+ uri: 'configuration/survivorshipStrategies/OtherAttributeWinnerCrosswalk',
681
+ label: 'Other Attribute Winner Crosswalk'
682
+ },
683
+ comparisonAttributeUri: undefined,
684
+ primaryAttributeUri: 'configuration/entityTypes/HCP/attributes/CountryCode',
685
+ sourcesUriOrder: undefined
686
+ },
687
+ type: 'rule',
688
+ valueUri: 'entities/1/attributes/ScheduledDrug/1'
689
+ }
690
+ ]
561
691
  });
562
692
  });
563
693
  it('should return correct rule type with comparisonAttributeUri', function () {
@@ -568,12 +698,290 @@ describe('helpers tests', function () {
568
698
  label: 'Address',
569
699
  referencedAttributeURIs: ['configuration/relationTypes/HasAddress/attributes/Status']
570
700
  };
571
- expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP')).toEqual({
572
- ruleType: {
573
- uri: 'configuration/survivorshipStrategies/MinValue',
574
- label: 'Minimum value'
701
+ var attributeValues = [
702
+ {
703
+ uri: 'entities/1/attributes/Address/1',
704
+ type: 'configuration/entityTypes/HCP/attributes/Address',
705
+ value: {},
706
+ ov: true
707
+ }
708
+ ];
709
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
710
+ ruleTypes: [
711
+ {
712
+ data: {
713
+ strategy: {
714
+ uri: 'configuration/survivorshipStrategies/MinValue',
715
+ label: 'Minimum value'
716
+ },
717
+ comparisonAttributeUri: 'configuration/relationTypes/HasAddress/attributes/Status',
718
+ primaryAttributeUri: undefined,
719
+ sourcesUriOrder: undefined
720
+ },
721
+ type: 'rule',
722
+ valueUri: 'entities/1/attributes/Address/1'
723
+ }
724
+ ]
725
+ });
726
+ });
727
+ it('should return rule type with fallback labels if last applied survivorship rules differ from default one', function () {
728
+ var attributeType = {
729
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
730
+ type: 'Int',
731
+ name: 'Int',
732
+ label: 'Int'
733
+ };
734
+ var attributeValues = [
735
+ {
736
+ uri: 'entities/123abc/attributes/Int/345fgh',
737
+ type: 'configuration/entityTypes/HCP/attributes/Int',
738
+ value: '1005',
739
+ ov: true,
740
+ ovDetails: {
741
+ participationStatus: ParticipationStatus.Strategy,
742
+ appliedSurvivorshipRules: {
743
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, { SRC_SYS: ['LUD'] }, 'Frequency']
744
+ }
745
+ }
746
+ }
747
+ ];
748
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
749
+ ruleTypes: [
750
+ {
751
+ data: {
752
+ strategy: {
753
+ uri: 'configuration/survivorshipStrategies/Frequency',
754
+ label: 'Frequency'
755
+ },
756
+ comparisonAttributeUri: undefined,
757
+ primaryAttributeUri: undefined,
758
+ sourcesUriOrder: undefined
759
+ },
760
+ type: 'rule',
761
+ valueUri: 'entities/123abc/attributes/Int/345fgh'
762
+ }
763
+ ]
764
+ });
765
+ });
766
+ it('should return rule types per OV value with duplicates and ignore non-OV values', function () {
767
+ var attributeType = {
768
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
769
+ type: 'Int',
770
+ name: 'Int',
771
+ label: 'Int'
772
+ };
773
+ var attributeValues = [
774
+ {
775
+ uri: 'entities/123abc/attributes/Int/345fgh',
776
+ type: 'configuration/entityTypes/HCP/attributes/Int',
777
+ value: '1005',
778
+ ov: true,
779
+ ovDetails: {
780
+ participationStatus: ParticipationStatus.Strategy,
781
+ appliedSurvivorshipRules: {
782
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Frequency']
783
+ }
784
+ }
785
+ },
786
+ {
787
+ uri: 'entities/123abc/attributes/Int/ghj565',
788
+ type: 'configuration/entityTypes/HCP/attributes/Int',
789
+ value: '1006',
790
+ ov: true,
791
+ ovDetails: {
792
+ participationStatus: ParticipationStatus.Strategy,
793
+ appliedSurvivorshipRules: {
794
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Frequency']
795
+ }
796
+ }
575
797
  },
576
- comparisonAttributeUri: 'configuration/relationTypes/HasAddress/attributes/Status'
798
+ {
799
+ uri: 'entities/123abc/attributes/Int/nonOvValue',
800
+ type: 'configuration/entityTypes/HCP/attributes/Int',
801
+ value: '1006-non-ov',
802
+ ov: false,
803
+ ovDetails: {
804
+ participationStatus: ParticipationStatus.Strategy,
805
+ appliedSurvivorshipRules: {
806
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Aggregation']
807
+ }
808
+ }
809
+ },
810
+ {
811
+ uri: 'entities/123abc/attributes/Int/xfjhy6',
812
+ type: 'configuration/entityTypes/HCP/attributes/Int',
813
+ value: '1007',
814
+ ov: true,
815
+ ovDetails: {
816
+ participationStatus: ParticipationStatus.Strategy,
817
+ appliedSurvivorshipRules: {
818
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, { SRC_SYS: ['LUD'] }]
819
+ }
820
+ }
821
+ }
822
+ ];
823
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
824
+ ruleTypes: [
825
+ {
826
+ data: {
827
+ strategy: {
828
+ uri: 'configuration/survivorshipStrategies/Frequency',
829
+ label: 'Frequency'
830
+ },
831
+ comparisonAttributeUri: undefined,
832
+ primaryAttributeUri: undefined,
833
+ sourcesUriOrder: undefined
834
+ },
835
+ type: 'rule',
836
+ valueUri: 'entities/123abc/attributes/Int/345fgh'
837
+ },
838
+ {
839
+ data: {
840
+ strategy: {
841
+ uri: 'configuration/survivorshipStrategies/Frequency',
842
+ label: 'Frequency'
843
+ },
844
+ comparisonAttributeUri: undefined,
845
+ primaryAttributeUri: undefined,
846
+ sourcesUriOrder: undefined
847
+ },
848
+ type: 'rule',
849
+ valueUri: 'entities/123abc/attributes/Int/ghj565'
850
+ },
851
+ {
852
+ data: {
853
+ strategy: {
854
+ uri: 'configuration/survivorshipStrategies/LUD',
855
+ label: 'Recency'
856
+ },
857
+ comparisonAttributeUri: undefined,
858
+ primaryAttributeUri: undefined,
859
+ sourcesUriOrder: undefined
860
+ },
861
+ type: 'rule',
862
+ valueUri: 'entities/123abc/attributes/Int/xfjhy6'
863
+ }
864
+ ]
865
+ });
866
+ });
867
+ it('should return default rule type if applied survivorship rules are invalid', function () {
868
+ var attributeType = {
869
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
870
+ type: 'Int',
871
+ name: 'Int',
872
+ label: 'Int'
873
+ };
874
+ var attributeValues = [
875
+ {
876
+ uri: 'entities/123abc/attributes/Int/345fgh',
877
+ type: 'configuration/entityTypes/HCP/attributes/Int',
878
+ value: '1005',
879
+ ov: true,
880
+ ovDetails: {
881
+ participationStatus: ParticipationStatus.Strategy,
882
+ appliedSurvivorshipRules: 'N/A'
883
+ }
884
+ }
885
+ ];
886
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
887
+ ruleTypes: [
888
+ {
889
+ data: {
890
+ strategy: {
891
+ uri: 'configuration/survivorshipStrategies/Aggregation',
892
+ label: 'Aggregation'
893
+ },
894
+ comparisonAttributeUri: undefined,
895
+ primaryAttributeUri: undefined,
896
+ sourcesUriOrder: undefined
897
+ },
898
+ type: 'rule',
899
+ valueUri: 'entities/123abc/attributes/Int/345fgh'
900
+ }
901
+ ]
902
+ });
903
+ });
904
+ it('should return rule type with sourcesUriOrder from applied survivorship rules', function () {
905
+ var attributeType = {
906
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
907
+ type: 'Int',
908
+ name: 'Int',
909
+ label: 'Int'
910
+ };
911
+ var attributeValues = [
912
+ {
913
+ uri: 'entities/123abc/attributes/Int/345fgh',
914
+ type: 'configuration/entityTypes/HCP/attributes/Int',
915
+ value: '1005',
916
+ ov: true,
917
+ ovDetails: {
918
+ participationStatus: ParticipationStatus.Strategy,
919
+ appliedSurvivorshipRules: 'SRC_SYS'
920
+ }
921
+ }
922
+ ];
923
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
924
+ ruleTypes: [
925
+ {
926
+ data: {
927
+ strategy: {
928
+ uri: 'configuration/survivorshipStrategies/SRC_SYS',
929
+ label: 'Source system'
930
+ },
931
+ comparisonAttributeUri: undefined,
932
+ primaryAttributeUri: undefined,
933
+ sourcesUriOrder: ['configuration/sources/TEST', 'configuration/sources/Reltio']
934
+ },
935
+ type: 'rule',
936
+ valueUri: 'entities/123abc/attributes/Int/345fgh'
937
+ }
938
+ ]
939
+ });
940
+ });
941
+ it('should return default rule type for complex attribute even if there are different applied survivorship rules', function () {
942
+ var attributeType = {
943
+ uri: 'configuration/entityTypes/HCP/attributes/Address',
944
+ type: 'Reference',
945
+ name: 'Address',
946
+ label: 'Address',
947
+ referencedAttributeURIs: ['configuration/relationTypes/HasAddress/attributes/Status']
948
+ };
949
+ var attributeValues = [
950
+ {
951
+ uri: 'entities/123abc/attributes/Address/345fgh',
952
+ type: 'configuration/entityTypes/HCP/attributes/Address',
953
+ value: {
954
+ Status: [
955
+ {
956
+ uri: 'entities/123abc/attributes/Status/345fgh',
957
+ type: 'configuration/relationTypes/HasAddress/attributes/Status',
958
+ value: '1005'
959
+ }
960
+ ]
961
+ },
962
+ ov: true,
963
+ ovDetails: {
964
+ participationStatus: ParticipationStatus.Strategy,
965
+ appliedSurvivorshipRules: 'Aggregation'
966
+ }
967
+ }
968
+ ];
969
+ expect(getRuleTypeValues(metadata, attributeType, 'configuration/entityTypes/HCP', attributeValues)).toEqual({
970
+ ruleTypes: [
971
+ {
972
+ data: {
973
+ strategy: {
974
+ uri: 'configuration/survivorshipStrategies/MinValue',
975
+ label: 'Minimum value'
976
+ },
977
+ comparisonAttributeUri: 'configuration/relationTypes/HasAddress/attributes/Status',
978
+ primaryAttributeUri: undefined,
979
+ sourcesUriOrder: undefined
980
+ },
981
+ type: 'rule',
982
+ valueUri: 'entities/123abc/attributes/Address/345fgh'
983
+ }
984
+ ]
577
985
  });
578
986
  });
579
987
  });
@@ -744,5 +1152,46 @@ describe('helpers tests', function () {
744
1152
  expect(getWinnerCrosswalks(undefined, crosswalksMap)).toEqual([]);
745
1153
  });
746
1154
  });
1155
+ describe('collectRuleNames', function () {
1156
+ it('should return single rule when input is a string', function () {
1157
+ expect(collectRuleNames('LUD')).toEqual(['LUD']);
1158
+ });
1159
+ it('should return empty array for empty object', function () {
1160
+ expect(collectRuleNames({})).toEqual([]);
1161
+ });
1162
+ it('should flatten nested applied survivorship rules', function () {
1163
+ var rules = {
1164
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, { SRC_SYS: ['LUD'] }, 'Frequency']
1165
+ };
1166
+ expect(collectRuleNames(rules)).toEqual([
1167
+ 'SRC_SYS',
1168
+ 'SRC_SYS',
1169
+ 'SRC_SYS',
1170
+ 'Aggregation',
1171
+ 'SRC_SYS',
1172
+ 'LUD',
1173
+ 'Frequency'
1174
+ ]);
1175
+ });
1176
+ it('should handle rules with multiple top-level keys', function () {
1177
+ var rules = {
1178
+ SRC_SYS: ['LUD', { SRC_SYS: ['SRC_SYS', 'Aggregation'] }],
1179
+ SRC_SYS2: ['Aggregation']
1180
+ };
1181
+ expect(collectRuleNames(rules)).toEqual([
1182
+ 'SRC_SYS',
1183
+ 'LUD',
1184
+ 'SRC_SYS',
1185
+ 'SRC_SYS',
1186
+ 'Aggregation',
1187
+ 'SRC_SYS2',
1188
+ 'Aggregation'
1189
+ ]);
1190
+ });
1191
+ it('should handle rules with empty nested arrays', function () {
1192
+ var rules = { SRC_SYS: ['LUD', { SRC_SYS: [] }] };
1193
+ expect(collectRuleNames(rules)).toEqual(['SRC_SYS', 'LUD', 'SRC_SYS']);
1194
+ });
1195
+ });
747
1196
  });
748
1197
  });