@truedat/audit 8.3.2 → 8.3.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/audit",
3
- "version": "8.3.2",
3
+ "version": "8.3.4",
4
4
  "description": "Truedat Web Audit Module",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -41,14 +41,17 @@
41
41
  "rootMode": "upward"
42
42
  }
43
43
  ]
44
- }
44
+ },
45
+ "transformIgnorePatterns": [
46
+ "/node_modules/(?!marked|turndown|@tiptap)/"
47
+ ]
45
48
  },
46
49
  "devDependencies": {
47
50
  "@testing-library/dom": "^10.4.0",
48
51
  "@testing-library/jest-dom": "^6.6.3",
49
52
  "@testing-library/react": "^16.3.0",
50
53
  "@testing-library/user-event": "^14.6.1",
51
- "@truedat/test": "8.3.2",
54
+ "@truedat/test": "8.3.4",
52
55
  "identity-obj-proxy": "^3.0.0",
53
56
  "jest": "^29.7.0",
54
57
  "redux-saga-test-plan": "^4.0.6"
@@ -80,5 +83,5 @@
80
83
  "semantic-ui-react": "^3.0.0-beta.2",
81
84
  "swr": "^2.3.3"
82
85
  },
83
- "gitHead": "ed0c289882710d6df3483692fab5833747130cbf"
86
+ "gitHead": "6c7f4ef08bac69f8b642fa788ebb426a5a103314"
84
87
  }
@@ -1,6 +1,9 @@
1
1
  import { testSaga } from "redux-saga-test-plan";
2
2
  import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
3
- import { createSubscription } from "@truedat/core/routines";
3
+ import {
4
+ createSubscription,
5
+ searchSubscriptions,
6
+ } from "@truedat/core/routines";
4
7
  import {
5
8
  createSubscriptionRequestSaga,
6
9
  createSubscriptionSaga
@@ -61,6 +64,14 @@ describe("sagas: createSubscriptionSaga", () => {
61
64
  ...createSubscription.success({ data: requestData, ...payload })
62
65
  })
63
66
  .next()
67
+ .put(
68
+ searchSubscriptions.trigger({
69
+ resource_id: 2,
70
+ resource_type: "resource",
71
+ events: ["event"],
72
+ })
73
+ )
74
+ .next()
64
75
  .put(createSubscription.fulfill())
65
76
  .next()
66
77
  .isDone();
@@ -1,7 +1,10 @@
1
1
  import _ from "lodash/fp";
2
2
  import { compile } from "path-to-regexp";
3
3
  import { testSaga } from "redux-saga-test-plan";
4
- import { deleteSubscription } from "@truedat/core/routines";
4
+ import {
5
+ deleteSubscription,
6
+ searchSubscriptions,
7
+ } from "@truedat/core/routines";
5
8
  import { apiJsonDelete, JSON_OPTS } from "@truedat/core/services/api";
6
9
  import {
7
10
  deleteSubscriptionRequestSaga,
@@ -47,7 +50,11 @@ describe("sagas: deleteSubscriptionSaga", () => {
47
50
  type: "user",
48
51
  },
49
52
  };
50
- const payload = { subscription };
53
+ const payload = {
54
+ subscription,
55
+ resource_id: 2,
56
+ resource_type: "rule",
57
+ };
51
58
 
52
59
  const url = toApiPath({ id: `${subscription.id}` });
53
60
 
@@ -63,6 +70,14 @@ describe("sagas: deleteSubscriptionSaga", () => {
63
70
  ...deleteSubscription.success({ ...payload }),
64
71
  })
65
72
  .next()
73
+ .put(
74
+ searchSubscriptions.trigger({
75
+ resource_id: 2,
76
+ resource_type: "rule",
77
+ events: ["rule_result_created"],
78
+ })
79
+ )
80
+ .next()
66
81
  .put(deleteSubscription.fulfill())
67
82
  .next()
68
83
  .isDone();
@@ -1,7 +1,10 @@
1
1
  import _ from "lodash/fp";
2
2
  import { compile } from "path-to-regexp";
3
3
  import { testSaga } from "redux-saga-test-plan";
4
- import { updateSubscription } from "@truedat/core/routines";
4
+ import {
5
+ updateSubscription,
6
+ searchSubscriptions,
7
+ } from "@truedat/core/routines";
5
8
  import { apiJsonPut, JSON_OPTS } from "@truedat/core/services/api";
6
9
  import {
7
10
  updateSubscriptionRequestSaga,
@@ -39,6 +42,7 @@ describe("sagas: updateSubscriptionSaga", () => {
39
42
  resource_id: 2,
40
43
  resource_type: "resource",
41
44
  status: ["warn"],
45
+ events: ["event"],
42
46
  },
43
47
  };
44
48
  const requestData = {
@@ -64,6 +68,14 @@ describe("sagas: updateSubscriptionSaga", () => {
64
68
  ...updateSubscription.success({ data: payload, ...payload }),
65
69
  })
66
70
  .next()
71
+ .put(
72
+ searchSubscriptions.trigger({
73
+ resource_id: 2,
74
+ resource_type: "resource",
75
+ events: ["event"],
76
+ })
77
+ )
78
+ .next()
67
79
  .put(updateSubscription.fulfill())
68
80
  .next()
69
81
  .isDone();
@@ -1,7 +1,7 @@
1
1
  import _ from "lodash/fp";
2
2
  import { call, put, takeLatest } from "redux-saga/effects";
3
3
  import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
4
- import { createSubscription } from "@truedat/core/routines";
4
+ import { createSubscription, searchSubscriptions } from "@truedat/core/routines";
5
5
  import { API_SUBSCRIPTIONS } from "../api";
6
6
 
7
7
  export function* createSubscriptionSaga({ payload }) {
@@ -24,6 +24,13 @@ export function* createSubscriptionSaga({ payload }) {
24
24
  };
25
25
  const { data } = yield call(apiJsonPost, url, requestData, JSON_OPTS);
26
26
  yield put(createSubscription.success({ data, ...payload }));
27
+ const searchPayload = _.pick(
28
+ ["resource_id", "resource_type", "events"],
29
+ scope
30
+ );
31
+ if (!_.isEmpty(searchPayload)) {
32
+ yield put(searchSubscriptions.trigger(searchPayload));
33
+ }
27
34
  } catch (error) {
28
35
  if (error.response) {
29
36
  const { status, data } = error.response;
@@ -1,10 +1,26 @@
1
1
  import _ from "lodash/fp";
2
2
  import { compile } from "path-to-regexp";
3
3
  import { call, put, takeLatest } from "redux-saga/effects";
4
- import { deleteSubscription } from "@truedat/core/routines";
4
+ import {
5
+ deleteSubscription,
6
+ searchSubscriptions,
7
+ } from "@truedat/core/routines";
5
8
  import { apiJsonDelete, JSON_OPTS } from "@truedat/core/services/api";
6
9
  import { API_SUBSCRIPTION } from "../api";
7
10
 
11
+ const CONCEPT_EVENTS = [
12
+ "concept_submitted",
13
+ "new_concept_draft",
14
+ "concept_published",
15
+ "relation_created",
16
+ "update_concept_draft",
17
+ "delete_concept_draft",
18
+ "relation_deleted",
19
+ "concept_rejected",
20
+ "concept_rejection_canceled",
21
+ "concept_deprecated",
22
+ ];
23
+
8
24
  const toApiPath = compile(API_SUBSCRIPTION);
9
25
 
10
26
  export function* deleteSubscriptionSaga({ payload }) {
@@ -14,6 +30,12 @@ export function* deleteSubscriptionSaga({ payload }) {
14
30
  yield put(deleteSubscription.request());
15
31
  yield call(apiJsonDelete, url, JSON_OPTS);
16
32
  yield put(deleteSubscription.success({ ...payload }));
33
+ const { resource_id, resource_type } = payload;
34
+ const events =
35
+ resource_type === "concept" ? CONCEPT_EVENTS : ["rule_result_created"];
36
+ yield put(
37
+ searchSubscriptions.trigger({ resource_id, resource_type, events })
38
+ );
17
39
  } catch (error) {
18
40
  if (error.response) {
19
41
  const { status, data } = error.response;
@@ -1,7 +1,10 @@
1
1
  import _ from "lodash/fp";
2
2
  import { compile } from "path-to-regexp";
3
3
  import { call, put, takeLatest } from "redux-saga/effects";
4
- import { updateSubscription } from "@truedat/core/routines";
4
+ import {
5
+ updateSubscription,
6
+ searchSubscriptions,
7
+ } from "@truedat/core/routines";
5
8
  import { apiJsonPut, JSON_OPTS } from "@truedat/core/services/api";
6
9
  import { API_SUBSCRIPTION } from "../api";
7
10
 
@@ -23,6 +26,14 @@ export function* updateSubscriptionSaga({ payload }) {
23
26
  yield put({
24
27
  ...updateSubscription.success({ data, ...payload }),
25
28
  });
29
+ const scope = _.get("scope")(subscription);
30
+ const searchPayload = _.pick(
31
+ ["resource_id", "resource_type", "events"],
32
+ scope
33
+ );
34
+ if (!_.isEmpty(searchPayload)) {
35
+ yield put(searchSubscriptions.trigger(searchPayload));
36
+ }
26
37
  } catch (error) {
27
38
  if (error.response) {
28
39
  const { status, data } = error.response;