@everysk/apps-sdk 0.2.0 → 0.3.0-beta-20261019175049
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 +342 -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/msw/fakeApi.d.ts +43 -0
- package/dist/test/msw/fakeApi.d.ts.map +1 -0
- package/dist/test/msw/fakeApi.js +74 -0
- package/dist/test/msw/fakeApi.js.map +1 -0
- package/dist/test/msw/handlers.d.ts +20 -0
- package/dist/test/msw/handlers.d.ts.map +1 -0
- package/dist/test/msw/handlers.js +279 -0
- package/dist/test/msw/handlers.js.map +1 -0
- package/dist/test/msw/index.d.ts +5 -0
- package/dist/test/msw/index.d.ts.map +1 -0
- package/dist/test/msw/index.js +2 -0
- package/dist/test/msw/query.d.ts +34 -0
- package/dist/test/msw/query.d.ts.map +1 -0
- package/dist/test/msw/query.js +96 -0
- package/dist/test/msw/query.js.map +1 -0
- package/dist/test/msw/recorder.d.ts +30 -0
- package/dist/test/msw/recorder.d.ts.map +1 -0
- package/dist/test/msw/recorder.js +65 -0
- package/dist/test/msw/recorder.js.map +1 -0
- package/dist/test/msw/store.d.ts +57 -0
- package/dist/test/msw/store.d.ts.map +1 -0
- package/dist/test/msw/store.js +145 -0
- package/dist/test/msw/store.js.map +1 -0
- 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 +10 -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/msw/fakeApi.ts +83 -0
- package/src/test/msw/handlers.ts +350 -0
- package/src/test/msw/index.ts +9 -0
- package/src/test/msw/query.ts +134 -0
- package/src/test/msw/recorder.ts +88 -0
- package/src/test/msw/store.ts +182 -0
- 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
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { DEV_PROFILE } from "@/api/profile";
|
|
2
|
+
import type { WebsocketsConfig } from "@/api/websocketsConfig";
|
|
3
|
+
import type { Datastore } from "@/types/datastore";
|
|
4
|
+
import type { EveryskFile } from "@/types/file";
|
|
5
|
+
import type { Portfolio } from "@/types/portfolio";
|
|
6
|
+
import type { Profile } from "@/types/profile";
|
|
7
|
+
import type { Workflow, WorkflowExecution, WorkerExecution } from "@/types/workflow";
|
|
8
|
+
import type { Workspace } from "@/types/workspace";
|
|
9
|
+
|
|
10
|
+
/** What the fake API holds. A test seeds it and reads it back after a write. */
|
|
11
|
+
export type FakeApiStore = {
|
|
12
|
+
datastores: Datastore[];
|
|
13
|
+
files: EveryskFile[];
|
|
14
|
+
portfolios: Portfolio[];
|
|
15
|
+
workflows: Workflow[];
|
|
16
|
+
workflowExecutions: WorkflowExecution[];
|
|
17
|
+
workerExecutions: WorkerExecution[];
|
|
18
|
+
workspaces: Workspace[];
|
|
19
|
+
profile: Profile;
|
|
20
|
+
websocketsConfig: WebsocketsConfig;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** What a test seeds: partial records, each completed with what its type requires. */
|
|
24
|
+
export type FakeApiSeed = {
|
|
25
|
+
datastores?: Partial<Datastore>[];
|
|
26
|
+
files?: Partial<EveryskFile>[];
|
|
27
|
+
portfolios?: Partial<Portfolio>[];
|
|
28
|
+
workflows?: Partial<Workflow>[];
|
|
29
|
+
workflowExecutions?: Partial<WorkflowExecution>[];
|
|
30
|
+
workerExecutions?: Partial<WorkerExecution>[];
|
|
31
|
+
workspaces?: (Partial<Workspace> & { name: string })[];
|
|
32
|
+
profile?: Profile;
|
|
33
|
+
websocketsConfig?: WebsocketsConfig;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const newId = (prefix: string) =>
|
|
37
|
+
`${prefix}_${Array.from({ length: 25 }, () => Math.floor(Math.random() * 36).toString(36)).join("")}`;
|
|
38
|
+
|
|
39
|
+
/** The hex of a version-4 UUID, as a file's stored `url` is (`RE_FILE_URL`). */
|
|
40
|
+
export const newFileHash = () => crypto.randomUUID().replaceAll("-", "");
|
|
41
|
+
|
|
42
|
+
export const nowSeconds = () => Math.floor(Date.now() / 1000);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The fields each type requires and a test left out. `workspace` is `main`, as the API's create
|
|
46
|
+
* defaults it; the rest are blank, empty or zero rather than invented values.
|
|
47
|
+
*/
|
|
48
|
+
export const complete = {
|
|
49
|
+
datastore: (d: Partial<Datastore>): Datastore => ({
|
|
50
|
+
name: "",
|
|
51
|
+
workspace: "main",
|
|
52
|
+
data: [],
|
|
53
|
+
date_time: "",
|
|
54
|
+
...d,
|
|
55
|
+
id: d.id ?? newId("dats"),
|
|
56
|
+
}),
|
|
57
|
+
file: (f: Partial<EveryskFile>): EveryskFile => {
|
|
58
|
+
const hash = f.hash ?? newFileHash();
|
|
59
|
+
return {
|
|
60
|
+
name: "",
|
|
61
|
+
workspace: "main",
|
|
62
|
+
content_type: "",
|
|
63
|
+
version: "",
|
|
64
|
+
link_uid: null,
|
|
65
|
+
data: null,
|
|
66
|
+
...f,
|
|
67
|
+
hash,
|
|
68
|
+
url: f.url ?? `/file/${hash}`,
|
|
69
|
+
id: f.id ?? newId("file"),
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
portfolio: (p: Partial<Portfolio>): Portfolio => ({
|
|
73
|
+
workspace: "main",
|
|
74
|
+
base_currency: "",
|
|
75
|
+
securities: [],
|
|
76
|
+
date: "",
|
|
77
|
+
...p,
|
|
78
|
+
id: p.id ?? newId("port"),
|
|
79
|
+
}),
|
|
80
|
+
workflow: (w: Partial<Workflow>): Workflow => ({
|
|
81
|
+
name: "",
|
|
82
|
+
workspace: "main",
|
|
83
|
+
description: "",
|
|
84
|
+
tags: [],
|
|
85
|
+
status: "",
|
|
86
|
+
created: 0,
|
|
87
|
+
updated: 0,
|
|
88
|
+
version: "",
|
|
89
|
+
trigger_enabled: false,
|
|
90
|
+
trigger_type: "",
|
|
91
|
+
trigger_config: {},
|
|
92
|
+
starter_worker_id: "",
|
|
93
|
+
ender_worker_id: "",
|
|
94
|
+
...w,
|
|
95
|
+
id: w.id ?? newId("wrkf"),
|
|
96
|
+
}),
|
|
97
|
+
workflowExecution: (e: Partial<WorkflowExecution>): WorkflowExecution => ({
|
|
98
|
+
workflow_id: "",
|
|
99
|
+
workflow_name: "",
|
|
100
|
+
workspace: "main",
|
|
101
|
+
status: "",
|
|
102
|
+
run_status: "",
|
|
103
|
+
duration: 0,
|
|
104
|
+
real_execution_time: 0,
|
|
105
|
+
total_execution_time: 0,
|
|
106
|
+
started: 0,
|
|
107
|
+
created: 0,
|
|
108
|
+
updated: 0,
|
|
109
|
+
trigger: "",
|
|
110
|
+
started_worker_id: "",
|
|
111
|
+
ender_worker_id: "",
|
|
112
|
+
ender_worker_execution_id: "",
|
|
113
|
+
resume: null,
|
|
114
|
+
version: "",
|
|
115
|
+
...e,
|
|
116
|
+
id: e.id ?? newId("wfex"),
|
|
117
|
+
}),
|
|
118
|
+
workerExecution: (e: Partial<WorkerExecution>): WorkerExecution =>
|
|
119
|
+
({
|
|
120
|
+
status: "",
|
|
121
|
+
worker_id: "",
|
|
122
|
+
worker_name: "",
|
|
123
|
+
worker_type: "",
|
|
124
|
+
workflow_execution_id: "",
|
|
125
|
+
workflow_id: "",
|
|
126
|
+
workflow_name: "",
|
|
127
|
+
trigger: "",
|
|
128
|
+
created: 0,
|
|
129
|
+
updated: 0,
|
|
130
|
+
started: 0,
|
|
131
|
+
duration: 0,
|
|
132
|
+
cpu_time: 0,
|
|
133
|
+
result: {},
|
|
134
|
+
input_params: {},
|
|
135
|
+
...e,
|
|
136
|
+
id: e.id ?? newId("wkex"),
|
|
137
|
+
}) as WorkerExecution,
|
|
138
|
+
workspace: (w: Partial<Workspace> & { name: string }): Workspace => ({
|
|
139
|
+
group: null,
|
|
140
|
+
description: "",
|
|
141
|
+
version: "",
|
|
142
|
+
created: 0,
|
|
143
|
+
updated: 0,
|
|
144
|
+
...w,
|
|
145
|
+
}),
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const EMPTY_WEBSOCKETS_CONFIG: WebsocketsConfig = {
|
|
149
|
+
appConnectionURL: "",
|
|
150
|
+
appChannelID: "",
|
|
151
|
+
everyskUID: "",
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/** An empty store: no records, the SDK's dev profile, a blank websocket config. */
|
|
155
|
+
export const emptyStore = (): FakeApiStore => ({
|
|
156
|
+
datastores: [],
|
|
157
|
+
files: [],
|
|
158
|
+
portfolios: [],
|
|
159
|
+
workflows: [],
|
|
160
|
+
workflowExecutions: [],
|
|
161
|
+
workerExecutions: [],
|
|
162
|
+
workspaces: [],
|
|
163
|
+
profile: structuredClone(DEV_PROFILE),
|
|
164
|
+
websocketsConfig: { ...EMPTY_WEBSOCKETS_CONFIG },
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
/** The store a seed describes: each record completed, everything not seeded empty. */
|
|
168
|
+
export const storeFrom = (seed: FakeApiSeed): FakeApiStore => {
|
|
169
|
+
const data = structuredClone(seed);
|
|
170
|
+
const empty = emptyStore();
|
|
171
|
+
return {
|
|
172
|
+
datastores: (data.datastores ?? []).map(complete.datastore),
|
|
173
|
+
files: (data.files ?? []).map(complete.file),
|
|
174
|
+
portfolios: (data.portfolios ?? []).map(complete.portfolio),
|
|
175
|
+
workflows: (data.workflows ?? []).map(complete.workflow),
|
|
176
|
+
workflowExecutions: (data.workflowExecutions ?? []).map(complete.workflowExecution),
|
|
177
|
+
workerExecutions: (data.workerExecutions ?? []).map(complete.workerExecution),
|
|
178
|
+
workspaces: (data.workspaces ?? []).map(complete.workspace),
|
|
179
|
+
profile: data.profile ?? empty.profile,
|
|
180
|
+
websocketsConfig: data.websocketsConfig ?? empty.websocketsConfig,
|
|
181
|
+
};
|
|
182
|
+
};
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import userEvent from "@testing-library/user-event";
|
|
10
10
|
import { QueryClient } from "@tanstack/react-query";
|
|
11
11
|
|
|
12
|
-
import { EveryskApp, type
|
|
12
|
+
import { EveryskApp, type ProviderEntry } from "@/EveryskApp";
|
|
13
13
|
import type { AnyRecord } from "@/types/anyRecord";
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -39,14 +39,19 @@ export function createTestQueryClient(): QueryClient {
|
|
|
39
39
|
type ProviderOptions = {
|
|
40
40
|
queryClient?: QueryClient;
|
|
41
41
|
/** Extra providers, mounted inside the core tree and around the subject. */
|
|
42
|
-
providers?:
|
|
42
|
+
providers?: ProviderEntry[];
|
|
43
43
|
/** Injected instead of `window.APP_ID`, so a test needs no page globals. */
|
|
44
44
|
appId?: string | null;
|
|
45
45
|
/** Injected instead of `window.APP_CONFIG`. */
|
|
46
46
|
appEnvironmentVar?: AnyRecord;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
const buildWrapper = ({
|
|
49
|
+
const buildWrapper = ({
|
|
50
|
+
queryClient,
|
|
51
|
+
providers,
|
|
52
|
+
appId,
|
|
53
|
+
appEnvironmentVar,
|
|
54
|
+
}: ProviderOptions & {
|
|
50
55
|
queryClient: QueryClient;
|
|
51
56
|
}) =>
|
|
52
57
|
function Wrapper({ children }: { children?: React.ReactNode }) {
|
package/src/test/setup.ts
CHANGED
|
@@ -5,31 +5,31 @@ import "@testing-library/jest-dom/vitest";
|
|
|
5
5
|
|
|
6
6
|
// Unmount React trees and clear the jsdom document between tests so they stay isolated.
|
|
7
7
|
afterEach(() => {
|
|
8
|
-
|
|
8
|
+
cleanup();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
// jsdom does not implement matchMedia; MUI's `useMediaQuery` needs it. The theme no longer
|
|
12
12
|
// reads it — it is pinned to the brand dark theme — but responsive components still do.
|
|
13
13
|
if (!window.matchMedia) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
window.matchMedia = vi.fn().mockImplementation((query: string) => ({
|
|
15
|
+
matches: false,
|
|
16
|
+
media: query,
|
|
17
|
+
onchange: null,
|
|
18
|
+
addListener: vi.fn(),
|
|
19
|
+
removeListener: vi.fn(),
|
|
20
|
+
addEventListener: vi.fn(),
|
|
21
|
+
removeEventListener: vi.fn(),
|
|
22
|
+
dispatchEvent: vi.fn(),
|
|
23
|
+
}));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// jsdom does not implement ResizeObserver; several MUI components observe their container.
|
|
27
27
|
if (!globalThis.ResizeObserver) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
globalThis.ResizeObserver = class {
|
|
29
|
+
observe(): void {}
|
|
30
|
+
unobserve(): void {}
|
|
31
|
+
disconnect(): void {}
|
|
32
|
+
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// The template stubbed `BroadcastChannel` here, which jsdom does not implement. Nothing in
|
package/src/theme/index.ts
CHANGED
|
@@ -12,4 +12,4 @@ export { EveryskDarkTheme } from "./themes/EveryskDark";
|
|
|
12
12
|
export { DefaultLightTheme } from "./themes/DefaultLight";
|
|
13
13
|
export { DefaultDarkTheme } from "./themes/DefaultDark";
|
|
14
14
|
export { MidnightEmberTheme } from "./themes/MidnightEmber";
|
|
15
|
-
export {
|
|
15
|
+
export { componentOverrides } from "./overrides";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Components, Theme } from "@mui/material/styles";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {} from "@mui/x-date-pickers/themeAugmentation";
|
|
4
4
|
|
|
5
5
|
import { MuiCssBaseline } from "./muiCssBaseline";
|
|
6
6
|
import { MuiDatePicker } from "./muiDatePicker";
|
|
@@ -15,9 +15,11 @@ import { MuiButton } from "./muiButton";
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Shared MUI component overrides applied by every theme (light, dark and branded).
|
|
18
|
-
* They read `theme.palette.mode`, so the same set works for any palette.
|
|
18
|
+
* They read `theme.palette.mode`, so the same set works for any palette. Public as
|
|
19
|
+
* `componentOverrides` for an app that builds its own theme; `components` alone, at the root of
|
|
20
|
+
* the package, did not say whose components.
|
|
19
21
|
*/
|
|
20
|
-
export const
|
|
22
|
+
export const componentOverrides: Components<Omit<Theme, "components">> = {
|
|
21
23
|
MuiCssBaseline,
|
|
22
24
|
MuiDatePicker,
|
|
23
25
|
MuiTextField,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Components, Theme } from
|
|
1
|
+
import type { Components, Theme } from "@mui/material/styles";
|
|
2
2
|
|
|
3
|
-
export const MuiButton: Components<Theme>[
|
|
3
|
+
export const MuiButton: Components<Theme>["MuiButton"] = {
|
|
4
4
|
defaultProps: {
|
|
5
|
-
size:
|
|
5
|
+
size: "small",
|
|
6
6
|
},
|
|
7
7
|
};
|
|
@@ -9,27 +9,26 @@ export const MuiCssBaseline = {
|
|
|
9
9
|
},
|
|
10
10
|
"*::-webkit-scrollbar-thumb": {
|
|
11
11
|
borderRadius: 10,
|
|
12
|
-
backgroundColor:
|
|
13
|
-
|
|
12
|
+
backgroundColor: "#959595",
|
|
14
13
|
},
|
|
15
14
|
"*::-webkit-scrollbar-thumb:hover ": {
|
|
16
|
-
backgroundColor:
|
|
15
|
+
backgroundColor: "#959595",
|
|
17
16
|
},
|
|
18
17
|
"*:hover::-webkit-scrollbar-thumb": {
|
|
19
|
-
backgroundColor:
|
|
18
|
+
backgroundColor: "#959595",
|
|
20
19
|
},
|
|
21
20
|
|
|
22
21
|
"*::-webkit-scrollbar-thumb:active": {
|
|
23
|
-
backgroundColor: theme.palette.primary.main
|
|
22
|
+
backgroundColor: theme.palette.primary.main,
|
|
24
23
|
},
|
|
25
24
|
|
|
26
25
|
"*::-moz-selection": {
|
|
27
|
-
color:
|
|
28
|
-
backgroundColor: theme.palette.primary.main
|
|
26
|
+
color: theme.palette.mode === "dark" ? colors.common.black : colors.common.white,
|
|
27
|
+
backgroundColor: theme.palette.primary.main,
|
|
29
28
|
},
|
|
30
29
|
"*::selection": {
|
|
31
|
-
color:
|
|
32
|
-
backgroundColor: theme.palette.primary.main
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
}
|
|
30
|
+
color: theme.palette.mode === "dark" ? colors.common.black : colors.common.white,
|
|
31
|
+
backgroundColor: theme.palette.primary.main,
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Components, Theme } from
|
|
1
|
+
import type { Components, Theme } from "@mui/material/styles";
|
|
2
2
|
|
|
3
|
-
export const MuiIconButton: Components<Theme>[
|
|
3
|
+
export const MuiIconButton: Components<Theme>["MuiIconButton"] = {
|
|
4
4
|
defaultProps: {
|
|
5
|
-
size:
|
|
5
|
+
size: "small",
|
|
6
6
|
},
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Components, Theme } from
|
|
1
|
+
import type { Components, Theme } from "@mui/material/styles";
|
|
2
2
|
|
|
3
|
-
export const MuiToggleButton: Components<Theme>[
|
|
3
|
+
export const MuiToggleButton: Components<Theme>["MuiToggleButton"] = {
|
|
4
4
|
defaultProps: {
|
|
5
|
-
size:
|
|
5
|
+
size: "small",
|
|
6
6
|
},
|
|
7
|
-
};
|
|
7
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Components, Theme } from
|
|
1
|
+
import type { Components, Theme } from "@mui/material/styles";
|
|
2
2
|
|
|
3
|
-
export const MuiToggleButtonGroup: Components<Theme>[
|
|
3
|
+
export const MuiToggleButtonGroup: Components<Theme>["MuiToggleButtonGroup"] = {
|
|
4
4
|
defaultProps: {
|
|
5
|
-
size:
|
|
5
|
+
size: "small",
|
|
6
6
|
},
|
|
7
|
-
};
|
|
7
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTheme, type Theme } from "@mui/material/styles";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { componentOverrides } from "@/theme/overrides";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Neutral dark theme. Uses MUI's default palette (no brand color) plus the
|
|
@@ -10,5 +10,5 @@ export const DefaultDarkTheme: Theme = createTheme({
|
|
|
10
10
|
palette: {
|
|
11
11
|
mode: "dark",
|
|
12
12
|
},
|
|
13
|
-
components,
|
|
13
|
+
components: componentOverrides,
|
|
14
14
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTheme, type Theme } from "@mui/material/styles";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { componentOverrides } from "@/theme/overrides";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Neutral light theme. Uses MUI's default palette (no brand color) plus the
|
|
@@ -10,5 +10,5 @@ export const DefaultLightTheme: Theme = createTheme({
|
|
|
10
10
|
palette: {
|
|
11
11
|
mode: "light",
|
|
12
12
|
},
|
|
13
|
-
components,
|
|
13
|
+
components: componentOverrides,
|
|
14
14
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTheme, type Theme } from "@mui/material/styles";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { componentOverrides } from "@/theme/overrides";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Everysk Dark — the theme every Everysk app runs with.
|
|
@@ -58,5 +58,5 @@ export const EveryskDarkTheme: Theme = createTheme({
|
|
|
58
58
|
shape: {
|
|
59
59
|
borderRadius: 8,
|
|
60
60
|
},
|
|
61
|
-
components,
|
|
61
|
+
components: componentOverrides,
|
|
62
62
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTheme, type Theme } from "@mui/material/styles";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { componentOverrides } from "@/theme/overrides";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Everysk Light — the light twin of {@link EveryskDarkTheme}.
|
|
@@ -64,5 +64,5 @@ export const EveryskLightTheme: Theme = createTheme({
|
|
|
64
64
|
shape: {
|
|
65
65
|
borderRadius: 8,
|
|
66
66
|
},
|
|
67
|
-
components,
|
|
67
|
+
components: componentOverrides,
|
|
68
68
|
});
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { createTheme, type Theme } from "@mui/material/styles";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { componentOverrides } from "@/theme/overrides";
|
|
4
4
|
|
|
5
5
|
export const MidnightEmberTheme: Theme = createTheme({
|
|
6
6
|
palette: {
|
|
7
|
-
mode:
|
|
7
|
+
mode: "dark",
|
|
8
8
|
primary: {
|
|
9
|
-
main:
|
|
10
|
-
dark:
|
|
11
|
-
light:
|
|
12
|
-
contrastText:
|
|
9
|
+
main: "#F97316",
|
|
10
|
+
dark: "#EA580C",
|
|
11
|
+
light: "#FDBA74",
|
|
12
|
+
contrastText: "#020617",
|
|
13
13
|
},
|
|
14
14
|
secondary: {
|
|
15
|
-
main:
|
|
16
|
-
dark:
|
|
17
|
-
light:
|
|
18
|
-
contrastText:
|
|
15
|
+
main: "#94A3B8",
|
|
16
|
+
dark: "#64748B",
|
|
17
|
+
light: "#CBD5F5",
|
|
18
|
+
contrastText: "#020617",
|
|
19
19
|
},
|
|
20
20
|
background: {
|
|
21
|
-
default:
|
|
22
|
-
paper:
|
|
21
|
+
default: "#020617",
|
|
22
|
+
paper: "#0B1120",
|
|
23
23
|
},
|
|
24
24
|
text: {
|
|
25
|
-
primary:
|
|
25
|
+
primary: "#F9FAFB",
|
|
26
26
|
},
|
|
27
|
-
divider:
|
|
27
|
+
divider: "rgba(148, 163, 184, 0.25)",
|
|
28
28
|
},
|
|
29
|
-
components,
|
|
29
|
+
components: componentOverrides,
|
|
30
30
|
});
|
package/src/types/anyRecord.ts
CHANGED
package/src/types/datastore.ts
CHANGED
|
@@ -1,33 +1,67 @@
|
|
|
1
1
|
import type { AnyRecord } from "./anyRecord";
|
|
2
|
-
import type {
|
|
2
|
+
import type { EntityListResponse } from "./entityQuery";
|
|
3
|
+
import type { DatastoreDataFormat } from "./datastoreDataFormat";
|
|
3
4
|
|
|
4
5
|
export type DatastoreRow = string | number | null;
|
|
6
|
+
|
|
7
|
+
/** A tabular datastore's content: a matrix whose first row names the columns. */
|
|
5
8
|
export type DatastoreData = DatastoreRow[][];
|
|
6
9
|
|
|
7
10
|
export type Datastore = {
|
|
8
|
-
updated?: number
|
|
9
|
-
created?: number
|
|
10
|
-
|
|
11
|
-
id: string
|
|
12
|
-
name: string
|
|
13
|
-
date?: string
|
|
14
|
-
version?: string
|
|
15
|
-
description?: string
|
|
16
|
-
|
|
17
|
-
tags?: string[]
|
|
18
|
-
link_uid?: string
|
|
19
|
-
workspace: string
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
updated?: number;
|
|
12
|
+
created?: number;
|
|
13
|
+
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
date?: string;
|
|
17
|
+
version?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
|
|
20
|
+
tags?: string[];
|
|
21
|
+
link_uid?: string;
|
|
22
|
+
workspace: string;
|
|
23
|
+
/**
|
|
24
|
+
* A matrix for a tabular datastore; an object or an array of objects for a JSON one. The API
|
|
25
|
+
* does not say which, so the shape is the only signal: an array whose every element is an
|
|
26
|
+
* array is a table. The API has returned `[{ … }]` for a JSON one, an array without being a
|
|
27
|
+
* table.
|
|
28
|
+
*/
|
|
29
|
+
data: DatastoreData | AnyRecord | AnyRecord[];
|
|
30
|
+
date_time: string;
|
|
31
|
+
level?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** A tabular datastore as the hooks return it: the matrix converted to row objects. */
|
|
35
|
+
export type TableDatastore = Omit<Datastore, "data"> & {
|
|
36
|
+
format: "table";
|
|
26
37
|
data: AnyRecord[];
|
|
38
|
+
/**
|
|
39
|
+
* The column names in the datastore's own order, from the header row the conversion to
|
|
40
|
+
* objects drops. Saving back needs it — `toDatastoreMatrix(datastore)` uses it — rather
|
|
41
|
+
* than rebuilding the order from object keys and leaving out the `datastoreId` the SDK adds.
|
|
42
|
+
* Empty when the read projects `data` away.
|
|
43
|
+
*/
|
|
44
|
+
fields: string[];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** A JSON datastore as the hooks return it: its object or array of objects, untouched. */
|
|
48
|
+
export type JsonDatastore = Omit<Datastore, "data"> & {
|
|
49
|
+
format: "json";
|
|
50
|
+
data: AnyRecord | AnyRecord[];
|
|
27
51
|
};
|
|
28
52
|
|
|
29
|
-
|
|
53
|
+
/**
|
|
54
|
+
* A datastore as the hooks return it: its `data` read and classified by `parseDatastore`. Narrow
|
|
55
|
+
* on `format` (or with `isTableDatastore`) before reading `data` as rows: a list can mix both
|
|
56
|
+
* kinds. `F` is the `dataFormat` the hook read with. It was `DatastoreWithRows`, a name from
|
|
57
|
+
* before JSON datastores, which carry no rows.
|
|
58
|
+
*/
|
|
59
|
+
export type ParsedDatastore<F extends DatastoreDataFormat = "object"> =
|
|
60
|
+
| (F extends "matrix"
|
|
61
|
+
? // A tabular datastore read with `dataFormat: "matrix"`: its matrix unconverted, header row included,
|
|
62
|
+
// so it can be written back unchanged. Written in place: nothing refers to it by name.
|
|
63
|
+
Omit<TableDatastore, "data"> & { data: DatastoreData }
|
|
64
|
+
: TableDatastore)
|
|
65
|
+
| JsonDatastore;
|
|
30
66
|
|
|
31
67
|
export type DatastoreListResponse = EntityListResponse<"datastores", Datastore>;
|
|
32
|
-
|
|
33
|
-
export type DeleteDatastoreResponse = DeleteEntityResponse<"datastores">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the datastore hooks hand over a **tabular** datastore's `data`; a JSON datastore's is never
|
|
3
|
+
* converted. `"object"` (the default) is each row as an object — a list of them, not one
|
|
4
|
+
* object — which lets an app patch a row as `{ ...row, ...patch }`. `"matrix"` leaves the table's
|
|
5
|
+
* matrix unconverted, header row included. A value rather than a conversion function, so it can
|
|
6
|
+
* be part of the cache key.
|
|
7
|
+
*
|
|
8
|
+
* Internal: no barrel re-exports this file. An app never writes the name — `dataFormat` is
|
|
9
|
+
* inferred from the value it passes — so it stays out of the public types, and exists only so
|
|
10
|
+
* the SDK does not repeat the union in every generic.
|
|
11
|
+
*/
|
|
12
|
+
export type DatastoreDataFormat = "object" | "matrix";
|