@truedat/dq 5.0.4 → 5.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.0.6] 2023-01-30
4
+
5
+ ### Changed
6
+
7
+ - [TD-5524] Use implementation_ref instead of implementation id on subscriptions
8
+
3
9
  ## [5.0.4] 2023-01-27
4
10
 
5
11
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "5.0.4",
3
+ "version": "5.0.6",
4
4
  "description": "Truedat Web Data Quality Module",
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.0.4",
37
+ "@truedat/test": "5.0.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",
@@ -92,8 +92,8 @@
92
92
  },
93
93
  "dependencies": {
94
94
  "@apollo/client": "^3.7.1",
95
- "@truedat/core": "5.0.4",
96
- "@truedat/df": "5.0.4",
95
+ "@truedat/core": "5.0.5",
96
+ "@truedat/df": "5.0.5",
97
97
  "decode-uri-component": "^0.2.2",
98
98
  "graphql": "^15.5.3",
99
99
  "moment": "^2.29.4",
@@ -118,5 +118,5 @@
118
118
  "react-dom": ">= 16.8.6 < 17",
119
119
  "semantic-ui-react": ">= 2.0.3 < 2.2"
120
120
  },
121
- "gitHead": "91d484a16499494eedec012362b3a7f45cb1cbc9"
121
+ "gitHead": "8b2dcaba45d7b32a6e3e14821e580157a418a5bb"
122
122
  }
@@ -11,29 +11,34 @@ import {
11
11
  export const RuleSubscriptionLoader = ({
12
12
  clearSubscriptionsSearch,
13
13
  searchSubscriptions,
14
+ ruleImplementation,
14
15
  }) => {
15
- const { id, implementation_id } = useParams();
16
+ const { id } = useParams();
16
17
 
17
18
  useEffect(() => {
18
- const payload = {
19
- resource_id: _.toInteger(id || implementation_id),
20
- events: ["rule_result_created"],
21
- resource_type: id ? "rule" : implementation_id ? "implementation" : "",
22
- };
19
+ if (!_.isEmpty(id) || !_.isEmpty(ruleImplementation)) {
20
+ const payload = {
21
+ resource_id: _.toInteger(id || ruleImplementation.implementation_ref),
22
+ events: ["rule_result_created"],
23
+ resource_type: id ? "rule" : ruleImplementation ? "implementation" : "",
24
+ };
23
25
 
24
- searchSubscriptions(payload);
25
- return () => {
26
- clearSubscriptionsSearch();
27
- };
28
- }, [clearSubscriptionsSearch, searchSubscriptions, id]);
26
+ searchSubscriptions(payload);
27
+ return () => {
28
+ clearSubscriptionsSearch();
29
+ };
30
+ }
31
+ }, [clearSubscriptionsSearch, searchSubscriptions, id, ruleImplementation]);
29
32
  return null;
30
33
  };
31
34
 
32
35
  RuleSubscriptionLoader.propTypes = {
33
36
  clearSubscriptionsSearch: PropTypes.func,
34
37
  searchSubscriptions: PropTypes.func,
38
+ ruleImplementation: PropTypes.object,
35
39
  };
36
40
 
37
- export default connect(null, { clearSubscriptionsSearch, searchSubscriptions })(
38
- RuleSubscriptionLoader
39
- );
41
+ export default connect(_.pick(["ruleImplementation"]), {
42
+ clearSubscriptionsSearch,
43
+ searchSubscriptions,
44
+ })(RuleSubscriptionLoader);
@@ -4,7 +4,7 @@ import { RuleSubscriptionLoader } from "../RuleSubscriptionLoader";
4
4
 
5
5
  jest.mock("react-router-dom", () => ({
6
6
  ...jest.requireActual("react-router-dom"),
7
- useParams: () => ({ id: 1 })
7
+ useParams: () => ({ id: 1 }),
8
8
  }));
9
9
 
10
10
  describe("<RuleSubscriptionLoader />", () => {
@@ -21,7 +21,11 @@ describe("<RuleSubscriptionLoader />", () => {
21
21
  const searchSubscriptions = jest.fn();
22
22
  const clearSubscriptionsSearch = jest.fn();
23
23
 
24
- const props = { searchSubscriptions, clearSubscriptionsSearch };
24
+ const props = {
25
+ searchSubscriptions,
26
+ clearSubscriptionsSearch,
27
+ ruleImplementation: { implementation_ref: 1 },
28
+ };
25
29
  const wrapper = mount(<RuleSubscriptionLoader {...props} />);
26
30
  expect(clearSubscriptionsSearch.mock.calls.length).toBe(0);
27
31
  expect(searchSubscriptions.mock.calls.length).toBe(1);