@truedat/dd 5.6.4 → 5.6.6

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/dd",
3
- "version": "5.6.4",
3
+ "version": "5.6.6",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.5",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "5.6.4",
37
+ "@truedat/test": "5.6.6",
38
38
  "babel-jest": "^28.1.0",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -87,9 +87,9 @@
87
87
  },
88
88
  "dependencies": {
89
89
  "@apollo/client": "^3.7.1",
90
- "@truedat/auth": "5.6.4",
91
- "@truedat/core": "5.6.4",
92
- "@truedat/df": "5.6.4",
90
+ "@truedat/auth": "5.6.6",
91
+ "@truedat/core": "5.6.6",
92
+ "@truedat/df": "5.6.6",
93
93
  "lodash": "^4.17.21",
94
94
  "moment": "^2.29.4",
95
95
  "path-to-regexp": "^1.7.0",
@@ -114,5 +114,5 @@
114
114
  "react-dom": ">= 16.8.6 < 17",
115
115
  "semantic-ui-react": ">= 2.0.3 < 2.2"
116
116
  },
117
- "gitHead": "fbecd33735354811f674678337ae16aaa15b4794"
117
+ "gitHead": "2f9e356d743886f505c5e2406e2dd04569ad81f7"
118
118
  }
@@ -28,7 +28,7 @@ export const StructureEventRow = ({ user, user_name, ts, payload }) => {
28
28
  text
29
29
  content={formatMessage({ id: eventMessageId(value, action) }, [
30
30
  field,
31
- value
31
+ value,
32
32
  ])}
33
33
  />
34
34
  ))}
@@ -41,7 +41,7 @@ StructureEventRow.propTypes = {
41
41
  user: PropTypes.object,
42
42
  user_name: PropTypes.string,
43
43
  ts: PropTypes.string,
44
- payload: PropTypes.array
44
+ payload: PropTypes.array,
45
45
  };
46
46
 
47
47
  export default StructureEventRow;
@@ -18,12 +18,12 @@ export const StructureEvents = ({ events, eventsLoading }) =>
18
18
 
19
19
  StructureEvents.propTypes = {
20
20
  events: PropTypes.array.isRequired,
21
- eventsLoading: PropTypes.bool
21
+ eventsLoading: PropTypes.bool,
22
22
  };
23
23
 
24
- const mapStateToProps = state => ({
24
+ const mapStateToProps = (state) => ({
25
25
  events: getParsedEvents(state),
26
- eventsLoading: state.eventsLoading
26
+ eventsLoading: state.eventsLoading,
27
27
  });
28
28
 
29
29
  export default connect(mapStateToProps)(StructureEvents);
@@ -545,6 +545,11 @@ export default {
545
545
  "structures.events.field_tag_linked": "Tag {0} linked with description {1}",
546
546
  "structures.events.field_tag_linked_without_value": "Tag {0} linked",
547
547
  "structures.events.field_tag_updated": "Tag {0} updated with value {1}",
548
+ "structures.events.field_note_deleted": "Note deleted",
549
+ "structures.events.field_note_deprecated": "Note deprecated",
550
+ "structures.events.field_note_draft": "Note to draft",
551
+ "structures.events.field_note_rejected": "Note rejected",
552
+ "structures.events.field_note_pending_approval": "Note pending approval",
548
553
  "structures.events.field_note_published": "Note published",
549
554
  "structures.events.field_note_published_without_value": "Note published",
550
555
  "structures.events.field_note_versioned": "Note versioned",
@@ -559,6 +559,12 @@ export default {
559
559
  "structures.events.field_tag_linked_without_value": "Etiqueta {0} vinculada",
560
560
  "structures.events.field_tag_updated":
561
561
  "Etiqueta {0} actualizada con valor {1}",
562
+ "structures.events.field_note_deleted": "Nota borrada",
563
+ "structures.events.field_note_deprecated": "Nota archivada",
564
+ "structures.events.field_note_draft": "Nota a borrador",
565
+ "structures.events.field_note_rejected": "Nota rechazada",
566
+ "structures.events.field_note_pending_approval":
567
+ "Nota pendiente de aprobación",
562
568
  "structures.events.field_note_published": "Nota publicada",
563
569
  "structures.events.field_note_published_without_value": "Nota publicada",
564
570
  "structures.events.field_note_versioned": "Nota versionada",
@@ -61,6 +61,132 @@ describe("selectors: getParsedEvents", () => {
61
61
  service: "My invented service 6",
62
62
  };
63
63
 
64
+ const r7 = {
65
+ event: "structure_note_deleted",
66
+ id: 7,
67
+ payload: [
68
+ {
69
+ action: "note_deleted",
70
+ field: "",
71
+ value: "",
72
+ },
73
+ ],
74
+ resource_id: 7,
75
+ service: "My invented service 7",
76
+ };
77
+
78
+ const r8 = {
79
+ event: "structure_note_deprecated",
80
+ id: 8,
81
+ payload: [
82
+ {
83
+ action: "note_deprecated",
84
+ field: "",
85
+ value: "",
86
+ },
87
+ ],
88
+ resource_id: 8,
89
+ service: "My invented service 8",
90
+ };
91
+
92
+ const r9 = {
93
+ event: "structure_note_versioned",
94
+ id: 9,
95
+ payload: [
96
+ {
97
+ action: "note_versioned",
98
+ field: "",
99
+ value: "",
100
+ },
101
+ ],
102
+ resource_id: 9,
103
+ service: "My invented service 9",
104
+ };
105
+
106
+ const r10 = {
107
+ event: "structure_note_pending_approval",
108
+ id: 10,
109
+ payload: [
110
+ {
111
+ action: "note_pending_approval",
112
+ field: "",
113
+ value: "",
114
+ },
115
+ ],
116
+ resource_id: 10,
117
+ service: "My invented service 10",
118
+ };
119
+
120
+ const r11 = {
121
+ event: "structure_note_rejected",
122
+ id: 11,
123
+ payload: [
124
+ {
125
+ action: "note_rejected",
126
+ field: "",
127
+ value: "",
128
+ },
129
+ ],
130
+ resource_id: 11,
131
+ service: "My invented service 11",
132
+ };
133
+
134
+ const r12 = {
135
+ event: "structure_note_draft",
136
+ id: 12,
137
+ payload: [
138
+ {
139
+ action: "note_draft",
140
+ field: "",
141
+ value: "",
142
+ },
143
+ ],
144
+ resource_id: 12,
145
+ service: "My invented service 12",
146
+ };
147
+
148
+ const r13 = {
149
+ event: "structure_note_updated",
150
+ id: 13,
151
+ payload: [
152
+ {
153
+ action: "note_updated",
154
+ field: "",
155
+ value: "(field_1)",
156
+ },
157
+ ],
158
+ resource_id: 13,
159
+ service: "My invented service 13",
160
+ };
161
+
162
+ const r14 = {
163
+ event: "structure_note_published",
164
+ id: 14,
165
+ payload: [
166
+ {
167
+ action: "note_published",
168
+ field: "",
169
+ value: "",
170
+ },
171
+ ],
172
+ resource_id: 14,
173
+ service: "My invented service 14",
174
+ };
175
+
176
+ const r15 = {
177
+ event: "structure_note_updated",
178
+ id: 15,
179
+ payload: [
180
+ {
181
+ action: "note_updated",
182
+ field: "",
183
+ value: "",
184
+ },
185
+ ],
186
+ resource_id: 15,
187
+ service: "My invented service 15",
188
+ };
189
+
64
190
  const events = [
65
191
  {
66
192
  id: 1,
@@ -102,12 +228,93 @@ describe("selectors: getParsedEvents", () => {
102
228
  resource_id: 6,
103
229
  payload: { tag: "foo", description: "bar" },
104
230
  },
231
+ {
232
+ id: 7,
233
+ service: "My invented service 7",
234
+ event: "structure_note_deleted",
235
+ resource_id: 7,
236
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
237
+ },
238
+ {
239
+ id: 8,
240
+ service: "My invented service 8",
241
+ event: "structure_note_deprecated",
242
+ resource_id: 8,
243
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
244
+ },
245
+ {
246
+ id: 9,
247
+ service: "My invented service 9",
248
+ event: "structure_note_versioned",
249
+ resource_id: 9,
250
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
251
+ },
252
+ {
253
+ id: 10,
254
+ service: "My invented service 10",
255
+ event: "structure_note_pending_approval",
256
+ resource_id: 10,
257
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
258
+ },
259
+ {
260
+ id: 11,
261
+ service: "My invented service 11",
262
+ event: "structure_note_rejected",
263
+ resource_id: 11,
264
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
265
+ },
266
+ {
267
+ id: 12,
268
+ service: "My invented service 12",
269
+ event: "structure_note_draft",
270
+ resource_id: 12,
271
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
272
+ },
273
+ {
274
+ id: 13,
275
+ service: "My invented service 13",
276
+ event: "structure_note_updated",
277
+ resource_id: 13,
278
+ payload: { content: { added: { field_1: { id: 1, name: "foo" } } } },
279
+ },
280
+ {
281
+ id: 14,
282
+ service: "My invented service 14",
283
+ event: "structure_note_published",
284
+ resource_id: 14,
285
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
286
+ },
287
+ {
288
+ id: 15,
289
+ service: "My invented service 15",
290
+ event: "structure_note_updated",
291
+ resource_id: 15,
292
+ payload: {},
293
+ },
105
294
  ];
106
295
 
107
296
  it("should return all the events with the new payload", () => {
108
297
  const res = getParsedEvents({ events, templates, structure });
109
- expect(res).toHaveLength(6);
110
- expect(res).toEqual(expect.arrayContaining([r1, r2, r3, r4, r5, r6]));
298
+ expect(res).toHaveLength(15);
299
+ expect(res).toEqual(
300
+ expect.arrayContaining([
301
+ r1,
302
+ r2,
303
+ r3,
304
+ r4,
305
+ r5,
306
+ r6,
307
+ r7,
308
+ r8,
309
+ r9,
310
+ r10,
311
+ r11,
312
+ r12,
313
+ r13,
314
+ r14,
315
+ r15,
316
+ ])
317
+ );
111
318
  });
112
319
 
113
320
  it("should return empty array when we have no elements", () => {
@@ -12,7 +12,11 @@ const transformFieldFormat = (field) =>
12
12
  _.isBoolean(field) ? _.toString(field) : field;
13
13
 
14
14
  const transformNotesPayloadFormat = (payload) => {
15
- const addedFields = payload.content.added;
15
+ if (_.isEmpty(payload.content)) return "";
16
+
17
+ const addedFields = payload.content.added
18
+ ? payload.content.added
19
+ : payload.content.changed;
16
20
 
17
21
  const fieldsArray = Object.keys(addedFields).reduce((acc, field) => {
18
22
  if (!_.isEmpty(addedFields[field])) acc.push(field);
@@ -165,6 +169,28 @@ const getParsedEvents = createSelector(
165
169
  },
166
170
  ],
167
171
  };
172
+ case "structure_note_deleted":
173
+ return {
174
+ ...d,
175
+ payload: [
176
+ {
177
+ field: "",
178
+ action: "note_deleted",
179
+ value: "",
180
+ },
181
+ ],
182
+ };
183
+ case "structure_note_deprecated":
184
+ return {
185
+ ...d,
186
+ payload: [
187
+ {
188
+ field: "",
189
+ action: "note_deprecated",
190
+ value: "",
191
+ },
192
+ ],
193
+ };
168
194
  case "structure_note_versioned":
169
195
  return {
170
196
  ...d,
@@ -176,6 +202,39 @@ const getParsedEvents = createSelector(
176
202
  },
177
203
  ],
178
204
  };
205
+ case "structure_note_pending_approval":
206
+ return {
207
+ ...d,
208
+ payload: [
209
+ {
210
+ field: "",
211
+ action: "note_pending_approval",
212
+ value: "",
213
+ },
214
+ ],
215
+ };
216
+ case "structure_note_rejected":
217
+ return {
218
+ ...d,
219
+ payload: [
220
+ {
221
+ field: "",
222
+ action: "note_rejected",
223
+ value: "",
224
+ },
225
+ ],
226
+ };
227
+ case "structure_note_draft":
228
+ return {
229
+ ...d,
230
+ payload: [
231
+ {
232
+ field: "",
233
+ action: "note_draft",
234
+ value: "",
235
+ },
236
+ ],
237
+ };
179
238
  case "structure_note_updated":
180
239
  return {
181
240
  ...d,