@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,93 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
|
|
5
|
+
import { useAxios } from "@/hooks/useAxios";
|
|
6
|
+
import type { EveryskFile } from "@/types/file";
|
|
7
|
+
import { useAppAlert } from "@/contexts/appAlertContext/useAppAlert";
|
|
8
|
+
import { getFile } from "@/api/file";
|
|
9
|
+
import type { EntityQueryOptions, FetchEntityParams } from "@/types/entityQuery";
|
|
10
|
+
|
|
11
|
+
export type FetchFileProps<TData = EveryskFile, TSelected = TData> = FetchEntityParams<TData, TSelected>;
|
|
12
|
+
|
|
13
|
+
const defaultQueryOptions: EntityQueryOptions<EveryskFile> = {
|
|
14
|
+
refetchOnMount: "always",
|
|
15
|
+
staleTime: 0,
|
|
16
|
+
gcTime: 0
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* useFetchFile
|
|
21
|
+
*
|
|
22
|
+
* Data-fetching hook built on TanStack Query to retrieve a single file 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
|
+
* Important notes:
|
|
29
|
+
* - Always returns a single `EveryskFile` object.
|
|
30
|
+
* - `EveryskFile.data` represents the file content and is expected to be a Base64-encoded string
|
|
31
|
+
* when provided by the API (or when sending content through mutations).
|
|
32
|
+
*
|
|
33
|
+
* Parameters (FetchFileProps):
|
|
34
|
+
* @param {string} id
|
|
35
|
+
* EveryskFile identifier (required).
|
|
36
|
+
*
|
|
37
|
+
* @param {string} workspace
|
|
38
|
+
* Workspace the file belongs to (required by `getFile`).
|
|
39
|
+
*
|
|
40
|
+
* @param {EntityQueryOptions<any>} [queryOptions=defaultQueryOptions]
|
|
41
|
+
* TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
42
|
+
*
|
|
43
|
+
* Returns:
|
|
44
|
+
* @returns {object}
|
|
45
|
+
* TanStack Query's `query` object extended with:
|
|
46
|
+
* - `queryKey`: the cache key used by React Query
|
|
47
|
+
*
|
|
48
|
+
* Tip:
|
|
49
|
+
* - The returned `queryKey` can be reused by mutation hooks for cache invalidation:
|
|
50
|
+
* ```ts
|
|
51
|
+
* const fetch = useFetchFile({ id: "file-123", workspace: "ws-1" });
|
|
52
|
+
* useFileMutations({ queryKey: fetch.queryKey });
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* Example:
|
|
56
|
+
* ```ts
|
|
57
|
+
* const { data, isLoading } = useFetchFile({
|
|
58
|
+
* id: "file-123",
|
|
59
|
+
* workspace: "ws-1",
|
|
60
|
+
* });
|
|
61
|
+
* // data -> EveryskFile
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export const useFetchFile = ({ id, workspace, queryOptions = defaultQueryOptions }: FetchFileProps) => {
|
|
65
|
+
|
|
66
|
+
const { api } = useAxios();
|
|
67
|
+
const { showAlert } = useAppAlert();
|
|
68
|
+
|
|
69
|
+
const queryKey = ["file", id, workspace];
|
|
70
|
+
|
|
71
|
+
const query = useQuery<EveryskFile>({
|
|
72
|
+
queryKey,
|
|
73
|
+
queryFn: async () => {
|
|
74
|
+
const file = await getFile(api, id, workspace);
|
|
75
|
+
return file;
|
|
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,109 @@
|
|
|
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 { listFiles } from "@/api/file";
|
|
6
|
+
import type { EveryskFile, FileListResponse } from "@/types/file";
|
|
7
|
+
import type { FetchEntitiesParams } from "@/types/entityQuery";
|
|
8
|
+
import { buildQueryKey, buildQueryObject } from "@/api/entityQuery";
|
|
9
|
+
|
|
10
|
+
type PageToken = string | null;
|
|
11
|
+
|
|
12
|
+
type InfiniteOptions<TData> = Omit<
|
|
13
|
+
UseInfiniteQueryOptions<FileListResponse, Error, TData, QueryKey, PageToken>,
|
|
14
|
+
"queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam"
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
export type FetchInfiniteFileProps = FetchEntitiesParams<EveryskFile[], InfiniteOptions<EveryskFile[]>> & {
|
|
18
|
+
pageSize?: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const defaultQueryOptions: InfiniteOptions<EveryskFile[]> = {
|
|
22
|
+
refetchOnMount: "always",
|
|
23
|
+
staleTime: 0,
|
|
24
|
+
gcTime: 0,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* useFetchFiles
|
|
29
|
+
*
|
|
30
|
+
* Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve
|
|
31
|
+
* files with cursor-based pagination.
|
|
32
|
+
*
|
|
33
|
+
* It also:
|
|
34
|
+
* - flattens all pages into a single `EveryskFile[]` via `select`
|
|
35
|
+
*
|
|
36
|
+
* Important notes:
|
|
37
|
+
* - `query.data` returns a flat `EveryskFile[]` (all pages merged).
|
|
38
|
+
*
|
|
39
|
+
* Parameters (FetchInfiniteFileProps):
|
|
40
|
+
* @param {FilterClause[]} [filters=[]]
|
|
41
|
+
* Filters applied to every page request. Must include a `workspace` filter.
|
|
42
|
+
*
|
|
43
|
+
* @param {string[]} [order=[]]
|
|
44
|
+
* Sorting applied to every page request.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} [projection=""]
|
|
47
|
+
* Single field to project: `"field"` returns only that field (others come back null),
|
|
48
|
+
* `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
49
|
+
*
|
|
50
|
+
* @param {number} [pageSize=10]
|
|
51
|
+
* Number of files to fetch per page.
|
|
52
|
+
*
|
|
53
|
+
* @param {InfiniteOptions<EveryskFile[]>} [queryOptions]
|
|
54
|
+
* TanStack Query options passed through to `useInfiniteQuery`
|
|
55
|
+
* (e.g., enabled, staleTime, gcTime, etc.).
|
|
56
|
+
*
|
|
57
|
+
* Returns:
|
|
58
|
+
* @returns {object}
|
|
59
|
+
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
60
|
+
* - `queryKey`: the cache key used by React Query
|
|
61
|
+
*
|
|
62
|
+
* Example:
|
|
63
|
+
* ```ts
|
|
64
|
+
* const { query } = useFetchFiles({
|
|
65
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
66
|
+
* pageSize: 20,
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* // Flat list of all fetched files
|
|
70
|
+
* const files = query.data ?? [];
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export function useFetchFiles({ filters = [], order = [], projection = "", pageSize = 10, queryOptions }: FetchInfiniteFileProps) {
|
|
74
|
+
const { api } = useAxios();
|
|
75
|
+
|
|
76
|
+
const queryKey = buildQueryKey(["files"], filters);
|
|
77
|
+
|
|
78
|
+
const mergedQueryOptions = useMemo<InfiniteOptions<EveryskFile[]>>(() => ({
|
|
79
|
+
...defaultQueryOptions,
|
|
80
|
+
...(queryOptions ?? {}),
|
|
81
|
+
}), [queryOptions]);
|
|
82
|
+
|
|
83
|
+
const query = useInfiniteQuery<FileListResponse, Error, EveryskFile[], QueryKey, PageToken>({
|
|
84
|
+
queryKey,
|
|
85
|
+
initialPageParam: null,
|
|
86
|
+
getNextPageParam: (lastPage) => lastPage.next_page_token ?? undefined,
|
|
87
|
+
|
|
88
|
+
queryFn: async ({ pageParam }) => {
|
|
89
|
+
const queryFilter = buildQueryObject({
|
|
90
|
+
filters,
|
|
91
|
+
order,
|
|
92
|
+
projection,
|
|
93
|
+
pageSize,
|
|
94
|
+
pageToken: pageParam ?? undefined,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
return await listFiles(api, queryFilter);
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
select: (data) => data.pages.flatMap((p) => p.files),
|
|
101
|
+
|
|
102
|
+
...mergedQueryOptions,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
query,
|
|
107
|
+
queryKey,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
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 { EveryskFile } from "@/types/file";
|
|
6
|
+
import { deleteFile, createFile, updateFile } from "@/api/file";
|
|
7
|
+
|
|
8
|
+
type CreateFileProps = {
|
|
9
|
+
data: Partial<EveryskFile>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type UpdateFileProps = {
|
|
13
|
+
id: string;
|
|
14
|
+
data: Partial<EveryskFile>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type DeleteFileProps = {
|
|
18
|
+
id: string;
|
|
19
|
+
workspace: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type UseFileMutationsProps = {
|
|
23
|
+
queryKey?: unknown[];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getErrorMessage = (err: unknown, fallback: string) =>
|
|
27
|
+
err instanceof Error && err.message ? err.message : fallback;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* useFileMutations
|
|
31
|
+
*
|
|
32
|
+
* Mutation hook built on TanStack Query to perform EveryskFile write operations:
|
|
33
|
+
* - create a file (POST)
|
|
34
|
+
* - update a file (PUT)
|
|
35
|
+
* - delete a file (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 `useFetchFile`.
|
|
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 `deleteFile(api, id, workspace)`
|
|
46
|
+
* expects it as a query param.
|
|
47
|
+
*
|
|
48
|
+
* - EveryskFile content (`data`):
|
|
49
|
+
* - When creating/updating a file, the file content must be provided in `data` as a Base64-encoded string.
|
|
50
|
+
* - Send only the raw Base64 content (do not include a data URL prefix like `data:<mime>;base64,`)
|
|
51
|
+
* - `content_type` should match the file MIME type (e.g., "text/csv", "application/pdf").
|
|
52
|
+
*
|
|
53
|
+
* Parameters (UseFileMutationsProps):
|
|
54
|
+
* @param {unknown[]} [queryKey]
|
|
55
|
+
* Query key to invalidate after successful mutations. Use the same `queryKey` you pass to the relevant `useQuery`
|
|
56
|
+
* (e.g., file list/detail) so UI data is refreshed automatically after a write.
|
|
57
|
+
*
|
|
58
|
+
* Tip:
|
|
59
|
+
* - If you're using `useFetchFile`, you can pass its returned `queryKey` directly:
|
|
60
|
+
* `const fetch = useFetchFile(...);`
|
|
61
|
+
* `useFileMutations({ queryKey: fetch.queryKey });`
|
|
62
|
+
*
|
|
63
|
+
* Mutations:
|
|
64
|
+
* - `create`:
|
|
65
|
+
* - mutationFn: `createFile(api, data)`
|
|
66
|
+
* - variables: `{ data: Partial<EveryskFile> }`
|
|
67
|
+
* - success message: "EveryskFile created successfully."
|
|
68
|
+
* - error message: "Unable to create the file. Please try again." (fallback)
|
|
69
|
+
*
|
|
70
|
+
* - `update`:
|
|
71
|
+
* - mutationFn: `updateFile(api, id, data)`
|
|
72
|
+
* - variables: `{ id: string; data: Partial<EveryskFile> }`
|
|
73
|
+
* - success message: "EveryskFile updated successfully."
|
|
74
|
+
* - error message: "Unable to update the file. Please try again." (fallback)
|
|
75
|
+
*
|
|
76
|
+
* - `remove`:
|
|
77
|
+
* - mutationFn: `deleteFile(api, id, workspace)`
|
|
78
|
+
* - variables: `{ id: string; workspace: string }`
|
|
79
|
+
* - success message: "EveryskFile deleted successfully."
|
|
80
|
+
* - error message: "Unable to delete the file. Please try again." (fallback)
|
|
81
|
+
*
|
|
82
|
+
* Return value:
|
|
83
|
+
* @returns {object}
|
|
84
|
+
* Returns an object with the three TanStack Query mutation results:
|
|
85
|
+
* - `create`: UseMutationResult<EveryskFile, Error, CreateFileProps, unknown>
|
|
86
|
+
* - `update`: UseMutationResult<EveryskFile, Error, UpdateFileProps, unknown>
|
|
87
|
+
* - `remove`: UseMutationResult<EveryskFile, Error, DeleteFileProps, unknown>
|
|
88
|
+
*
|
|
89
|
+
* Each mutation includes standard TanStack Query helpers:
|
|
90
|
+
* - `mutate(variables, options?)`
|
|
91
|
+
* - `mutateAsync(variables, options?)`
|
|
92
|
+
* - `isPending`, `isSuccess`, `isError`, `error`, `data`, etc.
|
|
93
|
+
*
|
|
94
|
+
* Examples:
|
|
95
|
+
*
|
|
96
|
+
* 1) Invalidate a file list query after mutations:
|
|
97
|
+
* ```ts
|
|
98
|
+
* const { create, update, remove } = useFileMutations({ queryKey: ["file"] });
|
|
99
|
+
*
|
|
100
|
+
* // Create
|
|
101
|
+
* create.mutate({
|
|
102
|
+
* data: {
|
|
103
|
+
* name: "My file",
|
|
104
|
+
* workspace: "ws-1",
|
|
105
|
+
* content_type: "text/plain",
|
|
106
|
+
* version: "1",
|
|
107
|
+
* link_uid: null,
|
|
108
|
+
* data: "SGVsbG8gd29ybGQ=", // Base64 content
|
|
109
|
+
* }
|
|
110
|
+
* });
|
|
111
|
+
*
|
|
112
|
+
* // Update
|
|
113
|
+
* update.mutate({
|
|
114
|
+
* id: "file-123",
|
|
115
|
+
* data: {
|
|
116
|
+
* name: "Renamed file",
|
|
117
|
+
* content_type: "text/plain",
|
|
118
|
+
* data: "SGVsbG8gd29ybGQ=", // Base64 content (optional if only renaming)
|
|
119
|
+
* }
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* // Delete
|
|
123
|
+
* remove.mutate({ id: "file-123", workspace: "ws-1" });
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* 2) Using async/await with `mutateAsync`:
|
|
127
|
+
* ```ts
|
|
128
|
+
* const { create } = useFileMutations({ queryKey: ["file"] });
|
|
129
|
+
*
|
|
130
|
+
* await create.mutateAsync({
|
|
131
|
+
* data: {
|
|
132
|
+
* name: "My file",
|
|
133
|
+
* workspace: "ws-1",
|
|
134
|
+
* content_type: "text/plain",
|
|
135
|
+
* version: "1",
|
|
136
|
+
* link_uid: null,
|
|
137
|
+
* data: "SGVsbG8gd29ybGQ=",
|
|
138
|
+
* }
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* 3) Without cache invalidation (no queryKey):
|
|
143
|
+
* ```ts
|
|
144
|
+
* const { update } = useFileMutations({});
|
|
145
|
+
*
|
|
146
|
+
* update.mutate({
|
|
147
|
+
* id: "file-123",
|
|
148
|
+
* data: {
|
|
149
|
+
* name: "New name",
|
|
150
|
+
* content_type: "text/plain",
|
|
151
|
+
* }
|
|
152
|
+
* });
|
|
153
|
+
* // Mutation still runs and alerts are shown, but cached queries are not invalidated.
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* 4) Using `useFetchFile` queryKey for automatic invalidation:
|
|
157
|
+
* ```ts
|
|
158
|
+
* const fetch = useFetchFile({
|
|
159
|
+
* id: null,
|
|
160
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
161
|
+
* });
|
|
162
|
+
*
|
|
163
|
+
* const { remove } = useFileMutations({ queryKey: fetch.queryKey });
|
|
164
|
+
*
|
|
165
|
+
* await remove.mutateAsync({ id: "file-123", workspace: "ws-1" });
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
export const useFileMutations = ({ queryKey }: UseFileMutationsProps) => {
|
|
170
|
+
const { api } = useAxios();
|
|
171
|
+
const { showAlert } = useAppAlert();
|
|
172
|
+
const queryClient = useQueryClient();
|
|
173
|
+
|
|
174
|
+
const invalidate = async () => {
|
|
175
|
+
if (!queryKey?.length) return;
|
|
176
|
+
await queryClient.invalidateQueries({ queryKey });
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const create = useMutation({
|
|
180
|
+
mutationFn: async ({ data }: CreateFileProps) => createFile(api, data),
|
|
181
|
+
onSuccess: async () => {
|
|
182
|
+
await invalidate();
|
|
183
|
+
showAlert({
|
|
184
|
+
severity: "success",
|
|
185
|
+
message: "EveryskFile created successfully.",
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
onError: (err: unknown) => {
|
|
189
|
+
showAlert({
|
|
190
|
+
severity: "error",
|
|
191
|
+
message: getErrorMessage(
|
|
192
|
+
err,
|
|
193
|
+
"Unable to create the file. Please try again."
|
|
194
|
+
),
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const update = useMutation({
|
|
200
|
+
mutationFn: async ({ id, data }: UpdateFileProps) => updateFile(api, id, data),
|
|
201
|
+
onSuccess: async () => {
|
|
202
|
+
await invalidate();
|
|
203
|
+
showAlert({
|
|
204
|
+
severity: "success",
|
|
205
|
+
message: "EveryskFile updated successfully.",
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
onError: (err: unknown) => {
|
|
209
|
+
showAlert({
|
|
210
|
+
severity: "error",
|
|
211
|
+
message: getErrorMessage(
|
|
212
|
+
err,
|
|
213
|
+
"Unable to update the file. Please try again."
|
|
214
|
+
),
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
const remove = useMutation({
|
|
220
|
+
mutationFn: async ({ id, workspace }: DeleteFileProps) => deleteFile(api, id, workspace),
|
|
221
|
+
onSuccess: async () => {
|
|
222
|
+
await invalidate();
|
|
223
|
+
showAlert({
|
|
224
|
+
severity: "success",
|
|
225
|
+
message: "EveryskFile deleted successfully.",
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
onError: (err: unknown) => {
|
|
229
|
+
showAlert({
|
|
230
|
+
severity: "error",
|
|
231
|
+
message: getErrorMessage(
|
|
232
|
+
err,
|
|
233
|
+
"Unable to delete the file. Please try again."
|
|
234
|
+
),
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
return { create, update, remove };
|
|
240
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
|
|
4
|
+
import { useAxios } from "@/hooks/useAxios";
|
|
5
|
+
import { useAppAlert } from "@/contexts/appAlertContext/useAppAlert";
|
|
6
|
+
import type { Portfolio } from "@/types/portfolio";
|
|
7
|
+
import { getPortfolio } from "@/api/portfolio";
|
|
8
|
+
import type { EntityQueryOptions, FetchEntityParams } from "@/types/entityQuery";
|
|
9
|
+
|
|
10
|
+
export type FetchPortfolioProps<TData = Portfolio, TSelected = TData> = FetchEntityParams<TData, TSelected>;
|
|
11
|
+
|
|
12
|
+
const defaultQueryOptions: EntityQueryOptions<Portfolio> = {
|
|
13
|
+
refetchOnMount: "always",
|
|
14
|
+
staleTime: 0,
|
|
15
|
+
gcTime: 0
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* useFetchPortfolio
|
|
20
|
+
*
|
|
21
|
+
* Data-fetching hook built on TanStack Query to retrieve a single portfolio by ID.
|
|
22
|
+
*
|
|
23
|
+
* It also:
|
|
24
|
+
* - builds a stable React Query `queryKey` that can be reused by mutation hooks for cache invalidation
|
|
25
|
+
* - triggers an error alert via `useAppAlert` whenever `query.error` is present
|
|
26
|
+
*
|
|
27
|
+
* Important notes:
|
|
28
|
+
* - Always returns a single `Portfolio` object.
|
|
29
|
+
*
|
|
30
|
+
* Parameters (FetchPortfolioProps):
|
|
31
|
+
* @param {string} id
|
|
32
|
+
* Portfolio identifier (required).
|
|
33
|
+
*
|
|
34
|
+
* @param {string} workspace
|
|
35
|
+
* Workspace the portfolio belongs to (required by `getPortfolio`).
|
|
36
|
+
*
|
|
37
|
+
* @param {EntityQueryOptions<Portfolio>} [queryOptions=defaultQueryOptions]
|
|
38
|
+
* TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
39
|
+
*
|
|
40
|
+
* Returns:
|
|
41
|
+
* @returns {object}
|
|
42
|
+
* TanStack Query's `query` object extended with:
|
|
43
|
+
* - `queryKey`: the cache key used by React Query
|
|
44
|
+
*
|
|
45
|
+
* Tip:
|
|
46
|
+
* - The returned `queryKey` can be reused by mutation hooks for cache invalidation:
|
|
47
|
+
* ```ts
|
|
48
|
+
* const fetch = useFetchPortfolio({ id: "pf-123", workspace: "ws-1" });
|
|
49
|
+
* usePortfolioMutations({ queryKey: fetch.queryKey });
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* Example:
|
|
53
|
+
* ```ts
|
|
54
|
+
* const { data, isLoading } = useFetchPortfolio({
|
|
55
|
+
* id: "pf-123",
|
|
56
|
+
* workspace: "ws-1",
|
|
57
|
+
* });
|
|
58
|
+
* // data -> Portfolio
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export const useFetchPortfolio = ({ id, workspace, queryOptions = defaultQueryOptions }: FetchPortfolioProps) => {
|
|
62
|
+
|
|
63
|
+
const { api } = useAxios();
|
|
64
|
+
const { showAlert } = useAppAlert();
|
|
65
|
+
|
|
66
|
+
const queryKey = [
|
|
67
|
+
"portfolio",
|
|
68
|
+
id,
|
|
69
|
+
workspace
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
const query = useQuery<Portfolio>({
|
|
73
|
+
queryKey,
|
|
74
|
+
queryFn: async () => {
|
|
75
|
+
const response = await getPortfolio(api, id, workspace);
|
|
76
|
+
return response.portfolio;
|
|
77
|
+
},
|
|
78
|
+
...queryOptions ?? {}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!query.error) return;
|
|
83
|
+
|
|
84
|
+
showAlert({
|
|
85
|
+
severity: "error",
|
|
86
|
+
message: query.error.message,
|
|
87
|
+
});
|
|
88
|
+
}, [query.error, showAlert]);
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
...query,
|
|
92
|
+
queryKey,
|
|
93
|
+
};
|
|
94
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
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 { listPortfolios } from "@/api/portfolio";
|
|
6
|
+
import type { FetchEntitiesParams } from "@/types/entityQuery";
|
|
7
|
+
import type { Portfolio, PortfolioListResponse } from "@/types/portfolio";
|
|
8
|
+
import { buildQueryKey, buildQueryObject } from "@/api/entityQuery";
|
|
9
|
+
|
|
10
|
+
type PageToken = string | null;
|
|
11
|
+
|
|
12
|
+
type InfiniteOptions<TData> = Omit<
|
|
13
|
+
UseInfiniteQueryOptions<PortfolioListResponse, Error, TData, QueryKey, PageToken>,
|
|
14
|
+
"queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam"
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
export type FetchInfinitePortfolioProps = FetchEntitiesParams<Portfolio[], InfiniteOptions<Portfolio[]>> & {
|
|
18
|
+
pageSize?: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const defaultQueryOptions: InfiniteOptions<Portfolio[]> = {
|
|
22
|
+
refetchOnMount: "always",
|
|
23
|
+
staleTime: 0,
|
|
24
|
+
gcTime: 0,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* useFetchInfinitePortfolios
|
|
29
|
+
*
|
|
30
|
+
* Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve
|
|
31
|
+
* portfolios with cursor-based pagination.
|
|
32
|
+
*
|
|
33
|
+
* It also:
|
|
34
|
+
* - flattens all pages into a single `Portfolio[]` via `select`
|
|
35
|
+
*
|
|
36
|
+
* Important notes:
|
|
37
|
+
* - `query.data` returns a flat `Portfolio[]` (all pages merged).
|
|
38
|
+
*
|
|
39
|
+
* Parameters (FetchInfinitePortfolioProps):
|
|
40
|
+
* @param {FilterClause[]} [filters=[]]
|
|
41
|
+
* Filters applied to every page request. Must include a `workspace` filter.
|
|
42
|
+
*
|
|
43
|
+
* @param {string[]} [order=[]]
|
|
44
|
+
* Sorting applied to every page request.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} [projection=""]
|
|
47
|
+
* Single field to project: `"field"` returns only that field (others come back null),
|
|
48
|
+
* `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
49
|
+
*
|
|
50
|
+
* @param {number} [pageSize=10]
|
|
51
|
+
* Number of portfolios to fetch per page.
|
|
52
|
+
*
|
|
53
|
+
* @param {InfiniteOptions<Portfolio[]>} [queryOptions]
|
|
54
|
+
* TanStack Query options passed through to `useInfiniteQuery`
|
|
55
|
+
* (e.g., enabled, staleTime, gcTime, etc.).
|
|
56
|
+
*
|
|
57
|
+
* Returns:
|
|
58
|
+
* @returns {object}
|
|
59
|
+
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
60
|
+
* - `queryKey`: the cache key used by React Query
|
|
61
|
+
*
|
|
62
|
+
* Example:
|
|
63
|
+
* ```ts
|
|
64
|
+
* const { query } = useFetchInfinitePortfolios({
|
|
65
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
66
|
+
* pageSize: 20,
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* // Flat list of all fetched portfolios
|
|
70
|
+
* const portfolios = query.data ?? [];
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export function useFetchPortfolios({ filters = [], order = [], projection = "", pageSize = 10, queryOptions }: FetchInfinitePortfolioProps) {
|
|
74
|
+
const { api } = useAxios();
|
|
75
|
+
|
|
76
|
+
const queryKey = buildQueryKey(["portfolios"], filters);
|
|
77
|
+
|
|
78
|
+
const mergedQueryOptions = useMemo<InfiniteOptions<Portfolio[]>>(() => ({
|
|
79
|
+
...defaultQueryOptions,
|
|
80
|
+
...(queryOptions ?? {}),
|
|
81
|
+
}), [queryOptions]);
|
|
82
|
+
|
|
83
|
+
const query = useInfiniteQuery<PortfolioListResponse, Error, Portfolio[], QueryKey, PageToken>({
|
|
84
|
+
queryKey,
|
|
85
|
+
initialPageParam: null,
|
|
86
|
+
getNextPageParam: (lastPage) => lastPage.next_page_token ?? undefined,
|
|
87
|
+
|
|
88
|
+
queryFn: async ({ pageParam }) => {
|
|
89
|
+
const queryFilter = buildQueryObject({
|
|
90
|
+
filters,
|
|
91
|
+
order,
|
|
92
|
+
projection,
|
|
93
|
+
pageSize,
|
|
94
|
+
pageToken: pageParam ?? undefined,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
return await listPortfolios(api, queryFilter);
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
select: (data) => data.pages.flatMap((p) => p.portfolios),
|
|
101
|
+
|
|
102
|
+
...mergedQueryOptions,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
query,
|
|
107
|
+
queryKey,
|
|
108
|
+
};
|
|
109
|
+
}
|