@databiosphere/findable-ui 16.1.0 → 17.0.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 (84) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +11 -0
  3. package/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand.d.ts +3 -2
  4. package/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand.js +6 -4
  5. package/lib/components/Export/components/ExportForm/components/ExportManifestDownloadFormatForm/exportManifestDownloadFormatForm.d.ts +3 -2
  6. package/lib/components/Export/components/ExportForm/components/ExportManifestDownloadFormatForm/exportManifestDownloadFormatForm.js +2 -12
  7. package/lib/components/Export/components/ExportToTerra/components/ExportToTerraForm/exportToTerraForm.d.ts +5 -2
  8. package/lib/components/Export/components/ExportToTerra/components/ExportToTerraForm/exportToTerraForm.js +2 -2
  9. package/lib/components/Export/components/ExportToTerra/components/ExportToTerraNotStarted/exportToTerraNotStarted.d.ts +3 -1
  10. package/lib/components/Export/components/ExportToTerra/components/ExportToTerraNotStarted/exportToTerraNotStarted.js +2 -2
  11. package/lib/components/Export/components/ExportToTerra/exportToTerra.d.ts +1 -1
  12. package/lib/components/Export/components/ExportToTerra/exportToTerra.js +9 -6
  13. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/manifestDownloadEntity.d.ts +3 -1
  14. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/manifestDownloadEntity.js +3 -4
  15. package/lib/components/Export/components/ManifestDownload/manifestDownload.d.ts +3 -2
  16. package/lib/components/Export/components/ManifestDownload/manifestDownload.js +6 -4
  17. package/lib/hooks/types.d.ts +4 -0
  18. package/lib/hooks/types.js +5 -0
  19. package/lib/hooks/useFileManifest/common/entities.d.ts +0 -5
  20. package/lib/hooks/useFileManifest/common/entities.js +0 -6
  21. package/lib/hooks/useFileManifest/useFileManifest.d.ts +8 -5
  22. package/lib/hooks/useFileManifest/useFileManifest.js +29 -8
  23. package/lib/hooks/useFileManifest/useFileManifestDownload.js +10 -9
  24. package/lib/hooks/useFileManifest/useFileManifestFormat.d.ts +12 -0
  25. package/lib/hooks/useFileManifest/useFileManifestFormat.js +10 -0
  26. package/lib/hooks/useRequestFileLocation.d.ts +1 -4
  27. package/lib/hooks/useRequestFileLocation.js +1 -5
  28. package/lib/hooks/useRequestManifest/constants.d.ts +2 -0
  29. package/lib/hooks/useRequestManifest/constants.js +4 -0
  30. package/lib/hooks/useRequestManifest/types.d.ts +6 -0
  31. package/lib/hooks/useRequestManifest/types.js +1 -0
  32. package/lib/hooks/useRequestManifest/useRequestManifest.d.ts +10 -0
  33. package/lib/hooks/useRequestManifest/useRequestManifest.js +30 -0
  34. package/lib/hooks/useRequestManifest/utils.d.ts +65 -0
  35. package/lib/hooks/useRequestManifest/utils.js +118 -0
  36. package/lib/mocks/useRequestFileManifest.mocks.d.ts +11 -0
  37. package/lib/mocks/useRequestFileManifest.mocks.js +100 -0
  38. package/lib/providers/fileManifestState/constants.d.ts +0 -2
  39. package/lib/providers/fileManifestState/constants.js +0 -11
  40. package/lib/providers/fileManifestState.d.ts +3 -25
  41. package/lib/providers/fileManifestState.js +3 -36
  42. package/lib/views/ExportView/exportView.js +2 -2
  43. package/package.json +1 -1
  44. package/src/components/Export/components/DownloadCurlCommand/downloadCurlCommand.tsx +17 -10
  45. package/src/components/Export/components/ExportForm/components/ExportManifestDownloadFormatForm/exportManifestDownloadFormatForm.tsx +7 -16
  46. package/src/components/Export/components/ExportToTerra/components/ExportToTerraForm/exportToTerraForm.tsx +8 -4
  47. package/src/components/Export/components/ExportToTerra/components/ExportToTerraNotStarted/exportToTerraNotStarted.tsx +4 -1
  48. package/src/components/Export/components/ExportToTerra/exportToTerra.tsx +13 -9
  49. package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/manifestDownloadEntity.tsx +4 -9
  50. package/src/components/Export/components/ManifestDownload/manifestDownload.tsx +17 -11
  51. package/src/hooks/types.ts +4 -0
  52. package/src/hooks/useFileManifest/common/entities.ts +0 -6
  53. package/src/hooks/useFileManifest/useFileManifest.ts +34 -13
  54. package/src/hooks/useFileManifest/useFileManifestDownload.ts +21 -16
  55. package/src/hooks/useFileManifest/useFileManifestFormat.ts +23 -0
  56. package/src/hooks/useRequestFileLocation.ts +1 -5
  57. package/src/hooks/useRequestManifest/constants.ts +6 -0
  58. package/src/hooks/useRequestManifest/types.ts +7 -0
  59. package/src/hooks/useRequestManifest/useRequestManifest.ts +49 -0
  60. package/src/hooks/useRequestManifest/utils.ts +153 -0
  61. package/src/mocks/useRequestFileManifest.mocks.ts +121 -0
  62. package/src/providers/fileManifestState/constants.ts +0 -15
  63. package/src/providers/fileManifestState.tsx +5 -77
  64. package/src/views/ExportView/exportView.tsx +2 -2
  65. package/tests/buildRequestFilters.test.ts +68 -0
  66. package/tests/buildRequestManifest.test.ts +103 -0
  67. package/tests/useRequestManifest.test.ts +193 -0
  68. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +0 -15
  69. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +0 -28
  70. package/lib/hooks/useFileManifest/useFileManifestURL.d.ts +0 -5
  71. package/lib/hooks/useFileManifest/useFileManifestURL.js +0 -11
  72. package/lib/hooks/useFileManifest/useRequestFileManifest.d.ts +0 -11
  73. package/lib/hooks/useFileManifest/useRequestFileManifest.js +0 -40
  74. package/lib/providers/fileManifestState/actions.d.ts +0 -9
  75. package/lib/providers/fileManifestState/actions.js +0 -19
  76. package/lib/providers/fileManifestState/utils.d.ts +0 -34
  77. package/lib/providers/fileManifestState/utils.js +0 -80
  78. package/src/hooks/useFileManifest/common/buildFileManifestRequestURL.ts +0 -44
  79. package/src/hooks/useFileManifest/useFileManifestURL.ts +0 -12
  80. package/src/hooks/useFileManifest/useRequestFileManifest.ts +0 -51
  81. package/src/providers/fileManifestState/actions.ts +0 -34
  82. package/src/providers/fileManifestState/utils.ts +0 -108
  83. package/tests/fileManifestRequestFilters.test.ts +0 -160
  84. package/tests/updateFilesFacetsStatus.test.ts +0 -84
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "16.1.0"
2
+ ".": "17.0.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [17.0.0](https://github.com/DataBiosphere/findable-ui/compare/v16.1.0...v17.0.0) (2024-12-12)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * exports via main button don't include orphans ([#287](https://github.com/DataBiosphere/findable-ui/issues/287)) (#288)
9
+
10
+ ### Features
11
+
12
+ * exports via main button don't include orphans ([#287](https://github.com/DataBiosphere/findable-ui/issues/287)) ([#288](https://github.com/DataBiosphere/findable-ui/issues/288)) ([86e3e40](https://github.com/DataBiosphere/findable-ui/commit/86e3e4047cce84a90348719c9ca7b41a3a93e4c3))
13
+
3
14
  ## [16.1.0](https://github.com/DataBiosphere/findable-ui/compare/v16.0.0...v16.1.0) (2024-12-12)
4
15
 
5
16
 
@@ -2,7 +2,7 @@ import { ElementType } from "react";
2
2
  import { Filters } from "../../../../common/entities";
3
3
  import { FileManifestType } from "../../../../hooks/useFileManifest/common/entities";
4
4
  import { FileManifestState } from "../../../../providers/fileManifestState";
5
- import { FormFacet } from "../../common/entities";
5
+ import { FormFacet, ManifestDownloadFormat } from "../../common/entities";
6
6
  interface DownloadCurlCommandProps {
7
7
  DownloadCurlForm: ElementType;
8
8
  DownloadCurlStart: ElementType;
@@ -12,6 +12,7 @@ interface DownloadCurlCommandProps {
12
12
  fileSummaryFacetName: string;
13
13
  filters: Filters;
14
14
  formFacet: FormFacet;
15
+ manifestDownloadFormat?: ManifestDownloadFormat;
15
16
  }
16
- export declare const DownloadCurlCommand: ({ DownloadCurlForm, DownloadCurlStart, DownloadCurlSuccess, fileManifestState, fileManifestType, fileSummaryFacetName, filters, formFacet, }: DownloadCurlCommandProps) => JSX.Element;
17
+ export declare const DownloadCurlCommand: ({ DownloadCurlForm, DownloadCurlStart, DownloadCurlSuccess, fileManifestState, fileSummaryFacetName, filters, formFacet, manifestDownloadFormat, }: DownloadCurlCommandProps) => JSX.Element;
17
18
  export {};
@@ -2,16 +2,18 @@ import React, { useState } from "react";
2
2
  import { MANIFEST_DOWNLOAD_FORMAT } from "../../../../apis/azul/common/entities";
3
3
  import { useExploreState } from "../../../../hooks/useExploreState";
4
4
  import { useFileManifest } from "../../../../hooks/useFileManifest/useFileManifest";
5
- import { useRequestFileManifest } from "../../../../hooks/useFileManifest/useRequestFileManifest";
5
+ import { useRequestFileLocation, } from "../../../../hooks/useRequestFileLocation";
6
+ import { useRequestManifest } from "../../../../hooks/useRequestManifest/useRequestManifest";
6
7
  import { BULK_DOWNLOAD_EXECUTION_ENVIRONMENT, } from "../../common/entities";
7
8
  import { trackBulkDownloadRequested } from "../../common/tracking";
8
9
  import { DownloadCurlCommandNotStarted } from "./components/DownloadCurlCommandNotStarted/downloadCurlCommandNotStarted";
9
10
  import { DownloadCurlCommandReady } from "./components/DownloadCurlCommandReady/downloadCurlCommandReady";
10
- export const DownloadCurlCommand = ({ DownloadCurlForm, DownloadCurlStart, DownloadCurlSuccess, fileManifestState, fileManifestType, fileSummaryFacetName, filters, formFacet, }) => {
11
- useRequestFileManifest(fileManifestType, MANIFEST_DOWNLOAD_FORMAT.CURL, filters, fileSummaryFacetName);
11
+ export const DownloadCurlCommand = ({ DownloadCurlForm, DownloadCurlStart, DownloadCurlSuccess, fileManifestState, fileSummaryFacetName, filters, formFacet, manifestDownloadFormat = MANIFEST_DOWNLOAD_FORMAT.CURL, }) => {
12
+ useFileManifest(filters, fileSummaryFacetName);
12
13
  const [executionEnvironment, setExecutionEnvironment] = useState(BULK_DOWNLOAD_EXECUTION_ENVIRONMENT.BASH);
13
14
  const { exploreState: { tabValue: entityList }, } = useExploreState();
14
- const { data, isLoading, run } = useFileManifest();
15
+ const { requestMethod, requestUrl } = useRequestManifest(manifestDownloadFormat, formFacet);
16
+ const { data, isLoading, run } = useRequestFileLocation(requestUrl, requestMethod);
15
17
  const curlCommand = getBulkDownloadCurlCommand(data, executionEnvironment);
16
18
  return curlCommand ? (React.createElement(DownloadCurlCommandReady, { curlCommand: curlCommand, DownloadCurlSuccess: DownloadCurlSuccess })) : (React.createElement(DownloadCurlCommandNotStarted, { DownloadCurlForm: DownloadCurlForm, DownloadCurlStart: DownloadCurlStart, executionEnvironment: executionEnvironment, fileManifestState: fileManifestState, formFacet: formFacet, isLoading: isLoading, onRequestManifest: () => {
17
19
  // Execute GTM tracking.
@@ -1,6 +1,7 @@
1
+ import { FileManifestFormatState } from "../../../../../../hooks/useFileManifest/useFileManifestFormat";
1
2
  import { ManifestDownloadFormat } from "../../../../common/entities";
2
3
  export interface ExportManifestDownloadFormatFormProps {
3
- manifestDownloadFormat?: ManifestDownloadFormat;
4
+ fileManifestFormatState: FileManifestFormatState;
4
5
  manifestDownloadFormats: ManifestDownloadFormat[];
5
6
  }
6
- export declare const ExportManifestDownloadFormatForm: ({ manifestDownloadFormat, manifestDownloadFormats, }: ExportManifestDownloadFormatFormProps) => JSX.Element;
7
+ export declare const ExportManifestDownloadFormatForm: ({ fileManifestFormatState, manifestDownloadFormats, }: ExportManifestDownloadFormatFormProps) => JSX.Element;
@@ -1,20 +1,10 @@
1
1
  import { FormControlLabel, FormLabel, Radio, RadioGroup } from "@mui/material";
2
2
  import React from "react";
3
- import { useFileManifestState } from "../../../../../../hooks/useFileManifestState";
4
- import { FileManifestActionKind } from "../../../../../../providers/fileManifestState";
5
3
  import { RadioCheckedIcon } from "../../../../../common/CustomIcon/components/RadioCheckedIcon/radioCheckedIcon";
6
4
  import { RadioUncheckedIcon } from "../../../../../common/CustomIcon/components/RadioUncheckedIcon/radioUncheckedIcon";
7
5
  import { FormControl } from "../../exportForm.styles";
8
- export const ExportManifestDownloadFormatForm = ({ manifestDownloadFormat, manifestDownloadFormats, }) => {
9
- const { fileManifestDispatch } = useFileManifestState();
10
- // Updates file manifest format state.
11
- const onUpdateManifestFormat = (format) => {
12
- fileManifestDispatch({
13
- payload: format,
14
- type: FileManifestActionKind.UpdateFileManifestFormat,
15
- });
16
- };
6
+ export const ExportManifestDownloadFormatForm = ({ fileManifestFormatState, manifestDownloadFormats, }) => {
17
7
  return (React.createElement(FormControl, null,
18
8
  React.createElement(FormLabel, null, "Download Format"),
19
- React.createElement(RadioGroup, { value: manifestDownloadFormat ?? "" }, manifestDownloadFormats.map((manifestFormat) => (React.createElement(FormControlLabel, { control: React.createElement(Radio, { checkedIcon: React.createElement(RadioCheckedIcon, null), icon: React.createElement(RadioUncheckedIcon, null), onChange: () => onUpdateManifestFormat(manifestFormat), size: "small", value: manifestFormat }), key: manifestFormat, label: manifestFormat }))))));
9
+ React.createElement(RadioGroup, { value: fileManifestFormatState.fileManifestFormat ?? "" }, manifestDownloadFormats.map((manifestFormat) => (React.createElement(FormControlLabel, { control: React.createElement(Radio, { checkedIcon: React.createElement(RadioCheckedIcon, null), icon: React.createElement(RadioUncheckedIcon, null), onChange: () => fileManifestFormatState.setFileManifestFormat(manifestFormat), size: "small", value: manifestFormat }), key: manifestFormat, label: manifestFormat }))))));
20
10
  };
@@ -1,10 +1,13 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ import { FileManifestFormatState } from "../../../../../../hooks/useFileManifest/useFileManifestFormat";
1
3
  import { FormFacet, ManifestDownloadFormat } from "../../../../common/entities";
2
4
  import { OnRequestManifestFn } from "../../../ExportForm/exportForm";
3
5
  export interface ExportToTerraFormProps {
6
+ fileManifestFormatState: FileManifestFormatState;
4
7
  formFacet: FormFacet;
5
8
  isLoading: boolean;
6
- manifestDownloadFormat?: ManifestDownloadFormat;
7
9
  manifestDownloadFormats: ManifestDownloadFormat[];
8
10
  onRequestManifest: OnRequestManifestFn;
11
+ setFileManifestFormat: Dispatch<SetStateAction<ManifestDownloadFormat | undefined>>;
9
12
  }
10
- export declare const ExportToTerraForm: ({ formFacet, isLoading, manifestDownloadFormat, manifestDownloadFormats, onRequestManifest, }: ExportToTerraFormProps) => JSX.Element;
13
+ export declare const ExportToTerraForm: ({ fileManifestFormatState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }: ExportToTerraFormProps) => JSX.Element;
@@ -2,9 +2,9 @@ import React from "react";
2
2
  import { ExportButton } from "../../../ExportForm/components/ExportButton/exportButton";
3
3
  import { ExportManifestDownloadFormatForm } from "../../../ExportForm/components/ExportManifestDownloadFormatForm/exportManifestDownloadFormatForm";
4
4
  import { ExportForm, } from "../../../ExportForm/exportForm";
5
- export const ExportToTerraForm = ({ formFacet, isLoading, manifestDownloadFormat, manifestDownloadFormats, onRequestManifest, }) => {
5
+ export const ExportToTerraForm = ({ fileManifestFormatState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }) => {
6
6
  return (React.createElement(ExportForm, { Button: renderButton, formFacet: formFacet, isLoading: isLoading, onRequestManifest: onRequestManifest },
7
- React.createElement(ExportManifestDownloadFormatForm, { manifestDownloadFormat: manifestDownloadFormat, manifestDownloadFormats: manifestDownloadFormats })));
7
+ React.createElement(ExportManifestDownloadFormatForm, { fileManifestFormatState: fileManifestFormatState, manifestDownloadFormats: manifestDownloadFormats })));
8
8
  };
9
9
  /**
10
10
  * Build the export button.
@@ -1,14 +1,16 @@
1
1
  import { ElementType } from "react";
2
+ import { FileManifestFormatState } from "../../../../../../hooks/useFileManifest/useFileManifestFormat";
2
3
  import { FileManifestState } from "../../../../../../providers/fileManifestState";
3
4
  import { FormFacet, ManifestDownloadFormat } from "../../../../common/entities";
4
5
  import { OnRequestManifestFn } from "../../../ExportForm/exportForm";
5
6
  export interface ExportToTerraNotStartedProps {
6
7
  ExportTerraForm: ElementType;
7
8
  ExportToTerraStart: ElementType;
9
+ fileManifestFormatState: FileManifestFormatState;
8
10
  fileManifestState: FileManifestState;
9
11
  formFacet: FormFacet;
10
12
  isLoading: boolean;
11
13
  manifestDownloadFormats: ManifestDownloadFormat[];
12
14
  onRequestManifest: OnRequestManifestFn;
13
15
  }
14
- export declare const ExportToTerraNotStarted: ({ ExportTerraForm, ExportToTerraStart, fileManifestState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }: ExportToTerraNotStartedProps) => JSX.Element;
16
+ export declare const ExportToTerraNotStarted: ({ ExportTerraForm, ExportToTerraStart, fileManifestFormatState, fileManifestState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }: ExportToTerraNotStartedProps) => JSX.Element;
@@ -3,12 +3,12 @@ import { PAPER_PANEL_STYLE } from "../../../../../common/Paper/paper";
3
3
  import { FluidPaper } from "../../../../../common/Paper/paper.styles";
4
4
  import { Loading } from "../../../../../Loading/loading";
5
5
  import { Section, SectionContent } from "../../../../export.styles";
6
- export const ExportToTerraNotStarted = ({ ExportTerraForm, ExportToTerraStart, fileManifestState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }) => {
6
+ export const ExportToTerraNotStarted = ({ ExportTerraForm, ExportToTerraStart, fileManifestFormatState, fileManifestState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }) => {
7
7
  return (React.createElement("div", null,
8
8
  React.createElement(Loading, { loading: isLoading, panelStyle: PAPER_PANEL_STYLE.FLUID, text: "Your link will be ready shortly..." }),
9
9
  React.createElement(FluidPaper, null,
10
10
  React.createElement(Section, null,
11
11
  React.createElement(SectionContent, null,
12
12
  React.createElement(ExportToTerraStart, null)),
13
- React.createElement(ExportTerraForm, { formFacet: formFacet, isLoading: fileManifestState.isLoading, manifestDownloadFormat: fileManifestState.fileManifestFormat, manifestDownloadFormats: manifestDownloadFormats, onRequestManifest: onRequestManifest })))));
13
+ React.createElement(ExportTerraForm, { fileManifestFormatState: fileManifestFormatState, formFacet: formFacet, isLoading: fileManifestState.isLoading, manifestDownloadFormats: manifestDownloadFormats, onRequestManifest: onRequestManifest })))));
14
14
  };
@@ -15,4 +15,4 @@ export interface ExportToTerraProps {
15
15
  manifestDownloadFormat?: ManifestDownloadFormat;
16
16
  manifestDownloadFormats: ManifestDownloadFormat[];
17
17
  }
18
- export declare const ExportToTerra: ({ ExportForm, ExportToTerraStart, ExportToTerraSuccess, fileManifestState, fileManifestType, fileSummaryFacetName, filters, formFacet, manifestDownloadFormat, manifestDownloadFormats, }: ExportToTerraProps) => JSX.Element;
18
+ export declare const ExportToTerra: ({ ExportForm, ExportToTerraStart, ExportToTerraSuccess, fileManifestState, fileSummaryFacetName, filters, formFacet, manifestDownloadFormat, manifestDownloadFormats, }: ExportToTerraProps) => JSX.Element;
@@ -2,17 +2,20 @@ import React from "react";
2
2
  import { useExploreState } from "../../../../hooks/useExploreState";
3
3
  import { useExportToTerraResponseURL } from "../../../../hooks/useExportToTerraResponseURL";
4
4
  import { useFileManifest } from "../../../../hooks/useFileManifest/useFileManifest";
5
- import { useRequestFileManifest } from "../../../../hooks/useFileManifest/useRequestFileManifest";
5
+ import { useFileManifestFormat } from "../../../../hooks/useFileManifest/useFileManifestFormat";
6
+ import { useRequestFileLocation } from "../../../../hooks/useRequestFileLocation";
7
+ import { useRequestManifest } from "../../../../hooks/useRequestManifest/useRequestManifest";
6
8
  import { trackExportToTerraRequested } from "../../common/tracking";
7
9
  import { ExportToTerraNotStarted } from "./components/ExportToTerraNotStarted/exportToTerraNotStarted";
8
10
  import { ExportToTerraReady } from "./components/ExportToTerraReady/exportToTerraReady";
9
- export const ExportToTerra = ({ ExportForm, ExportToTerraStart, ExportToTerraSuccess, fileManifestState, fileManifestType, fileSummaryFacetName, filters, formFacet, manifestDownloadFormat, manifestDownloadFormats, }) => {
11
+ export const ExportToTerra = ({ ExportForm, ExportToTerraStart, ExportToTerraSuccess, fileManifestState, fileSummaryFacetName, filters, formFacet, manifestDownloadFormat, manifestDownloadFormats, }) => {
10
12
  const { exploreState: { tabValue: entityList }, } = useExploreState();
11
- useRequestFileManifest(fileManifestType, manifestDownloadFormat, filters, fileSummaryFacetName);
12
- const { requestParams } = fileManifestState;
13
- const { data, isLoading, run } = useFileManifest();
13
+ useFileManifest(filters, fileSummaryFacetName);
14
+ const fileManifestFormatState = useFileManifestFormat(manifestDownloadFormat);
15
+ const { requestMethod, requestParams, requestUrl } = useRequestManifest(fileManifestFormatState.fileManifestFormat, formFacet);
16
+ const { data, isLoading, run } = useRequestFileLocation(requestUrl, requestMethod);
14
17
  const exportURL = useExportToTerraResponseURL(requestParams, data);
15
- return exportURL ? (React.createElement(ExportToTerraReady, { ExportToTerraSuccess: ExportToTerraSuccess, exportURL: exportURL })) : (React.createElement(ExportToTerraNotStarted, { ExportTerraForm: ExportForm, ExportToTerraStart: ExportToTerraStart, fileManifestState: fileManifestState, formFacet: formFacet, isLoading: isLoading, manifestDownloadFormats: manifestDownloadFormats, onRequestManifest: () => {
18
+ return exportURL ? (React.createElement(ExportToTerraReady, { ExportToTerraSuccess: ExportToTerraSuccess, exportURL: exportURL })) : (React.createElement(ExportToTerraNotStarted, { ExportTerraForm: ExportForm, ExportToTerraStart: ExportToTerraStart, fileManifestFormatState: fileManifestFormatState, fileManifestState: fileManifestState, formFacet: formFacet, isLoading: isLoading, manifestDownloadFormats: manifestDownloadFormats, onRequestManifest: () => {
16
19
  // Execute GA tracking
17
20
  trackExportToTerraRequested(entityList);
18
21
  // Request manifest
@@ -1,8 +1,10 @@
1
1
  import { Filters } from "../../../../../../common/entities";
2
2
  import { FileManifestType } from "../../../../../../hooks/useFileManifest/common/entities";
3
+ import { ManifestDownloadFormat } from "../../../../common/entities";
3
4
  export interface ManifestDownloadEntityProps {
4
5
  fileManifestType: FileManifestType;
5
6
  filters: Filters;
7
+ manifestDownloadFormat?: ManifestDownloadFormat;
6
8
  metadataFilters: Filters;
7
9
  }
8
- export declare const ManifestDownloadEntity: ({ fileManifestType, filters, metadataFilters, }: ManifestDownloadEntityProps) => JSX.Element;
10
+ export declare const ManifestDownloadEntity: ({ filters, metadataFilters, }: ManifestDownloadEntityProps) => JSX.Element;
@@ -1,10 +1,9 @@
1
1
  import React from "react";
2
- import { MANIFEST_DOWNLOAD_FORMAT } from "../../../../../../apis/azul/common/entities";
3
- import { useRequestFileManifest } from "../../../../../../hooks/useFileManifest/useRequestFileManifest";
2
+ import { useFileManifest } from "../../../../../../hooks/useFileManifest/useFileManifest";
4
3
  import { FileManifestDownload } from "./components/FileManifestDownload/fileManifestDownload";
5
4
  import { FileManifestSpreadsheet } from "./components/FileManifestSpreadsheet/fileManifestSpreadsheet";
6
- export const ManifestDownloadEntity = ({ fileManifestType, filters, metadataFilters, }) => {
7
- useRequestFileManifest(fileManifestType, MANIFEST_DOWNLOAD_FORMAT.COMPACT, filters, undefined);
5
+ export const ManifestDownloadEntity = ({ filters, metadataFilters, }) => {
6
+ useFileManifest(filters, undefined);
8
7
  return (React.createElement(React.Fragment, null,
9
8
  React.createElement(FileManifestSpreadsheet, { filters: metadataFilters }),
10
9
  React.createElement(FileManifestDownload, { filters: filters })));
@@ -2,7 +2,7 @@ import { ElementType } from "react";
2
2
  import { Filters } from "../../../../common/entities";
3
3
  import { FileManifestType } from "../../../../hooks/useFileManifest/common/entities";
4
4
  import { FileManifestState } from "../../../../providers/fileManifestState";
5
- import { FormFacet } from "../../common/entities";
5
+ import { FormFacet, ManifestDownloadFormat } from "../../common/entities";
6
6
  export interface ManifestDownloadProps {
7
7
  fileManifestState: FileManifestState;
8
8
  fileManifestType: FileManifestType;
@@ -10,7 +10,8 @@ export interface ManifestDownloadProps {
10
10
  filters: Filters;
11
11
  formFacet: FormFacet;
12
12
  ManifestDownloadForm: ElementType;
13
+ manifestDownloadFormat?: ManifestDownloadFormat;
13
14
  ManifestDownloadStart: ElementType;
14
15
  ManifestDownloadSuccess: ElementType;
15
16
  }
16
- export declare const ManifestDownload: ({ fileManifestState, fileManifestType, fileSummaryFacetName, filters, formFacet, ManifestDownloadForm, ManifestDownloadStart, ManifestDownloadSuccess, }: ManifestDownloadProps) => JSX.Element;
17
+ export declare const ManifestDownload: ({ fileManifestState, fileSummaryFacetName, filters, formFacet, ManifestDownloadForm, manifestDownloadFormat, ManifestDownloadStart, ManifestDownloadSuccess, }: ManifestDownloadProps) => JSX.Element;
@@ -2,14 +2,16 @@ import React from "react";
2
2
  import { MANIFEST_DOWNLOAD_FORMAT } from "../../../../apis/azul/common/entities";
3
3
  import { useExploreState } from "../../../../hooks/useExploreState";
4
4
  import { useFileManifest } from "../../../../hooks/useFileManifest/useFileManifest";
5
- import { useRequestFileManifest } from "../../../../hooks/useFileManifest/useRequestFileManifest";
5
+ import { useRequestFileLocation, } from "../../../../hooks/useRequestFileLocation";
6
+ import { useRequestManifest } from "../../../../hooks/useRequestManifest/useRequestManifest";
6
7
  import { trackFileManifestRequested } from "../../common/tracking";
7
8
  import { ManifestDownloadNotStarted } from "./components/ManifestDownloadNotStarted/manifestDownloadNotStarted";
8
9
  import { ManifestDownloadReady } from "./components/ManifestDownloadReady/manifestDownloadReady";
9
- export const ManifestDownload = ({ fileManifestState, fileManifestType, fileSummaryFacetName, filters, formFacet, ManifestDownloadForm, ManifestDownloadStart, ManifestDownloadSuccess, }) => {
10
- useRequestFileManifest(fileManifestType, MANIFEST_DOWNLOAD_FORMAT.COMPACT, filters, fileSummaryFacetName);
10
+ export const ManifestDownload = ({ fileManifestState, fileSummaryFacetName, filters, formFacet, ManifestDownloadForm, manifestDownloadFormat = MANIFEST_DOWNLOAD_FORMAT.COMPACT, ManifestDownloadStart, ManifestDownloadSuccess, }) => {
11
+ useFileManifest(filters, fileSummaryFacetName);
11
12
  const { exploreState: { tabValue: entityList }, } = useExploreState();
12
- const { data, isLoading, run } = useFileManifest();
13
+ const { requestMethod, requestUrl } = useRequestManifest(manifestDownloadFormat, formFacet);
14
+ const { data, isLoading, run } = useRequestFileLocation(requestUrl, requestMethod);
13
15
  const manifestURL = getManifestDownloadURL(data);
14
16
  return manifestURL ? (React.createElement(ManifestDownloadReady, { ManifestDownloadSuccess: ManifestDownloadSuccess, manifestURL: manifestURL })) : (React.createElement(ManifestDownloadNotStarted, { ManifestDownloadForm: ManifestDownloadForm, ManifestDownloadStart: ManifestDownloadStart, fileManifestState: fileManifestState, formFacet: formFacet, isLoading: isLoading, onRequestManifest: () => {
15
17
  trackFileManifestRequested(entityList);
@@ -0,0 +1,4 @@
1
+ export declare enum METHOD {
2
+ GET = "GET",
3
+ PUT = "PUT"
4
+ }
@@ -0,0 +1,5 @@
1
+ export var METHOD;
2
+ (function (METHOD) {
3
+ METHOD["GET"] = "GET";
4
+ METHOD["PUT"] = "PUT";
5
+ })(METHOD || (METHOD = {}));
@@ -38,11 +38,6 @@ export declare enum FILE_MANIFEST_TYPE {
38
38
  EXPORT_TO_TERRA = "EXPORT_TO_TERRA"
39
39
  }
40
40
  export type FileManifestType = FILE_MANIFEST_TYPE;
41
- export declare enum FILES_FACETS_STATUS {
42
- COMPLETED = "COMPLETED",
43
- IN_PROGRESS = "IN_PROGRESS",
44
- NOT_STARTED = "NOT_STARTED"
45
- }
46
41
  export type SelectedSearchTermsBySearchKey = Map<CategoryKey, Set<CategoryValueKey>>;
47
42
  /**
48
43
  * Model of an individual facet value. For example, the term "Homo Sapiens" contained in the facet "Species".
@@ -7,9 +7,3 @@ export var FILE_MANIFEST_TYPE;
7
7
  FILE_MANIFEST_TYPE["ENTITY_EXPORT_TO_TERRA"] = "ENTITY_EXPORT_TO_TERRA";
8
8
  FILE_MANIFEST_TYPE["EXPORT_TO_TERRA"] = "EXPORT_TO_TERRA";
9
9
  })(FILE_MANIFEST_TYPE || (FILE_MANIFEST_TYPE = {}));
10
- export var FILES_FACETS_STATUS;
11
- (function (FILES_FACETS_STATUS) {
12
- FILES_FACETS_STATUS["COMPLETED"] = "COMPLETED";
13
- FILES_FACETS_STATUS["IN_PROGRESS"] = "IN_PROGRESS";
14
- FILES_FACETS_STATUS["NOT_STARTED"] = "NOT_STARTED";
15
- })(FILES_FACETS_STATUS || (FILES_FACETS_STATUS = {}));
@@ -1,7 +1,10 @@
1
- import { UseRequestFileLocationResult } from "../useRequestFileLocation";
1
+ import { Filters } from "../../common/entities";
2
2
  /**
3
- * Requests file manifest.
4
- * @param requestURL - Request URL.
5
- * @returns file manifest request response, function and status.
3
+ * Initializes the file manifest with specified filters and a file summary facet name.
4
+ * This hook sets up the file manifest state by dispatching an action to fetch the manifest
5
+ * based on the provided initial filters and file summary facet name. It also ensures that
6
+ * the manifest state is cleared when the component is unmounted.
7
+ * @param initialFilters - The initial filters used to fetch the file manifest.
8
+ * @param fileSummaryFacetName - The name of the file summary facet to be used in the file manifest request.
6
9
  */
7
- export declare const useFileManifest: (requestURL?: string) => UseRequestFileLocationResult;
10
+ export declare const useFileManifest: (initialFilters?: Filters | undefined, fileSummaryFacetName?: string) => void;
@@ -1,12 +1,33 @@
1
+ import { useEffect, useState } from "react";
2
+ import { FileManifestActionKind } from "../../providers/fileManifestState";
1
3
  import { useFileManifestState } from "../useFileManifestState";
2
- import { METHOD, useRequestFileLocation, } from "../useRequestFileLocation";
3
4
  /**
4
- * Requests file manifest.
5
- * @param requestURL - Request URL.
6
- * @returns file manifest request response, function and status.
5
+ * Initializes the file manifest with specified filters and a file summary facet name.
6
+ * This hook sets up the file manifest state by dispatching an action to fetch the manifest
7
+ * based on the provided initial filters and file summary facet name. It also ensures that
8
+ * the manifest state is cleared when the component is unmounted.
9
+ * @param initialFilters - The initial filters used to fetch the file manifest.
10
+ * @param fileSummaryFacetName - The name of the file summary facet to be used in the file manifest request.
7
11
  */
8
- export const useFileManifest = (requestURL) => {
9
- const { fileManifestState } = useFileManifestState();
10
- const url = requestURL || fileManifestState.requestURL;
11
- return useRequestFileLocation(url, METHOD.PUT);
12
+ export const useFileManifest = (initialFilters = [], fileSummaryFacetName) => {
13
+ // Initial file manifest filter.
14
+ const [initFilters] = useState(() => initialFilters);
15
+ // File manifest state.
16
+ const { fileManifestDispatch } = useFileManifestState();
17
+ // Fetches file manifest with the given file manifest filters, format.
18
+ useEffect(() => {
19
+ fileManifestDispatch({
20
+ payload: {
21
+ fileSummaryFacetName,
22
+ filters: initFilters,
23
+ },
24
+ type: FileManifestActionKind.FetchFileManifest,
25
+ });
26
+ return () => {
27
+ fileManifestDispatch({
28
+ payload: undefined,
29
+ type: FileManifestActionKind.ClearFileManifest,
30
+ });
31
+ };
32
+ }, [fileManifestDispatch, fileSummaryFacetName, initFilters]);
12
33
  };
@@ -2,9 +2,9 @@ import { useEffect } from "react";
2
2
  import { MANIFEST_DOWNLOAD_FORMAT } from "../../apis/azul/common/entities";
3
3
  import { BULK_DOWNLOAD_EXECUTION_ENVIRONMENT } from "../../components/Export/common/entities";
4
4
  import { useCatalog } from "../useCatalog";
5
- import { buildFileManifestRequestURL } from "./common/buildFileManifestRequestURL";
6
- import { useFileManifest } from "./useFileManifest";
7
- import { useFileManifestURL } from "./useFileManifestURL";
5
+ import { useConfig } from "../useConfig";
6
+ import { useRequestFileLocation, } from "../useRequestFileLocation";
7
+ import { buildRequestManifest } from "../useRequestManifest/utils";
8
8
  /**
9
9
  * Returns file manifest download url and file name.
10
10
  * @param filters - Filters.
@@ -12,13 +12,14 @@ import { useFileManifestURL } from "./useFileManifestURL";
12
12
  * @returns file manifest download url and file name.
13
13
  */
14
14
  export const useFileManifestDownload = (filters, disabled) => {
15
- // Determine file manifest request data URL.
16
- const URL = useFileManifestURL();
15
+ // Retrieve the endpoint URL from configured data source.
16
+ const config = useConfig();
17
+ const endpointUrl = config.config.dataSource.url;
17
18
  // Determine catalog.
18
19
  const catalog = useCatalog(); // catalog should be defined.
19
- // Build request URL.
20
- const { requestURL } = buildFileManifestRequestURL(URL, filters, catalog, MANIFEST_DOWNLOAD_FORMAT.COMPACT) || {};
21
- const { data, isIdle, isLoading, run } = useFileManifest(requestURL);
20
+ // Build request manifest request URL.
21
+ const { requestMethod, requestUrl } = buildRequestManifest(endpointUrl, catalog, filters, MANIFEST_DOWNLOAD_FORMAT.COMPACT);
22
+ const { data, isIdle, isLoading, run } = useRequestFileLocation(requestUrl, requestMethod);
22
23
  const manifestURL = getManifestDownloadURL(data);
23
24
  const fileName = getManifestDownloadFileName(data);
24
25
  // Requests file manifest.
@@ -26,7 +27,7 @@ export const useFileManifestDownload = (filters, disabled) => {
26
27
  if (disabled)
27
28
  return;
28
29
  run();
29
- }, [disabled, requestURL, run]);
30
+ }, [disabled, requestUrl, run]);
30
31
  return {
31
32
  fileName,
32
33
  isIdle,
@@ -0,0 +1,12 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ import { ManifestDownloadFormat } from "../../components/Export/common/entities";
3
+ export interface FileManifestFormatState {
4
+ fileManifestFormat: ManifestDownloadFormat | undefined;
5
+ setFileManifestFormat: Dispatch<SetStateAction<ManifestDownloadFormat | undefined>>;
6
+ }
7
+ /**
8
+ * Facilitates the management of file manifest format state.
9
+ * @param manifestDownloadFormat - The initial manifest download format used to fetch the file manifest.
10
+ * @returns The file manifest format state and a function to set the file manifest format.
11
+ */
12
+ export declare const useFileManifestFormat: (manifestDownloadFormat?: ManifestDownloadFormat) => FileManifestFormatState;
@@ -0,0 +1,10 @@
1
+ import { useState } from "react";
2
+ /**
3
+ * Facilitates the management of file manifest format state.
4
+ * @param manifestDownloadFormat - The initial manifest download format used to fetch the file manifest.
5
+ * @returns The file manifest format state and a function to set the file manifest format.
6
+ */
7
+ export const useFileManifestFormat = (manifestDownloadFormat) => {
8
+ const [fileManifestFormat, setFileManifestFormat] = useState(manifestDownloadFormat);
9
+ return { fileManifestFormat, setFileManifestFormat };
10
+ };
@@ -1,3 +1,4 @@
1
+ import { METHOD } from "./types";
1
2
  export interface FileLocation {
2
3
  commandLine?: {
3
4
  [key: string]: string;
@@ -14,10 +15,6 @@ export interface UseRequestFileLocationResult {
14
15
  run: () => void;
15
16
  }
16
17
  export type Method = METHOD;
17
- export declare enum METHOD {
18
- GET = "GET",
19
- PUT = "PUT"
20
- }
21
18
  /**
22
19
  * Function to make a get request and map the result to camelCase
23
20
  * @param url - url for the get request
@@ -1,12 +1,8 @@
1
1
  import { useCallback, useEffect, useRef } from "react";
2
2
  import { FILE_LOCATION_PENDING, FILE_LOCATION_SUCCESSFULLY, } from "../apis/azul/common/constants";
3
+ import { METHOD } from "./types";
3
4
  import { useAsync } from "./useAsync";
4
5
  import { useAuthentication } from "./useAuthentication/useAuthentication";
5
- export var METHOD;
6
- (function (METHOD) {
7
- METHOD["GET"] = "GET";
8
- METHOD["PUT"] = "PUT";
9
- })(METHOD || (METHOD = {}));
10
6
  /**
11
7
  * Returns fetch request options.
12
8
  * @param accessToken - Access token.
@@ -0,0 +1,2 @@
1
+ import { UseRequestManifest } from "./types";
2
+ export declare const REQUEST_MANIFEST: UseRequestManifest;
@@ -0,0 +1,4 @@
1
+ import { METHOD } from "../types";
2
+ export const REQUEST_MANIFEST = {
3
+ requestMethod: METHOD.PUT,
4
+ };
@@ -0,0 +1,6 @@
1
+ import { Method } from "../useRequestFileLocation";
2
+ export interface UseRequestManifest {
3
+ requestMethod: Method;
4
+ requestParams?: URLSearchParams;
5
+ requestUrl?: string;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ManifestDownloadFormat } from "../../apis/azul/common/entities";
2
+ import { FormFacet } from "../../components/Export/common/entities";
3
+ import { UseRequestManifest } from "./types";
4
+ /**
5
+ * Returns file manifest request method, params and URL.
6
+ * @param fileManifestFormat - File manifest format.
7
+ * @param formFacet - Object containing form related facets.
8
+ * @returns file manifest request method, params and URL.
9
+ */
10
+ export declare const useRequestManifest: (fileManifestFormat: ManifestDownloadFormat | undefined, formFacet: FormFacet) => UseRequestManifest;
@@ -0,0 +1,30 @@
1
+ import { useCatalog } from "../useCatalog";
2
+ import { useConfig } from "../useConfig";
3
+ import { useFileManifestState } from "../useFileManifestState";
4
+ import { REQUEST_MANIFEST } from "./constants";
5
+ import { buildRequestFilters, buildRequestManifest, isCatalogReady, isFileManifestFormatReady, isFileManifestStateReady, isFormSelectionReady, } from "./utils";
6
+ /**
7
+ * Returns file manifest request method, params and URL.
8
+ * @param fileManifestFormat - File manifest format.
9
+ * @param formFacet - Object containing form related facets.
10
+ * @returns file manifest request method, params and URL.
11
+ */
12
+ export const useRequestManifest = (fileManifestFormat, formFacet) => {
13
+ // Retrieve the endpoint URL from configured data source.
14
+ const config = useConfig();
15
+ const endpointUrl = config.config.dataSource.url;
16
+ // Determine catalog.
17
+ const catalog = useCatalog();
18
+ // Retrieve file manifest state.
19
+ const { fileManifestState } = useFileManifestState();
20
+ // Return file manifest request method etc. when conditions are met.
21
+ if (isCatalogReady(catalog) &&
22
+ isFileManifestFormatReady(fileManifestFormat) &&
23
+ isFileManifestStateReady(fileManifestState) &&
24
+ isFormSelectionReady(formFacet)) {
25
+ return buildRequestManifest(endpointUrl, catalog, // Catalog is defined.
26
+ buildRequestFilters(fileManifestState, formFacet), fileManifestFormat // Manifest format is defined.
27
+ );
28
+ }
29
+ return REQUEST_MANIFEST;
30
+ };
@@ -0,0 +1,65 @@
1
+ import { ManifestDownloadFormat } from "../../apis/azul/common/entities";
2
+ import { Filters } from "../../common/entities";
3
+ import { FormFacet } from "../../components/Export/common/entities";
4
+ import { FileManifestState } from "../../providers/fileManifestState";
5
+ import { UseRequestManifest } from "./types";
6
+ /**
7
+ * Returns true if all form facets have all their terms selected.
8
+ * @param formFacet - Form related file facets.
9
+ * @returns true if all form facets have all their terms selected.
10
+ */
11
+ export declare function areAllFormFilterTermsSelected(formFacet: FormFacet): boolean;
12
+ /**
13
+ * Generates the filters for a request URL based on the file manifest state.
14
+ * - **all form facets have all their terms selected** - returns filters from state without form filters.
15
+ * - **at least one form facet has an unselected term** - returns filters from state.
16
+ * @param state - File manifest state.
17
+ * @param formFacet - Form related file facets.
18
+ * @returns filters for the request URL.
19
+ */
20
+ export declare function buildRequestFilters(state: FileManifestState, formFacet: FormFacet): Filters;
21
+ /**
22
+ * Build up file manifest request params and URL query string for the given search results, catalog and format.
23
+ * @param endpointUrl - Data URL.
24
+ * @param catalog - Configured catalog.
25
+ * @param filters - Selected filters.
26
+ * @param manifestFormat - Manifest format.
27
+ * @returns file manifest request params and URL query string.
28
+ */
29
+ export declare function buildRequestManifest(endpointUrl: string, catalog: string, filters: Filters, manifestFormat: ManifestDownloadFormat): Required<UseRequestManifest>;
30
+ /**
31
+ * Returns filters, without form related filters.
32
+ * @param state - File manifest state.
33
+ * @param formFacet - Form related file facets.
34
+ * @returns filters.
35
+ */
36
+ export declare function excludeFullySelectedFormFilters(state: FileManifestState, formFacet: FormFacet): Filters;
37
+ /**
38
+ * Returns true if the catalog is defined.
39
+ * The catalog is defined via the configuration and is required for the file manifest request.
40
+ * @param catalog - Catalog.
41
+ * @returns true if the catalog is defined.
42
+ */
43
+ export declare function isCatalogReady(catalog: string | undefined): boolean;
44
+ /**
45
+ * Returns true if the file manifest state is ready for a request.
46
+ * A file manifest state is considered ready if it is both enabled (`isEnabled` is `true`)
47
+ * and not currently loading (`isLoading` is `false`).
48
+ * @param fileManifestState - File manifest state.
49
+ * @returns true if the file manifest state is ready for a request.
50
+ */
51
+ export declare function isFileManifestStateReady(fileManifestState: FileManifestState): boolean;
52
+ /**
53
+ * Checks if the file manifest format is ready for use.
54
+ * The file manifest format is considered ready if `fileManifestFormat` is defined.
55
+ * @param fileManifestFormat - File manifest format.
56
+ * @returns `true` if the `fileManifestFormat` is defined.
57
+ */
58
+ export declare function isFileManifestFormatReady(fileManifestFormat: ManifestDownloadFormat | undefined): boolean;
59
+ /**
60
+ * Checks if the form is ready to request a manifest.
61
+ * A form is considered ready if all facets have the `selected` term set to `true`.
62
+ * @param formFacet - Form related file facets.
63
+ * @returns `true` if all facets in the form are selected.
64
+ */
65
+ export declare function isFormSelectionReady(formFacet: FormFacet): boolean;