@everysk/apps-sdk 0.2.0 → 0.3.0-beta-20261016180126
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/README.md +298 -12
- package/dist/EveryskApp.d.ts +34 -2
- package/dist/EveryskApp.d.ts.map +1 -1
- package/dist/EveryskApp.js +35 -2
- package/dist/EveryskApp.js.map +1 -1
- package/dist/agGrid/handleRowsScrollEnd.d.ts +53 -0
- package/dist/agGrid/handleRowsScrollEnd.d.ts.map +1 -0
- package/dist/agGrid/handleRowsScrollEnd.js +47 -0
- package/dist/agGrid/handleRowsScrollEnd.js.map +1 -0
- package/dist/agGrid/index.d.ts +2 -0
- package/dist/agGrid/index.d.ts.map +1 -1
- package/dist/agGrid/index.js +2 -1
- package/dist/api/datastore.d.ts +10 -8
- package/dist/api/datastore.d.ts.map +1 -1
- package/dist/api/datastore.js +24 -55
- package/dist/api/datastore.js.map +1 -1
- package/dist/api/entityQuery.d.ts +46 -41
- package/dist/api/entityQuery.d.ts.map +1 -1
- package/dist/api/entityQuery.js +55 -14
- package/dist/api/entityQuery.js.map +1 -1
- package/dist/api/file.d.ts +26 -9
- package/dist/api/file.d.ts.map +1 -1
- package/dist/api/file.js +45 -55
- package/dist/api/file.js.map +1 -1
- package/dist/api/portfolio.d.ts +11 -8
- package/dist/api/portfolio.d.ts.map +1 -1
- package/dist/api/portfolio.js +24 -55
- package/dist/api/portfolio.js.map +1 -1
- package/dist/api/profile.d.ts +3 -2
- package/dist/api/profile.d.ts.map +1 -1
- package/dist/api/profile.js +4 -9
- package/dist/api/profile.js.map +1 -1
- package/dist/api/request.d.ts +106 -0
- package/dist/api/request.d.ts.map +1 -0
- package/dist/api/request.js +132 -0
- package/dist/api/request.js.map +1 -0
- package/dist/api/websocketsConfig.d.ts +7 -2
- package/dist/api/websocketsConfig.d.ts.map +1 -1
- package/dist/api/websocketsConfig.js +2 -10
- package/dist/api/websocketsConfig.js.map +1 -1
- package/dist/api/workflow.d.ts +84 -89
- package/dist/api/workflow.d.ts.map +1 -1
- package/dist/api/workflow.js +121 -208
- package/dist/api/workflow.js.map +1 -1
- package/dist/api/workspace.d.ts +18 -8
- package/dist/api/workspace.d.ts.map +1 -1
- package/dist/api/workspace.js +21 -26
- package/dist/api/workspace.js.map +1 -1
- package/dist/components/ui/Footer/index.d.ts.map +1 -1
- package/dist/components/ui/Footer/index.js.map +1 -1
- package/dist/components/ui/GlobalLoading/index.d.ts.map +1 -1
- package/dist/components/ui/GlobalLoading/index.js.map +1 -1
- package/dist/components/ui/PageContainer/index.d.ts +1 -1
- package/dist/components/ui/PageContainer/index.d.ts.map +1 -1
- package/dist/components/ui/PageContainer/index.js.map +1 -1
- package/dist/components/ui/Toolbar/index.d.ts +40 -3
- package/dist/components/ui/Toolbar/index.d.ts.map +1 -1
- package/dist/components/ui/Toolbar/index.js +42 -15
- package/dist/components/ui/Toolbar/index.js.map +1 -1
- package/dist/contexts/appAlertContext/provider.js.map +1 -1
- package/dist/contexts/appAlertContext/types.d.ts.map +1 -1
- package/dist/contexts/appConfigContext/index.d.ts.map +1 -1
- package/dist/contexts/appConfigContext/index.js.map +1 -1
- package/dist/contexts/appConfigContext/provider.d.ts.map +1 -1
- package/dist/contexts/appConfigContext/provider.js.map +1 -1
- package/dist/contexts/webSocketContext/handler.d.ts +3 -2
- package/dist/contexts/webSocketContext/handler.d.ts.map +1 -1
- package/dist/contexts/webSocketContext/handler.js.map +1 -1
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.d.ts +1 -1
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.js +1 -1
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.js.map +1 -1
- package/dist/contexts/webSocketContext/provider.d.ts +6 -3
- package/dist/contexts/webSocketContext/provider.d.ts.map +1 -1
- package/dist/contexts/webSocketContext/provider.js +42 -7
- package/dist/contexts/webSocketContext/provider.js.map +1 -1
- package/dist/contexts/webSocketContext/types.d.ts +7 -5
- package/dist/contexts/webSocketContext/types.d.ts.map +1 -1
- package/dist/file/index.d.ts +2 -0
- package/dist/file/index.d.ts.map +1 -1
- package/dist/hooks/datastore/useDatastoreMutations.d.ts +4 -4
- package/dist/hooks/datastore/useDatastoreMutations.d.ts.map +1 -1
- package/dist/hooks/datastore/useDatastoreMutations.js +17 -55
- package/dist/hooks/datastore/useDatastoreMutations.js.map +1 -1
- package/dist/hooks/datastore/useFetchDatastore.d.ts +30 -41
- package/dist/hooks/datastore/useFetchDatastore.d.ts.map +1 -1
- package/dist/hooks/datastore/useFetchDatastore.js +25 -59
- package/dist/hooks/datastore/useFetchDatastore.js.map +1 -1
- package/dist/hooks/datastore/useFetchDatastores.d.ts +47 -52
- package/dist/hooks/datastore/useFetchDatastores.d.ts.map +1 -1
- package/dist/hooks/datastore/useFetchDatastores.js +55 -70
- package/dist/hooks/datastore/useFetchDatastores.js.map +1 -1
- package/dist/hooks/file/fileData.d.ts +17 -0
- package/dist/hooks/file/fileData.d.ts.map +1 -0
- package/dist/hooks/file/fileData.js +10 -0
- package/dist/hooks/file/fileData.js.map +1 -0
- package/dist/hooks/file/useFetchFile.d.ts +38 -58
- package/dist/hooks/file/useFetchFile.d.ts.map +1 -1
- package/dist/hooks/file/useFetchFile.js +26 -66
- package/dist/hooks/file/useFetchFile.js.map +1 -1
- package/dist/hooks/file/useFetchFiles.d.ts +18 -52
- package/dist/hooks/file/useFetchFiles.d.ts.map +1 -1
- package/dist/hooks/file/useFetchFiles.js +53 -69
- package/dist/hooks/file/useFetchFiles.js.map +1 -1
- package/dist/hooks/file/useFileMutations.d.ts +9 -8
- package/dist/hooks/file/useFileMutations.d.ts.map +1 -1
- package/dist/hooks/file/useFileMutations.js +23 -60
- package/dist/hooks/file/useFileMutations.js.map +1 -1
- package/dist/hooks/portfolio/useFetchPortfolio.d.ts +16 -50
- package/dist/hooks/portfolio/useFetchPortfolio.d.ts.map +1 -1
- package/dist/hooks/portfolio/useFetchPortfolio.js +15 -63
- package/dist/hooks/portfolio/useFetchPortfolio.js.map +1 -1
- package/dist/hooks/portfolio/useFetchPortfolios.d.ts +13 -52
- package/dist/hooks/portfolio/useFetchPortfolios.d.ts.map +1 -1
- package/dist/hooks/portfolio/useFetchPortfolios.js +29 -71
- package/dist/hooks/portfolio/useFetchPortfolios.js.map +1 -1
- package/dist/hooks/portfolio/usePortfolioMutations.d.ts +8 -8
- package/dist/hooks/portfolio/usePortfolioMutations.d.ts.map +1 -1
- package/dist/hooks/portfolio/usePortfolioMutations.js +20 -58
- package/dist/hooks/portfolio/usePortfolioMutations.js.map +1 -1
- package/dist/hooks/profile/useFetchProfile.d.ts +18 -44
- package/dist/hooks/profile/useFetchProfile.d.ts.map +1 -1
- package/dist/hooks/profile/useFetchProfile.js +16 -48
- package/dist/hooks/profile/useFetchProfile.js.map +1 -1
- package/dist/hooks/useAxios.js.map +1 -1
- package/dist/hooks/useEntityInfiniteQuery.d.ts +88 -0
- package/dist/hooks/useEntityInfiniteQuery.d.ts.map +1 -0
- package/dist/hooks/useEntityInfiniteQuery.js +111 -0
- package/dist/hooks/useEntityInfiniteQuery.js.map +1 -0
- package/dist/hooks/useEntityMutation.d.ts +47 -0
- package/dist/hooks/useEntityMutation.d.ts.map +1 -0
- package/dist/hooks/useEntityMutation.js +58 -0
- package/dist/hooks/useEntityMutation.js.map +1 -0
- package/dist/hooks/useEntityQuery.d.ts +68 -0
- package/dist/hooks/useEntityQuery.d.ts.map +1 -0
- package/dist/hooks/useEntityQuery.js +75 -0
- package/dist/hooks/useEntityQuery.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkerExecution.d.ts +17 -34
- package/dist/hooks/workflow/useFetchWorkerExecution.d.ts.map +1 -1
- package/dist/hooks/workflow/useFetchWorkerExecution.js +16 -46
- package/dist/hooks/workflow/useFetchWorkerExecution.js.map +1 -1
- package/dist/hooks/workflow/useFetchWorkerExecutions.d.ts +179 -41
- package/dist/hooks/workflow/useFetchWorkerExecutions.d.ts.map +1 -1
- package/dist/hooks/workflow/useFetchWorkerExecutions.js +29 -62
- package/dist/hooks/workflow/useFetchWorkerExecutions.js.map +1 -1
- package/dist/hooks/workflow/useFetchWorkflow.d.ts +16 -35
- package/dist/hooks/workflow/useFetchWorkflow.d.ts.map +1 -1
- package/dist/hooks/workflow/useFetchWorkflow.js +15 -48
- package/dist/hooks/workflow/useFetchWorkflow.js.map +1 -1
- package/dist/hooks/workflow/useFetchWorkflowExecution.d.ts +17 -34
- package/dist/hooks/workflow/useFetchWorkflowExecution.d.ts.map +1 -1
- package/dist/hooks/workflow/useFetchWorkflowExecution.js +16 -46
- package/dist/hooks/workflow/useFetchWorkflowExecution.js.map +1 -1
- package/dist/hooks/workflow/useFetchWorkflowExecutions.d.ts +22 -36
- package/dist/hooks/workflow/useFetchWorkflowExecutions.d.ts.map +1 -1
- package/dist/hooks/workflow/useFetchWorkflowExecutions.js +43 -56
- package/dist/hooks/workflow/useFetchWorkflowExecutions.js.map +1 -1
- package/dist/hooks/workflow/useFetchWorkflows.d.ts +20 -37
- package/dist/hooks/workflow/useFetchWorkflows.d.ts.map +1 -1
- package/dist/hooks/workflow/useFetchWorkflows.js +32 -47
- package/dist/hooks/workflow/useFetchWorkflows.js.map +1 -1
- package/dist/hooks/workflow/useRunWorkflow.d.ts +21 -16
- package/dist/hooks/workflow/useRunWorkflow.d.ts.map +1 -1
- package/dist/hooks/workflow/useRunWorkflow.js +66 -29
- package/dist/hooks/workflow/useRunWorkflow.js.map +1 -1
- package/dist/hooks/workflow/useTriggerWorkflow.d.ts +20 -0
- package/dist/hooks/workflow/useTriggerWorkflow.d.ts.map +1 -0
- package/dist/hooks/workflow/useTriggerWorkflow.js +32 -0
- package/dist/hooks/workflow/useTriggerWorkflow.js.map +1 -0
- package/dist/hooks/workspace/useFetchWorkspace.d.ts +19 -34
- package/dist/hooks/workspace/useFetchWorkspace.d.ts.map +1 -1
- package/dist/hooks/workspace/useFetchWorkspace.js +16 -46
- package/dist/hooks/workspace/useFetchWorkspace.js.map +1 -1
- package/dist/hooks/workspace/useFetchWorkspaces.d.ts +17 -37
- package/dist/hooks/workspace/useFetchWorkspaces.d.ts.map +1 -1
- package/dist/hooks/workspace/useFetchWorkspaces.js +25 -47
- package/dist/hooks/workspace/useFetchWorkspaces.js.map +1 -1
- package/dist/index.d.ts +13 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -11
- package/dist/lib/abort.d.ts +58 -0
- package/dist/lib/abort.d.ts.map +1 -0
- package/dist/lib/abort.js +112 -0
- package/dist/lib/abort.js.map +1 -0
- package/dist/lib/datastoreTable.d.ts +59 -54
- package/dist/lib/datastoreTable.d.ts.map +1 -1
- package/dist/lib/datastoreTable.js +58 -62
- package/dist/lib/datastoreTable.js.map +1 -1
- package/dist/lib/file.d.ts +34 -0
- package/dist/lib/file.d.ts.map +1 -0
- package/dist/lib/file.js +63 -0
- package/dist/lib/file.js.map +1 -0
- package/dist/lib/queryClient.d.ts.map +1 -1
- package/dist/lib/queryClient.js.map +1 -1
- package/dist/lib/workflowRun.d.ts +91 -0
- package/dist/lib/workflowRun.d.ts.map +1 -0
- package/dist/lib/workflowRun.js +224 -0
- package/dist/lib/workflowRun.js.map +1 -0
- package/dist/socket/index.d.ts +1 -3
- package/dist/socket/index.d.ts.map +1 -1
- package/dist/socket/index.js +3 -5
- package/dist/test/mocks/index.d.ts +1 -1
- package/dist/test/mocks/index.d.ts.map +1 -1
- package/dist/test/renderWithProviders.d.ts +2 -2
- package/dist/test/renderWithProviders.d.ts.map +1 -1
- package/dist/test/renderWithProviders.js.map +1 -1
- package/dist/test/setup.js.map +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/overrides/index.d.ts +4 -2
- package/dist/theme/overrides/index.d.ts.map +1 -1
- package/dist/theme/overrides/index.js +5 -3
- package/dist/theme/overrides/index.js.map +1 -1
- package/dist/theme/overrides/muiButton.d.ts +2 -2
- package/dist/theme/overrides/muiButton.js.map +1 -1
- package/dist/theme/overrides/muiCssBaseline.d.ts.map +1 -1
- package/dist/theme/overrides/muiCssBaseline.js.map +1 -1
- package/dist/theme/overrides/muiDatePicker.js.map +1 -1
- package/dist/theme/overrides/muiFormControl.js.map +1 -1
- package/dist/theme/overrides/muiIconButton.d.ts +2 -2
- package/dist/theme/overrides/muiIconButton.js.map +1 -1
- package/dist/theme/overrides/muiSelect.d.ts.map +1 -1
- package/dist/theme/overrides/muiSelect.js.map +1 -1
- package/dist/theme/overrides/muiSvgIcon.d.ts.map +1 -1
- package/dist/theme/overrides/muiSvgIcon.js.map +1 -1
- package/dist/theme/overrides/muiTextField.js.map +1 -1
- package/dist/theme/overrides/muiToggleButton.d.ts +2 -2
- package/dist/theme/overrides/muiToggleButton.js.map +1 -1
- package/dist/theme/overrides/muiToggleButtonGroup.d.ts +2 -2
- package/dist/theme/overrides/muiToggleButtonGroup.js.map +1 -1
- package/dist/theme/themes/DefaultDark.js +2 -2
- package/dist/theme/themes/DefaultDark.js.map +1 -1
- package/dist/theme/themes/DefaultLight.js +2 -2
- package/dist/theme/themes/DefaultLight.js.map +1 -1
- package/dist/theme/themes/EveryskDark.js +2 -2
- package/dist/theme/themes/EveryskDark.js.map +1 -1
- package/dist/theme/themes/EveryskLight.js +2 -2
- package/dist/theme/themes/EveryskLight.js.map +1 -1
- package/dist/theme/themes/MidnightEmber.js +2 -2
- package/dist/theme/themes/MidnightEmber.js.map +1 -1
- package/dist/types/anyRecord.d.ts.map +1 -1
- package/dist/types/datastore.d.ts +35 -5
- package/dist/types/datastore.d.ts.map +1 -1
- package/dist/types/datastoreDataFormat.d.ts +13 -0
- package/dist/types/datastoreDataFormat.d.ts.map +1 -0
- package/dist/types/entityQuery.d.ts +86 -16
- package/dist/types/entityQuery.d.ts.map +1 -1
- package/dist/types/file.d.ts +7 -3
- package/dist/types/file.d.ts.map +1 -1
- package/dist/types/portfolio.d.ts +1 -3
- package/dist/types/portfolio.d.ts.map +1 -1
- package/dist/types/profile.d.ts +0 -10
- package/dist/types/profile.d.ts.map +1 -1
- package/dist/types/workflow.d.ts +35 -6
- package/dist/types/workflow.d.ts.map +1 -1
- package/dist/types/workspace.d.ts +1 -2
- package/dist/types/workspace.d.ts.map +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/workflow/index.d.ts +2 -0
- package/dist/workflow/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/EveryskApp.tsx +53 -2
- package/src/agGrid/handleRowsScrollEnd.ts +71 -0
- package/src/agGrid/index.ts +5 -1
- package/src/api/datastore.ts +79 -107
- package/src/api/entityQuery.ts +86 -17
- package/src/api/file.ts +110 -103
- package/src/api/portfolio.ts +82 -125
- package/src/api/profile.ts +25 -18
- package/src/api/request.ts +168 -0
- package/src/api/websocketsConfig.ts +11 -19
- package/src/api/workflow.ts +232 -334
- package/src/api/workspace.ts +43 -43
- package/src/components/ui/Footer/index.tsx +8 -7
- package/src/components/ui/GlobalLoading/index.tsx +13 -3
- package/src/components/ui/PageContainer/index.tsx +9 -2
- package/src/components/ui/Toolbar/index.tsx +105 -30
- package/src/contexts/appAlertContext/provider.tsx +1 -1
- package/src/contexts/appAlertContext/types.ts +3 -3
- package/src/contexts/appConfigContext/index.tsx +1 -1
- package/src/contexts/appConfigContext/provider.tsx +1 -5
- package/src/contexts/webSocketContext/handler.ts +8 -2
- package/src/contexts/webSocketContext/hooks/useWebSocket/index.ts +1 -1
- package/src/contexts/webSocketContext/provider.tsx +64 -14
- package/src/contexts/webSocketContext/types.ts +7 -6
- package/src/file/index.ts +2 -0
- package/src/hooks/datastore/useDatastoreMutations.ts +19 -60
- package/src/hooks/datastore/useFetchDatastore.ts +45 -73
- package/src/hooks/datastore/useFetchDatastores.ts +106 -131
- package/src/hooks/file/fileData.ts +19 -0
- package/src/hooks/file/useFetchFile.ts +41 -76
- package/src/hooks/file/useFetchFiles.ts +92 -87
- package/src/hooks/file/useFileMutations.ts +23 -73
- package/src/hooks/portfolio/useFetchPortfolio.ts +26 -78
- package/src/hooks/portfolio/useFetchPortfolios.ts +50 -93
- package/src/hooks/portfolio/usePortfolioMutations.ts +22 -72
- package/src/hooks/profile/useFetchProfile.ts +24 -65
- package/src/hooks/useAxios.ts +5 -5
- package/src/hooks/useEntityInfiniteQuery.ts +193 -0
- package/src/hooks/useEntityMutation.ts +70 -0
- package/src/hooks/useEntityQuery.ts +117 -0
- package/src/hooks/workflow/useFetchWorkerExecution.ts +27 -56
- package/src/hooks/workflow/useFetchWorkerExecutions.ts +54 -79
- package/src/hooks/workflow/useFetchWorkflow.ts +24 -58
- package/src/hooks/workflow/useFetchWorkflowExecution.ts +27 -57
- package/src/hooks/workflow/useFetchWorkflowExecutions.ts +64 -73
- package/src/hooks/workflow/useFetchWorkflows.ts +48 -64
- package/src/hooks/workflow/useRunWorkflow.ts +82 -36
- package/src/hooks/workflow/useTriggerWorkflow.ts +36 -0
- package/src/hooks/workspace/useFetchWorkspace.ts +25 -58
- package/src/hooks/workspace/useFetchWorkspaces.ts +38 -69
- package/src/index.ts +34 -19
- package/src/lib/abort.ts +131 -0
- package/src/lib/datastoreTable.ts +127 -74
- package/src/lib/file.ts +67 -0
- package/src/lib/queryClient.ts +11 -13
- package/src/lib/workflowRun.ts +329 -0
- package/src/socket/index.ts +1 -3
- package/src/test/mocks/index.ts +1 -5
- package/src/test/renderWithProviders.tsx +8 -3
- package/src/test/setup.ts +16 -16
- package/src/theme/index.ts +1 -1
- package/src/theme/overrides/index.ts +5 -3
- package/src/theme/overrides/muiButton.ts +3 -3
- package/src/theme/overrides/muiCssBaseline.ts +11 -12
- package/src/theme/overrides/muiDatePicker.ts +2 -2
- package/src/theme/overrides/muiFormControl.ts +2 -2
- package/src/theme/overrides/muiIconButton.ts +3 -3
- package/src/theme/overrides/muiSelect.ts +2 -2
- package/src/theme/overrides/muiSvgIcon.ts +2 -2
- package/src/theme/overrides/muiTextField.ts +1 -1
- package/src/theme/overrides/muiToggleButton.ts +4 -4
- package/src/theme/overrides/muiToggleButtonGroup.ts +4 -4
- package/src/theme/themes/DefaultDark.ts +2 -2
- package/src/theme/themes/DefaultLight.ts +2 -2
- package/src/theme/themes/EveryskDark.ts +2 -2
- package/src/theme/themes/EveryskLight.ts +2 -2
- package/src/theme/themes/MidnightEmber.ts +15 -15
- package/src/types/anyRecord.ts +2 -2
- package/src/types/datastore.ts +56 -22
- package/src/types/datastoreDataFormat.ts +12 -0
- package/src/types/entityQuery.ts +122 -38
- package/src/types/file.ts +8 -6
- package/src/types/portfolio.ts +70 -74
- package/src/types/profile.ts +0 -11
- package/src/types/workflow.ts +38 -9
- package/src/types/workspace.ts +2 -4
- package/src/ui/index.ts +1 -1
- package/src/workflow/index.ts +5 -0
|
@@ -1,40 +1,23 @@
|
|
|
1
1
|
import type { WorkflowExecution } from "../../types/workflow.d.ts";
|
|
2
|
-
import type {
|
|
3
|
-
export type FetchWorkflowExecutionProps<TData = WorkflowExecution, TSelected = TData> = {
|
|
2
|
+
import type { FetchEntityProps } from "../../types/entityQuery.d.ts";
|
|
3
|
+
export type FetchWorkflowExecutionProps<TData = WorkflowExecution, TSelected = TData> = FetchEntityProps<TData, TSelected> & {
|
|
4
4
|
workflowId: string;
|
|
5
5
|
workflowExecutionId: string;
|
|
6
6
|
workspace: string;
|
|
7
|
-
queryOptions?: EntityQueryOptions<TData, TSelected>;
|
|
8
7
|
};
|
|
9
8
|
/**
|
|
10
9
|
* useFetchWorkflowExecution
|
|
11
10
|
*
|
|
12
|
-
*
|
|
11
|
+
* Fetches one execution of a workflow; `data` is the execution, or whatever `select` makes of
|
|
12
|
+
* it. Idle while an id is empty; fails loudly, without a request, while `workspace` is. A failure is shown as an error alert.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @param workflowId - Workflow identifier the execution belongs to (required).
|
|
19
|
-
* @param workflowExecutionId - Workflow execution identifier (required).
|
|
20
|
-
* @param workspace - Workspace the workflow belongs to (required).
|
|
21
|
-
* @param queryOptions - TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
22
|
-
*
|
|
23
|
-
* @returns TanStack Query result extended with `queryKey`.
|
|
24
|
-
*
|
|
25
|
-
* Example:
|
|
26
|
-
* ```ts
|
|
27
|
-
* const { data, isLoading } = useFetchWorkflowExecution({
|
|
28
|
-
* workflowId: "wf-123",
|
|
29
|
-
* workflowExecutionId: "exec-456",
|
|
30
|
-
* workspace: "main",
|
|
31
|
-
* });
|
|
32
|
-
* // data -> WorkflowExecution
|
|
33
|
-
* ```
|
|
14
|
+
* @param {FetchWorkflowExecutionProps} props - `workflowId`, `workflowExecutionId`, `workspace`,
|
|
15
|
+
* `select` and TanStack `queryOptions`.
|
|
16
|
+
* @returns {object} The `useQuery` result, plus `queryKey`.
|
|
34
17
|
*/
|
|
35
|
-
export declare const useFetchWorkflowExecution: ({ workflowId, workflowExecutionId, workspace, queryOptions }: FetchWorkflowExecutionProps) => {
|
|
18
|
+
export declare const useFetchWorkflowExecution: <TSelected = WorkflowExecution>({ workflowId, workflowExecutionId, workspace, select, queryOptions, }: FetchWorkflowExecutionProps<WorkflowExecution, TSelected>) => {
|
|
36
19
|
queryKey: string[];
|
|
37
|
-
data:
|
|
20
|
+
data: TSelected;
|
|
38
21
|
error: Error;
|
|
39
22
|
isError: true;
|
|
40
23
|
isPending: false;
|
|
@@ -57,11 +40,11 @@ export declare const useFetchWorkflowExecution: ({ workflowId, workflowExecution
|
|
|
57
40
|
isRefetching: boolean;
|
|
58
41
|
isStale: boolean;
|
|
59
42
|
isEnabled: boolean;
|
|
60
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
43
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
61
44
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
62
45
|
} | {
|
|
63
46
|
queryKey: string[];
|
|
64
|
-
data:
|
|
47
|
+
data: TSelected;
|
|
65
48
|
error: null;
|
|
66
49
|
isError: false;
|
|
67
50
|
isPending: false;
|
|
@@ -84,7 +67,7 @@ export declare const useFetchWorkflowExecution: ({ workflowId, workflowExecution
|
|
|
84
67
|
isRefetching: boolean;
|
|
85
68
|
isStale: boolean;
|
|
86
69
|
isEnabled: boolean;
|
|
87
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
70
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
88
71
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
89
72
|
} | {
|
|
90
73
|
queryKey: string[];
|
|
@@ -111,7 +94,7 @@ export declare const useFetchWorkflowExecution: ({ workflowId, workflowExecution
|
|
|
111
94
|
isRefetching: boolean;
|
|
112
95
|
isStale: boolean;
|
|
113
96
|
isEnabled: boolean;
|
|
114
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
97
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
115
98
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
116
99
|
} | {
|
|
117
100
|
queryKey: string[];
|
|
@@ -138,7 +121,7 @@ export declare const useFetchWorkflowExecution: ({ workflowId, workflowExecution
|
|
|
138
121
|
isRefetching: boolean;
|
|
139
122
|
isStale: boolean;
|
|
140
123
|
isEnabled: boolean;
|
|
141
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
124
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
142
125
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
143
126
|
} | {
|
|
144
127
|
queryKey: string[];
|
|
@@ -165,11 +148,11 @@ export declare const useFetchWorkflowExecution: ({ workflowId, workflowExecution
|
|
|
165
148
|
isRefetching: boolean;
|
|
166
149
|
isStale: boolean;
|
|
167
150
|
isEnabled: boolean;
|
|
168
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
151
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
169
152
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
170
153
|
} | {
|
|
171
154
|
queryKey: string[];
|
|
172
|
-
data:
|
|
155
|
+
data: TSelected;
|
|
173
156
|
isError: false;
|
|
174
157
|
error: null;
|
|
175
158
|
isPending: false;
|
|
@@ -192,7 +175,7 @@ export declare const useFetchWorkflowExecution: ({ workflowId, workflowExecution
|
|
|
192
175
|
isRefetching: boolean;
|
|
193
176
|
isStale: boolean;
|
|
194
177
|
isEnabled: boolean;
|
|
195
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
178
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
196
179
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
197
180
|
};
|
|
198
181
|
//# sourceMappingURL=useFetchWorkflowExecution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchWorkflowExecution.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflow/useFetchWorkflowExecution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFetchWorkflowExecution.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflow/useFetchWorkflowExecution.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,MAAM,2BAA2B,CACnC,KAAK,GAAG,iBAAiB,EACzB,SAAS,GAAG,KAAK,IACjB,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,GAAG,iBAAiB,EAAE,uEAMtE,2BAA2B,CAAC,iBAAiB,EAAE,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgB3D,CAAC"}
|
|
@@ -1,65 +1,35 @@
|
|
|
1
|
-
import { useAppAlert } from "../../contexts/appAlertContext/useAppAlert.js";
|
|
2
1
|
import { useAxios } from "../useAxios.js";
|
|
2
|
+
import { useEntityQuery } from "../useEntityQuery.js";
|
|
3
|
+
import { missingWorkspaceError } from "../../api/entityQuery.js";
|
|
3
4
|
import { getWorkflowExecution } from "../../api/workflow.js";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
import { useQuery } from "@tanstack/react-query";
|
|
6
5
|
//#region src/hooks/workflow/useFetchWorkflowExecution.ts
|
|
7
|
-
var defaultQueryOptions = {
|
|
8
|
-
refetchOnMount: "always",
|
|
9
|
-
staleTime: 0,
|
|
10
|
-
gcTime: 0
|
|
11
|
-
};
|
|
12
6
|
/**
|
|
13
7
|
* useFetchWorkflowExecution
|
|
14
8
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* It also:
|
|
18
|
-
* - builds a stable React Query `queryKey` that can be reused by mutation hooks for cache invalidation
|
|
19
|
-
* - triggers an error alert via `useAppAlert` whenever `query.error` is present
|
|
20
|
-
*
|
|
21
|
-
* @param workflowId - Workflow identifier the execution belongs to (required).
|
|
22
|
-
* @param workflowExecutionId - Workflow execution identifier (required).
|
|
23
|
-
* @param workspace - Workspace the workflow belongs to (required).
|
|
24
|
-
* @param queryOptions - TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
25
|
-
*
|
|
26
|
-
* @returns TanStack Query result extended with `queryKey`.
|
|
9
|
+
* Fetches one execution of a workflow; `data` is the execution, or whatever `select` makes of
|
|
10
|
+
* it. Idle while an id is empty; fails loudly, without a request, while `workspace` is. A failure is shown as an error alert.
|
|
27
11
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* workflowId: "wf-123",
|
|
32
|
-
* workflowExecutionId: "exec-456",
|
|
33
|
-
* workspace: "main",
|
|
34
|
-
* });
|
|
35
|
-
* // data -> WorkflowExecution
|
|
36
|
-
* ```
|
|
12
|
+
* @param {FetchWorkflowExecutionProps} props - `workflowId`, `workflowExecutionId`, `workspace`,
|
|
13
|
+
* `select` and TanStack `queryOptions`.
|
|
14
|
+
* @returns {object} The `useQuery` result, plus `queryKey`.
|
|
37
15
|
*/
|
|
38
|
-
var useFetchWorkflowExecution = ({ workflowId, workflowExecutionId, workspace, queryOptions
|
|
16
|
+
var useFetchWorkflowExecution = ({ workflowId, workflowExecutionId, workspace, select, queryOptions }) => {
|
|
39
17
|
const { api } = useAxios();
|
|
40
|
-
const { showAlert } = useAppAlert();
|
|
41
18
|
const queryKey = [
|
|
42
19
|
"workflow_execution",
|
|
43
20
|
workflowId,
|
|
44
21
|
workflowExecutionId,
|
|
45
22
|
workspace
|
|
46
23
|
];
|
|
47
|
-
const query = useQuery({
|
|
48
|
-
queryKey,
|
|
49
|
-
queryFn: async () => {
|
|
50
|
-
return await getWorkflowExecution(api, workflowId, workflowExecutionId, workspace);
|
|
51
|
-
},
|
|
52
|
-
...queryOptions ?? {}
|
|
53
|
-
});
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (!query.error) return;
|
|
56
|
-
showAlert({
|
|
57
|
-
severity: "error",
|
|
58
|
-
message: query.error.message
|
|
59
|
-
});
|
|
60
|
-
}, [query.error, showAlert]);
|
|
61
24
|
return {
|
|
62
|
-
...
|
|
25
|
+
...useEntityQuery({
|
|
26
|
+
queryKey,
|
|
27
|
+
fetchEntity: (signal) => getWorkflowExecution(api, workflowId, workflowExecutionId, workspace, signal),
|
|
28
|
+
select,
|
|
29
|
+
enabled: Boolean(workflowId) && Boolean(workflowExecutionId),
|
|
30
|
+
configError: workspace ? void 0 : missingWorkspaceError("useFetchWorkflowExecution"),
|
|
31
|
+
queryOptions
|
|
32
|
+
}),
|
|
63
33
|
queryKey
|
|
64
34
|
};
|
|
65
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchWorkflowExecution.js","names":[],"sources":["../../../src/hooks/workflow/useFetchWorkflowExecution.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useFetchWorkflowExecution.js","names":[],"sources":["../../../src/hooks/workflow/useFetchWorkflowExecution.ts"],"sourcesContent":["import { useAxios } from \"@/hooks/useAxios\";\nimport { useEntityQuery } from \"@/hooks/useEntityQuery\";\nimport { missingWorkspaceError } from \"@/api/entityQuery\";\nimport { getWorkflowExecution } from \"@/api/workflow\";\nimport type { WorkflowExecution } from \"@/types/workflow\";\nimport type { FetchEntityProps } from \"@/types/entityQuery\";\n\nexport type FetchWorkflowExecutionProps<\n TData = WorkflowExecution,\n TSelected = TData,\n> = FetchEntityProps<TData, TSelected> & {\n workflowId: string;\n workflowExecutionId: string;\n workspace: string;\n};\n\n/**\n * useFetchWorkflowExecution\n *\n * Fetches one execution of a workflow; `data` is the execution, or whatever `select` makes of\n * it. Idle while an id is empty; fails loudly, without a request, while `workspace` is. A failure is shown as an error alert.\n *\n * @param {FetchWorkflowExecutionProps} props - `workflowId`, `workflowExecutionId`, `workspace`,\n * `select` and TanStack `queryOptions`.\n * @returns {object} The `useQuery` result, plus `queryKey`.\n */\nexport const useFetchWorkflowExecution = <TSelected = WorkflowExecution>({\n workflowId,\n workflowExecutionId,\n workspace,\n select,\n queryOptions,\n}: FetchWorkflowExecutionProps<WorkflowExecution, TSelected>) => {\n const { api } = useAxios();\n\n const queryKey = [\"workflow_execution\", workflowId, workflowExecutionId, workspace];\n\n const query = useEntityQuery<WorkflowExecution, TSelected>({\n queryKey,\n fetchEntity: (signal) =>\n getWorkflowExecution(api, workflowId, workflowExecutionId, workspace, signal),\n select,\n enabled: Boolean(workflowId) && Boolean(workflowExecutionId),\n configError: workspace ? undefined : missingWorkspaceError(\"useFetchWorkflowExecution\"),\n queryOptions,\n });\n\n return { ...query, queryKey };\n};\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,IAAa,6BAA4D,EACrE,YACA,qBACA,WACA,QACA,mBAC6D;CAC7D,MAAM,EAAE,QAAQ,SAAS;CAEzB,MAAM,WAAW;EAAC;EAAsB;EAAY;EAAqB;CAAS;CAYlF,OAAO;EAAE,GAVK,eAA6C;GACvD;GACA,cAAc,WACV,qBAAqB,KAAK,YAAY,qBAAqB,WAAW,MAAM;GAChF;GACA,SAAS,QAAQ,UAAU,KAAK,QAAQ,mBAAmB;GAC3D,aAAa,YAAY,KAAA,IAAY,sBAAsB,2BAA2B;GACtF;EACJ,CAEY;EAAO;CAAS;AAChC"}
|
|
@@ -1,49 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { FetchEntitiesParams } from "../../types/entityQuery.d.ts";
|
|
1
|
+
import type { FetchEntitiesProps, ListCache } from "../../types/entityQuery.d.ts";
|
|
3
2
|
import type { WorkflowExecution, WorkflowExecutionListResponse } from "../../types/workflow.d.ts";
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
export type
|
|
3
|
+
/** The query cache of `useFetchWorkflowExecutions`, for typing `setQueryData`. */
|
|
4
|
+
export type WorkflowExecutionsCache = ListCache<WorkflowExecutionListResponse>;
|
|
5
|
+
export type FetchWorkflowExecutionsProps<TData = WorkflowExecution[]> = FetchEntitiesProps<WorkflowExecution, TData, WorkflowExecutionListResponse> & {
|
|
7
6
|
workflowId: string;
|
|
8
|
-
|
|
7
|
+
workspace: string;
|
|
8
|
+
/** Only the executions this worker took part in. */
|
|
9
|
+
workerId?: string;
|
|
10
|
+
/** Include each execution's `resume`, the per-worker summary. */
|
|
11
|
+
withResume?: boolean;
|
|
9
12
|
};
|
|
10
13
|
/**
|
|
11
14
|
* useFetchWorkflowExecutions
|
|
12
15
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
16
|
+
* Lists the executions of one workflow, newest first, with cursor pagination; `query.data` is
|
|
17
|
+
* every loaded page merged, or whatever `select` makes of it. `select`, `fetchAllPages` and the
|
|
18
|
+
* missing-workspace error behave as in `useFetchDatastores`. Idle while `workflowId` is empty.
|
|
15
19
|
*
|
|
16
|
-
*
|
|
20
|
+
* The endpoint takes no filters, order or projection: only a worker id and `withResume`. It used
|
|
21
|
+
* to accept them as props and send them in a JSON query the endpoint ignores, along with the
|
|
22
|
+
* cursor, so every "next page" was the first one.
|
|
17
23
|
*
|
|
18
|
-
*
|
|
24
|
+
* The key starts with `["workflow_executions", workflowId]`, which is what apps invalidate to
|
|
25
|
+
* refresh the list after running a workflow.
|
|
19
26
|
*
|
|
20
|
-
* @param
|
|
21
|
-
*
|
|
22
|
-
* @
|
|
23
|
-
* @param projection - Single field to project: `"field"` returns only that field (others come
|
|
24
|
-
* back null), `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
25
|
-
* @param pageSize - Number of executions to fetch per page. Defaults to `10`.
|
|
26
|
-
* @param queryOptions - TanStack Query options passed through to `useInfiniteQuery`.
|
|
27
|
-
*
|
|
28
|
-
* @returns
|
|
29
|
-
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
30
|
-
* - `queryKey`: the cache key used by React Query
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* const { query } = useFetchWorkflowExecutions({
|
|
35
|
-
* workflowId: "wf-123",
|
|
36
|
-
* filters: [{ field: "workspace", value: "main" }],
|
|
37
|
-
* pageSize: 20,
|
|
38
|
-
* });
|
|
39
|
-
*
|
|
40
|
-
* // Flat list of all fetched executions
|
|
41
|
-
* const executions = query.data ?? [];
|
|
42
|
-
* ```
|
|
27
|
+
* @param {FetchWorkflowExecutionsProps} props - Workflow id, workspace, worker id,
|
|
28
|
+
* `withResume`, page size, `select`, `fetchAllPages`, `queryOptions`.
|
|
29
|
+
* @returns {object} `query` (the `useInfiniteQuery` result) and `queryKey`.
|
|
43
30
|
*/
|
|
44
|
-
export declare function useFetchWorkflowExecutions({ workflowId,
|
|
45
|
-
query: import("@tanstack/react-query").UseInfiniteQueryResult<
|
|
31
|
+
export declare function useFetchWorkflowExecutions<TData = WorkflowExecution[]>({ workflowId, workspace, workerId, withResume, pageSize, select, fetchAllPages, queryOptions, }: FetchWorkflowExecutionsProps<TData>): {
|
|
32
|
+
query: import("@tanstack/react-query").UseInfiniteQueryResult<TData, Error>;
|
|
46
33
|
queryKey: unknown[];
|
|
47
34
|
};
|
|
48
|
-
export {};
|
|
49
35
|
//# sourceMappingURL=useFetchWorkflowExecutions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchWorkflowExecutions.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflow/useFetchWorkflowExecutions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFetchWorkflowExecutions.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflow/useFetchWorkflowExecutions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAEzF,kFAAkF;AAClF,MAAM,MAAM,uBAAuB,GAAG,SAAS,CAAC,6BAA6B,CAAC,CAAC;AAE/E,MAAM,MAAM,4BAA4B,CAAC,KAAK,GAAG,iBAAiB,EAAE,IAAI,kBAAkB,CACtF,iBAAiB,EACjB,KAAK,EACL,6BAA6B,CAChC,GAAG;IACA,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,GAAG,iBAAiB,EAAE,EAAE,EACpE,UAAU,EACV,SAAS,EACT,QAAQ,EACR,UAAU,EACV,QAAa,EACb,MAAM,EACN,aAAqB,EACrB,YAAY,GACf,EAAE,4BAA4B,CAAC,KAAK,CAAC;;;EAmCrC"}
|
|
@@ -1,72 +1,59 @@
|
|
|
1
1
|
import { useAxios } from "../useAxios.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useEntityInfiniteQuery } from "../useEntityInfiniteQuery.js";
|
|
3
|
+
import { buildQueryKey, missingWorkspaceError } from "../../api/entityQuery.js";
|
|
3
4
|
import { listWorkflowExecutions } from "../../api/workflow.js";
|
|
4
|
-
import { useMemo } from "react";
|
|
5
|
-
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
6
5
|
//#region src/hooks/workflow/useFetchWorkflowExecutions.ts
|
|
7
|
-
var defaultQueryOptions = {
|
|
8
|
-
refetchOnMount: "always",
|
|
9
|
-
staleTime: 0,
|
|
10
|
-
gcTime: 0
|
|
11
|
-
};
|
|
12
6
|
/**
|
|
13
7
|
* useFetchWorkflowExecutions
|
|
14
8
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
9
|
+
* Lists the executions of one workflow, newest first, with cursor pagination; `query.data` is
|
|
10
|
+
* every loaded page merged, or whatever `select` makes of it. `select`, `fetchAllPages` and the
|
|
11
|
+
* missing-workspace error behave as in `useFetchDatastores`. Idle while `workflowId` is empty.
|
|
17
12
|
*
|
|
18
|
-
*
|
|
13
|
+
* The endpoint takes no filters, order or projection: only a worker id and `withResume`. It used
|
|
14
|
+
* to accept them as props and send them in a JSON query the endpoint ignores, along with the
|
|
15
|
+
* cursor, so every "next page" was the first one.
|
|
19
16
|
*
|
|
20
|
-
*
|
|
17
|
+
* The key starts with `["workflow_executions", workflowId]`, which is what apps invalidate to
|
|
18
|
+
* refresh the list after running a workflow.
|
|
21
19
|
*
|
|
22
|
-
* @param
|
|
23
|
-
*
|
|
24
|
-
* @
|
|
25
|
-
* @param projection - Single field to project: `"field"` returns only that field (others come
|
|
26
|
-
* back null), `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
27
|
-
* @param pageSize - Number of executions to fetch per page. Defaults to `10`.
|
|
28
|
-
* @param queryOptions - TanStack Query options passed through to `useInfiniteQuery`.
|
|
29
|
-
*
|
|
30
|
-
* @returns
|
|
31
|
-
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
32
|
-
* - `queryKey`: the cache key used by React Query
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* const { query } = useFetchWorkflowExecutions({
|
|
37
|
-
* workflowId: "wf-123",
|
|
38
|
-
* filters: [{ field: "workspace", value: "main" }],
|
|
39
|
-
* pageSize: 20,
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* // Flat list of all fetched executions
|
|
43
|
-
* const executions = query.data ?? [];
|
|
44
|
-
* ```
|
|
20
|
+
* @param {FetchWorkflowExecutionsProps} props - Workflow id, workspace, worker id,
|
|
21
|
+
* `withResume`, page size, `select`, `fetchAllPages`, `queryOptions`.
|
|
22
|
+
* @returns {object} `query` (the `useInfiniteQuery` result) and `queryKey`.
|
|
45
23
|
*/
|
|
46
|
-
function useFetchWorkflowExecutions({ workflowId,
|
|
24
|
+
function useFetchWorkflowExecutions({ workflowId, workspace, workerId, withResume, pageSize = 10, select, fetchAllPages = false, queryOptions }) {
|
|
47
25
|
const { api } = useAxios();
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
26
|
+
const filters = [...workerId ? [{
|
|
27
|
+
field: "worker_id",
|
|
28
|
+
value: workerId
|
|
29
|
+
}] : [], ...withResume !== void 0 ? [{
|
|
30
|
+
field: "with_resume",
|
|
31
|
+
value: withResume
|
|
32
|
+
}] : []];
|
|
33
|
+
const queryKey = buildQueryKey([
|
|
34
|
+
"workflow_executions",
|
|
35
|
+
workflowId,
|
|
36
|
+
workspace
|
|
37
|
+
], filters, {
|
|
38
|
+
pageSize,
|
|
39
|
+
fetchAllPages
|
|
40
|
+
});
|
|
53
41
|
return {
|
|
54
|
-
query:
|
|
42
|
+
query: useEntityInfiniteQuery({
|
|
55
43
|
queryKey,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
...mergedQueryOptions
|
|
44
|
+
itemsKey: "workflow_executions",
|
|
45
|
+
fetchPage: (pageToken, signal) => listWorkflowExecutions(api, workflowId, {
|
|
46
|
+
workspace,
|
|
47
|
+
pageSize,
|
|
48
|
+
pageToken: pageToken ?? void 0,
|
|
49
|
+
workerId,
|
|
50
|
+
withResume
|
|
51
|
+
}, signal),
|
|
52
|
+
select,
|
|
53
|
+
fetchAllPages,
|
|
54
|
+
enabled: Boolean(workflowId),
|
|
55
|
+
configError: workspace ? void 0 : missingWorkspaceError("useFetchWorkflowExecutions"),
|
|
56
|
+
queryOptions
|
|
70
57
|
}),
|
|
71
58
|
queryKey
|
|
72
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchWorkflowExecutions.js","names":[],"sources":["../../../src/hooks/workflow/useFetchWorkflowExecutions.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useFetchWorkflowExecutions.js","names":[],"sources":["../../../src/hooks/workflow/useFetchWorkflowExecutions.ts"],"sourcesContent":["import { useAxios } from \"@/hooks/useAxios\";\nimport { useEntityInfiniteQuery } from \"@/hooks/useEntityInfiniteQuery\";\nimport { listWorkflowExecutions } from \"@/api/workflow\";\nimport type { FetchEntitiesProps, ListCache } from \"@/types/entityQuery\";\nimport { buildQueryKey, missingWorkspaceError } from \"@/api/entityQuery\";\nimport type { WorkflowExecution, WorkflowExecutionListResponse } from \"@/types/workflow\";\n\n/** The query cache of `useFetchWorkflowExecutions`, for typing `setQueryData`. */\nexport type WorkflowExecutionsCache = ListCache<WorkflowExecutionListResponse>;\n\nexport type FetchWorkflowExecutionsProps<TData = WorkflowExecution[]> = FetchEntitiesProps<\n WorkflowExecution,\n TData,\n WorkflowExecutionListResponse\n> & {\n workflowId: string;\n workspace: string;\n /** Only the executions this worker took part in. */\n workerId?: string;\n /** Include each execution's `resume`, the per-worker summary. */\n withResume?: boolean;\n};\n\n/**\n * useFetchWorkflowExecutions\n *\n * Lists the executions of one workflow, newest first, with cursor pagination; `query.data` is\n * every loaded page merged, or whatever `select` makes of it. `select`, `fetchAllPages` and the\n * missing-workspace error behave as in `useFetchDatastores`. Idle while `workflowId` is empty.\n *\n * The endpoint takes no filters, order or projection: only a worker id and `withResume`. It used\n * to accept them as props and send them in a JSON query the endpoint ignores, along with the\n * cursor, so every \"next page\" was the first one.\n *\n * The key starts with `[\"workflow_executions\", workflowId]`, which is what apps invalidate to\n * refresh the list after running a workflow.\n *\n * @param {FetchWorkflowExecutionsProps} props - Workflow id, workspace, worker id,\n * `withResume`, page size, `select`, `fetchAllPages`, `queryOptions`.\n * @returns {object} `query` (the `useInfiniteQuery` result) and `queryKey`.\n */\nexport function useFetchWorkflowExecutions<TData = WorkflowExecution[]>({\n workflowId,\n workspace,\n workerId,\n withResume,\n pageSize = 10,\n select,\n fetchAllPages = false,\n queryOptions,\n}: FetchWorkflowExecutionsProps<TData>) {\n const { api } = useAxios();\n\n // The endpoint's two filters go in the key as filters, so a list per worker gets its own entry.\n const filters = [\n ...(workerId ? [{ field: \"worker_id\", value: workerId }] : []),\n ...(withResume !== undefined ? [{ field: \"with_resume\", value: withResume }] : []),\n ];\n const queryKey = buildQueryKey([\"workflow_executions\", workflowId, workspace], filters, {\n pageSize,\n fetchAllPages,\n });\n\n const query = useEntityInfiniteQuery<\n WorkflowExecutionListResponse,\n \"workflow_executions\",\n TData\n >({\n queryKey,\n itemsKey: \"workflow_executions\",\n fetchPage: (pageToken, signal) =>\n listWorkflowExecutions(\n api,\n workflowId,\n { workspace, pageSize, pageToken: pageToken ?? undefined, workerId, withResume },\n signal,\n ),\n select,\n fetchAllPages,\n enabled: Boolean(workflowId),\n configError: workspace ? undefined : missingWorkspaceError(\"useFetchWorkflowExecutions\"),\n queryOptions,\n });\n\n return { query, queryKey };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,2BAAwD,EACpE,YACA,WACA,UACA,YACA,WAAW,IACX,QACA,gBAAgB,OAChB,gBACoC;CACpC,MAAM,EAAE,QAAQ,SAAS;CAGzB,MAAM,UAAU,CACZ,GAAI,WAAW,CAAC;EAAE,OAAO;EAAa,OAAO;CAAS,CAAC,IAAI,CAAC,GAC5D,GAAI,eAAe,KAAA,IAAY,CAAC;EAAE,OAAO;EAAe,OAAO;CAAW,CAAC,IAAI,CAAC,CACpF;CACA,MAAM,WAAW,cAAc;EAAC;EAAuB;EAAY;CAAS,GAAG,SAAS;EACpF;EACA;CACJ,CAAC;CAuBD,OAAO;EAAE,OArBK,uBAIZ;GACE;GACA,UAAU;GACV,YAAY,WAAW,WACnB,uBACI,KACA,YACA;IAAE;IAAW;IAAU,WAAW,aAAa,KAAA;IAAW;IAAU;GAAW,GAC/E,MACJ;GACJ;GACA;GACA,SAAS,QAAQ,UAAU;GAC3B,aAAa,YAAY,KAAA,IAAY,sBAAsB,4BAA4B;GACvF;EACJ,CAES;EAAO;CAAS;AAC7B"}
|
|
@@ -1,47 +1,30 @@
|
|
|
1
|
-
import { type UseInfiniteQueryOptions, type QueryKey } from "@tanstack/react-query";
|
|
2
1
|
import type { Workflow, WorkflowListResponse } from "../../types/workflow.d.ts";
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import type { FetchEntitiesProps, ListCache } from "../../types/entityQuery.d.ts";
|
|
3
|
+
/** The query cache of `useFetchWorkflows`, for typing `setQueryData`. */
|
|
4
|
+
export type WorkflowsCache = ListCache<WorkflowListResponse>;
|
|
5
|
+
export type FetchWorkflowsProps<TData = Workflow[]> = FetchEntitiesProps<Workflow, TData, WorkflowListResponse> & {
|
|
6
|
+
/** Workspace to list. Required: without one the API reads `main`, not the account. */
|
|
7
|
+
workspace: string;
|
|
8
|
+
/** A name prefix, an id, `#tag #tag` (every tag), or `&link_uid`. */
|
|
9
|
+
search?: string;
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
* useFetchWorkflows
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* Lists workflows with cursor pagination; `query.data` is every loaded page merged, or
|
|
15
|
+
* whatever `select` makes of it. `select` and `fetchAllPages` behave as in
|
|
16
|
+
* `useFetchDatastores`. This endpoint takes a workspace and a text `search` rather than
|
|
17
|
+
* filters.
|
|
15
18
|
*
|
|
16
|
-
*
|
|
19
|
+
* A missing workspace fails loudly, without a request, as in every other hook. This hook used to
|
|
20
|
+
* allow one, documented as listing the account's workflows; the API reads `main` instead.
|
|
17
21
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
21
|
-
* Current workspace name. Sent as a query param via the legacy method, required by some API configurations.
|
|
22
|
-
*
|
|
23
|
-
* @param {number} [pageSize=10]
|
|
24
|
-
* Number of workflows to fetch per page.
|
|
25
|
-
*
|
|
26
|
-
* @param {InfiniteOptions<Workflow[]>} [queryOptions]
|
|
27
|
-
* TanStack Query options passed through to `useInfiniteQuery`
|
|
28
|
-
* (e.g., enabled, staleTime, gcTime, etc.).
|
|
29
|
-
*
|
|
30
|
-
* @returns {{ query, queryKey }}
|
|
31
|
-
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
32
|
-
* - `queryKey`: the cache key used by React Query
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* const { query } = useFetchWorkflows({ workspace: "ws-1", pageSize: 20 });
|
|
37
|
-
*
|
|
38
|
-
* // Flat list of all fetched workflows
|
|
39
|
-
* const workflows = query.data ?? [];
|
|
40
|
-
* ```
|
|
22
|
+
* @param {FetchWorkflowsProps} props - Workspace, search, page size, `select`,
|
|
23
|
+
* `fetchAllPages` and TanStack `queryOptions`.
|
|
24
|
+
* @returns {object} `query` (the `useInfiniteQuery` result) and `queryKey`.
|
|
41
25
|
*/
|
|
42
|
-
export declare function useFetchWorkflows({ workspace, pageSize, queryOptions }:
|
|
43
|
-
query: import("@tanstack/react-query").UseInfiniteQueryResult<
|
|
44
|
-
queryKey:
|
|
26
|
+
export declare function useFetchWorkflows<TData = Workflow[]>({ workspace, search, pageSize, select, fetchAllPages, queryOptions, }: FetchWorkflowsProps<TData>): {
|
|
27
|
+
query: import("@tanstack/react-query").UseInfiniteQueryResult<TData, Error>;
|
|
28
|
+
queryKey: unknown[];
|
|
45
29
|
};
|
|
46
|
-
export {};
|
|
47
30
|
//# sourceMappingURL=useFetchWorkflows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchWorkflows.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflow/useFetchWorkflows.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFetchWorkflows.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflow/useFetchWorkflows.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzE,yEAAyE;AACzE,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,oBAAoB,CAAC,CAAC;AAE7D,MAAM,MAAM,mBAAmB,CAAC,KAAK,GAAG,QAAQ,EAAE,IAAI,kBAAkB,CACpE,QAAQ,EACR,KAAK,EACL,oBAAoB,CACvB,GAAG;IACA,sFAAsF;IACtF,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,GAAG,QAAQ,EAAE,EAAE,EAClD,SAAS,EACT,MAAM,EACN,QAAa,EACb,MAAM,EACN,aAAqB,EACrB,YAAY,GACf,EAAE,mBAAmB,CAAC,KAAK,CAAC;;;EAwB5B"}
|