@truedat/lm 4.48.14 → 4.49.2

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.49.0] 2022-07-27
4
+
5
+ ### Changed
6
+
7
+ - [TD-4175] Routes changed from `TAGS` (`/tags`) to `RELATION_TAGS`
8
+ (`/relationTags`)
9
+
3
10
  ## [4.48.8] 2022-07-18
4
11
 
5
12
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/lm",
3
- "version": "4.48.14",
3
+ "version": "4.49.2",
4
4
  "description": "Truedat Link Manager",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -87,7 +87,7 @@
87
87
  ]
88
88
  },
89
89
  "dependencies": {
90
- "@truedat/core": "4.48.14",
90
+ "@truedat/core": "4.49.2",
91
91
  "path-to-regexp": "^1.7.0",
92
92
  "prop-types": "^15.8.1",
93
93
  "react-graph-vis": "1.0.5",
@@ -105,5 +105,5 @@
105
105
  "react-dom": ">= 16.8.6 < 17",
106
106
  "semantic-ui-react": ">= 0.88.2 < 2.1"
107
107
  },
108
- "gitHead": "958a84bddc4a739679ea01e0758b78fa6583e240"
108
+ "gitHead": "496ac11b90d4059b4699e50044b37c1dd913f4e2"
109
109
  }
package/src/api.js CHANGED
@@ -1,17 +1,17 @@
1
- const API_RELATIONS_SEARCH = "/api/relations/search";
1
+ const API_RELATION = "/api/relations/:id";
2
2
  const API_RELATIONS = "/api/relations";
3
- const API_RELATIONS_ID = "/api/relations/:id";
4
- const API_RELATION_TAGS = "/api/tags";
5
- const API_RELATION_TAGS_SEARCH = "/api/tags/search";
6
- const API_RELATION_TAGS_ID = "/api/tags/:id";
7
3
  const API_RELATIONS_GRAPH = "/api/relations/:id/graph";
4
+ const API_RELATIONS_SEARCH = "/api/relations/search";
5
+ const API_TAG = "/api/tags/:id";
6
+ const API_TAGS = "/api/tags";
7
+ const API_TAGS_SEARCH = "/api/tags/search";
8
8
 
9
9
  export {
10
- API_RELATIONS_SEARCH,
10
+ API_RELATION,
11
11
  API_RELATIONS,
12
- API_RELATION_TAGS,
13
- API_RELATION_TAGS_SEARCH,
14
- API_RELATIONS_ID,
15
- API_RELATION_TAGS_ID,
16
- API_RELATIONS_GRAPH
12
+ API_RELATIONS_GRAPH,
13
+ API_RELATIONS_SEARCH,
14
+ API_TAG,
15
+ API_TAGS,
16
+ API_TAGS_SEARCH,
17
17
  };
@@ -19,15 +19,15 @@ export const NewRelationTag = ({ createRelationTag }) => (
19
19
  </Header.Content>
20
20
  </Header>
21
21
  <RelationTagForm
22
- onSubmit={relationTag => {
23
- createRelationTag({ relationTag, redirectUrl: linkTo.TAGS() });
22
+ onSubmit={(relationTag) => {
23
+ createRelationTag({ relationTag, redirectUrl: linkTo.RELATION_TAGS() });
24
24
  }}
25
25
  />
26
26
  </Container>
27
27
  );
28
28
 
29
29
  NewRelationTag.propTypes = {
30
- createRelationTag: PropTypes.func
30
+ createRelationTag: PropTypes.func,
31
31
  };
32
32
 
33
33
  export default connect(null, { createRelationTag })(NewRelationTag);
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { Route, Switch } from "react-router-dom";
3
3
  import { Unauthorized } from "@truedat/core/components";
4
4
  import { useAuthorized } from "@truedat/core/hooks";
5
- import { TAGS, TAGS_NEW } from "@truedat/core/routes";
5
+ import { RELATION_TAGS, RELATION_TAGS_NEW } from "@truedat/core/routes";
6
6
  import NewRelationTag from "./NewRelationTag";
7
7
  import RelationTags from "./RelationTags";
8
8
  import RelationTagsLoader from "./RelationTagsLoader";
@@ -12,14 +12,18 @@ export const RelationRoutes = () => {
12
12
 
13
13
  return (
14
14
  <Route
15
- path={TAGS}
15
+ path={RELATION_TAGS}
16
16
  render={() =>
17
17
  authorized ? (
18
18
  <>
19
- <Route path={TAGS} component={RelationTagsLoader} exact />
20
- <Route path={TAGS} component={RelationTags} exact />
19
+ <Route path={RELATION_TAGS} component={RelationTagsLoader} exact />
20
+ <Route path={RELATION_TAGS} component={RelationTags} exact />
21
21
  <Switch>
22
- <Route path={TAGS_NEW} component={NewRelationTag} exact />
22
+ <Route
23
+ path={RELATION_TAGS_NEW}
24
+ component={NewRelationTag}
25
+ exact
26
+ />
23
27
  </Switch>
24
28
  </>
25
29
  ) : (
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { Link } from "react-router-dom";
3
3
  import { Button, Header, Icon, Segment } from "semantic-ui-react";
4
4
  import { FormattedMessage } from "react-intl";
5
- import { TAGS_NEW } from "@truedat/core/routes";
5
+ import { RELATION_TAGS_NEW } from "@truedat/core/routes";
6
6
  import RelationTagCards from "./RelationTagCards";
7
7
 
8
8
  export const RelationTags = () => (
@@ -12,7 +12,7 @@ export const RelationTags = () => (
12
12
  floated="right"
13
13
  primary
14
14
  as={Link}
15
- to={TAGS_NEW}
15
+ to={RELATION_TAGS_NEW}
16
16
  content={<FormattedMessage id="relationTags.actions.create" />}
17
17
  />
18
18
  <Icon name="cubes" circular />
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports[`<RelationRoutes /> matches the latest snapshot 1`] = `
4
4
  <Route
5
- path="/tags"
5
+ path="/relationTags"
6
6
  render={[Function]}
7
7
  />
8
8
  `;
@@ -27,7 +27,7 @@ exports[`<RelationTags /> matches the latest snapshot 1`] = `
27
27
  }
28
28
  floated="right"
29
29
  primary={true}
30
- to="/tags/new"
30
+ to="/relationTags/new"
31
31
  />
32
32
  <Icon
33
33
  as="i"
@@ -3,7 +3,7 @@ import { testSaga } from "redux-saga-test-plan";
3
3
  import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
4
4
  import {
5
5
  createRelationRequestSaga,
6
- createRelationSaga
6
+ createRelationSaga,
7
7
  } from "../createRelation";
8
8
  import { createRelation } from "../../routines";
9
9
  import { API_RELATIONS } from "../../api";
@@ -38,7 +38,7 @@ describe("sagas: createRelationSaga", () => {
38
38
  target_type: "target_type",
39
39
  context: {},
40
40
  tag_ids: [],
41
- redirectUrl
41
+ redirectUrl,
42
42
  };
43
43
  const meta = { redirectUrl };
44
44
  const relation = _.pick([
@@ -47,10 +47,10 @@ describe("sagas: createRelationSaga", () => {
47
47
  "source_type",
48
48
  "target_id",
49
49
  "target_type",
50
- "tag_ids"
50
+ "tag_ids",
51
51
  ])(payload);
52
52
  const request_data = {
53
- relation
53
+ relation,
54
54
  };
55
55
 
56
56
  it("should put a success action when a response is returned", () => {
@@ -1,12 +1,11 @@
1
- import _ from "lodash/fp";
2
1
  import { testSaga } from "redux-saga-test-plan";
3
2
  import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
4
3
  import {
5
4
  createRelationTagRequestSaga,
6
- createRelationTagSaga
5
+ createRelationTagSaga,
7
6
  } from "../createRelationTag";
8
7
  import { createRelationTag } from "../../routines";
9
- import { API_RELATION_TAGS } from "../../api";
8
+ import { API_TAGS } from "../../api";
10
9
 
11
10
  describe("sagas: createRelationTagRequestSaga", () => {
12
11
  it("should invoke createRelationTagSaga on createRelationTag.TRIGGER", () => {
@@ -33,13 +32,13 @@ describe("sagas: createRelationTagSaga", () => {
33
32
  const payload = {
34
33
  relationTag: {
35
34
  type: "tag1",
36
- target_type: "business_concept"
35
+ target_type: "business_concept",
37
36
  },
38
- redirectUrl
37
+ redirectUrl,
39
38
  };
40
39
  const meta = { redirectUrl };
41
40
  const request_data = {
42
- tag: { value: { type: "tag1", target_type: "business_concept" } }
41
+ tag: { value: { type: "tag1", target_type: "business_concept" } },
43
42
  };
44
43
 
45
44
  it("should put a success action when a response is returned", () => {
@@ -48,7 +47,7 @@ describe("sagas: createRelationTagSaga", () => {
48
47
  .next()
49
48
  .put({ meta, ...createRelationTag.request() })
50
49
  .next()
51
- .call(apiJsonPost, API_RELATION_TAGS, request_data, JSON_OPTS)
50
+ .call(apiJsonPost, API_TAGS, request_data, JSON_OPTS)
52
51
  .next({ data: payload })
53
52
  .put({ meta, ...createRelationTag.success(payload) })
54
53
  .next()
@@ -67,7 +66,7 @@ describe("sagas: createRelationTagSaga", () => {
67
66
  .next()
68
67
  .put({ meta, ...createRelationTag.request() })
69
68
  .next()
70
- .call(apiJsonPost, API_RELATION_TAGS, request_data, JSON_OPTS)
69
+ .call(apiJsonPost, API_TAGS, request_data, JSON_OPTS)
71
70
  .throw(error)
72
71
  .put(createRelationTag.failure(message))
73
72
  .next()
@@ -6,7 +6,7 @@ import {
6
6
  deleteRelationRequestSaga,
7
7
  } from "../deleteRelation";
8
8
  import { deleteRelation } from "../../routines";
9
- import { API_RELATIONS_ID } from "../../api";
9
+ import { API_RELATION } from "../../api";
10
10
 
11
11
  describe("sagas: deleteRelationRequestSaga", () => {
12
12
  it("should invoke deleteRelationSaga on deleteRelation.TRIGGER", () => {
@@ -32,7 +32,7 @@ describe("sagas: deleteRelationSaga", () => {
32
32
  const payload = { id: "1" };
33
33
  const { id } = payload;
34
34
  const meta = { id };
35
- const url = compile(API_RELATIONS_ID)(payload);
35
+ const url = compile(API_RELATION)(payload);
36
36
 
37
37
  it("should put a success action when a response is returned", () => {
38
38
  expect(() => {
@@ -1,9 +1,9 @@
1
1
  import { testSaga } from "redux-saga-test-plan";
2
- import { TAGS } from "@truedat/core/routes";
2
+ import { RELATION_TAGS } from "@truedat/core/routes";
3
3
  import { apiJsonDelete, JSON_OPTS } from "@truedat/core/services/api";
4
4
  import {
5
5
  deleteRelationTagSaga,
6
- deleteRelationTagRequestSaga
6
+ deleteRelationTagRequestSaga,
7
7
  } from "../deleteRelationTag";
8
8
  import { deleteRelationTag } from "../../routines";
9
9
 
@@ -30,7 +30,7 @@ describe("sagas: deleteRelationTagRequestSaga", () => {
30
30
  describe("sagas: deleteRelationTagSaga", () => {
31
31
  const payload = { id: "1" };
32
32
  const { id } = payload;
33
- const redirectUrl = TAGS;
33
+ const redirectUrl = RELATION_TAGS;
34
34
  const meta = { id, redirectUrl };
35
35
 
36
36
  it("should put a success action when a response is returned", () => {
@@ -2,10 +2,10 @@ import { testSaga } from "redux-saga-test-plan";
2
2
  import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
3
3
  import {
4
4
  fetchRelationTagsRequestSaga,
5
- fetchRelationTagsSaga
5
+ fetchRelationTagsSaga,
6
6
  } from "../fetchRelationTags";
7
7
  import { fetchRelationTags } from "../../routines";
8
- import { API_RELATION_TAGS_SEARCH } from "../../api";
8
+ import { API_TAGS_SEARCH } from "../../api";
9
9
 
10
10
  describe("sagas: fetchRelationTagsRequestSaga", () => {
11
11
  it("should invoke fetchRelationTagsSaga on fetchRelationTags.TRIGGER", () => {
@@ -29,7 +29,7 @@ describe("sagas: fetchRelationTagsRequestSaga", () => {
29
29
 
30
30
  describe("sagas: fetchRelationTagsSaga", () => {
31
31
  const data = {
32
- collection: [{ id: 1, value: { type: "ingest_to_data_structure" } }]
32
+ collection: [{ id: 1, value: { type: "ingest_to_data_structure" } }],
33
33
  };
34
34
 
35
35
  const headers = {};
@@ -42,7 +42,7 @@ describe("sagas: fetchRelationTagsSaga", () => {
42
42
  .next()
43
43
  .put(fetchRelationTags.request())
44
44
  .next()
45
- .call(apiJsonPost, API_RELATION_TAGS_SEARCH, body, JSON_OPTS)
45
+ .call(apiJsonPost, API_TAGS_SEARCH, body, JSON_OPTS)
46
46
  .next({ data, headers })
47
47
  .put(fetchRelationTags.success({ data, headers }))
48
48
  .next()
@@ -61,7 +61,7 @@ describe("sagas: fetchRelationTagsSaga", () => {
61
61
  .next()
62
62
  .put(fetchRelationTags.request())
63
63
  .next()
64
- .call(apiJsonPost, API_RELATION_TAGS_SEARCH, body, JSON_OPTS)
64
+ .call(apiJsonPost, API_TAGS_SEARCH, body, JSON_OPTS)
65
65
  .throw(error)
66
66
  .put(fetchRelationTags.failure(message))
67
67
  .next()
@@ -2,7 +2,7 @@ import { testSaga } from "redux-saga-test-plan";
2
2
  import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
3
3
  import {
4
4
  fetchRelationsRequestSaga,
5
- fetchRelationsSaga
5
+ fetchRelationsSaga,
6
6
  } from "../fetchRelations";
7
7
  import { fetchRelations } from "../../routines";
8
8
  import { API_RELATIONS_SEARCH } from "../../api";
@@ -35,8 +35,8 @@ describe("sagas: fetchRelationsSaga", () => {
35
35
  source_type: "source_type",
36
36
  target_id: 456,
37
37
  target_type: "target_type",
38
- context: {}
39
- }
38
+ context: {},
39
+ },
40
40
  ];
41
41
  const resource_id = "1";
42
42
  const resource_type = "some resource type";
@@ -44,7 +44,7 @@ describe("sagas: fetchRelationsSaga", () => {
44
44
  const resource = {
45
45
  resource_id,
46
46
  resource_type,
47
- target_type: related_to_type
47
+ target_type: related_to_type,
48
48
  };
49
49
 
50
50
  const body = { resource_id, resource_type, related_to_type };
@@ -3,7 +3,7 @@ import { compile } from "path-to-regexp";
3
3
  import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
4
4
  import {
5
5
  fetchRelationsGraphRequestSaga,
6
- fetchRelationsGraphSaga
6
+ fetchRelationsGraphSaga,
7
7
  } from "../fetchRelationsGraph";
8
8
  import { fetchRelationsGraph } from "../../routines";
9
9
  import { API_RELATIONS_GRAPH } from "../../api";
@@ -12,16 +12,16 @@ const toApiPath = compile(API_RELATIONS_GRAPH);
12
12
  const nodes = [
13
13
  {
14
14
  id: "business_concept:92",
15
- label: "My Awesome Concept"
15
+ label: "My Awesome Concept",
16
16
  },
17
17
  {
18
18
  id: "business_concept:5",
19
- label: "New Concept 4"
19
+ label: "New Concept 4",
20
20
  },
21
21
  {
22
22
  id: "business_concept:18",
23
- label: "Float Concept"
24
- }
23
+ label: "Float Concept",
24
+ },
25
25
  ];
26
26
 
27
27
  const edges = [
@@ -32,11 +32,11 @@ const edges = [
32
32
  id: 3,
33
33
  value: {
34
34
  target_type: "business_concept",
35
- type: "bc_padre"
36
- }
37
- }
35
+ type: "bc_padre",
36
+ },
37
+ },
38
38
  ],
39
- to: "business_concept:5"
39
+ to: "business_concept:5",
40
40
  },
41
41
  {
42
42
  from: "business_concept:5",
@@ -45,11 +45,11 @@ const edges = [
45
45
  id: 3,
46
46
  value: {
47
47
  target_type: "business_concept",
48
- type: "bc_padre"
49
- }
50
- }
48
+ type: "bc_padre",
49
+ },
50
+ },
51
51
  ],
52
- to: "business_concept:18"
52
+ to: "business_concept:18",
53
53
  },
54
54
  {
55
55
  from: "business_concept:18",
@@ -58,12 +58,12 @@ const edges = [
58
58
  id: 3,
59
59
  value: {
60
60
  target_type: "business_concept",
61
- type: "bc_padre"
62
- }
63
- }
61
+ type: "bc_padre",
62
+ },
63
+ },
64
64
  ],
65
- to: "business_concept:5"
66
- }
65
+ to: "business_concept:5",
66
+ },
67
67
  ];
68
68
 
69
69
  describe("sagas: fetchRelationsGraphRequestSaga", () => {
@@ -2,7 +2,7 @@ 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
4
  import { createRelationTag } from "../routines";
5
- import { API_RELATION_TAGS } from "../api";
5
+ import { API_TAGS } from "../api";
6
6
 
7
7
  export function* createRelationTagSaga({ payload }) {
8
8
  try {
@@ -14,12 +14,7 @@ export function* createRelationTagSaga({ payload }) {
14
14
  const requestData = { tag: { value: relationTagValue } };
15
15
 
16
16
  yield put({ meta, ...createRelationTag.request() });
17
- const { data } = yield call(
18
- apiJsonPost,
19
- API_RELATION_TAGS,
20
- requestData,
21
- JSON_OPTS
22
- );
17
+ const { data } = yield call(apiJsonPost, API_TAGS, requestData, JSON_OPTS);
23
18
  yield put({ meta, ...createRelationTag.success(data) });
24
19
  } catch (error) {
25
20
  if (error.response) {
@@ -2,9 +2,9 @@ import { compile } from "path-to-regexp";
2
2
  import { call, put, takeLatest } from "redux-saga/effects";
3
3
  import { apiJsonDelete, JSON_OPTS } from "@truedat/core/services/api";
4
4
  import { deleteRelation } from "../routines";
5
- import { API_RELATIONS_ID } from "../api";
5
+ import { API_RELATION } from "../api";
6
6
 
7
- const toApiPath = compile(API_RELATIONS_ID);
7
+ const toApiPath = compile(API_RELATION);
8
8
 
9
9
  export function* deleteRelationSaga({ payload }) {
10
10
  try {
@@ -1,16 +1,16 @@
1
1
  import { compile } from "path-to-regexp";
2
2
  import { call, put, takeLatest } from "redux-saga/effects";
3
- import { TAGS } from "@truedat/core/routes";
3
+ import { RELATION_TAGS } from "@truedat/core/routes";
4
4
  import { apiJsonDelete, JSON_OPTS } from "@truedat/core/services/api";
5
5
  import { deleteRelationTag } from "../routines";
6
- import { API_RELATION_TAGS_ID } from "../api";
6
+ import { API_TAG } from "../api";
7
7
 
8
- const toApiPath = compile(API_RELATION_TAGS_ID);
8
+ const toApiPath = compile(API_TAG);
9
9
 
10
10
  export function* deleteRelationTagSaga({ payload }) {
11
11
  try {
12
12
  const { id } = payload;
13
- const redirectUrl = TAGS;
13
+ const redirectUrl = RELATION_TAGS;
14
14
  const meta = { id, redirectUrl };
15
15
  const url = toApiPath(payload);
16
16
  yield put({ meta, ...deleteRelationTag.request() });
@@ -2,11 +2,11 @@ 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
4
  import { fetchRelationTags } from "../routines";
5
- import { API_RELATION_TAGS_SEARCH } from "../api";
5
+ import { API_TAGS_SEARCH } from "../api";
6
6
 
7
7
  export function* fetchRelationTagsSaga({ payload }) {
8
8
  try {
9
- const url = API_RELATION_TAGS_SEARCH;
9
+ const url = API_TAGS_SEARCH;
10
10
  const { targetType } = payload;
11
11
  const body = _.isNil(targetType)
12
12
  ? {}
@@ -9,7 +9,7 @@ export function* fetchRelationsSaga({ payload }) {
9
9
  const body = {
10
10
  resource_id: resource_id,
11
11
  resource_type: resource_type,
12
- related_to_type: target_type
12
+ related_to_type: target_type,
13
13
  };
14
14
  yield put(fetchRelations.request());
15
15
  const { data } = yield call(