@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,210 @@
|
|
|
1
|
+
import type { Portfolio } from "../../types/portfolio.d.ts";
|
|
2
|
+
import type { FetchEntityParams } from "../../types/entityQuery.d.ts";
|
|
3
|
+
export type FetchPortfolioProps<TData = Portfolio, TSelected = TData> = FetchEntityParams<TData, TSelected>;
|
|
4
|
+
/**
|
|
5
|
+
* useFetchPortfolio
|
|
6
|
+
*
|
|
7
|
+
* Data-fetching hook built on TanStack Query to retrieve a single portfolio by ID.
|
|
8
|
+
*
|
|
9
|
+
* It also:
|
|
10
|
+
* - builds a stable React Query `queryKey` that can be reused by mutation hooks for cache invalidation
|
|
11
|
+
* - triggers an error alert via `useAppAlert` whenever `query.error` is present
|
|
12
|
+
*
|
|
13
|
+
* Important notes:
|
|
14
|
+
* - Always returns a single `Portfolio` object.
|
|
15
|
+
*
|
|
16
|
+
* Parameters (FetchPortfolioProps):
|
|
17
|
+
* @param {string} id
|
|
18
|
+
* Portfolio identifier (required).
|
|
19
|
+
*
|
|
20
|
+
* @param {string} workspace
|
|
21
|
+
* Workspace the portfolio belongs to (required by `getPortfolio`).
|
|
22
|
+
*
|
|
23
|
+
* @param {EntityQueryOptions<Portfolio>} [queryOptions=defaultQueryOptions]
|
|
24
|
+
* TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
25
|
+
*
|
|
26
|
+
* Returns:
|
|
27
|
+
* @returns {object}
|
|
28
|
+
* TanStack Query's `query` object extended with:
|
|
29
|
+
* - `queryKey`: the cache key used by React Query
|
|
30
|
+
*
|
|
31
|
+
* Tip:
|
|
32
|
+
* - The returned `queryKey` can be reused by mutation hooks for cache invalidation:
|
|
33
|
+
* ```ts
|
|
34
|
+
* const fetch = useFetchPortfolio({ id: "pf-123", workspace: "ws-1" });
|
|
35
|
+
* usePortfolioMutations({ queryKey: fetch.queryKey });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* Example:
|
|
39
|
+
* ```ts
|
|
40
|
+
* const { data, isLoading } = useFetchPortfolio({
|
|
41
|
+
* id: "pf-123",
|
|
42
|
+
* workspace: "ws-1",
|
|
43
|
+
* });
|
|
44
|
+
* // data -> Portfolio
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare const useFetchPortfolio: ({ id, workspace, queryOptions }: FetchPortfolioProps) => {
|
|
48
|
+
queryKey: string[];
|
|
49
|
+
data: Portfolio;
|
|
50
|
+
error: Error;
|
|
51
|
+
isError: true;
|
|
52
|
+
isPending: false;
|
|
53
|
+
isLoading: false;
|
|
54
|
+
isLoadingError: false;
|
|
55
|
+
isRefetchError: true;
|
|
56
|
+
isSuccess: false;
|
|
57
|
+
isPlaceholderData: false;
|
|
58
|
+
status: "error";
|
|
59
|
+
dataUpdatedAt: number;
|
|
60
|
+
errorUpdatedAt: number;
|
|
61
|
+
failureCount: number;
|
|
62
|
+
failureReason: Error | null;
|
|
63
|
+
errorUpdateCount: number;
|
|
64
|
+
isFetched: boolean;
|
|
65
|
+
isFetchedAfterMount: boolean;
|
|
66
|
+
isFetching: boolean;
|
|
67
|
+
isInitialLoading: boolean;
|
|
68
|
+
isPaused: boolean;
|
|
69
|
+
isRefetching: boolean;
|
|
70
|
+
isStale: boolean;
|
|
71
|
+
isEnabled: boolean;
|
|
72
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<Portfolio, Error>>;
|
|
73
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
74
|
+
} | {
|
|
75
|
+
queryKey: string[];
|
|
76
|
+
data: Portfolio;
|
|
77
|
+
error: null;
|
|
78
|
+
isError: false;
|
|
79
|
+
isPending: false;
|
|
80
|
+
isLoading: false;
|
|
81
|
+
isLoadingError: false;
|
|
82
|
+
isRefetchError: false;
|
|
83
|
+
isSuccess: true;
|
|
84
|
+
isPlaceholderData: false;
|
|
85
|
+
status: "success";
|
|
86
|
+
dataUpdatedAt: number;
|
|
87
|
+
errorUpdatedAt: number;
|
|
88
|
+
failureCount: number;
|
|
89
|
+
failureReason: Error | null;
|
|
90
|
+
errorUpdateCount: number;
|
|
91
|
+
isFetched: boolean;
|
|
92
|
+
isFetchedAfterMount: boolean;
|
|
93
|
+
isFetching: boolean;
|
|
94
|
+
isInitialLoading: boolean;
|
|
95
|
+
isPaused: boolean;
|
|
96
|
+
isRefetching: boolean;
|
|
97
|
+
isStale: boolean;
|
|
98
|
+
isEnabled: boolean;
|
|
99
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<Portfolio, Error>>;
|
|
100
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
101
|
+
} | {
|
|
102
|
+
queryKey: string[];
|
|
103
|
+
data: undefined;
|
|
104
|
+
error: Error;
|
|
105
|
+
isError: true;
|
|
106
|
+
isPending: false;
|
|
107
|
+
isLoading: false;
|
|
108
|
+
isLoadingError: true;
|
|
109
|
+
isRefetchError: false;
|
|
110
|
+
isSuccess: false;
|
|
111
|
+
isPlaceholderData: false;
|
|
112
|
+
status: "error";
|
|
113
|
+
dataUpdatedAt: number;
|
|
114
|
+
errorUpdatedAt: number;
|
|
115
|
+
failureCount: number;
|
|
116
|
+
failureReason: Error | null;
|
|
117
|
+
errorUpdateCount: number;
|
|
118
|
+
isFetched: boolean;
|
|
119
|
+
isFetchedAfterMount: boolean;
|
|
120
|
+
isFetching: boolean;
|
|
121
|
+
isInitialLoading: boolean;
|
|
122
|
+
isPaused: boolean;
|
|
123
|
+
isRefetching: boolean;
|
|
124
|
+
isStale: boolean;
|
|
125
|
+
isEnabled: boolean;
|
|
126
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<Portfolio, Error>>;
|
|
127
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
128
|
+
} | {
|
|
129
|
+
queryKey: string[];
|
|
130
|
+
data: undefined;
|
|
131
|
+
error: null;
|
|
132
|
+
isError: false;
|
|
133
|
+
isPending: true;
|
|
134
|
+
isLoading: true;
|
|
135
|
+
isLoadingError: false;
|
|
136
|
+
isRefetchError: false;
|
|
137
|
+
isSuccess: false;
|
|
138
|
+
isPlaceholderData: false;
|
|
139
|
+
status: "pending";
|
|
140
|
+
dataUpdatedAt: number;
|
|
141
|
+
errorUpdatedAt: number;
|
|
142
|
+
failureCount: number;
|
|
143
|
+
failureReason: Error | null;
|
|
144
|
+
errorUpdateCount: number;
|
|
145
|
+
isFetched: boolean;
|
|
146
|
+
isFetchedAfterMount: boolean;
|
|
147
|
+
isFetching: boolean;
|
|
148
|
+
isInitialLoading: boolean;
|
|
149
|
+
isPaused: boolean;
|
|
150
|
+
isRefetching: boolean;
|
|
151
|
+
isStale: boolean;
|
|
152
|
+
isEnabled: boolean;
|
|
153
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<Portfolio, Error>>;
|
|
154
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
155
|
+
} | {
|
|
156
|
+
queryKey: string[];
|
|
157
|
+
data: undefined;
|
|
158
|
+
error: null;
|
|
159
|
+
isError: false;
|
|
160
|
+
isPending: true;
|
|
161
|
+
isLoadingError: false;
|
|
162
|
+
isRefetchError: false;
|
|
163
|
+
isSuccess: false;
|
|
164
|
+
isPlaceholderData: false;
|
|
165
|
+
status: "pending";
|
|
166
|
+
dataUpdatedAt: number;
|
|
167
|
+
errorUpdatedAt: number;
|
|
168
|
+
failureCount: number;
|
|
169
|
+
failureReason: Error | null;
|
|
170
|
+
errorUpdateCount: number;
|
|
171
|
+
isFetched: boolean;
|
|
172
|
+
isFetchedAfterMount: boolean;
|
|
173
|
+
isFetching: boolean;
|
|
174
|
+
isLoading: boolean;
|
|
175
|
+
isInitialLoading: boolean;
|
|
176
|
+
isPaused: boolean;
|
|
177
|
+
isRefetching: boolean;
|
|
178
|
+
isStale: boolean;
|
|
179
|
+
isEnabled: boolean;
|
|
180
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<Portfolio, Error>>;
|
|
181
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
182
|
+
} | {
|
|
183
|
+
queryKey: string[];
|
|
184
|
+
data: Portfolio;
|
|
185
|
+
isError: false;
|
|
186
|
+
error: null;
|
|
187
|
+
isPending: false;
|
|
188
|
+
isLoading: false;
|
|
189
|
+
isLoadingError: false;
|
|
190
|
+
isRefetchError: false;
|
|
191
|
+
isSuccess: true;
|
|
192
|
+
isPlaceholderData: true;
|
|
193
|
+
status: "success";
|
|
194
|
+
dataUpdatedAt: number;
|
|
195
|
+
errorUpdatedAt: number;
|
|
196
|
+
failureCount: number;
|
|
197
|
+
failureReason: Error | null;
|
|
198
|
+
errorUpdateCount: number;
|
|
199
|
+
isFetched: boolean;
|
|
200
|
+
isFetchedAfterMount: boolean;
|
|
201
|
+
isFetching: boolean;
|
|
202
|
+
isInitialLoading: boolean;
|
|
203
|
+
isPaused: boolean;
|
|
204
|
+
isRefetching: boolean;
|
|
205
|
+
isStale: boolean;
|
|
206
|
+
isEnabled: boolean;
|
|
207
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<Portfolio, Error>>;
|
|
208
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
209
|
+
};
|
|
210
|
+
//# sourceMappingURL=useFetchPortfolio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchPortfolio.d.ts","sourceRoot":"","sources":["../../../src/hooks/portfolio/useFetchPortfolio.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAsB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,MAAM,mBAAmB,CAAC,KAAK,GAAG,SAAS,EAAE,SAAS,GAAG,KAAK,IAAI,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAQ5G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,iBAAiB,GAAI,iCAAuD,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC3G,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useAppAlert } from "../../contexts/appAlertContext/useAppAlert.js";
|
|
2
|
+
import { useAxios } from "../useAxios.js";
|
|
3
|
+
import { getPortfolio } from "../../api/portfolio.js";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
//#region src/hooks/portfolio/useFetchPortfolio.ts
|
|
7
|
+
var defaultQueryOptions = {
|
|
8
|
+
refetchOnMount: "always",
|
|
9
|
+
staleTime: 0,
|
|
10
|
+
gcTime: 0
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* useFetchPortfolio
|
|
14
|
+
*
|
|
15
|
+
* Data-fetching hook built on TanStack Query to retrieve a single portfolio by ID.
|
|
16
|
+
*
|
|
17
|
+
* It also:
|
|
18
|
+
* - builds a stable React Query `queryKey` that can be reused by mutation hooks for cache invalidation
|
|
19
|
+
* - triggers an error alert via `useAppAlert` whenever `query.error` is present
|
|
20
|
+
*
|
|
21
|
+
* Important notes:
|
|
22
|
+
* - Always returns a single `Portfolio` object.
|
|
23
|
+
*
|
|
24
|
+
* Parameters (FetchPortfolioProps):
|
|
25
|
+
* @param {string} id
|
|
26
|
+
* Portfolio identifier (required).
|
|
27
|
+
*
|
|
28
|
+
* @param {string} workspace
|
|
29
|
+
* Workspace the portfolio belongs to (required by `getPortfolio`).
|
|
30
|
+
*
|
|
31
|
+
* @param {EntityQueryOptions<Portfolio>} [queryOptions=defaultQueryOptions]
|
|
32
|
+
* TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
33
|
+
*
|
|
34
|
+
* Returns:
|
|
35
|
+
* @returns {object}
|
|
36
|
+
* TanStack Query's `query` object extended with:
|
|
37
|
+
* - `queryKey`: the cache key used by React Query
|
|
38
|
+
*
|
|
39
|
+
* Tip:
|
|
40
|
+
* - The returned `queryKey` can be reused by mutation hooks for cache invalidation:
|
|
41
|
+
* ```ts
|
|
42
|
+
* const fetch = useFetchPortfolio({ id: "pf-123", workspace: "ws-1" });
|
|
43
|
+
* usePortfolioMutations({ queryKey: fetch.queryKey });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Example:
|
|
47
|
+
* ```ts
|
|
48
|
+
* const { data, isLoading } = useFetchPortfolio({
|
|
49
|
+
* id: "pf-123",
|
|
50
|
+
* workspace: "ws-1",
|
|
51
|
+
* });
|
|
52
|
+
* // data -> Portfolio
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
var useFetchPortfolio = ({ id, workspace, queryOptions = defaultQueryOptions }) => {
|
|
56
|
+
const { api } = useAxios();
|
|
57
|
+
const { showAlert } = useAppAlert();
|
|
58
|
+
const queryKey = [
|
|
59
|
+
"portfolio",
|
|
60
|
+
id,
|
|
61
|
+
workspace
|
|
62
|
+
];
|
|
63
|
+
const query = useQuery({
|
|
64
|
+
queryKey,
|
|
65
|
+
queryFn: async () => {
|
|
66
|
+
return (await getPortfolio(api, id, workspace)).portfolio;
|
|
67
|
+
},
|
|
68
|
+
...queryOptions ?? {}
|
|
69
|
+
});
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (!query.error) return;
|
|
72
|
+
showAlert({
|
|
73
|
+
severity: "error",
|
|
74
|
+
message: query.error.message
|
|
75
|
+
});
|
|
76
|
+
}, [query.error, showAlert]);
|
|
77
|
+
return {
|
|
78
|
+
...query,
|
|
79
|
+
queryKey
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
export { useFetchPortfolio };
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=useFetchPortfolio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchPortfolio.js","names":[],"sources":["../../../src/hooks/portfolio/useFetchPortfolio.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useQuery } from \"@tanstack/react-query\";\n\nimport { useAxios } from \"@/hooks/useAxios\";\nimport { useAppAlert } from \"@/contexts/appAlertContext/useAppAlert\";\nimport type { Portfolio } from \"@/types/portfolio\";\nimport { getPortfolio } from \"@/api/portfolio\";\nimport type { EntityQueryOptions, FetchEntityParams } from \"@/types/entityQuery\";\n\nexport type FetchPortfolioProps<TData = Portfolio, TSelected = TData> = FetchEntityParams<TData, TSelected>;\n\nconst defaultQueryOptions: EntityQueryOptions<Portfolio> = {\n refetchOnMount: \"always\",\n staleTime: 0,\n gcTime: 0\n}\n\n/**\n * useFetchPortfolio\n *\n * Data-fetching hook built on TanStack Query to retrieve a single portfolio by ID.\n *\n * It also:\n * - builds a stable React Query `queryKey` that can be reused by mutation hooks for cache invalidation\n * - triggers an error alert via `useAppAlert` whenever `query.error` is present\n *\n * Important notes:\n * - Always returns a single `Portfolio` object.\n *\n * Parameters (FetchPortfolioProps):\n * @param {string} id\n * Portfolio identifier (required).\n *\n * @param {string} workspace\n * Workspace the portfolio belongs to (required by `getPortfolio`).\n *\n * @param {EntityQueryOptions<Portfolio>} [queryOptions=defaultQueryOptions]\n * TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).\n *\n * Returns:\n * @returns {object}\n * TanStack Query's `query` object extended with:\n * - `queryKey`: the cache key used by React Query\n *\n * Tip:\n * - The returned `queryKey` can be reused by mutation hooks for cache invalidation:\n * ```ts\n * const fetch = useFetchPortfolio({ id: \"pf-123\", workspace: \"ws-1\" });\n * usePortfolioMutations({ queryKey: fetch.queryKey });\n * ```\n *\n * Example:\n * ```ts\n * const { data, isLoading } = useFetchPortfolio({\n * id: \"pf-123\",\n * workspace: \"ws-1\",\n * });\n * // data -> Portfolio\n * ```\n */\nexport const useFetchPortfolio = ({ id, workspace, queryOptions = defaultQueryOptions }: FetchPortfolioProps) => {\n\n const { api } = useAxios();\n const { showAlert } = useAppAlert();\n\n const queryKey = [\n \"portfolio\",\n id,\n workspace\n ];\n\n const query = useQuery<Portfolio>({\n queryKey,\n queryFn: async () => {\n const response = await getPortfolio(api, id, workspace);\n return response.portfolio;\n },\n ...queryOptions ?? {}\n });\n\n useEffect(() => {\n if (!query.error) return;\n\n showAlert({\n severity: \"error\",\n message: query.error.message,\n });\n }, [query.error, showAlert]);\n\n return {\n ...query,\n queryKey,\n };\n};\n"],"mappings":";;;;;;AAWA,IAAM,sBAAqD;CACvD,gBAAgB;CAChB,WAAW;CACX,QAAQ;AACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,IAAa,qBAAqB,EAAE,IAAI,WAAW,eAAe,0BAA+C;CAE7G,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,EAAE,cAAc,YAAY;CAElC,MAAM,WAAW;EACb;EACA;EACA;CACJ;CAEA,MAAM,QAAQ,SAAoB;EAC9B;EACA,SAAS,YAAY;GAEjB,QAAO,MADgB,aAAa,KAAK,IAAI,SAAS,EAAA,CACtC;EACpB;EACA,GAAG,gBAAgB,CAAC;CACxB,CAAC;CAED,gBAAgB;EACZ,IAAI,CAAC,MAAM,OAAO;EAElB,UAAU;GACN,UAAU;GACV,SAAS,MAAM,MAAM;EACzB,CAAC;CACL,GAAG,CAAC,MAAM,OAAO,SAAS,CAAC;CAE3B,OAAO;EACH,GAAG;EACH;CACJ;AACJ"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type UseInfiniteQueryOptions, type QueryKey } from "@tanstack/react-query";
|
|
2
|
+
import type { FetchEntitiesParams } from "../../types/entityQuery.d.ts";
|
|
3
|
+
import type { Portfolio, PortfolioListResponse } from "../../types/portfolio.d.ts";
|
|
4
|
+
type PageToken = string | null;
|
|
5
|
+
type InfiniteOptions<TData> = Omit<UseInfiniteQueryOptions<PortfolioListResponse, Error, TData, QueryKey, PageToken>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam">;
|
|
6
|
+
export type FetchInfinitePortfolioProps = FetchEntitiesParams<Portfolio[], InfiniteOptions<Portfolio[]>> & {
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* useFetchInfinitePortfolios
|
|
11
|
+
*
|
|
12
|
+
* Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve
|
|
13
|
+
* portfolios with cursor-based pagination.
|
|
14
|
+
*
|
|
15
|
+
* It also:
|
|
16
|
+
* - flattens all pages into a single `Portfolio[]` via `select`
|
|
17
|
+
*
|
|
18
|
+
* Important notes:
|
|
19
|
+
* - `query.data` returns a flat `Portfolio[]` (all pages merged).
|
|
20
|
+
*
|
|
21
|
+
* Parameters (FetchInfinitePortfolioProps):
|
|
22
|
+
* @param {FilterClause[]} [filters=[]]
|
|
23
|
+
* Filters applied to every page request. Must include a `workspace` filter.
|
|
24
|
+
*
|
|
25
|
+
* @param {string[]} [order=[]]
|
|
26
|
+
* Sorting applied to every page request.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} [projection=""]
|
|
29
|
+
* Single field to project: `"field"` returns only that field (others come back null),
|
|
30
|
+
* `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
31
|
+
*
|
|
32
|
+
* @param {number} [pageSize=10]
|
|
33
|
+
* Number of portfolios to fetch per page.
|
|
34
|
+
*
|
|
35
|
+
* @param {InfiniteOptions<Portfolio[]>} [queryOptions]
|
|
36
|
+
* TanStack Query options passed through to `useInfiniteQuery`
|
|
37
|
+
* (e.g., enabled, staleTime, gcTime, etc.).
|
|
38
|
+
*
|
|
39
|
+
* Returns:
|
|
40
|
+
* @returns {object}
|
|
41
|
+
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
42
|
+
* - `queryKey`: the cache key used by React Query
|
|
43
|
+
*
|
|
44
|
+
* Example:
|
|
45
|
+
* ```ts
|
|
46
|
+
* const { query } = useFetchInfinitePortfolios({
|
|
47
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
48
|
+
* pageSize: 20,
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* // Flat list of all fetched portfolios
|
|
52
|
+
* const portfolios = query.data ?? [];
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function useFetchPortfolios({ filters, order, projection, pageSize, queryOptions }: FetchInfinitePortfolioProps): {
|
|
56
|
+
query: import("@tanstack/react-query").UseInfiniteQueryResult<Portfolio[], Error>;
|
|
57
|
+
queryKey: unknown[];
|
|
58
|
+
};
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=useFetchPortfolios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchPortfolios.d.ts","sourceRoot":"","sources":["../../../src/hooks/portfolio/useFetchPortfolios.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,uBAAuB,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,KAAK,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/B,KAAK,eAAe,CAAC,KAAK,IAAI,IAAI,CAC9B,uBAAuB,CAAC,qBAAqB,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,EACjF,UAAU,GAAG,SAAS,GAAG,kBAAkB,GAAG,kBAAkB,CACnE,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,CAAC,SAAS,EAAE,EAAE,eAAe,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAQF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAY,EAAE,KAAU,EAAE,UAAe,EAAE,QAAa,EAAE,YAAY,EAAE,EAAE,2BAA2B;;;EAoCzI"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useAxios } from "../useAxios.js";
|
|
2
|
+
import { buildQueryKey, buildQueryObject } from "../../api/entityQuery.js";
|
|
3
|
+
import { listPortfolios } from "../../api/portfolio.js";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
6
|
+
//#region src/hooks/portfolio/useFetchPortfolios.ts
|
|
7
|
+
var defaultQueryOptions = {
|
|
8
|
+
refetchOnMount: "always",
|
|
9
|
+
staleTime: 0,
|
|
10
|
+
gcTime: 0
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* useFetchInfinitePortfolios
|
|
14
|
+
*
|
|
15
|
+
* Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve
|
|
16
|
+
* portfolios with cursor-based pagination.
|
|
17
|
+
*
|
|
18
|
+
* It also:
|
|
19
|
+
* - flattens all pages into a single `Portfolio[]` via `select`
|
|
20
|
+
*
|
|
21
|
+
* Important notes:
|
|
22
|
+
* - `query.data` returns a flat `Portfolio[]` (all pages merged).
|
|
23
|
+
*
|
|
24
|
+
* Parameters (FetchInfinitePortfolioProps):
|
|
25
|
+
* @param {FilterClause[]} [filters=[]]
|
|
26
|
+
* Filters applied to every page request. Must include a `workspace` filter.
|
|
27
|
+
*
|
|
28
|
+
* @param {string[]} [order=[]]
|
|
29
|
+
* Sorting applied to every page request.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} [projection=""]
|
|
32
|
+
* Single field to project: `"field"` returns only that field (others come back null),
|
|
33
|
+
* `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
34
|
+
*
|
|
35
|
+
* @param {number} [pageSize=10]
|
|
36
|
+
* Number of portfolios to fetch per page.
|
|
37
|
+
*
|
|
38
|
+
* @param {InfiniteOptions<Portfolio[]>} [queryOptions]
|
|
39
|
+
* TanStack Query options passed through to `useInfiniteQuery`
|
|
40
|
+
* (e.g., enabled, staleTime, gcTime, etc.).
|
|
41
|
+
*
|
|
42
|
+
* Returns:
|
|
43
|
+
* @returns {object}
|
|
44
|
+
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
45
|
+
* - `queryKey`: the cache key used by React Query
|
|
46
|
+
*
|
|
47
|
+
* Example:
|
|
48
|
+
* ```ts
|
|
49
|
+
* const { query } = useFetchInfinitePortfolios({
|
|
50
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
51
|
+
* pageSize: 20,
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* // Flat list of all fetched portfolios
|
|
55
|
+
* const portfolios = query.data ?? [];
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
function useFetchPortfolios({ filters = [], order = [], projection = "", pageSize = 10, queryOptions }) {
|
|
59
|
+
const { api } = useAxios();
|
|
60
|
+
const queryKey = buildQueryKey(["portfolios"], filters);
|
|
61
|
+
const mergedQueryOptions = useMemo(() => ({
|
|
62
|
+
...defaultQueryOptions,
|
|
63
|
+
...queryOptions ?? {}
|
|
64
|
+
}), [queryOptions]);
|
|
65
|
+
return {
|
|
66
|
+
query: useInfiniteQuery({
|
|
67
|
+
queryKey,
|
|
68
|
+
initialPageParam: null,
|
|
69
|
+
getNextPageParam: (lastPage) => lastPage.next_page_token ?? void 0,
|
|
70
|
+
queryFn: async ({ pageParam }) => {
|
|
71
|
+
const queryFilter = buildQueryObject({
|
|
72
|
+
filters,
|
|
73
|
+
order,
|
|
74
|
+
projection,
|
|
75
|
+
pageSize,
|
|
76
|
+
pageToken: pageParam ?? void 0
|
|
77
|
+
});
|
|
78
|
+
return await listPortfolios(api, queryFilter);
|
|
79
|
+
},
|
|
80
|
+
select: (data) => data.pages.flatMap((p) => p.portfolios),
|
|
81
|
+
...mergedQueryOptions
|
|
82
|
+
}),
|
|
83
|
+
queryKey
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { useFetchPortfolios };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=useFetchPortfolios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchPortfolios.js","names":[],"sources":["../../../src/hooks/portfolio/useFetchPortfolios.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useInfiniteQuery, type UseInfiniteQueryOptions, type QueryKey } from \"@tanstack/react-query\";\n\nimport { useAxios } from \"@/hooks/useAxios\";\nimport { listPortfolios } from \"@/api/portfolio\";\nimport type { FetchEntitiesParams } from \"@/types/entityQuery\";\nimport type { Portfolio, PortfolioListResponse } from \"@/types/portfolio\";\nimport { buildQueryKey, buildQueryObject } from \"@/api/entityQuery\";\n\ntype PageToken = string | null;\n\ntype InfiniteOptions<TData> = Omit<\n UseInfiniteQueryOptions<PortfolioListResponse, Error, TData, QueryKey, PageToken>,\n \"queryKey\" | \"queryFn\" | \"initialPageParam\" | \"getNextPageParam\"\n>;\n\nexport type FetchInfinitePortfolioProps = FetchEntitiesParams<Portfolio[], InfiniteOptions<Portfolio[]>> & {\n pageSize?: number;\n};\n\nconst defaultQueryOptions: InfiniteOptions<Portfolio[]> = {\n refetchOnMount: \"always\",\n staleTime: 0,\n gcTime: 0,\n};\n\n/**\n * useFetchInfinitePortfolios\n *\n * Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve\n * portfolios with cursor-based pagination.\n *\n * It also:\n * - flattens all pages into a single `Portfolio[]` via `select`\n *\n * Important notes:\n * - `query.data` returns a flat `Portfolio[]` (all pages merged).\n *\n * Parameters (FetchInfinitePortfolioProps):\n * @param {FilterClause[]} [filters=[]]\n * Filters applied to every page request. Must include a `workspace` filter.\n *\n * @param {string[]} [order=[]]\n * Sorting applied to every page request.\n *\n * @param {string} [projection=\"\"]\n * Single field to project: `\"field\"` returns only that field (others come back null),\n * `\"-field\"` returns every field except that one. One field only — lists 500. Omitted when empty.\n *\n * @param {number} [pageSize=10]\n * Number of portfolios to fetch per page.\n *\n * @param {InfiniteOptions<Portfolio[]>} [queryOptions]\n * TanStack Query options passed through to `useInfiniteQuery`\n * (e.g., enabled, staleTime, gcTime, etc.).\n *\n * Returns:\n * @returns {object}\n * - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)\n * - `queryKey`: the cache key used by React Query\n *\n * Example:\n * ```ts\n * const { query } = useFetchInfinitePortfolios({\n * filters: [{ field: \"workspace\", value: \"ws-1\" }],\n * pageSize: 20,\n * });\n *\n * // Flat list of all fetched portfolios\n * const portfolios = query.data ?? [];\n * ```\n */\nexport function useFetchPortfolios({ filters = [], order = [], projection = \"\", pageSize = 10, queryOptions }: FetchInfinitePortfolioProps) {\n const { api } = useAxios();\n\n const queryKey = buildQueryKey([\"portfolios\"], filters);\n\n const mergedQueryOptions = useMemo<InfiniteOptions<Portfolio[]>>(() => ({\n ...defaultQueryOptions,\n ...(queryOptions ?? {}),\n }), [queryOptions]);\n\n const query = useInfiniteQuery<PortfolioListResponse, Error, Portfolio[], QueryKey, PageToken>({\n queryKey,\n initialPageParam: null,\n getNextPageParam: (lastPage) => lastPage.next_page_token ?? undefined,\n\n queryFn: async ({ pageParam }) => {\n const queryFilter = buildQueryObject({\n filters,\n order,\n projection,\n pageSize,\n pageToken: pageParam ?? undefined,\n });\n\n return await listPortfolios(api, queryFilter);\n },\n\n select: (data) => data.pages.flatMap((p) => p.portfolios),\n\n ...mergedQueryOptions,\n });\n\n return {\n query,\n queryKey,\n };\n}"],"mappings":";;;;;;AAoBA,IAAM,sBAAoD;CACtD,gBAAgB;CAChB,WAAW;CACX,QAAQ;AACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,mBAAmB,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,aAAa,IAAI,WAAW,IAAI,gBAA6C;CACxI,MAAM,EAAE,QAAQ,SAAS;CAEzB,MAAM,WAAW,cAAc,CAAC,YAAY,GAAG,OAAO;CAEtD,MAAM,qBAAqB,eAA6C;EACpE,GAAG;EACH,GAAI,gBAAgB,CAAC;CACzB,IAAI,CAAC,YAAY,CAAC;CAwBlB,OAAO;EACH,OAvBU,iBAAiF;GAC3F;GACA,kBAAkB;GAClB,mBAAmB,aAAa,SAAS,mBAAmB,KAAA;GAE5D,SAAS,OAAO,EAAE,gBAAgB;IAC9B,MAAM,cAAc,iBAAiB;KACjC;KACA;KACA;KACA;KACA,WAAW,aAAa,KAAA;IAC5B,CAAC;IAED,OAAO,MAAM,eAAe,KAAK,WAAW;GAChD;GAEA,SAAS,SAAS,KAAK,MAAM,SAAS,MAAM,EAAE,UAAU;GAExD,GAAG;EACP,CAGI;EACA;CACJ;AACJ"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { Portfolio } from "../../types/portfolio.d.ts";
|
|
2
|
+
type CreatePortfolioProps = {
|
|
3
|
+
data: Partial<Portfolio>;
|
|
4
|
+
};
|
|
5
|
+
type UpdatePortfolioProps = {
|
|
6
|
+
id: string;
|
|
7
|
+
data: Partial<Portfolio>;
|
|
8
|
+
};
|
|
9
|
+
type DeletePortfolioProps = {
|
|
10
|
+
id: string;
|
|
11
|
+
workspace: string;
|
|
12
|
+
};
|
|
13
|
+
type UsePortfolioMutationsProps = {
|
|
14
|
+
queryKey?: unknown[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* usePortfolioMutations
|
|
18
|
+
*
|
|
19
|
+
* Mutation hook built on TanStack Query to perform Portfolio write operations:
|
|
20
|
+
* - create a portfolio (POST)
|
|
21
|
+
* - update a portfolio (PUT)
|
|
22
|
+
* - delete a portfolio (DELETE)
|
|
23
|
+
*
|
|
24
|
+
* It also:
|
|
25
|
+
* - optionally invalidates a target query cache key after successful mutations
|
|
26
|
+
* - displays success/error alerts via `useAppAlert`
|
|
27
|
+
*
|
|
28
|
+
* Important notes:
|
|
29
|
+
* - This hook is intended for side-effect operations only. Reading/retrieving data should be done via `useQuery` or `useFetchPortfolio`.
|
|
30
|
+
* - Cache invalidation is controlled by `queryKey`. If `queryKey` is not provided, the hook will still run
|
|
31
|
+
* mutations and show alerts, but it will NOT invalidate any cached queries.
|
|
32
|
+
* - `remove` requires a `workspace` parameter because the underlying API helper `deletePortfolio(api, id, workspace)`
|
|
33
|
+
* expects it as a query param.
|
|
34
|
+
*
|
|
35
|
+
* Parameters (UsePortfolioMutationsProps):
|
|
36
|
+
* @param {unknown[]} [queryKey]
|
|
37
|
+
* Query key to invalidate after successful mutations. Use the same `queryKey` you pass to the relevant `useQuery`
|
|
38
|
+
* (e.g., portfolio list/detail) so UI data is refreshed automatically after a write.
|
|
39
|
+
*
|
|
40
|
+
* Tip:
|
|
41
|
+
* - If you're using `useFetchPortfolio`, you can pass its returned `queryKey` directly:
|
|
42
|
+
* `const fetch = useFetchPortfolio(...);`
|
|
43
|
+
* `usePortfolioMutations({ queryKey: fetch.queryKey });`
|
|
44
|
+
*
|
|
45
|
+
* Mutations:
|
|
46
|
+
* - `create`:
|
|
47
|
+
* - mutationFn: `createPortfolio(api, data)`
|
|
48
|
+
* - variables: `{ data: Partial<Portfolio> }`
|
|
49
|
+
* - success message: "Portfolio created successfully."
|
|
50
|
+
* - error message: "We couldn't create the portfolio. Please review your inputs and try again." (fallback)
|
|
51
|
+
*
|
|
52
|
+
* - `update`:
|
|
53
|
+
* - mutationFn: `updatePortfolio(api, id, data)`
|
|
54
|
+
* - variables: `{ id: string; data: Partial<Portfolio> }`
|
|
55
|
+
* - success message: "Portfolio updated successfully."
|
|
56
|
+
* - error message: "We couldn't update the portfolio. Please try again." (fallback)
|
|
57
|
+
*
|
|
58
|
+
* - `remove`:
|
|
59
|
+
* - mutationFn: `deletePortfolio(api, id, workspace)`
|
|
60
|
+
* - variables: `{ id: string; workspace: string }`
|
|
61
|
+
* - success message: "Portfolio deleted successfully."
|
|
62
|
+
* - error message: "We couldn't delete the portfolio. Please try again." (fallback)
|
|
63
|
+
*
|
|
64
|
+
* Return value:
|
|
65
|
+
* @returns {object}
|
|
66
|
+
* Returns an object with the three TanStack Query mutation results:
|
|
67
|
+
* - `create`: UseMutationResult<Portfolio, Error, CreatePortfolioProps, unknown>
|
|
68
|
+
* - `update`: UseMutationResult<Portfolio, Error, UpdatePortfolioProps, unknown>
|
|
69
|
+
* - `remove`: UseMutationResult<Portfolio, Error, DeletePortfolioProps, unknown>
|
|
70
|
+
*
|
|
71
|
+
* Each mutation includes standard TanStack Query helpers:
|
|
72
|
+
* - `mutate(variables, options?)`
|
|
73
|
+
* - `mutateAsync(variables, options?)`
|
|
74
|
+
* - `isPending`, `isSuccess`, `isError`, `error`, `data`, etc.
|
|
75
|
+
*
|
|
76
|
+
* Examples:
|
|
77
|
+
*
|
|
78
|
+
* 1) Invalidate a portfolio list query after mutations:
|
|
79
|
+
* ```ts
|
|
80
|
+
* const { create, update, remove } = usePortfolioMutations({ queryKey: ["portfolio"] });
|
|
81
|
+
*
|
|
82
|
+
* // Create (minimal example - other Security fields omitted for brevity)
|
|
83
|
+
* create.mutate({
|
|
84
|
+
* data: {
|
|
85
|
+
* name: "My Portfolio",
|
|
86
|
+
* description: "Test portfolio",
|
|
87
|
+
* base_currency: "USD",
|
|
88
|
+
* date: "2026-01-08",
|
|
89
|
+
* workspace: "ws-1",
|
|
90
|
+
* securities: [
|
|
91
|
+
* {
|
|
92
|
+
* id: "sec-1",
|
|
93
|
+
* ticker: "AAPL",
|
|
94
|
+
* symbol: "AAPL",
|
|
95
|
+
* name: "Apple Inc.",
|
|
96
|
+
* currency: "USD",
|
|
97
|
+
* quantity: 10,
|
|
98
|
+
* market_price: 200,
|
|
99
|
+
* market_value: 2000,
|
|
100
|
+
* market_value_in_base: 2000,
|
|
101
|
+
* fx_rate: 1,
|
|
102
|
+
* instrument_type: "Equity",
|
|
103
|
+
* instrument_class: "Equity",
|
|
104
|
+
* asset_class: "Equity",
|
|
105
|
+
* exchange: "NASDAQ",
|
|
106
|
+
* status: "active",
|
|
107
|
+
* // Other fields are nullable in the Security type and can be omitted here for documentation purposes.
|
|
108
|
+
* } as Security,
|
|
109
|
+
* ],
|
|
110
|
+
* }
|
|
111
|
+
* });
|
|
112
|
+
*
|
|
113
|
+
* // Update (partial)
|
|
114
|
+
* update.mutate({
|
|
115
|
+
* id: "pf-123",
|
|
116
|
+
* data: {
|
|
117
|
+
* name: "Renamed Portfolio",
|
|
118
|
+
* tags: ["tag-1", "tag-2"],
|
|
119
|
+
* check_securities: true,
|
|
120
|
+
* }
|
|
121
|
+
* });
|
|
122
|
+
*
|
|
123
|
+
* // Delete
|
|
124
|
+
* remove.mutate({ id: "pf-123", workspace: "ws-1" });
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* 2) Using async/await with `mutateAsync`:
|
|
128
|
+
* ```ts
|
|
129
|
+
* const { create } = usePortfolioMutations({ queryKey: ["portfolio"] });
|
|
130
|
+
*
|
|
131
|
+
* await create.mutateAsync({
|
|
132
|
+
* data: {
|
|
133
|
+
* name: "My Portfolio",
|
|
134
|
+
* base_currency: "USD",
|
|
135
|
+
* date: "2026-01-08",
|
|
136
|
+
* workspace: "ws-1",
|
|
137
|
+
* securities: [],
|
|
138
|
+
* }
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* 3) Without cache invalidation (no queryKey):
|
|
143
|
+
* ```ts
|
|
144
|
+
* const { update } = usePortfolioMutations({});
|
|
145
|
+
*
|
|
146
|
+
* update.mutate({
|
|
147
|
+
* id: "pf-123",
|
|
148
|
+
* data: { description: "Updated description" }
|
|
149
|
+
* });
|
|
150
|
+
* // Mutation still runs and alerts are shown, but cached queries are not invalidated.
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
153
|
+
* 4) Using `useFetchPortfolio` queryKey for automatic invalidation:
|
|
154
|
+
* ```ts
|
|
155
|
+
* const fetch = useFetchPortfolio({
|
|
156
|
+
* id: null,
|
|
157
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
158
|
+
* });
|
|
159
|
+
*
|
|
160
|
+
* const { remove } = usePortfolioMutations({ queryKey: fetch.queryKey });
|
|
161
|
+
*
|
|
162
|
+
* await remove.mutateAsync({ id: "pf-123", workspace: "ws-1" });
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export declare const usePortfolioMutations: ({ queryKey }: UsePortfolioMutationsProps) => {
|
|
166
|
+
create: import("@tanstack/react-query").UseMutationResult<Portfolio, unknown, CreatePortfolioProps, unknown>;
|
|
167
|
+
update: import("@tanstack/react-query").UseMutationResult<Portfolio, unknown, UpdatePortfolioProps, unknown>;
|
|
168
|
+
remove: import("@tanstack/react-query").UseMutationResult<Portfolio, unknown, DeletePortfolioProps, unknown>;
|
|
169
|
+
};
|
|
170
|
+
export {};
|
|
171
|
+
//# sourceMappingURL=usePortfolioMutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePortfolioMutations.d.ts","sourceRoot":"","sources":["../../../src/hooks/portfolio/usePortfolioMutations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,KAAK,oBAAoB,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;CAC5B,CAAC;AAEF,KAAK,oBAAoB,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;CAC5B,CAAC;AAEF,KAAK,oBAAoB,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAC9B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACxB,CAAC;AAKF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoJG;AAEH,eAAO,MAAM,qBAAqB,GAAI,cAAc,0BAA0B;;;;CAuE7E,CAAC"}
|