@reltio/components 1.4.2231 → 1.4.2233

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