@truedat/dd 5.6.4 → 5.6.5

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.5",
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.5",
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.5",
91
+ "@truedat/core": "5.6.5",
92
+ "@truedat/df": "5.6.5",
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": "6e3f4ba8d3ade3c5dee25dc5834101b525332d21"
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,118 @@ 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
+
64
176
  const events = [
65
177
  {
66
178
  id: 1,
@@ -102,12 +214,85 @@ describe("selectors: getParsedEvents", () => {
102
214
  resource_id: 6,
103
215
  payload: { tag: "foo", description: "bar" },
104
216
  },
217
+ {
218
+ id: 7,
219
+ service: "My invented service 7",
220
+ event: "structure_note_deleted",
221
+ resource_id: 7,
222
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
223
+ },
224
+ {
225
+ id: 8,
226
+ service: "My invented service 8",
227
+ event: "structure_note_deprecated",
228
+ resource_id: 8,
229
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
230
+ },
231
+ {
232
+ id: 9,
233
+ service: "My invented service 9",
234
+ event: "structure_note_versioned",
235
+ resource_id: 9,
236
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
237
+ },
238
+ {
239
+ id: 10,
240
+ service: "My invented service 10",
241
+ event: "structure_note_pending_approval",
242
+ resource_id: 10,
243
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
244
+ },
245
+ {
246
+ id: 11,
247
+ service: "My invented service 11",
248
+ event: "structure_note_rejected",
249
+ resource_id: 11,
250
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
251
+ },
252
+ {
253
+ id: 12,
254
+ service: "My invented service 12",
255
+ event: "structure_note_draft",
256
+ resource_id: 12,
257
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
258
+ },
259
+ {
260
+ id: 13,
261
+ service: "My invented service 13",
262
+ event: "structure_note_updated",
263
+ resource_id: 13,
264
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
265
+ },
266
+ {
267
+ id: 14,
268
+ service: "My invented service 14",
269
+ event: "structure_note_published",
270
+ resource_id: 14,
271
+ payload: { content: { changed: { field_1: { id: 1, name: "foo" } } } },
272
+ },
105
273
  ];
106
274
 
107
275
  it("should return all the events with the new payload", () => {
108
276
  const res = getParsedEvents({ events, templates, structure });
109
- expect(res).toHaveLength(6);
110
- expect(res).toEqual(expect.arrayContaining([r1, r2, r3, r4, r5, r6]));
277
+ expect(res).toHaveLength(14);
278
+ expect(res).toEqual(
279
+ expect.arrayContaining([
280
+ r1,
281
+ r2,
282
+ r3,
283
+ r4,
284
+ r5,
285
+ r6,
286
+ r7,
287
+ r8,
288
+ r9,
289
+ r10,
290
+ r11,
291
+ r12,
292
+ r13,
293
+ r14,
294
+ ])
295
+ );
111
296
  });
112
297
 
113
298
  it("should return empty array when we have no elements", () => {
@@ -12,7 +12,9 @@ const transformFieldFormat = (field) =>
12
12
  _.isBoolean(field) ? _.toString(field) : field;
13
13
 
14
14
  const transformNotesPayloadFormat = (payload) => {
15
- const addedFields = payload.content.added;
15
+ const addedFields = payload.content.added
16
+ ? payload.content.added
17
+ : payload.content.changed;
16
18
 
17
19
  const fieldsArray = Object.keys(addedFields).reduce((acc, field) => {
18
20
  if (!_.isEmpty(addedFields[field])) acc.push(field);
@@ -165,6 +167,28 @@ const getParsedEvents = createSelector(
165
167
  },
166
168
  ],
167
169
  };
170
+ case "structure_note_deleted":
171
+ return {
172
+ ...d,
173
+ payload: [
174
+ {
175
+ field: "",
176
+ action: "note_deleted",
177
+ value: "",
178
+ },
179
+ ],
180
+ };
181
+ case "structure_note_deprecated":
182
+ return {
183
+ ...d,
184
+ payload: [
185
+ {
186
+ field: "",
187
+ action: "note_deprecated",
188
+ value: "",
189
+ },
190
+ ],
191
+ };
168
192
  case "structure_note_versioned":
169
193
  return {
170
194
  ...d,
@@ -176,6 +200,39 @@ const getParsedEvents = createSelector(
176
200
  },
177
201
  ],
178
202
  };
203
+ case "structure_note_pending_approval":
204
+ return {
205
+ ...d,
206
+ payload: [
207
+ {
208
+ field: "",
209
+ action: "note_pending_approval",
210
+ value: "",
211
+ },
212
+ ],
213
+ };
214
+ case "structure_note_rejected":
215
+ return {
216
+ ...d,
217
+ payload: [
218
+ {
219
+ field: "",
220
+ action: "note_rejected",
221
+ value: "",
222
+ },
223
+ ],
224
+ };
225
+ case "structure_note_draft":
226
+ return {
227
+ ...d,
228
+ payload: [
229
+ {
230
+ field: "",
231
+ action: "note_draft",
232
+ value: "",
233
+ },
234
+ ],
235
+ };
179
236
  case "structure_note_updated":
180
237
  return {
181
238
  ...d,