@truedat/bg 7.13.2 → 7.13.4
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "7.13.
|
|
3
|
+
"version": "7.13.4",
|
|
4
4
|
"description": "Truedat Web Business Glossary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
49
|
"@testing-library/react": "^16.3.0",
|
|
50
50
|
"@testing-library/user-event": "^14.6.1",
|
|
51
|
-
"@truedat/test": "7.13.
|
|
51
|
+
"@truedat/test": "7.13.4",
|
|
52
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
54
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
82
82
|
"swr": "^2.3.3"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "6040831e5a3ad34db35c7233cb3b630a1ad81c4e"
|
|
85
85
|
}
|
|
@@ -124,6 +124,26 @@ describe("selectors: getParsedEvents", () => {
|
|
|
124
124
|
],
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
const r13 = {
|
|
128
|
+
id: 25,
|
|
129
|
+
event: "update_concept_draft",
|
|
130
|
+
resource_id: 23,
|
|
131
|
+
payload: [
|
|
132
|
+
{ msg_key: "changed_field_without_target", msg_params: ["changed_field_1", null] },
|
|
133
|
+
{ msg_key: "changed_field", msg_params: ["changed_field_2", "value_2"] },
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const r14 = {
|
|
138
|
+
id: 26,
|
|
139
|
+
event: "update_concept_draft",
|
|
140
|
+
resource_id: 24,
|
|
141
|
+
payload: [
|
|
142
|
+
{ msg_key: "changed_field_without_target", msg_params: ["changed_field_1", null] },
|
|
143
|
+
{ msg_key: "changed_field", msg_params: ["changed_field_2", "value_2"] },
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
|
|
127
147
|
const events = [
|
|
128
148
|
{
|
|
129
149
|
id: 1,
|
|
@@ -261,12 +281,36 @@ describe("selectors: getParsedEvents", () => {
|
|
|
261
281
|
subscribable_fields: {},
|
|
262
282
|
},
|
|
263
283
|
},
|
|
284
|
+
{
|
|
285
|
+
id: 25,
|
|
286
|
+
event: "update_concept_draft",
|
|
287
|
+
resource_id: 23,
|
|
288
|
+
payload: {
|
|
289
|
+
content: {
|
|
290
|
+
removed: {},
|
|
291
|
+
changed: { changed_field_1: { origin: "origin", value: null }, changed_field_2: { origin: "origin", value: "value_2" } },
|
|
292
|
+
added: {},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
id: 26,
|
|
298
|
+
event: "update_concept_draft",
|
|
299
|
+
resource_id: 24,
|
|
300
|
+
payload: {
|
|
301
|
+
content: {
|
|
302
|
+
removed: {},
|
|
303
|
+
changed: { changed_field_1: null, changed_field_2: "value_2" },
|
|
304
|
+
added: {},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
},
|
|
264
308
|
];
|
|
265
309
|
|
|
266
310
|
it("should return all the events with the new payload", () => {
|
|
267
311
|
const res = getParsedEvents({ events, concept });
|
|
268
|
-
expect(res).toHaveLength(
|
|
269
|
-
expect(res).toEqual([r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12]);
|
|
312
|
+
expect(res).toHaveLength(14);
|
|
313
|
+
expect(res).toEqual([r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14]);
|
|
270
314
|
});
|
|
271
315
|
|
|
272
316
|
it("should return empty array when we have no elements", () => {
|
|
@@ -35,11 +35,19 @@ const getConceptFieldChanges = (
|
|
|
35
35
|
_.flow(
|
|
36
36
|
_.toPairs,
|
|
37
37
|
_.sortBy(([fieldName, _]) => fieldName),
|
|
38
|
-
_.map(([k,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
_.map(([k, fieldValue]) => {
|
|
39
|
+
const v =
|
|
40
|
+
_.isObject(fieldValue) &&
|
|
41
|
+
!_.isNull(fieldValue) &&
|
|
42
|
+
_.has("value", fieldValue)
|
|
43
|
+
? fieldValue.value
|
|
44
|
+
: fieldValue;
|
|
45
|
+
return {
|
|
46
|
+
msg_key: fromValueType(msg_key, k, v, fieldsWithoutValue),
|
|
47
|
+
msg_params: [getFieldLabel(k, templateFields), toStr(v)],
|
|
48
|
+
msg_via: event_via,
|
|
49
|
+
};
|
|
50
|
+
})
|
|
43
51
|
)(fields);
|
|
44
52
|
|
|
45
53
|
const fromValueType = (msg_key, field, value, fieldsWithoutValue) =>
|