synapse-react-client 4.0.36 → 4.0.37
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/dist/SWC.index.js +1 -1
- package/dist/aridhia-queries/index.js +11 -11
- package/dist/aridhia-queries/useAridhiaQuery.d.ts +1 -0
- package/dist/aridhia-queries/useAridhiaQuery.d.ts.map +1 -1
- package/dist/aridhia-queries/useAridhiaQuery.js +24 -17
- package/dist/aridhia-queries/useAridhiaQuery.js.map +1 -1
- package/dist/assets/icons/emailWithNotification.js +15 -15
- package/dist/assets/icons/emailWithNotification.js.map +1 -1
- package/dist/assets/icons/emailWithNotification.svg +13 -13
- package/dist/components/AccessRequirementList/AccessRequirementList.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/AccessRequirementList.js +124 -117
- package/dist/components/AccessRequirementList/AccessRequirementList.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.js +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.js +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.js +33 -32
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.js.map +1 -1
- package/dist/components/Aridhia/AridhiaAccessStatus.d.ts.map +1 -1
- package/dist/components/Aridhia/AridhiaAccessStatus.js +39 -18
- package/dist/components/Aridhia/AridhiaAccessStatus.js.map +1 -1
- package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.d.ts +32 -0
- package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.d.ts.map +1 -0
- package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.js +285 -0
- package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.js.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarAboutStep.d.ts +4 -0
- package/dist/components/Aridhia/DarWizard/DarAboutStep.d.ts.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarAboutStep.js +17 -0
- package/dist/components/Aridhia/DarWizard/DarAboutStep.js.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarCompleteStep.d.ts +27 -0
- package/dist/components/Aridhia/DarWizard/DarCompleteStep.d.ts.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarCompleteStep.js +96 -0
- package/dist/components/Aridhia/DarWizard/DarCompleteStep.js.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarDestinationStep.d.ts +28 -0
- package/dist/components/Aridhia/DarWizard/DarDestinationStep.d.ts.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarDestinationStep.js +128 -0
- package/dist/components/Aridhia/DarWizard/DarDestinationStep.js.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarProjectStep.d.ts +4 -0
- package/dist/components/Aridhia/DarWizard/DarProjectStep.d.ts.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarProjectStep.js +17 -0
- package/dist/components/Aridhia/DarWizard/DarProjectStep.js.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarSectionForm.d.ts +13 -0
- package/dist/components/Aridhia/DarWizard/DarSectionForm.d.ts.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarSectionForm.js +23 -0
- package/dist/components/Aridhia/DarWizard/DarSectionForm.js.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.d.ts +11 -0
- package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.d.ts.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.js +47 -0
- package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.js.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarWorkspaceStep.d.ts +16 -0
- package/dist/components/Aridhia/DarWizard/DarWorkspaceStep.d.ts.map +1 -0
- package/dist/components/Aridhia/DarWizard/DarWorkspaceStep.js +33 -0
- package/dist/components/Aridhia/DarWizard/DarWorkspaceStep.js.map +1 -0
- package/dist/components/Aridhia/DarWizard/useDarDraft.d.ts +32 -0
- package/dist/components/Aridhia/DarWizard/useDarDraft.d.ts.map +1 -0
- package/dist/components/Aridhia/DarWizard/useDarDraft.js +44 -0
- package/dist/components/Aridhia/DarWizard/useDarDraft.js.map +1 -0
- package/dist/components/Aridhia/FairLabelField.d.ts +8 -0
- package/dist/components/Aridhia/FairLabelField.d.ts.map +1 -0
- package/dist/components/Aridhia/FairLabelField.js +13 -0
- package/dist/components/Aridhia/FairLabelField.js.map +1 -0
- package/dist/components/Aridhia/fairFormToRjsf.d.ts +36 -0
- package/dist/components/Aridhia/fairFormToRjsf.d.ts.map +1 -0
- package/dist/components/Aridhia/fairFormToRjsf.js +137 -0
- package/dist/components/Aridhia/fairFormToRjsf.js.map +1 -0
- package/dist/components/CannedRejectionDialog/CannedRejectionDialog.d.ts.map +1 -1
- package/dist/components/CannedRejectionDialog/CannedRejectionDialog.js +2 -2
- package/dist/components/CannedRejectionDialog/CannedRejectionDialog.js.map +1 -1
- package/dist/components/CardContainer/CardContainer.d.ts.map +1 -1
- package/dist/components/CardContainer/CardContainer.js +1 -1
- package/dist/components/CardContainer/CardContainer.js.map +1 -1
- package/dist/components/ChallengeSubmission/ChallengeSubmission.d.ts.map +1 -1
- package/dist/components/ChallengeSubmission/ChallengeSubmission.js +2 -2
- package/dist/components/ChallengeSubmission/ChallengeSubmission.js.map +1 -1
- package/dist/components/ChallengeTeamWizard/ChallengeTeamWizard.d.ts.map +1 -1
- package/dist/components/ChallengeTeamWizard/ChallengeTeamWizard.js +3 -3
- package/dist/components/ChallengeTeamWizard/ChallengeTeamWizard.js.map +1 -1
- package/dist/components/ChallengeTeamWizard/CreateChallengeTeam.js +1 -1
- package/dist/components/ChallengeTeamWizard/CreateChallengeTeam.js.map +1 -1
- package/dist/components/CreateTableViewWizard/CreateTableViewWizard.js +2 -2
- package/dist/components/CreateTableViewWizard/CreateTableViewWizard.js.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.js +121 -117
- package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
- package/dist/components/DataGrid/columns/DateTimeColumn.d.ts +21 -1
- package/dist/components/DataGrid/columns/DateTimeColumn.d.ts.map +1 -1
- package/dist/components/DataGrid/columns/DateTimeColumn.js +73 -29
- package/dist/components/DataGrid/columns/DateTimeColumn.js.map +1 -1
- package/dist/components/DataGrid/columns/NumberColumn.d.ts +31 -0
- package/dist/components/DataGrid/columns/NumberColumn.d.ts.map +1 -0
- package/dist/components/DataGrid/columns/NumberColumn.js +27 -0
- package/dist/components/DataGrid/columns/NumberColumn.js.map +1 -0
- package/dist/components/DataGrid/components/ReorderColumnsButton.d.ts +1 -0
- package/dist/components/DataGrid/components/ReorderColumnsButton.d.ts.map +1 -1
- package/dist/components/DataGrid/components/ReorderColumnsButton.js +17 -16
- package/dist/components/DataGrid/components/ReorderColumnsButton.js.map +1 -1
- package/dist/components/DataGrid/components/ReorderColumnsDialog.d.ts +2 -0
- package/dist/components/DataGrid/components/ReorderColumnsDialog.d.ts.map +1 -1
- package/dist/components/DataGrid/components/ReorderColumnsDialog.js +104 -65
- package/dist/components/DataGrid/components/ReorderColumnsDialog.js.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.js +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.js.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.js +55 -51
- package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
- package/dist/components/DataGrid/utils/computeDefaultColumnOrder.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/computeDefaultColumnOrder.js +9 -8
- package/dist/components/DataGrid/utils/computeDefaultColumnOrder.js.map +1 -1
- package/dist/components/DatasetHosting/DatasetDownloadButton.d.ts +10 -5
- package/dist/components/DatasetHosting/DatasetDownloadButton.d.ts.map +1 -1
- package/dist/components/DatasetHosting/DatasetDownloadButton.js +66 -74
- package/dist/components/DatasetHosting/DatasetDownloadButton.js.map +1 -1
- package/dist/components/DatasetHosting/DatasetHosting.d.ts +6 -0
- package/dist/components/DatasetHosting/DatasetHosting.d.ts.map +1 -1
- package/dist/components/DatasetHosting/DatasetHosting.js +6 -0
- package/dist/components/DatasetHosting/DatasetHosting.js.map +1 -1
- package/dist/components/DatasetHosting/DatasetHostingAdornment.d.ts +15 -0
- package/dist/components/DatasetHosting/DatasetHostingAdornment.d.ts.map +1 -0
- package/dist/components/DatasetHosting/DatasetHostingAdornment.js +23 -0
- package/dist/components/DatasetHosting/DatasetHostingAdornment.js.map +1 -0
- package/dist/components/DatasetHosting/index.d.ts +2 -0
- package/dist/components/DatasetHosting/index.d.ts.map +1 -1
- package/dist/components/DatasetHosting/index.js +2 -1
- package/dist/components/DownloadCart/DownloadCartPage.d.ts.map +1 -1
- package/dist/components/DownloadCart/DownloadCartPage.js +1 -1
- package/dist/components/DownloadCart/DownloadCartPage.js.map +1 -1
- package/dist/components/DropdownSelect/DropdownSelect.d.ts.map +1 -1
- package/dist/components/DropdownSelect/DropdownSelect.js +1 -1
- package/dist/components/DropdownSelect/DropdownSelect.js.map +1 -1
- package/dist/components/EntityFinder/tree/EntityTree.d.ts.map +1 -1
- package/dist/components/EntityFinder/tree/EntityTree.js +1 -1
- package/dist/components/EntityFinder/tree/EntityTree.js.map +1 -1
- package/dist/components/EntityFinder/tree/VirtualizedTree.js +1 -1
- package/dist/components/EntityFinder/tree/VirtualizedTree.js.map +1 -1
- package/dist/components/FeaturedDataTabs/FacetPlotsCard.js +1 -1
- package/dist/components/FeaturedDataTabs/FacetPlotsCard.js.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.d.ts.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.js +176 -170
- package/dist/components/GenericCard/TableRowGenericCard.js.map +1 -1
- package/dist/components/JsonSchemaForm/CustomFormContext.d.ts +9 -0
- package/dist/components/JsonSchemaForm/CustomFormContext.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.js +2 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.js.map +1 -1
- package/dist/components/JsonSchemaForm/templates/ArrayFieldTemplate.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm/templates/ArrayFieldTemplate.js +1 -1
- package/dist/components/JsonSchemaForm/templates/ArrayFieldTemplate.js.map +1 -1
- package/dist/components/JsonSchemaForm/templates/FieldTemplate.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm/templates/FieldTemplate.js +6 -6
- package/dist/components/JsonSchemaForm/templates/FieldTemplate.js.map +1 -1
- package/dist/components/JsonSchemaForm/widgets/DateWidget.d.ts +9 -0
- package/dist/components/JsonSchemaForm/widgets/DateWidget.d.ts.map +1 -0
- package/dist/components/JsonSchemaForm/widgets/DateWidget.js +23 -0
- package/dist/components/JsonSchemaForm/widgets/DateWidget.js.map +1 -0
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.css +1 -1
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.d.ts +3 -2
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.d.ts.map +1 -1
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.js +10 -12
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.js.map +1 -1
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.module.js +8 -7
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.module.js.map +1 -1
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.module.scss +12 -2
- package/dist/components/Markdown/MarkdownEditor.js +1 -1
- package/dist/components/Markdown/MarkdownEditor.js.map +1 -1
- package/dist/components/ProvenanceGraph/ProvenanceGraph.d.ts.map +1 -1
- package/dist/components/ProvenanceGraph/ProvenanceGraph.js +46 -46
- package/dist/components/ProvenanceGraph/ProvenanceGraph.js.map +1 -1
- package/dist/components/QueryBuilder/queryBuilderTranslation.js +1 -1
- package/dist/components/QueryBuilder/queryBuilderTranslation.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/LastUpdatedOn.js +1 -1
- package/dist/components/QueryWrapperPlotNav/LastUpdatedOn.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js +27 -25
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js.map +1 -1
- package/dist/components/SchemaDrivenAnnotationEditor/AnnotationEditorUtils.d.ts +0 -9
- package/dist/components/SchemaDrivenAnnotationEditor/AnnotationEditorUtils.d.ts.map +1 -1
- package/dist/components/SchemaDrivenAnnotationEditor/AnnotationEditorUtils.js +23 -31
- package/dist/components/SchemaDrivenAnnotationEditor/AnnotationEditorUtils.js.map +1 -1
- package/dist/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.d.ts.map +1 -1
- package/dist/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.js +5 -4
- package/dist/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.js.map +1 -1
- package/dist/components/SchemaDrivenAnnotationEditor/field/SynapseAnnotationsRJSFObjectField.d.ts.map +1 -1
- package/dist/components/SchemaDrivenAnnotationEditor/field/SynapseAnnotationsRJSFObjectField.js +6 -5
- package/dist/components/SchemaDrivenAnnotationEditor/field/SynapseAnnotationsRJSFObjectField.js.map +1 -1
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.d.ts +2 -0
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.d.ts.map +1 -1
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.js +18 -13
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.js.map +1 -1
- package/dist/components/StatisticsPlot.d.ts.map +1 -1
- package/dist/components/StatisticsPlot.js +1 -1
- package/dist/components/StatisticsPlot.js.map +1 -1
- package/dist/components/SynapseForm/SynapseFormWrapper.js +1 -1
- package/dist/components/SynapseForm/SynapseFormWrapper.js.map +1 -1
- package/dist/components/SynapseHomepageV2/HotdropsAndNews.css +1 -1
- package/dist/components/SynapseHomepageV2/HotdropsAndNews.module.js +9 -9
- package/dist/components/SynapseHomepageV2/HotdropsAndNews.module.js.map +1 -1
- package/dist/components/SynapseHomepageV2/HotdropsAndNews.module.scss +14 -0
- package/dist/components/SynapseHomepageV2/SynapseHomepageChatSearch.js +1 -1
- package/dist/components/SynapseHomepageV2/SynapseHomepageChatSearch.js.map +1 -1
- package/dist/components/SynapseSearchPageResults/SynapseSearchPage.js +1 -1
- package/dist/components/SynapseSearchPageResults/SynapseSearchPage.js.map +1 -1
- package/dist/components/SynapseTable/SynapseTableRenderers.d.ts.map +1 -1
- package/dist/components/SynapseTable/SynapseTableRenderers.js +1 -1
- package/dist/components/SynapseTable/SynapseTableRenderers.js.map +1 -1
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.d.ts +4 -0
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.d.ts.map +1 -1
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js +71 -69
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js.map +1 -1
- package/dist/components/SynapseTable/table-top/DownloadOptions.d.ts +4 -0
- package/dist/components/SynapseTable/table-top/DownloadOptions.d.ts.map +1 -1
- package/dist/components/SynapseTable/table-top/DownloadOptions.js +14 -13
- package/dist/components/SynapseTable/table-top/DownloadOptions.js.map +1 -1
- package/dist/components/SynapseTable/usePrefetchTableData.js +1 -1
- package/dist/components/SynapseTable/usePrefetchTableData.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaFormReducer.js +4 -4
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaFormReducer.js.map +1 -1
- package/dist/components/TanStackTable/TableCellRenderer.d.ts.map +1 -1
- package/dist/components/TanStackTable/TableCellRenderer.js +1 -1
- package/dist/components/TanStackTable/TableCellRenderer.js.map +1 -1
- package/dist/components/TermsAndConditions/TermsAndConditions.js +1 -1
- package/dist/components/TermsAndConditions/TermsAndConditions.js.map +1 -1
- package/dist/components/Webhook/CreateWebhookModal.d.ts.map +1 -1
- package/dist/components/Webhook/CreateWebhookModal.js +1 -1
- package/dist/components/Webhook/CreateWebhookModal.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js +172 -63
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/RouteConstants.d.ts +3 -0
- package/dist/components/dataaccess/UserAccessRequestHistory/RouteConstants.d.ts.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/RouteConstants.js +2 -2
- package/dist/components/dataaccess/UserAccessRequestHistory/RouteConstants.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPage.d.ts.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPage.js +10 -8
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPage.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.d.ts.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.js +74 -43
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryTable.d.ts.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryTable.js +2 -2
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryTable.js.map +1 -1
- package/dist/components/doi/CreateOrUpdateDoiModal.js +5 -5
- package/dist/components/doi/CreateOrUpdateDoiModal.js.map +1 -1
- package/dist/components/entity/metadata/EntityModal.js +1 -1
- package/dist/components/entity/metadata/EntityModal.js.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.js +2 -2
- package/dist/components/entity/page/action_menu/EntityActionMenu.js.map +1 -1
- package/dist/components/index.js +113 -112
- package/dist/components/menu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/menu/DropdownMenu.js +1 -1
- package/dist/components/menu/DropdownMenu.js.map +1 -1
- package/dist/components/row_renderers/Dataset.js +1 -1
- package/dist/components/row_renderers/Dataset.js.map +1 -1
- package/dist/components/styled/LeftRightPanel.d.ts +8 -0
- package/dist/components/styled/LeftRightPanel.d.ts.map +1 -1
- package/dist/components/styled/LeftRightPanel.js +10 -1
- package/dist/components/styled/LeftRightPanel.js.map +1 -1
- package/dist/components/widgets/facet-nav/FacetNavPanel.js +1 -1
- package/dist/components/widgets/facet-nav/FacetNavPanel.js.map +1 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilter.d.ts.map +1 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilter.js +1 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilter.js.map +1 -1
- package/dist/components/widgets/query-filter/FacetFilterControls.js +1 -1
- package/dist/components/widgets/query-filter/FacetFilterControls.js.map +1 -1
- package/dist/features/entity/metadata-task/components/CreateOrUpdateCurationTaskDialog.d.ts.map +1 -1
- package/dist/features/entity/metadata-task/components/CreateOrUpdateCurationTaskDialog.js +1 -1
- package/dist/features/entity/metadata-task/components/CreateOrUpdateCurationTaskDialog.js.map +1 -1
- package/dist/index.js +174 -173
- package/dist/index.js.map +1 -1
- package/dist/mocks/msw/handlers/aridhiaHandlers.d.ts +73 -0
- package/dist/mocks/msw/handlers/aridhiaHandlers.d.ts.map +1 -0
- package/dist/mocks/msw/handlers/aridhiaHandlers.js +119 -0
- package/dist/mocks/msw/handlers/aridhiaHandlers.js.map +1 -0
- package/dist/mocks/msw/handlers/dataAccessRequestHandlers.js +1 -1
- package/dist/mocks/msw/handlers/dataAccessRequestHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/entityHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/entityHandlers.js +4 -4
- package/dist/mocks/msw/handlers/entityHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/userProfileHandlers.js +2 -2
- package/dist/mocks/msw/handlers/userProfileHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers.js +72 -69
- package/dist/mocks/msw/handlers.js.map +1 -1
- package/dist/style/components/_terms-and-conditions.scss +25 -3
- package/dist/style/main.css +1 -1
- package/dist/testutils/RjsfFormTestUtils.js +12 -0
- package/dist/testutils/RjsfFormTestUtils.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/featureflag/FeatureFlags.d.ts +1 -0
- package/dist/utils/featureflag/FeatureFlags.d.ts.map +1 -1
- package/dist/utils/featureflag/FeatureFlags.js +1 -1
- package/dist/utils/featureflag/FeatureFlags.js.map +1 -1
- package/dist/utils/functions/QueryFilterUtils.js +1 -1
- package/dist/utils/functions/QueryFilterUtils.js.map +1 -1
- package/dist/utils/functions/SqlFunctions.js +1 -1
- package/dist/utils/functions/SqlFunctions.js.map +1 -1
- package/dist/utils/functions/queryUtils.js +1 -1
- package/dist/utils/functions/queryUtils.js.map +1 -1
- package/dist/utils/hooks/useDetectSSOCode.d.ts.map +1 -1
- package/dist/utils/hooks/useDetectSSOCode.js +1 -1
- package/dist/utils/hooks/useDetectSSOCode.js.map +1 -1
- package/dist/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.js +1 -1
- package/dist/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.js.map +1 -1
- package/dist/utils/jsonschema/SchemaAnnotationUtils.js +1 -1
- package/dist/utils/jsonschema/SchemaAnnotationUtils.js.map +1 -1
- package/dist/utils/jsonschema/collectTopLevelProperties.d.ts +22 -0
- package/dist/utils/jsonschema/collectTopLevelProperties.d.ts.map +1 -0
- package/dist/utils/jsonschema/collectTopLevelProperties.js +31 -0
- package/dist/utils/jsonschema/collectTopLevelProperties.js.map +1 -0
- package/dist/utils/jsonschema/getSchemaPropertyInfo.d.ts.map +1 -1
- package/dist/utils/jsonschema/getSchemaPropertyInfo.js +1 -1
- package/dist/utils/jsonschema/getSchemaPropertyInfo.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchTableData.js","names":[],"sources":["../../../src/components/SynapseTable/usePrefetchTableData.ts"],"sourcesContent":["import {\n useGetEntity,\n useGetEntityHeaders,\n useGetFileBatch,\n useGetRestrictionInformationBatch,\n useGetUserGroupHeaders,\n} from '@/synapse-queries'\nimport { useSynapseContext } from '@/utils'\nimport { getFieldIndex, getTypeIndices } from '@/utils/functions/queryUtils'\nimport { goToPage as transformQueryToGoToPage } from '@/utils/hooks/useImmutableTableQuery/TableQueryReducerActions'\nimport {\n ColumnTypeEnum,\n FileHandleAssociateType,\n FileHandleAssociation,\n QueryBundleRequest,\n ReferenceList,\n RestrictableObjectType,\n RowSet,\n Table,\n} from '@sage-bionetworks/synapse-types'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { cloneDeep } from 'lodash-es'\nimport { useCallback, useMemo } from 'react'\nimport { useQueryContext } from '../QueryContext'\nimport { getTableQueryUseQueryOptions } from '../QueryWrapper/TableQueryUseQueryOptions'\nimport { useGetQueryMetadata } from '../QueryWrapper/useGetQueryMetadata'\nimport {\n isEntityViewOrDatasetOrCollection,\n isFileViewOrDataset,\n} from './SynapseTableUtils'\n\nfunction usePrefetchFileHandleData(rowSet: RowSet) {\n const { entityId, versionNumber } = useQueryContext()\n\n const { data: entity } = useGetEntity<Table>(entityId, versionNumber)\n const { data: queryMetadata } = useGetQueryMetadata()\n\n const fileHandleIdColumnIndices = getTypeIndices(\n ColumnTypeEnum.FILEHANDLEID,\n queryMetadata?.selectColumns,\n )\n\n let fileHandlesToPrefetch: FileHandleAssociation[] = []\n\n // Now add all IDs from the entity ID columns\n if (entity && rowSet && queryMetadata && queryMetadata.selectColumns) {\n fileHandlesToPrefetch = rowSet.rows.reduce(\n (prev: FileHandleAssociation[], curr) => {\n fileHandleIdColumnIndices.forEach(index => {\n const value = curr.values[index]\n if (value) {\n const selectColumn = queryMetadata?.selectColumns![index]\n if (\n isFileViewOrDataset(entity) &&\n selectColumn.name === 'dataFileHandleId'\n ) {\n // The association is the entity\n prev.push({\n fileHandleId: value,\n associateObjectId: String(curr.rowId),\n associateObjectType: FileHandleAssociateType.FileEntity,\n })\n } else {\n // The association is the table entity\n prev.push({\n fileHandleId: value,\n associateObjectId: entity.id!,\n associateObjectType: FileHandleAssociateType.TableEntity,\n })\n }\n }\n })\n return prev\n },\n\n fileHandlesToPrefetch,\n )\n }\n\n return useGetFileBatch(\n {\n requestedFiles: fileHandlesToPrefetch,\n includeFileHandles: true,\n includePreSignedURLs: false,\n includePreviewPreSignedURLs: false,\n },\n {\n enabled: fileHandlesToPrefetch.length > 0,\n },\n )\n}\n\nfunction useGetEntitiesInTable(rowSet: RowSet) {\n const { entityId, versionNumber } = useQueryContext()\n const { data: entity } = useGetEntity<Table>(entityId, versionNumber)\n const { data: queryMetadata } = useGetQueryMetadata()\n\n let entitiesInTable: ReferenceList = []\n\n // If this is a file view/dataset, collect all the row IDs; they correspond to entities that we'll end up fetching\n if (entity && isEntityViewOrDatasetOrCollection(entity)) {\n entitiesInTable = rowSet.rows.reduce((prev: ReferenceList, curr) => {\n const { rowId, versionNumber } = curr\n if (rowId) {\n prev.push({\n targetId: `syn${rowId}`,\n targetVersionNumber: versionNumber,\n })\n }\n return prev\n }, entitiesInTable)\n }\n\n let entityIdColumnIndices = getTypeIndices(\n ColumnTypeEnum.ENTITYID,\n queryMetadata?.selectColumns,\n )\n\n if (entity && isEntityViewOrDatasetOrCollection(entity)) {\n // If this is a view/dataset, we don't need to fetch the entities in the entity ID column\n // Collecting the row IDs in the last step was sufficient\n const idColumnIndex = getFieldIndex('id', queryMetadata)\n entityIdColumnIndices = entityIdColumnIndices.filter(\n index => index !== idColumnIndex,\n )\n }\n\n const entityIdListColumnIndices = getTypeIndices(\n ColumnTypeEnum.ENTITYID_LIST,\n queryMetadata?.selectColumns,\n )\n\n entitiesInTable = rowSet.rows.reduce((prev: ReferenceList, curr) => {\n // Get all IDs from the entity ID columns\n entityIdColumnIndices.forEach(index => {\n const value = curr.values[index]\n if (\n value &&\n !prev.find(e => e.targetId === value && e.targetVersionNumber == null)\n ) {\n prev.push({ targetId: value })\n }\n })\n // Get all IDs from the entity ID list columns\n entityIdListColumnIndices.forEach(index => {\n const value = curr.values[index]\n if (value) {\n const ids = JSON.parse(value) as string[]\n ids.forEach(id => {\n if (\n id &&\n !prev.find(e => e.targetId === id && e.targetVersionNumber == null)\n ) {\n prev.push({ targetId: id })\n }\n })\n }\n })\n\n return prev\n }, entitiesInTable)\n\n return entitiesInTable\n}\n\nfunction usePrefetchEntityData(entitiesToPrefetch: ReferenceList) {\n return useGetEntityHeaders(entitiesToPrefetch, {\n enabled: entitiesToPrefetch.length > 0,\n })\n}\n\nfunction usePrefetchUserGroupHeaderData(rowSet: RowSet) {\n const { data: queryMetadata } = useGetQueryMetadata()\n\n const userIdColumnIndices = getTypeIndices(\n ColumnTypeEnum.USERID,\n queryMetadata?.selectColumns,\n )\n\n const userIdListColumnIndices = getTypeIndices(\n ColumnTypeEnum.USERID_LIST,\n queryMetadata?.selectColumns,\n )\n\n const principalIdsToPrefetch: string[] = rowSet.rows.reduce(\n (prev: string[], curr) => {\n // Add all IDs from the USERID columns\n userIdColumnIndices.forEach(index => {\n const value = curr.values[index]\n if (value && !prev.includes(value)) {\n prev.push(value)\n }\n })\n // Add all IDs from the USERID_LIST columns\n userIdListColumnIndices.forEach(index => {\n const value = curr.values[index]\n if (value) {\n const userIds = JSON.parse(value) as number[]\n userIds.forEach(userId => {\n if (!prev.includes(String(userId))) {\n prev.push(String(userId))\n }\n })\n }\n })\n return prev\n },\n [],\n )\n\n return useGetUserGroupHeaders(principalIdsToPrefetch, {\n enabled: principalIdsToPrefetch.length > 0,\n })\n}\n\nfunction usePrefetchEntityRestrictionData(entitiesToPrefetch: ReferenceList) {\n // This information only varies by entity ID, not version number. The restriction information is the same for all versions.\n const uniqueEntityIds = useMemo(() => {\n const entityIds = entitiesToPrefetch.map(e => e.targetId)\n // Dedupe the list in case there were duplicates, e.g. there were multiple versions of the same entity\n return Array.from(new Set(entityIds))\n }, [entitiesToPrefetch])\n\n return useGetRestrictionInformationBatch(\n {\n objectIds: uniqueEntityIds,\n restrictableObjectType: RestrictableObjectType.ENTITY,\n },\n {\n enabled: entitiesToPrefetch.length > 0,\n },\n )\n}\n\n/**\n * Uses react-query to prefetch data rendered by SynapseTable. Each SynapseTableCell instance load data to render rich\n * content (e.g. entity data) for the cell based on its column type. This hook uses react-query hooks that will\n * fetch and de-normalize batch requests, so when the SynapseTableCell component renders, the data is already loaded\n * in the cache. In practice, this avoids Synapse backend throttling and 'waterfall' content rendering.\n */\nexport function usePrefetchResourcesInTable(rowSet: RowSet): {\n dataHasBeenPrefetched: boolean\n} {\n const entitiesToPrefetch = useGetEntitiesInTable(rowSet)\n const { isLoading: isLoadingEntityData } =\n usePrefetchEntityData(entitiesToPrefetch)\n const { isLoading: isLoadingEntityRestrictionData } =\n usePrefetchEntityRestrictionData(entitiesToPrefetch)\n const { isLoading: isLoadingFileHandleData } =\n usePrefetchFileHandleData(rowSet)\n const { isLoading: isLoadingUserGroupData } =\n usePrefetchUserGroupHeaderData(rowSet)\n\n return {\n dataHasBeenPrefetched:\n !isLoadingEntityData &&\n !isLoadingEntityRestrictionData &&\n !isLoadingFileHandleData &&\n !isLoadingUserGroupData,\n }\n}\n\n/**\n * Uses react-query to prefetch an entire page of row data.\n *\n * @returns A function that will prefetch the data for a given page number.\n */\nexport function usePrefetchTableRows(): (pageNumber: number) => Promise<void> {\n const { keyFactory, accessToken } = useSynapseContext()\n const { currentQueryRequest, getRowDataQueryOptionsForPage } =\n useQueryContext()\n const queryClient = useQueryClient()\n\n // locked column does not matter for row data\n const lockedColumn = undefined\n return useCallback(\n (pageNumber: number) => {\n let rowDataQueryOptions\n if (getRowDataQueryOptionsForPage) {\n // Use the context-provided factory (e.g. SearchQueryWrapper) to avoid calling\n // the standard table query API with a synthetic entity ID.\n rowDataQueryOptions = getRowDataQueryOptionsForPage(pageNumber)\n } else {\n // Standard table query path\n const queryWithUpdatedPage = transformQueryToGoToPage(\n { type: 'goToPage', pageNumber },\n cloneDeep(currentQueryRequest) as QueryBundleRequest,\n )\n rowDataQueryOptions = getTableQueryUseQueryOptions(\n queryWithUpdatedPage,\n lockedColumn,\n keyFactory,\n accessToken,\n ).rowDataQueryOptions\n }\n\n // Finally, prefetch the data\n return queryClient.prefetchQuery(rowDataQueryOptions)\n },\n [\n accessToken,\n currentQueryRequest,\n getRowDataQueryOptionsForPage,\n keyFactory,\n lockedColumn,\n queryClient,\n ],\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;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,SAAS,OAAO,CAAM,CAAC,KAC/B,EAAK,KAAK,OAAO,CAAM,CAAC;EAE5B,CAAC;CAEL,CAAC,GACM,IAET,CAAC,CACH;CAEA,OAAO,EAAuB,GAAwB,EACpD,SAAS,EAAuB,SAAS,EAC3C,CAAC;AACH;AAEA,SAAS,EAAiC,GAAmC;CAQ3E,OAAO,EACL;EACE,WARoB,QAAc;GACpC,IAAM,IAAY,EAAmB,KAAI,MAAK,EAAE,QAAQ;GAExD,OAAO,MAAM,KAAK,IAAI,IAAI,CAAS,CAAC;EACtC,GAAG,CAAC,CAAkB,CAIP;EACX,wBAAwB,EAAuB;CACjD,GACA,EACE,SAAS,EAAmB,SAAS,EACvC,CACF;AACF;AAQA,SAAgB,EAA4B,GAE1C;CACA,IAAM,IAAqB,EAAsB,CAAM,GACjD,EAAE,WAAW,MACjB,EAAsB,CAAkB,GACpC,EAAE,WAAW,MACjB,EAAiC,CAAkB,GAC/C,EAAE,WAAW,MACjB,EAA0B,CAAM,GAC5B,EAAE,WAAW,MACjB,EAA+B,CAAM;CAEvC,OAAO,EACL,uBACE,CAAC,KACD,CAAC,KACD,CAAC,KACD,CAAC,EACL;AACF;AAOA,SAAgB,IAA8D;CAC5E,IAAM,EAAE,eAAY,mBAAgB,EAAkB,GAChD,EAAE,wBAAqB,qCAC3B,EAAgB,GACZ,IAAc,EAAe;CAInC,OAAO,GACJ,MAAuB;EACtB,IAAI;EAoBJ,OAnBA,AAUE,IAVE,IAGoB,EAA8B,CAAU,IAOxC,EAJO,EAC3B;GAAE,MAAM;GAAY;EAAW,GAC/B,EAAU,CAAmB,CAG7B,GACA,QACA,GACA,CACF,EAAE,qBAIG,EAAY,cAAc,CAAmB;CACtD,GACA;EACE;EACA;EACA;EACA;EACA;EACA;CACF,CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"usePrefetchTableData.js","names":[],"sources":["../../../src/components/SynapseTable/usePrefetchTableData.ts"],"sourcesContent":["import {\n useGetEntity,\n useGetEntityHeaders,\n useGetFileBatch,\n useGetRestrictionInformationBatch,\n useGetUserGroupHeaders,\n} from '@/synapse-queries'\nimport { useSynapseContext } from '@/utils'\nimport { getFieldIndex, getTypeIndices } from '@/utils/functions/queryUtils'\nimport { goToPage as transformQueryToGoToPage } from '@/utils/hooks/useImmutableTableQuery/TableQueryReducerActions'\nimport {\n ColumnTypeEnum,\n FileHandleAssociateType,\n FileHandleAssociation,\n QueryBundleRequest,\n ReferenceList,\n RestrictableObjectType,\n RowSet,\n Table,\n} from '@sage-bionetworks/synapse-types'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { cloneDeep } from 'lodash-es'\nimport { useCallback, useMemo } from 'react'\nimport { useQueryContext } from '../QueryContext'\nimport { getTableQueryUseQueryOptions } from '../QueryWrapper/TableQueryUseQueryOptions'\nimport { useGetQueryMetadata } from '../QueryWrapper/useGetQueryMetadata'\nimport {\n isEntityViewOrDatasetOrCollection,\n isFileViewOrDataset,\n} from './SynapseTableUtils'\n\nfunction usePrefetchFileHandleData(rowSet: RowSet) {\n const { entityId, versionNumber } = useQueryContext()\n\n const { data: entity } = useGetEntity<Table>(entityId, versionNumber)\n const { data: queryMetadata } = useGetQueryMetadata()\n\n const fileHandleIdColumnIndices = getTypeIndices(\n ColumnTypeEnum.FILEHANDLEID,\n queryMetadata?.selectColumns,\n )\n\n let fileHandlesToPrefetch: FileHandleAssociation[] = []\n\n // Now add all IDs from the entity ID columns\n if (entity && rowSet && queryMetadata?.selectColumns) {\n fileHandlesToPrefetch = rowSet.rows.reduce(\n (prev: FileHandleAssociation[], curr) => {\n fileHandleIdColumnIndices.forEach(index => {\n const value = curr.values[index]\n if (value) {\n const selectColumn = queryMetadata?.selectColumns![index]\n if (\n isFileViewOrDataset(entity) &&\n selectColumn.name === 'dataFileHandleId'\n ) {\n // The association is the entity\n prev.push({\n fileHandleId: value,\n associateObjectId: String(curr.rowId),\n associateObjectType: FileHandleAssociateType.FileEntity,\n })\n } else {\n // The association is the table entity\n prev.push({\n fileHandleId: value,\n associateObjectId: entity.id!,\n associateObjectType: FileHandleAssociateType.TableEntity,\n })\n }\n }\n })\n return prev\n },\n\n fileHandlesToPrefetch,\n )\n }\n\n return useGetFileBatch(\n {\n requestedFiles: fileHandlesToPrefetch,\n includeFileHandles: true,\n includePreSignedURLs: false,\n includePreviewPreSignedURLs: false,\n },\n {\n enabled: fileHandlesToPrefetch.length > 0,\n },\n )\n}\n\nfunction useGetEntitiesInTable(rowSet: RowSet) {\n const { entityId, versionNumber } = useQueryContext()\n const { data: entity } = useGetEntity<Table>(entityId, versionNumber)\n const { data: queryMetadata } = useGetQueryMetadata()\n\n let entitiesInTable: ReferenceList = []\n\n // If this is a file view/dataset, collect all the row IDs; they correspond to entities that we'll end up fetching\n if (entity && isEntityViewOrDatasetOrCollection(entity)) {\n entitiesInTable = rowSet.rows.reduce((prev: ReferenceList, curr) => {\n const { rowId, versionNumber } = curr\n if (rowId) {\n prev.push({\n targetId: `syn${rowId}`,\n targetVersionNumber: versionNumber,\n })\n }\n return prev\n }, entitiesInTable)\n }\n\n let entityIdColumnIndices = getTypeIndices(\n ColumnTypeEnum.ENTITYID,\n queryMetadata?.selectColumns,\n )\n\n if (entity && isEntityViewOrDatasetOrCollection(entity)) {\n // If this is a view/dataset, we don't need to fetch the entities in the entity ID column\n // Collecting the row IDs in the last step was sufficient\n const idColumnIndex = getFieldIndex('id', queryMetadata)\n entityIdColumnIndices = entityIdColumnIndices.filter(\n index => index !== idColumnIndex,\n )\n }\n\n const entityIdListColumnIndices = getTypeIndices(\n ColumnTypeEnum.ENTITYID_LIST,\n queryMetadata?.selectColumns,\n )\n\n entitiesInTable = rowSet.rows.reduce((prev: ReferenceList, curr) => {\n // Get all IDs from the entity ID columns\n entityIdColumnIndices.forEach(index => {\n const value = curr.values[index]\n if (\n value &&\n !prev.find(e => e.targetId === value && e.targetVersionNumber == null)\n ) {\n prev.push({ targetId: value })\n }\n })\n // Get all IDs from the entity ID list columns\n entityIdListColumnIndices.forEach(index => {\n const value = curr.values[index]\n if (value) {\n const ids = JSON.parse(value) as string[]\n ids.forEach(id => {\n if (\n id &&\n !prev.find(e => e.targetId === id && e.targetVersionNumber == null)\n ) {\n prev.push({ targetId: id })\n }\n })\n }\n })\n\n return prev\n }, entitiesInTable)\n\n return entitiesInTable\n}\n\nfunction usePrefetchEntityData(entitiesToPrefetch: ReferenceList) {\n return useGetEntityHeaders(entitiesToPrefetch, {\n enabled: entitiesToPrefetch.length > 0,\n })\n}\n\nfunction usePrefetchUserGroupHeaderData(rowSet: RowSet) {\n const { data: queryMetadata } = useGetQueryMetadata()\n\n const userIdColumnIndices = getTypeIndices(\n ColumnTypeEnum.USERID,\n queryMetadata?.selectColumns,\n )\n\n const userIdListColumnIndices = getTypeIndices(\n ColumnTypeEnum.USERID_LIST,\n queryMetadata?.selectColumns,\n )\n\n const principalIdsToPrefetch: string[] = rowSet.rows.reduce(\n (prev: string[], curr) => {\n // Add all IDs from the USERID columns\n userIdColumnIndices.forEach(index => {\n const value = curr.values[index]\n if (value && !prev.includes(value)) {\n prev.push(value)\n }\n })\n // Add all IDs from the USERID_LIST columns\n userIdListColumnIndices.forEach(index => {\n const value = curr.values[index]\n if (value) {\n const userIds = JSON.parse(value) as number[]\n userIds.forEach(userId => {\n if (!prev.includes(String(userId))) {\n prev.push(String(userId))\n }\n })\n }\n })\n return prev\n },\n [],\n )\n\n return useGetUserGroupHeaders(principalIdsToPrefetch, {\n enabled: principalIdsToPrefetch.length > 0,\n })\n}\n\nfunction usePrefetchEntityRestrictionData(entitiesToPrefetch: ReferenceList) {\n // This information only varies by entity ID, not version number. The restriction information is the same for all versions.\n const uniqueEntityIds = useMemo(() => {\n const entityIds = entitiesToPrefetch.map(e => e.targetId)\n // Dedupe the list in case there were duplicates, e.g. there were multiple versions of the same entity\n return Array.from(new Set(entityIds))\n }, [entitiesToPrefetch])\n\n return useGetRestrictionInformationBatch(\n {\n objectIds: uniqueEntityIds,\n restrictableObjectType: RestrictableObjectType.ENTITY,\n },\n {\n enabled: entitiesToPrefetch.length > 0,\n },\n )\n}\n\n/**\n * Uses react-query to prefetch data rendered by SynapseTable. Each SynapseTableCell instance load data to render rich\n * content (e.g. entity data) for the cell based on its column type. This hook uses react-query hooks that will\n * fetch and de-normalize batch requests, so when the SynapseTableCell component renders, the data is already loaded\n * in the cache. In practice, this avoids Synapse backend throttling and 'waterfall' content rendering.\n */\nexport function usePrefetchResourcesInTable(rowSet: RowSet): {\n dataHasBeenPrefetched: boolean\n} {\n const entitiesToPrefetch = useGetEntitiesInTable(rowSet)\n const { isLoading: isLoadingEntityData } =\n usePrefetchEntityData(entitiesToPrefetch)\n const { isLoading: isLoadingEntityRestrictionData } =\n usePrefetchEntityRestrictionData(entitiesToPrefetch)\n const { isLoading: isLoadingFileHandleData } =\n usePrefetchFileHandleData(rowSet)\n const { isLoading: isLoadingUserGroupData } =\n usePrefetchUserGroupHeaderData(rowSet)\n\n return {\n dataHasBeenPrefetched:\n !isLoadingEntityData &&\n !isLoadingEntityRestrictionData &&\n !isLoadingFileHandleData &&\n !isLoadingUserGroupData,\n }\n}\n\n/**\n * Uses react-query to prefetch an entire page of row data.\n *\n * @returns A function that will prefetch the data for a given page number.\n */\nexport function usePrefetchTableRows(): (pageNumber: number) => Promise<void> {\n const { keyFactory, accessToken } = useSynapseContext()\n const { currentQueryRequest, getRowDataQueryOptionsForPage } =\n useQueryContext()\n const queryClient = useQueryClient()\n\n // locked column does not matter for row data\n const lockedColumn = undefined\n return useCallback(\n (pageNumber: number) => {\n let rowDataQueryOptions\n if (getRowDataQueryOptionsForPage) {\n // Use the context-provided factory (e.g. SearchQueryWrapper) to avoid calling\n // the standard table query API with a synthetic entity ID.\n rowDataQueryOptions = getRowDataQueryOptionsForPage(pageNumber)\n } else {\n // Standard table query path\n const queryWithUpdatedPage = transformQueryToGoToPage(\n { type: 'goToPage', pageNumber },\n cloneDeep(currentQueryRequest) as QueryBundleRequest,\n )\n rowDataQueryOptions = getTableQueryUseQueryOptions(\n queryWithUpdatedPage,\n lockedColumn,\n keyFactory,\n accessToken,\n ).rowDataQueryOptions\n }\n\n // Finally, prefetch the data\n return queryClient.prefetchQuery(rowDataQueryOptions)\n },\n [\n accessToken,\n currentQueryRequest,\n getRowDataQueryOptionsForPage,\n keyFactory,\n lockedColumn,\n queryClient,\n ],\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BA,SAAS,EAA0B,GAAgB;CACjD,IAAM,EAAE,aAAU,qBAAkB,EAAgB,GAE9C,EAAE,MAAM,MAAW,EAAoB,GAAU,CAAa,GAC9D,EAAE,MAAM,MAAkB,EAAoB,GAE9C,IAA4B,EAChC,EAAe,cACf,GAAe,aACjB,GAEI,IAAiD,CAAC;CAqCtD,OAlCI,KAAU,KAAU,GAAe,kBACrC,IAAwB,EAAO,KAAK,QACjC,GAA+B,OAC9B,EAA0B,SAAQ,MAAS;EACzC,IAAM,IAAQ,EAAK,OAAO;EAC1B,IAAI,GAAO;GACT,IAAM,IAAe,GAAe,cAAe;GACnD,AACE,EAAoB,CAAM,KAC1B,EAAa,SAAS,qBAGtB,EAAK,KAAK;IACR,cAAc;IACd,mBAAmB,OAAO,EAAK,KAAK;IACpC,qBAAqB,EAAwB;GAC/C,CAAC,IAGD,EAAK,KAAK;IACR,cAAc;IACd,mBAAmB,EAAO;IAC1B,qBAAqB,EAAwB;GAC/C,CAAC;EAEL;CACF,CAAC,GACM,IAGT,CACF,IAGK,EACL;EACE,gBAAgB;EAChB,oBAAoB;EACpB,sBAAsB;EACtB,6BAA6B;CAC/B,GACA,EACE,SAAS,EAAsB,SAAS,EAC1C,CACF;AACF;AAEA,SAAS,EAAsB,GAAgB;CAC7C,IAAM,EAAE,aAAU,qBAAkB,EAAgB,GAC9C,EAAE,MAAM,MAAW,EAAoB,GAAU,CAAa,GAC9D,EAAE,MAAM,MAAkB,EAAoB,GAEhD,IAAiC,CAAC;CAGtC,AAAI,KAAU,EAAkC,CAAM,MACpD,IAAkB,EAAO,KAAK,QAAQ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,GACA,CACF,EAAE,qBAIG,EAAY,cAAc,CAAmB;CACtD,GACA;EACE;EACA;EACA;EACA;EACA;EACA;CACF,CACF;AACF"}
|
|
@@ -64,11 +64,11 @@ function m(e, t) {
|
|
|
64
64
|
}
|
|
65
65
|
function h(r, i) {
|
|
66
66
|
let { columnModelIndex: s, jsonSubColumnModelIndex: c, newColumnType: l } = r, u;
|
|
67
|
-
if (i
|
|
67
|
+
if (i?.[s]) u = i[s].jsonSubColumns && c !== void 0 ? a(i[s].jsonSubColumns[c]) : a(i[s]);
|
|
68
68
|
else throw Error("Cannot change column model type for a column that does not exist");
|
|
69
69
|
u.columnType = l, !t(l) && "maximumSize" in u && delete u.maximumSize, !e(l) && "maximumListLength" in u && delete u.maximumListLength, "enumValues" in u && delete u.enumValues, "defaultValue" in u && delete u.defaultValue;
|
|
70
70
|
let d = n(l, !!c);
|
|
71
|
-
"facetType" in u && (d === null || !d.includes(u.facetType)) && delete u.facetType, "jsonSubColumns" in u && l !== o.JSON && delete u.jsonSubColumns, i
|
|
71
|
+
"facetType" in u && (d === null || !d.includes(u.facetType)) && delete u.facetType, "jsonSubColumns" in u && l !== o.JSON && delete u.jsonSubColumns, i?.[s] && (i[s].jsonSubColumns && c !== void 0 ? i[s].jsonSubColumns[c] = u : i[s] = u);
|
|
72
72
|
}
|
|
73
73
|
function g(e) {
|
|
74
74
|
return c(e) ? e.map((e) => ({
|
|
@@ -89,11 +89,11 @@ function g(e) {
|
|
|
89
89
|
}
|
|
90
90
|
function _(e, t) {
|
|
91
91
|
let { columnModelIndex: n, jsonSubColumnModelIndex: r, value: i } = e;
|
|
92
|
-
t
|
|
92
|
+
t?.[n] && (t[n].jsonSubColumns && r !== void 0 ? t[n].jsonSubColumns[r] = i : t[n] = i);
|
|
93
93
|
}
|
|
94
94
|
function v(e, t) {
|
|
95
95
|
let { columnModelIndex: n, jsonSubColumnModelIndex: r } = e;
|
|
96
|
-
if (t
|
|
96
|
+
if (t?.[n]) if (t[n].jsonSubColumns && r !== void 0) {
|
|
97
97
|
let e = t[n].jsonSubColumns[r];
|
|
98
98
|
t[n].jsonSubColumns[r] = {
|
|
99
99
|
...e,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableColumnSchemaFormReducer.js","names":[],"sources":["../../../src/components/TableColumnSchemaEditor/TableColumnSchemaFormReducer.ts"],"sourcesContent":["import { ColumnModel, ColumnTypeEnum } from '@sage-bionetworks/synapse-types'\nimport { atomWithReducer } from 'jotai/utils'\nimport { cloneDeep } from 'lodash-es'\nimport {\n canHaveMaxListLength,\n canHaveSize,\n configureFacetsForType,\n DEFAULT_STRING_SIZE,\n findMatchingColumnModel,\n isFormDataValueSmallerThanRecommendedValue,\n} from './TableColumnSchemaEditorUtils'\nimport {\n ColumnModelFormData,\n JsonSubColumnModelFormData,\n} from './Validators/ColumnModelValidator'\n\nexport function getIsAllSelected(formData: ColumnModelFormData[]) {\n return (\n formData.length > 0 &&\n formData.every(\n cm =>\n // Is selected\n cm.isSelected &&\n // And all subcolumns are selected (true if there are no subcolumns)\n (cm.jsonSubColumns ?? []).every(\n (jsc: JsonSubColumnModelFormData) => jsc.isSelected,\n ),\n )\n )\n}\n\nexport function getNumberOfSelectedItems(formData: ColumnModelFormData[]) {\n return formData.reduce((acc, curr) => {\n if (curr.isSelected) {\n acc += 1\n }\n if (curr.jsonSubColumns) {\n curr.jsonSubColumns.forEach((jsc: JsonSubColumnModelFormData) => {\n if (jsc.isSelected) {\n acc += 1\n }\n })\n }\n return acc\n }, 0)\n}\n\nexport function getDefaultColumnModelFormData(): ColumnModelFormData {\n return {\n name: '',\n columnType: ColumnTypeEnum.STRING,\n maximumSize: DEFAULT_STRING_SIZE,\n isOriginallyDefaultColumn: false,\n isSelected: false,\n }\n}\n\nexport function getDefaultJsonSubColumnFormData(): JsonSubColumnModelFormData {\n return {\n name: '',\n jsonPath: '',\n columnType: ColumnTypeEnum.STRING,\n facetType: 'enumeration',\n isSelected: false,\n }\n}\n\n/**\n * In the provided array, move items up where the predicate evaluates to true\n * @param arr the array to reorder\n * @param predicate a function that returns true if the item should be moved up\n * @returns - a new array with the reordered items\n */\nfunction moveSelectedItemsUp<T = unknown>(\n arr: T[],\n predicate: (item: T) => boolean,\n) {\n const newArr = [...arr]\n newArr.forEach((item, index) => {\n // For each item that should move up, swap it with the previous item\n if (\n // Cannot move index 0 up\n index > 0 &&\n // Only move if the predicate matches\n predicate(item) &&\n // If the previous item should also move, skip the swap\n !predicate(newArr[index - 1])\n ) {\n // swap the items\n const temp = newArr[index - 1]\n newArr[index - 1] = newArr[index]\n newArr[index] = temp\n }\n })\n return newArr\n}\n\n/**\n * In the provided array, move items down where the predicate evaluates to true\n * @param arr the array to reorder\n * @param predicate a function that returns true if the item should be moved down\n * @returns - a new array with the reordered items\n */\nfunction moveSelectedItemsDown<T = unknown>(\n arr: T[],\n predicate: (item: T) => boolean,\n) {\n const newArr = [...arr]\n // Start from the end and work backwards, otherwise items could be moved more than once\n for (let i = newArr.length - 1; i >= 0; i--) {\n const item = newArr[i]\n if (\n // Cannot move the last item down\n i < newArr.length - 1 &&\n // Only move if the predicate matches\n predicate(item) &&\n // If the next item should also be moved, don't swap\n !predicate(newArr[i + 1])\n ) {\n // swap the items\n const temp = newArr[i]\n newArr[i] = newArr[i + 1]\n newArr[i + 1] = temp\n }\n }\n return newArr\n}\n\ntype TableColumnSchemaFormReducerAction =\n | {\n type: 'setValue'\n value: ColumnModelFormData[]\n }\n | {\n type: 'toggleSelect'\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n }\n | { type: 'toggleSelectAll' }\n | {\n type: 'appendColumn'\n }\n | {\n type: 'appendJsonSubColumn'\n columnModelIndex: number\n }\n | {\n type: 'setColumnModelValue'\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n value: ColumnModelFormData | JsonSubColumnModelFormData\n }\n | {\n type: 'changeColumnModelType'\n newColumnType: ColumnTypeEnum\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n }\n | {\n type: 'move'\n from: {\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n }\n to: { columnModelIndex: number; jsonSubColumnModelIndex?: number }\n }\n | {\n type: 'moveUp'\n }\n | {\n type: 'moveDown'\n }\n | {\n type: 'delete'\n }\n | {\n type: 'updateColumnSizesToRecommendedValues'\n annotationColumnModels: ColumnModel[]\n }\n\nfunction updateColumnSizesToRecommendedValues(\n action: {\n type: 'updateColumnSizesToRecommendedValues'\n annotationColumnModels: ColumnModel[]\n },\n prevState: ColumnModelFormData[],\n): ColumnModelFormData[] {\n const { annotationColumnModels } = action\n return prevState.map(cm => {\n // Note: no need to check JSON subcolumns, because Views cannot have JSON data!\n\n // Find the closest match between passed column model and current column model with name and type\n const defaultAnnotationModel = annotationColumnModels\n ? findMatchingColumnModel(annotationColumnModels, cm)\n : undefined\n\n if (defaultAnnotationModel == null) {\n // No matching annotation column, so do not change it\n return cm\n }\n\n if (\n isFormDataValueSmallerThanRecommendedValue(\n cm.maximumSize,\n defaultAnnotationModel.maximumSize,\n )\n ) {\n cm = { ...cm, maximumSize: defaultAnnotationModel.maximumSize }\n }\n\n if (\n isFormDataValueSmallerThanRecommendedValue(\n cm.maximumListLength,\n defaultAnnotationModel.maximumListLength,\n )\n ) {\n cm = {\n ...cm,\n maximumListLength: defaultAnnotationModel.maximumListLength,\n }\n }\n return cm\n })\n}\n\nfunction changeColumnModelType(\n action: {\n type: 'changeColumnModelType'\n newColumnType: ColumnTypeEnum\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n },\n prevState: ColumnModelFormData[],\n) {\n const { columnModelIndex, jsonSubColumnModelIndex, newColumnType } = action\n let newColumnModelValue: ColumnModelFormData | JsonSubColumnModelFormData\n\n // Create a copy of the selected column model\n if (prevState && prevState[columnModelIndex]) {\n if (\n prevState[columnModelIndex].jsonSubColumns &&\n jsonSubColumnModelIndex !== undefined\n ) {\n newColumnModelValue = cloneDeep(\n prevState[columnModelIndex].jsonSubColumns[jsonSubColumnModelIndex],\n )\n } else {\n newColumnModelValue = cloneDeep(prevState[columnModelIndex])\n }\n } else {\n throw new Error(\n 'Cannot change column model type for a column that does not exist',\n )\n }\n\n // Update the column model. Remove fields that no longer make sense for the new column type\n newColumnModelValue.columnType = newColumnType\n if (!canHaveSize(newColumnType) && 'maximumSize' in newColumnModelValue) {\n delete newColumnModelValue.maximumSize\n }\n if (\n !canHaveMaxListLength(newColumnType) &&\n 'maximumListLength' in newColumnModelValue\n ) {\n delete newColumnModelValue.maximumListLength\n }\n\n // Remove default and restricted values unconditionally since they may not adhere to the new column type\n if ('enumValues' in newColumnModelValue) {\n delete newColumnModelValue.enumValues\n }\n if ('defaultValue' in newColumnModelValue) {\n delete newColumnModelValue.defaultValue\n }\n\n const allowedFacetTypes = configureFacetsForType(\n newColumnType,\n !!jsonSubColumnModelIndex,\n )\n if (\n 'facetType' in newColumnModelValue &&\n (allowedFacetTypes === null ||\n !allowedFacetTypes.includes(newColumnModelValue.facetType))\n ) {\n delete newColumnModelValue.facetType\n }\n\n if (\n 'jsonSubColumns' in newColumnModelValue &&\n newColumnType !== ColumnTypeEnum.JSON\n ) {\n delete newColumnModelValue.jsonSubColumns\n }\n\n // Replace the value\n if (prevState && prevState[columnModelIndex]) {\n if (\n prevState[columnModelIndex].jsonSubColumns &&\n jsonSubColumnModelIndex !== undefined\n ) {\n prevState[columnModelIndex].jsonSubColumns[jsonSubColumnModelIndex] =\n newColumnModelValue as JsonSubColumnModelFormData\n } else {\n prevState[columnModelIndex] = newColumnModelValue as ColumnModelFormData\n }\n }\n}\n\nfunction toggleSelectAll(prevState: ColumnModelFormData[]) {\n const allSelected = getIsAllSelected(prevState)\n if (allSelected) {\n return prevState.map(cm => ({\n ...cm,\n jsonSubColumns: cm.jsonSubColumns?.map(jsc => ({\n ...jsc,\n isSelected: false,\n })),\n isSelected: false,\n }))\n } else {\n return prevState.map(cm => ({\n ...cm,\n jsonSubColumns: cm.jsonSubColumns?.map(jsc => ({\n ...jsc,\n isSelected: true,\n })),\n isSelected: true,\n }))\n }\n}\n\nfunction setColumnModelValue(\n action: {\n type: 'setColumnModelValue'\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n value: ColumnModelFormData | JsonSubColumnModelFormData\n },\n prevState: ColumnModelFormData[],\n) {\n const { columnModelIndex, jsonSubColumnModelIndex, value } = action\n if (prevState && prevState[columnModelIndex]) {\n if (\n prevState[columnModelIndex].jsonSubColumns &&\n jsonSubColumnModelIndex !== undefined\n ) {\n prevState[columnModelIndex].jsonSubColumns[jsonSubColumnModelIndex] =\n value as JsonSubColumnModelFormData\n } else {\n prevState[columnModelIndex] = value as ColumnModelFormData\n }\n }\n}\n\nfunction toggleSelect(\n action: {\n type: 'toggleSelect'\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n },\n prevState: ColumnModelFormData[],\n) {\n const { columnModelIndex, jsonSubColumnModelIndex } = action\n if (prevState && prevState[columnModelIndex]) {\n if (\n prevState[columnModelIndex].jsonSubColumns &&\n jsonSubColumnModelIndex !== undefined\n ) {\n const cm =\n prevState[columnModelIndex].jsonSubColumns[jsonSubColumnModelIndex]\n prevState[columnModelIndex].jsonSubColumns[jsonSubColumnModelIndex] = {\n ...cm,\n isSelected: !cm.isSelected,\n }\n } else {\n const cm = prevState[columnModelIndex]\n prevState[columnModelIndex] = { ...cm, isSelected: !cm.isSelected }\n }\n }\n}\n\nfunction deleteColumnModel(prevState: ColumnModelFormData[]) {\n return prevState\n .filter(cm => !cm.isSelected)\n .map(cm => {\n if (cm.jsonSubColumns) {\n cm = {\n ...cm,\n jsonSubColumns: cm.jsonSubColumns.filter(\n (jsc: JsonSubColumnModelFormData) => !jsc.isSelected,\n ),\n }\n }\n return cm\n })\n}\n\n/**\n * Returns a new, shallowly-cloned array that moves the object from the `fromIndex` to the `toIndex`.\n * Derived from https://stackoverflow.com/a/6470794/9723359\n *\n * Returns the same array if the `fromIndex` and `toIndex` are the same.\n * @param arrayToReorder\n * @param fromIndex\n * @param toIndex\n */\nfunction moveElementInArray<T = unknown>(\n arrayToReorder: Array<T>,\n fromIndex: number,\n toIndex: number,\n): Array<T> {\n if (fromIndex == toIndex) {\n return arrayToReorder\n }\n const newArray = [...arrayToReorder]\n const elementToMove = newArray[fromIndex]\n newArray.splice(fromIndex, 1)\n newArray.splice(toIndex, 0, elementToMove)\n return newArray\n}\n\n/**\n * Moves a column model or jsonSubColumn from the `from` index to the `to` index\n * @param action\n * @param prevState\n */\nfunction moveColumnModel(\n action: {\n type: 'move'\n from: { columnModelIndex: number; jsonSubColumnModelIndex?: number }\n to: { columnModelIndex: number; jsonSubColumnModelIndex?: number }\n },\n prevState: ColumnModelFormData[],\n): ColumnModelFormData[] {\n const { from, to } = action\n const arrayToReorder =\n from.jsonSubColumnModelIndex !== undefined\n ? prevState[from.columnModelIndex].jsonSubColumns!\n : prevState\n\n const fromIndex =\n from.jsonSubColumnModelIndex !== undefined\n ? from.jsonSubColumnModelIndex\n : from.columnModelIndex\n\n const toIndex =\n to.jsonSubColumnModelIndex !== undefined\n ? to.jsonSubColumnModelIndex\n : to.columnModelIndex\n\n // Move the element\n const newArray = moveElementInArray<unknown>(\n arrayToReorder,\n fromIndex,\n toIndex,\n ) as ColumnModelFormData[] | JsonSubColumnModelFormData[]\n\n if (from.jsonSubColumnModelIndex !== undefined) {\n // If we moved a jsonSubColumn, update state to use the new, reordered array\n prevState[from.columnModelIndex].jsonSubColumns =\n newArray as JsonSubColumnModelFormData[]\n return prevState\n } else {\n // Otherwise, return the new, reordered array of column models\n return newArray as ColumnModelFormData[]\n }\n}\n\nexport function reducer(\n prevState: ColumnModelFormData[],\n action: TableColumnSchemaFormReducerAction,\n) {\n switch (action.type) {\n case 'setValue':\n prevState = action.value\n break\n case 'toggleSelectAll': {\n prevState = toggleSelectAll(prevState)\n break\n }\n case 'setColumnModelValue': {\n setColumnModelValue(action, prevState)\n break\n }\n case 'changeColumnModelType': {\n changeColumnModelType(action, prevState)\n break\n }\n\n case 'appendColumn':\n prevState.push(getDefaultColumnModelFormData())\n break\n case 'appendJsonSubColumn': {\n const { columnModelIndex } = action\n prevState[columnModelIndex] = {\n ...prevState[columnModelIndex],\n jsonSubColumns: [\n ...(prevState[columnModelIndex].jsonSubColumns ?? []),\n getDefaultJsonSubColumnFormData(),\n ],\n }\n break\n }\n case 'toggleSelect': {\n toggleSelect(action, prevState)\n break\n }\n case 'delete':\n prevState = deleteColumnModel(prevState)\n break\n case 'move': {\n prevState = moveColumnModel(action, prevState)\n break\n }\n case 'moveUp':\n prevState = moveSelectedItemsUp(prevState, cm => cm.isSelected)\n prevState.forEach(cm => {\n if (cm.jsonSubColumns) {\n cm.jsonSubColumns = moveSelectedItemsUp(\n cm.jsonSubColumns,\n jsc => jsc.isSelected,\n )\n }\n })\n break\n case 'moveDown':\n prevState = moveSelectedItemsDown(prevState, cm => cm.isSelected)\n prevState.forEach(cm => {\n if (cm.jsonSubColumns) {\n cm.jsonSubColumns = moveSelectedItemsDown(\n cm.jsonSubColumns,\n jsc => jsc.isSelected,\n )\n }\n })\n break\n case 'updateColumnSizesToRecommendedValues':\n prevState = updateColumnSizesToRecommendedValues(action, prevState)\n break\n default:\n throw new Error(`Unexpected action`, action)\n }\n return [...prevState]\n}\n\nexport const tableColumnSchemaFormDataAtom = atomWithReducer<\n ColumnModelFormData[],\n TableColumnSchemaFormReducerAction\n>([], reducer)\n"],"mappings":";;;;;AAgBA,SAAgB,EAAiB,GAAiC;CAChE,OACE,EAAS,SAAS,KAClB,EAAS,OACP,MAEE,EAAG,eAEF,EAAG,kBAAkB,CAAC,GAAG,OACvB,MAAoC,EAAI,UAC3C,CACJ;AAEJ;AAEA,SAAgB,EAAyB,GAAiC;CACxE,OAAO,EAAS,QAAQ,GAAK,OACvB,EAAK,eACP,KAAO,IAEL,EAAK,kBACP,EAAK,eAAe,SAAS,MAAoC;EAC/D,AAAI,EAAI,eACN,KAAO;CAEX,CAAC,GAEI,IACN,CAAC;AACN;AAEA,SAAgB,IAAqD;CACnE,OAAO;EACL,MAAM;EACN,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;EAEF,KAAK;GACH,EAAoB,GAAQ,CAAS;GACrC;EAEF,KAAK;GACH,EAAsB,GAAQ,CAAS;GACvC;EAGF,KAAK;GACH,EAAU,KAAK,EAA8B,CAAC;GAC9C;EACF,KAAK,uBAAuB;GAC1B,IAAM,EAAE,wBAAqB;GAC7B,EAAU,KAAoB;IAC5B,GAAG,EAAU;IACb,gBAAgB,CACd,GAAI,EAAU,GAAkB,kBAAkB,CAAC,GACnD,EAAgC,CAClC;GACF;GACA;EACF;EACA,KAAK;GACH,EAAa,GAAQ,CAAS;GAC9B;EAEF,KAAK;GACH,IAAY,EAAkB,CAAS;GACvC;EACF,KAAK;GACH,IAAY,EAAgB,GAAQ,CAAS;GAC7C;EAEF,KAAK;GAEH,AADA,IAAY,EAAoB,IAAW,MAAM,EAAG,UAAU,GAC9D,EAAU,SAAQ,MAAM;IACtB,AACE,EAAG,mBAAiB,EAClB,EAAG,iBACH,MAAO,EAAI,UACb;GAEJ,CAAC;GACD;EACF,KAAK;GAEH,AADA,IAAY,EAAsB,IAAW,MAAM,EAAG,UAAU,GAChE,EAAU,SAAQ,MAAM;IACtB,AACE,EAAG,mBAAiB,EAClB,EAAG,iBACH,MAAO,EAAI,UACb;GAEJ,CAAC;GACD;EACF,KAAK;GACH,IAAY,EAAqC,GAAQ,CAAS;GAClE;EACF,SACE,MAAU,MAAM,qBAAqB,CAAM;CAC/C;CACA,OAAO,CAAC,GAAG,CAAS;AACtB;AAEA,IAAa,IAAgC,EAG3C,CAAC,GAAG,CAAO"}
|
|
1
|
+
{"version":3,"file":"TableColumnSchemaFormReducer.js","names":[],"sources":["../../../src/components/TableColumnSchemaEditor/TableColumnSchemaFormReducer.ts"],"sourcesContent":["import { ColumnModel, ColumnTypeEnum } from '@sage-bionetworks/synapse-types'\nimport { atomWithReducer } from 'jotai/utils'\nimport { cloneDeep } from 'lodash-es'\nimport {\n canHaveMaxListLength,\n canHaveSize,\n configureFacetsForType,\n DEFAULT_STRING_SIZE,\n findMatchingColumnModel,\n isFormDataValueSmallerThanRecommendedValue,\n} from './TableColumnSchemaEditorUtils'\nimport {\n ColumnModelFormData,\n JsonSubColumnModelFormData,\n} from './Validators/ColumnModelValidator'\n\nexport function getIsAllSelected(formData: ColumnModelFormData[]) {\n return (\n formData.length > 0 &&\n formData.every(\n cm =>\n // Is selected\n cm.isSelected &&\n // And all subcolumns are selected (true if there are no subcolumns)\n (cm.jsonSubColumns ?? []).every(\n (jsc: JsonSubColumnModelFormData) => jsc.isSelected,\n ),\n )\n )\n}\n\nexport function getNumberOfSelectedItems(formData: ColumnModelFormData[]) {\n return formData.reduce((acc, curr) => {\n if (curr.isSelected) {\n acc += 1\n }\n if (curr.jsonSubColumns) {\n curr.jsonSubColumns.forEach((jsc: JsonSubColumnModelFormData) => {\n if (jsc.isSelected) {\n acc += 1\n }\n })\n }\n return acc\n }, 0)\n}\n\nexport function getDefaultColumnModelFormData(): ColumnModelFormData {\n return {\n name: '',\n columnType: ColumnTypeEnum.STRING,\n maximumSize: DEFAULT_STRING_SIZE,\n isOriginallyDefaultColumn: false,\n isSelected: false,\n }\n}\n\nexport function getDefaultJsonSubColumnFormData(): JsonSubColumnModelFormData {\n return {\n name: '',\n jsonPath: '',\n columnType: ColumnTypeEnum.STRING,\n facetType: 'enumeration',\n isSelected: false,\n }\n}\n\n/**\n * In the provided array, move items up where the predicate evaluates to true\n * @param arr the array to reorder\n * @param predicate a function that returns true if the item should be moved up\n * @returns - a new array with the reordered items\n */\nfunction moveSelectedItemsUp<T = unknown>(\n arr: T[],\n predicate: (item: T) => boolean,\n) {\n const newArr = [...arr]\n newArr.forEach((item, index) => {\n // For each item that should move up, swap it with the previous item\n if (\n // Cannot move index 0 up\n index > 0 &&\n // Only move if the predicate matches\n predicate(item) &&\n // If the previous item should also move, skip the swap\n !predicate(newArr[index - 1])\n ) {\n // swap the items\n const temp = newArr[index - 1]\n newArr[index - 1] = newArr[index]\n newArr[index] = temp\n }\n })\n return newArr\n}\n\n/**\n * In the provided array, move items down where the predicate evaluates to true\n * @param arr the array to reorder\n * @param predicate a function that returns true if the item should be moved down\n * @returns - a new array with the reordered items\n */\nfunction moveSelectedItemsDown<T = unknown>(\n arr: T[],\n predicate: (item: T) => boolean,\n) {\n const newArr = [...arr]\n // Start from the end and work backwards, otherwise items could be moved more than once\n for (let i = newArr.length - 1; i >= 0; i--) {\n const item = newArr[i]\n if (\n // Cannot move the last item down\n i < newArr.length - 1 &&\n // Only move if the predicate matches\n predicate(item) &&\n // If the next item should also be moved, don't swap\n !predicate(newArr[i + 1])\n ) {\n // swap the items\n const temp = newArr[i]\n newArr[i] = newArr[i + 1]\n newArr[i + 1] = temp\n }\n }\n return newArr\n}\n\ntype TableColumnSchemaFormReducerAction =\n | {\n type: 'setValue'\n value: ColumnModelFormData[]\n }\n | {\n type: 'toggleSelect'\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n }\n | { type: 'toggleSelectAll' }\n | {\n type: 'appendColumn'\n }\n | {\n type: 'appendJsonSubColumn'\n columnModelIndex: number\n }\n | {\n type: 'setColumnModelValue'\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n value: ColumnModelFormData | JsonSubColumnModelFormData\n }\n | {\n type: 'changeColumnModelType'\n newColumnType: ColumnTypeEnum\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n }\n | {\n type: 'move'\n from: {\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n }\n to: { columnModelIndex: number; jsonSubColumnModelIndex?: number }\n }\n | {\n type: 'moveUp'\n }\n | {\n type: 'moveDown'\n }\n | {\n type: 'delete'\n }\n | {\n type: 'updateColumnSizesToRecommendedValues'\n annotationColumnModels: ColumnModel[]\n }\n\nfunction updateColumnSizesToRecommendedValues(\n action: {\n type: 'updateColumnSizesToRecommendedValues'\n annotationColumnModels: ColumnModel[]\n },\n prevState: ColumnModelFormData[],\n): ColumnModelFormData[] {\n const { annotationColumnModels } = action\n return prevState.map(cm => {\n // Note: no need to check JSON subcolumns, because Views cannot have JSON data!\n\n // Find the closest match between passed column model and current column model with name and type\n const defaultAnnotationModel = annotationColumnModels\n ? findMatchingColumnModel(annotationColumnModels, cm)\n : undefined\n\n if (defaultAnnotationModel == null) {\n // No matching annotation column, so do not change it\n return cm\n }\n\n if (\n isFormDataValueSmallerThanRecommendedValue(\n cm.maximumSize,\n defaultAnnotationModel.maximumSize,\n )\n ) {\n cm = { ...cm, maximumSize: defaultAnnotationModel.maximumSize }\n }\n\n if (\n isFormDataValueSmallerThanRecommendedValue(\n cm.maximumListLength,\n defaultAnnotationModel.maximumListLength,\n )\n ) {\n cm = {\n ...cm,\n maximumListLength: defaultAnnotationModel.maximumListLength,\n }\n }\n return cm\n })\n}\n\nfunction changeColumnModelType(\n action: {\n type: 'changeColumnModelType'\n newColumnType: ColumnTypeEnum\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n },\n prevState: ColumnModelFormData[],\n) {\n const { columnModelIndex, jsonSubColumnModelIndex, newColumnType } = action\n let newColumnModelValue: ColumnModelFormData | JsonSubColumnModelFormData\n\n // Create a copy of the selected column model\n if (prevState?.[columnModelIndex]) {\n if (\n prevState[columnModelIndex].jsonSubColumns &&\n jsonSubColumnModelIndex !== undefined\n ) {\n newColumnModelValue = cloneDeep(\n prevState[columnModelIndex].jsonSubColumns[jsonSubColumnModelIndex],\n )\n } else {\n newColumnModelValue = cloneDeep(prevState[columnModelIndex])\n }\n } else {\n throw new Error(\n 'Cannot change column model type for a column that does not exist',\n )\n }\n\n // Update the column model. Remove fields that no longer make sense for the new column type\n newColumnModelValue.columnType = newColumnType\n if (!canHaveSize(newColumnType) && 'maximumSize' in newColumnModelValue) {\n delete newColumnModelValue.maximumSize\n }\n if (\n !canHaveMaxListLength(newColumnType) &&\n 'maximumListLength' in newColumnModelValue\n ) {\n delete newColumnModelValue.maximumListLength\n }\n\n // Remove default and restricted values unconditionally since they may not adhere to the new column type\n if ('enumValues' in newColumnModelValue) {\n delete newColumnModelValue.enumValues\n }\n if ('defaultValue' in newColumnModelValue) {\n delete newColumnModelValue.defaultValue\n }\n\n const allowedFacetTypes = configureFacetsForType(\n newColumnType,\n !!jsonSubColumnModelIndex,\n )\n if (\n 'facetType' in newColumnModelValue &&\n (allowedFacetTypes === null ||\n !allowedFacetTypes.includes(newColumnModelValue.facetType))\n ) {\n delete newColumnModelValue.facetType\n }\n\n if (\n 'jsonSubColumns' in newColumnModelValue &&\n newColumnType !== ColumnTypeEnum.JSON\n ) {\n delete newColumnModelValue.jsonSubColumns\n }\n\n // Replace the value\n if (prevState?.[columnModelIndex]) {\n if (\n prevState[columnModelIndex].jsonSubColumns &&\n jsonSubColumnModelIndex !== undefined\n ) {\n prevState[columnModelIndex].jsonSubColumns[jsonSubColumnModelIndex] =\n newColumnModelValue as JsonSubColumnModelFormData\n } else {\n prevState[columnModelIndex] = newColumnModelValue as ColumnModelFormData\n }\n }\n}\n\nfunction toggleSelectAll(prevState: ColumnModelFormData[]) {\n const allSelected = getIsAllSelected(prevState)\n if (allSelected) {\n return prevState.map(cm => ({\n ...cm,\n jsonSubColumns: cm.jsonSubColumns?.map(jsc => ({\n ...jsc,\n isSelected: false,\n })),\n isSelected: false,\n }))\n } else {\n return prevState.map(cm => ({\n ...cm,\n jsonSubColumns: cm.jsonSubColumns?.map(jsc => ({\n ...jsc,\n isSelected: true,\n })),\n isSelected: true,\n }))\n }\n}\n\nfunction setColumnModelValue(\n action: {\n type: 'setColumnModelValue'\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n value: ColumnModelFormData | JsonSubColumnModelFormData\n },\n prevState: ColumnModelFormData[],\n) {\n const { columnModelIndex, jsonSubColumnModelIndex, value } = action\n if (prevState?.[columnModelIndex]) {\n if (\n prevState[columnModelIndex].jsonSubColumns &&\n jsonSubColumnModelIndex !== undefined\n ) {\n prevState[columnModelIndex].jsonSubColumns[jsonSubColumnModelIndex] =\n value as JsonSubColumnModelFormData\n } else {\n prevState[columnModelIndex] = value as ColumnModelFormData\n }\n }\n}\n\nfunction toggleSelect(\n action: {\n type: 'toggleSelect'\n columnModelIndex: number\n jsonSubColumnModelIndex?: number\n },\n prevState: ColumnModelFormData[],\n) {\n const { columnModelIndex, jsonSubColumnModelIndex } = action\n if (prevState?.[columnModelIndex]) {\n if (\n prevState[columnModelIndex].jsonSubColumns &&\n jsonSubColumnModelIndex !== undefined\n ) {\n const cm =\n prevState[columnModelIndex].jsonSubColumns[jsonSubColumnModelIndex]\n prevState[columnModelIndex].jsonSubColumns[jsonSubColumnModelIndex] = {\n ...cm,\n isSelected: !cm.isSelected,\n }\n } else {\n const cm = prevState[columnModelIndex]\n prevState[columnModelIndex] = { ...cm, isSelected: !cm.isSelected }\n }\n }\n}\n\nfunction deleteColumnModel(prevState: ColumnModelFormData[]) {\n return prevState\n .filter(cm => !cm.isSelected)\n .map(cm => {\n if (cm.jsonSubColumns) {\n cm = {\n ...cm,\n jsonSubColumns: cm.jsonSubColumns.filter(\n (jsc: JsonSubColumnModelFormData) => !jsc.isSelected,\n ),\n }\n }\n return cm\n })\n}\n\n/**\n * Returns a new, shallowly-cloned array that moves the object from the `fromIndex` to the `toIndex`.\n * Derived from https://stackoverflow.com/a/6470794/9723359\n *\n * Returns the same array if the `fromIndex` and `toIndex` are the same.\n * @param arrayToReorder\n * @param fromIndex\n * @param toIndex\n */\nfunction moveElementInArray<T = unknown>(\n arrayToReorder: Array<T>,\n fromIndex: number,\n toIndex: number,\n): Array<T> {\n if (fromIndex == toIndex) {\n return arrayToReorder\n }\n const newArray = [...arrayToReorder]\n const elementToMove = newArray[fromIndex]\n newArray.splice(fromIndex, 1)\n newArray.splice(toIndex, 0, elementToMove)\n return newArray\n}\n\n/**\n * Moves a column model or jsonSubColumn from the `from` index to the `to` index\n * @param action\n * @param prevState\n */\nfunction moveColumnModel(\n action: {\n type: 'move'\n from: { columnModelIndex: number; jsonSubColumnModelIndex?: number }\n to: { columnModelIndex: number; jsonSubColumnModelIndex?: number }\n },\n prevState: ColumnModelFormData[],\n): ColumnModelFormData[] {\n const { from, to } = action\n const arrayToReorder =\n from.jsonSubColumnModelIndex !== undefined\n ? prevState[from.columnModelIndex].jsonSubColumns!\n : prevState\n\n const fromIndex =\n from.jsonSubColumnModelIndex !== undefined\n ? from.jsonSubColumnModelIndex\n : from.columnModelIndex\n\n const toIndex =\n to.jsonSubColumnModelIndex !== undefined\n ? to.jsonSubColumnModelIndex\n : to.columnModelIndex\n\n // Move the element\n const newArray = moveElementInArray<unknown>(\n arrayToReorder,\n fromIndex,\n toIndex,\n ) as ColumnModelFormData[] | JsonSubColumnModelFormData[]\n\n if (from.jsonSubColumnModelIndex !== undefined) {\n // If we moved a jsonSubColumn, update state to use the new, reordered array\n prevState[from.columnModelIndex].jsonSubColumns =\n newArray as JsonSubColumnModelFormData[]\n return prevState\n } else {\n // Otherwise, return the new, reordered array of column models\n return newArray as ColumnModelFormData[]\n }\n}\n\nexport function reducer(\n prevState: ColumnModelFormData[],\n action: TableColumnSchemaFormReducerAction,\n) {\n switch (action.type) {\n case 'setValue':\n prevState = action.value\n break\n case 'toggleSelectAll': {\n prevState = toggleSelectAll(prevState)\n break\n }\n case 'setColumnModelValue': {\n setColumnModelValue(action, prevState)\n break\n }\n case 'changeColumnModelType': {\n changeColumnModelType(action, prevState)\n break\n }\n\n case 'appendColumn':\n prevState.push(getDefaultColumnModelFormData())\n break\n case 'appendJsonSubColumn': {\n const { columnModelIndex } = action\n prevState[columnModelIndex] = {\n ...prevState[columnModelIndex],\n jsonSubColumns: [\n ...(prevState[columnModelIndex].jsonSubColumns ?? []),\n getDefaultJsonSubColumnFormData(),\n ],\n }\n break\n }\n case 'toggleSelect': {\n toggleSelect(action, prevState)\n break\n }\n case 'delete':\n prevState = deleteColumnModel(prevState)\n break\n case 'move': {\n prevState = moveColumnModel(action, prevState)\n break\n }\n case 'moveUp':\n prevState = moveSelectedItemsUp(prevState, cm => cm.isSelected)\n prevState.forEach(cm => {\n if (cm.jsonSubColumns) {\n cm.jsonSubColumns = moveSelectedItemsUp(\n cm.jsonSubColumns,\n jsc => jsc.isSelected,\n )\n }\n })\n break\n case 'moveDown':\n prevState = moveSelectedItemsDown(prevState, cm => cm.isSelected)\n prevState.forEach(cm => {\n if (cm.jsonSubColumns) {\n cm.jsonSubColumns = moveSelectedItemsDown(\n cm.jsonSubColumns,\n jsc => jsc.isSelected,\n )\n }\n })\n break\n case 'updateColumnSizesToRecommendedValues':\n prevState = updateColumnSizesToRecommendedValues(action, prevState)\n break\n default:\n throw new Error(`Unexpected action`, action)\n }\n return [...prevState]\n}\n\nexport const tableColumnSchemaFormDataAtom = atomWithReducer<\n ColumnModelFormData[],\n TableColumnSchemaFormReducerAction\n>([], reducer)\n"],"mappings":";;;;;AAgBA,SAAgB,EAAiB,GAAiC;CAChE,OACE,EAAS,SAAS,KAClB,EAAS,OACP,MAEE,EAAG,eAEF,EAAG,kBAAkB,CAAC,GAAG,OACvB,MAAoC,EAAI,UAC3C,CACJ;AAEJ;AAEA,SAAgB,EAAyB,GAAiC;CACxE,OAAO,EAAS,QAAQ,GAAK,OACvB,EAAK,eACP,KAAO,IAEL,EAAK,kBACP,EAAK,eAAe,SAAS,MAAoC;EAC/D,AAAI,EAAI,eACN,KAAO;CAEX,CAAC,GAEI,IACN,CAAC;AACN;AAEA,SAAgB,IAAqD;CACnE,OAAO;EACL,MAAM;EACN,YAAY,EAAe;EAC3B,aAAA;EACA,2BAA2B;EAC3B,YAAY;CACd;AACF;AAEA,SAAgB,IAA8D;CAC5E,OAAO;EACL,MAAM;EACN,UAAU;EACV,YAAY,EAAe;EAC3B,WAAW;EACX,YAAY;CACd;AACF;AAQA,SAAS,EACP,GACA,GACA;CACA,IAAM,IAAS,CAAC,GAAG,CAAG;CAiBtB,OAhBA,EAAO,SAAS,GAAM,MAAU;EAE9B,IAEE,IAAQ,KAER,EAAU,CAAI,KAEd,CAAC,EAAU,EAAO,IAAQ,EAAE,GAC5B;GAEA,IAAM,IAAO,EAAO,IAAQ;GAE5B,AADA,EAAO,IAAQ,KAAK,EAAO,I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F,KAAK;GAEH,AADA,IAAY,EAAoB,IAAW,MAAM,EAAG,UAAU,GAC9D,EAAU,SAAQ,MAAM;IACtB,AACE,EAAG,mBAAiB,EAClB,EAAG,iBACH,MAAO,EAAI,UACb;GAEJ,CAAC;GACD;EACF,KAAK;GAEH,AADA,IAAY,EAAsB,IAAW,MAAM,EAAG,UAAU,GAChE,EAAU,SAAQ,MAAM;IACtB,AACE,EAAG,mBAAiB,EAClB,EAAG,iBACH,MAAO,EAAI,UACb;GAEJ,CAAC;GACD;EACF,KAAK;GACH,IAAY,EAAqC,GAAQ,CAAS;GAClE;EACF,SACE,MAAU,MAAM,qBAAqB,CAAM;CAC/C;CACA,OAAO,CAAC,GAAG,CAAS;AACtB;AAEA,IAAa,IAAgC,EAG3C,CAAC,GAAG,CAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCellRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/TanStackTable/TableCellRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAc,MAAM,uBAAuB,CAAA;AAOxD,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"TableCellRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/TanStackTable/TableCellRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAc,MAAM,uBAAuB,CAAA;AAOxD,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,2CA6BpE"}
|
|
@@ -5,7 +5,7 @@ import { jsx as i } from "react/jsx-runtime";
|
|
|
5
5
|
import { flexRender as a } from "@tanstack/react-table";
|
|
6
6
|
//#region src/components/TanStackTable/TableCellRenderer.tsx
|
|
7
7
|
function o(o) {
|
|
8
|
-
let s = o.getContext().table.options.meta?.getWrapInExpandableTd, c = s
|
|
8
|
+
let s = o.getContext().table.options.meta?.getWrapInExpandableTd, c = s?.(o) ? e : "td", l = o.getContext().table.options.meta?.renderPlaceholderData;
|
|
9
9
|
return /* @__PURE__ */ i(c, {
|
|
10
10
|
style: {
|
|
11
11
|
width: `calc(var(${t(o.column.id)}) * 1px)`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCellRenderer.js","names":[],"sources":["../../../src/components/TanStackTable/TableCellRenderer.tsx"],"sourcesContent":["import { Skeleton } from '@mui/material'\nimport { Cell, flexRender } from '@tanstack/react-table'\nimport ExpandableTableDataCell from '../SynapseTable/ExpandableTableDataCell'\nimport {\n getColumnSizeCssVariable,\n getCommonPinningStyles,\n} from './TanStackTableUtils'\n\nexport function TableCellRenderer<T = unknown>(cell: Cell<T, unknown>) {\n const getWrapInExpandableTd =\n cell.getContext().table.options.meta?.getWrapInExpandableTd\n const wrapInExpandableTd
|
|
1
|
+
{"version":3,"file":"TableCellRenderer.js","names":[],"sources":["../../../src/components/TanStackTable/TableCellRenderer.tsx"],"sourcesContent":["import { Skeleton } from '@mui/material'\nimport { Cell, flexRender } from '@tanstack/react-table'\nimport ExpandableTableDataCell from '../SynapseTable/ExpandableTableDataCell'\nimport {\n getColumnSizeCssVariable,\n getCommonPinningStyles,\n} from './TanStackTableUtils'\n\nexport function TableCellRenderer<T = unknown>(cell: Cell<T, unknown>) {\n const getWrapInExpandableTd =\n cell.getContext().table.options.meta?.getWrapInExpandableTd\n const wrapInExpandableTd = getWrapInExpandableTd?.(cell)\n const TableDataCellElement = wrapInExpandableTd\n ? ExpandableTableDataCell\n : 'td'\n\n const renderPlaceholderData =\n cell.getContext().table.options.meta?.renderPlaceholderData\n\n return (\n <TableDataCellElement\n key={cell.id}\n style={{\n width: `calc(var(${getColumnSizeCssVariable(cell.column.id)}) * 1px)`,\n textAlign: cell.column.columnDef.meta?.textAlign,\n ...getCommonPinningStyles(cell.column),\n }}\n >\n {renderPlaceholderData ? (\n <p>\n <Skeleton width={'80%'} height={'20px'} />\n </p>\n ) : (\n flexRender(cell.column.columnDef.cell, cell.getContext())\n )}\n </TableDataCellElement>\n )\n}\n"],"mappings":";;;;;;AAQA,SAAgB,EAA+B,GAAwB;CACrE,IAAM,IACJ,EAAK,WAAW,EAAE,MAAM,QAAQ,MAAM,uBAElC,IADqB,IAAwB,CAAI,IAEnD,IACA,MAEE,IACJ,EAAK,WAAW,EAAE,MAAM,QAAQ,MAAM;CAExC,OACE,kBAAC,GAAD;EAEE,OAAO;GACL,OAAO,YAAY,EAAyB,EAAK,OAAO,EAAE,EAAE;GAC5D,WAAW,EAAK,OAAO,UAAU,MAAM;GACvC,GAAG,EAAuB,EAAK,MAAM;EACvC;YAEC,IACC,kBAAC,KAAD,EAAA,UACE,kBAAC,GAAD;GAAU,OAAO;GAAO,QAAQ;EAAS,CAAA,EACxC,CAAA,IAEH,EAAW,EAAK,OAAO,UAAU,MAAM,EAAK,WAAW,CAAC;CAEtC,GAdf,EAAK,EAcU;AAE1B"}
|
|
@@ -14,7 +14,7 @@ function f({ termsAndConditionsTableID: f, termsAndConditionsTableVersion: p, on
|
|
|
14
14
|
concreteType: "org.sagebionetworks.repo.model.table.QueryBundleRequest"
|
|
15
15
|
}, { staleTime: Infinity }, !0), S = x && b.status == 404;
|
|
16
16
|
S && m(!0), r(() => {
|
|
17
|
-
if (v
|
|
17
|
+
if (v?.queryResult?.queryResults) {
|
|
18
18
|
let { rows: e, headers: t } = v.queryResult.queryResults, n = t.findIndex((e) => e.name === "icon"), r = t.findIndex((e) => e.name === "label"), i = t.findIndex((e) => e.name === "description"), a = [];
|
|
19
19
|
e.forEach((e) => {
|
|
20
20
|
let { values: t } = e, o = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TermsAndConditions.js","names":[],"sources":["../../../src/components/TermsAndConditions/TermsAndConditions.tsx"],"sourcesContent":["import { useGetFullTableQueryResults } from '@/synapse-queries'\nimport {\n BUNDLE_MASK_QUERY_RESULTS,\n URL_TERMS_CONDITIONS_AGREEMENT,\n} from '@/utils/SynapseConstants'\nimport { Alert, AlertTitle, Button, Link, Typography } from '@mui/material'\nimport { useEffect, useState } from 'react'\nimport TermsAndConditionsItem, {\n LoadingItem,\n tcItem,\n} from './TermsAndConditionsItem'\n\nexport type TermsAndConditionsProps = {\n onFormChange: (formComplete: boolean) => void\n termsAndConditionsTableID: string\n termsAndConditionsTableVersion: string\n hideLinkToFullTC?: boolean\n}\n\nfunction TermsAndConditions({\n termsAndConditionsTableID,\n termsAndConditionsTableVersion,\n onFormChange,\n hideLinkToFullTC = false,\n}: TermsAndConditionsProps) {\n const [tcList, setTcList] = useState<tcItem[]>([])\n // Fetch the table data\n const { data, isLoading, error, isError } = useGetFullTableQueryResults(\n {\n entityId: termsAndConditionsTableID,\n query: {\n sql: `SELECT * FROM ${termsAndConditionsTableID}.${termsAndConditionsTableVersion} ORDER BY order asc`,\n },\n partMask: BUNDLE_MASK_QUERY_RESULTS,\n concreteType: 'org.sagebionetworks.repo.model.table.QueryBundleRequest',\n },\n { staleTime: Infinity },\n true, // force this query to be run as the anonymous user (without an access token)\n )\n\n const isTermsAndConditionsTableNotFound = isError && error.status == 404\n\n if (isTermsAndConditionsTableNotFound) {\n // \"Pledge\" Synapse table is unavailable on this stack. Allow agreement to the terms, but we will show a warning below\n onFormChange(true)\n }\n\n // update tcList when data changes (transform)\n useEffect(() => {\n if (data
|
|
1
|
+
{"version":3,"file":"TermsAndConditions.js","names":[],"sources":["../../../src/components/TermsAndConditions/TermsAndConditions.tsx"],"sourcesContent":["import { useGetFullTableQueryResults } from '@/synapse-queries'\nimport {\n BUNDLE_MASK_QUERY_RESULTS,\n URL_TERMS_CONDITIONS_AGREEMENT,\n} from '@/utils/SynapseConstants'\nimport { Alert, AlertTitle, Button, Link, Typography } from '@mui/material'\nimport { useEffect, useState } from 'react'\nimport TermsAndConditionsItem, {\n LoadingItem,\n tcItem,\n} from './TermsAndConditionsItem'\n\nexport type TermsAndConditionsProps = {\n onFormChange: (formComplete: boolean) => void\n termsAndConditionsTableID: string\n termsAndConditionsTableVersion: string\n hideLinkToFullTC?: boolean\n}\n\nfunction TermsAndConditions({\n termsAndConditionsTableID,\n termsAndConditionsTableVersion,\n onFormChange,\n hideLinkToFullTC = false,\n}: TermsAndConditionsProps) {\n const [tcList, setTcList] = useState<tcItem[]>([])\n // Fetch the table data\n const { data, isLoading, error, isError } = useGetFullTableQueryResults(\n {\n entityId: termsAndConditionsTableID,\n query: {\n sql: `SELECT * FROM ${termsAndConditionsTableID}.${termsAndConditionsTableVersion} ORDER BY order asc`,\n },\n partMask: BUNDLE_MASK_QUERY_RESULTS,\n concreteType: 'org.sagebionetworks.repo.model.table.QueryBundleRequest',\n },\n { staleTime: Infinity },\n true, // force this query to be run as the anonymous user (without an access token)\n )\n\n const isTermsAndConditionsTableNotFound = isError && error.status == 404\n\n if (isTermsAndConditionsTableNotFound) {\n // \"Pledge\" Synapse table is unavailable on this stack. Allow agreement to the terms, but we will show a warning below\n onFormChange(true)\n }\n\n // update tcList when data changes (transform)\n useEffect(() => {\n if (data?.queryResult?.queryResults) {\n const { rows, headers } = data.queryResult.queryResults\n const iconColIndex = headers.findIndex(col => col.name === 'icon')\n const labelColIndex = headers.findIndex(col => col.name === 'label')\n const descriptionColIndex = headers.findIndex(\n col => col.name === 'description',\n )\n const newTcList: tcItem[] = []\n rows.forEach(row => {\n const { values } = row\n const item: tcItem = {\n iconFileHandleId: values[iconColIndex] ?? '',\n label: values[labelColIndex] ?? '',\n description: values[descriptionColIndex] ?? '',\n }\n newTcList.push(item)\n })\n setTcList(newTcList)\n const checkboxCount = newTcList.length\n setCheckboxChecked(getInitialCheckboxState(checkboxCount))\n // disabled all checkbox except the first one\n setCheckboxEnabled(\n getInitialCheckboxState(checkboxCount).fill(true, 0, 1),\n )\n }\n }, [data])\n\n const sageTermsOfService =\n 'https://www.synapse.org/TrustCenter:TermsOfService'\n const trustCenter = 'https://sagebionetworks.org/trust-center'\n const getInitialCheckboxState = (checkboxCount: number) =>\n Array.from(Array(checkboxCount).fill(false))\n let mounted = true\n\n // State variables\n const [checkboxChecked, setCheckboxChecked] = useState<boolean[]>([])\n const [checkboxEnabled, setCheckboxEnabled] = useState<boolean[]>([])\n\n useEffect(() => {\n if (mounted) {\n checkFormCompleted()\n }\n return () => {\n mounted = false\n }\n }, [checkboxEnabled, checkboxChecked])\n\n // Placeholder function to check if all checkboxes are checked and agreement is signed\n const checkFormCompleted = () => {\n const allCheckboxChecked =\n checkboxChecked.length > 0 && !checkboxChecked.includes(false)\n onFormChange(allCheckboxChecked)\n }\n\n const updateCheckboxState = (id: number) => {\n const newState = !checkboxChecked[id]\n const checkboxCount = checkboxChecked.length\n if (newState) {\n // if the checkbox is checked (i.e. newState is true)\n setCheckboxChecked(\n getInitialCheckboxState(checkboxCount).fill(true, 0, id + 1),\n )\n if (id + 2 <= tcList.length) {\n setCheckboxEnabled(\n getInitialCheckboxState(checkboxCount).fill(true, 0, id + 2),\n )\n }\n } else {\n setCheckboxChecked(\n getInitialCheckboxState(checkboxCount).fill(true, 0, id),\n )\n setCheckboxEnabled(\n getInitialCheckboxState(checkboxCount).fill(true, 0, id + 1),\n )\n }\n }\n\n return (\n <section className=\"terms-conditions\">\n <h3 className=\"page-header\">Pledge</h3>\n <form>\n <label>\n I affirm my commitment to Sage's{' '}\n <Link target=\"_blank\" href={sageTermsOfService}>\n Terms of Service\n </Link>{' '}\n and policies for responsible research and data handling (\n <Link target=\"_blank\" href={trustCenter}>\n Trust Center\n </Link>\n ), including:\n </label>\n {isTermsAndConditionsTableNotFound && (\n <Alert severity=\"warning\">\n <AlertTitle>Source data unavailable</AlertTitle>\n <Typography variant=\"body1\">\n We are unable to display the source table content for the Synapse\n Pledge at this time. Please review the full{' '}\n <Link target=\"_blank\" href={sageTermsOfService}>\n {' '}\n Terms of Service{' '}\n </Link>{' '}\n carefully before proceeding. By clicking \"Agree And Continue,\" you\n confirm that you have read and understood the Terms and Conditions\n for use.\n </Typography>\n </Alert>\n )}\n <ul className=\"term-list\">\n {isLoading && <LoadingItem numLoadingItems={6} />}\n {tcList.length > 0 &&\n tcList.map((item, i) => {\n return (\n <TermsAndConditionsItem\n key={`tc-item-${i}`}\n item={item}\n id={i}\n checked={checkboxChecked[i]}\n enabled={checkboxEnabled[i]}\n termsAndConditionsTableID={termsAndConditionsTableID}\n onChange={updateCheckboxState}\n />\n )\n })}\n </ul>\n {!hideLinkToFullTC && (\n <div className=\"view-terms\">\n <Button\n variant={'contained'}\n href={URL_TERMS_CONDITIONS_AGREEMENT}\n target=\"_blank\"\n >\n View Complete Terms and Conditions for Use\n </Button>\n </div>\n )}\n </form>\n </section>\n )\n}\n\nexport default TermsAndConditions\n"],"mappings":";;;;;;;;AAmBA,SAAS,EAAmB,EAC1B,8BACA,mCACA,iBACA,sBAAmB,MACO;CAC1B,IAAM,CAAC,GAAQ,KAAa,EAAmB,CAAC,CAAC,GAE3C,EAAE,SAAM,cAAW,UAAO,eAAY,EAC1C;EACE,UAAU;EACV,OAAO,EACL,KAAK,iBAAiB,EAA0B,GAAG,EAA+B,qBACpF;EACA,UAAA;EACA,cAAc;CAChB,GACA,EAAE,WAAW,SAAS,GACtB,EACF,GAEM,IAAoC,KAAW,EAAM,UAAU;CAQrE,AANI,KAEF,EAAa,EAAI,GAInB,QAAgB;EACd,IAAI,GAAM,aAAa,cAAc;GACnC,IAAM,EAAE,SAAM,eAAY,EAAK,YAAY,cACrC,IAAe,EAAQ,WAAU,MAAO,EAAI,SAAS,MAAM,GAC3D,IAAgB,EAAQ,WAAU,MAAO,EAAI,SAAS,OAAO,GAC7D,IAAsB,EAAQ,WAClC,MAAO,EAAI,SAAS,aACtB,GACM,IAAsB,CAAC;GAU7B,AATA,EAAK,SAAQ,MAAO;IAClB,IAAM,EAAE,cAAW,GACb,IAAe;KACnB,kBAAkB,EAAO,MAAiB;KAC1C,OAAO,EAAO,MAAkB;KAChC,aAAa,EAAO,MAAw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,MAAM;eAAa;IAEnC,CAAA;IAAC;GAEF,EAAA,CAAA;GACN,KACC,kBAAC,GAAD;IAAO,UAAS;cAAhB,CACE,kBAAC,GAAD,EAAA,UAAY,0BAAmC,CAAA,GAC/C,kBAAC,GAAD;KAAY,SAAQ;eAApB;MAA4B;MAEkB;MAC5C,kBAAC,GAAD;OAAM,QAAO;OAAS,MAAM;iBAA5B;QACG;QAAI;QACY;OACb;;MAAE;MAAI;KAIF;MACP;;GAET,kBAAC,MAAD;IAAI,WAAU;cAAd,CACG,KAAa,kBAAC,GAAD,EAAa,iBAAiB,EAAI,CAAA,GAC/C,EAAO,SAAS,KACf,EAAO,KAAK,GAAM,MAEd,kBAAC,GAAD;KAEQ;KACN,IAAI;KACJ,SAAS,EAAgB;KACzB,SAAS,EAAgB;KACE;KAC3B,UAAU;IACX,GAPM,WAAW,GAOjB,CAEJ,CACD;;GACH,CAAC,KACA,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,GAAD;KACE,SAAS;KACT,MAAA;KACA,QAAO;eACR;IAEO,CAAA;GACL,CAAA;EAEH,EAAA,CAAA,CACC;;AAEb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateWebhookModal.d.ts","sourceRoot":"","sources":["../../../src/components/Webhook/CreateWebhookModal.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAIL,OAAO,EAER,MAAM,kCAAkC,CAAA;AAUzC,KAAK,uBAAuB,GAAG;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAgCD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"CreateWebhookModal.d.ts","sourceRoot":"","sources":["../../../src/components/Webhook/CreateWebhookModal.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAIL,OAAO,EAER,MAAM,kCAAkC,CAAA;AAUzC,KAAK,uBAAuB,GAAG;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAgCD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CA8TxE"}
|
|
@@ -72,7 +72,7 @@ function j(p) {
|
|
|
72
72
|
function fe() {
|
|
73
73
|
j && ue(j.id);
|
|
74
74
|
}
|
|
75
|
-
let $ = Q
|
|
75
|
+
let $ = Q?.errorResponse && "errorCode" in Q.errorResponse && Q.errorResponse.errorCode === te.UNSUPPORTED_WEBHOOK_DOMAIN, pe = j && j.verificationStatus === ie.VERIFIED ? A : c;
|
|
76
76
|
return /* @__PURE__ */ E(n, {
|
|
77
77
|
open: M,
|
|
78
78
|
title: "Create New Webhook",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateWebhookModal.js","names":[],"sources":["../../../src/components/Webhook/CreateWebhookModal.tsx"],"sourcesContent":["import {\n useCreateWebhook,\n useDeleteWebhook,\n useUpdateWebhook,\n} from '@/synapse-queries/webhook/useWebhook'\nimport DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone'\nimport SearchOutlined from '@mui/icons-material/SearchOutlined'\nimport {\n Alert,\n Box,\n Button,\n Checkbox,\n FormControlLabel,\n FormGroup,\n Grid,\n IconButton,\n InputLabel,\n Link,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport {\n ErrorResponseCode,\n SynapseEventType,\n SynapseObjectType,\n Webhook,\n WebhookVerificationStatus,\n} from '@sage-bionetworks/synapse-client'\nimport { upperFirst } from 'lodash-es'\nimport { Fragment, PropsWithChildren, useEffect, useState } from 'react'\nimport { ConfirmationDialog } from '../ConfirmationDialog/ConfirmationDialog'\nimport { EntityFinderModal } from '../EntityFinder/EntityFinderModal'\nimport { FinderScope } from '../EntityFinder/tree/EntityTree'\nimport { VersionSelectionType } from '../EntityFinder/VersionSelectionType'\nimport { HelpPopover } from '../HelpPopover/HelpPopover'\nimport { displayToast } from '../ToastMessage/ToastMessage'\n\ntype CreateWebhookModalProps = {\n initialData?: Webhook\n open: boolean\n onClose: () => void\n}\n\nconst NEW_ENDPOINT_DOMAIN_REQUEST_TITLE = encodeURIComponent(\n 'Request to add new domain for webhook verification',\n)\nconst NEW_ENDPOINT_DOMAIN_REQUEST_SUMMARY = encodeURIComponent(\n '<Please provide the domain(s) you wish to use and any additional details related to your request.>',\n)\nconst NEW_ENDPOINT_CONTACT_FORM_URL = `https://sagebionetworks.jira.com/servicedesk/customer/portal/9/group/16/create/85?summary=${NEW_ENDPOINT_DOMAIN_REQUEST_TITLE}&description=${NEW_ENDPOINT_DOMAIN_REQUEST_SUMMARY}`\n\nfunction UpdateWarningWrapper(props: PropsWithChildren) {\n return (\n <Box\n sx={{\n mt: '10px',\n py: 2,\n px: 4,\n backgroundColor: 'rgb(178, 36, 42, 0.03)',\n }}\n >\n <Typography sx={{ my: 1 }} color=\"error\" variant=\"headline3\" gutterBottom>\n DANGER ZONE\n </Typography>\n <Typography variant=\"body1\" gutterBottom>\n Editing the following information will require you to re-verify the\n webhook.\n </Typography>\n {props.children}\n </Box>\n )\n}\n\nexport default function CreateWebhookModal(props: CreateWebhookModalProps) {\n const { initialData, open, onClose } = props\n\n // Form state\n const objectType: SynapseObjectType = SynapseObjectType.ENTITY // Currently only entities can be selected\n const [objectId, setObjectId] = useState<string>('')\n const [eventTypes, setEventTypes] = useState<Set<SynapseEventType>>(new Set())\n const [invokeEndpoint, setInvokeEndpoint] = useState<string>('')\n const [enabled, setEnabled] = useState(true)\n\n useEffect(() => {\n setObjectId(initialData?.objectId || '')\n setEventTypes(\n new Set(initialData?.eventTypes || []) as Set<SynapseEventType>,\n )\n setInvokeEndpoint(initialData?.invokeEndpoint || '')\n setEnabled(initialData?.isEnabled ?? true)\n }, [initialData])\n\n const [showEntityFinder, setShowEntityFinder] = useState(false)\n const [showDeleteConfirmation, setShowDeleteConfirmation] = useState(false)\n\n const {\n mutate: createWebhook,\n isPending: isCreatePending,\n error: createError,\n } = useCreateWebhook({\n onSuccess: () => {\n displayToast('Webhook created', 'success')\n onClose()\n },\n })\n\n const {\n mutate: updateWebhook,\n isPending: isUpdatePending,\n error: updateError,\n } = useUpdateWebhook({\n onSuccess: () => {\n displayToast('Webhook updated', 'success')\n onClose()\n },\n })\n\n const {\n mutate: deleteWebhook,\n isPending: isDeletePending,\n error: deleteError,\n } = useDeleteWebhook({\n onSuccess: () => {\n displayToast('Webhook deleted', 'info')\n setShowDeleteConfirmation(false)\n onClose()\n },\n })\n\n const isPending = isCreatePending || isUpdatePending\n const error = createError || updateError\n\n function handleConfirm() {\n if (initialData) {\n updateWebhook({\n webhookId: initialData.id!,\n createOrUpdateWebhookRequest: {\n objectType,\n objectId,\n eventTypes,\n invokeEndpoint,\n isEnabled: enabled,\n },\n })\n } else {\n createWebhook({\n objectType,\n objectId,\n eventTypes,\n invokeEndpoint,\n isEnabled: enabled,\n })\n }\n }\n\n function handleDelete() {\n if (initialData) {\n deleteWebhook(initialData.id!)\n }\n }\n\n // If the user attempts to use a domain that has not been added to the allowlist, link to a form to create a request.\n const showRequestDomainForm =\n error &&\n error.errorResponse &&\n 'errorCode' in error.errorResponse &&\n error.errorResponse.errorCode ===\n ErrorResponseCode.UNSUPPORTED_WEBHOOK_DOMAIN\n\n // Wrap certain fields in a wrapper if they will require re-verifying the webhook\n const RevalidationFieldsWrapper =\n initialData &&\n initialData.verificationStatus === WebhookVerificationStatus.VERIFIED\n ? UpdateWarningWrapper\n : Fragment\n\n return (\n <ConfirmationDialog\n open={open}\n title={'Create New Webhook'}\n maxWidth={'md'}\n onCancel={onClose}\n onConfirm={() => {\n handleConfirm()\n }}\n confirmButtonProps={{\n children: `${initialData ? 'Update' : 'Create'} Webhook`,\n disabled: isPending,\n }}\n cancelButtonProps={{\n disabled: isPending,\n }}\n content={\n <>\n <Grid container spacing={2}>\n <Grid size={12}>\n <Typography variant={'body1'} gutterBottom>\n Specify the ID of the entity and the types of events you would\n like to receive. Once you complete this step, Synapse will send\n a verification code to the endpoint you specify. After you\n verify your webhook, Synapse will send your chosen events to the\n verified endpoint.\n </Typography>\n </Grid>\n <Grid\n size={{\n xs: 12,\n md: 6,\n }}\n >\n <EntityFinderModal\n configuration={{\n initialScope: FinderScope.ALL_PROJECTS,\n initialContainer: 'root',\n selectMultiple: false,\n treeOnly: false,\n versionSelection: VersionSelectionType.DISALLOWED,\n }}\n show={showEntityFinder}\n onCancel={() => {\n setShowEntityFinder(false)\n }}\n title={'Select item for Webhook'}\n promptCopy={\n 'Select an item to associate with the webhook. The webhook can be used to receive programmatic alerts when the item is updated.'\n }\n onConfirm={selected => {\n setObjectId(selected[0].targetId)\n setShowEntityFinder(false)\n }}\n confirmButtonCopy={'Select'}\n />\n <TextField\n required\n label={\n <>\n Entity ID\n <HelpPopover\n containerSx={{\n position: 'fixed',\n ml: '15px',\n fontSize: '12px',\n }}\n markdownText={\n 'The ID of a Synapse entity for which to receive events. For folders and projects, matching events are published to the webhook endpoint for any entity in their hierarchy.'\n }\n />\n </>\n }\n type=\"text\"\n fullWidth\n value={objectId}\n onChange={e => {\n setObjectId(e.target.value)\n }}\n slotProps={{\n input: {\n endAdornment: (\n <IconButton onClick={() => setShowEntityFinder(true)}>\n <SearchOutlined />\n </IconButton>\n ),\n },\n }}\n />\n </Grid>\n <Grid size={6}>\n <FormControlLabel\n control={<Switch />}\n labelPlacement={'top'}\n label={<InputLabel>Enabled</InputLabel>}\n checked={enabled}\n onChange={(_e, checked) => {\n setEnabled(checked)\n }}\n />\n </Grid>\n <Grid\n size={{\n xs: 12,\n md: 6,\n }}\n >\n <FormGroup>\n <InputLabel required>Events</InputLabel>\n {Object.values(SynapseEventType).map(eventType => (\n <FormControlLabel\n control={<Checkbox />}\n label={upperFirst(eventType.toLowerCase())}\n key={eventType}\n checked={eventTypes.has(eventType)}\n onChange={(_e, checked) => {\n setEventTypes(curr => {\n if (checked) {\n const newSet = new Set(curr)\n newSet.add(eventType)\n return newSet\n } else {\n curr.delete(eventType)\n return new Set<SynapseEventType>(curr)\n }\n })\n }}\n />\n ))}\n </FormGroup>\n </Grid>\n <Grid size={12}>\n <RevalidationFieldsWrapper>\n <TextField\n label={'Endpoint'}\n fullWidth\n value={invokeEndpoint}\n onChange={e => setInvokeEndpoint(e.target.value)}\n required\n placeholder={'https://'}\n />\n {initialData && (\n <>\n <Button\n onClick={() => {\n setShowDeleteConfirmation(true)\n }}\n color=\"error\"\n variant={'outlined'}\n startIcon={<DeleteTwoToneIcon />}\n sx={{ my: 2 }}\n >\n Delete Webhook\n </Button>\n <ConfirmationDialog\n title={'Confirm Delete Webhook?'}\n onCancel={() => setShowDeleteConfirmation(false)}\n open={showDeleteConfirmation}\n content={\n <>\n <Typography variant={'body1'}>\n Are you sure you want to delete this webhook? This\n action cannot be undone.\n </Typography>\n {deleteError && (\n <Alert severity=\"error\" sx={{ mt: 2 }}>\n {deleteError.reason}\n </Alert>\n )}\n </>\n }\n onConfirm={() => {\n handleDelete()\n }}\n confirmButtonProps={{\n children: 'Delete',\n color: 'error',\n disabled: isDeletePending,\n }}\n cancelButtonProps={{ disabled: isDeletePending }}\n />\n </>\n )}\n </RevalidationFieldsWrapper>\n </Grid>\n </Grid>\n\n {error && (\n <Alert severity=\"error\" sx={{ my: 2 }}>\n {showRequestDomainForm && (\n <>\n Synapse only permits configuring webhooks on verified domains,\n which are specified in the{' '}\n <Link\n href={\n 'https://rest-docs.synapse.org/rest/index.html#org.sagebionetworks.repo.web.controller.WebhookController'\n }\n target={'_blank'}\n >\n REST documentation\n </Link>\n . You have entered a domain that has not been verified.{' '}\n <Link href={NEW_ENDPOINT_CONTACT_FORM_URL} target={'_blank'}>\n Please fill out this form to request verification for your\n webhook domain\n </Link>\n .\n </>\n )}\n {!showRequestDomainForm && error.reason}\n </Alert>\n )}\n </>\n }\n />\n )\n}\n"],"mappings":";;;;;;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kBAAC,GAAD;MACE,OAAO;MACP,WAAA;MACA,OAAO;MACP,WAAU,MAAK,EAAkB,EAAE,OAAO,KAAK;MAC/C,UAAA;MACA,aAAa;KACd,CAAA,GACA,KACC,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;MACE,eAAe;OACb,EAA0B,EAAI;MAChC;MACA,OAAM;MACN,SAAS;MACT,WAAW,kBAAC,IAAD,CAAoB,CAAA;MAC/B,IAAI,EAAE,IAAI,EAAE;gBACb;KAEO,CAAA,GACR,kBAAC,GAAD;MACE,OAAO;MACP,gBAAgB,EAA0B,EAAK;MAC/C,MAAM;MACN,SACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;OAAY,SAAS;iBAAS;MAGlB,CAAA,GACX,KACC,kBAAC,GAAD;OAAO,UAAS;OAAQ,IAAI,EAAE,IAAI,EAAE;iBACjC,EAAY;MACR,CAAA,CAET,EAAA,CAAA;MAEJ,iBAAiB;OACf,GAAa;MACf;MACA,oBAAoB;OAClB,UAAU;OACV,OAAO;OACP,UAAU;MACZ;MACA,mBAAmB,EAAE,UAAU,EAAgB;KAChD,CAAA,CACD,EAAA,CAAA,CAEqB,EAAA,CAAA;IACvB,CAAA;GACF;MAEL,KACC,kBAAC,GAAD;GAAO,UAAS;GAAQ,IAAI,EAAE,IAAI,EAAE;aAApC,CACG,KACC,kBAAA,GAAA,EAAA,UAAA;IAAE;IAE2B;IAC3B,kBAAC,GAAD;KACE,MACE;KAEF,QAAQ;eACT;IAEK,CAAA;IAAC;IACiD;IACxD,kBAAC,GAAD;KAAM,MAAM;KAA+B,QAAQ;eAAU;IAGvD,CAAA;IAAC;GAEP,EAAA,CAAA,GAEH,CAAC,KAAyB,EAAM,MAC5B;IAET,EAAA,CAAA;CAEL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"CreateWebhookModal.js","names":[],"sources":["../../../src/components/Webhook/CreateWebhookModal.tsx"],"sourcesContent":["import {\n useCreateWebhook,\n useDeleteWebhook,\n useUpdateWebhook,\n} from '@/synapse-queries/webhook/useWebhook'\nimport DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone'\nimport SearchOutlined from '@mui/icons-material/SearchOutlined'\nimport {\n Alert,\n Box,\n Button,\n Checkbox,\n FormControlLabel,\n FormGroup,\n Grid,\n IconButton,\n InputLabel,\n Link,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport {\n ErrorResponseCode,\n SynapseEventType,\n SynapseObjectType,\n Webhook,\n WebhookVerificationStatus,\n} from '@sage-bionetworks/synapse-client'\nimport { upperFirst } from 'lodash-es'\nimport { Fragment, PropsWithChildren, useEffect, useState } from 'react'\nimport { ConfirmationDialog } from '../ConfirmationDialog/ConfirmationDialog'\nimport { EntityFinderModal } from '../EntityFinder/EntityFinderModal'\nimport { FinderScope } from '../EntityFinder/tree/EntityTree'\nimport { VersionSelectionType } from '../EntityFinder/VersionSelectionType'\nimport { HelpPopover } from '../HelpPopover/HelpPopover'\nimport { displayToast } from '../ToastMessage/ToastMessage'\n\ntype CreateWebhookModalProps = {\n initialData?: Webhook\n open: boolean\n onClose: () => void\n}\n\nconst NEW_ENDPOINT_DOMAIN_REQUEST_TITLE = encodeURIComponent(\n 'Request to add new domain for webhook verification',\n)\nconst NEW_ENDPOINT_DOMAIN_REQUEST_SUMMARY = encodeURIComponent(\n '<Please provide the domain(s) you wish to use and any additional details related to your request.>',\n)\nconst NEW_ENDPOINT_CONTACT_FORM_URL = `https://sagebionetworks.jira.com/servicedesk/customer/portal/9/group/16/create/85?summary=${NEW_ENDPOINT_DOMAIN_REQUEST_TITLE}&description=${NEW_ENDPOINT_DOMAIN_REQUEST_SUMMARY}`\n\nfunction UpdateWarningWrapper(props: PropsWithChildren) {\n return (\n <Box\n sx={{\n mt: '10px',\n py: 2,\n px: 4,\n backgroundColor: 'rgb(178, 36, 42, 0.03)',\n }}\n >\n <Typography sx={{ my: 1 }} color=\"error\" variant=\"headline3\" gutterBottom>\n DANGER ZONE\n </Typography>\n <Typography variant=\"body1\" gutterBottom>\n Editing the following information will require you to re-verify the\n webhook.\n </Typography>\n {props.children}\n </Box>\n )\n}\n\nexport default function CreateWebhookModal(props: CreateWebhookModalProps) {\n const { initialData, open, onClose } = props\n\n // Form state\n const objectType: SynapseObjectType = SynapseObjectType.ENTITY // Currently only entities can be selected\n const [objectId, setObjectId] = useState<string>('')\n const [eventTypes, setEventTypes] = useState<Set<SynapseEventType>>(new Set())\n const [invokeEndpoint, setInvokeEndpoint] = useState<string>('')\n const [enabled, setEnabled] = useState(true)\n\n useEffect(() => {\n setObjectId(initialData?.objectId || '')\n setEventTypes(\n new Set(initialData?.eventTypes || []) as Set<SynapseEventType>,\n )\n setInvokeEndpoint(initialData?.invokeEndpoint || '')\n setEnabled(initialData?.isEnabled ?? true)\n }, [initialData])\n\n const [showEntityFinder, setShowEntityFinder] = useState(false)\n const [showDeleteConfirmation, setShowDeleteConfirmation] = useState(false)\n\n const {\n mutate: createWebhook,\n isPending: isCreatePending,\n error: createError,\n } = useCreateWebhook({\n onSuccess: () => {\n displayToast('Webhook created', 'success')\n onClose()\n },\n })\n\n const {\n mutate: updateWebhook,\n isPending: isUpdatePending,\n error: updateError,\n } = useUpdateWebhook({\n onSuccess: () => {\n displayToast('Webhook updated', 'success')\n onClose()\n },\n })\n\n const {\n mutate: deleteWebhook,\n isPending: isDeletePending,\n error: deleteError,\n } = useDeleteWebhook({\n onSuccess: () => {\n displayToast('Webhook deleted', 'info')\n setShowDeleteConfirmation(false)\n onClose()\n },\n })\n\n const isPending = isCreatePending || isUpdatePending\n const error = createError || updateError\n\n function handleConfirm() {\n if (initialData) {\n updateWebhook({\n webhookId: initialData.id!,\n createOrUpdateWebhookRequest: {\n objectType,\n objectId,\n eventTypes,\n invokeEndpoint,\n isEnabled: enabled,\n },\n })\n } else {\n createWebhook({\n objectType,\n objectId,\n eventTypes,\n invokeEndpoint,\n isEnabled: enabled,\n })\n }\n }\n\n function handleDelete() {\n if (initialData) {\n deleteWebhook(initialData.id!)\n }\n }\n\n // If the user attempts to use a domain that has not been added to the allowlist, link to a form to create a request.\n const showRequestDomainForm =\n error?.errorResponse &&\n 'errorCode' in error.errorResponse &&\n error.errorResponse.errorCode ===\n ErrorResponseCode.UNSUPPORTED_WEBHOOK_DOMAIN\n\n // Wrap certain fields in a wrapper if they will require re-verifying the webhook\n const RevalidationFieldsWrapper =\n initialData &&\n initialData.verificationStatus === WebhookVerificationStatus.VERIFIED\n ? UpdateWarningWrapper\n : Fragment\n\n return (\n <ConfirmationDialog\n open={open}\n title={'Create New Webhook'}\n maxWidth={'md'}\n onCancel={onClose}\n onConfirm={() => {\n handleConfirm()\n }}\n confirmButtonProps={{\n children: `${initialData ? 'Update' : 'Create'} Webhook`,\n disabled: isPending,\n }}\n cancelButtonProps={{\n disabled: isPending,\n }}\n content={\n <>\n <Grid container spacing={2}>\n <Grid size={12}>\n <Typography variant={'body1'} gutterBottom>\n Specify the ID of the entity and the types of events you would\n like to receive. Once you complete this step, Synapse will send\n a verification code to the endpoint you specify. After you\n verify your webhook, Synapse will send your chosen events to the\n verified endpoint.\n </Typography>\n </Grid>\n <Grid\n size={{\n xs: 12,\n md: 6,\n }}\n >\n <EntityFinderModal\n configuration={{\n initialScope: FinderScope.ALL_PROJECTS,\n initialContainer: 'root',\n selectMultiple: false,\n treeOnly: false,\n versionSelection: VersionSelectionType.DISALLOWED,\n }}\n show={showEntityFinder}\n onCancel={() => {\n setShowEntityFinder(false)\n }}\n title={'Select item for Webhook'}\n promptCopy={\n 'Select an item to associate with the webhook. The webhook can be used to receive programmatic alerts when the item is updated.'\n }\n onConfirm={selected => {\n setObjectId(selected[0].targetId)\n setShowEntityFinder(false)\n }}\n confirmButtonCopy={'Select'}\n />\n <TextField\n required\n label={\n <>\n Entity ID\n <HelpPopover\n containerSx={{\n position: 'fixed',\n ml: '15px',\n fontSize: '12px',\n }}\n markdownText={\n 'The ID of a Synapse entity for which to receive events. For folders and projects, matching events are published to the webhook endpoint for any entity in their hierarchy.'\n }\n />\n </>\n }\n type=\"text\"\n fullWidth\n value={objectId}\n onChange={e => {\n setObjectId(e.target.value)\n }}\n slotProps={{\n input: {\n endAdornment: (\n <IconButton onClick={() => setShowEntityFinder(true)}>\n <SearchOutlined />\n </IconButton>\n ),\n },\n }}\n />\n </Grid>\n <Grid size={6}>\n <FormControlLabel\n control={<Switch />}\n labelPlacement={'top'}\n label={<InputLabel>Enabled</InputLabel>}\n checked={enabled}\n onChange={(_e, checked) => {\n setEnabled(checked)\n }}\n />\n </Grid>\n <Grid\n size={{\n xs: 12,\n md: 6,\n }}\n >\n <FormGroup>\n <InputLabel required>Events</InputLabel>\n {Object.values(SynapseEventType).map(eventType => (\n <FormControlLabel\n control={<Checkbox />}\n label={upperFirst(eventType.toLowerCase())}\n key={eventType}\n checked={eventTypes.has(eventType)}\n onChange={(_e, checked) => {\n setEventTypes(curr => {\n if (checked) {\n const newSet = new Set(curr)\n newSet.add(eventType)\n return newSet\n } else {\n curr.delete(eventType)\n return new Set<SynapseEventType>(curr)\n }\n })\n }}\n />\n ))}\n </FormGroup>\n </Grid>\n <Grid size={12}>\n <RevalidationFieldsWrapper>\n <TextField\n label={'Endpoint'}\n fullWidth\n value={invokeEndpoint}\n onChange={e => setInvokeEndpoint(e.target.value)}\n required\n placeholder={'https://'}\n />\n {initialData && (\n <>\n <Button\n onClick={() => {\n setShowDeleteConfirmation(true)\n }}\n color=\"error\"\n variant={'outlined'}\n startIcon={<DeleteTwoToneIcon />}\n sx={{ my: 2 }}\n >\n Delete Webhook\n </Button>\n <ConfirmationDialog\n title={'Confirm Delete Webhook?'}\n onCancel={() => setShowDeleteConfirmation(false)}\n open={showDeleteConfirmation}\n content={\n <>\n <Typography variant={'body1'}>\n Are you sure you want to delete this webhook? This\n action cannot be undone.\n </Typography>\n {deleteError && (\n <Alert severity=\"error\" sx={{ mt: 2 }}>\n {deleteError.reason}\n </Alert>\n )}\n </>\n }\n onConfirm={() => {\n handleDelete()\n }}\n confirmButtonProps={{\n children: 'Delete',\n color: 'error',\n disabled: isDeletePending,\n }}\n cancelButtonProps={{ disabled: isDeletePending }}\n />\n </>\n )}\n </RevalidationFieldsWrapper>\n </Grid>\n </Grid>\n\n {error && (\n <Alert severity=\"error\" sx={{ my: 2 }}>\n {showRequestDomainForm && (\n <>\n Synapse only permits configuring webhooks on verified domains,\n which are specified in the{' '}\n <Link\n href={\n 'https://rest-docs.synapse.org/rest/index.html#org.sagebionetworks.repo.web.controller.WebhookController'\n }\n target={'_blank'}\n >\n REST documentation\n </Link>\n . You have entered a domain that has not been verified.{' '}\n <Link href={NEW_ENDPOINT_CONTACT_FORM_URL} target={'_blank'}>\n Please fill out this form to request verification for your\n webhook domain\n </Link>\n .\n </>\n )}\n {!showRequestDomainForm && error.reason}\n </Alert>\n )}\n </>\n }\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkDA,IAAM,IAAgC;AAEtC,SAAS,EAAqB,GAA0B;CACtD,OACE,kBAAC,GAAD;EACE,IAAI;GACF,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,iBAAiB;EACnB;YANF;GAQE,kBAAC,GAAD;IAAY,IAAI,EAAE,IAAI,EAAE;IAAG,OAAM;IAAQ,SAAQ;IAAY,cAAA;cAAa;GAE9D,CAAA;GACZ,kBAAC,GAAD;IAAY,SAAQ;IAAQ,cAAA;cAAa;GAG7B,CAAA;GACX,EAAM;EACJ;;AAET;AAEA,SAAwB,EAAmB,GAAgC;CACzE,IAAM,EAAE,gBAAa,SAAM,eAAY,GAGjC,IAAgC,GAAkB,QAClD,CAAC,GAAU,KAAe,EAAiB,EAAE,GAC7C,CAAC,GAAY,KAAiB,kBAAgC,IAAI,IAAI,CAAC,GACvE,CAAC,GAAgB,KAAqB,EAAiB,EAAE,GACzD,CAAC,GAAS,KAAc,EAAS,EAAI;CAE3C,QAAgB;EAMd,AALA,EAAY,GAAa,YAAY,EAAE,GACvC,EACE,IAAI,IAAI,GAAa,cAAc,CAAC,CAAC,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CAAA,CACD,EAAA,CAAA,CAEqB,EAAA,CAAA;IACvB,CAAA;GACF;MAEL,KACC,kBAAC,GAAD;GAAO,UAAS;GAAQ,IAAI,EAAE,IAAI,EAAE;aAApC,CACG,KACC,kBAAA,GAAA,EAAA,UAAA;IAAE;IAE2B;IAC3B,kBAAC,GAAD;KACE,MACE;KAEF,QAAQ;eACT;IAEK,CAAA;IAAC;IACiD;IACxD,kBAAC,GAAD;KAAM,MAAM;KAA+B,QAAQ;eAAU;IAGvD,CAAA;IAAC;GAEP,EAAA,CAAA,GAEH,CAAC,KAAyB,EAAM,MAC5B;IAET,EAAA,CAAA;CAEL,CAAA;AAEL"}
|
package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InFlightEDucSignaturesTable.d.ts","sourceRoot":"","sources":["../../../../src/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InFlightEDucSignaturesTable.d.ts","sourceRoot":"","sources":["../../../../src/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.tsx"],"names":[],"mappings":"AA8IA;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,mDA8J1C"}
|