@everysk/apps-sdk 0.1.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 +395 -8
- 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 +6 -6
- 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,52 +1,190 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
type PageToken = string | null;
|
|
5
|
-
type InfiniteOptions<TData> = Omit<UseInfiniteQueryOptions<WorkerExecutionListResponse, Error, TData, QueryKey, PageToken>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam">;
|
|
6
|
-
export type FetchInfiniteWorkerExecutionProps = FetchEntitiesParams<WorkerExecution[], InfiniteOptions<WorkerExecution[]>> & {
|
|
1
|
+
import type { FetchEntityProps } from "../../types/entityQuery.d.ts";
|
|
2
|
+
import type { WorkerExecutionGroup } from "../../types/workflow.d.ts";
|
|
3
|
+
export type FetchWorkerExecutionsProps<TData = WorkerExecutionGroup[], TSelected = TData> = FetchEntityProps<TData, TSelected> & {
|
|
7
4
|
workflowId: string;
|
|
8
5
|
workflowExecutionId: string;
|
|
9
|
-
|
|
6
|
+
workspace: string;
|
|
7
|
+
/** Include each run's `result` and `input_params`. The API leaves them out by default. */
|
|
8
|
+
withResult?: boolean;
|
|
10
9
|
};
|
|
11
10
|
/**
|
|
12
11
|
* useFetchWorkerExecutions
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Fetches every worker execution of one workflow execution, grouped by worker; `data` is the
|
|
14
|
+
* groups, or whatever `select` makes of them. Narrow a group on `is_parallel_execution`: a
|
|
15
|
+
* worker that ran in parallel carries every run under `executions`, any other one its run as
|
|
16
|
+
* `execution`. Idle while an id is empty; fails loudly, without a request, while `workspace` is.
|
|
17
|
+
* A failure is shown as an error alert.
|
|
16
18
|
*
|
|
17
|
-
*
|
|
19
|
+
* A plain query, not an infinite one, and so shaped like the single-entity hooks: the endpoint
|
|
20
|
+
* returns the whole set at once, with no cursor to page by. It used to be paged, over a JSON
|
|
21
|
+
* query the endpoint ignores, and typed as a flat list of worker executions.
|
|
18
22
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
22
|
-
* @param workflowExecutionId - Workflow execution identifier to filter worker executions (required).
|
|
23
|
-
* @param filters - Filters applied to every page request. Must include a `workspace` filter.
|
|
24
|
-
* @param order - Sorting applied to every page request.
|
|
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 } = useFetchWorkerExecutions({
|
|
37
|
-
* workflowId: "wf-123",
|
|
38
|
-
* workflowExecutionId: "wfex-456",
|
|
39
|
-
* filters: [{ field: "workspace", value: "main" }],
|
|
40
|
-
* pageSize: 20,
|
|
41
|
-
* });
|
|
42
|
-
*
|
|
43
|
-
* // Flat list of all fetched worker executions
|
|
44
|
-
* const workerExecutions = query.data ?? [];
|
|
45
|
-
* ```
|
|
23
|
+
* @param {FetchWorkerExecutionsProps} props - Workflow and execution ids, workspace,
|
|
24
|
+
* `withResult`, `select` and TanStack `queryOptions`.
|
|
25
|
+
* @returns {object} The `useQuery` result, plus `queryKey`.
|
|
46
26
|
*/
|
|
47
|
-
export declare
|
|
48
|
-
|
|
49
|
-
|
|
27
|
+
export declare const useFetchWorkerExecutions: <TSelected = WorkerExecutionGroup[]>({ workflowId, workflowExecutionId, workspace, withResult, select, queryOptions, }: FetchWorkerExecutionsProps<WorkerExecutionGroup[], TSelected>) => {
|
|
28
|
+
queryKey: (string | boolean | null)[];
|
|
29
|
+
data: TSelected;
|
|
30
|
+
error: Error;
|
|
31
|
+
isError: true;
|
|
32
|
+
isPending: false;
|
|
33
|
+
isLoading: false;
|
|
34
|
+
isLoadingError: false;
|
|
35
|
+
isRefetchError: true;
|
|
36
|
+
isSuccess: false;
|
|
37
|
+
isPlaceholderData: false;
|
|
38
|
+
status: "error";
|
|
39
|
+
dataUpdatedAt: number;
|
|
40
|
+
errorUpdatedAt: number;
|
|
41
|
+
failureCount: number;
|
|
42
|
+
failureReason: Error | null;
|
|
43
|
+
errorUpdateCount: number;
|
|
44
|
+
isFetched: boolean;
|
|
45
|
+
isFetchedAfterMount: boolean;
|
|
46
|
+
isFetching: boolean;
|
|
47
|
+
isInitialLoading: boolean;
|
|
48
|
+
isPaused: boolean;
|
|
49
|
+
isRefetching: boolean;
|
|
50
|
+
isStale: boolean;
|
|
51
|
+
isEnabled: boolean;
|
|
52
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
53
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
54
|
+
} | {
|
|
55
|
+
queryKey: (string | boolean | null)[];
|
|
56
|
+
data: TSelected;
|
|
57
|
+
error: null;
|
|
58
|
+
isError: false;
|
|
59
|
+
isPending: false;
|
|
60
|
+
isLoading: false;
|
|
61
|
+
isLoadingError: false;
|
|
62
|
+
isRefetchError: false;
|
|
63
|
+
isSuccess: true;
|
|
64
|
+
isPlaceholderData: false;
|
|
65
|
+
status: "success";
|
|
66
|
+
dataUpdatedAt: number;
|
|
67
|
+
errorUpdatedAt: number;
|
|
68
|
+
failureCount: number;
|
|
69
|
+
failureReason: Error | null;
|
|
70
|
+
errorUpdateCount: number;
|
|
71
|
+
isFetched: boolean;
|
|
72
|
+
isFetchedAfterMount: boolean;
|
|
73
|
+
isFetching: boolean;
|
|
74
|
+
isInitialLoading: boolean;
|
|
75
|
+
isPaused: boolean;
|
|
76
|
+
isRefetching: boolean;
|
|
77
|
+
isStale: boolean;
|
|
78
|
+
isEnabled: boolean;
|
|
79
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
80
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
81
|
+
} | {
|
|
82
|
+
queryKey: (string | boolean | null)[];
|
|
83
|
+
data: undefined;
|
|
84
|
+
error: Error;
|
|
85
|
+
isError: true;
|
|
86
|
+
isPending: false;
|
|
87
|
+
isLoading: false;
|
|
88
|
+
isLoadingError: true;
|
|
89
|
+
isRefetchError: false;
|
|
90
|
+
isSuccess: false;
|
|
91
|
+
isPlaceholderData: false;
|
|
92
|
+
status: "error";
|
|
93
|
+
dataUpdatedAt: number;
|
|
94
|
+
errorUpdatedAt: number;
|
|
95
|
+
failureCount: number;
|
|
96
|
+
failureReason: Error | null;
|
|
97
|
+
errorUpdateCount: number;
|
|
98
|
+
isFetched: boolean;
|
|
99
|
+
isFetchedAfterMount: boolean;
|
|
100
|
+
isFetching: boolean;
|
|
101
|
+
isInitialLoading: boolean;
|
|
102
|
+
isPaused: boolean;
|
|
103
|
+
isRefetching: boolean;
|
|
104
|
+
isStale: boolean;
|
|
105
|
+
isEnabled: boolean;
|
|
106
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
107
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
108
|
+
} | {
|
|
109
|
+
queryKey: (string | boolean | null)[];
|
|
110
|
+
data: undefined;
|
|
111
|
+
error: null;
|
|
112
|
+
isError: false;
|
|
113
|
+
isPending: true;
|
|
114
|
+
isLoading: true;
|
|
115
|
+
isLoadingError: false;
|
|
116
|
+
isRefetchError: false;
|
|
117
|
+
isSuccess: false;
|
|
118
|
+
isPlaceholderData: false;
|
|
119
|
+
status: "pending";
|
|
120
|
+
dataUpdatedAt: number;
|
|
121
|
+
errorUpdatedAt: number;
|
|
122
|
+
failureCount: number;
|
|
123
|
+
failureReason: Error | null;
|
|
124
|
+
errorUpdateCount: number;
|
|
125
|
+
isFetched: boolean;
|
|
126
|
+
isFetchedAfterMount: boolean;
|
|
127
|
+
isFetching: boolean;
|
|
128
|
+
isInitialLoading: boolean;
|
|
129
|
+
isPaused: boolean;
|
|
130
|
+
isRefetching: boolean;
|
|
131
|
+
isStale: boolean;
|
|
132
|
+
isEnabled: boolean;
|
|
133
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
134
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
135
|
+
} | {
|
|
136
|
+
queryKey: (string | boolean | null)[];
|
|
137
|
+
data: undefined;
|
|
138
|
+
error: null;
|
|
139
|
+
isError: false;
|
|
140
|
+
isPending: true;
|
|
141
|
+
isLoadingError: false;
|
|
142
|
+
isRefetchError: false;
|
|
143
|
+
isSuccess: false;
|
|
144
|
+
isPlaceholderData: false;
|
|
145
|
+
status: "pending";
|
|
146
|
+
dataUpdatedAt: number;
|
|
147
|
+
errorUpdatedAt: number;
|
|
148
|
+
failureCount: number;
|
|
149
|
+
failureReason: Error | null;
|
|
150
|
+
errorUpdateCount: number;
|
|
151
|
+
isFetched: boolean;
|
|
152
|
+
isFetchedAfterMount: boolean;
|
|
153
|
+
isFetching: boolean;
|
|
154
|
+
isLoading: boolean;
|
|
155
|
+
isInitialLoading: boolean;
|
|
156
|
+
isPaused: boolean;
|
|
157
|
+
isRefetching: boolean;
|
|
158
|
+
isStale: boolean;
|
|
159
|
+
isEnabled: boolean;
|
|
160
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
161
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
162
|
+
} | {
|
|
163
|
+
queryKey: (string | boolean | null)[];
|
|
164
|
+
data: TSelected;
|
|
165
|
+
isError: false;
|
|
166
|
+
error: null;
|
|
167
|
+
isPending: false;
|
|
168
|
+
isLoading: false;
|
|
169
|
+
isLoadingError: false;
|
|
170
|
+
isRefetchError: false;
|
|
171
|
+
isSuccess: true;
|
|
172
|
+
isPlaceholderData: true;
|
|
173
|
+
status: "success";
|
|
174
|
+
dataUpdatedAt: number;
|
|
175
|
+
errorUpdatedAt: number;
|
|
176
|
+
failureCount: number;
|
|
177
|
+
failureReason: Error | null;
|
|
178
|
+
errorUpdateCount: number;
|
|
179
|
+
isFetched: boolean;
|
|
180
|
+
isFetchedAfterMount: boolean;
|
|
181
|
+
isFetching: boolean;
|
|
182
|
+
isInitialLoading: boolean;
|
|
183
|
+
isPaused: boolean;
|
|
184
|
+
isRefetching: boolean;
|
|
185
|
+
isStale: boolean;
|
|
186
|
+
isEnabled: boolean;
|
|
187
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
188
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
50
189
|
};
|
|
51
|
-
export {};
|
|
52
190
|
//# sourceMappingURL=useFetchWorkerExecutions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchWorkerExecutions.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflow/useFetchWorkerExecutions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFetchWorkerExecutions.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflow/useFetchWorkerExecutions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,MAAM,0BAA0B,CAClC,KAAK,GAAG,oBAAoB,EAAE,EAC9B,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;IAClB,0FAA0F;IAC1F,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,GAAG,oBAAoB,EAAE,EAAE,mFAO1E,0BAA0B,CAAC,oBAAoB,EAAE,EAAE,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B/D,CAAC"}
|
|
@@ -1,82 +1,49 @@
|
|
|
1
1
|
import { useAxios } from "../useAxios.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useEntityQuery } from "../useEntityQuery.js";
|
|
3
|
+
import { missingWorkspaceError } from "../../api/entityQuery.js";
|
|
3
4
|
import { listWorkerExecutions } from "../../api/workflow.js";
|
|
4
|
-
import { useMemo } from "react";
|
|
5
|
-
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
6
5
|
//#region src/hooks/workflow/useFetchWorkerExecutions.ts
|
|
7
|
-
var defaultQueryOptions = {
|
|
8
|
-
refetchOnMount: "always",
|
|
9
|
-
staleTime: 0,
|
|
10
|
-
gcTime: 0
|
|
11
|
-
};
|
|
12
6
|
/**
|
|
13
7
|
* useFetchWorkerExecutions
|
|
14
8
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* Note: `query.data` returns a flat `WorkerExecution[]` with all fetched items merged across pages.
|
|
9
|
+
* Fetches every worker execution of one workflow execution, grouped by worker; `data` is the
|
|
10
|
+
* groups, or whatever `select` makes of them. Narrow a group on `is_parallel_execution`: a
|
|
11
|
+
* worker that ran in parallel carries every run under `executions`, any other one its run as
|
|
12
|
+
* `execution`. Idle while an id is empty; fails loudly, without a request, while `workspace` is.
|
|
13
|
+
* A failure is shown as an error alert.
|
|
21
14
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @param order - Sorting applied to every page request.
|
|
26
|
-
* @param projection - Single field to project: `"field"` returns only that field (others come
|
|
27
|
-
* back null), `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
28
|
-
* @param pageSize - Number of executions to fetch per page. Defaults to `10`.
|
|
29
|
-
* @param queryOptions - TanStack Query options passed through to `useInfiniteQuery`.
|
|
15
|
+
* A plain query, not an infinite one, and so shaped like the single-entity hooks: the endpoint
|
|
16
|
+
* returns the whole set at once, with no cursor to page by. It used to be paged, over a JSON
|
|
17
|
+
* query the endpoint ignores, and typed as a flat list of worker executions.
|
|
30
18
|
*
|
|
31
|
-
* @
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* const { query } = useFetchWorkerExecutions({
|
|
38
|
-
* workflowId: "wf-123",
|
|
39
|
-
* workflowExecutionId: "wfex-456",
|
|
40
|
-
* filters: [{ field: "workspace", value: "main" }],
|
|
41
|
-
* pageSize: 20,
|
|
42
|
-
* });
|
|
43
|
-
*
|
|
44
|
-
* // Flat list of all fetched worker executions
|
|
45
|
-
* const workerExecutions = query.data ?? [];
|
|
46
|
-
* ```
|
|
19
|
+
* @param {FetchWorkerExecutionsProps} props - Workflow and execution ids, workspace,
|
|
20
|
+
* `withResult`, `select` and TanStack `queryOptions`.
|
|
21
|
+
* @returns {object} The `useQuery` result, plus `queryKey`.
|
|
47
22
|
*/
|
|
48
|
-
|
|
23
|
+
var useFetchWorkerExecutions = ({ workflowId, workflowExecutionId, workspace, withResult, select, queryOptions }) => {
|
|
49
24
|
const { api } = useAxios();
|
|
50
|
-
const queryKey =
|
|
25
|
+
const queryKey = [
|
|
51
26
|
"worker_executions",
|
|
52
27
|
workflowId,
|
|
53
|
-
workflowExecutionId
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
...queryOptions ?? {}
|
|
58
|
-
}), [queryOptions]);
|
|
28
|
+
workflowExecutionId,
|
|
29
|
+
workspace,
|
|
30
|
+
withResult ?? null
|
|
31
|
+
];
|
|
59
32
|
return {
|
|
60
|
-
|
|
33
|
+
...useEntityQuery({
|
|
61
34
|
queryKey,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
pageToken: pageParam ?? void 0
|
|
71
|
-
});
|
|
72
|
-
return await listWorkerExecutions(api, workflowId, workflowExecutionId, queryFilter);
|
|
73
|
-
},
|
|
74
|
-
select: (data) => data.pages.flatMap((p) => p.worker_executions),
|
|
75
|
-
...mergedQueryOptions
|
|
35
|
+
fetchEntity: async (signal) => (await listWorkerExecutions(api, workflowId, workflowExecutionId, {
|
|
36
|
+
workspace,
|
|
37
|
+
withResult
|
|
38
|
+
}, signal)).worker_executions,
|
|
39
|
+
select,
|
|
40
|
+
enabled: Boolean(workflowId) && Boolean(workflowExecutionId),
|
|
41
|
+
configError: workspace ? void 0 : missingWorkspaceError("useFetchWorkerExecutions"),
|
|
42
|
+
queryOptions
|
|
76
43
|
}),
|
|
77
44
|
queryKey
|
|
78
45
|
};
|
|
79
|
-
}
|
|
46
|
+
};
|
|
80
47
|
//#endregion
|
|
81
48
|
export { useFetchWorkerExecutions };
|
|
82
49
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchWorkerExecutions.js","names":[],"sources":["../../../src/hooks/workflow/useFetchWorkerExecutions.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useFetchWorkerExecutions.js","names":[],"sources":["../../../src/hooks/workflow/useFetchWorkerExecutions.ts"],"sourcesContent":["import { useAxios } from \"@/hooks/useAxios\";\nimport { useEntityQuery } from \"@/hooks/useEntityQuery\";\nimport { listWorkerExecutions } from \"@/api/workflow\";\nimport { missingWorkspaceError } from \"@/api/entityQuery\";\nimport type { FetchEntityProps } from \"@/types/entityQuery\";\nimport type { WorkerExecutionGroup } from \"@/types/workflow\";\n\nexport type FetchWorkerExecutionsProps<\n TData = WorkerExecutionGroup[],\n TSelected = TData,\n> = FetchEntityProps<TData, TSelected> & {\n workflowId: string;\n workflowExecutionId: string;\n workspace: string;\n /** Include each run's `result` and `input_params`. The API leaves them out by default. */\n withResult?: boolean;\n};\n\n/**\n * useFetchWorkerExecutions\n *\n * Fetches every worker execution of one workflow execution, grouped by worker; `data` is the\n * groups, or whatever `select` makes of them. Narrow a group on `is_parallel_execution`: a\n * worker that ran in parallel carries every run under `executions`, any other one its run as\n * `execution`. Idle while an id is empty; fails loudly, without a request, while `workspace` is.\n * A failure is shown as an error alert.\n *\n * A plain query, not an infinite one, and so shaped like the single-entity hooks: the endpoint\n * returns the whole set at once, with no cursor to page by. It used to be paged, over a JSON\n * query the endpoint ignores, and typed as a flat list of worker executions.\n *\n * @param {FetchWorkerExecutionsProps} props - Workflow and execution ids, workspace,\n * `withResult`, `select` and TanStack `queryOptions`.\n * @returns {object} The `useQuery` result, plus `queryKey`.\n */\nexport const useFetchWorkerExecutions = <TSelected = WorkerExecutionGroup[]>({\n workflowId,\n workflowExecutionId,\n workspace,\n withResult,\n select,\n queryOptions,\n}: FetchWorkerExecutionsProps<WorkerExecutionGroup[], TSelected>) => {\n const { api } = useAxios();\n\n const queryKey = [\n \"worker_executions\",\n workflowId,\n workflowExecutionId,\n workspace,\n withResult ?? null,\n ];\n\n const query = useEntityQuery<WorkerExecutionGroup[], TSelected>({\n queryKey,\n fetchEntity: async (signal) =>\n (\n await listWorkerExecutions(\n api,\n workflowId,\n workflowExecutionId,\n { workspace, withResult },\n signal,\n )\n ).worker_executions,\n select,\n enabled: Boolean(workflowId) && Boolean(workflowExecutionId),\n configError: workspace ? undefined : missingWorkspaceError(\"useFetchWorkerExecutions\"),\n queryOptions,\n });\n\n return { ...query, queryKey };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAa,4BAAgE,EACzE,YACA,qBACA,WACA,YACA,QACA,mBACiE;CACjE,MAAM,EAAE,QAAQ,SAAS;CAEzB,MAAM,WAAW;EACb;EACA;EACA;EACA;EACA,cAAc;CAClB;CAoBA,OAAO;EAAE,GAlBK,eAAkD;GAC5D;GACA,aAAa,OAAO,YAEZ,MAAM,qBACF,KACA,YACA,qBACA;IAAE;IAAW;GAAW,GACxB,MACJ,EAAA,CACF;GACN;GACA,SAAS,QAAQ,UAAU,KAAK,QAAQ,mBAAmB;GAC3D,aAAa,YAAY,KAAA,IAAY,sBAAsB,0BAA0B;GACrF;EACJ,CAEY;EAAO;CAAS;AAChC"}
|
|
@@ -1,37 +1,18 @@
|
|
|
1
1
|
import type { Workflow } from "../../types/workflow.d.ts";
|
|
2
|
-
import type {
|
|
3
|
-
export type FetchWorkflowProps<TData = Workflow, TSelected = TData> =
|
|
2
|
+
import type { FetchEntityByIdProps } from "../../types/entityQuery.d.ts";
|
|
3
|
+
export type FetchWorkflowProps<TData = Workflow, TSelected = TData> = FetchEntityByIdProps<TData, TSelected>;
|
|
4
4
|
/**
|
|
5
5
|
* useFetchWorkflow
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Fetches one workflow; `data` is the workflow, or whatever `select` makes of it. Idle while
|
|
8
|
+
* `id` is empty; fails loudly, without a request, while `workspace` is. A failure is shown as an error alert.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - triggers an error alert via `useAppAlert` whenever `query.error` is present
|
|
12
|
-
*
|
|
13
|
-
* @param id - Workflow identifier (required).
|
|
14
|
-
* @param workspace - Workspace the workflow belongs to (required).
|
|
15
|
-
* @param queryOptions - TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
16
|
-
*
|
|
17
|
-
* @returns TanStack Query result extended with `queryKey`.
|
|
18
|
-
*
|
|
19
|
-
* Tip:
|
|
20
|
-
* - The returned `queryKey` can be reused by mutation hooks for cache invalidation:
|
|
21
|
-
* ```ts
|
|
22
|
-
* const fetch = useFetchWorkflow({ id: "wf-123", workspace: "main" });
|
|
23
|
-
* useWorkflowMutations({ queryKey: fetch.queryKey });
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* Example:
|
|
27
|
-
* ```ts
|
|
28
|
-
* const { data, isLoading } = useFetchWorkflow({ id: "wf-123", workspace: "main" });
|
|
29
|
-
* // data -> Workflow
|
|
30
|
-
* ```
|
|
10
|
+
* @param {FetchWorkflowProps} props - `id`, `workspace`, `select` and TanStack `queryOptions`.
|
|
11
|
+
* @returns {object} The `useQuery` result, plus `queryKey`.
|
|
31
12
|
*/
|
|
32
|
-
export declare const useFetchWorkflow: ({ id, workspace, queryOptions }: FetchWorkflowProps) => {
|
|
13
|
+
export declare const useFetchWorkflow: <TSelected = Workflow>({ id, workspace, select, queryOptions, }: FetchWorkflowProps<Workflow, TSelected>) => {
|
|
33
14
|
queryKey: string[];
|
|
34
|
-
data:
|
|
15
|
+
data: TSelected;
|
|
35
16
|
error: Error;
|
|
36
17
|
isError: true;
|
|
37
18
|
isPending: false;
|
|
@@ -54,11 +35,11 @@ export declare const useFetchWorkflow: ({ id, workspace, queryOptions }: FetchWo
|
|
|
54
35
|
isRefetching: boolean;
|
|
55
36
|
isStale: boolean;
|
|
56
37
|
isEnabled: boolean;
|
|
57
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
38
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
58
39
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
59
40
|
} | {
|
|
60
41
|
queryKey: string[];
|
|
61
|
-
data:
|
|
42
|
+
data: TSelected;
|
|
62
43
|
error: null;
|
|
63
44
|
isError: false;
|
|
64
45
|
isPending: false;
|
|
@@ -81,7 +62,7 @@ export declare const useFetchWorkflow: ({ id, workspace, queryOptions }: FetchWo
|
|
|
81
62
|
isRefetching: boolean;
|
|
82
63
|
isStale: boolean;
|
|
83
64
|
isEnabled: boolean;
|
|
84
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
65
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
85
66
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
86
67
|
} | {
|
|
87
68
|
queryKey: string[];
|
|
@@ -108,7 +89,7 @@ export declare const useFetchWorkflow: ({ id, workspace, queryOptions }: FetchWo
|
|
|
108
89
|
isRefetching: boolean;
|
|
109
90
|
isStale: boolean;
|
|
110
91
|
isEnabled: boolean;
|
|
111
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
92
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
112
93
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
113
94
|
} | {
|
|
114
95
|
queryKey: string[];
|
|
@@ -135,7 +116,7 @@ export declare const useFetchWorkflow: ({ id, workspace, queryOptions }: FetchWo
|
|
|
135
116
|
isRefetching: boolean;
|
|
136
117
|
isStale: boolean;
|
|
137
118
|
isEnabled: boolean;
|
|
138
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
119
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
139
120
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
140
121
|
} | {
|
|
141
122
|
queryKey: string[];
|
|
@@ -162,11 +143,11 @@ export declare const useFetchWorkflow: ({ id, workspace, queryOptions }: FetchWo
|
|
|
162
143
|
isRefetching: boolean;
|
|
163
144
|
isStale: boolean;
|
|
164
145
|
isEnabled: boolean;
|
|
165
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
146
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
166
147
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
167
148
|
} | {
|
|
168
149
|
queryKey: string[];
|
|
169
|
-
data:
|
|
150
|
+
data: TSelected;
|
|
170
151
|
isError: false;
|
|
171
152
|
error: null;
|
|
172
153
|
isPending: false;
|
|
@@ -189,7 +170,7 @@ export declare const useFetchWorkflow: ({ id, workspace, queryOptions }: FetchWo
|
|
|
189
170
|
isRefetching: boolean;
|
|
190
171
|
isStale: boolean;
|
|
191
172
|
isEnabled: boolean;
|
|
192
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
173
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<TSelected, Error>>;
|
|
193
174
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
194
175
|
};
|
|
195
176
|
//# sourceMappingURL=useFetchWorkflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchWorkflow.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflow/useFetchWorkflow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFetchWorkflow.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflow/useFetchWorkflow.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,MAAM,MAAM,kBAAkB,CAAC,KAAK,GAAG,QAAQ,EAAE,SAAS,GAAG,KAAK,IAAI,oBAAoB,CACtF,KAAK,EACL,SAAS,CACZ,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,GAAG,QAAQ,EAAE,0CAKpD,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAezC,CAAC"}
|
|
@@ -1,66 +1,33 @@
|
|
|
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 { getWorkflow } from "../../api/workflow.js";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
import { useQuery } from "@tanstack/react-query";
|
|
6
5
|
//#region src/hooks/workflow/useFetchWorkflow.ts
|
|
7
|
-
var defaultQueryOptions = {
|
|
8
|
-
refetchOnMount: "always",
|
|
9
|
-
staleTime: 0,
|
|
10
|
-
gcTime: 0
|
|
11
|
-
};
|
|
12
6
|
/**
|
|
13
7
|
* useFetchWorkflow
|
|
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 id - Workflow identifier (required).
|
|
22
|
-
* @param workspace - Workspace the workflow belongs to (required).
|
|
23
|
-
* @param queryOptions - TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
24
|
-
*
|
|
25
|
-
* @returns TanStack Query result extended with `queryKey`.
|
|
26
|
-
*
|
|
27
|
-
* Tip:
|
|
28
|
-
* - The returned `queryKey` can be reused by mutation hooks for cache invalidation:
|
|
29
|
-
* ```ts
|
|
30
|
-
* const fetch = useFetchWorkflow({ id: "wf-123", workspace: "main" });
|
|
31
|
-
* useWorkflowMutations({ queryKey: fetch.queryKey });
|
|
32
|
-
* ```
|
|
9
|
+
* Fetches one workflow; `data` is the workflow, or whatever `select` makes of it. Idle while
|
|
10
|
+
* `id` is empty; fails loudly, without a request, while `workspace` is. A failure is shown as an error alert.
|
|
33
11
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* const { data, isLoading } = useFetchWorkflow({ id: "wf-123", workspace: "main" });
|
|
37
|
-
* // data -> Workflow
|
|
38
|
-
* ```
|
|
12
|
+
* @param {FetchWorkflowProps} props - `id`, `workspace`, `select` and TanStack `queryOptions`.
|
|
13
|
+
* @returns {object} The `useQuery` result, plus `queryKey`.
|
|
39
14
|
*/
|
|
40
|
-
var useFetchWorkflow = ({ id, workspace, queryOptions
|
|
15
|
+
var useFetchWorkflow = ({ id, workspace, select, queryOptions }) => {
|
|
41
16
|
const { api } = useAxios();
|
|
42
|
-
const { showAlert } = useAppAlert();
|
|
43
17
|
const queryKey = [
|
|
44
18
|
"workflow",
|
|
45
19
|
id,
|
|
46
20
|
workspace
|
|
47
21
|
];
|
|
48
|
-
const query = useQuery({
|
|
49
|
-
queryKey,
|
|
50
|
-
queryFn: async () => {
|
|
51
|
-
return await getWorkflow(api, id, workspace);
|
|
52
|
-
},
|
|
53
|
-
...queryOptions ?? {}
|
|
54
|
-
});
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (!query.error) return;
|
|
57
|
-
showAlert({
|
|
58
|
-
severity: "error",
|
|
59
|
-
message: query.error.message
|
|
60
|
-
});
|
|
61
|
-
}, [query.error, showAlert]);
|
|
62
22
|
return {
|
|
63
|
-
...
|
|
23
|
+
...useEntityQuery({
|
|
24
|
+
queryKey,
|
|
25
|
+
fetchEntity: (signal) => getWorkflow(api, id, workspace, signal),
|
|
26
|
+
select,
|
|
27
|
+
enabled: Boolean(id),
|
|
28
|
+
configError: workspace ? void 0 : missingWorkspaceError("useFetchWorkflow"),
|
|
29
|
+
queryOptions
|
|
30
|
+
}),
|
|
64
31
|
queryKey
|
|
65
32
|
};
|
|
66
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchWorkflow.js","names":[],"sources":["../../../src/hooks/workflow/useFetchWorkflow.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useFetchWorkflow.js","names":[],"sources":["../../../src/hooks/workflow/useFetchWorkflow.ts"],"sourcesContent":["import { useAxios } from \"@/hooks/useAxios\";\nimport { useEntityQuery } from \"@/hooks/useEntityQuery\";\nimport { missingWorkspaceError } from \"@/api/entityQuery\";\nimport { getWorkflow } from \"@/api/workflow\";\nimport type { Workflow } from \"@/types/workflow\";\nimport type { FetchEntityByIdProps } from \"@/types/entityQuery\";\n\nexport type FetchWorkflowProps<TData = Workflow, TSelected = TData> = FetchEntityByIdProps<\n TData,\n TSelected\n>;\n\n/**\n * useFetchWorkflow\n *\n * Fetches one workflow; `data` is the workflow, or whatever `select` makes of it. Idle while\n * `id` is empty; fails loudly, without a request, while `workspace` is. A failure is shown as an error alert.\n *\n * @param {FetchWorkflowProps} props - `id`, `workspace`, `select` and TanStack `queryOptions`.\n * @returns {object} The `useQuery` result, plus `queryKey`.\n */\nexport const useFetchWorkflow = <TSelected = Workflow>({\n id,\n workspace,\n select,\n queryOptions,\n}: FetchWorkflowProps<Workflow, TSelected>) => {\n const { api } = useAxios();\n\n const queryKey = [\"workflow\", id, workspace];\n\n const query = useEntityQuery<Workflow, TSelected>({\n queryKey,\n fetchEntity: (signal) => getWorkflow(api, id, workspace, signal),\n select,\n enabled: Boolean(id),\n configError: workspace ? undefined : missingWorkspaceError(\"useFetchWorkflow\"),\n queryOptions,\n });\n\n return { ...query, queryKey };\n};\n"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAa,oBAA0C,EACnD,IACA,WACA,QACA,mBAC2C;CAC3C,MAAM,EAAE,QAAQ,SAAS;CAEzB,MAAM,WAAW;EAAC;EAAY;EAAI;CAAS;CAW3C,OAAO;EAAE,GATK,eAAoC;GAC9C;GACA,cAAc,WAAW,YAAY,KAAK,IAAI,WAAW,MAAM;GAC/D;GACA,SAAS,QAAQ,EAAE;GACnB,aAAa,YAAY,KAAA,IAAY,sBAAsB,kBAAkB;GAC7E;EACJ,CAEY;EAAO;CAAS;AAChC"}
|