@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,250 @@
|
|
|
1
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
|
|
3
|
+
import { useAxios } from "@/hooks/useAxios";
|
|
4
|
+
import { useAppAlert } from "@/contexts/appAlertContext/useAppAlert";
|
|
5
|
+
import type { Portfolio } from "@/types/portfolio";
|
|
6
|
+
import { deletePortfolio, createPortfolio, updatePortfolio } from "@/api/portfolio";
|
|
7
|
+
|
|
8
|
+
type CreatePortfolioProps = {
|
|
9
|
+
data: Partial<Portfolio>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type UpdatePortfolioProps = {
|
|
13
|
+
id: string;
|
|
14
|
+
data: Partial<Portfolio>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type DeletePortfolioProps = {
|
|
18
|
+
id: string;
|
|
19
|
+
workspace: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type UsePortfolioMutationsProps = {
|
|
23
|
+
queryKey?: unknown[];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getErrorMessage = (err: unknown, fallback: string) =>
|
|
27
|
+
err instanceof Error && err.message ? err.message : fallback;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* usePortfolioMutations
|
|
31
|
+
*
|
|
32
|
+
* Mutation hook built on TanStack Query to perform Portfolio write operations:
|
|
33
|
+
* - create a portfolio (POST)
|
|
34
|
+
* - update a portfolio (PUT)
|
|
35
|
+
* - delete a portfolio (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 `useFetchPortfolio`.
|
|
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 `deletePortfolio(api, id, workspace)`
|
|
46
|
+
* expects it as a query param.
|
|
47
|
+
*
|
|
48
|
+
* Parameters (UsePortfolioMutationsProps):
|
|
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., portfolio list/detail) so UI data is refreshed automatically after a write.
|
|
52
|
+
*
|
|
53
|
+
* Tip:
|
|
54
|
+
* - If you're using `useFetchPortfolio`, you can pass its returned `queryKey` directly:
|
|
55
|
+
* `const fetch = useFetchPortfolio(...);`
|
|
56
|
+
* `usePortfolioMutations({ queryKey: fetch.queryKey });`
|
|
57
|
+
*
|
|
58
|
+
* Mutations:
|
|
59
|
+
* - `create`:
|
|
60
|
+
* - mutationFn: `createPortfolio(api, data)`
|
|
61
|
+
* - variables: `{ data: Partial<Portfolio> }`
|
|
62
|
+
* - success message: "Portfolio created successfully."
|
|
63
|
+
* - error message: "We couldn't create the portfolio. Please review your inputs and try again." (fallback)
|
|
64
|
+
*
|
|
65
|
+
* - `update`:
|
|
66
|
+
* - mutationFn: `updatePortfolio(api, id, data)`
|
|
67
|
+
* - variables: `{ id: string; data: Partial<Portfolio> }`
|
|
68
|
+
* - success message: "Portfolio updated successfully."
|
|
69
|
+
* - error message: "We couldn't update the portfolio. Please try again." (fallback)
|
|
70
|
+
*
|
|
71
|
+
* - `remove`:
|
|
72
|
+
* - mutationFn: `deletePortfolio(api, id, workspace)`
|
|
73
|
+
* - variables: `{ id: string; workspace: string }`
|
|
74
|
+
* - success message: "Portfolio deleted successfully."
|
|
75
|
+
* - error message: "We couldn't delete the portfolio. 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<Portfolio, Error, CreatePortfolioProps, unknown>
|
|
81
|
+
* - `update`: UseMutationResult<Portfolio, Error, UpdatePortfolioProps, unknown>
|
|
82
|
+
* - `remove`: UseMutationResult<Portfolio, Error, DeletePortfolioProps, 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 portfolio list query after mutations:
|
|
92
|
+
* ```ts
|
|
93
|
+
* const { create, update, remove } = usePortfolioMutations({ queryKey: ["portfolio"] });
|
|
94
|
+
*
|
|
95
|
+
* // Create (minimal example - other Security fields omitted for brevity)
|
|
96
|
+
* create.mutate({
|
|
97
|
+
* data: {
|
|
98
|
+
* name: "My Portfolio",
|
|
99
|
+
* description: "Test portfolio",
|
|
100
|
+
* base_currency: "USD",
|
|
101
|
+
* date: "2026-01-08",
|
|
102
|
+
* workspace: "ws-1",
|
|
103
|
+
* securities: [
|
|
104
|
+
* {
|
|
105
|
+
* id: "sec-1",
|
|
106
|
+
* ticker: "AAPL",
|
|
107
|
+
* symbol: "AAPL",
|
|
108
|
+
* name: "Apple Inc.",
|
|
109
|
+
* currency: "USD",
|
|
110
|
+
* quantity: 10,
|
|
111
|
+
* market_price: 200,
|
|
112
|
+
* market_value: 2000,
|
|
113
|
+
* market_value_in_base: 2000,
|
|
114
|
+
* fx_rate: 1,
|
|
115
|
+
* instrument_type: "Equity",
|
|
116
|
+
* instrument_class: "Equity",
|
|
117
|
+
* asset_class: "Equity",
|
|
118
|
+
* exchange: "NASDAQ",
|
|
119
|
+
* status: "active",
|
|
120
|
+
* // Other fields are nullable in the Security type and can be omitted here for documentation purposes.
|
|
121
|
+
* } as Security,
|
|
122
|
+
* ],
|
|
123
|
+
* }
|
|
124
|
+
* });
|
|
125
|
+
*
|
|
126
|
+
* // Update (partial)
|
|
127
|
+
* update.mutate({
|
|
128
|
+
* id: "pf-123",
|
|
129
|
+
* data: {
|
|
130
|
+
* name: "Renamed Portfolio",
|
|
131
|
+
* tags: ["tag-1", "tag-2"],
|
|
132
|
+
* check_securities: true,
|
|
133
|
+
* }
|
|
134
|
+
* });
|
|
135
|
+
*
|
|
136
|
+
* // Delete
|
|
137
|
+
* remove.mutate({ id: "pf-123", workspace: "ws-1" });
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* 2) Using async/await with `mutateAsync`:
|
|
141
|
+
* ```ts
|
|
142
|
+
* const { create } = usePortfolioMutations({ queryKey: ["portfolio"] });
|
|
143
|
+
*
|
|
144
|
+
* await create.mutateAsync({
|
|
145
|
+
* data: {
|
|
146
|
+
* name: "My Portfolio",
|
|
147
|
+
* base_currency: "USD",
|
|
148
|
+
* date: "2026-01-08",
|
|
149
|
+
* workspace: "ws-1",
|
|
150
|
+
* securities: [],
|
|
151
|
+
* }
|
|
152
|
+
* });
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* 3) Without cache invalidation (no queryKey):
|
|
156
|
+
* ```ts
|
|
157
|
+
* const { update } = usePortfolioMutations({});
|
|
158
|
+
*
|
|
159
|
+
* update.mutate({
|
|
160
|
+
* id: "pf-123",
|
|
161
|
+
* data: { description: "Updated description" }
|
|
162
|
+
* });
|
|
163
|
+
* // Mutation still runs and alerts are shown, but cached queries are not invalidated.
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* 4) Using `useFetchPortfolio` queryKey for automatic invalidation:
|
|
167
|
+
* ```ts
|
|
168
|
+
* const fetch = useFetchPortfolio({
|
|
169
|
+
* id: null,
|
|
170
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
171
|
+
* });
|
|
172
|
+
*
|
|
173
|
+
* const { remove } = usePortfolioMutations({ queryKey: fetch.queryKey });
|
|
174
|
+
*
|
|
175
|
+
* await remove.mutateAsync({ id: "pf-123", workspace: "ws-1" });
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
export const usePortfolioMutations = ({ queryKey }: UsePortfolioMutationsProps) => {
|
|
180
|
+
const { api } = useAxios();
|
|
181
|
+
const { showAlert } = useAppAlert();
|
|
182
|
+
const queryClient = useQueryClient();
|
|
183
|
+
|
|
184
|
+
const invalidate = async () => {
|
|
185
|
+
if (!queryKey?.length) return;
|
|
186
|
+
await queryClient.invalidateQueries({ queryKey });
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const create = useMutation({
|
|
190
|
+
mutationFn: async ({ data }: CreatePortfolioProps) => createPortfolio(api, data),
|
|
191
|
+
onSuccess: async () => {
|
|
192
|
+
await invalidate();
|
|
193
|
+
showAlert({
|
|
194
|
+
severity: "success",
|
|
195
|
+
message: "Portfolio created successfully.",
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
onError: (err: unknown) => {
|
|
199
|
+
showAlert({
|
|
200
|
+
severity: "error",
|
|
201
|
+
message: getErrorMessage(
|
|
202
|
+
err,
|
|
203
|
+
"We couldn't create the portfolio. Please review your inputs and try again."
|
|
204
|
+
),
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
const update = useMutation({
|
|
210
|
+
mutationFn: async ({ id, data }: UpdatePortfolioProps) => updatePortfolio(api, id, data),
|
|
211
|
+
onSuccess: async () => {
|
|
212
|
+
await invalidate();
|
|
213
|
+
showAlert({
|
|
214
|
+
severity: "success",
|
|
215
|
+
message: "Portfolio updated successfully.",
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
onError: (err: unknown) => {
|
|
219
|
+
showAlert({
|
|
220
|
+
severity: "error",
|
|
221
|
+
message: getErrorMessage(
|
|
222
|
+
err,
|
|
223
|
+
"We couldn't update the portfolio. Please try again."
|
|
224
|
+
),
|
|
225
|
+
});
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
const remove = useMutation({
|
|
230
|
+
mutationFn: async ({ id, workspace }: DeletePortfolioProps) => deletePortfolio(api, id, workspace),
|
|
231
|
+
onSuccess: async () => {
|
|
232
|
+
await invalidate();
|
|
233
|
+
showAlert({
|
|
234
|
+
severity: "success",
|
|
235
|
+
message: "Portfolio deleted successfully.",
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
onError: (err: unknown) => {
|
|
239
|
+
showAlert({
|
|
240
|
+
severity: "error",
|
|
241
|
+
message: getErrorMessage(
|
|
242
|
+
err,
|
|
243
|
+
"We couldn't delete the portfolio. Please try again."
|
|
244
|
+
),
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
return { create, update, remove };
|
|
250
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
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 type { Profile } from "@/types/profile";
|
|
8
|
+
import { getProfile } from "@/api/profile";
|
|
9
|
+
import type { EntityQueryOptions } from "@/types/entityQuery";
|
|
10
|
+
|
|
11
|
+
export type FetchProfileProps<TData = Profile, TSelected = TData> = {
|
|
12
|
+
queryOptions?: EntityQueryOptions<TData, TSelected>;
|
|
13
|
+
/**
|
|
14
|
+
* Served instead of calling the API. Pass `DEV_PROFILE` while running the dev server,
|
|
15
|
+
* where `/api/profile` has no session to resolve.
|
|
16
|
+
*/
|
|
17
|
+
fallback?: Profile;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// The logged user's profile does not change during a session, so it is fetched once and kept —
|
|
21
|
+
// unlike the entity hooks (staleTime/gcTime 0, refetch on every mount), which read data the
|
|
22
|
+
// platform keeps changing.
|
|
23
|
+
const defaultQueryOptions: EntityQueryOptions<Profile> = {
|
|
24
|
+
staleTime: Infinity,
|
|
25
|
+
refetchOnMount: false,
|
|
26
|
+
refetchOnWindowFocus: false,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* useFetchProfile
|
|
31
|
+
*
|
|
32
|
+
* Data-fetching hook built on TanStack Query to retrieve the profile of the logged user. It takes
|
|
33
|
+
* no identifier: the API resolves the user from the session.
|
|
34
|
+
*
|
|
35
|
+
* It also:
|
|
36
|
+
* - builds a stable React Query `queryKey`, shared by every consumer, so the profile is fetched
|
|
37
|
+
* once per session and read from cache afterwards
|
|
38
|
+
* - triggers an error alert via `useAppAlert` whenever `query.error` is present
|
|
39
|
+
*
|
|
40
|
+
* Parameters (FetchProfileProps):
|
|
41
|
+
* @param queryOptions
|
|
42
|
+
* TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
43
|
+
* Defaults keep the profile cached for the whole session.
|
|
44
|
+
* @param fallback
|
|
45
|
+
* Served instead of calling the API. `/api/profile` only resolves in production, so an app
|
|
46
|
+
* running the dev server passes `DEV_PROFILE` here:
|
|
47
|
+
* `useFetchProfile({ fallback: import.meta.env.DEV ? DEV_PROFILE : undefined })`.
|
|
48
|
+
* The SDK cannot make that choice itself — see `getProfile`.
|
|
49
|
+
*
|
|
50
|
+
* Returns:
|
|
51
|
+
* @returns {object}
|
|
52
|
+
* TanStack Query's `query` object extended with:
|
|
53
|
+
* - `queryKey`: the cache key used by React Query
|
|
54
|
+
*
|
|
55
|
+
* Example:
|
|
56
|
+
* ```ts
|
|
57
|
+
* const { data, isPending } = useFetchProfile();
|
|
58
|
+
* // data -> Profile
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export const useFetchProfile = ({
|
|
62
|
+
queryOptions = defaultQueryOptions,
|
|
63
|
+
fallback,
|
|
64
|
+
}: FetchProfileProps = {}) => {
|
|
65
|
+
|
|
66
|
+
const { api } = useAxios();
|
|
67
|
+
const { showAlert } = useAppAlert();
|
|
68
|
+
|
|
69
|
+
const queryKey = ["profile"];
|
|
70
|
+
|
|
71
|
+
const query = useQuery<Profile>({
|
|
72
|
+
queryKey,
|
|
73
|
+
queryFn: async () => {
|
|
74
|
+
const profile = await getProfile(api, fallback);
|
|
75
|
+
return profile;
|
|
76
|
+
},
|
|
77
|
+
...queryOptions ?? {}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (!query.error) return;
|
|
82
|
+
|
|
83
|
+
showAlert({
|
|
84
|
+
severity: "error",
|
|
85
|
+
message: query.error.message,
|
|
86
|
+
});
|
|
87
|
+
}, [query.error, showAlert]);
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
...query,
|
|
91
|
+
queryKey,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
import axios, { type AxiosInstance, type InternalAxiosRequestConfig } from "axios";
|
|
4
|
+
|
|
5
|
+
import type { AnyRecord } from "@/types/anyRecord";
|
|
6
|
+
import type { FilterExpression } from "@/types/entityQuery";
|
|
7
|
+
import { useAppConfig } from "@/contexts/appConfigContext/useAppConfig";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* useAxios
|
|
11
|
+
*
|
|
12
|
+
* Axios client hook that returns a memoized `AxiosInstance` configured with:
|
|
13
|
+
* - `baseURL` derived from:
|
|
14
|
+
* - the optional `url` parameter, or
|
|
15
|
+
* - the relative `/api` by default. In dev, `/api` is proxied to `EVERYSK_API_URL`
|
|
16
|
+
* (see `vite/serverProxy.ts`); in production it is served behind the same host.
|
|
17
|
+
*
|
|
18
|
+
* Request behavior:
|
|
19
|
+
* - Sets the `X-Everysk-Source` header on every request, identifying the app to the API as
|
|
20
|
+
* `everysk-user-app-<appId>` (the `appId` from `useAppConfig()`). When there is no app id (dev,
|
|
21
|
+
* where the host page hasn't injected `window.APP_ID`), it falls back to
|
|
22
|
+
* `everysk-user-app-development`.
|
|
23
|
+
* - Registers a request interceptor that, for `GET` and `DELETE` requests, attempts to parse
|
|
24
|
+
* `config.params.query` (expected to be a JSON string) and extract a `workspace` filter from it.
|
|
25
|
+
* - If a `workspace` value is found, it is injected into `config.params.workspace`.
|
|
26
|
+
*
|
|
27
|
+
* Lifecycle / cleanup:
|
|
28
|
+
* - The interceptor is attached in `useEffect` and ejected on cleanup to avoid stacking interceptors
|
|
29
|
+
* across re-renders or unmount/mount cycles.
|
|
30
|
+
*
|
|
31
|
+
* Notes:
|
|
32
|
+
* - `params.query` parsing is best-effort. Invalid JSON is ignored.
|
|
33
|
+
* - This hook assumes a query structure containing `filters`, where the workspace filter is identified by
|
|
34
|
+
* `filter[0] === "workspace"`.
|
|
35
|
+
*
|
|
36
|
+
* Parameters:
|
|
37
|
+
* @param {string | null} [url=null]
|
|
38
|
+
* Optional base URL override. If omitted/null, defaults to the relative `/api`.
|
|
39
|
+
*
|
|
40
|
+
* Return value:
|
|
41
|
+
* @returns {{ api: AxiosInstance }}
|
|
42
|
+
* Returns an object containing the configured Axios instance.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
export const useAxios = (url: string | null = null) => {
|
|
46
|
+
|
|
47
|
+
const reqInterceptorId = useRef<number | null>(null);
|
|
48
|
+
const { appId } = useAppConfig();
|
|
49
|
+
|
|
50
|
+
const source = appId ? `everysk-user-app-${appId}` : "everysk-user-app-development";
|
|
51
|
+
|
|
52
|
+
const api: AxiosInstance = useMemo(() => {
|
|
53
|
+
const instance = axios.create({ baseURL: url ?? "/api" });
|
|
54
|
+
instance.defaults.headers.common["X-Everysk-Source"] = source;
|
|
55
|
+
return instance;
|
|
56
|
+
}, [url, source]);
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
reqInterceptorId.current = api.interceptors.request.use(
|
|
60
|
+
(config: InternalAxiosRequestConfig<AnyRecord>) => {
|
|
61
|
+
const method = (config.method ?? "").toLowerCase();
|
|
62
|
+
|
|
63
|
+
if (method === "get" || method === "delete") {
|
|
64
|
+
const params = (config.params ?? {}) as Record<string, unknown>;
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
const rawQuery = params.query;
|
|
68
|
+
const queryObj = typeof rawQuery === "string" ? JSON.parse(rawQuery) : null;
|
|
69
|
+
|
|
70
|
+
const workspaceFilter = queryObj?.filters?.find(
|
|
71
|
+
(filter: FilterExpression) => filter?.[0] === "workspace"
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const workspace =
|
|
75
|
+
Array.isArray(workspaceFilter) ? workspaceFilter[workspaceFilter.length - 1] : null;
|
|
76
|
+
|
|
77
|
+
if (workspace) {
|
|
78
|
+
config.params = { ...params, workspace };
|
|
79
|
+
}
|
|
80
|
+
} catch {
|
|
81
|
+
// ignore invalid query JSON
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return config;
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return () => {
|
|
90
|
+
if (reqInterceptorId.current != null) {
|
|
91
|
+
api.interceptors.request.eject(reqInterceptorId.current);
|
|
92
|
+
}
|
|
93
|
+
reqInterceptorId.current = null;
|
|
94
|
+
};
|
|
95
|
+
}, [api]);
|
|
96
|
+
|
|
97
|
+
return { api };
|
|
98
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
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 { getWorkerExecution } from "@/api/workflow";
|
|
8
|
+
import type { WorkerExecution } from "@/types/workflow";
|
|
9
|
+
import type { EntityQueryOptions } from "@/types/entityQuery";
|
|
10
|
+
|
|
11
|
+
export type FetchWorkerExecutionProps<TData = WorkerExecution, TSelected = TData> = {
|
|
12
|
+
workflowId: string;
|
|
13
|
+
workerExecutionId: string;
|
|
14
|
+
workspace: string;
|
|
15
|
+
queryOptions?: EntityQueryOptions<TData, TSelected>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const defaultQueryOptions: EntityQueryOptions<WorkerExecution> = {
|
|
19
|
+
refetchOnMount: "always",
|
|
20
|
+
staleTime: 0,
|
|
21
|
+
gcTime: 0,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* useFetchWorkerExecution
|
|
26
|
+
*
|
|
27
|
+
* Data-fetching hook built on TanStack Query to retrieve a single worker execution.
|
|
28
|
+
*
|
|
29
|
+
* It also:
|
|
30
|
+
* - builds a stable React Query `queryKey` that can be reused by mutation hooks for cache invalidation
|
|
31
|
+
* - triggers an error alert via `useAppAlert` whenever `query.error` is present
|
|
32
|
+
*
|
|
33
|
+
* @param workflowId - Workflow identifier the worker execution belongs to (required).
|
|
34
|
+
* @param workerExecutionId - Worker execution identifier (required).
|
|
35
|
+
* @param workspace - Workspace the workflow belongs to (required).
|
|
36
|
+
* @param queryOptions - TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
37
|
+
*
|
|
38
|
+
* @returns TanStack Query result extended with `queryKey`.
|
|
39
|
+
*
|
|
40
|
+
* Example:
|
|
41
|
+
* ```ts
|
|
42
|
+
* const { data, isLoading } = useFetchWorkerExecution({
|
|
43
|
+
* workflowId: "wf-123",
|
|
44
|
+
* workerExecutionId: "wkex-456",
|
|
45
|
+
* workspace: "main",
|
|
46
|
+
* });
|
|
47
|
+
* // data -> WorkerExecution
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export const useFetchWorkerExecution = ({ workflowId, workerExecutionId, workspace, queryOptions = defaultQueryOptions }: FetchWorkerExecutionProps) => {
|
|
51
|
+
|
|
52
|
+
const { api } = useAxios();
|
|
53
|
+
const { showAlert } = useAppAlert();
|
|
54
|
+
|
|
55
|
+
const queryKey = ["worker_execution", workflowId, workerExecutionId, workspace];
|
|
56
|
+
|
|
57
|
+
const query = useQuery<WorkerExecution>({
|
|
58
|
+
queryKey,
|
|
59
|
+
queryFn: async () => {
|
|
60
|
+
return await getWorkerExecution(api, workflowId, workerExecutionId, workspace);
|
|
61
|
+
},
|
|
62
|
+
...queryOptions ?? {}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!query.error) return;
|
|
67
|
+
|
|
68
|
+
showAlert({
|
|
69
|
+
severity: "error",
|
|
70
|
+
message: query.error.message,
|
|
71
|
+
});
|
|
72
|
+
}, [query.error, showAlert]);
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
...query,
|
|
76
|
+
queryKey,
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useInfiniteQuery, type UseInfiniteQueryOptions, type QueryKey } from "@tanstack/react-query";
|
|
3
|
+
|
|
4
|
+
import { useAxios } from "@/hooks/useAxios";
|
|
5
|
+
import { listWorkerExecutions } from "@/api/workflow";
|
|
6
|
+
import type { FetchEntitiesParams } from "@/types/entityQuery";
|
|
7
|
+
import { buildQueryKey, buildQueryObject } from "@/api/entityQuery";
|
|
8
|
+
import type { WorkerExecution, WorkerExecutionListResponse } from "@/types/workflow";
|
|
9
|
+
|
|
10
|
+
type PageToken = string | null;
|
|
11
|
+
|
|
12
|
+
type InfiniteOptions<TData> = Omit<UseInfiniteQueryOptions<WorkerExecutionListResponse, Error, TData, QueryKey, PageToken>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam">;
|
|
13
|
+
|
|
14
|
+
export type FetchInfiniteWorkerExecutionProps = FetchEntitiesParams<WorkerExecution[], InfiniteOptions<WorkerExecution[]>> & {
|
|
15
|
+
workflowId: string;
|
|
16
|
+
workflowExecutionId: string;
|
|
17
|
+
pageSize?: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const defaultQueryOptions: InfiniteOptions<WorkerExecution[]> = {
|
|
21
|
+
refetchOnMount: "always",
|
|
22
|
+
staleTime: 0,
|
|
23
|
+
gcTime: 0,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* useFetchWorkerExecutions
|
|
28
|
+
*
|
|
29
|
+
* Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve
|
|
30
|
+
* worker executions for a given workflow with cursor-based pagination.
|
|
31
|
+
*
|
|
32
|
+
* Automatically flattens all pages into a single `WorkerExecution[]` via `select`.
|
|
33
|
+
*
|
|
34
|
+
* Note: `query.data` returns a flat `WorkerExecution[]` with all fetched items merged across pages.
|
|
35
|
+
*
|
|
36
|
+
* @param workflowId - Workflow identifier whose worker executions to fetch (required).
|
|
37
|
+
* @param workflowExecutionId - Workflow execution identifier to filter worker executions (required).
|
|
38
|
+
* @param filters - Filters applied to every page request. Must include a `workspace` filter.
|
|
39
|
+
* @param order - Sorting applied to every page request.
|
|
40
|
+
* @param projection - Single field to project: `"field"` returns only that field (others come
|
|
41
|
+
* back null), `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
42
|
+
* @param pageSize - Number of executions to fetch per page. Defaults to `10`.
|
|
43
|
+
* @param queryOptions - TanStack Query options passed through to `useInfiniteQuery`.
|
|
44
|
+
*
|
|
45
|
+
* @returns
|
|
46
|
+
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
47
|
+
* - `queryKey`: the cache key used by React Query
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const { query } = useFetchWorkerExecutions({
|
|
52
|
+
* workflowId: "wf-123",
|
|
53
|
+
* workflowExecutionId: "wfex-456",
|
|
54
|
+
* filters: [{ field: "workspace", value: "main" }],
|
|
55
|
+
* pageSize: 20,
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* // Flat list of all fetched worker executions
|
|
59
|
+
* const workerExecutions = query.data ?? [];
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export function useFetchWorkerExecutions({ workflowId, workflowExecutionId, filters = [], order = [], projection = "", pageSize = 10, queryOptions }: FetchInfiniteWorkerExecutionProps) {
|
|
63
|
+
const { api } = useAxios();
|
|
64
|
+
|
|
65
|
+
const queryKey = buildQueryKey(["worker_executions", workflowId, workflowExecutionId], filters);
|
|
66
|
+
|
|
67
|
+
const mergedQueryOptions = useMemo<InfiniteOptions<WorkerExecution[]>>(() => ({
|
|
68
|
+
...defaultQueryOptions,
|
|
69
|
+
...(queryOptions ?? {}),
|
|
70
|
+
}), [queryOptions]);
|
|
71
|
+
|
|
72
|
+
const query = useInfiniteQuery<WorkerExecutionListResponse, Error, WorkerExecution[], QueryKey, PageToken>({
|
|
73
|
+
queryKey,
|
|
74
|
+
initialPageParam: null,
|
|
75
|
+
getNextPageParam: (lastPage) => lastPage.next_page_token ?? undefined,
|
|
76
|
+
|
|
77
|
+
queryFn: async ({ pageParam }) => {
|
|
78
|
+
const queryFilter = buildQueryObject({
|
|
79
|
+
filters,
|
|
80
|
+
order,
|
|
81
|
+
projection,
|
|
82
|
+
pageSize,
|
|
83
|
+
pageToken: pageParam ?? undefined,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return await listWorkerExecutions(api, workflowId, workflowExecutionId, queryFilter);
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
select: (data) => data.pages.flatMap((p) => p.worker_executions),
|
|
90
|
+
|
|
91
|
+
...mergedQueryOptions,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
query,
|
|
96
|
+
queryKey,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { getWorkflow } from "@/api/workflow";
|
|
8
|
+
import type { Workflow } from "@/types/workflow";
|
|
9
|
+
import type { EntityQueryOptions, FetchEntityParams } from "@/types/entityQuery";
|
|
10
|
+
|
|
11
|
+
export type FetchWorkflowProps<TData = Workflow, TSelected = TData> = FetchEntityParams<TData, TSelected>;
|
|
12
|
+
|
|
13
|
+
const defaultQueryOptions: EntityQueryOptions<Workflow> = {
|
|
14
|
+
refetchOnMount: "always",
|
|
15
|
+
staleTime: 0,
|
|
16
|
+
gcTime: 0
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* useFetchWorkflow
|
|
21
|
+
*
|
|
22
|
+
* Data-fetching hook built on TanStack Query to retrieve a single workflow by ID.
|
|
23
|
+
*
|
|
24
|
+
* It also:
|
|
25
|
+
* - builds a stable React Query `queryKey` that can be reused by mutation hooks for cache invalidation
|
|
26
|
+
* - triggers an error alert via `useAppAlert` whenever `query.error` is present
|
|
27
|
+
*
|
|
28
|
+
* @param id - Workflow identifier (required).
|
|
29
|
+
* @param workspace - Workspace the workflow belongs to (required).
|
|
30
|
+
* @param queryOptions - TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
31
|
+
*
|
|
32
|
+
* @returns TanStack Query result extended with `queryKey`.
|
|
33
|
+
*
|
|
34
|
+
* Tip:
|
|
35
|
+
* - The returned `queryKey` can be reused by mutation hooks for cache invalidation:
|
|
36
|
+
* ```ts
|
|
37
|
+
* const fetch = useFetchWorkflow({ id: "wf-123", workspace: "main" });
|
|
38
|
+
* useWorkflowMutations({ queryKey: fetch.queryKey });
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* Example:
|
|
42
|
+
* ```ts
|
|
43
|
+
* const { data, isLoading } = useFetchWorkflow({ id: "wf-123", workspace: "main" });
|
|
44
|
+
* // data -> Workflow
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export const useFetchWorkflow = ({ id, workspace, queryOptions = defaultQueryOptions }: FetchWorkflowProps) => {
|
|
48
|
+
|
|
49
|
+
const { api } = useAxios();
|
|
50
|
+
const { showAlert } = useAppAlert();
|
|
51
|
+
|
|
52
|
+
const queryKey = ["workflow", id, workspace];
|
|
53
|
+
|
|
54
|
+
const query = useQuery<Workflow>({
|
|
55
|
+
queryKey,
|
|
56
|
+
queryFn: async () => {
|
|
57
|
+
const workflow = await getWorkflow(api, id, workspace);
|
|
58
|
+
return workflow;
|
|
59
|
+
},
|
|
60
|
+
...queryOptions ?? {}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!query.error) return;
|
|
65
|
+
|
|
66
|
+
showAlert({
|
|
67
|
+
severity: "error",
|
|
68
|
+
message: query.error.message,
|
|
69
|
+
});
|
|
70
|
+
}, [query.error, showAlert]);
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
...query,
|
|
74
|
+
queryKey,
|
|
75
|
+
};
|
|
76
|
+
};
|