@truedat/dq 8.10.8 → 8.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,14 +11,14 @@ describe("selectors: getParsedEvents", () => {
11
11
  payload: {
12
12
  active: true,
13
13
  content: {
14
- added: {
15
- data_owner: null,
16
- proyecto: ["P1"],
17
- },
14
+ data_owner: { origin: "user", value: "Mr. Foo" },
15
+ data_stew: { origin: "user", value: null },
16
+ proyecto: { origin: "user", value: ["P1", "P2"] },
18
17
  },
19
- description: {},
18
+ event_via: "file",
19
+ description: null,
20
20
  df_name: "dq_default_template",
21
- domain_id: 2,
21
+ new_domain: { external_id: "bar_id", id: 140, name: "bar" },
22
22
  goal: 20,
23
23
  minimum: 80,
24
24
  name: "des01",
@@ -35,7 +35,34 @@ describe("selectors: getParsedEvents", () => {
35
35
  },
36
36
  ts: "2021-08-12T12:11:26.908147Z",
37
37
  },
38
-
38
+ {
39
+ id: 52359,
40
+ service: "td_dd",
41
+ resource_id: 777,
42
+ resource_type: "rule",
43
+ event: "rule_created",
44
+ payload: {
45
+ content: {
46
+ data_owner: "Former value format",
47
+ data_stew: null,
48
+ },
49
+ event_via: "single_update",
50
+ domain_id: 2,
51
+ goal: 70,
52
+ minimum: 25,
53
+ result_type: "percentage",
54
+ updated_by: 398,
55
+ },
56
+ user_id: 398,
57
+ user_name: null,
58
+ user: {
59
+ email: "some.user@domain.tld",
60
+ full_name: "Some User",
61
+ id: 398,
62
+ user_name: "some.user@domain.tld",
63
+ },
64
+ ts: "2021-08-12T12:11:26.908147Z",
65
+ },
39
66
  {
40
67
  id: 100217,
41
68
  service: "td_dd",
@@ -44,6 +71,9 @@ describe("selectors: getParsedEvents", () => {
44
71
  event: "rule_updated",
45
72
  payload: {
46
73
  domain_id: 140,
74
+ event_via: "single_update",
75
+ new_domain: { external_id: "bar_id", id: 140, name: "bar" },
76
+ old_domain: { external_id: "baz_id", id: 70, name: "baz" },
47
77
  },
48
78
  user_id: 142,
49
79
  user_name: null,
@@ -62,28 +92,9 @@ describe("selectors: getParsedEvents", () => {
62
92
  resource_type: "rule",
63
93
  event: "rule_updated",
64
94
  payload: {
65
- description: {
66
- document: {
67
- data: {},
68
- nodes: [
69
- {
70
- data: {},
71
- nodes: [
72
- {
73
- marks: [],
74
- object: "text",
75
- text: "Añadimos descripción a la regla",
76
- },
77
- ],
78
- object: "block",
79
- type: "paragraph",
80
- },
81
- ],
82
- object: "document",
83
- },
84
- object: "value",
85
- },
95
+ description: "Añadimos descripción a la regla",
86
96
  updated_by: 171,
97
+ event_via: "single_update",
87
98
  },
88
99
  user_id: 171,
89
100
  user_name: null,
@@ -102,20 +113,57 @@ describe("selectors: getParsedEvents", () => {
102
113
  resource_type: "rule",
103
114
  event: "rule_updated",
104
115
  payload: {
116
+ description: null,
117
+ content: {
118
+ changed: {
119
+ data_stew: { origin: "user", value: null },
120
+ principle: { origin: "user", value: "Validez" },
121
+ scheduler: { origin: "user", value: "" },
122
+ tags: { origin: "user", value: "et" },
123
+ },
124
+ removed: {
125
+ data_owner: { origin: "user", value: null },
126
+ proyecto: { origin: "user", value: ["P1", "P3"] },
127
+ },
128
+ },
129
+ df_name: "quality_template",
130
+ updated_by: 426,
131
+ event_via: "single_update",
132
+ },
133
+ user_id: 426,
134
+ user_name: null,
135
+ user: {
136
+ email: "some.user@domain.tld",
137
+ full_name: "Some User",
138
+ id: 426,
139
+ user_name: "some.user",
140
+ },
141
+ ts: "2021-10-20T07:56:45.891087Z",
142
+ },
143
+ {
144
+ id: 177699,
145
+ service: "td_dd",
146
+ resource_id: 777,
147
+ resource_type: "rule",
148
+ event: "rule_updated",
149
+ payload: {
150
+ description: null,
151
+ business_concept: { id: 3, name: "test_concept" },
152
+ new_domain: { external_id: "bar_id", id: 140, name: "foo" },
153
+ old_domain: { external_id: "baz_id", id: 70, name: "xyz" },
105
154
  content: {
106
155
  changed: {
107
156
  data_stew: null,
108
- principle: "Validez",
109
- scheduler: "",
110
- tags: "et",
157
+ responsible: "",
158
+ tag: "tag",
111
159
  },
112
160
  removed: {
113
161
  data_owner: null,
114
162
  proyecto: ["P1"],
115
163
  },
116
164
  },
117
- df_name: "quality_template",
118
165
  updated_by: 426,
166
+ event_via: "single_update",
119
167
  },
120
168
  user_id: 426,
121
169
  user_name: null,
@@ -127,6 +175,187 @@ describe("selectors: getParsedEvents", () => {
127
175
  },
128
176
  ts: "2021-10-20T07:56:45.891087Z",
129
177
  },
178
+ {
179
+ id: 15799,
180
+ service: "td_dd",
181
+ resource_id: 1130,
182
+ resource_type: "implementation",
183
+ event: "implementation_created",
184
+ payload: {
185
+ df_content: {
186
+ criticality: { origin: "user", value: "Low" },
187
+ type: { origin: "user", value: null },
188
+ project: { origin: "user", value: ["P1", "P2"] },
189
+ },
190
+ domain_id: 6,
191
+ new_domain: { external_id: "Demo", id: 6, name: "Demo" },
192
+ implementation_key: "implemetantion creation test",
193
+ goal: 70,
194
+ minimum: 50,
195
+ result_type: "percentage",
196
+ df_name: "default_template",
197
+ rule_id: null,
198
+ rule_name: null,
199
+ event_via: "single_update",
200
+ },
201
+ user_id: 1,
202
+ user_name: null,
203
+ user: {
204
+ email: "user@user.com",
205
+ external_id: "",
206
+ full_name: "user",
207
+ id: 1,
208
+ user_name: "user",
209
+ },
210
+ ts: "2022-06-29T10:07:30.260906Z",
211
+ },
212
+ {
213
+ id: 15999,
214
+ service: "td_dd",
215
+ resource_id: 1130,
216
+ resource_type: "implementation",
217
+ event: "implementation_created",
218
+ payload: {
219
+ dataset: [
220
+ {
221
+ structure: {
222
+ id: 214196,
223
+ name: "ACCESSLOGV",
224
+ type: "View",
225
+ },
226
+ clauses: [],
227
+ join_type: null,
228
+ alias: {
229
+ index: 1,
230
+ text: "ACCESSLOGV",
231
+ },
232
+ },
233
+ {
234
+ structure: {
235
+ id: 214196,
236
+ name: "ACCESSLOGV",
237
+ type: "View",
238
+ },
239
+ clauses: [
240
+ {
241
+ left: {
242
+ id: "214197",
243
+ parent_index: 2,
244
+ name: "ACCESSTYPE",
245
+ type: "Column",
246
+ },
247
+ right: {
248
+ id: "214213",
249
+ parent_index: 1,
250
+ name: "QUERYBAND",
251
+ type: "Column",
252
+ },
253
+ },
254
+ ],
255
+ join_type: "inner",
256
+ alias: {
257
+ index: 2,
258
+ text: "ACCESSLOGV (2)",
259
+ },
260
+ },
261
+ ],
262
+ df_content: {
263
+ criticality_field: "Low",
264
+ type_field: null,
265
+ },
266
+ domain_id: 6,
267
+ new_domain: { external_id: "Demo", id: 6, name: "Demo" },
268
+ implementation_key: "implemetantion creation test",
269
+ goal: 30,
270
+ minimum: 65,
271
+ result_type: "errors_number",
272
+ df_name: "new_template",
273
+ rule_id: 5,
274
+ rule_name: "Rule name",
275
+ event_via: "single_update",
276
+ populations: [
277
+ [
278
+ {
279
+ structure: {
280
+ id: "214197",
281
+ parent_index: 1,
282
+ name: "ACCESSTYPE",
283
+ type: "Column",
284
+ },
285
+ modifier: null,
286
+ operator: {
287
+ name: "eq",
288
+ value_type: "string",
289
+ },
290
+ value: [
291
+ {
292
+ raw: "9",
293
+ },
294
+ ],
295
+ value_modifier: [],
296
+ population: [],
297
+ },
298
+ ],
299
+ ],
300
+ segments: [
301
+ {
302
+ structure: {
303
+ field_type: "string",
304
+ name: "ACCOUNTNAME",
305
+ parent_index: 1,
306
+ type: "Column",
307
+ metadata: {
308
+ data_type_class: "string",
309
+ database: "DBC",
310
+ host: "localhost",
311
+ length: "256.0",
312
+ order: "1,033",
313
+ table: "ACCESSLOGV",
314
+ type: "VARCHAR CHARACTER SET UNICODE",
315
+ },
316
+ id: "214199",
317
+ },
318
+ },
319
+ ],
320
+ validation: [
321
+ [
322
+ {
323
+ structure: {
324
+ id: "214198",
325
+ parent_index: 1,
326
+ name: "ACCLOGRESULT",
327
+ type: "Column",
328
+ },
329
+ modifier: null,
330
+ operator: {
331
+ name: "not_eq",
332
+ value_type: "field",
333
+ },
334
+ value: [
335
+ {
336
+ id: 214200,
337
+ parent_index: 1,
338
+ name: "COLUMNNAME",
339
+ type: "Column",
340
+ },
341
+ ],
342
+ value_modifier: [],
343
+ population: [],
344
+ },
345
+ ],
346
+ ],
347
+ },
348
+ user_id: 1,
349
+ user_name: null,
350
+ user: {
351
+ email: "user@user.com",
352
+ external_id: "",
353
+ full_name: "user",
354
+ id: 1,
355
+ user_name: "user",
356
+ },
357
+ ts: "2022-06-29T10:07:30.260906Z",
358
+ },
130
359
  {
131
360
  id: 15762,
132
361
  service: "td_dd",
@@ -137,6 +366,242 @@ describe("selectors: getParsedEvents", () => {
137
366
  domain_ids: [386],
138
367
  implementation_key: "prueba de estados de audit",
139
368
  status: "rejected",
369
+ version: 2,
370
+ event_via: "single_update",
371
+ },
372
+ user_id: 1,
373
+ user_name: null,
374
+ user: {
375
+ email: "user@user.com",
376
+ external_id: "",
377
+ full_name: "user",
378
+ id: 1,
379
+ user_name: "user",
380
+ },
381
+ ts: "2022-06-29T10:07:30.260906Z",
382
+ },
383
+ {
384
+ id: 26799,
385
+ service: "td_dd",
386
+ resource_id: 1130,
387
+ resource_type: "implementation",
388
+ event: "implementation_changed",
389
+ payload: {
390
+ dataset: [
391
+ {
392
+ alias: {
393
+ index: 1,
394
+ text: "ACCESSLOGV_SZ",
395
+ },
396
+ structure: {
397
+ id: 214219,
398
+ name: "ACCESSLOGV_SZ",
399
+ },
400
+ },
401
+ {
402
+ alias: {
403
+ index: 2,
404
+ text: "650_BUT0ID",
405
+ },
406
+ clauses: [
407
+ {
408
+ left: {
409
+ id: 251750,
410
+ name: "address",
411
+ parent_index: 2,
412
+ },
413
+ right: {
414
+ id: 214221,
415
+ name: "ACCLOGRESULT",
416
+ parent_index: 1,
417
+ },
418
+ },
419
+ ],
420
+ join_type: "inner",
421
+ structure: {
422
+ id: 251749,
423
+ name: "650_BUT0ID",
424
+ },
425
+ },
426
+ ],
427
+ df_content: {
428
+ changed: {
429
+ criticality: { origin: "user", value: "Low" },
430
+ type: { origin: "user", value: null },
431
+ project: { origin: "user", value: ["P1", "P3"] },
432
+ },
433
+ added: {
434
+ extra: { origin: "user", value: "Extra info" },
435
+ field_2: { origin: "user", value: null },
436
+ },
437
+ removed: {
438
+ new_field: { origin: "user", value: "Last info" },
439
+ field_3: { origin: "user", value: null },
440
+ },
441
+ },
442
+ new_domain: { external_id: "truedat_id", id: 5, name: "Truedat" },
443
+ old_domain: { external_id: "test_id", id: 4, name: "Test" },
444
+ implementation_key: "implemetantion updated",
445
+ goal: 70,
446
+ minimum: 50,
447
+ result_type: "percentage",
448
+ df_name: "default_template",
449
+ rule_id: null,
450
+ populations: [],
451
+ segments: [{}],
452
+ validation: [
453
+ {
454
+ conditions: [
455
+ {
456
+ operator: {
457
+ name: "eq",
458
+ value_type: "field",
459
+ },
460
+ structure: {
461
+ id: 214221,
462
+ name: "ACCLOGRESULT",
463
+ parent_index: 1,
464
+ },
465
+ value: [
466
+ {
467
+ id: 214223,
468
+ name: "COLUMNNAME",
469
+ parent_index: 1,
470
+ type: "Column",
471
+ },
472
+ ],
473
+ },
474
+ ],
475
+ },
476
+ ],
477
+ event_via: "single_update",
478
+ },
479
+ user_id: 1,
480
+ user_name: null,
481
+ user: {
482
+ email: "user@user.com",
483
+ external_id: "",
484
+ full_name: "user",
485
+ id: 1,
486
+ user_name: "user",
487
+ },
488
+ ts: "2022-06-29T10:07:30.260906Z",
489
+ },
490
+ {
491
+ id: 26999,
492
+ service: "td_dd",
493
+ resource_id: 1130,
494
+ resource_type: "implementation",
495
+ event: "implementation_changed",
496
+ payload: {
497
+ dataset: [
498
+ {
499
+ alias: {
500
+ index: 1,
501
+ text: "ACCESSLOGV_SZ",
502
+ },
503
+ structure: {
504
+ id: 214219,
505
+ name: "ACCESSLOGV_SZ",
506
+ },
507
+ },
508
+ {
509
+ alias: {
510
+ index: 2,
511
+ text: "650_BUT0ID",
512
+ },
513
+ clauses: [
514
+ {
515
+ left: {
516
+ id: 251750,
517
+ name: "address",
518
+ parent_index: 2,
519
+ },
520
+ right: {
521
+ id: 214221,
522
+ name: "ACCLOGRESULT",
523
+ parent_index: 1,
524
+ },
525
+ },
526
+ ],
527
+ join_type: "inner",
528
+ structure: {
529
+ id: 251749,
530
+ name: "650_BUT0ID",
531
+ },
532
+ },
533
+ ],
534
+ df_content: {
535
+ changed: {
536
+ criticality_field: { origin: "user", value: "Low" },
537
+ type_field: { origin: "user", value: null },
538
+ },
539
+ added: {
540
+ extra_field: { origin: "user", value: "Extra info" },
541
+ field_22: { origin: "user", value: null },
542
+ },
543
+ removed: {
544
+ new_field_2: { origin: "user", value: "Last info" },
545
+ field_32: { origin: "user", value: null },
546
+ project: { origin: "user", value: ["P1", "P4"] },
547
+ },
548
+ },
549
+ validation: [
550
+ {
551
+ conditions: [
552
+ {
553
+ operator: {
554
+ name: "eq",
555
+ value_type: "field",
556
+ },
557
+ structure: {
558
+ id: 214221,
559
+ name: "ACCLOGRESULT",
560
+ parent_index: 1,
561
+ },
562
+ value: [
563
+ {
564
+ id: 214223,
565
+ name: "COLUMNNAME",
566
+ parent_index: 1,
567
+ type: "Column",
568
+ },
569
+ ],
570
+ },
571
+ ],
572
+ },
573
+ ],
574
+ event_via: "single_update",
575
+ },
576
+ user_id: 1,
577
+ user_name: null,
578
+ user: {
579
+ email: "user@user.com",
580
+ external_id: "",
581
+ full_name: "user",
582
+ id: 1,
583
+ user_name: "user",
584
+ },
585
+ ts: "2022-06-29T10:07:30.260906Z",
586
+ },
587
+ {
588
+ id: 29999,
589
+ service: "td_dd",
590
+ resource_id: 1130,
591
+ resource_type: "implementation",
592
+ event: "implementation_updated",
593
+ payload: {
594
+ df_content: {
595
+ criticality_field: { origin: "user", value: "Low" },
596
+ type_field: { origin: "user", value: null },
597
+ extra_field: { origin: "user", value: "Extra info" },
598
+ field_22: { origin: "user", value: null },
599
+ },
600
+ new_domain: { external_id: "td_id", id: 6, name: "Test_domain" },
601
+ old_domain: { external_id: "d2_id", id: 8, name: "Domain_2" },
602
+ implementation_key: "implemetantion key updated",
603
+ goal: 80,
604
+ event_via: "single_update",
140
605
  },
141
606
  user_id: 1,
142
607
  user_name: null,
@@ -154,40 +619,896 @@ describe("selectors: getParsedEvents", () => {
154
619
  const parsed = [
155
620
  {
156
621
  ...events[0],
157
- payload: [{ field: "des01", action: "created" }],
622
+ payload: [
623
+ {
624
+ field: "bar",
625
+ action: "created",
626
+ action_extra: "domain_added_with_name",
627
+ event_via: "file",
628
+ },
629
+ {
630
+ field: "active",
631
+ action: "created",
632
+ value: true,
633
+ action_extra: "active_added",
634
+ event_via: "file",
635
+ },
636
+ {
637
+ field: "description",
638
+ action: "created",
639
+ value: null,
640
+ action_extra: null,
641
+ event_via: "file",
642
+ },
643
+ {
644
+ field: "df_name",
645
+ action: "created",
646
+ value: "dq_default_template",
647
+ action_extra: "df_name_added",
648
+ event_via: "file",
649
+ },
650
+ {
651
+ field: "goal",
652
+ action: "created",
653
+ value: 20,
654
+ action_extra: "goal_added",
655
+ event_via: "file",
656
+ },
657
+ {
658
+ field: "minimum",
659
+ action: "created",
660
+ value: 80,
661
+ action_extra: "minimum_added",
662
+ event_via: "file",
663
+ },
664
+ {
665
+ field: "name",
666
+ action: "created",
667
+ value: "des01",
668
+ action_extra: "name_added",
669
+ event_via: "file",
670
+ },
671
+ {
672
+ field: "result_type",
673
+ action: "created",
674
+ value: "deviation",
675
+ action_extra: "result_type_added",
676
+ event_via: "file",
677
+ },
678
+ {
679
+ field: "data_owner",
680
+ action: "created",
681
+ value: "Mr. Foo",
682
+ action_extra: "added",
683
+ event_via: "file",
684
+ },
685
+ {
686
+ field: "data_stew",
687
+ action: "created",
688
+ value: null,
689
+ action_extra: "added",
690
+ event_via: "file",
691
+ },
692
+ {
693
+ field: "proyecto",
694
+ action: "created",
695
+ value: "[P1, P2]",
696
+ action_extra: "added",
697
+ event_via: "file",
698
+ },
699
+ ],
158
700
  },
159
701
  {
160
702
  ...events[1],
161
- payload: [{ field: "domain_id", action: "changed", value: 140 }],
703
+ payload: [
704
+ {
705
+ field: 2,
706
+ action: "created",
707
+ action_extra: "domain_added_with_id",
708
+ event_via: "single_update",
709
+ },
710
+ {
711
+ field: "goal",
712
+ action: "created",
713
+ value: 70,
714
+ action_extra: "goal_added",
715
+ event_via: "single_update",
716
+ },
717
+ {
718
+ field: "minimum",
719
+ action: "created",
720
+ value: 25,
721
+ action_extra: "minimum_added",
722
+ event_via: "single_update",
723
+ },
724
+ {
725
+ field: "result_type",
726
+ action: "created",
727
+ value: "percentage",
728
+ action_extra: "result_type_added",
729
+ event_via: "single_update",
730
+ },
731
+ {
732
+ field: "data_owner",
733
+ action: "created",
734
+ value: "Former value format",
735
+ action_extra: "added",
736
+ event_via: "single_update",
737
+ },
738
+ {
739
+ field: "data_stew",
740
+ action: "created",
741
+ value: null,
742
+ action_extra: "added",
743
+ event_via: "single_update",
744
+ },
745
+ ],
162
746
  },
163
747
  {
164
748
  ...events[2],
165
749
  payload: [
166
750
  {
167
- field: "description",
168
- action: "changed_without_target",
169
- value: events[2].payload.description,
751
+ field: "baz",
752
+ action: "changed",
753
+ value: "bar",
754
+ action_extra: "domain_updated_with_names",
755
+ event_via: "single_update",
756
+ },
757
+ ],
758
+ },
759
+ {
760
+ ...events[3],
761
+ payload: [
762
+ {
763
+ field: "description",
764
+ action: "changed",
765
+ action_extra: "changed_without_target",
766
+ value: events[3].payload.description,
767
+ action_extra: "description_updated",
768
+ event_via: "single_update",
769
+ },
770
+ ],
771
+ },
772
+ {
773
+ ...events[4],
774
+ payload: [
775
+ {
776
+ field: "description",
777
+ action: "changed",
778
+ value: null,
779
+ action_extra: "description_removed_without_value",
780
+ event_via: "single_update",
781
+ },
782
+ {
783
+ field: "df_name",
784
+ action: "changed",
785
+ value: "quality_template",
786
+ action_extra: "df_name_updated",
787
+ event_via: "single_update",
788
+ },
789
+ {
790
+ field: "data_stew",
791
+ action: "changed",
792
+ value: null,
793
+ action_extra: "changed",
794
+ event_via: "single_update",
795
+ },
796
+ {
797
+ field: "principle",
798
+ action: "changed",
799
+ action_extra: "changed",
800
+ value: "Validez",
801
+ event_via: "single_update",
802
+ },
803
+ {
804
+ field: "scheduler",
805
+ action: "changed",
806
+ value: "",
807
+ action_extra: "changed",
808
+ event_via: "single_update",
809
+ },
810
+ {
811
+ field: "tags",
812
+ action: "changed",
813
+ value: "et",
814
+ action_extra: "changed",
815
+ event_via: "single_update",
816
+ },
817
+ {
818
+ field: "data_owner",
819
+ action: "changed",
820
+ value: null,
821
+ action_extra: "removed",
822
+ event_via: "single_update",
823
+ },
824
+ {
825
+ field: "proyecto",
826
+ action: "changed",
827
+ value: "[P1, P3]",
828
+ action_extra: "removed",
829
+ event_via: "single_update",
830
+ },
831
+ ],
832
+ },
833
+ {
834
+ ...events[5],
835
+ payload: [
836
+ {
837
+ field: "xyz",
838
+ action: "changed",
839
+ value: "foo",
840
+ action_extra: "domain_updated_with_names",
841
+ event_via: "single_update",
842
+ },
843
+ {
844
+ field: "description",
845
+ action: "changed",
846
+ value: null,
847
+ action_extra: "description_removed_without_value",
848
+ event_via: "single_update",
849
+ },
850
+ {
851
+ field: "business_concept",
852
+ action: "changed",
853
+ value: "test_concept",
854
+ action_extra: "business_concept_updated",
855
+ event_via: "single_update",
856
+ },
857
+ {
858
+ field: "data_stew",
859
+ action: "changed",
860
+ value: null,
861
+ action_extra: "changed",
862
+ event_via: "single_update",
863
+ },
864
+ {
865
+ field: "responsible",
866
+ action: "changed",
867
+ value: "",
868
+ action_extra: "changed",
869
+ event_via: "single_update",
870
+ },
871
+ {
872
+ field: "tag",
873
+ action: "changed",
874
+ value: "tag",
875
+ action_extra: "changed",
876
+ event_via: "single_update",
877
+ },
878
+ {
879
+ field: "data_owner",
880
+ action: "changed",
881
+ value: null,
882
+ action_extra: "removed",
883
+ event_via: "single_update",
884
+ },
885
+ {
886
+ field: "proyecto",
887
+ action: "changed",
888
+ value: "[P1]",
889
+ action_extra: "removed",
890
+ event_via: "single_update",
891
+ },
892
+ ],
893
+ },
894
+ {
895
+ ...events[6],
896
+ payload: [
897
+ {
898
+ field: "Demo",
899
+ action: "created",
900
+ action_extra: "domain_added_with_name",
901
+ event_via: "single_update",
902
+ },
903
+ {
904
+ field: "implementation_key",
905
+ action: "created",
906
+ value: "implemetantion creation test",
907
+ action_extra: "implementation_key_added",
908
+ event_via: "single_update",
909
+ },
910
+ {
911
+ field: "goal",
912
+ action: "created",
913
+ value: 70,
914
+ action_extra: "goal_added",
915
+ event_via: "single_update",
916
+ },
917
+ {
918
+ field: "minimum",
919
+ action: "created",
920
+ value: 50,
921
+ action_extra: "minimum_added",
922
+ event_via: "single_update",
923
+ },
924
+ {
925
+ field: "result_type",
926
+ action: "created",
927
+ value: "percentage",
928
+ action_extra: "result_type_added",
929
+ event_via: "single_update",
930
+ },
931
+ {
932
+ field: "df_name",
933
+ action: "created",
934
+ value: "default_template",
935
+ action_extra: "df_name_added",
936
+ event_via: "single_update",
937
+ },
938
+ {
939
+ field: "rule_name",
940
+ action: "created",
941
+ value: null,
942
+ action_extra: null,
943
+ event_via: "single_update",
944
+ },
945
+ {
946
+ field: "criticality",
947
+ action: "created",
948
+ value: "Low",
949
+ action_extra: "added",
950
+ event_via: "single_update",
951
+ },
952
+ {
953
+ field: "type",
954
+ action: "created",
955
+ value: null,
956
+ action_extra: "added",
957
+ event_via: "single_update",
958
+ },
959
+ {
960
+ field: "project",
961
+ action: "created",
962
+ value: "[P1, P2]",
963
+ action_extra: "added",
964
+ event_via: "single_update",
965
+ },
966
+ ],
967
+ },
968
+ {
969
+ ...events[7],
970
+ payload: [
971
+ {
972
+ field: "Demo",
973
+ action: "created",
974
+ action_extra: "domain_added_with_name",
975
+ event_via: "single_update",
976
+ },
977
+ {
978
+ field: "dataset",
979
+ action: "created",
980
+ value: [
981
+ {
982
+ structure: {
983
+ id: 214196,
984
+ name: "ACCESSLOGV",
985
+ type: "View",
986
+ },
987
+ clauses: [],
988
+ join_type: null,
989
+ alias: {
990
+ index: 1,
991
+ text: "ACCESSLOGV",
992
+ },
993
+ },
994
+ {
995
+ structure: {
996
+ id: 214196,
997
+ name: "ACCESSLOGV",
998
+ type: "View",
999
+ },
1000
+ clauses: [
1001
+ {
1002
+ left: {
1003
+ id: "214197",
1004
+ parent_index: 2,
1005
+ name: "ACCESSTYPE",
1006
+ type: "Column",
1007
+ },
1008
+ right: {
1009
+ id: "214213",
1010
+ parent_index: 1,
1011
+ name: "QUERYBAND",
1012
+ type: "Column",
1013
+ },
1014
+ },
1015
+ ],
1016
+ join_type: "inner",
1017
+ alias: {
1018
+ index: 2,
1019
+ text: "ACCESSLOGV (2)",
1020
+ },
1021
+ },
1022
+ ],
1023
+ action_extra: "dataset_added",
1024
+ event_via: "single_update",
1025
+ },
1026
+ {
1027
+ field: "implementation_key",
1028
+ action: "created",
1029
+ value: "implemetantion creation test",
1030
+ action_extra: "implementation_key_added",
1031
+ event_via: "single_update",
1032
+ },
1033
+ {
1034
+ field: "goal",
1035
+ action: "created",
1036
+ value: 30,
1037
+ action_extra: "goal_added",
1038
+ event_via: "single_update",
1039
+ },
1040
+ {
1041
+ field: "minimum",
1042
+ action: "created",
1043
+ value: 65,
1044
+ action_extra: "minimum_added",
1045
+ event_via: "single_update",
1046
+ },
1047
+ {
1048
+ field: "result_type",
1049
+ action: "created",
1050
+ value: "errors_number",
1051
+ action_extra: "result_type_added",
1052
+ event_via: "single_update",
1053
+ },
1054
+ {
1055
+ field: "df_name",
1056
+ action: "created",
1057
+ value: "new_template",
1058
+ action_extra: "df_name_added",
1059
+ event_via: "single_update",
1060
+ },
1061
+ {
1062
+ field: "rule_name",
1063
+ action: "created",
1064
+ value: "Rule name",
1065
+ action_extra: "rule_name_added",
1066
+ event_via: "single_update",
1067
+ },
1068
+ {
1069
+ field: "populations",
1070
+ action: "created",
1071
+ value: [
1072
+ [
1073
+ {
1074
+ structure: {
1075
+ id: "214197",
1076
+ parent_index: 1,
1077
+ name: "ACCESSTYPE",
1078
+ type: "Column",
1079
+ },
1080
+ modifier: null,
1081
+ operator: {
1082
+ name: "eq",
1083
+ value_type: "string",
1084
+ },
1085
+ value: [
1086
+ {
1087
+ raw: "9",
1088
+ },
1089
+ ],
1090
+ value_modifier: [],
1091
+ population: [],
1092
+ },
1093
+ ],
1094
+ ],
1095
+ action_extra: "populations_added",
1096
+ event_via: "single_update",
1097
+ },
1098
+ {
1099
+ field: "segments",
1100
+ action: "created",
1101
+ value: [
1102
+ {
1103
+ structure: {
1104
+ field_type: "string",
1105
+ name: "ACCOUNTNAME",
1106
+ parent_index: 1,
1107
+ type: "Column",
1108
+ metadata: {
1109
+ data_type_class: "string",
1110
+ database: "DBC",
1111
+ host: "localhost",
1112
+ length: "256.0",
1113
+ order: "1,033",
1114
+ table: "ACCESSLOGV",
1115
+ type: "VARCHAR CHARACTER SET UNICODE",
1116
+ },
1117
+ id: "214199",
1118
+ },
1119
+ },
1120
+ ],
1121
+ action_extra: "segments_added",
1122
+ event_via: "single_update",
1123
+ },
1124
+ {
1125
+ field: "validation",
1126
+ action: "created",
1127
+ value: [
1128
+ [
1129
+ {
1130
+ structure: {
1131
+ id: "214198",
1132
+ parent_index: 1,
1133
+ name: "ACCLOGRESULT",
1134
+ type: "Column",
1135
+ },
1136
+ modifier: null,
1137
+ operator: {
1138
+ name: "not_eq",
1139
+ value_type: "field",
1140
+ },
1141
+ value: [
1142
+ {
1143
+ id: 214200,
1144
+ parent_index: 1,
1145
+ name: "COLUMNNAME",
1146
+ type: "Column",
1147
+ },
1148
+ ],
1149
+ value_modifier: [],
1150
+ population: [],
1151
+ },
1152
+ ],
1153
+ ],
1154
+ action_extra: "validation_added",
1155
+ event_via: "single_update",
1156
+ },
1157
+ {
1158
+ field: "criticality_field",
1159
+ action: "created",
1160
+ value: "Low",
1161
+ action_extra: "added",
1162
+ event_via: "single_update",
1163
+ },
1164
+ {
1165
+ field: "type_field",
1166
+ action: "created",
1167
+ value: null,
1168
+ action_extra: "added",
1169
+ event_via: "single_update",
1170
+ },
1171
+ ],
1172
+ },
1173
+ {
1174
+ ...events[8],
1175
+ payload: [{ action: "rejected", event_via: "single_update", value: 2 }],
1176
+ },
1177
+ {
1178
+ ...events[9],
1179
+ payload: [
1180
+ {
1181
+ field: "Test",
1182
+ action: "changed",
1183
+ value: "Truedat",
1184
+ action_extra: "domain_updated_with_names",
1185
+ event_via: "single_update",
1186
+ },
1187
+ {
1188
+ field: "dataset",
1189
+ action: "changed",
1190
+ value: [
1191
+ {
1192
+ alias: {
1193
+ index: 1,
1194
+ text: "ACCESSLOGV_SZ",
1195
+ },
1196
+ structure: {
1197
+ id: 214219,
1198
+ name: "ACCESSLOGV_SZ",
1199
+ },
1200
+ },
1201
+ {
1202
+ alias: {
1203
+ index: 2,
1204
+ text: "650_BUT0ID",
1205
+ },
1206
+ clauses: [
1207
+ {
1208
+ left: {
1209
+ id: 251750,
1210
+ name: "address",
1211
+ parent_index: 2,
1212
+ },
1213
+ right: {
1214
+ id: 214221,
1215
+ name: "ACCLOGRESULT",
1216
+ parent_index: 1,
1217
+ },
1218
+ },
1219
+ ],
1220
+ join_type: "inner",
1221
+ structure: {
1222
+ id: 251749,
1223
+ name: "650_BUT0ID",
1224
+ },
1225
+ },
1226
+ ],
1227
+ action_extra: "dataset_updated",
1228
+ event_via: "single_update",
1229
+ },
1230
+ {
1231
+ field: "implementation_key",
1232
+ action: "changed",
1233
+ value: "implemetantion updated",
1234
+ action_extra: "implementation_key_updated",
1235
+ event_via: "single_update",
1236
+ },
1237
+ {
1238
+ field: "goal",
1239
+ action: "changed",
1240
+ value: 70,
1241
+ action_extra: "goal_updated",
1242
+ event_via: "single_update",
1243
+ },
1244
+ {
1245
+ field: "minimum",
1246
+ action: "changed",
1247
+ value: 50,
1248
+ action_extra: "minimum_updated",
1249
+ event_via: "single_update",
1250
+ },
1251
+ {
1252
+ field: "result_type",
1253
+ action: "changed",
1254
+ value: "percentage",
1255
+ action_extra: "result_type_updated",
1256
+ event_via: "single_update",
1257
+ },
1258
+ {
1259
+ field: "df_name",
1260
+ action: "changed",
1261
+ value: "default_template",
1262
+ action_extra: "df_name_updated",
1263
+ event_via: "single_update",
1264
+ },
1265
+ {
1266
+ field: "populations",
1267
+ action: "changed",
1268
+ value: null,
1269
+ action_extra: "populations_removed_without_value",
1270
+ event_via: "single_update",
1271
+ },
1272
+ {
1273
+ field: "segments",
1274
+ action: "changed",
1275
+ value: null,
1276
+ action_extra: "segments_removed_without_value",
1277
+ event_via: "single_update",
1278
+ },
1279
+ {
1280
+ field: "validation",
1281
+ action: "changed",
1282
+ value: [
1283
+ {
1284
+ conditions: [
1285
+ {
1286
+ operator: {
1287
+ name: "eq",
1288
+ value_type: "field",
1289
+ },
1290
+ structure: {
1291
+ id: 214221,
1292
+ name: "ACCLOGRESULT",
1293
+ parent_index: 1,
1294
+ },
1295
+ value: [
1296
+ {
1297
+ id: 214223,
1298
+ name: "COLUMNNAME",
1299
+ parent_index: 1,
1300
+ type: "Column",
1301
+ },
1302
+ ],
1303
+ },
1304
+ ],
1305
+ },
1306
+ ],
1307
+ action_extra: "validation_updated",
1308
+ event_via: "single_update",
1309
+ },
1310
+ {
1311
+ field: "criticality",
1312
+ action: "changed",
1313
+ value: "Low",
1314
+ action_extra: "changed",
1315
+ event_via: "single_update",
1316
+ },
1317
+ {
1318
+ field: "type",
1319
+ action: "changed",
1320
+ value: null,
1321
+ action_extra: "changed",
1322
+ event_via: "single_update",
1323
+ },
1324
+ {
1325
+ field: "project",
1326
+ action: "changed",
1327
+ value: "[P1, P3]",
1328
+ action_extra: "changed",
1329
+ event_via: "single_update",
1330
+ },
1331
+ {
1332
+ field: "extra",
1333
+ action: "changed",
1334
+ value: "Extra info",
1335
+ action_extra: "added",
1336
+ event_via: "single_update",
1337
+ },
1338
+ {
1339
+ field: "field_2",
1340
+ action: "changed",
1341
+ value: null,
1342
+ action_extra: "added",
1343
+ event_via: "single_update",
1344
+ },
1345
+ {
1346
+ field: "new_field",
1347
+ action: "changed",
1348
+ value: "Last info",
1349
+ action_extra: "removed",
1350
+ event_via: "single_update",
1351
+ },
1352
+ {
1353
+ field: "field_3",
1354
+ action: "changed",
1355
+ value: null,
1356
+ action_extra: "removed",
1357
+ event_via: "single_update",
1358
+ },
1359
+ ],
1360
+ },
1361
+ {
1362
+ ...events[10],
1363
+ payload: [
1364
+ {
1365
+ field: "dataset",
1366
+ action: "changed",
1367
+ value: [
1368
+ {
1369
+ alias: {
1370
+ index: 1,
1371
+ text: "ACCESSLOGV_SZ",
1372
+ },
1373
+ structure: {
1374
+ id: 214219,
1375
+ name: "ACCESSLOGV_SZ",
1376
+ },
1377
+ },
1378
+ {
1379
+ alias: {
1380
+ index: 2,
1381
+ text: "650_BUT0ID",
1382
+ },
1383
+ clauses: [
1384
+ {
1385
+ left: {
1386
+ id: 251750,
1387
+ name: "address",
1388
+ parent_index: 2,
1389
+ },
1390
+ right: {
1391
+ id: 214221,
1392
+ name: "ACCLOGRESULT",
1393
+ parent_index: 1,
1394
+ },
1395
+ },
1396
+ ],
1397
+ join_type: "inner",
1398
+ structure: {
1399
+ id: 251749,
1400
+ name: "650_BUT0ID",
1401
+ },
1402
+ },
1403
+ ],
1404
+ action_extra: "dataset_updated",
1405
+ event_via: "single_update",
1406
+ },
1407
+ {
1408
+ field: "validation",
1409
+ action: "changed",
1410
+ value: [
1411
+ {
1412
+ conditions: [
1413
+ {
1414
+ operator: {
1415
+ name: "eq",
1416
+ value_type: "field",
1417
+ },
1418
+ structure: {
1419
+ id: 214221,
1420
+ name: "ACCLOGRESULT",
1421
+ parent_index: 1,
1422
+ },
1423
+ value: [
1424
+ {
1425
+ id: 214223,
1426
+ name: "COLUMNNAME",
1427
+ parent_index: 1,
1428
+ type: "Column",
1429
+ },
1430
+ ],
1431
+ },
1432
+ ],
1433
+ },
1434
+ ],
1435
+ action_extra: "validation_updated",
1436
+ event_via: "single_update",
1437
+ },
1438
+ {
1439
+ field: "criticality_field",
1440
+ action: "changed",
1441
+ value: "Low",
1442
+ action_extra: "changed",
1443
+ event_via: "single_update",
1444
+ },
1445
+ {
1446
+ field: "type_field",
1447
+ action: "changed",
1448
+ value: null,
1449
+ action_extra: "changed",
1450
+ event_via: "single_update",
1451
+ },
1452
+ {
1453
+ field: "extra_field",
1454
+ action: "changed",
1455
+ value: "Extra info",
1456
+ action_extra: "added",
1457
+ event_via: "single_update",
1458
+ },
1459
+ {
1460
+ field: "field_22",
1461
+ action: "changed",
1462
+ value: null,
1463
+ action_extra: "added",
1464
+ event_via: "single_update",
1465
+ },
1466
+ {
1467
+ field: "new_field_2",
1468
+ action: "changed",
1469
+ value: "Last info",
1470
+ action_extra: "removed",
1471
+ event_via: "single_update",
1472
+ },
1473
+ {
1474
+ field: "field_32",
1475
+ action: "changed",
1476
+ value: null,
1477
+ action_extra: "removed",
1478
+ event_via: "single_update",
1479
+ },
1480
+ {
1481
+ field: "project",
1482
+ action: "changed",
1483
+ value: "[P1, P4]",
1484
+ action_extra: "removed",
1485
+ event_via: "single_update",
170
1486
  },
171
1487
  ],
172
1488
  },
173
1489
  {
174
- ...events[3],
175
- payload: [
176
- { field: "df_name", action: "changed", value: "quality_template" },
177
- { action: "changed", field: "data_stew", value: null },
178
- { action: "changed", field: "principle", value: "Validez" },
179
- { action: "changed", field: "scheduler", value: "" },
180
- { action: "changed", field: "tags", value: "et" },
181
- { action: "removed", field: "data_owner", value: null },
182
- { action: "removed", field: "proyecto", value: ["P1"] },
183
- ],
184
- },
185
- {
186
- ...events[4],
1490
+ ...events[11],
187
1491
  payload: [
188
1492
  {
189
- action: "rejected",
190
- field: "prueba de estados de audit",
1493
+ field: "Domain_2",
1494
+ action: "updated",
1495
+ value: "Test_domain",
1496
+ action_extra: "domain_updated_with_names",
1497
+ event_via: "single_update",
1498
+ },
1499
+ {
1500
+ field: "implementation_key",
1501
+ action: "updated",
1502
+ value: "implemetantion key updated",
1503
+ action_extra: "implementation_key_updated",
1504
+ event_via: "single_update",
1505
+ },
1506
+ {
1507
+ field: "goal",
1508
+ action: "updated",
1509
+ value: 80,
1510
+ action_extra: "goal_updated",
1511
+ event_via: "single_update",
191
1512
  },
192
1513
  ],
193
1514
  },
@@ -204,14 +1525,13 @@ describe("selectors: getParsedEvents", () => {
204
1525
  expect(res).toEqual(expect.arrayContaining([]));
205
1526
  });
206
1527
 
207
- it("appends _without_target to changed action for fields whose template type is url/table/system/image/markdown", () => {
1528
+ it("appends _without_target to changed action for fields whose template type is table/system/image/markdown", () => {
208
1529
  const ruleTemplate = {
209
1530
  name: "quality_template",
210
1531
  content: [
211
1532
  {
212
1533
  fields: [
213
1534
  { name: "description_md", type: "markdown" },
214
- { name: "doc_url", type: "url" },
215
1535
  { name: "principle", type: "string" },
216
1536
  ],
217
1537
  },
@@ -240,7 +1560,6 @@ describe("selectors: getParsedEvents", () => {
240
1560
  content: {
241
1561
  changed: {
242
1562
  description_md: "# new doc",
243
- doc_url: "https://example.test",
244
1563
  principle: "Validez",
245
1564
  },
246
1565
  },
@@ -257,7 +1576,6 @@ describe("selectors: getParsedEvents", () => {
257
1576
  df_content: {
258
1577
  changed: {
259
1578
  notes_md: "## hi",
260
- evidence: { url: "x" },
261
1579
  comment: "ok",
262
1580
  },
263
1581
  },
@@ -277,29 +1595,31 @@ describe("selectors: getParsedEvents", () => {
277
1595
  expect(ruleParsed.payload).toEqual([
278
1596
  {
279
1597
  field: "description_md",
280
- action: "changed_without_target",
1598
+ action: "changed",
1599
+ action_extra: "changed_without_target",
281
1600
  value: "# new doc",
282
1601
  },
283
1602
  {
284
- field: "doc_url",
285
- action: "changed_without_target",
286
- value: "https://example.test",
1603
+ field: "principle",
1604
+ action: "changed",
1605
+ action_extra: "changed",
1606
+ value: "Validez",
287
1607
  },
288
- { field: "principle", action: "changed", value: "Validez" },
289
1608
  ]);
290
1609
 
291
1610
  expect(implParsed.payload).toEqual([
292
1611
  {
293
1612
  field: "notes_md",
294
- action: "changed_without_target",
1613
+ action: "changed",
1614
+ action_extra: "changed_without_target",
295
1615
  value: "## hi",
296
1616
  },
297
1617
  {
298
- field: "evidence",
299
- action: "changed_without_target",
300
- value: { url: "x" },
1618
+ field: "comment",
1619
+ action: "changed",
1620
+ action_extra: "changed",
1621
+ value: "ok",
301
1622
  },
302
- { field: "comment", action: "changed", value: "ok" },
303
1623
  ]);
304
1624
  });
305
1625
 
@@ -327,9 +1647,518 @@ describe("selectors: getParsedEvents", () => {
327
1647
  const [parsed] = getParsedEvents({ events: [event] });
328
1648
 
329
1649
  expect(parsed.payload).toEqual([
330
- { field: "comment", action: "changed", value: "updated" },
331
- { field: "User", action: "added", value: "Inés Owner" },
332
- { field: "tag", action: "removed", value: "stale" },
1650
+ {
1651
+ field: "comment",
1652
+ action: "changed",
1653
+ action_extra: "changed",
1654
+ value: "updated",
1655
+ },
1656
+ {
1657
+ field: "User",
1658
+ action: "changed",
1659
+ action_extra: "added",
1660
+ value: "Inés Owner",
1661
+ },
1662
+ {
1663
+ field: "tag",
1664
+ action: "changed",
1665
+ action_extra: "removed",
1666
+ value: "stale",
1667
+ },
1668
+ ]);
1669
+ });
1670
+ it("formats URL fields from both rule content and implementation df_content into a readable string", () => {
1671
+ const ruleTemplate = {
1672
+ name: "rule_with_url",
1673
+ content: [
1674
+ {
1675
+ fields: [{ name: "url_field", type: "url" }],
1676
+ },
1677
+ ],
1678
+ };
1679
+
1680
+ const implementationTemplate = {
1681
+ name: "impl_with_url",
1682
+ content: [
1683
+ {
1684
+ fields: [{ name: "url_field_impl", type: "url" }],
1685
+ },
1686
+ ],
1687
+ };
1688
+
1689
+ const ruleEvent = {
1690
+ id: 1001,
1691
+ service: "td_dd",
1692
+ resource_type: "rule",
1693
+ event: "rule_updated",
1694
+ payload: {
1695
+ content: {
1696
+ changed: {
1697
+ url_field: [
1698
+ { url_name: "Truedat", url_value: "https://docs.truedat.io" },
1699
+ { url_name: "Google", url_value: "https://google.com" },
1700
+ ],
1701
+ },
1702
+ },
1703
+ df_name: "rule_with_url",
1704
+ event_via: "single_update",
1705
+ },
1706
+ user_id: 1,
1707
+ user: { email: "test@test.com", full_name: "Test User" },
1708
+ ts: "2026-07-17T11:21:00Z",
1709
+ };
1710
+
1711
+ const implementationEvent = {
1712
+ id: 1002,
1713
+ service: "td_dd",
1714
+ resource_type: "implementation",
1715
+ event: "implementation_changed",
1716
+ payload: {
1717
+ df_content: {
1718
+ changed: {
1719
+ url_field_impl: [
1720
+ { url_name: "Docs", url_value: "https://docs.example.com" },
1721
+ { url_name: "API", url_value: "https://api.example.com" },
1722
+ ],
1723
+ },
1724
+ },
1725
+ df_name: "impl_with_url",
1726
+ event_via: "single_update",
1727
+ },
1728
+ user_id: 1,
1729
+ user: { email: "test@test.com", full_name: "Test User" },
1730
+ ts: "2026-07-17T11:22:00Z",
1731
+ };
1732
+
1733
+ const state = {
1734
+ events: [ruleEvent, implementationEvent],
1735
+ templates: [ruleTemplate],
1736
+ allTemplates: [implementationTemplate],
1737
+ rule: { df_name: "rule_with_url" },
1738
+ ruleImplementation: { df_name: "impl_with_url" },
1739
+ };
1740
+
1741
+ const [ruleParsed, implParsed] = getParsedEvents(state);
1742
+
1743
+ expect(ruleParsed.payload).toContainEqual(
1744
+ expect.objectContaining({
1745
+ field: "url_field",
1746
+ action: "changed",
1747
+ action_extra: "changed",
1748
+ value:
1749
+ "[Truedat] (https://docs.truedat.io) ; [Google] (https://google.com)",
1750
+ event_via: "single_update",
1751
+ }),
1752
+ );
1753
+
1754
+ expect(implParsed.payload).toContainEqual(
1755
+ expect.objectContaining({
1756
+ field: "url_field_impl",
1757
+ action: "changed",
1758
+ action_extra: "changed",
1759
+ value:
1760
+ "[Docs] (https://docs.example.com) ; [API] (https://api.example.com)",
1761
+ event_via: "single_update",
1762
+ }),
1763
+ );
1764
+ });
1765
+
1766
+ it("parses relation_created for business_concept", () => {
1767
+ const event = {
1768
+ id: 968403,
1769
+ service: "td_lm",
1770
+ resource_type: "implementation_ref",
1771
+ resource_id: 516,
1772
+ event: "relation_created",
1773
+ payload: {
1774
+ event_via: "single_update",
1775
+ id: 248,
1776
+ source_id: 516,
1777
+ source_type: "implementation_ref",
1778
+ target_id: 430,
1779
+ target_name: "test business concept",
1780
+ target_type: "business_concept",
1781
+ },
1782
+ user_id: 119,
1783
+ user: { id: 119, full_name: "User Name" },
1784
+ ts: "2026-07-20T11:28:57.574913Z",
1785
+ };
1786
+
1787
+ const [parsed] = getParsedEvents({ events: [event] });
1788
+
1789
+ expect(parsed.payload).toEqual([
1790
+ {
1791
+ field: "business_concept",
1792
+ value: "test business concept",
1793
+ action: "relation_created",
1794
+ action_extra: "relation_created_business_concept",
1795
+ event_via: "single_update",
1796
+ },
1797
+ ]);
1798
+ });
1799
+
1800
+ it("parses relation_deprecated for business_concept", () => {
1801
+ const event = {
1802
+ id: 968404,
1803
+ service: "td_lm",
1804
+ resource_type: "implementation_ref",
1805
+ resource_id: 516,
1806
+ event: "relation_deprecated",
1807
+ payload: {
1808
+ context: {},
1809
+ event_via: "single_update",
1810
+ id: 248,
1811
+ status: null,
1812
+ target_id: 430,
1813
+ target_name: "test business concept",
1814
+ target_type: "business_concept",
1815
+ },
1816
+ user_id: 119,
1817
+ user: { id: 119, full_name: "User Name" },
1818
+ ts: "2026-07-20T11:53:31.971930Z",
1819
+ };
1820
+
1821
+ const [parsed] = getParsedEvents({ events: [event] });
1822
+
1823
+ expect(parsed.payload).toEqual([
1824
+ {
1825
+ field: "business_concept",
1826
+ value: "test business concept",
1827
+ action: "relation_deprecated",
1828
+ action_extra: "relation_deprecated_business_concept",
1829
+ event_via: "single_update",
1830
+ },
1831
+ ]);
1832
+ });
1833
+
1834
+ it("parses implementation_structure_created", () => {
1835
+ const event = {
1836
+ id: 968384,
1837
+ service: "td_dd",
1838
+ resource_type: "implementation_ref",
1839
+ resource_id: 516,
1840
+ event: "implementation_structure_created",
1841
+ payload: {
1842
+ data_structure_id: 214812,
1843
+ data_structure_name: "ACCOUNTINFOX",
1844
+ event_via: "single_update",
1845
+ id: 1050,
1846
+ implementation_id: 516,
1847
+ implementation_key: "Impl_key",
1848
+ type: "dataset",
1849
+ },
1850
+ user_id: 119,
1851
+ user: { id: 119, full_name: "User Name" },
1852
+ ts: "2026-07-16T13:50:06.200705Z",
1853
+ };
1854
+
1855
+ const [parsed] = getParsedEvents({ events: [event] });
1856
+
1857
+ expect(parsed.payload).toEqual([
1858
+ {
1859
+ field: "dataset",
1860
+ value: "ACCOUNTINFOX",
1861
+ action: "relation_created",
1862
+ action_extra: "relation_created_data_structure",
1863
+ event_via: "single_update",
1864
+ },
1865
+ ]);
1866
+ });
1867
+
1868
+ it("parses implementation_structure_deleted", () => {
1869
+ const event = {
1870
+ id: 968381,
1871
+ service: "td_dd",
1872
+ resource_type: "implementation_ref",
1873
+ resource_id: 516,
1874
+ event: "implementation_structure_deleted",
1875
+ payload: {
1876
+ data_structure_id: 214242,
1877
+ data_structure_name: "ACCESSLOG_SZ",
1878
+ event_via: "single_update",
1879
+ id: 927,
1880
+ implementation_id: 516,
1881
+ implementation_key: "Impl_key",
1882
+ type: "dataset",
1883
+ },
1884
+ user_id: 119,
1885
+ user: { id: 119, full_name: "User Name" },
1886
+ ts: "2026-07-16T12:57:49.988770Z",
1887
+ };
1888
+
1889
+ const [parsed] = getParsedEvents({ events: [event] });
1890
+
1891
+ expect(parsed.payload).toEqual([
1892
+ {
1893
+ field: "dataset",
1894
+ value: "ACCESSLOG_SZ",
1895
+ action: "relation_deleted",
1896
+ action_extra: "relation_deleted_data_structure",
1897
+ event_via: "single_update",
1898
+ },
1899
+ ]);
1900
+ });
1901
+ it("handles unknown event types with default payload", () => {
1902
+ const event = {
1903
+ id: 999,
1904
+ event: "some_unknown_event",
1905
+ payload: { implementation_key: "key123", event_via: "single_update" },
1906
+ };
1907
+ const [parsed] = getParsedEvents({ events: [event] });
1908
+ expect(parsed.payload).toEqual([
1909
+ {
1910
+ field: "key123",
1911
+ action: "updated",
1912
+ event_via: "single_update",
1913
+ },
1914
+ ]);
1915
+ });
1916
+ it("parses implementation_moved event", () => {
1917
+ const event = {
1918
+ event: "implementation_moved",
1919
+ payload: { rule_name: "old_rule", event_via: "single_update" },
1920
+ };
1921
+ const [parsed] = getParsedEvents({ events: [event] });
1922
+ expect(parsed.payload).toEqual([
1923
+ {
1924
+ field: "old_rule",
1925
+ action: "moved",
1926
+ action_extra: "moved",
1927
+ event_via: "single_update",
1928
+ },
1929
+ ]);
1930
+ });
1931
+
1932
+ it("parses implementation_restored event", () => {
1933
+ const event = {
1934
+ event: "implementation_restored",
1935
+ payload: { implementation_key: "key123", event_via: "single_update" },
1936
+ };
1937
+ const [parsed] = getParsedEvents({ events: [event] });
1938
+ expect(parsed.payload).toEqual([
1939
+ { field: "key123", action: "restored", event_via: "single_update" },
1940
+ ]);
1941
+ });
1942
+
1943
+ it("parses implementation_deleted event", () => {
1944
+ const event = {
1945
+ event: "implementation_deleted",
1946
+ payload: { implementation_key: "key123", event_via: "single_update" },
1947
+ };
1948
+ const [parsed] = getParsedEvents({ events: [event] });
1949
+ expect(parsed.payload).toEqual([
1950
+ { field: "key123", action: "deleted", event_via: "single_update" },
1951
+ ]);
1952
+ });
1953
+
1954
+ it("parses implementation_status_updated with deprecated status", () => {
1955
+ const event = {
1956
+ event: "implementation_status_updated",
1957
+ payload: { status: "deprecated" },
1958
+ };
1959
+ const [parsed] = getParsedEvents({ events: [event] });
1960
+ expect(parsed.payload).toEqual([
1961
+ {
1962
+ action: "deprecated",
1963
+ },
1964
+ ]);
1965
+ });
1966
+
1967
+ it("parses implementation_status_updated with draft and version", () => {
1968
+ const event = {
1969
+ event: "implementation_status_updated",
1970
+ payload: { status: "draft", version: 3, event_via: "single_update" },
1971
+ };
1972
+ const [parsed] = getParsedEvents({ events: [event] });
1973
+ expect(parsed.payload).toEqual([
1974
+ {
1975
+ value: 3,
1976
+ action: "draft",
1977
+ action_extra: "created_version",
1978
+ event_via: "single_update",
1979
+ },
333
1980
  ]);
334
1981
  });
1982
+
1983
+ it("handles domain update with only domain_id (no new_domain)", () => {
1984
+ const event = {
1985
+ event: "rule_updated",
1986
+ payload: {
1987
+ domain_id: 42,
1988
+ event_via: "single_update",
1989
+ },
1990
+ };
1991
+ const [parsed] = getParsedEvents({ events: [event] });
1992
+ expect(parsed.payload).toContainEqual({
1993
+ field: 42,
1994
+ action: "changed",
1995
+ action_extra: "domain_updated_with_id",
1996
+ event_via: "single_update",
1997
+ });
1998
+ });
1999
+ it("handles executable field in updated event", () => {
2000
+ const event = {
2001
+ event: "implementation_updated",
2002
+ payload: {
2003
+ executable: true,
2004
+ event_via: "single_update",
2005
+ },
2006
+ };
2007
+ const [parsed] = getParsedEvents({ events: [event] });
2008
+ expect(parsed.payload).toContainEqual({
2009
+ field: "executable",
2010
+ value: true,
2011
+ action: "updated",
2012
+ action_extra: "executable_updated",
2013
+ event_via: "single_update",
2014
+ });
2015
+ });
2016
+
2017
+ it("extracts business_concept name when present", () => {
2018
+ const event = {
2019
+ event: "rule_created",
2020
+ payload: {
2021
+ business_concept: { name: "Concept A" },
2022
+ event_via: "single_update",
2023
+ },
2024
+ };
2025
+ const [parsed] = getParsedEvents({ events: [event] });
2026
+ expect(parsed.payload).toContainEqual({
2027
+ field: "business_concept",
2028
+ value: "Concept A",
2029
+ action: "created",
2030
+ action_extra: "business_concept_added",
2031
+ event_via: "single_update",
2032
+ });
2033
+ });
2034
+
2035
+ it("formats array values as comma-separated string when not URL objects", () => {
2036
+ const template = {
2037
+ name: "test_template",
2038
+ content: [{ fields: [{ name: "tags", type: "string" }] }],
2039
+ };
2040
+ const state = {
2041
+ events: [
2042
+ {
2043
+ event: "rule_created",
2044
+ payload: {
2045
+ content: { tags: ["a", "b", "c"] },
2046
+ df_name: "test_template",
2047
+ },
2048
+ },
2049
+ ],
2050
+ rule: { df_name: "test_template" },
2051
+ templates: [template],
2052
+ };
2053
+ const [parsed] = getParsedEvents(state);
2054
+ expect(parsed.payload).toContainEqual(
2055
+ expect.objectContaining({
2056
+ field: "tags",
2057
+ value: "[a, b, c]",
2058
+ }),
2059
+ );
2060
+ });
2061
+
2062
+ it("falls back to field name when template not found", () => {
2063
+ const event = {
2064
+ event: "rule_created",
2065
+ payload: {
2066
+ content: { field_name: "value" },
2067
+ df_name: "non_existent_template",
2068
+ },
2069
+ };
2070
+ const [parsed] = getParsedEvents({ events: [event], templates: [] });
2071
+ expect(parsed.payload).toContainEqual(
2072
+ expect.objectContaining({
2073
+ field: "field_name",
2074
+ }),
2075
+ );
2076
+ });
2077
+
2078
+ it("handles active field in rule_created event with false (should not be null)", () => {
2079
+ const event = {
2080
+ event: "rule_created",
2081
+ payload: {
2082
+ active: false,
2083
+ event_via: "single_update",
2084
+ },
2085
+ };
2086
+ const [parsed] = getParsedEvents({ events: [event] });
2087
+ expect(parsed.payload).toContainEqual({
2088
+ field: "active",
2089
+ value: false,
2090
+ action: "created",
2091
+ action_extra: "active_added",
2092
+ event_via: "single_update",
2093
+ });
2094
+ });
2095
+
2096
+ it("handles active field in rule_updated event", () => {
2097
+ const event = {
2098
+ event: "rule_updated",
2099
+ payload: {
2100
+ active: true,
2101
+ event_via: "single_update",
2102
+ },
2103
+ };
2104
+ const [parsed] = getParsedEvents({ events: [event] });
2105
+ expect(parsed.payload).toContainEqual({
2106
+ field: "active",
2107
+ value: true,
2108
+ action: "changed",
2109
+ action_extra: "active_updated",
2110
+ event_via: "single_update",
2111
+ });
2112
+ });
2113
+
2114
+ it("handles business_concept_added in rule_updated event (added case)", () => {
2115
+ const event = {
2116
+ event: "rule_updated",
2117
+ payload: {
2118
+ business_concept_added: { id: 423, name: "Business Concept Name" },
2119
+ event_via: "single_update",
2120
+ },
2121
+ };
2122
+ const [parsed] = getParsedEvents({ events: [event] });
2123
+ expect(parsed.payload).toContainEqual({
2124
+ field: "business_concept",
2125
+ value: "Business Concept Name",
2126
+ action: "changed",
2127
+ action_extra: "business_concept_added",
2128
+ event_via: "single_update",
2129
+ });
2130
+ });
2131
+
2132
+ it("handles business_concept_removed in rule_updated event (removed case)", () => {
2133
+ const event = {
2134
+ event: "rule_updated",
2135
+ payload: {
2136
+ business_concept_removed: { id: 423, name: "Business Concept Name" },
2137
+ event_via: "single_update",
2138
+ },
2139
+ };
2140
+ const [parsed] = getParsedEvents({ events: [event] });
2141
+ expect(parsed.payload).toContainEqual({
2142
+ field: "business_concept",
2143
+ value: "Business Concept Name",
2144
+ action: "changed",
2145
+ action_extra: "business_concept_removed",
2146
+ event_via: "single_update",
2147
+ });
2148
+ });
2149
+
2150
+ it("does not emit business_concept events when no concept changes are present", () => {
2151
+ const event = {
2152
+ event: "rule_updated",
2153
+ payload: {
2154
+ description: "nueva desc",
2155
+ event_via: "single_update",
2156
+ },
2157
+ };
2158
+ const [parsed] = getParsedEvents({ events: [event] });
2159
+ const conceptEvents = parsed.payload.filter(
2160
+ (e) => e.field === "business_concept",
2161
+ );
2162
+ expect(conceptEvents).toHaveLength(0);
2163
+ });
335
2164
  });