@everysk/apps-sdk 0.1.0-beta.0
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/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/EveryskApp.d.ts +73 -0
- package/dist/EveryskApp.d.ts.map +1 -0
- package/dist/EveryskApp.js +66 -0
- package/dist/EveryskApp.js.map +1 -0
- package/dist/agGrid/agGridTheme.d.ts +77 -0
- package/dist/agGrid/agGridTheme.d.ts.map +1 -0
- package/dist/agGrid/agGridTheme.js +88 -0
- package/dist/agGrid/agGridTheme.js.map +1 -0
- package/dist/agGrid/index.d.ts +4 -0
- package/dist/agGrid/index.d.ts.map +1 -0
- package/dist/agGrid/index.js +3 -0
- package/dist/api/datastore.d.ts +68 -0
- package/dist/api/datastore.d.ts.map +1 -0
- package/dist/api/datastore.js +125 -0
- package/dist/api/datastore.js.map +1 -0
- package/dist/api/entityQuery.d.ts +78 -0
- package/dist/api/entityQuery.d.ts.map +1 -0
- package/dist/api/entityQuery.js +100 -0
- package/dist/api/entityQuery.js.map +1 -0
- package/dist/api/file.d.ts +70 -0
- package/dist/api/file.d.ts.map +1 -0
- package/dist/api/file.js +126 -0
- package/dist/api/file.js.map +1 -0
- package/dist/api/portfolio.d.ts +67 -0
- package/dist/api/portfolio.d.ts.map +1 -0
- package/dist/api/portfolio.js +125 -0
- package/dist/api/portfolio.js.map +1 -0
- package/dist/api/profile.d.ts +40 -0
- package/dist/api/profile.d.ts.map +1 -0
- package/dist/api/profile.js +71 -0
- package/dist/api/profile.js.map +1 -0
- package/dist/api/websocketsConfig.d.ts +13 -0
- package/dist/api/websocketsConfig.d.ts.map +1 -0
- package/dist/api/websocketsConfig.js +25 -0
- package/dist/api/websocketsConfig.js.map +1 -0
- package/dist/api/workflow.d.ts +154 -0
- package/dist/api/workflow.d.ts.map +1 -0
- package/dist/api/workflow.js +289 -0
- package/dist/api/workflow.js.map +1 -0
- package/dist/api/workspace.d.ts +29 -0
- package/dist/api/workspace.d.ts.map +1 -0
- package/dist/api/workspace.js +54 -0
- package/dist/api/workspace.js.map +1 -0
- package/dist/components/ui/EveryskIcon/index.d.ts +5 -0
- package/dist/components/ui/EveryskIcon/index.d.ts.map +1 -0
- package/dist/components/ui/EveryskIcon/index.js +25 -0
- package/dist/components/ui/EveryskIcon/index.js.map +1 -0
- package/dist/components/ui/Footer/index.d.ts +5 -0
- package/dist/components/ui/Footer/index.d.ts.map +1 -0
- package/dist/components/ui/Footer/index.js +23 -0
- package/dist/components/ui/Footer/index.js.map +1 -0
- package/dist/components/ui/GlobalLoading/index.d.ts +8 -0
- package/dist/components/ui/GlobalLoading/index.d.ts.map +1 -0
- package/dist/components/ui/GlobalLoading/index.js +42 -0
- package/dist/components/ui/GlobalLoading/index.js.map +1 -0
- package/dist/components/ui/PageContainer/index.d.ts +7 -0
- package/dist/components/ui/PageContainer/index.d.ts.map +1 -0
- package/dist/components/ui/PageContainer/index.js +20 -0
- package/dist/components/ui/PageContainer/index.js.map +1 -0
- package/dist/components/ui/Toolbar/index.d.ts +5 -0
- package/dist/components/ui/Toolbar/index.d.ts.map +1 -0
- package/dist/components/ui/Toolbar/index.js +32 -0
- package/dist/components/ui/Toolbar/index.js.map +1 -0
- package/dist/contexts/agGridLicenseContext/provider.d.ts +51 -0
- package/dist/contexts/agGridLicenseContext/provider.d.ts.map +1 -0
- package/dist/contexts/agGridLicenseContext/provider.js +58 -0
- package/dist/contexts/agGridLicenseContext/provider.js.map +1 -0
- package/dist/contexts/appAlertContext/index.d.ts +3 -0
- package/dist/contexts/appAlertContext/index.d.ts.map +1 -0
- package/dist/contexts/appAlertContext/index.js +7 -0
- package/dist/contexts/appAlertContext/index.js.map +1 -0
- package/dist/contexts/appAlertContext/provider.d.ts +40 -0
- package/dist/contexts/appAlertContext/provider.d.ts.map +1 -0
- package/dist/contexts/appAlertContext/provider.js +96 -0
- package/dist/contexts/appAlertContext/provider.js.map +1 -0
- package/dist/contexts/appAlertContext/types.d.ts +15 -0
- package/dist/contexts/appAlertContext/types.d.ts.map +1 -0
- package/dist/contexts/appAlertContext/useAppAlert.d.ts +30 -0
- package/dist/contexts/appAlertContext/useAppAlert.d.ts.map +1 -0
- package/dist/contexts/appAlertContext/useAppAlert.js +40 -0
- package/dist/contexts/appAlertContext/useAppAlert.js.map +1 -0
- package/dist/contexts/appConfigContext/index.d.ts +3 -0
- package/dist/contexts/appConfigContext/index.d.ts.map +1 -0
- package/dist/contexts/appConfigContext/index.js +7 -0
- package/dist/contexts/appConfigContext/index.js.map +1 -0
- package/dist/contexts/appConfigContext/provider.d.ts +45 -0
- package/dist/contexts/appConfigContext/provider.d.ts.map +1 -0
- package/dist/contexts/appConfigContext/provider.js +63 -0
- package/dist/contexts/appConfigContext/provider.js.map +1 -0
- package/dist/contexts/appConfigContext/types.d.ts +28 -0
- package/dist/contexts/appConfigContext/types.d.ts.map +1 -0
- package/dist/contexts/appConfigContext/useAppConfig.d.ts +20 -0
- package/dist/contexts/appConfigContext/useAppConfig.d.ts.map +1 -0
- package/dist/contexts/appConfigContext/useAppConfig.js +30 -0
- package/dist/contexts/appConfigContext/useAppConfig.js.map +1 -0
- package/dist/contexts/webSocketContext/constants.d.ts +4 -0
- package/dist/contexts/webSocketContext/constants.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/constants.js +8 -0
- package/dist/contexts/webSocketContext/constants.js.map +1 -0
- package/dist/contexts/webSocketContext/handler.d.ts +43 -0
- package/dist/contexts/webSocketContext/handler.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/handler.js +87 -0
- package/dist/contexts/webSocketContext/handler.js.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useAppNotificationSubscription/index.d.ts +19 -0
- package/dist/contexts/webSocketContext/hooks/useAppNotificationSubscription/index.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useAppNotificationSubscription/index.js +31 -0
- package/dist/contexts/webSocketContext/hooks/useAppNotificationSubscription/index.js.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.d.ts +11 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.js +21 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.js.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocketSubscription/index.d.ts +30 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocketSubscription/index.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocketSubscription/index.js +44 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocketSubscription/index.js.map +1 -0
- package/dist/contexts/webSocketContext/index.d.ts +3 -0
- package/dist/contexts/webSocketContext/index.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/index.js +7 -0
- package/dist/contexts/webSocketContext/index.js.map +1 -0
- package/dist/contexts/webSocketContext/provider.d.ts +39 -0
- package/dist/contexts/webSocketContext/provider.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/provider.js +121 -0
- package/dist/contexts/webSocketContext/provider.js.map +1 -0
- package/dist/contexts/webSocketContext/types.d.ts +41 -0
- package/dist/contexts/webSocketContext/types.d.ts.map +1 -0
- package/dist/datastore/index.d.ts +7 -0
- package/dist/datastore/index.d.ts.map +1 -0
- package/dist/file/index.d.ts +6 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/hooks/datastore/useDatastoreMutations.d.ts +151 -0
- package/dist/hooks/datastore/useDatastoreMutations.d.ts.map +1 -0
- package/dist/hooks/datastore/useDatastoreMutations.js +198 -0
- package/dist/hooks/datastore/useDatastoreMutations.js.map +1 -0
- package/dist/hooks/datastore/useFetchDatastore.d.ts +205 -0
- package/dist/hooks/datastore/useFetchDatastore.d.ts.map +1 -0
- package/dist/hooks/datastore/useFetchDatastore.js +85 -0
- package/dist/hooks/datastore/useFetchDatastore.js.map +1 -0
- package/dist/hooks/datastore/useFetchDatastores.d.ts +70 -0
- package/dist/hooks/datastore/useFetchDatastores.d.ts.map +1 -0
- package/dist/hooks/datastore/useFetchDatastores.js +105 -0
- package/dist/hooks/datastore/useFetchDatastores.js.map +1 -0
- package/dist/hooks/file/useFetchFile.d.ts +212 -0
- package/dist/hooks/file/useFetchFile.d.ts.map +1 -0
- package/dist/hooks/file/useFetchFile.js +87 -0
- package/dist/hooks/file/useFetchFile.js.map +1 -0
- package/dist/hooks/file/useFetchFiles.d.ts +60 -0
- package/dist/hooks/file/useFetchFiles.d.ts.map +1 -0
- package/dist/hooks/file/useFetchFiles.js +89 -0
- package/dist/hooks/file/useFetchFiles.js.map +1 -0
- package/dist/hooks/file/useFileMutations.d.ts +161 -0
- package/dist/hooks/file/useFileMutations.d.ts.map +1 -0
- package/dist/hooks/file/useFileMutations.js +208 -0
- package/dist/hooks/file/useFileMutations.js.map +1 -0
- package/dist/hooks/portfolio/useFetchPortfolio.d.ts +210 -0
- package/dist/hooks/portfolio/useFetchPortfolio.d.ts.map +1 -0
- package/dist/hooks/portfolio/useFetchPortfolio.js +85 -0
- package/dist/hooks/portfolio/useFetchPortfolio.js.map +1 -0
- package/dist/hooks/portfolio/useFetchPortfolios.d.ts +60 -0
- package/dist/hooks/portfolio/useFetchPortfolios.d.ts.map +1 -0
- package/dist/hooks/portfolio/useFetchPortfolios.js +89 -0
- package/dist/hooks/portfolio/useFetchPortfolios.js.map +1 -0
- package/dist/hooks/portfolio/usePortfolioMutations.d.ts +171 -0
- package/dist/hooks/portfolio/usePortfolioMutations.d.ts.map +1 -0
- package/dist/hooks/portfolio/usePortfolioMutations.js +218 -0
- package/dist/hooks/portfolio/usePortfolioMutations.js.map +1 -0
- package/dist/hooks/profile/useFetchProfile.d.ts +206 -0
- package/dist/hooks/profile/useFetchProfile.d.ts.map +1 -0
- package/dist/hooks/profile/useFetchProfile.js +70 -0
- package/dist/hooks/profile/useFetchProfile.js.map +1 -0
- package/dist/hooks/useAxios.d.ts +40 -0
- package/dist/hooks/useAxios.d.ts.map +1 -0
- package/dist/hooks/useAxios.js +76 -0
- package/dist/hooks/useAxios.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkerExecution.d.ts +198 -0
- package/dist/hooks/workflow/useFetchWorkerExecution.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkerExecution.js +69 -0
- package/dist/hooks/workflow/useFetchWorkerExecution.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkerExecutions.d.ts +52 -0
- package/dist/hooks/workflow/useFetchWorkerExecutions.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkerExecutions.js +83 -0
- package/dist/hooks/workflow/useFetchWorkerExecutions.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflow.d.ts +195 -0
- package/dist/hooks/workflow/useFetchWorkflow.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflow.js +70 -0
- package/dist/hooks/workflow/useFetchWorkflow.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflowExecution.d.ts +198 -0
- package/dist/hooks/workflow/useFetchWorkflowExecution.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflowExecution.js +69 -0
- package/dist/hooks/workflow/useFetchWorkflowExecution.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflowExecutions.d.ts +49 -0
- package/dist/hooks/workflow/useFetchWorkflowExecutions.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflowExecutions.js +77 -0
- package/dist/hooks/workflow/useFetchWorkflowExecutions.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflows.d.ts +47 -0
- package/dist/hooks/workflow/useFetchWorkflows.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflows.js +67 -0
- package/dist/hooks/workflow/useFetchWorkflows.js.map +1 -0
- package/dist/hooks/workflow/useRunWorkflow.d.ts +30 -0
- package/dist/hooks/workflow/useRunWorkflow.d.ts.map +1 -0
- package/dist/hooks/workflow/useRunWorkflow.js +50 -0
- package/dist/hooks/workflow/useRunWorkflow.js.map +1 -0
- package/dist/hooks/workspace/useFetchWorkspace.d.ts +197 -0
- package/dist/hooks/workspace/useFetchWorkspace.d.ts.map +1 -0
- package/dist/hooks/workspace/useFetchWorkspace.js +65 -0
- package/dist/hooks/workspace/useFetchWorkspace.js.map +1 -0
- package/dist/hooks/workspace/useFetchWorkspaces.d.ts +46 -0
- package/dist/hooks/workspace/useFetchWorkspaces.d.ts.map +1 -0
- package/dist/hooks/workspace/useFetchWorkspaces.js +66 -0
- package/dist/hooks/workspace/useFetchWorkspaces.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +50 -0
- package/dist/lib/datastoreTable.d.ts +126 -0
- package/dist/lib/datastoreTable.d.ts.map +1 -0
- package/dist/lib/datastoreTable.js +146 -0
- package/dist/lib/datastoreTable.js.map +1 -0
- package/dist/lib/queryClient.d.ts +24 -0
- package/dist/lib/queryClient.d.ts.map +1 -0
- package/dist/lib/queryClient.js +48 -0
- package/dist/lib/queryClient.js.map +1 -0
- package/dist/portfolio/index.d.ts +6 -0
- package/dist/portfolio/index.d.ts.map +1 -0
- package/dist/profile/index.d.ts +4 -0
- package/dist/profile/index.d.ts.map +1 -0
- package/dist/socket/index.d.ts +10 -0
- package/dist/socket/index.d.ts.map +1 -0
- package/dist/socket/index.js +9 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +2 -0
- package/dist/test/mocks/agGridEnterprise.d.ts +38 -0
- package/dist/test/mocks/agGridEnterprise.d.ts.map +1 -0
- package/dist/test/mocks/agGridEnterprise.js +43 -0
- package/dist/test/mocks/agGridEnterprise.js.map +1 -0
- package/dist/test/mocks/agGridReact.d.ts +42 -0
- package/dist/test/mocks/agGridReact.d.ts.map +1 -0
- package/dist/test/mocks/agGridReact.js +47 -0
- package/dist/test/mocks/agGridReact.js.map +1 -0
- package/dist/test/mocks/index.d.ts +5 -0
- package/dist/test/mocks/index.d.ts.map +1 -0
- package/dist/test/mocks/index.js +4 -0
- package/dist/test/mocks/socketIoClient.d.ts +45 -0
- package/dist/test/mocks/socketIoClient.d.ts.map +1 -0
- package/dist/test/mocks/socketIoClient.js +54 -0
- package/dist/test/mocks/socketIoClient.js.map +1 -0
- package/dist/test/renderWithProviders.d.ts +107 -0
- package/dist/test/renderWithProviders.d.ts.map +1 -0
- package/dist/test/renderWithProviders.js +85 -0
- package/dist/test/renderWithProviders.js.map +1 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +25 -0
- package/dist/test/setup.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +12 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +22 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/index.d.ts +9 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/overrides/index.d.ts +7 -0
- package/dist/theme/overrides/index.d.ts.map +1 -0
- package/dist/theme/overrides/index.js +31 -0
- package/dist/theme/overrides/index.js.map +1 -0
- package/dist/theme/overrides/muiButton.d.ts +3 -0
- package/dist/theme/overrides/muiButton.d.ts.map +1 -0
- package/dist/theme/overrides/muiButton.js +6 -0
- package/dist/theme/overrides/muiButton.js.map +1 -0
- package/dist/theme/overrides/muiCssBaseline.d.ts +31 -0
- package/dist/theme/overrides/muiCssBaseline.d.ts.map +1 -0
- package/dist/theme/overrides/muiCssBaseline.js +27 -0
- package/dist/theme/overrides/muiCssBaseline.js.map +1 -0
- package/dist/theme/overrides/muiDatePicker.d.ts +10 -0
- package/dist/theme/overrides/muiDatePicker.d.ts.map +1 -0
- package/dist/theme/overrides/muiDatePicker.js +6 -0
- package/dist/theme/overrides/muiDatePicker.js.map +1 -0
- package/dist/theme/overrides/muiFormControl.d.ts +3 -0
- package/dist/theme/overrides/muiFormControl.d.ts.map +1 -0
- package/dist/theme/overrides/muiFormControl.js +6 -0
- package/dist/theme/overrides/muiFormControl.js.map +1 -0
- package/dist/theme/overrides/muiIconButton.d.ts +3 -0
- package/dist/theme/overrides/muiIconButton.d.ts.map +1 -0
- package/dist/theme/overrides/muiIconButton.js +6 -0
- package/dist/theme/overrides/muiIconButton.js.map +1 -0
- package/dist/theme/overrides/muiSelect.d.ts +3 -0
- package/dist/theme/overrides/muiSelect.d.ts.map +1 -0
- package/dist/theme/overrides/muiSelect.js +6 -0
- package/dist/theme/overrides/muiSelect.js.map +1 -0
- package/dist/theme/overrides/muiSvgIcon.d.ts +3 -0
- package/dist/theme/overrides/muiSvgIcon.d.ts.map +1 -0
- package/dist/theme/overrides/muiSvgIcon.js +6 -0
- package/dist/theme/overrides/muiSvgIcon.js.map +1 -0
- package/dist/theme/overrides/muiTextField.d.ts +3 -0
- package/dist/theme/overrides/muiTextField.d.ts.map +1 -0
- package/dist/theme/overrides/muiTextField.js +6 -0
- package/dist/theme/overrides/muiTextField.js.map +1 -0
- package/dist/theme/overrides/muiToggleButton.d.ts +3 -0
- package/dist/theme/overrides/muiToggleButton.d.ts.map +1 -0
- package/dist/theme/overrides/muiToggleButton.js +6 -0
- package/dist/theme/overrides/muiToggleButton.js.map +1 -0
- package/dist/theme/overrides/muiToggleButtonGroup.d.ts +3 -0
- package/dist/theme/overrides/muiToggleButtonGroup.d.ts.map +1 -0
- package/dist/theme/overrides/muiToggleButtonGroup.js +6 -0
- package/dist/theme/overrides/muiToggleButtonGroup.js.map +1 -0
- package/dist/theme/themes/DefaultDark.d.ts +7 -0
- package/dist/theme/themes/DefaultDark.d.ts.map +1 -0
- package/dist/theme/themes/DefaultDark.js +15 -0
- package/dist/theme/themes/DefaultDark.js.map +1 -0
- package/dist/theme/themes/DefaultLight.d.ts +7 -0
- package/dist/theme/themes/DefaultLight.d.ts.map +1 -0
- package/dist/theme/themes/DefaultLight.js +15 -0
- package/dist/theme/themes/DefaultLight.js.map +1 -0
- package/dist/theme/themes/EveryskDark.d.ts +15 -0
- package/dist/theme/themes/EveryskDark.d.ts.map +1 -0
- package/dist/theme/themes/EveryskDark.js +63 -0
- package/dist/theme/themes/EveryskDark.js.map +1 -0
- package/dist/theme/themes/EveryskLight.d.ts +21 -0
- package/dist/theme/themes/EveryskLight.d.ts.map +1 -0
- package/dist/theme/themes/EveryskLight.js +69 -0
- package/dist/theme/themes/EveryskLight.js.map +1 -0
- package/dist/theme/themes/MidnightEmber.d.ts +3 -0
- package/dist/theme/themes/MidnightEmber.d.ts.map +1 -0
- package/dist/theme/themes/MidnightEmber.js +31 -0
- package/dist/theme/themes/MidnightEmber.js.map +1 -0
- package/dist/theme/themes/index.d.ts +17 -0
- package/dist/theme/themes/index.d.ts.map +1 -0
- package/dist/theme/themes/index.js +32 -0
- package/dist/theme/themes/index.js.map +1 -0
- package/dist/types/anyRecord.d.ts +4 -0
- package/dist/types/anyRecord.d.ts.map +1 -0
- package/dist/types/datastore.d.ts +26 -0
- package/dist/types/datastore.d.ts.map +1 -0
- package/dist/types/entityQuery.d.ts +47 -0
- package/dist/types/entityQuery.d.ts.map +1 -0
- package/dist/types/file.d.ts +29 -0
- package/dist/types/file.d.ts.map +1 -0
- package/dist/types/portfolio.d.ts +77 -0
- package/dist/types/portfolio.d.ts.map +1 -0
- package/dist/types/profile.d.ts +37 -0
- package/dist/types/profile.d.ts.map +1 -0
- package/dist/types/workflow.d.ts +68 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/types/workspace.d.ts +13 -0
- package/dist/types/workspace.d.ts.map +1 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/workflow/index.d.ts +10 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workspace/index.d.ts +5 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/package.json +148 -0
- package/src/EveryskApp.tsx +108 -0
- package/src/agGrid/agGridTheme.ts +113 -0
- package/src/agGrid/index.ts +15 -0
- package/src/api/datastore.ts +175 -0
- package/src/api/entityQuery.ts +101 -0
- package/src/api/file.ts +174 -0
- package/src/api/portfolio.ts +190 -0
- package/src/api/profile.ts +80 -0
- package/src/api/websocketsConfig.ts +32 -0
- package/src/api/workflow.ts +427 -0
- package/src/api/workspace.ts +72 -0
- package/src/components/ui/EveryskIcon/index.tsx +24 -0
- package/src/components/ui/Footer/index.tsx +30 -0
- package/src/components/ui/GlobalLoading/index.tsx +38 -0
- package/src/components/ui/PageContainer/index.tsx +14 -0
- package/src/components/ui/Toolbar/index.tsx +44 -0
- package/src/contexts/agGridLicenseContext/provider.tsx +63 -0
- package/src/contexts/appAlertContext/index.tsx +4 -0
- package/src/contexts/appAlertContext/provider.tsx +92 -0
- package/src/contexts/appAlertContext/types.ts +17 -0
- package/src/contexts/appAlertContext/useAppAlert.ts +39 -0
- package/src/contexts/appConfigContext/index.tsx +4 -0
- package/src/contexts/appConfigContext/provider.tsx +67 -0
- package/src/contexts/appConfigContext/types.ts +28 -0
- package/src/contexts/appConfigContext/useAppConfig.ts +30 -0
- package/src/contexts/webSocketContext/constants.ts +3 -0
- package/src/contexts/webSocketContext/handler.ts +108 -0
- package/src/contexts/webSocketContext/hooks/useAppNotificationSubscription/index.ts +36 -0
- package/src/contexts/webSocketContext/hooks/useWebSocket/index.ts +18 -0
- package/src/contexts/webSocketContext/hooks/useWebSocketSubscription/index.ts +45 -0
- package/src/contexts/webSocketContext/index.tsx +5 -0
- package/src/contexts/webSocketContext/provider.tsx +125 -0
- package/src/contexts/webSocketContext/types.ts +50 -0
- package/src/datastore/index.ts +14 -0
- package/src/file/index.ts +13 -0
- package/src/hooks/datastore/useDatastoreMutations.ts +221 -0
- package/src/hooks/datastore/useFetchDatastore.ts +95 -0
- package/src/hooks/datastore/useFetchDatastores.ts +162 -0
- package/src/hooks/file/useFetchFile.ts +93 -0
- package/src/hooks/file/useFetchFiles.ts +109 -0
- package/src/hooks/file/useFileMutations.ts +240 -0
- package/src/hooks/portfolio/useFetchPortfolio.ts +94 -0
- package/src/hooks/portfolio/useFetchPortfolios.ts +109 -0
- package/src/hooks/portfolio/usePortfolioMutations.ts +250 -0
- package/src/hooks/profile/useFetchProfile.ts +93 -0
- package/src/hooks/useAxios.ts +98 -0
- package/src/hooks/workflow/useFetchWorkerExecution.ts +78 -0
- package/src/hooks/workflow/useFetchWorkerExecutions.ts +98 -0
- package/src/hooks/workflow/useFetchWorkflow.ts +76 -0
- package/src/hooks/workflow/useFetchWorkflowExecution.ts +79 -0
- package/src/hooks/workflow/useFetchWorkflowExecutions.ts +95 -0
- package/src/hooks/workflow/useFetchWorkflows.ts +84 -0
- package/src/hooks/workflow/useRunWorkflow.ts +62 -0
- package/src/hooks/workspace/useFetchWorkspace.ts +78 -0
- package/src/hooks/workspace/useFetchWorkspaces.ts +86 -0
- package/src/index.ts +72 -0
- package/src/lib/datastoreTable.ts +159 -0
- package/src/lib/queryClient.ts +60 -0
- package/src/portfolio/index.ts +13 -0
- package/src/profile/index.ts +11 -0
- package/src/socket/index.ts +19 -0
- package/src/test/index.ts +10 -0
- package/src/test/mocks/agGridEnterprise.ts +45 -0
- package/src/test/mocks/agGridReact.tsx +61 -0
- package/src/test/mocks/index.ts +22 -0
- package/src/test/mocks/socketIoClient.ts +78 -0
- package/src/test/renderWithProviders.tsx +114 -0
- package/src/test/setup.ts +46 -0
- package/src/theme/ThemeProvider.tsx +33 -0
- package/src/theme/index.ts +15 -0
- package/src/theme/overrides/index.ts +31 -0
- package/src/theme/overrides/muiButton.ts +7 -0
- package/src/theme/overrides/muiCssBaseline.ts +35 -0
- package/src/theme/overrides/muiDatePicker.ts +5 -0
- package/src/theme/overrides/muiFormControl.ts +7 -0
- package/src/theme/overrides/muiIconButton.ts +7 -0
- package/src/theme/overrides/muiSelect.ts +7 -0
- package/src/theme/overrides/muiSvgIcon.ts +7 -0
- package/src/theme/overrides/muiTextField.ts +7 -0
- package/src/theme/overrides/muiToggleButton.ts +7 -0
- package/src/theme/overrides/muiToggleButtonGroup.ts +7 -0
- package/src/theme/themes/DefaultDark.ts +14 -0
- package/src/theme/themes/DefaultLight.ts +14 -0
- package/src/theme/themes/EveryskDark.ts +62 -0
- package/src/theme/themes/EveryskLight.ts +68 -0
- package/src/theme/themes/MidnightEmber.ts +30 -0
- package/src/theme/themes/index.ts +35 -0
- package/src/types/anyRecord.ts +4 -0
- package/src/types/datastore.ts +33 -0
- package/src/types/entityQuery.ts +64 -0
- package/src/types/file.ts +32 -0
- package/src/types/portfolio.ts +81 -0
- package/src/types/profile.ts +39 -0
- package/src/types/workflow.ts +76 -0
- package/src/types/workspace.ts +15 -0
- package/src/ui/index.ts +14 -0
- package/src/workflow/index.ts +17 -0
- package/src/workspace/index.ts +12 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { getWebsocketsConfig } from "@/api/websocketsConfig";
|
|
4
|
+
import { useAxios } from "@/hooks/useAxios";
|
|
5
|
+
import { useAppAlert } from "@/contexts/appAlertContext/useAppAlert";
|
|
6
|
+
import { WebSocketContext } from ".";
|
|
7
|
+
import { WebSocketHandler } from "./handler";
|
|
8
|
+
import type { WebSocketContextType, WebSocketNotification, WebSocketProviderProps, WebSocketStatus } from "./types";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* WebSocketProvider
|
|
12
|
+
*
|
|
13
|
+
* React context provider that exposes a receive-only pub/sub API backed by Socket.IO.
|
|
14
|
+
*
|
|
15
|
+
* What this provider does:
|
|
16
|
+
* - Fetches `/api/websockets_config` once on mount to get the connection URL, channel id,
|
|
17
|
+
* and session uid. Socket.IO handles reconnection internally — the config is not re-fetched.
|
|
18
|
+
* - Opens a `WebSocketHandler` instance that connects and joins the per-user channel.
|
|
19
|
+
* - Exposes `subscribe`, `lastMessage`, and `status` via `WebSocketContext`.
|
|
20
|
+
*
|
|
21
|
+
* Why the pending buffer exists (`pendingRef`):
|
|
22
|
+
* - The handler is created asynchronously (after the config fetch resolves).
|
|
23
|
+
* - Consumers that call `subscribe` before the handler is ready have their callbacks buffered
|
|
24
|
+
* and registered once the handler initializes, ensuring no early subscriptions are lost.
|
|
25
|
+
*
|
|
26
|
+
* Subscribe buffering behavior:
|
|
27
|
+
* - If `subscribe(fn)` is called before the handler exists, `fn` is stored with a `null` placeholder.
|
|
28
|
+
* - Once the handler is ready, all pending callbacks are registered and their unsubscribe functions
|
|
29
|
+
* stored back into the map.
|
|
30
|
+
* - The returned cleanup always works: it calls the real unsubscribe if available, or removes
|
|
31
|
+
* the entry from the pending map.
|
|
32
|
+
*
|
|
33
|
+
* Usage:
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <WebSocketProvider>
|
|
36
|
+
* <YourPage />
|
|
37
|
+
* </WebSocketProvider>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* Context value (WebSocketContextType):
|
|
41
|
+
* @returns {object}
|
|
42
|
+
* - `subscribe(fn)`: register a listener; returns an unsubscribe function.
|
|
43
|
+
* - `lastMessage`: the most recently received notification (or null).
|
|
44
|
+
* - `status`: current connection status ("connecting" | "connected" | "error").
|
|
45
|
+
*/
|
|
46
|
+
export const WebSocketProvider = ({ children }: WebSocketProviderProps) => {
|
|
47
|
+
const { api } = useAxios();
|
|
48
|
+
const { showAlert } = useAppAlert();
|
|
49
|
+
|
|
50
|
+
// Refs keep the latest values accessible inside the mount-only effect without
|
|
51
|
+
// making it re-run when api or showAlert change.
|
|
52
|
+
const apiRef = useRef(api);
|
|
53
|
+
const showAlertRef = useRef(showAlert);
|
|
54
|
+
useEffect(() => { apiRef.current = api; });
|
|
55
|
+
useEffect(() => { showAlertRef.current = showAlert; });
|
|
56
|
+
|
|
57
|
+
const handlerRef = useRef<WebSocketHandler | null>(null);
|
|
58
|
+
const unsubscribeProviderRef = useRef<(() => void) | null>(null);
|
|
59
|
+
const [lastMessage, setLastMessage] = useState<WebSocketNotification | null>(null);
|
|
60
|
+
const [status, setStatus] = useState<WebSocketStatus>("idle");
|
|
61
|
+
|
|
62
|
+
const pendingRef = useRef(new Map<(m: WebSocketNotification) => void, (() => void) | null>());
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
let cancelled = false;
|
|
66
|
+
const pending = pendingRef.current;
|
|
67
|
+
|
|
68
|
+
getWebsocketsConfig(apiRef.current)
|
|
69
|
+
.then((config) => {
|
|
70
|
+
if (cancelled) return;
|
|
71
|
+
|
|
72
|
+
setStatus("connecting");
|
|
73
|
+
const handler = new WebSocketHandler({
|
|
74
|
+
...config,
|
|
75
|
+
onStatusChange: (s) => setStatus(s),
|
|
76
|
+
});
|
|
77
|
+
handlerRef.current = handler;
|
|
78
|
+
|
|
79
|
+
unsubscribeProviderRef.current = handler.listen((message) => setLastMessage(message));
|
|
80
|
+
|
|
81
|
+
for (const [fn, unsub] of pending.entries()) {
|
|
82
|
+
if (!unsub) {
|
|
83
|
+
const realUnsub = handler.listen(fn);
|
|
84
|
+
pending.set(fn, realUnsub);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
.catch((error) => {
|
|
89
|
+
if (cancelled) return;
|
|
90
|
+
console.error("Failed to initialize WebSocket connection:", error);
|
|
91
|
+
setStatus("error");
|
|
92
|
+
showAlertRef.current({ message: "Real-time notifications are unavailable. Please refresh the page.", severity: "error" });
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
return () => {
|
|
96
|
+
cancelled = true;
|
|
97
|
+
unsubscribeProviderRef.current?.();
|
|
98
|
+
unsubscribeProviderRef.current = null;
|
|
99
|
+
handlerRef.current?.close();
|
|
100
|
+
handlerRef.current = null;
|
|
101
|
+
pending.clear();
|
|
102
|
+
};
|
|
103
|
+
}, []); // mount-only — Socket.IO handles reconnection; no re-init needed when api changes
|
|
104
|
+
|
|
105
|
+
const subscribe = useCallback((fn: (m: WebSocketNotification) => void) => {
|
|
106
|
+
if (handlerRef.current) {
|
|
107
|
+
return handlerRef.current.listen(fn);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
pendingRef.current.set(fn, null);
|
|
111
|
+
|
|
112
|
+
return () => {
|
|
113
|
+
const maybeUnsub = pendingRef.current.get(fn);
|
|
114
|
+
if (maybeUnsub) maybeUnsub();
|
|
115
|
+
pendingRef.current.delete(fn);
|
|
116
|
+
};
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
119
|
+
const value: WebSocketContextType = useMemo(
|
|
120
|
+
() => ({ subscribe, lastMessage, status }),
|
|
121
|
+
[subscribe, lastMessage, status]
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
return <WebSocketContext.Provider value={value}>{children}</WebSocketContext.Provider>;
|
|
125
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type WebsocketsConfig = {
|
|
4
|
+
appConnectionURL: string;
|
|
5
|
+
appChannelID: string;
|
|
6
|
+
everyskUID: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type WebSocketStatus = "idle" | "connecting" | "connected" | "error";
|
|
10
|
+
|
|
11
|
+
export type AppNotificationPayload = {
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* WebSocketNotification
|
|
17
|
+
*
|
|
18
|
+
* Base type for all Socket.IO notifications.
|
|
19
|
+
* `event_type` discriminates between notification kinds (e.g. "USER_APP_NOTIFICATION",
|
|
20
|
+
* "WORKFLOW_EXECUTION_COMPLETED"). Other fields vary per event_type.
|
|
21
|
+
*/
|
|
22
|
+
export type WebSocketNotification = {
|
|
23
|
+
event_type: string;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* AppNotification
|
|
29
|
+
*
|
|
30
|
+
* Narrowed type for event_type === "USER_APP_NOTIFICATION".
|
|
31
|
+
* Has a nested `payload` with app-level metadata.
|
|
32
|
+
*/
|
|
33
|
+
export type AppNotification = WebSocketNotification & {
|
|
34
|
+
event_type: "USER_APP_NOTIFICATION";
|
|
35
|
+
user_app_id: string;
|
|
36
|
+
payload: AppNotificationPayload;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type WebSocketContextType = {
|
|
40
|
+
subscribe: (listener: (msg: WebSocketNotification) => void) => () => void;
|
|
41
|
+
lastMessage: WebSocketNotification | null;
|
|
42
|
+
status: WebSocketStatus;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type WebSocketProviderProps = {
|
|
46
|
+
// Optional, so this provider satisfies `ProviderComponent` and can be handed to
|
|
47
|
+
// `EveryskApp`'s `providers` array. A provider that only renders `{children}` behaves
|
|
48
|
+
// correctly when there are none.
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The datastore entity slice: API calls, entity hooks and types.
|
|
2
|
+
//
|
|
3
|
+
// Re-exported from the package root rather than its own subpath: nothing here carries an
|
|
4
|
+
// optional peer, so there is nothing for a subpath to isolate.
|
|
5
|
+
//
|
|
6
|
+
// `export *` rather than a hand-written list: a slice is exactly "everything these modules
|
|
7
|
+
// expose", and an enumerated list silently drops an export when the slice grows.
|
|
8
|
+
|
|
9
|
+
export * from "@/api/datastore";
|
|
10
|
+
export * from "@/types/datastore";
|
|
11
|
+
export * from "@/hooks/datastore/useDatastoreMutations";
|
|
12
|
+
export * from "@/hooks/datastore/useFetchDatastore";
|
|
13
|
+
export * from "@/hooks/datastore/useFetchDatastores";
|
|
14
|
+
export * from "@/lib/datastoreTable";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The file entity slice: API calls, entity hooks and types.
|
|
2
|
+
//
|
|
3
|
+
// Re-exported from the package root rather than its own subpath: nothing here carries an
|
|
4
|
+
// optional peer, so there is nothing for a subpath to isolate.
|
|
5
|
+
//
|
|
6
|
+
// `export *` rather than a hand-written list: a slice is exactly "everything these modules
|
|
7
|
+
// expose", and an enumerated list silently drops an export when the slice grows.
|
|
8
|
+
|
|
9
|
+
export * from "@/api/file";
|
|
10
|
+
export * from "@/types/file";
|
|
11
|
+
export * from "@/hooks/file/useFetchFile";
|
|
12
|
+
export * from "@/hooks/file/useFetchFiles";
|
|
13
|
+
export * from "@/hooks/file/useFileMutations";
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
|
|
3
|
+
import { useAxios } from "./../useAxios";
|
|
4
|
+
import { useAppAlert } from "@/contexts/appAlertContext/useAppAlert";
|
|
5
|
+
import type { Datastore } from "@/types/datastore";
|
|
6
|
+
import { deleteDatastore, createDatastore, updateDatastore } from "@/api/datastore";
|
|
7
|
+
|
|
8
|
+
type CreateDatastoreProps = {
|
|
9
|
+
data: Partial<Datastore>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type UpdateDatastoreProps = {
|
|
13
|
+
id: string;
|
|
14
|
+
data: Partial<Datastore>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type DeleteDatastoreProps = {
|
|
18
|
+
id: string;
|
|
19
|
+
workspace: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type UseDatastoreMutationsProps = {
|
|
23
|
+
queryKey?: unknown[];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getErrorMessage = (err: unknown, fallback: string) =>
|
|
27
|
+
err instanceof Error && err.message ? err.message : fallback;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* useDatastoreMutations
|
|
31
|
+
*
|
|
32
|
+
* Mutation hook built on TanStack Query to perform Datastore write operations:
|
|
33
|
+
* - create a datastore (POST)
|
|
34
|
+
* - update a datastore (PUT)
|
|
35
|
+
* - delete a datastore (DELETE)
|
|
36
|
+
*
|
|
37
|
+
* It also:
|
|
38
|
+
* - optionally invalidates a target query cache key after successful mutations
|
|
39
|
+
* - displays success/error alerts via `useAppAlert`
|
|
40
|
+
*
|
|
41
|
+
* Important notes:
|
|
42
|
+
* - This hook is intended for side-effect operations only. Reading/retrieving data should be done via `useQuery` or `useFetchDatastore`.
|
|
43
|
+
* - Cache invalidation is controlled by `queryKey`. If `queryKey` is not provided, the hook will still run
|
|
44
|
+
* mutations and show alerts, but it will NOT invalidate any cached queries.
|
|
45
|
+
* - `remove` requires a `workspace` parameter because the underlying API helper `deleteDatastore(api, id, workspace)`
|
|
46
|
+
* expects it as a query param.
|
|
47
|
+
*
|
|
48
|
+
* Parameters (UseDatastoreMutationsProps):
|
|
49
|
+
* @param {unknown[]} [queryKey]
|
|
50
|
+
* Query key to invalidate after successful mutations. Use the same `queryKey` you pass to the relevant `useQuery`
|
|
51
|
+
* (e.g., datastore list/detail) so UI data is refreshed automatically after a write.
|
|
52
|
+
*
|
|
53
|
+
* Tip:
|
|
54
|
+
* - If you're using `useFetchDatastore`, you can pass its returned `queryKey` directly:
|
|
55
|
+
* `const fetch = useFetchDatastore(...);`
|
|
56
|
+
* `useDatastoreMutations({ queryKey: fetch.queryKey });`
|
|
57
|
+
*
|
|
58
|
+
* Mutations:
|
|
59
|
+
* - `create`:
|
|
60
|
+
* - mutationFn: `createDatastore(api, data)`
|
|
61
|
+
* - variables: `{ data: Partial<Datastore> }`
|
|
62
|
+
* - success message: "Datastore created successfully."
|
|
63
|
+
* - error message: "Unable to create the datastore. Please try again." (fallback)
|
|
64
|
+
*
|
|
65
|
+
* - `update`:
|
|
66
|
+
* - mutationFn: `updateDatastore(api, id, data)`
|
|
67
|
+
* - variables: `{ id: string; data: Partial<Datastore> }`
|
|
68
|
+
* - success message: "Datastore updated successfully."
|
|
69
|
+
* - error message: "Unable to update the datastore. Please try again." (fallback)
|
|
70
|
+
*
|
|
71
|
+
* - `remove`:
|
|
72
|
+
* - mutationFn: `deleteDatastore(api, id, workspace)`
|
|
73
|
+
* - variables: `{ id: string; workspace: string }`
|
|
74
|
+
* - success message: "Datastore deleted successfully."
|
|
75
|
+
* - error message: "Unable to delete the datastore. Please try again." (fallback)
|
|
76
|
+
*
|
|
77
|
+
* Return value:
|
|
78
|
+
* @returns {object}
|
|
79
|
+
* Returns an object with the three TanStack Query mutation results:
|
|
80
|
+
* - `create`: UseMutationResult<Datastore, Error, CreateDatastoreProps, unknown>
|
|
81
|
+
* - `update`: UseMutationResult<Datastore, Error, UpdateDatastoreProps, unknown>
|
|
82
|
+
* - `remove`: UseMutationResult<Datastore, Error, DeleteDatastoreProps, unknown>
|
|
83
|
+
*
|
|
84
|
+
* Each mutation includes standard TanStack Query helpers:
|
|
85
|
+
* - `mutate(variables, options?)`
|
|
86
|
+
* - `mutateAsync(variables, options?)`
|
|
87
|
+
* - `isPending`, `isSuccess`, `isError`, `error`, `data`, etc.
|
|
88
|
+
*
|
|
89
|
+
* Examples:
|
|
90
|
+
*
|
|
91
|
+
* 1) Invalidate a datastore list query after mutations:
|
|
92
|
+
* ```ts
|
|
93
|
+
* const { create, update, remove } = useDatastoreMutations({ queryKey: ["datastore"] });
|
|
94
|
+
*
|
|
95
|
+
* // Create
|
|
96
|
+
* create.mutate({
|
|
97
|
+
* data: {
|
|
98
|
+
* name: "My datastore",
|
|
99
|
+
* workspace: "ws-1",
|
|
100
|
+
* data: [["id", "name"], ["ABEOX135", "Jorge"]],
|
|
101
|
+
* }
|
|
102
|
+
* });
|
|
103
|
+
*
|
|
104
|
+
* // Update
|
|
105
|
+
* update.mutate({
|
|
106
|
+
* id: "ds-123",
|
|
107
|
+
* data: {
|
|
108
|
+
* name: "Renamed datastore",
|
|
109
|
+
* data: [["id", "name"], ["ABEOX135", "Jorge"]],
|
|
110
|
+
* }
|
|
111
|
+
* });
|
|
112
|
+
*
|
|
113
|
+
* // Delete
|
|
114
|
+
* remove.mutate({
|
|
115
|
+
* id: "ds-123",
|
|
116
|
+
* workspace: "ws-1"
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* 2) Using async/await with `mutateAsync`:
|
|
121
|
+
* ```ts
|
|
122
|
+
* const { create } = useDatastoreMutations({ queryKey: ["datastore"] });
|
|
123
|
+
*
|
|
124
|
+
* await create.mutateAsync({
|
|
125
|
+
* data: {
|
|
126
|
+
* name: "My datastore",
|
|
127
|
+
* workspace: "ws-1",
|
|
128
|
+
* data: [["id", "name"], ["ABEOX135", "Jorge"]],
|
|
129
|
+
* }
|
|
130
|
+
* });
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* 3) Without cache invalidation (no queryKey):
|
|
134
|
+
* ```ts
|
|
135
|
+
* const { update } = useDatastoreMutations({});
|
|
136
|
+
*
|
|
137
|
+
* update.mutate({
|
|
138
|
+
* id: "ds-123",
|
|
139
|
+
* data: { name: "Renamed datastore" }
|
|
140
|
+
* });
|
|
141
|
+
* // Mutation still runs and alerts are shown, but cached queries are not invalidated.
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* 4) Using `useFetchDatastore` queryKey for automatic invalidation:
|
|
145
|
+
* ```ts
|
|
146
|
+
* const fetch = useFetchDatastore({
|
|
147
|
+
* id: null,
|
|
148
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
149
|
+
* });
|
|
150
|
+
*
|
|
151
|
+
* const { create } = useDatastoreMutations({ queryKey: fetch.queryKey });
|
|
152
|
+
*
|
|
153
|
+
* await create.mutateAsync({
|
|
154
|
+
* data: { name: "My datastore", workspace: "ws-1" }
|
|
155
|
+
* });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
export const useDatastoreMutations = ({ queryKey }: UseDatastoreMutationsProps) => {
|
|
160
|
+
const { api } = useAxios();
|
|
161
|
+
const { showAlert } = useAppAlert();
|
|
162
|
+
const queryClient = useQueryClient();
|
|
163
|
+
|
|
164
|
+
const invalidate = async () => {
|
|
165
|
+
if (!queryKey?.length) return;
|
|
166
|
+
await queryClient.invalidateQueries({ queryKey });
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const create = useMutation({
|
|
170
|
+
mutationFn: async ({ data }: CreateDatastoreProps) => createDatastore(api, data),
|
|
171
|
+
onSuccess: async () => {
|
|
172
|
+
await invalidate();
|
|
173
|
+
showAlert({
|
|
174
|
+
severity: "success",
|
|
175
|
+
message: "Datastore created successfully.",
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
onError: (err: unknown) => {
|
|
179
|
+
showAlert({
|
|
180
|
+
severity: "error",
|
|
181
|
+
message: getErrorMessage(err, "Unable to create the datastore. Please try again."),
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const update = useMutation({
|
|
187
|
+
mutationFn: async ({ id, data }: UpdateDatastoreProps) => updateDatastore(api, id, data),
|
|
188
|
+
onSuccess: async () => {
|
|
189
|
+
await invalidate();
|
|
190
|
+
showAlert({
|
|
191
|
+
severity: "success",
|
|
192
|
+
message: "Datastore updated successfully.",
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
onError: (err: unknown) => {
|
|
196
|
+
showAlert({
|
|
197
|
+
severity: "error",
|
|
198
|
+
message: getErrorMessage(err, "Unable to update the datastore. Please try again."),
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
const remove = useMutation({
|
|
204
|
+
mutationFn: async ({ id, workspace }: DeleteDatastoreProps) => deleteDatastore(api, id, workspace),
|
|
205
|
+
onSuccess: async () => {
|
|
206
|
+
await invalidate();
|
|
207
|
+
showAlert({
|
|
208
|
+
severity: "success",
|
|
209
|
+
message: "Datastore deleted successfully.",
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
onError: (err: unknown) => {
|
|
213
|
+
showAlert({
|
|
214
|
+
severity: "error",
|
|
215
|
+
message: getErrorMessage(err, "Unable to delete the datastore. Please try again."),
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
return { create, update, remove };
|
|
221
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
|
|
5
|
+
import { useAxios } from "@/hooks/useAxios";
|
|
6
|
+
import { useAppAlert } from "@/contexts/appAlertContext/useAppAlert";
|
|
7
|
+
import { getDatastore } from "@/api/datastore";
|
|
8
|
+
import { tableToObjects } from "@/lib/datastoreTable";
|
|
9
|
+
import type { DatastoreWithRows } from "@/types/datastore";
|
|
10
|
+
import type { EntityQueryOptions, FetchEntityParams } from "@/types/entityQuery";
|
|
11
|
+
|
|
12
|
+
export type FetchDatastoreProps = FetchEntityParams<DatastoreWithRows>;
|
|
13
|
+
|
|
14
|
+
const defaultQueryOptions: EntityQueryOptions<DatastoreWithRows> = {
|
|
15
|
+
refetchOnMount: "always",
|
|
16
|
+
staleTime: 0,
|
|
17
|
+
gcTime: 0,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* useFetchDatastore
|
|
22
|
+
*
|
|
23
|
+
* Data-fetching hook built on TanStack Query to retrieve a single datastore by ID.
|
|
24
|
+
*
|
|
25
|
+
* It also:
|
|
26
|
+
* - triggers an error alert via `useAppAlert` whenever `query.error` is present
|
|
27
|
+
*
|
|
28
|
+
* Important notes:
|
|
29
|
+
* - Returns a `DatastoreWithRows` object: the full `Datastore` shape with `data`
|
|
30
|
+
* replaced by `AnyRecord[]` (rows transformed via `tableToObjects`).
|
|
31
|
+
*
|
|
32
|
+
* Parameters (FetchDatastoreProps):
|
|
33
|
+
* @param {string} id
|
|
34
|
+
* Datastore identifier (required).
|
|
35
|
+
*
|
|
36
|
+
* @param {string} workspace
|
|
37
|
+
* Workspace the datastore belongs to (required by `getDatastore`).
|
|
38
|
+
*
|
|
39
|
+
* @param {EntityQueryOptions<DatastoreWithRows>} [queryOptions=defaultQueryOptions]
|
|
40
|
+
* TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
41
|
+
*
|
|
42
|
+
* Returns:
|
|
43
|
+
* @returns {object}
|
|
44
|
+
* TanStack Query's `query` object extended with:
|
|
45
|
+
* - `queryKey`: the cache key used by React Query
|
|
46
|
+
*
|
|
47
|
+
* Example:
|
|
48
|
+
* ```ts
|
|
49
|
+
* const { data, isLoading } = useFetchDatastore({
|
|
50
|
+
* id: "abc123",
|
|
51
|
+
* workspace: "my-workspace",
|
|
52
|
+
* });
|
|
53
|
+
* // data -> DatastoreWithRows (datastore metadata + rows as AnyRecord[])
|
|
54
|
+
* // data.name -> "my-datastore"
|
|
55
|
+
* // data.data -> [{ datastoreId: "abc123", col1: "value", ... }]
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export const useFetchDatastore = ({ id, workspace, queryOptions = defaultQueryOptions }: FetchDatastoreProps) => {
|
|
59
|
+
|
|
60
|
+
const { api } = useAxios();
|
|
61
|
+
const { showAlert } = useAppAlert();
|
|
62
|
+
|
|
63
|
+
const queryKey = ["datastore", id, workspace];
|
|
64
|
+
|
|
65
|
+
const query = useQuery<DatastoreWithRows>({
|
|
66
|
+
queryKey,
|
|
67
|
+
queryFn: async () => {
|
|
68
|
+
const datastore = await getDatastore(api, id, workspace);
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
...datastore,
|
|
72
|
+
data: tableToObjects(
|
|
73
|
+
datastore.id,
|
|
74
|
+
datastore.data?.[0] as string[],
|
|
75
|
+
datastore.data
|
|
76
|
+
),
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
...queryOptions ?? {}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (!query.error) return;
|
|
84
|
+
|
|
85
|
+
showAlert({
|
|
86
|
+
severity: "error",
|
|
87
|
+
message: query.error.message,
|
|
88
|
+
});
|
|
89
|
+
}, [query.error, showAlert]);
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
...query,
|
|
93
|
+
queryKey,
|
|
94
|
+
};
|
|
95
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
//import { useCallback, useMemo, useRef } from "react";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useInfiniteQuery, type UseInfiniteQueryOptions, type QueryKey } from "@tanstack/react-query";
|
|
4
|
+
|
|
5
|
+
//import type { GridApi } from "ag-grid-community";
|
|
6
|
+
|
|
7
|
+
import { useAxios } from "@/hooks/useAxios";
|
|
8
|
+
import { tableToObjects } from "@/lib/datastoreTable";
|
|
9
|
+
import { listDatastores } from "@/api/datastore";
|
|
10
|
+
|
|
11
|
+
import type { Datastore, DatastoreListResponse, DatastoreWithRows } from "@/types/datastore";
|
|
12
|
+
import type { FetchEntitiesParams, EntityDefaultResponse } from "@/types/entityQuery";
|
|
13
|
+
import { buildQueryKey, buildQueryObject } from "@/api/entityQuery";
|
|
14
|
+
|
|
15
|
+
type PageToken = string | null;
|
|
16
|
+
|
|
17
|
+
type InfiniteOptions<TData> = Omit<
|
|
18
|
+
UseInfiniteQueryOptions<DatastoreQueryPage, Error, TData, QueryKey, PageToken>,
|
|
19
|
+
"queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam"
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export type DatastoreQueryPage = EntityDefaultResponse & {
|
|
24
|
+
datastores: DatastoreWithRows[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type FetchInfiniteDatastoreProps = FetchEntitiesParams<DatastoreWithRows[], InfiniteOptions<DatastoreWithRows[]>> & {
|
|
28
|
+
pageSize?: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const defaultQueryOptions: InfiniteOptions<DatastoreWithRows[]> = {
|
|
32
|
+
refetchOnMount: "always",
|
|
33
|
+
staleTime: 0,
|
|
34
|
+
gcTime: 0,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* useFetchDatastores
|
|
39
|
+
*
|
|
40
|
+
* Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve
|
|
41
|
+
* datastores with cursor-based pagination.
|
|
42
|
+
*
|
|
43
|
+
* It also:
|
|
44
|
+
* - flattens all pages into a single `DatastoreWithRows[]` via `select`
|
|
45
|
+
* - exposes `actions` for cache management
|
|
46
|
+
* - exposes `events` for ag-Grid integration
|
|
47
|
+
*
|
|
48
|
+
* Important notes:
|
|
49
|
+
* - `query.data` returns a flat `DatastoreWithRows[]` (all pages merged).
|
|
50
|
+
* - Each item retains the full `Datastore` shape, with `data` replaced by `AnyRecord[]` (rows transformed via `tableToObjects`).
|
|
51
|
+
*
|
|
52
|
+
* Parameters (FetchInfiniteDatastoreProps):
|
|
53
|
+
* @param {FilterClause[]} [filters=[]]
|
|
54
|
+
* Filters applied to every page request. Must include a `workspace` filter.
|
|
55
|
+
*
|
|
56
|
+
* @param {string[]} [order=[]]
|
|
57
|
+
* Sorting applied to every page request.
|
|
58
|
+
*
|
|
59
|
+
* @param {string} [projection=""]
|
|
60
|
+
* Single field to project: `"field"` returns only that field (others come back null),
|
|
61
|
+
* `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
62
|
+
*
|
|
63
|
+
* @param {number} [pageSize=10]
|
|
64
|
+
* Number of datastores to fetch per page.
|
|
65
|
+
*
|
|
66
|
+
* @param {InfiniteOptions<DatastoreWithRows[]>} [queryOptions]
|
|
67
|
+
* TanStack Query options passed through to `useInfiniteQuery`
|
|
68
|
+
* (e.g., enabled, staleTime, gcTime, etc.).
|
|
69
|
+
*
|
|
70
|
+
* Returns:
|
|
71
|
+
* @returns {object}
|
|
72
|
+
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
73
|
+
* - `queryKey`: the cache key used by React Query
|
|
74
|
+
* - `events.handleFetchIfGridEmptyOrNearEnd(gridApi)`: triggers next page fetch when the ag-Grid is empty or near the end of the list
|
|
75
|
+
*
|
|
76
|
+
* Example:
|
|
77
|
+
* ```ts
|
|
78
|
+
* const { query, events } = useFetchDatastores({
|
|
79
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
80
|
+
* pageSize: 20,
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* // Flat list of all fetched datastores with transformed rows
|
|
84
|
+
* const datastores = query.data ?? [];
|
|
85
|
+
*
|
|
86
|
+
* // Load next page when grid is near end
|
|
87
|
+
* <AgGridReact onBodyScroll={() => events.handleFetchIfGridEmptyOrNearEnd(gridApi)} />
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export function useFetchDatastores({ filters = [], order = [], projection = "", pageSize = 10, queryOptions }: FetchInfiniteDatastoreProps) {
|
|
91
|
+
const { api } = useAxios();
|
|
92
|
+
|
|
93
|
+
//const fetchingGuardRef = useRef(false);
|
|
94
|
+
const queryKey = buildQueryKey(["datastores"], filters);
|
|
95
|
+
|
|
96
|
+
const mergedQueryOptions = useMemo<InfiniteOptions<DatastoreWithRows[]>>(() => ({
|
|
97
|
+
...defaultQueryOptions,
|
|
98
|
+
...(queryOptions ?? {}),
|
|
99
|
+
}), [queryOptions]);
|
|
100
|
+
|
|
101
|
+
const query = useInfiniteQuery<DatastoreQueryPage, Error, DatastoreWithRows[], QueryKey, PageToken>({
|
|
102
|
+
queryKey,
|
|
103
|
+
initialPageParam: null,
|
|
104
|
+
getNextPageParam: (lastPage) => lastPage.next_page_token ?? undefined,
|
|
105
|
+
|
|
106
|
+
queryFn: async ({ pageParam }) => {
|
|
107
|
+
const queryFilter = buildQueryObject({
|
|
108
|
+
filters,
|
|
109
|
+
order,
|
|
110
|
+
projection,
|
|
111
|
+
pageSize,
|
|
112
|
+
pageToken: pageParam ?? undefined,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const response: DatastoreListResponse = await listDatastores(api, queryFilter);
|
|
116
|
+
|
|
117
|
+
const nested: DatastoreWithRows[] = response.datastores.map((datastore: Datastore) => ({
|
|
118
|
+
...datastore,
|
|
119
|
+
data: tableToObjects(
|
|
120
|
+
datastore.id,
|
|
121
|
+
datastore.data?.[0] as string[],
|
|
122
|
+
datastore.data
|
|
123
|
+
),
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
next_page_token: response.next_page_token,
|
|
128
|
+
datastores: nested,
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
select: (data) => data.pages.flatMap((p) => p.datastores),
|
|
133
|
+
|
|
134
|
+
...mergedQueryOptions,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
/*
|
|
138
|
+
const { hasNextPage, isFetchingNextPage, fetchNextPage } = query;
|
|
139
|
+
const handleFetchIfGridEmptyOrNearEnd = useCallback((gridApi: GridApi) => {
|
|
140
|
+
if (!hasNextPage || isFetchingNextPage || fetchingGuardRef.current) return;
|
|
141
|
+
|
|
142
|
+
const total = gridApi.getDisplayedRowCount();
|
|
143
|
+
const last = gridApi.getLastDisplayedRowIndex();
|
|
144
|
+
|
|
145
|
+
const isEmpty = total === 0 || last < 0;
|
|
146
|
+
const isNearEnd = !isEmpty && (total - 1 - last) <= 30;
|
|
147
|
+
|
|
148
|
+
if (!isEmpty && !isNearEnd) return;
|
|
149
|
+
|
|
150
|
+
fetchingGuardRef.current = true;
|
|
151
|
+
fetchNextPage().finally(() => {
|
|
152
|
+
fetchingGuardRef.current = false;
|
|
153
|
+
});
|
|
154
|
+
}, [hasNextPage, isFetchingNextPage, fetchNextPage]);
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
query,
|
|
159
|
+
queryKey,
|
|
160
|
+
//events: { handleFetchIfGridEmptyOrNearEnd },
|
|
161
|
+
};
|
|
162
|
+
}
|