@burdenoff/microfe-cosmicintersection 2026.1110.1 → 2026.1111.1
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/cosmicintersection/CosmicIntersectionRoot.d.ts +0 -1
- package/dist/cosmicintersection/CosmicIntersectionRoot.js +1 -2
- package/dist/cosmicintersection/CosmicIntersectionRoot.js.map +1 -1
- package/dist/cosmicintersection/CosmicIntersectionRoutes.d.ts +0 -1
- package/dist/cosmicintersection/CosmicIntersectionRoutes.js +1 -2
- package/dist/cosmicintersection/CosmicIntersectionRoutes.js.map +1 -1
- package/dist/cosmicintersection/api/cosmicApi.d.ts +0 -1
- package/dist/cosmicintersection/api/cosmicApi.js +1 -2
- package/dist/cosmicintersection/api/cosmicApi.js.map +1 -1
- package/dist/cosmicintersection/api/databricksTransport.d.ts +0 -1
- package/dist/cosmicintersection/api/databricksTransport.js +1 -2
- package/dist/cosmicintersection/api/databricksTransport.js.map +1 -1
- package/dist/cosmicintersection/api/tagsApi.d.ts +0 -1
- package/dist/cosmicintersection/api/tagsApi.js +1 -2
- package/dist/cosmicintersection/api/tagsApi.js.map +1 -1
- package/dist/cosmicintersection/components/ActionMenu.d.ts +0 -1
- package/dist/cosmicintersection/components/ActionMenu.js +1 -2
- package/dist/cosmicintersection/components/ActionMenu.js.map +1 -1
- package/dist/cosmicintersection/components/ActivityFeedPanel.d.ts +0 -1
- package/dist/cosmicintersection/components/ActivityFeedPanel.js +27 -25
- package/dist/cosmicintersection/components/ActivityFeedPanel.js.map +1 -1
- package/dist/cosmicintersection/components/AiRunAttribution.d.ts +0 -1
- package/dist/cosmicintersection/components/AiRunAttribution.js +1 -2
- package/dist/cosmicintersection/components/AiRunAttribution.js.map +1 -1
- package/dist/cosmicintersection/components/DatabricksQueueForm.d.ts +0 -1
- package/dist/cosmicintersection/components/DatabricksQueueForm.js +1 -2
- package/dist/cosmicintersection/components/DatabricksQueueForm.js.map +1 -1
- package/dist/cosmicintersection/components/DatabricksRunPanel.d.ts +0 -1
- package/dist/cosmicintersection/components/DatabricksRunPanel.js +1 -2
- package/dist/cosmicintersection/components/DatabricksRunPanel.js.map +1 -1
- package/dist/cosmicintersection/components/DiscussionPanel.d.ts +0 -1
- package/dist/cosmicintersection/components/DiscussionPanel.js +4 -4
- package/dist/cosmicintersection/components/DiscussionPanel.js.map +1 -1
- package/dist/cosmicintersection/components/EmptyState.d.ts +0 -1
- package/dist/cosmicintersection/components/EmptyState.js +1 -2
- package/dist/cosmicintersection/components/EmptyState.js.map +1 -1
- package/dist/cosmicintersection/components/EntityFormShell.d.ts +0 -1
- package/dist/cosmicintersection/components/EntityFormShell.js +1 -2
- package/dist/cosmicintersection/components/EntityFormShell.js.map +1 -1
- package/dist/cosmicintersection/components/EntityTagsField.d.ts +0 -1
- package/dist/cosmicintersection/components/EntityTagsField.js +1 -2
- package/dist/cosmicintersection/components/EntityTagsField.js.map +1 -1
- package/dist/cosmicintersection/components/ErrorState.d.ts +0 -1
- package/dist/cosmicintersection/components/ErrorState.js +1 -2
- package/dist/cosmicintersection/components/ErrorState.js.map +1 -1
- package/dist/cosmicintersection/components/FacetPanel.d.ts +0 -1
- package/dist/cosmicintersection/components/FacetPanel.js +1 -2
- package/dist/cosmicintersection/components/FacetPanel.js.map +1 -1
- package/dist/cosmicintersection/components/FileUploadField.d.ts +5 -2
- package/dist/cosmicintersection/components/FileUploadField.js +80 -76
- package/dist/cosmicintersection/components/FileUploadField.js.map +1 -1
- package/dist/cosmicintersection/components/LineageGraph.d.ts +0 -1
- package/dist/cosmicintersection/components/LineageGraph.js +7 -12
- package/dist/cosmicintersection/components/LineageGraph.js.map +1 -1
- package/dist/cosmicintersection/components/LoadingState.d.ts +0 -1
- package/dist/cosmicintersection/components/LoadingState.js +1 -2
- package/dist/cosmicintersection/components/LoadingState.js.map +1 -1
- package/dist/cosmicintersection/components/PageLayout.d.ts +0 -1
- package/dist/cosmicintersection/components/PageLayout.js +1 -2
- package/dist/cosmicintersection/components/PageLayout.js.map +1 -1
- package/dist/cosmicintersection/components/Pagination.d.ts +0 -1
- package/dist/cosmicintersection/components/Pagination.js +1 -2
- package/dist/cosmicintersection/components/Pagination.js.map +1 -1
- package/dist/cosmicintersection/components/ReleaseDraftDialog.d.ts +0 -1
- package/dist/cosmicintersection/components/ReleaseDraftDialog.js +7 -12
- package/dist/cosmicintersection/components/ReleaseDraftDialog.js.map +1 -1
- package/dist/cosmicintersection/components/ResultsChart.d.ts +0 -1
- package/dist/cosmicintersection/components/ResultsChart.js +4 -8
- package/dist/cosmicintersection/components/ResultsChart.js.map +1 -1
- package/dist/cosmicintersection/components/RunTriageCard.d.ts +0 -1
- package/dist/cosmicintersection/components/RunTriageCard.js +18 -19
- package/dist/cosmicintersection/components/RunTriageCard.js.map +1 -1
- package/dist/cosmicintersection/components/SafeLink.d.ts +0 -1
- package/dist/cosmicintersection/components/SafeLink.js +8 -7
- package/dist/cosmicintersection/components/SafeLink.js.map +1 -1
- package/dist/cosmicintersection/components/SchemaProposalPanel.d.ts +0 -1
- package/dist/cosmicintersection/components/SchemaProposalPanel.js +17 -18
- package/dist/cosmicintersection/components/SchemaProposalPanel.js.map +1 -1
- package/dist/cosmicintersection/components/ScienceCanvas.d.ts +0 -1
- package/dist/cosmicintersection/components/ScienceCanvas.js +226 -233
- package/dist/cosmicintersection/components/ScienceCanvas.js.map +1 -1
- package/dist/cosmicintersection/components/StatusBadge.d.ts +0 -1
- package/dist/cosmicintersection/components/StatusBadge.js +1 -2
- package/dist/cosmicintersection/components/StatusBadge.js.map +1 -1
- package/dist/cosmicintersection/components/StepDAG.d.ts +0 -1
- package/dist/cosmicintersection/components/StepDAG.js +1 -2
- package/dist/cosmicintersection/components/StepDAG.js.map +1 -1
- package/dist/cosmicintersection/components/WorkspaceTagsPicker.d.ts +0 -1
- package/dist/cosmicintersection/components/WorkspaceTagsPicker.js +1 -2
- package/dist/cosmicintersection/components/WorkspaceTagsPicker.js.map +1 -1
- package/dist/cosmicintersection/components/index.d.ts +0 -1
- package/dist/cosmicintersection/components/index.js +14 -14
- package/dist/cosmicintersection/context/CosmicIntersectionContext.d.ts +0 -1
- package/dist/cosmicintersection/context/CosmicIntersectionContext.js +2 -7
- package/dist/cosmicintersection/context/CosmicIntersectionContext.js.map +1 -1
- package/dist/cosmicintersection/hooks/useDatabricksExecutions.d.ts +0 -1
- package/dist/cosmicintersection/hooks/useDatabricksExecutions.js +18 -19
- package/dist/cosmicintersection/hooks/useDatabricksExecutions.js.map +1 -1
- package/dist/cosmicintersection/hooks/useDatabricksQueueForm.d.ts +0 -1
- package/dist/cosmicintersection/hooks/useDatabricksQueueForm.js +1 -2
- package/dist/cosmicintersection/hooks/useDatabricksQueueForm.js.map +1 -1
- package/dist/cosmicintersection/hooks/useEntityTagSync.d.ts +0 -1
- package/dist/cosmicintersection/hooks/useEntityTagSync.js +29 -25
- package/dist/cosmicintersection/hooks/useEntityTagSync.js.map +1 -1
- package/dist/cosmicintersection/index.d.ts +0 -1
- package/dist/cosmicintersection/lib/assistantAwareDialog.d.ts +0 -1
- package/dist/cosmicintersection/lib/assistantAwareDialog.js +1 -2
- package/dist/cosmicintersection/lib/assistantAwareDialog.js.map +1 -1
- package/dist/cosmicintersection/lib/databricksForm.d.ts +0 -1
- package/dist/cosmicintersection/lib/databricksForm.js +1 -2
- package/dist/cosmicintersection/lib/databricksForm.js.map +1 -1
- package/dist/cosmicintersection/lib/databricksIntent.d.ts +0 -1
- package/dist/cosmicintersection/lib/databricksIntent.js +1 -2
- package/dist/cosmicintersection/lib/databricksIntent.js.map +1 -1
- package/dist/cosmicintersection/lib/databricksPresentation.d.ts +0 -1
- package/dist/cosmicintersection/lib/databricksPresentation.js +1 -2
- package/dist/cosmicintersection/lib/databricksPresentation.js.map +1 -1
- package/dist/cosmicintersection/lib/mutationResult.d.ts +0 -1
- package/dist/cosmicintersection/lib/mutationResult.js +1 -2
- package/dist/cosmicintersection/lib/mutationResult.js.map +1 -1
- package/dist/cosmicintersection/lib/toast.d.ts +0 -1
- package/dist/cosmicintersection/lib/toast.js +1 -2
- package/dist/cosmicintersection/lib/toast.js.map +1 -1
- package/dist/cosmicintersection/lib/uploadAudience.d.ts +4 -0
- package/dist/cosmicintersection/lib/uploadAudience.js +17 -0
- package/dist/cosmicintersection/lib/uploadAudience.js.map +1 -0
- package/dist/cosmicintersection/lib/useSelectedRecord.d.ts +0 -1
- package/dist/cosmicintersection/lib/useSelectedRecord.js +1 -2
- package/dist/cosmicintersection/lib/useSelectedRecord.js.map +1 -1
- package/dist/cosmicintersection/lib/useTrackRecentItem.d.ts +0 -1
- package/dist/cosmicintersection/lib/useTrackRecentItem.js +7 -8
- package/dist/cosmicintersection/lib/useTrackRecentItem.js.map +1 -1
- package/dist/cosmicintersection/lib/visualization.d.ts +0 -1
- package/dist/cosmicintersection/lib/visualization.js +2 -3
- package/dist/cosmicintersection/lib/visualization.js.map +1 -1
- package/dist/cosmicintersection/lib/visualizationSamples.d.ts +0 -1
- package/dist/cosmicintersection/pages/access/AccessPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/access/AccessPage.js +225 -226
- package/dist/cosmicintersection/pages/access/AccessPage.js.map +1 -1
- package/dist/cosmicintersection/pages/analyses/AnalysesPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/analyses/AnalysesPage.js +260 -260
- package/dist/cosmicintersection/pages/analyses/AnalysesPage.js.map +1 -1
- package/dist/cosmicintersection/pages/archive/ArchivePage.d.ts +0 -1
- package/dist/cosmicintersection/pages/archive/ArchivePage.js +23 -48
- package/dist/cosmicintersection/pages/archive/ArchivePage.js.map +1 -1
- package/dist/cosmicintersection/pages/collections/CollectionDetailPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/collections/CollectionDetailPage.js +32 -33
- package/dist/cosmicintersection/pages/collections/CollectionDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/collections/CollectionFormPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/collections/CollectionFormPage.js +17 -18
- package/dist/cosmicintersection/pages/collections/CollectionFormPage.js.map +1 -1
- package/dist/cosmicintersection/pages/collections/CollectionsPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/collections/CollectionsPage.js +20 -21
- package/dist/cosmicintersection/pages/collections/CollectionsPage.js.map +1 -1
- package/dist/cosmicintersection/pages/dashboard/DashboardPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/dashboard/DashboardPage.js +19 -20
- package/dist/cosmicintersection/pages/dashboard/DashboardPage.js.map +1 -1
- package/dist/cosmicintersection/pages/datasets/DatasetDetailPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/datasets/DatasetDetailPage.js +64 -75
- package/dist/cosmicintersection/pages/datasets/DatasetDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/datasets/DatasetFormPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/datasets/DatasetFormPage.js +131 -119
- package/dist/cosmicintersection/pages/datasets/DatasetFormPage.js.map +1 -1
- package/dist/cosmicintersection/pages/datasets/DatasetsPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/datasets/DatasetsPage.js +207 -208
- package/dist/cosmicintersection/pages/datasets/DatasetsPage.js.map +1 -1
- package/dist/cosmicintersection/pages/discovery/DiscoveryPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/discovery/DiscoveryPage.js +20 -24
- package/dist/cosmicintersection/pages/discovery/DiscoveryPage.js.map +1 -1
- package/dist/cosmicintersection/pages/lineage/LineagePage.d.ts +0 -1
- package/dist/cosmicintersection/pages/lineage/LineagePage.js +53 -54
- package/dist/cosmicintersection/pages/lineage/LineagePage.js.map +1 -1
- package/dist/cosmicintersection/pages/notebooks/NotebookDetailPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/notebooks/NotebookDetailPage.js +61 -62
- package/dist/cosmicintersection/pages/notebooks/NotebookDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/notebooks/NotebookFormPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/notebooks/NotebookFormPage.js +154 -149
- package/dist/cosmicintersection/pages/notebooks/NotebookFormPage.js.map +1 -1
- package/dist/cosmicintersection/pages/notebooks/NotebooksPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/notebooks/NotebooksPage.js +28 -29
- package/dist/cosmicintersection/pages/notebooks/NotebooksPage.js.map +1 -1
- package/dist/cosmicintersection/pages/pipelines/PipelineDetailPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/pipelines/PipelineDetailPage.js +119 -120
- package/dist/cosmicintersection/pages/pipelines/PipelineDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/pipelines/PipelineFormPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/pipelines/PipelineFormPage.js +41 -42
- package/dist/cosmicintersection/pages/pipelines/PipelineFormPage.js.map +1 -1
- package/dist/cosmicintersection/pages/pipelines/PipelinesPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/pipelines/PipelinesPage.js +30 -31
- package/dist/cosmicintersection/pages/pipelines/PipelinesPage.js.map +1 -1
- package/dist/cosmicintersection/pages/releases/ReleaseFormPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/releases/ReleaseFormPage.js +16 -17
- package/dist/cosmicintersection/pages/releases/ReleaseFormPage.js.map +1 -1
- package/dist/cosmicintersection/pages/releases/ReleasesPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/releases/ReleasesPage.js +268 -269
- package/dist/cosmicintersection/pages/releases/ReleasesPage.js.map +1 -1
- package/dist/cosmicintersection/pages/runs/RunDetailPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/runs/RunDetailPage.js +194 -195
- package/dist/cosmicintersection/pages/runs/RunDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/runs/RunsPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/runs/RunsPage.js +20 -21
- package/dist/cosmicintersection/pages/runs/RunsPage.js.map +1 -1
- package/dist/cosmicintersection/pages/sources/SourceDetailPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/sources/SourceDetailPage.js +31 -32
- package/dist/cosmicintersection/pages/sources/SourceDetailPage.js.map +1 -1
- package/dist/cosmicintersection/pages/sources/SourceFormPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/sources/SourceFormPage.js +23 -24
- package/dist/cosmicintersection/pages/sources/SourceFormPage.js.map +1 -1
- package/dist/cosmicintersection/pages/sources/SourcesPage.d.ts +0 -1
- package/dist/cosmicintersection/pages/sources/SourcesPage.js +184 -182
- package/dist/cosmicintersection/pages/sources/SourcesPage.js.map +1 -1
- package/dist/cosmicintersection/types/index.d.ts +0 -1
- package/dist/cosmicintersection/utils/cn.d.ts +0 -1
- package/dist/cosmicintersection/utils/cn.js +1 -2
- package/dist/cosmicintersection/utils/cn.js.map +1 -1
- package/dist/cosmicintersection/utils/i18n.d.ts +0 -1
- package/dist/cosmicintersection/utils/navigation.d.ts +0 -1
- package/dist/dev/main.d.ts +0 -1
- package/dist/generated/global-types.d.ts +0 -1
- package/dist/generated/wspace-operations.d.ts +0 -1
- package/dist/generated/wspace-operations.js +1 -2
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +3 -3
- package/dist/node_modules/clsx/dist/clsx.js +7 -6
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +4 -21
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/services/createSandboxAssistantTransport.d.ts +0 -1
- package/dist/services/createSandboxAssistantTransport.js +1 -2
- package/dist/services/createSandboxAssistantTransport.js.map +1 -1
- package/dist/services/recentItems.d.ts +0 -1
- package/dist/services/recentItems.js +5 -6
- package/dist/services/recentItems.js.map +1 -1
- package/dist/shared/hooks/useTr.d.ts +0 -1
- package/dist/shared/hooks/useTr.js +1 -2
- package/dist/shared/hooks/useTr.js.map +1 -1
- package/dist/stories/EmptyState.stories.d.ts +0 -1
- package/dist/stories/LoadingState.stories.d.ts +0 -1
- package/dist/stories/ScienceCanvas.stories.d.ts +0 -1
- package/dist/stories/StatusBadge.stories.d.ts +0 -1
- package/dist/stories/WorkspaceTagsPicker.stories.d.ts +0 -1
- package/dist/test/fakeGateway.d.ts +0 -1
- package/dist/test/fixtures.d.ts +0 -1
- package/dist/test/happydom.d.ts +1 -0
- package/dist/test/i18nMock.d.ts +13 -1
- package/dist/test/renderWithProviders.d.ts +1 -2
- package/dist/test/storage.d.ts +13 -0
- package/dist/types/assistant.d.ts +0 -1
- package/dist/utils/pageContext.d.ts +0 -1
- package/dist/utils/pageContext.js +1 -2
- package/dist/utils/pageContext.js.map +1 -1
- package/package.json +64 -38
- package/dist/cosmicintersection/CosmicIntersectionRoot.d.ts.map +0 -1
- package/dist/cosmicintersection/CosmicIntersectionRoutes.d.ts.map +0 -1
- package/dist/cosmicintersection/api/cosmicApi.d.ts.map +0 -1
- package/dist/cosmicintersection/api/databricksTransport.d.ts.map +0 -1
- package/dist/cosmicintersection/api/tagsApi.d.ts.map +0 -1
- package/dist/cosmicintersection/components/ActionMenu.d.ts.map +0 -1
- package/dist/cosmicintersection/components/ActivityFeedPanel.d.ts.map +0 -1
- package/dist/cosmicintersection/components/AiRunAttribution.d.ts.map +0 -1
- package/dist/cosmicintersection/components/DatabricksQueueForm.d.ts.map +0 -1
- package/dist/cosmicintersection/components/DatabricksRunPanel.d.ts.map +0 -1
- package/dist/cosmicintersection/components/DiscussionPanel.d.ts.map +0 -1
- package/dist/cosmicintersection/components/EmptyState.d.ts.map +0 -1
- package/dist/cosmicintersection/components/EntityFormShell.d.ts.map +0 -1
- package/dist/cosmicintersection/components/EntityTagsField.d.ts.map +0 -1
- package/dist/cosmicintersection/components/ErrorState.d.ts.map +0 -1
- package/dist/cosmicintersection/components/FacetPanel.d.ts.map +0 -1
- package/dist/cosmicintersection/components/FileUploadField.d.ts.map +0 -1
- package/dist/cosmicintersection/components/LineageGraph.d.ts.map +0 -1
- package/dist/cosmicintersection/components/LoadingState.d.ts.map +0 -1
- package/dist/cosmicintersection/components/PageLayout.d.ts.map +0 -1
- package/dist/cosmicintersection/components/Pagination.d.ts.map +0 -1
- package/dist/cosmicintersection/components/ReleaseDraftDialog.d.ts.map +0 -1
- package/dist/cosmicintersection/components/ResultsChart.d.ts.map +0 -1
- package/dist/cosmicintersection/components/RunTriageCard.d.ts.map +0 -1
- package/dist/cosmicintersection/components/SafeLink.d.ts.map +0 -1
- package/dist/cosmicintersection/components/SchemaProposalPanel.d.ts.map +0 -1
- package/dist/cosmicintersection/components/ScienceCanvas.d.ts.map +0 -1
- package/dist/cosmicintersection/components/StatusBadge.d.ts.map +0 -1
- package/dist/cosmicintersection/components/StepDAG.d.ts.map +0 -1
- package/dist/cosmicintersection/components/WorkspaceTagsPicker.d.ts.map +0 -1
- package/dist/cosmicintersection/components/index.d.ts.map +0 -1
- package/dist/cosmicintersection/context/CosmicIntersectionContext.d.ts.map +0 -1
- package/dist/cosmicintersection/hooks/useDatabricksExecutions.d.ts.map +0 -1
- package/dist/cosmicintersection/hooks/useDatabricksQueueForm.d.ts.map +0 -1
- package/dist/cosmicintersection/hooks/useEntityTagSync.d.ts.map +0 -1
- package/dist/cosmicintersection/index.d.ts.map +0 -1
- package/dist/cosmicintersection/lib/assistantAwareDialog.d.ts.map +0 -1
- package/dist/cosmicintersection/lib/databricksForm.d.ts.map +0 -1
- package/dist/cosmicintersection/lib/databricksIntent.d.ts.map +0 -1
- package/dist/cosmicintersection/lib/databricksPresentation.d.ts.map +0 -1
- package/dist/cosmicintersection/lib/mutationResult.d.ts.map +0 -1
- package/dist/cosmicintersection/lib/toast.d.ts.map +0 -1
- package/dist/cosmicintersection/lib/useSelectedRecord.d.ts.map +0 -1
- package/dist/cosmicintersection/lib/useTrackRecentItem.d.ts.map +0 -1
- package/dist/cosmicintersection/lib/visualization.d.ts.map +0 -1
- package/dist/cosmicintersection/lib/visualizationSamples.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/access/AccessPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/analyses/AnalysesPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/archive/ArchivePage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/collections/CollectionDetailPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/collections/CollectionFormPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/collections/CollectionsPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/dashboard/DashboardPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/datasets/DatasetDetailPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/datasets/DatasetFormPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/datasets/DatasetsPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/discovery/DiscoveryPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/lineage/LineagePage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/notebooks/NotebookDetailPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/notebooks/NotebookFormPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/notebooks/NotebooksPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/pipelines/PipelineDetailPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/pipelines/PipelineFormPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/pipelines/PipelinesPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/releases/ReleaseFormPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/releases/ReleasesPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/runs/RunDetailPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/runs/RunsPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/sources/SourceDetailPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/sources/SourceFormPage.d.ts.map +0 -1
- package/dist/cosmicintersection/pages/sources/SourcesPage.d.ts.map +0 -1
- package/dist/cosmicintersection/types/index.d.ts.map +0 -1
- package/dist/cosmicintersection/utils/cn.d.ts.map +0 -1
- package/dist/cosmicintersection/utils/i18n.d.ts.map +0 -1
- package/dist/cosmicintersection/utils/navigation.d.ts.map +0 -1
- package/dist/dev/main.d.ts.map +0 -1
- package/dist/generated/global-types.d.ts.map +0 -1
- package/dist/generated/wspace-operations.d.ts.map +0 -1
- package/dist/generated/wspace-types.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/services/createSandboxAssistantTransport.d.ts.map +0 -1
- package/dist/services/recentItems.d.ts.map +0 -1
- package/dist/shared/hooks/useTr.d.ts.map +0 -1
- package/dist/stories/EmptyState.stories.d.ts.map +0 -1
- package/dist/stories/LoadingState.stories.d.ts.map +0 -1
- package/dist/stories/ScienceCanvas.stories.d.ts.map +0 -1
- package/dist/stories/StatusBadge.stories.d.ts.map +0 -1
- package/dist/stories/WorkspaceTagsPicker.stories.d.ts.map +0 -1
- package/dist/test/fakeGateway.d.ts.map +0 -1
- package/dist/test/fixtures.d.ts.map +0 -1
- package/dist/test/i18nMock.d.ts.map +0 -1
- package/dist/test/renderWithProviders.d.ts.map +0 -1
- package/dist/test/setup.d.ts +0 -1
- package/dist/test/setup.d.ts.map +0 -1
- package/dist/types/assistant.d.ts.map +0 -1
- package/dist/utils/pageContext.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmicIntersectionContext.js","names":[],"sources":["../../../src/cosmicintersection/context/CosmicIntersectionContext.tsx"],"sourcesContent":["/**\n * CosmicIntersectionContext\n *\n * Provides basePath-aware navigation and shared props throughout the\n * CosmicIntersection microfrontend. Uses the `navigate` function injected by the\n * host app shell — no react-router hooks are needed here, so the same tree works\n * whether the shell drives routing or the local dev harness does.\n */\n\nimport { createContext, useCallback, useContext, useMemo, type ReactNode } from 'react';\nimport { appendContextToPath } from '@burdenoff/fe-libs/shared/hooks';\nimport type { CosmicIntersectionRootProps } from '../types';\n\ninterface CosmicIntersectionContextValue {\n basePath: string;\n navigate: (path: string) => void;\n currentUser: CosmicIntersectionRootProps['currentUser'];\n workspaceId?: string;\n tenantId?: string;\n organizationId?: string;\n projectId?: string;\n apiGatewayUrl: string;\n authToken: string;\n}\n\nconst CosmicIntersectionContext = createContext<CosmicIntersectionContextValue | null>(null);\n\ninterface CosmicIntersectionProviderProps {\n children: ReactNode;\n props: CosmicIntersectionRootProps;\n}\n\nexport function CosmicIntersectionProvider({ children, props }: CosmicIntersectionProviderProps) {\n const {\n basePath = '',\n navigate: hostNavigate,\n currentUser,\n workspaceId,\n tenantId,\n organizationId,\n projectId,\n apiGatewayUrl,\n authToken,\n } = props;\n\n // Normalize basePath (strip trailing slash) so joins never produce `//`.\n const normalizedBasePath = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;\n\n const contextParams = useMemo(() => {\n const params = new URLSearchParams();\n const pairs: Array<[string, string | undefined]> = [\n ['org', organizationId],\n ['workspace', workspaceId],\n ['project', projectId],\n ['tenant', tenantId],\n ];\n for (const [key, value] of pairs) {\n if (value) params.set(key, value);\n }\n return params;\n }, [organizationId, workspaceId, projectId, tenantId]);\n\n // Keep the host's captured context on the first navigation, before route sync.\n const navigate = useCallback(\n (path: string) => {\n if (!normalizedBasePath || normalizedBasePath === '/') {\n hostNavigate(appendContextToPath(path, contextParams));\n return;\n }\n if (path.startsWith(normalizedBasePath)) {\n hostNavigate(appendContextToPath(path, contextParams));\n return;\n }\n const fullPath = path.startsWith('/')\n ? `${normalizedBasePath}${path}`\n : `${normalizedBasePath}/${path}`;\n hostNavigate(appendContextToPath(fullPath, contextParams));\n },\n [normalizedBasePath, hostNavigate, contextParams]\n );\n\n const value = useMemo(\n () => ({\n basePath: normalizedBasePath,\n navigate,\n currentUser,\n workspaceId,\n tenantId,\n organizationId,\n projectId,\n apiGatewayUrl: apiGatewayUrl || '',\n authToken: authToken || '',\n }),\n [\n normalizedBasePath,\n navigate,\n currentUser,\n workspaceId,\n tenantId,\n organizationId,\n projectId,\n apiGatewayUrl,\n authToken,\n ]\n );\n\n return (\n <CosmicIntersectionContext.Provider value={value}>\n {children}\n </CosmicIntersectionContext.Provider>\n );\n}\n\nexport function useCosmicIntersection() {\n const context = useContext(CosmicIntersectionContext);\n if (!context) {\n throw new Error('useCosmicIntersection must be used within a CosmicIntersectionProvider');\n }\n return context;\n}\n\n/**\n * Hook for basePath-aware navigation. Returns a navigate function that\n * automatically prepends the microfrontend basePath. Falls back to a\n * `window.location`-based navigate if used outside the provider.\n */\nexport function useCosmicIntersectionNavigate() {\n const context = useContext(CosmicIntersectionContext);\n\n const fallbackNavigate = useCallback((path: string) => {\n const currentPath = window.location.pathname;\n const mfeMatch = currentPath.match(/^(\\/cosmicintersection)/);\n const basePath = mfeMatch ? mfeMatch[1] : '';\n\n let fullPath = path;\n if (basePath && !path.startsWith(basePath)) {\n fullPath = path.startsWith('/') ? `${basePath}${path}` : `${basePath}/${path}`;\n }\n window.location.href = fullPath;\n }, []);\n\n return context?.navigate ?? fallbackNavigate;\n}\n"],"mappings":";;;;AAyBA,
|
|
1
|
+
{"version":3,"file":"CosmicIntersectionContext.js","names":["CosmicIntersectionContext","createContext","CosmicIntersectionProvider","hostNavigate","props","normalizedBasePath","basePath","contextParams","useMemo","params","pairs","organizationId","workspaceId","projectId","tenantId","key","value","navigate","useCallback","path","appendContextToPath","fullPath","apiGatewayUrl","authToken","currentUser","useCosmicIntersection","context","useContext"],"sources":["../../../src/cosmicintersection/context/CosmicIntersectionContext.tsx"],"sourcesContent":["/**\n * CosmicIntersectionContext\n *\n * Provides basePath-aware navigation and shared props throughout the\n * CosmicIntersection microfrontend. Uses the `navigate` function injected by the\n * host app shell — no react-router hooks are needed here, so the same tree works\n * whether the shell drives routing or the local dev harness does.\n */\n\nimport { createContext, useCallback, useContext, useMemo, type ReactNode } from 'react';\nimport { appendContextToPath } from '@burdenoff/fe-libs/shared/hooks';\nimport type { CosmicIntersectionRootProps } from '../types';\n\ninterface CosmicIntersectionContextValue {\n basePath: string;\n navigate: (path: string) => void;\n currentUser: CosmicIntersectionRootProps['currentUser'];\n workspaceId?: string;\n tenantId?: string;\n organizationId?: string;\n projectId?: string;\n apiGatewayUrl: string;\n authToken: string;\n}\n\nconst CosmicIntersectionContext = createContext<CosmicIntersectionContextValue | null>(null);\n\ninterface CosmicIntersectionProviderProps {\n children: ReactNode;\n props: CosmicIntersectionRootProps;\n}\n\nexport function CosmicIntersectionProvider({ children, props }: CosmicIntersectionProviderProps) {\n const {\n basePath = '',\n navigate: hostNavigate,\n currentUser,\n workspaceId,\n tenantId,\n organizationId,\n projectId,\n apiGatewayUrl,\n authToken,\n } = props;\n\n // Normalize basePath (strip trailing slash) so joins never produce `//`.\n const normalizedBasePath = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;\n\n const contextParams = useMemo(() => {\n const params = new URLSearchParams();\n const pairs: Array<[string, string | undefined]> = [\n ['org', organizationId],\n ['workspace', workspaceId],\n ['project', projectId],\n ['tenant', tenantId],\n ];\n for (const [key, value] of pairs) {\n if (value) params.set(key, value);\n }\n return params;\n }, [organizationId, workspaceId, projectId, tenantId]);\n\n // Keep the host's captured context on the first navigation, before route sync.\n const navigate = useCallback(\n (path: string) => {\n if (!normalizedBasePath || normalizedBasePath === '/') {\n hostNavigate(appendContextToPath(path, contextParams));\n return;\n }\n if (path.startsWith(normalizedBasePath)) {\n hostNavigate(appendContextToPath(path, contextParams));\n return;\n }\n const fullPath = path.startsWith('/')\n ? `${normalizedBasePath}${path}`\n : `${normalizedBasePath}/${path}`;\n hostNavigate(appendContextToPath(fullPath, contextParams));\n },\n [normalizedBasePath, hostNavigate, contextParams]\n );\n\n const value = useMemo(\n () => ({\n basePath: normalizedBasePath,\n navigate,\n currentUser,\n workspaceId,\n tenantId,\n organizationId,\n projectId,\n apiGatewayUrl: apiGatewayUrl || '',\n authToken: authToken || '',\n }),\n [\n normalizedBasePath,\n navigate,\n currentUser,\n workspaceId,\n tenantId,\n organizationId,\n projectId,\n apiGatewayUrl,\n authToken,\n ]\n );\n\n return (\n <CosmicIntersectionContext.Provider value={value}>\n {children}\n </CosmicIntersectionContext.Provider>\n );\n}\n\nexport function useCosmicIntersection() {\n const context = useContext(CosmicIntersectionContext);\n if (!context) {\n throw new Error('useCosmicIntersection must be used within a CosmicIntersectionProvider');\n }\n return context;\n}\n\n/**\n * Hook for basePath-aware navigation. Returns a navigate function that\n * automatically prepends the microfrontend basePath. Falls back to a\n * `window.location`-based navigate if used outside the provider.\n */\nexport function useCosmicIntersectionNavigate() {\n const context = useContext(CosmicIntersectionContext);\n\n const fallbackNavigate = useCallback((path: string) => {\n const currentPath = window.location.pathname;\n const mfeMatch = currentPath.match(/^(\\/cosmicintersection)/);\n const basePath = mfeMatch ? mfeMatch[1] : '';\n\n let fullPath = path;\n if (basePath && !path.startsWith(basePath)) {\n fullPath = path.startsWith('/') ? `${basePath}${path}` : `${basePath}/${path}`;\n }\n window.location.href = fullPath;\n }, []);\n\n return context?.navigate ?? fallbackNavigate;\n}\n"],"mappings":";;;;AAyBA,IAAMA,IAA4BC,EAAqD,IAAI;AAO3F,SAAgBC,EAA2B,EAAE,aAAU,YAA0C;CAC/F,IAAM,EACJ,cAAW,IACX,UAAUC,GACV,gBACA,gBACA,aACA,mBACA,cACA,kBACA,iBACEC,GAGEC,IAAqBC,EAAS,SAAS,GAAG,IAAIA,EAAS,MAAM,GAAG,EAAE,IAAIA,GAEtEC,IAAgBC,QAAc;EAClC,IAAMC,IAAS,IAAI,gBAAgB,GAC7BC,IAA6C;GACjD,CAAC,OAAOC,CAAc;GACtB,CAAC,aAAaC,CAAW;GACzB,CAAC,WAAWC,CAAS;GACrB,CAAC,UAAUC,CAAQ;EACrB;EACA,KAAK,IAAM,CAACC,GAAKC,MAAUN,GACzB,AAAIM,KAAOP,EAAO,IAAIM,GAAKC,CAAK;EAElC,OAAOP;CACT,GAAG;EAACE;EAAgBC;EAAaC;EAAWC;CAAQ,CAAC,GAG/CG,IAAWC,GACd,MAAiB;EAKhB,IAJI,CAACb,KAAsBA,MAAuB,OAI9Cc,EAAK,WAAWd,CAAkB,GAAG;GACvC,EAAae,EAAoBD,GAAMZ,CAAa,CAAC;GACrD;EACF;EACA,IAAMc,IAAWF,EAAK,WAAW,GAAG,IAChC,GAAGd,IAAqBc,MACxB,GAAGd,EAAmB,GAAGc;EAC7B,EAAaC,EAAoBC,GAAUd,CAAa,CAAC;CAC3D,GACA;EAACF;EAAoBF;EAAcI;CAAa,CAClD,GAEMS,IAAQR,SACL;EACL,UAAUH;EACV;EACA;EACA;EACA;EACA;EACA;EACA,eAAeiB,KAAiB;EAChC,WAAWC,KAAa;CAC1B,IACA;EACElB;EACAY;EACAO;EACAZ;EACAE;EACAH;EACAE;EACAS;EACAC;CACF,CACF;CAEA,OACE,kBAACvB,EAA0B,UAA3B;EAA2C;EACxC;CACiC,CAAA;AAExC;AAEA,SAAgByB,IAAwB;CACtC,IAAMC,IAAUC,EAAW3B,CAAyB;CACpD,IAAI,CAAC0B,GACH,MAAU,MAAM,wEAAwE;CAE1F,OAAOA;AACT"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CosCancelExternalComputeDocument as e, CosExternalComputeDocument as t, CosRetryExternalComputeDocument as n } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { databricksRequest as r } from "../api/databricksTransport.js";
|
|
3
3
|
import { confirmDatabricksIntent as i } from "../lib/databricksIntent.js";
|
|
4
|
-
import {
|
|
4
|
+
import { databricksIntentKey as a } from "../lib/databricksPresentation.js";
|
|
5
5
|
import { useCallback as o, useEffect as s, useRef as c, useState as l } from "react";
|
|
6
6
|
import { useQuery as u } from "@tanstack/react-query";
|
|
7
7
|
import { clearGraphqlFetchResponseCache as d } from "@burdenoff/fe-libs/shared/graphql";
|
|
8
|
-
|
|
8
|
+
// src/cosmicintersection/hooks/useDatabricksExecutions.ts
|
|
9
9
|
function f({ scope: f, runId: p, onRunChanged: m }) {
|
|
10
|
-
let h = c(/* @__PURE__ */ new Set()), [g, _] = l(0), [v, y] = l(null), [b, x] = l(null), S =
|
|
10
|
+
let h = c(/* @__PURE__ */ new Set()), [g, _] = l(0), [v, y] = l(null), [b, x] = l(null), S = a(f, p);
|
|
11
11
|
s(() => {
|
|
12
12
|
let e = h.current;
|
|
13
13
|
return () => {
|
|
@@ -19,7 +19,7 @@ function f({ scope: f, runId: p, onRunChanged: m }) {
|
|
|
19
19
|
let n = new AbortController();
|
|
20
20
|
h.current.add(n);
|
|
21
21
|
try {
|
|
22
|
-
return await
|
|
22
|
+
return await r(f, e, t, n.signal);
|
|
23
23
|
} finally {
|
|
24
24
|
h.current.delete(n);
|
|
25
25
|
}
|
|
@@ -31,21 +31,21 @@ function f({ scope: f, runId: p, onRunChanged: m }) {
|
|
|
31
31
|
],
|
|
32
32
|
queryFn: async ({ signal: e }) => {
|
|
33
33
|
d();
|
|
34
|
-
let
|
|
34
|
+
let n = await r(f, t, {
|
|
35
35
|
runId: p,
|
|
36
36
|
pagination: {
|
|
37
37
|
limit: 10,
|
|
38
38
|
offset: g
|
|
39
39
|
}
|
|
40
|
-
}, e),
|
|
40
|
+
}, e), a = !1;
|
|
41
41
|
try {
|
|
42
|
-
for (let e of
|
|
42
|
+
for (let e of n.cosListExternalCompute.items) i(window.sessionStorage, S, e);
|
|
43
43
|
} catch {
|
|
44
|
-
|
|
44
|
+
a = !0;
|
|
45
45
|
}
|
|
46
46
|
return {
|
|
47
|
-
...
|
|
48
|
-
intentRecoveryUnavailable:
|
|
47
|
+
...n.cosListExternalCompute,
|
|
48
|
+
intentRecoveryUnavailable: a
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
}), T = w.data?.items ?? [], E = w.data?.pageInfo.hasMore ?? !1, D = w.isPending || w.isFetching, O = async () => {
|
|
@@ -62,16 +62,16 @@ function f({ scope: f, runId: p, onRunChanged: m }) {
|
|
|
62
62
|
setOffset: _,
|
|
63
63
|
setError: x,
|
|
64
64
|
refresh: O,
|
|
65
|
-
act: async (
|
|
66
|
-
y(
|
|
65
|
+
act: async (t, r) => {
|
|
66
|
+
y(t.id), x(null);
|
|
67
67
|
let i = !1;
|
|
68
68
|
try {
|
|
69
|
-
|
|
69
|
+
r ? await C(n, {
|
|
70
70
|
runId: p,
|
|
71
|
-
id:
|
|
72
|
-
}) : await C(
|
|
71
|
+
id: t.id
|
|
72
|
+
}) : await C(e, {
|
|
73
73
|
runId: p,
|
|
74
|
-
id:
|
|
74
|
+
id: t.id
|
|
75
75
|
}), i = !0, await O();
|
|
76
76
|
} catch {
|
|
77
77
|
x(i ? "The action is confirmed, but its status read failed. Refresh status; do not repeat the action." : "The action was not confirmed. Refresh status before trying again.");
|
|
@@ -83,7 +83,6 @@ function f({ scope: f, runId: p, onRunChanged: m }) {
|
|
|
83
83
|
intentKey: S
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
//#endregion
|
|
87
86
|
export { f as useDatabricksExecutions };
|
|
88
87
|
|
|
89
88
|
//# sourceMappingURL=useDatabricksExecutions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDatabricksExecutions.js","names":[],"sources":["../../../src/cosmicintersection/hooks/useDatabricksExecutions.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport type { DocumentNode } from 'graphql';\nimport { useQuery } from '@tanstack/react-query';\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql';\nimport {\n CosCancelExternalComputeDocument,\n CosExternalComputeDocument,\n CosRetryExternalComputeDocument,\n type CosCancelExternalComputeMutation,\n type CosDatabricksExecutionFieldsFragment,\n type CosExternalComputeQuery,\n type CosRetryExternalComputeMutation,\n} from '../../generated/wspace-operations';\nimport { databricksRequest, type DatabricksRequestScope } from '../api/databricksTransport';\nimport { confirmDatabricksIntent } from '../lib/databricksIntent';\nimport { databricksIntentKey } from '../lib/databricksPresentation';\ntype Execution = CosDatabricksExecutionFieldsFragment;\n\nexport function useDatabricksExecutions({\n scope,\n runId,\n onRunChanged,\n}: {\n scope: DatabricksRequestScope;\n runId: string;\n onRunChanged(): Promise<void>;\n}) {\n const controllers = useRef(new Set<AbortController>());\n const [offset, setOffset] = useState(0);\n const [actionId, setActionId] = useState<string | null>(null);\n const [error, setError] = useState<string | null>(null);\n const intentKey = databricksIntentKey(scope, runId);\n\n useEffect(() => {\n const active = controllers.current;\n return () => {\n for (const controller of active) controller.abort();\n active.clear();\n };\n }, [scope]);\n\n const request = useCallback(\n async <T>(document: DocumentNode, variables: Record<string, unknown>) => {\n const controller = new AbortController();\n controllers.current.add(controller);\n try {\n return await databricksRequest<T>(scope, document, variables, controller.signal);\n } finally {\n controllers.current.delete(controller);\n }\n },\n [scope]\n );\n\n const executions = useQuery({\n queryKey: ['cosmic-databricks-executions', intentKey, offset],\n queryFn: async ({ signal }) => {\n clearGraphqlFetchResponseCache();\n const result = await databricksRequest<CosExternalComputeQuery>(\n scope,\n CosExternalComputeDocument,\n {\n runId,\n pagination: { limit: 10, offset },\n },\n signal\n );\n // Identity validation or storage failure must not hide running compute.\n let intentRecoveryUnavailable = false;\n try {\n // Only an actual server record can resolve an ambiguous saved intent.\n for (const item of result.cosListExternalCompute.items) {\n confirmDatabricksIntent(window.sessionStorage, intentKey, item);\n }\n } catch {\n intentRecoveryUnavailable = true;\n }\n return { ...result.cosListExternalCompute, intentRecoveryUnavailable };\n },\n });\n const items = executions.data?.items ?? [];\n const hasMore = executions.data?.pageInfo.hasMore ?? false;\n const loading = executions.isPending || executions.isFetching;\n const refresh = async () => {\n await Promise.all([executions.refetch({ throwOnError: true }), onRunChanged()]);\n };\n\n const act = async (item: Execution, resume: boolean) => {\n setActionId(item.id);\n setError(null);\n let confirmed = false;\n try {\n if (resume) {\n await request<CosRetryExternalComputeMutation>(CosRetryExternalComputeDocument, {\n runId,\n id: item.id,\n });\n } else {\n await request<CosCancelExternalComputeMutation>(CosCancelExternalComputeDocument, {\n runId,\n id: item.id,\n });\n }\n confirmed = true;\n await refresh();\n } catch {\n setError(\n confirmed\n ? 'The action is confirmed, but its status read failed. Refresh status; do not repeat the action.'\n : 'The action was not confirmed. Refresh status before trying again.'\n );\n } finally {\n setActionId(null);\n }\n };\n\n return {\n items,\n hasMore,\n loading,\n executions,\n error,\n actionId,\n offset,\n setOffset,\n setError,\n refresh,\n act,\n request,\n intentKey,\n };\n}\n"],"mappings":";;;;;;;;AAkBA,
|
|
1
|
+
{"version":3,"file":"useDatabricksExecutions.js","names":["useDatabricksExecutions","controllers","useRef","offset","setOffset","useState","actionId","setActionId","error","setError","intentKey","databricksIntentKey","scope","runId","active","controller","request","useCallback","databricksRequest","document","variables","executions","useQuery","result","CosExternalComputeDocument","signal","intentRecoveryUnavailable","item","items","hasMore","loading","refresh","onRunChanged","confirmed","resume","CosRetryExternalComputeDocument","CosCancelExternalComputeDocument"],"sources":["../../../src/cosmicintersection/hooks/useDatabricksExecutions.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport type { DocumentNode } from 'graphql';\nimport { useQuery } from '@tanstack/react-query';\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql';\nimport {\n CosCancelExternalComputeDocument,\n CosExternalComputeDocument,\n CosRetryExternalComputeDocument,\n type CosCancelExternalComputeMutation,\n type CosDatabricksExecutionFieldsFragment,\n type CosExternalComputeQuery,\n type CosRetryExternalComputeMutation,\n} from '../../generated/wspace-operations';\nimport { databricksRequest, type DatabricksRequestScope } from '../api/databricksTransport';\nimport { confirmDatabricksIntent } from '../lib/databricksIntent';\nimport { databricksIntentKey } from '../lib/databricksPresentation';\ntype Execution = CosDatabricksExecutionFieldsFragment;\n\nexport function useDatabricksExecutions({\n scope,\n runId,\n onRunChanged,\n}: {\n scope: DatabricksRequestScope;\n runId: string;\n onRunChanged(): Promise<void>;\n}) {\n const controllers = useRef(new Set<AbortController>());\n const [offset, setOffset] = useState(0);\n const [actionId, setActionId] = useState<string | null>(null);\n const [error, setError] = useState<string | null>(null);\n const intentKey = databricksIntentKey(scope, runId);\n\n useEffect(() => {\n const active = controllers.current;\n return () => {\n for (const controller of active) controller.abort();\n active.clear();\n };\n }, [scope]);\n\n const request = useCallback(\n async <T>(document: DocumentNode, variables: Record<string, unknown>) => {\n const controller = new AbortController();\n controllers.current.add(controller);\n try {\n return await databricksRequest<T>(scope, document, variables, controller.signal);\n } finally {\n controllers.current.delete(controller);\n }\n },\n [scope]\n );\n\n const executions = useQuery({\n queryKey: ['cosmic-databricks-executions', intentKey, offset],\n queryFn: async ({ signal }) => {\n clearGraphqlFetchResponseCache();\n const result = await databricksRequest<CosExternalComputeQuery>(\n scope,\n CosExternalComputeDocument,\n {\n runId,\n pagination: { limit: 10, offset },\n },\n signal\n );\n // Identity validation or storage failure must not hide running compute.\n let intentRecoveryUnavailable = false;\n try {\n // Only an actual server record can resolve an ambiguous saved intent.\n for (const item of result.cosListExternalCompute.items) {\n confirmDatabricksIntent(window.sessionStorage, intentKey, item);\n }\n } catch {\n intentRecoveryUnavailable = true;\n }\n return { ...result.cosListExternalCompute, intentRecoveryUnavailable };\n },\n });\n const items = executions.data?.items ?? [];\n const hasMore = executions.data?.pageInfo.hasMore ?? false;\n const loading = executions.isPending || executions.isFetching;\n const refresh = async () => {\n await Promise.all([executions.refetch({ throwOnError: true }), onRunChanged()]);\n };\n\n const act = async (item: Execution, resume: boolean) => {\n setActionId(item.id);\n setError(null);\n let confirmed = false;\n try {\n if (resume) {\n await request<CosRetryExternalComputeMutation>(CosRetryExternalComputeDocument, {\n runId,\n id: item.id,\n });\n } else {\n await request<CosCancelExternalComputeMutation>(CosCancelExternalComputeDocument, {\n runId,\n id: item.id,\n });\n }\n confirmed = true;\n await refresh();\n } catch {\n setError(\n confirmed\n ? 'The action is confirmed, but its status read failed. Refresh status; do not repeat the action.'\n : 'The action was not confirmed. Refresh status before trying again.'\n );\n } finally {\n setActionId(null);\n }\n };\n\n return {\n items,\n hasMore,\n loading,\n executions,\n error,\n actionId,\n offset,\n setOffset,\n setError,\n refresh,\n act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7CU,IAAU,YAAY;EAC1B,MAAM,QAAQ,IAAI,CAACV,EAAW,QAAQ,EAAE,cAAc,GAAK,CAAC,GAAGW,EAAa,CAAC,CAAC;CAChF;CA+BA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAxCiB,GAAiB,MAAoB;GAEtD,AADAzB,EAAYoB,EAAK,EAAE,GACnBlB,EAAS,IAAI;GACb,IAAIwB,IAAY;GAChB,IAAI;IAaF,AAZIC,IACF,MAAMlB,EAAyCmB,GAAiC;KAC9E;KACA,IAAIR,EAAK;IACX,CAAC,IAED,MAAMX,EAA0CoB,GAAkC;KAChF;KACA,IAAIT,EAAK;IACX,CAAC,GAEH,IAAY,IACZ,MAAMI,EAAQ;GAChB,QAAQ;IACN,EACEE,IACI,mGACA,mEACN;GACF,UAAU;IACR,EAAY,IAAI;GAClB;EACF;EAcE;EACA;CACF;AACF"}
|
|
@@ -3,7 +3,7 @@ import { databricksJobId as i, databricksParameters as a } from "../lib/databric
|
|
|
3
3
|
import { clearConfirmedDatabricksIntent as o, clearWithdrawnDatabricksIntent as s, confirmDatabricksIntent as c, prepareDatabricksIntent as l, readDatabricksIntent as u } from "../lib/databricksIntent.js";
|
|
4
4
|
import { useRef as d, useState as f } from "react";
|
|
5
5
|
import { clearGraphqlFetchResponseCache as p } from "@burdenoff/fe-libs/shared/graphql";
|
|
6
|
-
|
|
6
|
+
// src/cosmicintersection/hooks/useDatabricksQueueForm.ts
|
|
7
7
|
function m({ request: m, runId: h, workspaceId: g, intentKey: _, onQueued: v, statusReady: ee, canQueue: y }) {
|
|
8
8
|
let [b, x] = f([]), [S, C] = f([]), [w, T] = f(0), [E, D] = f(0), [O, k] = f(!1), [A, te] = f(!1), [j, ne] = f(""), [M, N] = f(""), [P, F] = f("Databricks job"), [I, L] = f("{}"), [R, z] = f("3600"), [B, V] = f([]), [H, U] = f([]), [W, G] = f(!1), [K, q] = f(!1), [J] = f(() => {
|
|
9
9
|
try {
|
|
@@ -152,7 +152,6 @@ function m({ request: m, runId: h, workspaceId: g, intentKey: _, onQueued: v, st
|
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
//#endregion
|
|
156
155
|
export { m as useDatabricksQueueForm };
|
|
157
156
|
|
|
158
157
|
//# sourceMappingURL=useDatabricksQueueForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDatabricksQueueForm.js","names":[],"sources":["../../../src/cosmicintersection/hooks/useDatabricksQueueForm.ts"],"sourcesContent":["import { useRef, useState, type FormEvent } from 'react';\nimport type { DocumentNode } from 'graphql';\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql';\n\nimport {\n CosDatabricksConnectionsDocument,\n CosDatabricksDatasetsDocument,\n CosQueueDatabricksStepDocument,\n CosResolveExternalComputeRequestDocument,\n type CosDatabricksConnectionsQuery,\n type CosDatabricksDatasetsQuery,\n type CosQueueDatabricksStepMutation,\n type CosResolveExternalComputeRequestMutation,\n} from '../../generated/wspace-operations';\nimport { databricksJobId, databricksParameters } from '../lib/databricksForm';\nimport {\n clearConfirmedDatabricksIntent,\n clearWithdrawnDatabricksIntent,\n confirmDatabricksIntent,\n prepareDatabricksIntent,\n readDatabricksIntent,\n type DatabricksIntent,\n} from '../lib/databricksIntent';\n\ntype Connection = CosDatabricksConnectionsQuery['connections']['items'][number];\ntype Dataset = CosDatabricksDatasetsQuery['cosListDatasets']['items'][number];\ntype Request = <T>(document: DocumentNode, variables: Record<string, unknown>) => Promise<T>;\n\nexport function useDatabricksQueueForm({\n request,\n runId,\n workspaceId,\n intentKey,\n onQueued,\n statusReady,\n canQueue,\n}: {\n request: Request;\n runId: string;\n workspaceId: string;\n intentKey: string;\n onQueued(): Promise<void>;\n statusReady: boolean;\n canQueue: boolean;\n}) {\n const [connections, setConnections] = useState<Connection[]>([]);\n const [datasets, setDatasets] = useState<Dataset[]>([]);\n const [connectionOffset, setConnectionOffset] = useState(0);\n const [datasetOffset, setDatasetOffset] = useState(0);\n const [moreConnections, setMoreConnections] = useState(false);\n const [moreDatasets, setMoreDatasets] = useState(false);\n const [connectionId, setConnectionId] = useState('');\n const [jobId, setJobId] = useState('');\n const [name, setName] = useState('Databricks job');\n const [parameters, setParameters] = useState('{}');\n const [maximum, setMaximum] = useState('3600');\n const [inputs, setInputs] = useState<string[]>([]);\n const [outputs, setOutputs] = useState<string[]>([]);\n const [confirmedCost, setConfirmedCost] = useState(false);\n const [busy, setBusy] = useState(false);\n const [saved] = useState(() => {\n try {\n return { intent: readDatabricksIntent(window.sessionStorage, intentKey), error: null };\n } catch {\n return {\n intent: null,\n error:\n 'The saved request is unreadable. Do not submit another job until its status is recovered.',\n };\n }\n });\n const [error, setError] = useState<string | null>(saved.error);\n const [intent, setIntent] = useState<DatabricksIntent | null>(saved.intent);\n const sending = useRef(false);\n\n const reloadIntent = () => setIntent(readDatabricksIntent(window.sessionStorage, intentKey));\n\n const loadOptions = async (kind: 'connections' | 'datasets') => {\n if (sending.current) return;\n sending.current = true;\n setBusy(true);\n setError(null);\n try {\n // The published FE4 transport has no per-request cache bypass. These\n // explicit choice refreshes must observe current credential eligibility;\n // clearing its shared short-lived read cache may refetch sibling reads.\n clearGraphqlFetchResponseCache();\n if (kind === 'connections') {\n const offset = moreConnections ? connectionOffset : 0;\n const result = await request<CosDatabricksConnectionsQuery>(\n CosDatabricksConnectionsDocument,\n {\n pagination: { limit: 50, offset },\n }\n );\n setConnections((previous) =>\n Array.from(\n new Map(\n [...(offset ? previous : []), ...result.connections.items]\n .filter(\n (item) =>\n item.workspaceId === workspaceId &&\n item.canUse &&\n item.status === 'ACTIVE' &&\n item.provider.key === 'generic-api-key'\n )\n .map((item) => [item.id, item])\n ).values()\n )\n );\n setConnectionOffset(offset + result.connections.items.length);\n setMoreConnections(result.connections.hasMore);\n } else {\n const offset = moreDatasets ? datasetOffset : 0;\n const result = await request<CosDatabricksDatasetsQuery>(CosDatabricksDatasetsDocument, {\n pagination: { limit: 50, offset },\n });\n setDatasets((previous) =>\n Array.from(\n new Map(\n [...(offset ? previous : []), ...result.cosListDatasets.items].map((item) => [\n item.id,\n item,\n ])\n ).values()\n )\n );\n setDatasetOffset(offset + result.cosListDatasets.items.length);\n setMoreDatasets(result.cosListDatasets.pageInfo.hasMore);\n }\n } catch {\n setError('Could not load choices. Retry this read; no job was submitted.');\n } finally {\n sending.current = false;\n setBusy(false);\n }\n };\n\n const submit = async (event: FormEvent) => {\n event.preventDefault();\n if (sending.current) return;\n sending.current = true;\n setBusy(true);\n setError(null);\n let dispatched = false;\n let serverConfirmed = false;\n try {\n if (!canQueue || !statusReady) {\n throw new Error('Refresh and confirm existing job status before submitting a request.');\n }\n if (!confirmedCost || !connections.some((item) => item.id === connectionId)) {\n throw new Error(\n 'Choose an available existing connection and confirm external usage charges.'\n );\n }\n const maxRuntimeSeconds = Number(maximum);\n if (\n !Number.isSafeInteger(maxRuntimeSeconds) ||\n maxRuntimeSeconds < 60 ||\n maxRuntimeSeconds > 86400\n ) {\n throw new Error('Choose a monitoring deadline between 60 and 86,400 seconds.');\n }\n if (!name.trim() || name.trim().length > 255)\n throw new Error('Enter a job step name of at most 255 characters.');\n if (inputs.length > 100 || outputs.length > 100)\n throw new Error('Select at most 100 datasets for each lineage direction.');\n const input = {\n connectionId,\n jobId: databricksJobId(jobId),\n name: name.trim(),\n parameters: databricksParameters(parameters),\n inputDatasetIds: inputs,\n outputDatasetIds: outputs,\n maxRuntimeSeconds,\n };\n const prepared = await prepareDatabricksIntent(window.sessionStorage, intentKey, input);\n if (prepared.confirmedExecutionId)\n throw new Error('This request is already confirmed. Explicitly start another job below.');\n setIntent(prepared);\n dispatched = true;\n const result = await request<CosQueueDatabricksStepMutation>(CosQueueDatabricksStepDocument, {\n runId,\n input: { ...input, requestId: prepared.requestId },\n });\n if (\n result.cosQueueDatabricksStep.runId !== runId ||\n result.cosQueueDatabricksStep.requestId !== prepared.requestId\n ) {\n throw new Error('The returned execution did not match the saved request.');\n }\n serverConfirmed = true;\n let recoveryStorageFailed = false;\n try {\n if (\n !confirmDatabricksIntent(window.sessionStorage, intentKey, result.cosQueueDatabricksStep)\n )\n throw new Error('The acknowledged execution no longer matches local recovery identity.');\n reloadIntent();\n } catch {\n // A local storage failure cannot undo the acknowledged server execution.\n recoveryStorageFailed = true;\n }\n await onQueued();\n if (recoveryStorageFailed) {\n setError(\n 'The job request is confirmed and status was refreshed, but local recovery storage failed. Do not submit another job; recover the original request identity.'\n );\n }\n } catch (failure) {\n setError(\n serverConfirmed\n ? 'The job request is confirmed, but its status refresh failed. Refresh job status; do not submit a replacement.'\n : dispatched\n ? 'The queue outcome was not confirmed. Refresh job status. Retrying identical inputs reuses the saved request; changing them is refused until the original is recovered.'\n : failure instanceof Error\n ? failure.message\n : 'The request could not be verified. No job was submitted.'\n );\n } finally {\n sending.current = false;\n setBusy(false);\n }\n };\n\n const checkSavedRequest = () => {\n try {\n reloadIntent();\n } catch {\n setError('The saved request could not be verified.');\n }\n };\n const resolveSavedRequest = async () => {\n if (sending.current) return;\n sending.current = true;\n setBusy(true);\n setError(null);\n let resolved = false;\n try {\n const savedRequest = readDatabricksIntent(window.sessionStorage, intentKey);\n if (!savedRequest || savedRequest.confirmedExecutionId) {\n throw new Error('Only an unresolved saved request can be recovered here.');\n }\n const result = await request<CosResolveExternalComputeRequestMutation>(\n CosResolveExternalComputeRequestDocument,\n { runId, requestId: savedRequest.requestId }\n );\n const resolution = result.cosResolveExternalComputeRequest;\n if (\n readDatabricksIntent(window.sessionStorage, intentKey)?.requestId !== savedRequest.requestId\n ) {\n throw new Error('The saved request changed while recovery was running.');\n }\n if (resolution.withdrawn && resolution.execution === null) {\n clearWithdrawnDatabricksIntent(window.sessionStorage, intentKey, savedRequest.requestId);\n setConfirmedCost(false);\n } else if (\n !resolution.withdrawn &&\n resolution.execution?.runId === runId &&\n resolution.execution.requestId === savedRequest.requestId\n ) {\n if (!confirmDatabricksIntent(window.sessionStorage, intentKey, resolution.execution))\n throw new Error('The recovered execution no longer matches local recovery identity.');\n } else {\n throw new Error('The response did not resolve this exact saved request.');\n }\n reloadIntent();\n resolved = true;\n await onQueued();\n } catch {\n setError(\n resolved\n ? 'The saved request was resolved, but status refresh failed. Refresh status before submitting another job.'\n : 'The saved request could not be resolved. Keep its identity and retry recovery; do not submit a replacement.'\n );\n } finally {\n sending.current = false;\n setBusy(false);\n }\n };\n const startAnotherJob = () => {\n try {\n clearConfirmedDatabricksIntent(window.sessionStorage, intentKey);\n setIntent(null);\n setConfirmedCost(false);\n } catch {\n setError('The prior request is not confirmed. Refresh status before starting another job.');\n }\n };\n return {\n connections,\n datasets,\n connectionOffset,\n datasetOffset,\n moreConnections,\n moreDatasets,\n connectionId,\n jobId,\n name,\n parameters,\n maximum,\n inputs,\n outputs,\n confirmedCost,\n busy,\n error,\n intent,\n setConnectionId,\n setJobId,\n setName,\n setParameters,\n setMaximum,\n setInputs,\n setOutputs,\n setConfirmedCost,\n loadOptions,\n submit,\n checkSavedRequest,\n resolveSavedRequest,\n startAnotherJob,\n };\n}\n"],"mappings":";;;;;;AA4BA,SAAgB,EAAuB,EACrC,YACA,UACA,gBACA,cACA,aACA,iBACA,eASC;CACD,IAAM,CAAC,GAAa,KAAkB,EAAuB,CAAC,CAAC,GACzD,CAAC,GAAU,KAAe,EAAoB,CAAC,CAAC,GAChD,CAAC,GAAkB,KAAuB,EAAS,CAAC,GACpD,CAAC,GAAe,KAAoB,EAAS,CAAC,GAC9C,CAAC,GAAiB,KAAsB,EAAS,EAAK,GACtD,CAAC,GAAc,MAAmB,EAAS,EAAK,GAChD,CAAC,GAAc,MAAmB,EAAS,EAAE,GAC7C,CAAC,GAAO,KAAY,EAAS,EAAE,GAC/B,CAAC,GAAM,KAAW,EAAS,gBAAgB,GAC3C,CAAC,GAAY,KAAiB,EAAS,IAAI,GAC3C,CAAC,GAAS,KAAc,EAAS,MAAM,GACvC,CAAC,GAAQ,KAAa,EAAmB,CAAC,CAAC,GAC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cAAc,MAEnD,AADA,EAA+B,OAAO,gBAAgB,GAAW,EAAa,SAAS,GACvF,EAAiB,EAAK;SACjB,IACL,CAAC,EAAW,aACZ,EAAW,WAAW,UAAU,KAChC,EAAW,UAAU,cAAc,EAAa;SAE5C,CAAC,EAAwB,OAAO,gBAAgB,GAAW,EAAW,SAAS,GACjF,MAAU,MAAM,oEAAoE;IAAA,OAEtF,MAAU,MAAM,wDAAwD;IAI1E,AAFA,EAAa,GACb,IAAW,IACX,MAAM,EAAS;GACjB,QAAQ;IACN,EACE,IACI,6GACA,6GACN;GACF,UAAU;IAER,AADA,EAAQ,UAAU,IAClB,EAAQ,EAAK;GACf;EACF;EAwCE,uBAvC4B;GAC5B,IAAI;IAGF,AAFA,EAA+B,OAAO,gBAAgB,CAAS,GAC/D,EAAU,IAAI,GACd,EAAiB,EAAK;GACxB,QAAQ;IACN,EAAS,iFAAiF;GAC5F;EACF;CAgCA;AACF"}
|
|
1
|
+
{"version":3,"file":"useDatabricksQueueForm.js","names":["useDatabricksQueueForm","connections","setConnections","useState","datasets","setDatasets","connectionOffset","setConnectionOffset","datasetOffset","setDatasetOffset","moreConnections","setMoreConnections","moreDatasets","setMoreDatasets","connectionId","setConnectionId","jobId","setJobId","name","setName","parameters","setParameters","maximum","setMaximum","inputs","setInputs","outputs","setOutputs","confirmedCost","setConfirmedCost","busy","setBusy","saved","readDatabricksIntent","intentKey","error","setError","intent","setIntent","sending","useRef","reloadIntent","clearGraphqlFetchResponseCache","kind","offset","result","request","CosDatabricksConnectionsDocument","previous","item","workspaceId","CosDatabricksDatasetsDocument","event","dispatched","serverConfirmed","canQueue","statusReady","maxRuntimeSeconds","input","databricksJobId","databricksParameters","prepared","prepareDatabricksIntent","CosQueueDatabricksStepDocument","runId","recoveryStorageFailed","confirmDatabricksIntent","onQueued","failure","resolved","savedRequest","resolution","CosResolveExternalComputeRequestDocument","clearWithdrawnDatabricksIntent","clearConfirmedDatabricksIntent"],"sources":["../../../src/cosmicintersection/hooks/useDatabricksQueueForm.ts"],"sourcesContent":["import { useRef, useState, type FormEvent } from 'react';\nimport type { DocumentNode } from 'graphql';\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql';\n\nimport {\n CosDatabricksConnectionsDocument,\n CosDatabricksDatasetsDocument,\n CosQueueDatabricksStepDocument,\n CosResolveExternalComputeRequestDocument,\n type CosDatabricksConnectionsQuery,\n type CosDatabricksDatasetsQuery,\n type CosQueueDatabricksStepMutation,\n type CosResolveExternalComputeRequestMutation,\n} from '../../generated/wspace-operations';\nimport { databricksJobId, databricksParameters } from '../lib/databricksForm';\nimport {\n clearConfirmedDatabricksIntent,\n clearWithdrawnDatabricksIntent,\n confirmDatabricksIntent,\n prepareDatabricksIntent,\n readDatabricksIntent,\n type DatabricksIntent,\n} from '../lib/databricksIntent';\n\ntype Connection = CosDatabricksConnectionsQuery['connections']['items'][number];\ntype Dataset = CosDatabricksDatasetsQuery['cosListDatasets']['items'][number];\ntype Request = <T>(document: DocumentNode, variables: Record<string, unknown>) => Promise<T>;\n\nexport function useDatabricksQueueForm({\n request,\n runId,\n workspaceId,\n intentKey,\n onQueued,\n statusReady,\n canQueue,\n}: {\n request: Request;\n runId: string;\n workspaceId: string;\n intentKey: string;\n onQueued(): Promise<void>;\n statusReady: boolean;\n canQueue: boolean;\n}) {\n const [connections, setConnections] = useState<Connection[]>([]);\n const [datasets, setDatasets] = useState<Dataset[]>([]);\n const [connectionOffset, setConnectionOffset] = useState(0);\n const [datasetOffset, setDatasetOffset] = useState(0);\n const [moreConnections, setMoreConnections] = useState(false);\n const [moreDatasets, setMoreDatasets] = useState(false);\n const [connectionId, setConnectionId] = useState('');\n const [jobId, setJobId] = useState('');\n const [name, setName] = useState('Databricks job');\n const [parameters, setParameters] = useState('{}');\n const [maximum, setMaximum] = useState('3600');\n const [inputs, setInputs] = useState<string[]>([]);\n const [outputs, setOutputs] = useState<string[]>([]);\n const [confirmedCost, setConfirmedCost] = useState(false);\n const [busy, setBusy] = useState(false);\n const [saved] = useState(() => {\n try {\n return { intent: readDatabricksIntent(window.sessionStorage, intentKey), error: null };\n } catch {\n return {\n intent: null,\n error:\n 'The saved request is unreadable. Do not submit another job until its status is recovered.',\n };\n }\n });\n const [error, setError] = useState<string | null>(saved.error);\n const [intent, setIntent] = useState<DatabricksIntent | null>(saved.intent);\n const sending = useRef(false);\n\n const reloadIntent = () => setIntent(readDatabricksIntent(window.sessionStorage, intentKey));\n\n const loadOptions = async (kind: 'connections' | 'datasets') => {\n if (sending.current) return;\n sending.current = true;\n setBusy(true);\n setError(null);\n try {\n // The published FE4 transport has no per-request cache bypass. These\n // explicit choice refreshes must observe current credential eligibility;\n // clearing its shared short-lived read cache may refetch sibling reads.\n clearGraphqlFetchResponseCache();\n if (kind === 'connections') {\n const offset = moreConnections ? connectionOffset : 0;\n const result = await request<CosDatabricksConnectionsQuery>(\n CosDatabricksConnectionsDocument,\n {\n pagination: { limit: 50, offset },\n }\n );\n setConnections((previous) =>\n Array.from(\n new Map(\n [...(offset ? previous : []), ...result.connections.items]\n .filter(\n (item) =>\n item.workspaceId === workspaceId &&\n item.canUse &&\n item.status === 'ACTIVE' &&\n item.provider.key === 'generic-api-key'\n )\n .map((item) => [item.id, item])\n ).values()\n )\n );\n setConnectionOffset(offset + result.connections.items.length);\n setMoreConnections(result.connections.hasMore);\n } else {\n const offset = moreDatasets ? datasetOffset : 0;\n const result = await request<CosDatabricksDatasetsQuery>(CosDatabricksDatasetsDocument, {\n pagination: { limit: 50, offset },\n });\n setDatasets((previous) =>\n Array.from(\n new Map(\n [...(offset ? previous : []), ...result.cosListDatasets.items].map((item) => [\n item.id,\n item,\n ])\n ).values()\n )\n );\n setDatasetOffset(offset + result.cosListDatasets.items.length);\n setMoreDatasets(result.cosListDatasets.pageInfo.hasMore);\n }\n } catch {\n setError('Could not load choices. Retry this read; no job was submitted.');\n } finally {\n sending.current = false;\n setBusy(false);\n }\n };\n\n const submit = async (event: FormEvent) => {\n event.preventDefault();\n if (sending.current) return;\n sending.current = true;\n setBusy(true);\n setError(null);\n let dispatched = false;\n let serverConfirmed = false;\n try {\n if (!canQueue || !statusReady) {\n throw new Error('Refresh and confirm existing job status before submitting a request.');\n }\n if (!confirmedCost || !connections.some((item) => item.id === connectionId)) {\n throw new Error(\n 'Choose an available existing connection and confirm external usage charges.'\n );\n }\n const maxRuntimeSeconds = Number(maximum);\n if (\n !Number.isSafeInteger(maxRuntimeSeconds) ||\n maxRuntimeSeconds < 60 ||\n maxRuntimeSeconds > 86400\n ) {\n throw new Error('Choose a monitoring deadline between 60 and 86,400 seconds.');\n }\n if (!name.trim() || name.trim().length > 255)\n throw new Error('Enter a job step name of at most 255 characters.');\n if (inputs.length > 100 || outputs.length > 100)\n throw new Error('Select at most 100 datasets for each lineage direction.');\n const input = {\n connectionId,\n jobId: databricksJobId(jobId),\n name: name.trim(),\n parameters: databricksParameters(parameters),\n inputDatasetIds: inputs,\n outputDatasetIds: outputs,\n maxRuntimeSeconds,\n };\n const prepared = await prepareDatabricksIntent(window.sessionStorage, intentKey, input);\n if (prepared.confirmedExecutionId)\n throw new Error('This request is already confirmed. Explicitly start another job below.');\n setIntent(prepared);\n dispatched = true;\n const result = await request<CosQueueDatabricksStepMutation>(CosQueueDatabricksStepDocument, {\n runId,\n input: { ...input, requestId: prepared.requestId },\n });\n if (\n result.cosQueueDatabricksStep.runId !== runId ||\n result.cosQueueDatabricksStep.requestId !== prepared.requestId\n ) {\n throw new Error('The returned execution did not match the saved request.');\n }\n serverConfirmed = true;\n let recoveryStorageFailed = false;\n try {\n if (\n !confirmDatabricksIntent(window.sessionStorage, intentKey, result.cosQueueDatabricksStep)\n )\n throw new Error('The acknowledged execution no longer matches local recovery identity.');\n reloadIntent();\n } catch {\n // A local storage failure cannot undo the acknowledged server execution.\n recoveryStorageFailed = true;\n }\n await onQueued();\n if (recoveryStorageFailed) {\n setError(\n 'The job request is confirmed and status was refreshed, but local recovery storage failed. Do not submit another job; recover the original request identity.'\n );\n }\n } catch (failure) {\n setError(\n serverConfirmed\n ? 'The job request is confirmed, but its status refresh failed. Refresh job status; do not submit a replacement.'\n : dispatched\n ? 'The queue outcome was not confirmed. Refresh job status. Retrying identical inputs reuses the saved request; changing them is refused until the original is recovered.'\n : failure instanceof Error\n ? failure.message\n : 'The request could not be verified. No job was submitted.'\n );\n } finally {\n sending.current = false;\n setBusy(false);\n }\n };\n\n const checkSavedRequest = () => {\n try {\n reloadIntent();\n } catch {\n setError('The saved request could not be verified.');\n }\n };\n const resolveSavedRequest = async () => {\n if (sending.current) return;\n sending.current = true;\n setBusy(true);\n setError(null);\n let resolved = false;\n try {\n const savedRequest = readDatabricksIntent(window.sessionStorage, intentKey);\n if (!savedRequest || savedRequest.confirmedExecutionId) {\n throw new Error('Only an unresolved saved request can be recovered here.');\n }\n const result = await request<CosResolveExternalComputeRequestMutation>(\n CosResolveExternalComputeRequestDocument,\n { runId, requestId: savedRequest.requestId }\n );\n const resolution = result.cosResolveExternalComputeRequest;\n if (\n readDatabricksIntent(window.sessionStorage, intentKey)?.requestId !== savedRequest.requestId\n ) {\n throw new Error('The saved request changed while recovery was running.');\n }\n if (resolution.withdrawn && resolution.execution === null) {\n clearWithdrawnDatabricksIntent(window.sessionStorage, intentKey, savedRequest.requestId);\n setConfirmedCost(false);\n } else if (\n !resolution.withdrawn &&\n resolution.execution?.runId === runId &&\n resolution.execution.requestId === savedRequest.requestId\n ) {\n if (!confirmDatabricksIntent(window.sessionStorage, intentKey, resolution.execution))\n throw new Error('The recovered execution no longer matches local recovery identity.');\n } else {\n throw new Error('The response did not resolve this exact saved request.');\n }\n reloadIntent();\n resolved = true;\n await onQueued();\n } catch {\n setError(\n resolved\n ? 'The saved request was resolved, but status refresh failed. Refresh status before submitting another job.'\n : 'The saved request could not be resolved. Keep its identity and retry recovery; do not submit a replacement.'\n );\n } finally {\n sending.current = false;\n setBusy(false);\n }\n };\n const startAnotherJob = () => {\n try {\n clearConfirmedDatabricksIntent(window.sessionStorage, intentKey);\n setIntent(null);\n setConfirmedCost(false);\n } catch {\n setError('The prior request is not confirmed. Refresh status before starting another job.');\n }\n };\n return {\n connections,\n datasets,\n connectionOffset,\n datasetOffset,\n moreConnections,\n moreDatasets,\n connectionId,\n jobId,\n name,\n parameters,\n maximum,\n inputs,\n outputs,\n confirmedCost,\n busy,\n error,\n intent,\n setConnectionId,\n setJobId,\n setName,\n setParameters,\n setMaximum,\n setInputs,\n setOutputs,\n setConfirmedCost,\n loadOptions,\n submit,\n checkSavedRequest,\n resolveSavedRequest,\n startAnotherJob,\n };\n}\n"],"mappings":";;;;;;AA4BA,SAAgBA,EAAuB,EACrC,YACA,UACA,gBACA,cACA,aACA,iBACA,eASC;CACD,IAAM,CAACC,GAAaC,KAAkBC,EAAuB,CAAC,CAAC,GACzD,CAACC,GAAUC,KAAeF,EAAoB,CAAC,CAAC,GAChD,CAACG,GAAkBC,KAAuBJ,EAAS,CAAC,GACpD,CAACK,GAAeC,KAAoBN,EAAS,CAAC,GAC9C,CAACO,GAAiBC,KAAsBR,EAAS,EAAK,GACtD,CAACS,GAAcC,MAAmBV,EAAS,EAAK,GAChD,CAACW,GAAcC,MAAmBZ,EAAS,EAAE,GAC7C,CAACa,GAAOC,KAAYd,EAAS,EAAE,GAC/B,CAACe,GAAMC,KAAWhB,EAAS,gBAAgB,GAC3C,CAACiB,GAAYC,KAAiBlB,EAAS,IAAI,GAC3C,CAACmB,GAASC,KAAcpB,EAAS,MAAM,GACvC,CAACqB,GAAQC,KAAatB,EAAmB,CAAC,CAAC,GAC3C,CAACuB,GAASC,KAAcxB,EAAmB,CAAC,CAAC,GAC7C,CAACyB,GAAeC,KAAoB1B,EAAS,EAAK,GAClD,CAAC2B,GAAMC,KAAW5B,EAAS,EAAK,GAChC,CAAC6B,KAAS7B,QAAe;EAC7B,IAAI;GACF,OAAO;IAAE,QAAQ8B,EAAqB,OAAO,gBAAgBC,CAAS;IAAG,OAAO;GAAK;EACvF,QAAQ;GACN,OAAO;IACL,QA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gBvC,GAAWoC,EAAa,SAAS,GACvFzC,EAAiB,EAAK;SACjB,IACL,CAAC0C,EAAW,aACZA,EAAW,WAAW,UAAUP,KAChCO,EAAW,UAAU,cAAcD,EAAa,WAE5C;SAAA,CAACJ,EAAwB,OAAO,gBAAgBhC,GAAWqC,EAAW,SAAS,GACjF,MAAU,MAAM,oEAAoE;IAAA,OAEtF,MAAU,MAAM,wDAAwD;IAI1E,AAFA9B,EAAa,GACb,IAAW,IACX,MAAM0B,EAAS;GACjB,QAAQ;IACN,EACEE,IACI,6GACA,6GACN;GACF,UAAU;IAER,AADA,EAAQ,UAAU,IAClBtC,EAAQ,EAAK;GACf;EACF;EAwCE,uBAvC4B;GAC5B,IAAI;IAGF,AAFA2C,EAA+B,OAAO,gBAAgBxC,CAAS,GAC/DI,EAAU,IAAI,GACdT,EAAiB,EAAK;GACxB,QAAQ;IACN,EAAS,iFAAiF;GAC5F;EACF;CAgCA;AACF"}
|
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AVAILABLE_COS_TAGS as e, COS_ENTITY_TAGS as t, CREATE_COS_TAG as n, REPLACE_COS_ENTITY_TAGS as r, SEARCH_COS_TAGS as i, diffEntityTagLabels as a, findTagByLabel as o, labelsMissingFromAssignments as s, nextEntityTagIds as c, normalizeTagLabel as l } from "../api/tagsApi.js";
|
|
2
|
+
import { notify as u } from "../lib/toast.js";
|
|
3
3
|
import { useCallback as d, useState as f } from "react";
|
|
4
4
|
import { useApolloClient as p } from "@apollo/client/react";
|
|
5
|
-
|
|
5
|
+
// src/cosmicintersection/hooks/useEntityTagSync.ts
|
|
6
6
|
var m = "The labels were saved. Workspace tag assignments were not changed; manage them from the Tags page.", h = 25;
|
|
7
7
|
function g(g) {
|
|
8
8
|
let _ = p(), [v, y] = f(0), b = d(async (d, f, p = []) => {
|
|
9
9
|
if (!d) return !1;
|
|
10
|
-
let v =
|
|
10
|
+
let v = a(p, f);
|
|
11
11
|
if (v.added.length === 0 && v.removed.length === 0) return !0;
|
|
12
12
|
let { removed: y } = v, b = null;
|
|
13
13
|
try {
|
|
14
|
-
let [
|
|
15
|
-
query:
|
|
14
|
+
let [a, u] = await Promise.all([_.query({
|
|
15
|
+
query: e,
|
|
16
16
|
variables: { limit: 200 },
|
|
17
17
|
fetchPolicy: "network-only"
|
|
18
18
|
}), _.query({
|
|
19
|
-
query:
|
|
19
|
+
query: t,
|
|
20
20
|
variables: { input: {
|
|
21
21
|
entityType: g,
|
|
22
22
|
entityId: d
|
|
23
23
|
} },
|
|
24
24
|
fetchPolicy: "network-only"
|
|
25
|
-
})]), p =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
})]), p = a.data?.availableCosTags ?? [], m = u.data?.cosEntityTags ?? [], v = s(f, m, p), x = async (e) => {
|
|
26
|
+
let t = o(p, e);
|
|
27
|
+
if (t) return t;
|
|
28
|
+
let n = await _.query({
|
|
29
|
+
query: i,
|
|
30
|
+
variables: {
|
|
31
|
+
query: e,
|
|
32
|
+
limit: h
|
|
33
|
+
},
|
|
34
|
+
fetchPolicy: "network-only"
|
|
35
|
+
});
|
|
36
|
+
return o(n.data?.searchCosTags ?? [], e);
|
|
37
|
+
}, S = new Set(m.map((e) => e.tagInfo?.label).filter((e) => !!e).map(l)), C = [];
|
|
33
38
|
for (let e of y) {
|
|
34
|
-
if (S.has(
|
|
39
|
+
if (S.has(l(e))) continue;
|
|
35
40
|
let t = await x(e);
|
|
36
41
|
t && C.push(t.id);
|
|
37
42
|
}
|
|
@@ -42,31 +47,31 @@ function g(g) {
|
|
|
42
47
|
w.push(t.id);
|
|
43
48
|
continue;
|
|
44
49
|
}
|
|
45
|
-
let
|
|
46
|
-
mutation:
|
|
50
|
+
let r = (await _.mutate({
|
|
51
|
+
mutation: n,
|
|
47
52
|
variables: { input: { label: e } }
|
|
48
53
|
})).data?.createCosTag?.id;
|
|
49
|
-
if (!
|
|
50
|
-
w.push(
|
|
54
|
+
if (!r) throw Error(`Tag "${e}" could not be created`);
|
|
55
|
+
w.push(r), T = !0;
|
|
51
56
|
} catch (e) {
|
|
52
57
|
b ??= e;
|
|
53
58
|
}
|
|
54
59
|
await _.mutate({
|
|
55
|
-
mutation:
|
|
60
|
+
mutation: r,
|
|
56
61
|
variables: { input: {
|
|
57
62
|
entityType: g,
|
|
58
63
|
entityId: d,
|
|
59
|
-
tagIds:
|
|
64
|
+
tagIds: c(m, y, C, w)
|
|
60
65
|
} },
|
|
61
66
|
refetchQueries: T ? [{
|
|
62
|
-
query:
|
|
67
|
+
query: e,
|
|
63
68
|
variables: { limit: 200 }
|
|
64
69
|
}] : []
|
|
65
70
|
});
|
|
66
71
|
} catch (e) {
|
|
67
72
|
b ??= e;
|
|
68
73
|
}
|
|
69
|
-
return b === null
|
|
74
|
+
return b === null || (u.warning("Saved, but workspace tags were not updated", b instanceof Error ? `${b.message}. ${m}` : m), !1);
|
|
70
75
|
}, [_, g]);
|
|
71
76
|
return {
|
|
72
77
|
syncTags: d(async (e, t, n = []) => {
|
|
@@ -80,7 +85,6 @@ function g(g) {
|
|
|
80
85
|
syncing: v > 0
|
|
81
86
|
};
|
|
82
87
|
}
|
|
83
|
-
//#endregion
|
|
84
88
|
export { m as RETRY_HINT, g as useEntityTagSync };
|
|
85
89
|
|
|
86
90
|
//# sourceMappingURL=useEntityTagSync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntityTagSync.js","names":[],"sources":["../../../src/cosmicintersection/hooks/useEntityTagSync.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\n\nimport {\n AVAILABLE_COS_TAGS,\n COS_ENTITY_TAGS,\n CREATE_COS_TAG,\n REPLACE_COS_ENTITY_TAGS,\n SEARCH_COS_TAGS,\n WORKSPACE_TAG_LIMIT,\n diffEntityTagLabels,\n findTagByLabel,\n labelsMissingFromAssignments,\n nextEntityTagIds,\n normalizeTagLabel,\n type AvailableCosTagsData,\n type CosEntityTagsData,\n type CosTagEntityType,\n type CosWorkspaceTag,\n type CreateCosTagData,\n type ReplaceCosEntityTagsData,\n type SearchCosTagsData,\n} from '../api/tagsApi';\nimport { notify } from '../lib/toast';\n\n/** What a user can do after a failed sync; changes are not replayed automatically. */\nexport const RETRY_HINT =\n 'The labels were saved. Workspace tag assignments were not changed; manage them from the Tags page.';\n\n/** How many server-side search hits are checked for an exact label match. */\nconst SEARCH_LIMIT = 25;\n\n/**\n * Apply the tag labels a form added or removed to an entity's workspace tag\n * assignments.\n *\n * Call the returned `syncTags(entityId, labels, previousLabels)` right after\n * the entity's own create/update mutation succeeds (the entity and its inline\n * `tags` array are already saved by then). Pass the labels the entity was\n * loaded with, captured before the mutation (an empty array on create).\n *\n * - Unchanged labels do nothing: there is no network call and assignments made\n * from another surface are never touched.\n * - When the labels changed, every label the form holds that is not assigned\n * yet is resolved against the workspace taxonomy. Labels missing from\n * the capped suggestion page are looked up with `searchCosTags` before\n * anything is created, so a large workspace never gets a duplicate tag.\n * Labels with no match are created (create-on-select).\n * - Removed labels drop only their own assignment, resolved by the label of\n * the assignment or, when that projection is missing, by looking the label\n * up in the taxonomy. Every other current assignment is kept.\n *\n * Best-effort by design: the entity is already persisted, so a tags-svc\n * failure must never block the form. When some new tags were created before\n * a later one failed, the ones that succeeded are still assigned. A failure\n * surfaces one warning and resolves `false`, so the page can skip its success\n * toast.\n *\n * The entity's inline `tags` array stays the source of truth for the labels;\n * assignments are never reconciled to exactly that set, because that would\n * drop tags assigned from other surfaces. So a change whose sync failed is not\n * replayed later. Adding a label again re-applies it on the next tag edit\n * (missing labels are backfilled), while a failed removal has to be repeated\n * from the workspace Tags page. The warning says so instead of promising an\n * automatic retry.\n */\nexport interface EntityTagSync {\n /** Apply the form's label changes to the entity's workspace tag assignments. */\n syncTags: (\n entityId: string,\n labels: readonly string[],\n previousLabels?: readonly string[]\n ) => Promise<boolean>;\n /**\n * True while a sync is in flight. Forms add it to their saving state so the\n * submit button stays disabled between the entity mutation and navigation,\n * which prevents a second submit from creating a duplicate entity.\n */\n syncing: boolean;\n}\n\nexport function useEntityTagSync(entityType: CosTagEntityType): EntityTagSync {\n const client = useApolloClient();\n const [pending, setPending] = useState(0);\n\n const run = useCallback(\n async (\n entityId: string,\n labels: readonly string[],\n previousLabels: readonly string[] = []\n ): Promise<boolean> => {\n if (!entityId) return false;\n const diff = diffEntityTagLabels(previousLabels, labels);\n if (diff.added.length === 0 && diff.removed.length === 0) return true;\n const { removed } = diff;\n\n let failure: unknown = null;\n try {\n const [taxonomy, assignments] = await Promise.all([\n client.query<AvailableCosTagsData, { limit: number }>({\n query: AVAILABLE_COS_TAGS,\n variables: { limit: WORKSPACE_TAG_LIMIT },\n fetchPolicy: 'network-only',\n }),\n client.query<\n CosEntityTagsData,\n { input: { entityType: CosTagEntityType; entityId: string } }\n >({\n query: COS_ENTITY_TAGS,\n variables: { input: { entityType, entityId } },\n fetchPolicy: 'network-only',\n }),\n ]);\n const workspaceTags: CosWorkspaceTag[] = taxonomy.data?.availableCosTags ?? [];\n const current = assignments.data?.cosEntityTags ?? [];\n // Every kept label that is not assigned yet, not only the newly typed\n // ones: this also backfills labels saved before structured tags\n // existed, and re-applies labels a previous failed sync missed.\n const added = labelsMissingFromAssignments(labels, current, workspaceTags);\n\n const resolve = async (label: string): Promise<CosWorkspaceTag | undefined> => {\n const known = findTagByLabel(workspaceTags, label);\n if (known) return known;\n const search = await client.query<SearchCosTagsData, { query: string; limit: number }>({\n query: SEARCH_COS_TAGS,\n variables: { query: label, limit: SEARCH_LIMIT },\n fetchPolicy: 'network-only',\n });\n return findTagByLabel(search.data?.searchCosTags ?? [], label);\n };\n\n // Removed labels usually match an assignment's tagInfo label. When the\n // projection is missing, resolve the label to an id (searching beyond\n // the capped taxonomy page) so the assignment is still dropped.\n const projected = new Set(\n current\n .map((assignment) => assignment.tagInfo?.label)\n .filter((label): label is string => Boolean(label))\n .map(normalizeTagLabel)\n );\n const removedTagIds: string[] = [];\n for (const label of removed) {\n if (projected.has(normalizeTagLabel(label))) continue;\n const tag = await resolve(label);\n if (tag) removedTagIds.push(tag.id);\n }\n\n const addedTagIds: string[] = [];\n let created = false;\n for (const label of added) {\n try {\n const existing = await resolve(label);\n if (existing) {\n addedTagIds.push(existing.id);\n continue;\n }\n const result = await client.mutate<CreateCosTagData, { input: { label: string } }>({\n mutation: CREATE_COS_TAG,\n variables: { input: { label } },\n });\n const id = result.data?.createCosTag?.id;\n if (!id) throw new Error(`Tag \"${label}\" could not be created`);\n addedTagIds.push(id);\n created = true;\n } catch (error) {\n // Keep going: the tags resolved so far are still assigned below.\n failure ??= error;\n }\n }\n\n await client.mutate<\n ReplaceCosEntityTagsData,\n { input: { entityType: CosTagEntityType; entityId: string; tagIds: string[] } }\n >({\n mutation: REPLACE_COS_ENTITY_TAGS,\n variables: {\n input: {\n entityType,\n entityId,\n tagIds: nextEntityTagIds(current, removed, removedTagIds, addedTagIds),\n },\n },\n refetchQueries: created\n ? [{ query: AVAILABLE_COS_TAGS, variables: { limit: WORKSPACE_TAG_LIMIT } }]\n : [],\n });\n } catch (error) {\n failure ??= error;\n }\n\n if (failure === null) return true;\n notify.warning(\n 'Saved, but workspace tags were not updated',\n failure instanceof Error ? `${failure.message}. ${RETRY_HINT}` : RETRY_HINT\n );\n return false;\n },\n [client, entityType]\n );\n\n const syncTags = useCallback(\n async (\n entityId: string,\n labels: readonly string[],\n previousLabels: readonly string[] = []\n ): Promise<boolean> => {\n setPending((count) => count + 1);\n try {\n return await run(entityId, labels, previousLabels);\n } finally {\n setPending((count) => count - 1);\n }\n },\n [run]\n );\n\n return { syncTags, syncing: pending > 0 };\n}\n"],"mappings":";;;;;AA0BA,IAAa,IACX,sGAGI,IAAe;AAmDrB,SAAgB,EAAiB,GAA6C;CAC5E,IAAM,IAAS,EAAgB,GACzB,CAAC,GAAS,KAAc,EAAS,CAAC,GAElC,IAAM,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,EAAY,KAAK,EAAS,EAAE;KAC5B;IACF;IAKA,IAAM,KAAK,MAJU,EAAO,OAAuD;KACjF,UAAU;KACV,WAAW,EAAE,OAAO,EAAE,SAAM,EAAE;IAChC,CAAC,EAAA,CACiB,MAAM,cAAc;IACtC,IAAI,CAAC,GAAI,MAAU,MAAM,QAAQ,EAAM,uBAAuB;IAE9D,AADA,EAAY,KAAK,CAAE,GACnB,IAAU;GACZ,SAAS,GAAO;IAEd,MAAY;GACd;GAGF,MAAM,EAAO,OAGX;IACA,UAAU;IACV,WAAW,EACT,OAAO;KACL;KACA;KACA,QAAQ,EAAiB,GAAS,GAAS,GAAe,CAAW;IACvE,EACF;IACA,gBAAgB,IACZ,CAAC;KAAE,OAAO;KAAoB,WAAW,EAAE,OAAA,IAA2B;IAAE,CAAC,IACzE,CAAC;GACP,CAAC;EACH,SAAS,GAAO;GACd,MAAY;EACd;EAOA,OALI,MAAY,OAAa,MAC7B,EAAO,QACL,8CACA,aAAmB,QAAQ,GAAG,EAAQ,QAAQ,IAAI,MAAe,CACnE,GACO;CACT,GACA,CAAC,GAAQ,CAAU,CACrB;CAkBA,OAAO;EAAE,UAhBQ,EACf,OACE,GACA,GACA,IAAoC,CAAC,MAChB;GACrB,GAAY,MAAU,IAAQ,CAAC;GAC/B,IAAI;IACF,OAAO,MAAM,EAAI,GAAU,GAAQ,CAAc;GACnD,UAAU;IACR,GAAY,MAAU,IAAQ,CAAC;GACjC;EACF,GACA,CAAC,CAAG,CAGG;EAAU,SAAS,IAAU;CAAE;AAC1C"}
|
|
1
|
+
{"version":3,"file":"useEntityTagSync.js","names":["RETRY_HINT","SEARCH_LIMIT","useEntityTagSync","client","useApolloClient","pending","setPending","useState","run","useCallback","entityId","diff","diffEntityTagLabels","previousLabels","labels","failure","taxonomy","assignments","AVAILABLE_COS_TAGS","COS_ENTITY_TAGS","workspaceTags","current","added","labelsMissingFromAssignments","resolve","known","findTagByLabel","label","search","SEARCH_COS_TAGS","projected","assignment","normalizeTagLabel","removedTagIds","removed","tag","addedTagIds","created","existing","id","CREATE_COS_TAG","error","REPLACE_COS_ENTITY_TAGS","nextEntityTagIds","notify","entityType","count"],"sources":["../../../src/cosmicintersection/hooks/useEntityTagSync.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\n\nimport {\n AVAILABLE_COS_TAGS,\n COS_ENTITY_TAGS,\n CREATE_COS_TAG,\n REPLACE_COS_ENTITY_TAGS,\n SEARCH_COS_TAGS,\n WORKSPACE_TAG_LIMIT,\n diffEntityTagLabels,\n findTagByLabel,\n labelsMissingFromAssignments,\n nextEntityTagIds,\n normalizeTagLabel,\n type AvailableCosTagsData,\n type CosEntityTagsData,\n type CosTagEntityType,\n type CosWorkspaceTag,\n type CreateCosTagData,\n type ReplaceCosEntityTagsData,\n type SearchCosTagsData,\n} from '../api/tagsApi';\nimport { notify } from '../lib/toast';\n\n/** What a user can do after a failed sync; changes are not replayed automatically. */\nexport const RETRY_HINT =\n 'The labels were saved. Workspace tag assignments were not changed; manage them from the Tags page.';\n\n/** How many server-side search hits are checked for an exact label match. */\nconst SEARCH_LIMIT = 25;\n\n/**\n * Apply the tag labels a form added or removed to an entity's workspace tag\n * assignments.\n *\n * Call the returned `syncTags(entityId, labels, previousLabels)` right after\n * the entity's own create/update mutation succeeds (the entity and its inline\n * `tags` array are already saved by then). Pass the labels the entity was\n * loaded with, captured before the mutation (an empty array on create).\n *\n * - Unchanged labels do nothing: there is no network call and assignments made\n * from another surface are never touched.\n * - When the labels changed, every label the form holds that is not assigned\n * yet is resolved against the workspace taxonomy. Labels missing from\n * the capped suggestion page are looked up with `searchCosTags` before\n * anything is created, so a large workspace never gets a duplicate tag.\n * Labels with no match are created (create-on-select).\n * - Removed labels drop only their own assignment, resolved by the label of\n * the assignment or, when that projection is missing, by looking the label\n * up in the taxonomy. Every other current assignment is kept.\n *\n * Best-effort by design: the entity is already persisted, so a tags-svc\n * failure must never block the form. When some new tags were created before\n * a later one failed, the ones that succeeded are still assigned. A failure\n * surfaces one warning and resolves `false`, so the page can skip its success\n * toast.\n *\n * The entity's inline `tags` array stays the source of truth for the labels;\n * assignments are never reconciled to exactly that set, because that would\n * drop tags assigned from other surfaces. So a change whose sync failed is not\n * replayed later. Adding a label again re-applies it on the next tag edit\n * (missing labels are backfilled), while a failed removal has to be repeated\n * from the workspace Tags page. The warning says so instead of promising an\n * automatic retry.\n */\nexport interface EntityTagSync {\n /** Apply the form's label changes to the entity's workspace tag assignments. */\n syncTags: (\n entityId: string,\n labels: readonly string[],\n previousLabels?: readonly string[]\n ) => Promise<boolean>;\n /**\n * True while a sync is in flight. Forms add it to their saving state so the\n * submit button stays disabled between the entity mutation and navigation,\n * which prevents a second submit from creating a duplicate entity.\n */\n syncing: boolean;\n}\n\nexport function useEntityTagSync(entityType: CosTagEntityType): EntityTagSync {\n const client = useApolloClient();\n const [pending, setPending] = useState(0);\n\n const run = useCallback(\n async (\n entityId: string,\n labels: readonly string[],\n previousLabels: readonly string[] = []\n ): Promise<boolean> => {\n if (!entityId) return false;\n const diff = diffEntityTagLabels(previousLabels, labels);\n if (diff.added.length === 0 && diff.removed.length === 0) return true;\n const { removed } = diff;\n\n let failure: unknown = null;\n try {\n const [taxonomy, assignments] = await Promise.all([\n client.query<AvailableCosTagsData, { limit: number }>({\n query: AVAILABLE_COS_TAGS,\n variables: { limit: WORKSPACE_TAG_LIMIT },\n fetchPolicy: 'network-only',\n }),\n client.query<\n CosEntityTagsData,\n { input: { entityType: CosTagEntityType; entityId: string } }\n >({\n query: COS_ENTITY_TAGS,\n variables: { input: { entityType, entityId } },\n fetchPolicy: 'network-only',\n }),\n ]);\n const workspaceTags: CosWorkspaceTag[] = taxonomy.data?.availableCosTags ?? [];\n const current = assignments.data?.cosEntityTags ?? [];\n // Every kept label that is not assigned yet, not only the newly typed\n // ones: this also backfills labels saved before structured tags\n // existed, and re-applies labels a previous failed sync missed.\n const added = labelsMissingFromAssignments(labels, current, workspaceTags);\n\n const resolve = async (label: string): Promise<CosWorkspaceTag | undefined> => {\n const known = findTagByLabel(workspaceTags, label);\n if (known) return known;\n const search = await client.query<SearchCosTagsData, { query: string; limit: number }>({\n query: SEARCH_COS_TAGS,\n variables: { query: label, limit: SEARCH_LIMIT },\n fetchPolicy: 'network-only',\n });\n return findTagByLabel(search.data?.searchCosTags ?? [], label);\n };\n\n // Removed labels usually match an assignment's tagInfo label. When the\n // projection is missing, resolve the label to an id (searching beyond\n // the capped taxonomy page) so the assignment is still dropped.\n const projected = new Set(\n current\n .map((assignment) => assignment.tagInfo?.label)\n .filter((label): label is string => Boolean(label))\n .map(normalizeTagLabel)\n );\n const removedTagIds: string[] = [];\n for (const label of removed) {\n if (projected.has(normalizeTagLabel(label))) continue;\n const tag = await resolve(label);\n if (tag) removedTagIds.push(tag.id);\n }\n\n const addedTagIds: string[] = [];\n let created = false;\n for (const label of added) {\n try {\n const existing = await resolve(label);\n if (existing) {\n addedTagIds.push(existing.id);\n continue;\n }\n const result = await client.mutate<CreateCosTagData, { input: { label: string } }>({\n mutation: CREATE_COS_TAG,\n variables: { input: { label } },\n });\n const id = result.data?.createCosTag?.id;\n if (!id) throw new Error(`Tag \"${label}\" could not be created`);\n addedTagIds.push(id);\n created = true;\n } catch (error) {\n // Keep going: the tags resolved so far are still assigned below.\n failure ??= error;\n }\n }\n\n await client.mutate<\n ReplaceCosEntityTagsData,\n { input: { entityType: CosTagEntityType; entityId: string; tagIds: string[] } }\n >({\n mutation: REPLACE_COS_ENTITY_TAGS,\n variables: {\n input: {\n entityType,\n entityId,\n tagIds: nextEntityTagIds(current, removed, removedTagIds, addedTagIds),\n },\n },\n refetchQueries: created\n ? [{ query: AVAILABLE_COS_TAGS, variables: { limit: WORKSPACE_TAG_LIMIT } }]\n : [],\n });\n } catch (error) {\n failure ??= error;\n }\n\n if (failure === null) return true;\n notify.warning(\n 'Saved, but workspace tags were not updated',\n failure instanceof Error ? `${failure.message}. ${RETRY_HINT}` : RETRY_HINT\n );\n return false;\n },\n [client, entityType]\n );\n\n const syncTags = useCallback(\n async (\n entityId: string,\n labels: readonly string[],\n previousLabels: readonly string[] = []\n ): Promise<boolean> => {\n setPending((count) => count + 1);\n try {\n return await run(entityId, labels, previousLabels);\n } finally {\n setPending((count) => count - 1);\n }\n },\n [run]\n );\n\n return { syncTags, syncing: pending > 0 };\n}\n"],"mappings":";;;;;AA0BA,IAAaA,IACX,sGAGIC,IAAe;AAmDrB,SAAgBC,EAAiB,GAA6C;CAC5E,IAAMC,IAASC,EAAgB,GACzB,CAACC,GAASC,KAAcC,EAAS,CAAC,GAElCC,IAAMC,EACV,OACE,GACA,GACA,IAAoC,CAAC,MAChB;EACrB,IAAI,CAACC,GAAU,OAAO;EACtB,IAAMC,IAAOC,EAAoBC,GAAgBC,CAAM;EACvD,IAAIH,EAAK,MAAM,WAAW,KAAKA,EAAK,QAAQ,WAAW,GAAG,OAAO;EACjE,IAAM,EAAE,eAAYA,GAEhBI,IAAmB;EACvB,IAAI;GACF,IAAM,CAACC,GAAUC,KAAe,MAAM,QAAQ,IAAI,CAChDd,EAAO,MAA+C;IACpD,OAAOe;IACP,WAAW,EAAE,OAAA,IAA2B;IACxC,aAAa;GACf,CAAC,GACDf,EAAO,MAGL;IACA,OAAOgB;IACP,WAAW,EAAE,OAAO;KAAE;KAAY;IAAS,EAAE;IAC7C,aAAa;GACf,CAAC,CACH,CAAC,GACKC,IAAmCJ,EAAS,MAAM,oBAAoB,CAAC,GACvEK,IAAUJ,EAAY,MAAM,iBAAiB,CAAC,GAI9CK,IAAQC,EAA6BT,GAAQO,GAASD,CAAa,GAEnEI,IAAU,OAAO,MAAwD;IAC7E,IAAMC,IAAQC,EAAeN,GAAeO,CAAK;IACjD,IAAIF,GAAO,OAAOA;IAClB,IAAMG,IAAS,MAAMzB,EAAO,MAA2D;KACrF,OAAO0B;KACP,WAAW;MAAE,OAAOF;MAAO,OAAO1B;KAAa;KAC/C,aAAa;IACf,CAAC;IACD,OAAOyB,EAAe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AACG,GAAQ0C,CAAU,CACrB;CAkBA,OAAO;EAAE,UAhBQpC,EACf,OACE,GACA,GACA,IAAoC,CAAC,MAChB;GACrB,GAAY,MAAUqC,IAAQ,CAAC;GAC/B,IAAI;IACF,OAAO,MAAMtC,EAAIE,GAAUI,GAAQD,CAAc;GACnD,UAAU;IACR,GAAY,MAAUiC,IAAQ,CAAC;GACjC;EACF,GACA,CAACtC,CAAG,CAGG;EAAU,SAASH,IAAU;CAAE;AAC1C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cosmicintersection/lib/assistantAwareDialog.ts
|
|
2
2
|
var e = "[data-testid=\"assistant-widget-window\"], [data-testid=\"assistant-widget-launcher\"]";
|
|
3
3
|
function t(e) {
|
|
4
4
|
let t = e.target;
|
|
@@ -8,7 +8,6 @@ function n(e) {
|
|
|
8
8
|
t(e) && e.preventDefault();
|
|
9
9
|
}
|
|
10
10
|
var r = { modal: !1 }, i = { onInteractOutside: n };
|
|
11
|
-
//#endregion
|
|
12
11
|
export { i as ASSISTANT_AWARE_DIALOG_CONTENT_PROPS, r as ASSISTANT_AWARE_DIALOG_ROOT_PROPS, e as ASSISTANT_WIDGET_SELECTOR, t as isAssistantWidgetEvent, n as keepOpenForAssistant };
|
|
13
12
|
|
|
14
13
|
//# sourceMappingURL=assistantAwareDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistantAwareDialog.js","names":[],"sources":["../../../src/cosmicintersection/lib/assistantAwareDialog.ts"],"sourcesContent":["/**\n * Props for a record-detail dialog that the AI assistant must stay usable\n * beside.\n *\n * Releases and analyses have no detail route: the page opens the focused\n * record in a dialog and keeps its id in `?id=` (`useSelectedRecord`), which\n * the assistant's page context turns into `entityType` + `entityId`. A modal\n * dialog defeats that: Radix hides everything outside it from assistive\n * technology, traps focus inside it and blocks pointer events on the rest of\n * the page, so the assistant panel cannot be typed into while the record it\n * would resolve is on screen. \"Publish this release\" could only be asked after\n * closing the release, at which point `?id=` is gone.\n *\n * These detail dialogs therefore open non-modally, and a click or focus move\n * into the assistant widget does not count as \"outside\" (which would close the\n * dialog and drop the record from the page context). Every other outside\n * interaction still closes the dialog, exactly as before. Form dialogs that\n * collect input stay modal; this is only for read-only record views.\n */\n\n/**\n * The shared fe-libs `AssistantWidget` launcher and window\n * (`@burdenoff/fe-libs/shared/components`, `assistantWidget/AssistantWidget.tsx`).\n * Matched by the test ids that component publishes; a widget that renders\n * without them simply falls back to the ordinary close-on-outside behaviour.\n */\nexport const ASSISTANT_WIDGET_SELECTOR =\n '[data-testid=\"assistant-widget-window\"], [data-testid=\"assistant-widget-launcher\"]';\n\n/** True when the event started inside the assistant launcher or window. */\nexport function isAssistantWidgetEvent(event: Pick<Event, 'target'>): boolean {\n const target = event.target;\n return target instanceof Element && target.closest(ASSISTANT_WIDGET_SELECTOR) !== null;\n}\n\n/**\n * Spread on `DialogContent`: ignore outside interactions that land in the\n * assistant widget, so talking to the assistant keeps the record open.\n */\nexport function keepOpenForAssistant(event: Pick<Event, 'target' | 'preventDefault'>): void {\n if (isAssistantWidgetEvent(event)) event.preventDefault();\n}\n\n/** Spread on the `Dialog` root of a record-detail dialog. */\nexport const ASSISTANT_AWARE_DIALOG_ROOT_PROPS = { modal: false } as const;\n\n/** Spread on the `DialogContent` of a record-detail dialog. */\nexport const ASSISTANT_AWARE_DIALOG_CONTENT_PROPS = {\n onInteractOutside: keepOpenForAssistant,\n} as const;\n"],"mappings":";AA0BA,
|
|
1
|
+
{"version":3,"file":"assistantAwareDialog.js","names":["ASSISTANT_WIDGET_SELECTOR","isAssistantWidgetEvent","target","event","keepOpenForAssistant","ASSISTANT_AWARE_DIALOG_ROOT_PROPS","ASSISTANT_AWARE_DIALOG_CONTENT_PROPS"],"sources":["../../../src/cosmicintersection/lib/assistantAwareDialog.ts"],"sourcesContent":["/**\n * Props for a record-detail dialog that the AI assistant must stay usable\n * beside.\n *\n * Releases and analyses have no detail route: the page opens the focused\n * record in a dialog and keeps its id in `?id=` (`useSelectedRecord`), which\n * the assistant's page context turns into `entityType` + `entityId`. A modal\n * dialog defeats that: Radix hides everything outside it from assistive\n * technology, traps focus inside it and blocks pointer events on the rest of\n * the page, so the assistant panel cannot be typed into while the record it\n * would resolve is on screen. \"Publish this release\" could only be asked after\n * closing the release, at which point `?id=` is gone.\n *\n * These detail dialogs therefore open non-modally, and a click or focus move\n * into the assistant widget does not count as \"outside\" (which would close the\n * dialog and drop the record from the page context). Every other outside\n * interaction still closes the dialog, exactly as before. Form dialogs that\n * collect input stay modal; this is only for read-only record views.\n */\n\n/**\n * The shared fe-libs `AssistantWidget` launcher and window\n * (`@burdenoff/fe-libs/shared/components`, `assistantWidget/AssistantWidget.tsx`).\n * Matched by the test ids that component publishes; a widget that renders\n * without them simply falls back to the ordinary close-on-outside behaviour.\n */\nexport const ASSISTANT_WIDGET_SELECTOR =\n '[data-testid=\"assistant-widget-window\"], [data-testid=\"assistant-widget-launcher\"]';\n\n/** True when the event started inside the assistant launcher or window. */\nexport function isAssistantWidgetEvent(event: Pick<Event, 'target'>): boolean {\n const target = event.target;\n return target instanceof Element && target.closest(ASSISTANT_WIDGET_SELECTOR) !== null;\n}\n\n/**\n * Spread on `DialogContent`: ignore outside interactions that land in the\n * assistant widget, so talking to the assistant keeps the record open.\n */\nexport function keepOpenForAssistant(event: Pick<Event, 'target' | 'preventDefault'>): void {\n if (isAssistantWidgetEvent(event)) event.preventDefault();\n}\n\n/** Spread on the `Dialog` root of a record-detail dialog. */\nexport const ASSISTANT_AWARE_DIALOG_ROOT_PROPS = { modal: false } as const;\n\n/** Spread on the `DialogContent` of a record-detail dialog. */\nexport const ASSISTANT_AWARE_DIALOG_CONTENT_PROPS = {\n onInteractOutside: keepOpenForAssistant,\n} as const;\n"],"mappings":";AA0BA,IAAaA,IACX;AAGF,SAAgBC,EAAuB,GAAuC;CAC5E,IAAMC,IAASC,EAAM;CACrB,OAAOD,aAAkB,WAAWA,EAAO,QAAA,wFAAiC,MAAM;AACpF;AAMA,SAAgBE,EAAqB,GAAuD;CAC1F,AAAIH,EAAuBE,CAAK,KAAGA,EAAM,eAAe;AAC1D;AAGA,IAAaE,IAAoC,EAAE,OAAO,GAAM,GAGnDC,IAAuC,EAClD,mBAAmBF,EACrB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
/** Browser validation improves feedback; the service remains authoritative. */
|
|
2
2
|
export declare function databricksParameters(text: string): Record<string, string>;
|
|
3
3
|
export declare function databricksJobId(text: string): string;
|
|
4
|
-
//# sourceMappingURL=databricksForm.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cosmicintersection/lib/databricksForm.ts
|
|
2
2
|
function e(e) {
|
|
3
3
|
let t;
|
|
4
4
|
try {
|
|
@@ -25,7 +25,6 @@ function t(e) {
|
|
|
25
25
|
if (!/^[1-9]\d{0,15}$/.test(e) || !Number.isSafeInteger(Number(e))) throw Error("Enter the positive numeric ID of an existing Databricks job.");
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { t as databricksJobId, e as databricksParameters };
|
|
30
29
|
|
|
31
30
|
//# sourceMappingURL=databricksForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"databricksForm.js","names":[],"sources":["../../../src/cosmicintersection/lib/databricksForm.ts"],"sourcesContent":["/** Browser validation improves feedback; the service remains authoritative. */\nexport function databricksParameters(text: string): Record<string, string> {\n let value: unknown;\n try {\n value = JSON.parse(text);\n } catch {\n throw new Error('Job parameters must be valid JSON with nonsecret string values.');\n }\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n throw new Error('Job parameters must be a JSON object with string values.');\n }\n const entries = Object.entries(value);\n if (entries.length > 50) throw new Error('Use at most 50 job parameters.');\n const result: Record<string, string> = {};\n for (const [key, item] of entries) {\n if (\n !/^[A-Za-z][A-Za-z0-9_.-]{0,99}$/.test(key) ||\n /password|passcode|token|secret|authorization|cookie|credential|api.?key/i.test(key) ||\n ['__proto__', 'constructor', 'prototype'].includes(key) ||\n key.startsWith('cosmicintersection_') ||\n typeof item !== 'string' ||\n item.length > 4096 ||\n Array.from(item).some((char) => char.charCodeAt(0) < 32)\n ) {\n throw new Error(\n 'Use nonsecret, non-reserved parameter names and string values of at most 4,096 characters without control characters.'\n );\n }\n result[key] = item;\n }\n if (new TextEncoder().encode(JSON.stringify(result)).byteLength > 16_384) {\n throw new Error('Encoded job parameters must fit within 16 KiB.');\n }\n return result;\n}\n\nexport function databricksJobId(text: string): string {\n if (!/^[1-9]\\d{0,15}$/.test(text) || !Number.isSafeInteger(Number(text))) {\n throw new Error('Enter the positive numeric ID of an existing Databricks job.');\n }\n return text;\n}\n"],"mappings":";AACA,
|
|
1
|
+
{"version":3,"file":"databricksForm.js","names":["databricksParameters","value","text","entries","result","key","item","char","databricksJobId"],"sources":["../../../src/cosmicintersection/lib/databricksForm.ts"],"sourcesContent":["/** Browser validation improves feedback; the service remains authoritative. */\nexport function databricksParameters(text: string): Record<string, string> {\n let value: unknown;\n try {\n value = JSON.parse(text);\n } catch {\n throw new Error('Job parameters must be valid JSON with nonsecret string values.');\n }\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n throw new Error('Job parameters must be a JSON object with string values.');\n }\n const entries = Object.entries(value);\n if (entries.length > 50) throw new Error('Use at most 50 job parameters.');\n const result: Record<string, string> = {};\n for (const [key, item] of entries) {\n if (\n !/^[A-Za-z][A-Za-z0-9_.-]{0,99}$/.test(key) ||\n /password|passcode|token|secret|authorization|cookie|credential|api.?key/i.test(key) ||\n ['__proto__', 'constructor', 'prototype'].includes(key) ||\n key.startsWith('cosmicintersection_') ||\n typeof item !== 'string' ||\n item.length > 4096 ||\n Array.from(item).some((char) => char.charCodeAt(0) < 32)\n ) {\n throw new Error(\n 'Use nonsecret, non-reserved parameter names and string values of at most 4,096 characters without control characters.'\n );\n }\n result[key] = item;\n }\n if (new TextEncoder().encode(JSON.stringify(result)).byteLength > 16_384) {\n throw new Error('Encoded job parameters must fit within 16 KiB.');\n }\n return result;\n}\n\nexport function databricksJobId(text: string): string {\n if (!/^[1-9]\\d{0,15}$/.test(text) || !Number.isSafeInteger(Number(text))) {\n throw new Error('Enter the positive numeric ID of an existing Databricks job.');\n }\n return text;\n}\n"],"mappings":";AACA,SAAgBA,EAAqB,GAAsC;CACzE,IAAIC;CACJ,IAAI;EACF,IAAQ,KAAK,MAAMC,CAAI;CACzB,QAAQ;EACN,MAAU,MAAM,iEAAiE;CACnF;CACA,IAAI,CAACD,KAAS,OAAOA,KAAU,YAAY,MAAM,QAAQA,CAAK,GAC5D,MAAU,MAAM,0DAA0D;CAE5E,IAAME,IAAU,OAAO,QAAQF,CAAK;CACpC,IAAIE,EAAQ,SAAS,IAAI,MAAU,MAAM,gCAAgC;CACzE,IAAMC,IAAiC,CAAC;CACxC,KAAK,IAAM,CAACC,GAAKC,MAASH,GAAS;EACjC,IACE,CAAC,iCAAiC,KAAKE,CAAG,KAC1C,2EAA2E,KAAKA,CAAG,KACnF;GAAC;GAAa;GAAe;EAAW,CAAC,CAAC,SAASA,CAAG,KACtDA,EAAI,WAAW,qBAAqB,KACpC,OAAOC,KAAS,YAChBA,EAAK,SAAS,QACd,MAAM,KAAKA,CAAI,CAAC,CAAC,MAAM,MAASC,EAAK,WAAW,CAAC,IAAI,EAAE,GAEvD,MAAU,MACR,uHACF;EAEF,EAAOF,KAAOC;CAChB;CACA,IAAI,IAAI,YAAY,CAAC,CAAC,OAAO,KAAK,UAAUF,CAAM,CAAC,CAAC,CAAC,aAAa,OAChE,MAAU,MAAM,gDAAgD;CAElE,OAAOA;AACT;AAEA,SAAgBI,EAAgB,GAAsB;CACpD,IAAI,CAAC,kBAAkB,KAAKN,CAAI,KAAK,CAAC,OAAO,cAAc,OAAOA,CAAI,CAAC,GACrE,MAAU,MAAM,8DAA8D;CAEhF,OAAOA;AACT"}
|
|
@@ -16,4 +16,3 @@ export declare function clearConfirmedDatabricksIntent(storage: IntentStorage, k
|
|
|
16
16
|
/** Called only after the service durably fenced this exact absent request UUID. */
|
|
17
17
|
export declare function clearWithdrawnDatabricksIntent(storage: IntentStorage, key: string, requestId: string): void;
|
|
18
18
|
export {};
|
|
19
|
-
//# sourceMappingURL=databricksIntent.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cosmicintersection/lib/databricksIntent.ts
|
|
2
2
|
var e = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
3
3
|
function t(t, n) {
|
|
4
4
|
let r = t.getItem(n);
|
|
@@ -54,7 +54,6 @@ function o(e, n, r) {
|
|
|
54
54
|
if (!i || i.requestId !== r || i.confirmedExecutionId) throw Error("The acknowledged withdrawal does not match the unresolved saved request.");
|
|
55
55
|
e.removeItem(n);
|
|
56
56
|
}
|
|
57
|
-
//#endregion
|
|
58
57
|
export { a as clearConfirmedDatabricksIntent, o as clearWithdrawnDatabricksIntent, i as confirmDatabricksIntent, r as prepareDatabricksIntent, t as readDatabricksIntent };
|
|
59
58
|
|
|
60
59
|
//# sourceMappingURL=databricksIntent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"databricksIntent.js","names":[],"sources":["../../../src/cosmicintersection/lib/databricksIntent.ts"],"sourcesContent":["/** Durable product intent only: never stores credentials, names or job parameters. */\nexport interface DatabricksIntent {\n requestId: string;\n fingerprint: string;\n confirmedExecutionId?: string;\n}\n\ntype IntentStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;\n\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\nexport function readDatabricksIntent(storage: IntentStorage, key: string): DatabricksIntent | null {\n const raw = storage.getItem(key);\n if (raw === null) return null;\n let value: unknown;\n try {\n value = JSON.parse(raw);\n } catch {\n throw new Error('The saved Databricks request cannot be verified. Do not submit another job.');\n }\n if (\n !value ||\n typeof value !== 'object' ||\n !('requestId' in value) ||\n typeof value.requestId !== 'string' ||\n !UUID.test(value.requestId) ||\n !('fingerprint' in value) ||\n typeof value.fingerprint !== 'string' ||\n !/^[a-f0-9]{64}$/.test(value.fingerprint) ||\n ('confirmedExecutionId' in value &&\n (typeof value.confirmedExecutionId !== 'string' || !UUID.test(value.confirmedExecutionId)))\n ) {\n throw new Error('The saved Databricks request cannot be verified. Do not submit another job.');\n }\n return {\n requestId: value.requestId,\n fingerprint: value.fingerprint,\n ...('confirmedExecutionId' in value && typeof value.confirmedExecutionId === 'string'\n ? { confirmedExecutionId: value.confirmedExecutionId }\n : {}),\n };\n}\n\n/** Stable serialization makes reordered parameter keys the same intent. */\nfunction canonical(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`;\n if (value !== null && typeof value === 'object') {\n return `{${Object.entries(value)\n .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))\n .map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`)\n .join(',')}}`;\n }\n if (value === undefined || (typeof value === 'number' && !Number.isFinite(value)))\n throw new Error('Databricks request contains an unsupported value.');\n const encoded = JSON.stringify(value);\n if (encoded === undefined) throw new Error('Databricks request contains an unsupported value.');\n return encoded;\n}\n\nexport async function prepareDatabricksIntent(\n storage: IntentStorage,\n key: string,\n input: unknown\n): Promise<DatabricksIntent> {\n const bytes = new TextEncoder().encode(canonical(input));\n const fingerprint = Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256', bytes)))\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('');\n // Read after hashing so a preceding same-tab submission cannot be overwritten.\n const previous = readDatabricksIntent(storage, key);\n if (previous) {\n if (previous.fingerprint !== fingerprint) {\n throw new Error(\n 'A previous request is unresolved. Restore its exact inputs and retry or inspect its status.'\n );\n }\n return previous;\n }\n const intent = { requestId: crypto.randomUUID(), fingerprint };\n // A failed persistence write must prevent the network request entirely.\n storage.setItem(key, JSON.stringify(intent));\n return intent;\n}\n\nexport function confirmDatabricksIntent(\n storage: IntentStorage,\n key: string,\n execution: { requestId: string; id: string }\n): boolean {\n const intent = readDatabricksIntent(storage, key);\n if (!intent || intent.requestId !== execution.requestId) return false;\n if (!UUID.test(execution.id)) throw new Error('The confirmed execution ID is invalid.');\n storage.setItem(key, JSON.stringify({ ...intent, confirmedExecutionId: execution.id }));\n return true;\n}\n\n/** Explicit \"another job\" only after the server returned this exact intent. */\nexport function clearConfirmedDatabricksIntent(storage: IntentStorage, key: string): void {\n const intent = readDatabricksIntent(storage, key);\n if (!intent?.confirmedExecutionId) {\n throw new Error('Refresh the existing request status before queuing another job.');\n }\n storage.removeItem(key);\n}\n\n/** Called only after the service durably fenced this exact absent request UUID. */\nexport function clearWithdrawnDatabricksIntent(\n storage: IntentStorage,\n key: string,\n requestId: string\n): void {\n const intent = readDatabricksIntent(storage, key);\n if (!intent || intent.requestId !== requestId || intent.confirmedExecutionId) {\n throw new Error('The acknowledged withdrawal does not match the unresolved saved request.');\n }\n storage.removeItem(key);\n}\n"],"mappings":";AASA,
|
|
1
|
+
{"version":3,"file":"databricksIntent.js","names":["UUID","readDatabricksIntent","raw","storage","key","value","canonical","left","right","item","encoded","prepareDatabricksIntent","bytes","input","fingerprint","byte","previous","intent","confirmDatabricksIntent","execution","clearConfirmedDatabricksIntent","clearWithdrawnDatabricksIntent","requestId"],"sources":["../../../src/cosmicintersection/lib/databricksIntent.ts"],"sourcesContent":["/** Durable product intent only: never stores credentials, names or job parameters. */\nexport interface DatabricksIntent {\n requestId: string;\n fingerprint: string;\n confirmedExecutionId?: string;\n}\n\ntype IntentStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;\n\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\nexport function readDatabricksIntent(storage: IntentStorage, key: string): DatabricksIntent | null {\n const raw = storage.getItem(key);\n if (raw === null) return null;\n let value: unknown;\n try {\n value = JSON.parse(raw);\n } catch {\n throw new Error('The saved Databricks request cannot be verified. Do not submit another job.');\n }\n if (\n !value ||\n typeof value !== 'object' ||\n !('requestId' in value) ||\n typeof value.requestId !== 'string' ||\n !UUID.test(value.requestId) ||\n !('fingerprint' in value) ||\n typeof value.fingerprint !== 'string' ||\n !/^[a-f0-9]{64}$/.test(value.fingerprint) ||\n ('confirmedExecutionId' in value &&\n (typeof value.confirmedExecutionId !== 'string' || !UUID.test(value.confirmedExecutionId)))\n ) {\n throw new Error('The saved Databricks request cannot be verified. Do not submit another job.');\n }\n return {\n requestId: value.requestId,\n fingerprint: value.fingerprint,\n ...('confirmedExecutionId' in value && typeof value.confirmedExecutionId === 'string'\n ? { confirmedExecutionId: value.confirmedExecutionId }\n : {}),\n };\n}\n\n/** Stable serialization makes reordered parameter keys the same intent. */\nfunction canonical(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`;\n if (value !== null && typeof value === 'object') {\n return `{${Object.entries(value)\n .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))\n .map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`)\n .join(',')}}`;\n }\n if (value === undefined || (typeof value === 'number' && !Number.isFinite(value)))\n throw new Error('Databricks request contains an unsupported value.');\n const encoded = JSON.stringify(value);\n if (encoded === undefined) throw new Error('Databricks request contains an unsupported value.');\n return encoded;\n}\n\nexport async function prepareDatabricksIntent(\n storage: IntentStorage,\n key: string,\n input: unknown\n): Promise<DatabricksIntent> {\n const bytes = new TextEncoder().encode(canonical(input));\n const fingerprint = Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256', bytes)))\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('');\n // Read after hashing so a preceding same-tab submission cannot be overwritten.\n const previous = readDatabricksIntent(storage, key);\n if (previous) {\n if (previous.fingerprint !== fingerprint) {\n throw new Error(\n 'A previous request is unresolved. Restore its exact inputs and retry or inspect its status.'\n );\n }\n return previous;\n }\n const intent = { requestId: crypto.randomUUID(), fingerprint };\n // A failed persistence write must prevent the network request entirely.\n storage.setItem(key, JSON.stringify(intent));\n return intent;\n}\n\nexport function confirmDatabricksIntent(\n storage: IntentStorage,\n key: string,\n execution: { requestId: string; id: string }\n): boolean {\n const intent = readDatabricksIntent(storage, key);\n if (!intent || intent.requestId !== execution.requestId) return false;\n if (!UUID.test(execution.id)) throw new Error('The confirmed execution ID is invalid.');\n storage.setItem(key, JSON.stringify({ ...intent, confirmedExecutionId: execution.id }));\n return true;\n}\n\n/** Explicit \"another job\" only after the server returned this exact intent. */\nexport function clearConfirmedDatabricksIntent(storage: IntentStorage, key: string): void {\n const intent = readDatabricksIntent(storage, key);\n if (!intent?.confirmedExecutionId) {\n throw new Error('Refresh the existing request status before queuing another job.');\n }\n storage.removeItem(key);\n}\n\n/** Called only after the service durably fenced this exact absent request UUID. */\nexport function clearWithdrawnDatabricksIntent(\n storage: IntentStorage,\n key: string,\n requestId: string\n): void {\n const intent = readDatabricksIntent(storage, key);\n if (!intent || intent.requestId !== requestId || intent.confirmedExecutionId) {\n throw new Error('The acknowledged withdrawal does not match the unresolved saved request.');\n }\n storage.removeItem(key);\n}\n"],"mappings":";AASA,IAAMA,IAAO;AAEb,SAAgBC,EAAqB,GAAwB,GAAsC;CACjG,IAAMC,IAAMC,EAAQ,QAAQC,CAAG;CAC/B,IAAIF,MAAQ,MAAM,OAAO;CACzB,IAAIG;CACJ,IAAI;EACF,IAAQ,KAAK,MAAMH,CAAG;CACxB,QAAQ;EACN,MAAU,MAAM,6EAA6E;CAC/F;CACA,IACE,CAACG,KACD,OAAOA,KAAU,YACjB,EAAE,eAAeA,MACjB,OAAOA,EAAM,aAAc,YAC3B,CAACL,EAAK,KAAKK,EAAM,SAAS,KAC1B,EAAE,iBAAiBA,MACnB,OAAOA,EAAM,eAAgB,YAC7B,CAAC,iBAAiB,KAAKA,E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AAIY,GAAU;EACZ,IAAIA,EAAS,gBAAgBF,GAC3B,MAAU,MACR,6FACF;EAEF,OAAOE;CACT;CACA,IAAMC,IAAS;EAAE,WAAW,OAAO,WAAW;EAAG;CAAY;CAG7D,OADAd,EAAQ,QAAQC,GAAK,KAAK,UAAUa,CAAM,CAAC,GACpCA;AACT;AAEA,SAAgBC,EACd,GACA,GACA,GACS;CACT,IAAMD,IAAShB,EAAqBE,GAASC,CAAG;CAChD,IAAI,CAACa,KAAUA,EAAO,cAAcE,EAAU,WAAW,OAAO;CAChE,IAAI,CAACnB,EAAK,KAAKmB,EAAU,EAAE,GAAG,MAAU,MAAM,wCAAwC;CAEtF,OADAhB,EAAQ,QAAQC,GAAK,KAAK,UAAU;EAAE,GAAGa;EAAQ,sBAAsBE,EAAU;CAAG,CAAC,CAAC,GAC/E;AACT;AAGA,SAAgBC,EAA+B,GAAwB,GAAmB;CAExF,IAAI,CADWnB,EAAqBE,GAASC,CACxC,CAAA,EAAQ,sBACX,MAAU,MAAM,iEAAiE;CAEnF,EAAQ,WAAWA,CAAG;AACxB;AAGA,SAAgBiB,EACd,GACA,GACA,GACM;CACN,IAAMJ,IAAShB,EAAqBE,GAASC,CAAG;CAChD,IAAI,CAACa,KAAUA,EAAO,cAAcK,KAAaL,EAAO,sBACtD,MAAU,MAAM,0EAA0E;CAE5F,EAAQ,WAAWb,CAAG;AACxB"}
|
|
@@ -2,4 +2,3 @@ import { DatabricksRequestScope } from '../api/databricksTransport';
|
|
|
2
2
|
/** No bearer or job parameters enter the durable product-intent key. */
|
|
3
3
|
export declare function databricksIntentKey(scope: DatabricksRequestScope, runId: string): string;
|
|
4
4
|
export declare function safeLogsUrl(value: string | null | undefined): string | null;
|
|
5
|
-
//# sourceMappingURL=databricksPresentation.d.ts.map
|