@truedat/bg 8.0.2 → 8.0.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": "8.0.2",
3
+ "version": "8.0.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": "8.0.2",
51
+ "@truedat/test": "8.0.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": "db704fb9a008f425362ab96d69aa044fa1d7a720"
84
+ "gitHead": "e68d85fa6cb7c44974235cfb0e0301ed5a3dba98"
85
85
  }
@@ -1018,7 +1018,7 @@ describe("selectors: getParsedEvents", () => {
1018
1018
  });
1019
1019
  });
1020
1020
 
1021
- it("should NOT handle name field in update_concept", () => {
1021
+ it("should handle name field in update_concept", () => {
1022
1022
  const events = [
1023
1023
  {
1024
1024
  id: 1,
@@ -1035,12 +1035,11 @@ describe("selectors: getParsedEvents", () => {
1035
1035
  const res = getParsedEvents({ events, concept });
1036
1036
 
1037
1037
  expect(res).toHaveLength(1);
1038
- expect(res[0].payload).not.toContainEqual(
1039
- expect.objectContaining({
1040
- msg_key: "changed_field",
1041
- msg_params: expect.arrayContaining(["name", "New Concept Name"]),
1042
- })
1043
- );
1038
+ expect(res[0].payload).toContainEqual({
1039
+ msg_key: "changed_field",
1040
+ msg_params: ["name", "New Concept Name"],
1041
+ msg_via: "single_update",
1042
+ });
1044
1043
  });
1045
1044
 
1046
1045
  it("should handle description field in update_concept_draft", () => {
@@ -1067,7 +1066,7 @@ describe("selectors: getParsedEvents", () => {
1067
1066
  });
1068
1067
  });
1069
1068
 
1070
- it("should NOT handle description field in update_concept", () => {
1069
+ it("should handle description field in update_concept", () => {
1071
1070
  const events = [
1072
1071
  {
1073
1072
  id: 1,
@@ -1084,12 +1083,11 @@ describe("selectors: getParsedEvents", () => {
1084
1083
  const res = getParsedEvents({ events, concept });
1085
1084
 
1086
1085
  expect(res).toHaveLength(1);
1087
- expect(res[0].payload).not.toContainEqual(
1088
- expect.objectContaining({
1089
- msg_key: "changed_field_without_target",
1090
- msg_params: ["description"],
1091
- })
1092
- );
1086
+ expect(res[0].payload).toContainEqual({
1087
+ msg_key: "changed_field_without_target",
1088
+ msg_params: ["description"],
1089
+ msg_via: "single_update",
1090
+ });
1093
1091
  });
1094
1092
 
1095
1093
  it("should return empty payload when update_concept_draft has no content", () => {
@@ -1151,7 +1149,7 @@ describe("selectors: getParsedEvents", () => {
1151
1149
  msg_via: "bulk_upload",
1152
1150
  });
1153
1151
  expect(res[0].payload).toContainEqual({
1154
- msg_key: "changed_field_without_target",
1152
+ msg_key: "changed_field",
1155
1153
  msg_params: ["Label", "new_value"],
1156
1154
  msg_via: "bulk_upload",
1157
1155
  });
@@ -1202,7 +1200,7 @@ describe("selectors: getParsedEvents", () => {
1202
1200
  msg_via: "single_update",
1203
1201
  });
1204
1202
  expect(res[0].payload).toContainEqual({
1205
- msg_key: "added_field_without_target",
1203
+ msg_key: "added_field",
1206
1204
  msg_params: ["Label", "added_value"],
1207
1205
  msg_via: "single_update",
1208
1206
  });
@@ -18,7 +18,7 @@ const getDeleteConceptDraftEvent = ({ payload, ...e }) => {
18
18
  return { ...e, payload: [{ msg_key, msg_params, msg_via: event_via }] };
19
19
  };
20
20
 
21
- const getNewConceptDraftEvent = ({ payload, ...e }) => {
21
+ const getNewConceptVersion = ({ payload, ...e }) => {
22
22
  const msg_key = "created_version";
23
23
  const { version, event_via } = payload;
24
24
  const msg_params = [toStr(version)];
@@ -51,10 +51,11 @@ const getConceptFieldChanges = (
51
51
  )(fields);
52
52
 
53
53
  const fromValueType = (msg_key, field, value, fieldsWithoutValue) =>
54
- _.includes(field)(fieldsWithoutValue) ||
55
- _.isNil(value)
56
- ? msg_key + "_without_target"
57
- : msg_key;
54
+ _.isString(value) ? msg_key :
55
+ _.includes(field)(fieldsWithoutValue) ||
56
+ _.isNil(value)
57
+ ? msg_key + "_without_target"
58
+ : msg_key;
58
59
 
59
60
  const getFieldLabel = (field, fields) =>
60
61
  _.flow(
@@ -113,7 +114,7 @@ const getUpdateConceptEvent = (
113
114
  })(field_config);
114
115
  }
115
116
 
116
- if (options.isDraft && description) {
117
+ if (description) {
117
118
  // eslint-disable-next-line fp/no-mutation
118
119
  field_config = _.concat({
119
120
  msg_key: "changed_field_without_target",
@@ -122,7 +123,7 @@ const getUpdateConceptEvent = (
122
123
  })(field_config);
123
124
  }
124
125
 
125
- if (options.isDraft && name) {
126
+ if (name) {
126
127
  // eslint-disable-next-line fp/no-mutation
127
128
  field_config = _.concat({
128
129
  msg_key: "changed_field",
@@ -249,7 +250,7 @@ const getParsedEvents = createSelector(
249
250
  return _.map((e) => {
250
251
  const { event } = e;
251
252
  if (event === "create_concept_draft") {
252
- return getNewConceptDraftEvent(e);
253
+ return getNewConceptVersion(e);
253
254
  } else if (event === "update_concept_draft") {
254
255
  return getUpdateConceptEvent(
255
256
  e,
@@ -264,8 +265,10 @@ const getParsedEvents = createSelector(
264
265
  { isDraft: false });
265
266
  } else if (event === "delete_concept_draft") {
266
267
  return getDeleteConceptDraftEvent(e);
268
+ } else if (event === "new_published_version") {
269
+ return getNewConceptVersion(e);
267
270
  } else if (event === "new_concept_draft") {
268
- return getNewConceptDraftEvent(e);
271
+ return getNewConceptVersion(e);
269
272
  } else if (
270
273
  event === "add_resource_field" ||
271
274
  event === "delete_resource_field"