@truedat/dd 7.11.2 → 7.12.0

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.
Files changed (40) hide show
  1. package/package.json +3 -3
  2. package/src/api/queries.js +285 -28
  3. package/src/components/ImplementationStructuresLoader.js +6 -6
  4. package/src/components/StructureSelectorInputField.js +7 -5
  5. package/src/components/__tests__/ImplementationStructuresLoader.spec.js +5 -5
  6. package/src/components/__tests__/ProfileExecutionLoader.spec.js +1 -1
  7. package/src/components/__tests__/ProfileGroupLoader.spec.js +1 -1
  8. package/src/reducers/__tests__/graph.spec.js +3 -3
  9. package/src/reducers/__tests__/graphLoading.spec.js +3 -3
  10. package/src/reducers/__tests__/graphRedirect.spec.js +3 -3
  11. package/src/reducers/__tests__/structureFields.spec.js +7 -7
  12. package/src/reducers/__tests__/structureImpactGraph.spec.js +3 -3
  13. package/src/reducers/__tests__/structureImpactId.spec.js +3 -3
  14. package/src/reducers/__tests__/structureLineageGraph.spec.js +3 -3
  15. package/src/reducers/__tests__/structureLineageId.spec.js +3 -3
  16. package/src/reducers/__tests__/structureLinks.spec.js +5 -5
  17. package/src/reducers/__tests__/structureRedirect.spec.js +1 -1
  18. package/src/reducers/__tests__/structureRelations.spec.js +1 -1
  19. package/src/reducers/__tests__/structureSystem.spec.js +3 -3
  20. package/src/reducers/graph.js +2 -2
  21. package/src/reducers/graphLoading.js +2 -2
  22. package/src/reducers/graphRedirect.js +2 -2
  23. package/src/reducers/structureFields.js +4 -4
  24. package/src/reducers/structureImpactGraph.js +2 -2
  25. package/src/reducers/structureImpactId.js +2 -2
  26. package/src/reducers/structureLineageGraph.js +2 -2
  27. package/src/reducers/structureLineageId.js +2 -2
  28. package/src/reducers/structureLinks.js +3 -3
  29. package/src/reducers/structureSiblings.js +7 -1
  30. package/src/reducers/structureSystem.js +2 -2
  31. package/src/reducers/structureVersions.js +2 -3
  32. package/src/routines.js +1 -0
  33. package/src/sagas/__tests__/legacyFetchStructure.spec.js +148 -0
  34. package/src/sagas/__tests__/requestGrantRemoval.spec.js +132 -0
  35. package/src/sagas/createGrantRequestStatus.js +1 -0
  36. package/src/sagas/index.js +3 -2
  37. package/src/sagas/legacyFetchStructure.js +55 -0
  38. package/src/sagas/requestGrantRemoval.js +2 -2
  39. package/src/selectors/getStructuresFields.js +3 -2
  40. package/src/selectors/getTabVisibility.js +3 -2
@@ -0,0 +1,55 @@
1
+ import _ from "lodash/fp";
2
+ import { call, put, takeLatest, select, getContext } from "redux-saga/effects";
3
+ import { legacyFetchStructure } from "../routines";
4
+ import { LEGACY_DATA_STRUCTURE_VERSION_QUERY } from "../api/queries";
5
+ import { getStructureFieldColumns } from "../selectors";
6
+
7
+ export function* legacyFetchStructureSaga({ payload }) {
8
+ try {
9
+ const structureFieldColumns = yield select(getStructureFieldColumns);
10
+ const note_fields = _.flow(
11
+ _.filter(({ name }) => name.startsWith("note.")),
12
+ _.map(({ name }) => name.split(".")[1])
13
+ )(structureFieldColumns);
14
+
15
+ const client = yield getContext("client");
16
+
17
+ yield put(legacyFetchStructure.request());
18
+
19
+ const { id, version = "latest" } = payload;
20
+ const {
21
+ data: { dataStructureVersion },
22
+ } = yield call(client.query, {
23
+ fetchPolicy: "network-only",
24
+ query: LEGACY_DATA_STRUCTURE_VERSION_QUERY,
25
+ variables: {
26
+ dataStructureId: id,
27
+ version,
28
+ note_fields,
29
+ },
30
+ });
31
+
32
+ const data = {
33
+ data: dataStructureVersion,
34
+ _actions: dataStructureVersion._actions,
35
+ user_permissions: dataStructureVersion.user_permissions,
36
+ };
37
+
38
+ const meta = { version };
39
+
40
+ yield put({ meta, ...legacyFetchStructure.success(data) });
41
+ } catch (error) {
42
+ if (error.response) {
43
+ const { status, data } = error.response;
44
+ yield put(legacyFetchStructure.failure({ status, data }));
45
+ } else {
46
+ yield put(legacyFetchStructure.failure(error.message));
47
+ }
48
+ } finally {
49
+ yield put(legacyFetchStructure.fulfill());
50
+ }
51
+ }
52
+
53
+ export function* legacyFetchStructureRequestSaga() {
54
+ yield takeLatest(legacyFetchStructure.TRIGGER, legacyFetchStructureSaga);
55
+ }
@@ -3,7 +3,7 @@ import { call, put, takeLatest } from "redux-saga/effects";
3
3
  import { apiJsonPatch, JSON_OPTS } from "@truedat/core/services/api";
4
4
  import {
5
5
  requestGrantRemoval,
6
- fetchStructure,
6
+ legacyFetchStructure,
7
7
  fetchStructures,
8
8
  } from "../routines";
9
9
  import { API_GRANT } from "../api";
@@ -21,7 +21,7 @@ export function* requestGrantRemovalSaga({ payload }) {
21
21
  yield put(
22
22
  previousStructureQuery
23
23
  ? fetchStructures.trigger(previousStructureQuery)
24
- : fetchStructure.trigger({ id: data_structure_id, version })
24
+ : legacyFetchStructure.trigger({ id: data_structure_id, version })
25
25
  );
26
26
  } catch (error) {
27
27
  if (error.response) {
@@ -43,6 +43,7 @@ const getFieldsFromStructures = (structuresFields, parentStructures) =>
43
43
 
44
44
  export const getStructuresFields = createSelector(
45
45
  [_.propOr([], "structuresFields"), _.propOr([], "parentStructures")],
46
- (structuresFields, parentStructures) =>
47
- getFieldsFromStructures(structuresFields, parentStructures)
46
+ (structuresFields, parentStructures) => {
47
+ return getFieldsFromStructures(structuresFields, parentStructures);
48
+ }
48
49
  );
@@ -59,9 +59,10 @@ const eventsTabVisible = _.flow(
59
59
  );
60
60
  const grantsTabVisible = (state) => state?.structure?.grants_count > 0;
61
61
 
62
- const metatadaVisible = (state) => !_.isEmpty(_.path(["structure", "structure_type", "metadata_views"])(state))
62
+ const metatadaVisible = (state) =>
63
+ !_.isEmpty(_.path(["structure", "structure_type", "metadata_views"])(state));
63
64
 
64
- export const getTabVisibility = createSelector([state => state], (state) => ({
65
+ export const getTabVisibility = createSelector([(state) => state], (state) => ({
65
66
  fields: fieldsTabVisible(state),
66
67
  profile: profileTabVisible(state),
67
68
  links: linksTabVisible(state),