@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,85 @@
|
|
|
1
|
+
import { useAppAlert } from "../../contexts/appAlertContext/useAppAlert.js";
|
|
2
|
+
import { useAxios } from "../useAxios.js";
|
|
3
|
+
import { getDatastore } from "../../api/datastore.js";
|
|
4
|
+
import { tableToObjects } from "../../lib/datastoreTable.js";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
import { useQuery } from "@tanstack/react-query";
|
|
7
|
+
//#region src/hooks/datastore/useFetchDatastore.ts
|
|
8
|
+
var defaultQueryOptions = {
|
|
9
|
+
refetchOnMount: "always",
|
|
10
|
+
staleTime: 0,
|
|
11
|
+
gcTime: 0
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* useFetchDatastore
|
|
15
|
+
*
|
|
16
|
+
* Data-fetching hook built on TanStack Query to retrieve a single datastore by ID.
|
|
17
|
+
*
|
|
18
|
+
* It also:
|
|
19
|
+
* - triggers an error alert via `useAppAlert` whenever `query.error` is present
|
|
20
|
+
*
|
|
21
|
+
* Important notes:
|
|
22
|
+
* - Returns a `DatastoreWithRows` object: the full `Datastore` shape with `data`
|
|
23
|
+
* replaced by `AnyRecord[]` (rows transformed via `tableToObjects`).
|
|
24
|
+
*
|
|
25
|
+
* Parameters (FetchDatastoreProps):
|
|
26
|
+
* @param {string} id
|
|
27
|
+
* Datastore identifier (required).
|
|
28
|
+
*
|
|
29
|
+
* @param {string} workspace
|
|
30
|
+
* Workspace the datastore belongs to (required by `getDatastore`).
|
|
31
|
+
*
|
|
32
|
+
* @param {EntityQueryOptions<DatastoreWithRows>} [queryOptions=defaultQueryOptions]
|
|
33
|
+
* TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
34
|
+
*
|
|
35
|
+
* Returns:
|
|
36
|
+
* @returns {object}
|
|
37
|
+
* TanStack Query's `query` object extended with:
|
|
38
|
+
* - `queryKey`: the cache key used by React Query
|
|
39
|
+
*
|
|
40
|
+
* Example:
|
|
41
|
+
* ```ts
|
|
42
|
+
* const { data, isLoading } = useFetchDatastore({
|
|
43
|
+
* id: "abc123",
|
|
44
|
+
* workspace: "my-workspace",
|
|
45
|
+
* });
|
|
46
|
+
* // data -> DatastoreWithRows (datastore metadata + rows as AnyRecord[])
|
|
47
|
+
* // data.name -> "my-datastore"
|
|
48
|
+
* // data.data -> [{ datastoreId: "abc123", col1: "value", ... }]
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
var useFetchDatastore = ({ id, workspace, queryOptions = defaultQueryOptions }) => {
|
|
52
|
+
const { api } = useAxios();
|
|
53
|
+
const { showAlert } = useAppAlert();
|
|
54
|
+
const queryKey = [
|
|
55
|
+
"datastore",
|
|
56
|
+
id,
|
|
57
|
+
workspace
|
|
58
|
+
];
|
|
59
|
+
const query = useQuery({
|
|
60
|
+
queryKey,
|
|
61
|
+
queryFn: async () => {
|
|
62
|
+
const datastore = await getDatastore(api, id, workspace);
|
|
63
|
+
return {
|
|
64
|
+
...datastore,
|
|
65
|
+
data: tableToObjects(datastore.id, datastore.data?.[0], datastore.data)
|
|
66
|
+
};
|
|
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 { useFetchDatastore };
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=useFetchDatastore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchDatastore.js","names":[],"sources":["../../../src/hooks/datastore/useFetchDatastore.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nimport { useQuery } from \"@tanstack/react-query\";\n\nimport { useAxios } from \"@/hooks/useAxios\";\nimport { useAppAlert } from \"@/contexts/appAlertContext/useAppAlert\";\nimport { getDatastore } from \"@/api/datastore\";\nimport { tableToObjects } from \"@/lib/datastoreTable\";\nimport type { DatastoreWithRows } from \"@/types/datastore\";\nimport type { EntityQueryOptions, FetchEntityParams } from \"@/types/entityQuery\";\n\nexport type FetchDatastoreProps = FetchEntityParams<DatastoreWithRows>;\n\nconst defaultQueryOptions: EntityQueryOptions<DatastoreWithRows> = {\n refetchOnMount: \"always\",\n staleTime: 0,\n gcTime: 0,\n};\n\n/**\n * useFetchDatastore\n *\n * Data-fetching hook built on TanStack Query to retrieve a single datastore by ID.\n *\n * It also:\n * - triggers an error alert via `useAppAlert` whenever `query.error` is present\n *\n * Important notes:\n * - Returns a `DatastoreWithRows` object: the full `Datastore` shape with `data`\n * replaced by `AnyRecord[]` (rows transformed via `tableToObjects`).\n *\n * Parameters (FetchDatastoreProps):\n * @param {string} id\n * Datastore identifier (required).\n *\n * @param {string} workspace\n * Workspace the datastore belongs to (required by `getDatastore`).\n *\n * @param {EntityQueryOptions<DatastoreWithRows>} [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 * Example:\n * ```ts\n * const { data, isLoading } = useFetchDatastore({\n * id: \"abc123\",\n * workspace: \"my-workspace\",\n * });\n * // data -> DatastoreWithRows (datastore metadata + rows as AnyRecord[])\n * // data.name -> \"my-datastore\"\n * // data.data -> [{ datastoreId: \"abc123\", col1: \"value\", ... }]\n * ```\n */\nexport const useFetchDatastore = ({ id, workspace, queryOptions = defaultQueryOptions }: FetchDatastoreProps) => {\n\n const { api } = useAxios();\n const { showAlert } = useAppAlert();\n\n const queryKey = [\"datastore\", id, workspace];\n\n const query = useQuery<DatastoreWithRows>({\n queryKey,\n queryFn: async () => {\n const datastore = await getDatastore(api, id, workspace);\n\n return {\n ...datastore,\n data: tableToObjects(\n datastore.id,\n datastore.data?.[0] as string[],\n datastore.data\n ),\n };\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":";;;;;;;AAaA,IAAM,sBAA6D;CAC/D,gBAAgB;CAChB,WAAW;CACX,QAAQ;AACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,qBAAqB,EAAE,IAAI,WAAW,eAAe,0BAA+C;CAE7G,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,EAAE,cAAc,YAAY;CAElC,MAAM,WAAW;EAAC;EAAa;EAAI;CAAS;CAE5C,MAAM,QAAQ,SAA4B;EACtC;EACA,SAAS,YAAY;GACjB,MAAM,YAAY,MAAM,aAAa,KAAK,IAAI,SAAS;GAEvD,OAAO;IACH,GAAG;IACH,MAAM,eACF,UAAU,IACV,UAAU,OAAO,IACjB,UAAU,IACd;GACJ;EACJ;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,70 @@
|
|
|
1
|
+
import { type UseInfiniteQueryOptions, type QueryKey } from "@tanstack/react-query";
|
|
2
|
+
import type { DatastoreWithRows } from "../../types/datastore.d.ts";
|
|
3
|
+
import type { FetchEntitiesParams, EntityDefaultResponse } from "../../types/entityQuery.d.ts";
|
|
4
|
+
type PageToken = string | null;
|
|
5
|
+
type InfiniteOptions<TData> = Omit<UseInfiniteQueryOptions<DatastoreQueryPage, Error, TData, QueryKey, PageToken>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam">;
|
|
6
|
+
export type DatastoreQueryPage = EntityDefaultResponse & {
|
|
7
|
+
datastores: DatastoreWithRows[];
|
|
8
|
+
};
|
|
9
|
+
export type FetchInfiniteDatastoreProps = FetchEntitiesParams<DatastoreWithRows[], InfiniteOptions<DatastoreWithRows[]>> & {
|
|
10
|
+
pageSize?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* useFetchDatastores
|
|
14
|
+
*
|
|
15
|
+
* Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve
|
|
16
|
+
* datastores with cursor-based pagination.
|
|
17
|
+
*
|
|
18
|
+
* It also:
|
|
19
|
+
* - flattens all pages into a single `DatastoreWithRows[]` via `select`
|
|
20
|
+
* - exposes `actions` for cache management
|
|
21
|
+
* - exposes `events` for ag-Grid integration
|
|
22
|
+
*
|
|
23
|
+
* Important notes:
|
|
24
|
+
* - `query.data` returns a flat `DatastoreWithRows[]` (all pages merged).
|
|
25
|
+
* - Each item retains the full `Datastore` shape, with `data` replaced by `AnyRecord[]` (rows transformed via `tableToObjects`).
|
|
26
|
+
*
|
|
27
|
+
* Parameters (FetchInfiniteDatastoreProps):
|
|
28
|
+
* @param {FilterClause[]} [filters=[]]
|
|
29
|
+
* Filters applied to every page request. Must include a `workspace` filter.
|
|
30
|
+
*
|
|
31
|
+
* @param {string[]} [order=[]]
|
|
32
|
+
* Sorting applied to every page request.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} [projection=""]
|
|
35
|
+
* Single field to project: `"field"` returns only that field (others come back null),
|
|
36
|
+
* `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
37
|
+
*
|
|
38
|
+
* @param {number} [pageSize=10]
|
|
39
|
+
* Number of datastores to fetch per page.
|
|
40
|
+
*
|
|
41
|
+
* @param {InfiniteOptions<DatastoreWithRows[]>} [queryOptions]
|
|
42
|
+
* TanStack Query options passed through to `useInfiniteQuery`
|
|
43
|
+
* (e.g., enabled, staleTime, gcTime, etc.).
|
|
44
|
+
*
|
|
45
|
+
* Returns:
|
|
46
|
+
* @returns {object}
|
|
47
|
+
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
48
|
+
* - `queryKey`: the cache key used by React Query
|
|
49
|
+
* - `events.handleFetchIfGridEmptyOrNearEnd(gridApi)`: triggers next page fetch when the ag-Grid is empty or near the end of the list
|
|
50
|
+
*
|
|
51
|
+
* Example:
|
|
52
|
+
* ```ts
|
|
53
|
+
* const { query, events } = useFetchDatastores({
|
|
54
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
55
|
+
* pageSize: 20,
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* // Flat list of all fetched datastores with transformed rows
|
|
59
|
+
* const datastores = query.data ?? [];
|
|
60
|
+
*
|
|
61
|
+
* // Load next page when grid is near end
|
|
62
|
+
* <AgGridReact onBodyScroll={() => events.handleFetchIfGridEmptyOrNearEnd(gridApi)} />
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function useFetchDatastores({ filters, order, projection, pageSize, queryOptions }: FetchInfiniteDatastoreProps): {
|
|
66
|
+
query: import("@tanstack/react-query").UseInfiniteQueryResult<DatastoreWithRows[], Error>;
|
|
67
|
+
queryKey: unknown[];
|
|
68
|
+
};
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=useFetchDatastores.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchDatastores.d.ts","sourceRoot":"","sources":["../../../src/hooks/datastore/useFetchDatastores.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,uBAAuB,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQtG,OAAO,KAAK,EAAoC,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAGtF,KAAK,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/B,KAAK,eAAe,CAAC,KAAK,IAAI,IAAI,CAC9B,uBAAuB,CAAC,kBAAkB,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,EAC9E,UAAU,GAAG,SAAS,GAAG,kBAAkB,GAAG,kBAAkB,CACnE,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,GAAG;IACrD,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,CAAC,iBAAiB,EAAE,EAAE,eAAe,CAAC,iBAAiB,EAAE,CAAC,CAAC,GAAG;IACvH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAQF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAY,EAAE,KAAU,EAAE,UAAe,EAAE,QAAa,EAAE,YAAY,EAAE,EAAE,2BAA2B;;;EAwEzI"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useAxios } from "../useAxios.js";
|
|
2
|
+
import { buildQueryKey, buildQueryObject } from "../../api/entityQuery.js";
|
|
3
|
+
import { listDatastores } from "../../api/datastore.js";
|
|
4
|
+
import { tableToObjects } from "../../lib/datastoreTable.js";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
7
|
+
//#region src/hooks/datastore/useFetchDatastores.ts
|
|
8
|
+
var defaultQueryOptions = {
|
|
9
|
+
refetchOnMount: "always",
|
|
10
|
+
staleTime: 0,
|
|
11
|
+
gcTime: 0
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* useFetchDatastores
|
|
15
|
+
*
|
|
16
|
+
* Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve
|
|
17
|
+
* datastores with cursor-based pagination.
|
|
18
|
+
*
|
|
19
|
+
* It also:
|
|
20
|
+
* - flattens all pages into a single `DatastoreWithRows[]` via `select`
|
|
21
|
+
* - exposes `actions` for cache management
|
|
22
|
+
* - exposes `events` for ag-Grid integration
|
|
23
|
+
*
|
|
24
|
+
* Important notes:
|
|
25
|
+
* - `query.data` returns a flat `DatastoreWithRows[]` (all pages merged).
|
|
26
|
+
* - Each item retains the full `Datastore` shape, with `data` replaced by `AnyRecord[]` (rows transformed via `tableToObjects`).
|
|
27
|
+
*
|
|
28
|
+
* Parameters (FetchInfiniteDatastoreProps):
|
|
29
|
+
* @param {FilterClause[]} [filters=[]]
|
|
30
|
+
* Filters applied to every page request. Must include a `workspace` filter.
|
|
31
|
+
*
|
|
32
|
+
* @param {string[]} [order=[]]
|
|
33
|
+
* Sorting applied to every page request.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} [projection=""]
|
|
36
|
+
* Single field to project: `"field"` returns only that field (others come back null),
|
|
37
|
+
* `"-field"` returns every field except that one. One field only — lists 500. Omitted when empty.
|
|
38
|
+
*
|
|
39
|
+
* @param {number} [pageSize=10]
|
|
40
|
+
* Number of datastores to fetch per page.
|
|
41
|
+
*
|
|
42
|
+
* @param {InfiniteOptions<DatastoreWithRows[]>} [queryOptions]
|
|
43
|
+
* TanStack Query options passed through to `useInfiniteQuery`
|
|
44
|
+
* (e.g., enabled, staleTime, gcTime, etc.).
|
|
45
|
+
*
|
|
46
|
+
* Returns:
|
|
47
|
+
* @returns {object}
|
|
48
|
+
* - `query`: the full `useInfiniteQuery` result (data, isLoading, hasNextPage, fetchNextPage, etc.)
|
|
49
|
+
* - `queryKey`: the cache key used by React Query
|
|
50
|
+
* - `events.handleFetchIfGridEmptyOrNearEnd(gridApi)`: triggers next page fetch when the ag-Grid is empty or near the end of the list
|
|
51
|
+
*
|
|
52
|
+
* Example:
|
|
53
|
+
* ```ts
|
|
54
|
+
* const { query, events } = useFetchDatastores({
|
|
55
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
56
|
+
* pageSize: 20,
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* // Flat list of all fetched datastores with transformed rows
|
|
60
|
+
* const datastores = query.data ?? [];
|
|
61
|
+
*
|
|
62
|
+
* // Load next page when grid is near end
|
|
63
|
+
* <AgGridReact onBodyScroll={() => events.handleFetchIfGridEmptyOrNearEnd(gridApi)} />
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
function useFetchDatastores({ filters = [], order = [], projection = "", pageSize = 10, queryOptions }) {
|
|
67
|
+
const { api } = useAxios();
|
|
68
|
+
const queryKey = buildQueryKey(["datastores"], filters);
|
|
69
|
+
const mergedQueryOptions = useMemo(() => ({
|
|
70
|
+
...defaultQueryOptions,
|
|
71
|
+
...queryOptions ?? {}
|
|
72
|
+
}), [queryOptions]);
|
|
73
|
+
return {
|
|
74
|
+
query: useInfiniteQuery({
|
|
75
|
+
queryKey,
|
|
76
|
+
initialPageParam: null,
|
|
77
|
+
getNextPageParam: (lastPage) => lastPage.next_page_token ?? void 0,
|
|
78
|
+
queryFn: async ({ pageParam }) => {
|
|
79
|
+
const queryFilter = buildQueryObject({
|
|
80
|
+
filters,
|
|
81
|
+
order,
|
|
82
|
+
projection,
|
|
83
|
+
pageSize,
|
|
84
|
+
pageToken: pageParam ?? void 0
|
|
85
|
+
});
|
|
86
|
+
const response = await listDatastores(api, queryFilter);
|
|
87
|
+
const nested = response.datastores.map((datastore) => ({
|
|
88
|
+
...datastore,
|
|
89
|
+
data: tableToObjects(datastore.id, datastore.data?.[0], datastore.data)
|
|
90
|
+
}));
|
|
91
|
+
return {
|
|
92
|
+
next_page_token: response.next_page_token,
|
|
93
|
+
datastores: nested
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
select: (data) => data.pages.flatMap((p) => p.datastores),
|
|
97
|
+
...mergedQueryOptions
|
|
98
|
+
}),
|
|
99
|
+
queryKey
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { useFetchDatastores };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=useFetchDatastores.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchDatastores.js","names":[],"sources":["../../../src/hooks/datastore/useFetchDatastores.ts"],"sourcesContent":["//import { useCallback, useMemo, useRef } from \"react\";\nimport { useMemo } from \"react\";\nimport { useInfiniteQuery, type UseInfiniteQueryOptions, type QueryKey } from \"@tanstack/react-query\";\n\n//import type { GridApi } from \"ag-grid-community\";\n\nimport { useAxios } from \"@/hooks/useAxios\";\nimport { tableToObjects } from \"@/lib/datastoreTable\";\nimport { listDatastores } from \"@/api/datastore\";\n\nimport type { Datastore, DatastoreListResponse, DatastoreWithRows } from \"@/types/datastore\";\nimport type { FetchEntitiesParams, EntityDefaultResponse } from \"@/types/entityQuery\";\nimport { buildQueryKey, buildQueryObject } from \"@/api/entityQuery\";\n\ntype PageToken = string | null;\n\ntype InfiniteOptions<TData> = Omit<\n UseInfiniteQueryOptions<DatastoreQueryPage, Error, TData, QueryKey, PageToken>,\n \"queryKey\" | \"queryFn\" | \"initialPageParam\" | \"getNextPageParam\"\n>;\n\n\nexport type DatastoreQueryPage = EntityDefaultResponse & {\n datastores: DatastoreWithRows[];\n};\n\nexport type FetchInfiniteDatastoreProps = FetchEntitiesParams<DatastoreWithRows[], InfiniteOptions<DatastoreWithRows[]>> & {\n pageSize?: number;\n};\n\nconst defaultQueryOptions: InfiniteOptions<DatastoreWithRows[]> = {\n refetchOnMount: \"always\",\n staleTime: 0,\n gcTime: 0,\n};\n\n/**\n * useFetchDatastores\n *\n * Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve\n * datastores with cursor-based pagination.\n *\n * It also:\n * - flattens all pages into a single `DatastoreWithRows[]` via `select`\n * - exposes `actions` for cache management\n * - exposes `events` for ag-Grid integration\n *\n * Important notes:\n * - `query.data` returns a flat `DatastoreWithRows[]` (all pages merged).\n * - Each item retains the full `Datastore` shape, with `data` replaced by `AnyRecord[]` (rows transformed via `tableToObjects`).\n *\n * Parameters (FetchInfiniteDatastoreProps):\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 datastores to fetch per page.\n *\n * @param {InfiniteOptions<DatastoreWithRows[]>} [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 * - `events.handleFetchIfGridEmptyOrNearEnd(gridApi)`: triggers next page fetch when the ag-Grid is empty or near the end of the list\n *\n * Example:\n * ```ts\n * const { query, events } = useFetchDatastores({\n * filters: [{ field: \"workspace\", value: \"ws-1\" }],\n * pageSize: 20,\n * });\n *\n * // Flat list of all fetched datastores with transformed rows\n * const datastores = query.data ?? [];\n *\n * // Load next page when grid is near end\n * <AgGridReact onBodyScroll={() => events.handleFetchIfGridEmptyOrNearEnd(gridApi)} />\n * ```\n */\nexport function useFetchDatastores({ filters = [], order = [], projection = \"\", pageSize = 10, queryOptions }: FetchInfiniteDatastoreProps) {\n const { api } = useAxios();\n\n //const fetchingGuardRef = useRef(false);\n const queryKey = buildQueryKey([\"datastores\"], filters);\n\n const mergedQueryOptions = useMemo<InfiniteOptions<DatastoreWithRows[]>>(() => ({\n ...defaultQueryOptions,\n ...(queryOptions ?? {}),\n }), [queryOptions]);\n\n const query = useInfiniteQuery<DatastoreQueryPage, Error, DatastoreWithRows[], 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 const response: DatastoreListResponse = await listDatastores(api, queryFilter);\n\n const nested: DatastoreWithRows[] = response.datastores.map((datastore: Datastore) => ({\n ...datastore,\n data: tableToObjects(\n datastore.id,\n datastore.data?.[0] as string[],\n datastore.data\n ),\n }));\n\n return {\n next_page_token: response.next_page_token,\n datastores: nested,\n };\n },\n\n select: (data) => data.pages.flatMap((p) => p.datastores),\n\n ...mergedQueryOptions,\n });\n\n /*\n const { hasNextPage, isFetchingNextPage, fetchNextPage } = query;\n const handleFetchIfGridEmptyOrNearEnd = useCallback((gridApi: GridApi) => {\n if (!hasNextPage || isFetchingNextPage || fetchingGuardRef.current) return;\n\n const total = gridApi.getDisplayedRowCount();\n const last = gridApi.getLastDisplayedRowIndex();\n\n const isEmpty = total === 0 || last < 0;\n const isNearEnd = !isEmpty && (total - 1 - last) <= 30;\n\n if (!isEmpty && !isNearEnd) return;\n\n fetchingGuardRef.current = true;\n fetchNextPage().finally(() => {\n fetchingGuardRef.current = false;\n });\n }, [hasNextPage, isFetchingNextPage, fetchNextPage]);\n */\n\n return {\n query,\n queryKey,\n //events: { handleFetchIfGridEmptyOrNearEnd },\n };\n}"],"mappings":";;;;;;;AA8BA,IAAM,sBAA4D;CAC9D,gBAAgB;CAChB,WAAW;CACX,QAAQ;AACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,SAAgB,mBAAmB,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,aAAa,IAAI,WAAW,IAAI,gBAA6C;CACxI,MAAM,EAAE,QAAQ,SAAS;CAGzB,MAAM,WAAW,cAAc,CAAC,YAAY,GAAG,OAAO;CAEtD,MAAM,qBAAqB,eAAqD;EAC5E,GAAG;EACH,GAAI,gBAAgB,CAAC;CACzB,IAAI,CAAC,YAAY,CAAC;CA0DlB,OAAO;EACH,OAzDU,iBAAsF;GAChG;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,MAAM,WAAkC,MAAM,eAAe,KAAK,WAAW;IAE7E,MAAM,SAA8B,SAAS,WAAW,KAAK,eAA0B;KACnF,GAAG;KACH,MAAM,eACF,UAAU,IACV,UAAU,OAAO,IACjB,UAAU,IACd;IACJ,EAAE;IAEF,OAAO;KACH,iBAAiB,SAAS;KAC1B,YAAY;IAChB;GACJ;GAEA,SAAS,SAAS,KAAK,MAAM,SAAS,MAAM,EAAE,UAAU;GAExD,GAAG;EACP,CAuBI;EACA;CAEJ;AACJ"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import type { EveryskFile } from "../../types/file.d.ts";
|
|
2
|
+
import type { FetchEntityParams } from "../../types/entityQuery.d.ts";
|
|
3
|
+
export type FetchFileProps<TData = EveryskFile, TSelected = TData> = FetchEntityParams<TData, TSelected>;
|
|
4
|
+
/**
|
|
5
|
+
* useFetchFile
|
|
6
|
+
*
|
|
7
|
+
* Data-fetching hook built on TanStack Query to retrieve a single file 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 `EveryskFile` object.
|
|
15
|
+
* - `EveryskFile.data` represents the file content and is expected to be a Base64-encoded string
|
|
16
|
+
* when provided by the API (or when sending content through mutations).
|
|
17
|
+
*
|
|
18
|
+
* Parameters (FetchFileProps):
|
|
19
|
+
* @param {string} id
|
|
20
|
+
* EveryskFile identifier (required).
|
|
21
|
+
*
|
|
22
|
+
* @param {string} workspace
|
|
23
|
+
* Workspace the file belongs to (required by `getFile`).
|
|
24
|
+
*
|
|
25
|
+
* @param {EntityQueryOptions<any>} [queryOptions=defaultQueryOptions]
|
|
26
|
+
* TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
27
|
+
*
|
|
28
|
+
* Returns:
|
|
29
|
+
* @returns {object}
|
|
30
|
+
* TanStack Query's `query` object extended with:
|
|
31
|
+
* - `queryKey`: the cache key used by React Query
|
|
32
|
+
*
|
|
33
|
+
* Tip:
|
|
34
|
+
* - The returned `queryKey` can be reused by mutation hooks for cache invalidation:
|
|
35
|
+
* ```ts
|
|
36
|
+
* const fetch = useFetchFile({ id: "file-123", workspace: "ws-1" });
|
|
37
|
+
* useFileMutations({ queryKey: fetch.queryKey });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* Example:
|
|
41
|
+
* ```ts
|
|
42
|
+
* const { data, isLoading } = useFetchFile({
|
|
43
|
+
* id: "file-123",
|
|
44
|
+
* workspace: "ws-1",
|
|
45
|
+
* });
|
|
46
|
+
* // data -> EveryskFile
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare const useFetchFile: ({ id, workspace, queryOptions }: FetchFileProps) => {
|
|
50
|
+
queryKey: string[];
|
|
51
|
+
data: EveryskFile;
|
|
52
|
+
error: Error;
|
|
53
|
+
isError: true;
|
|
54
|
+
isPending: false;
|
|
55
|
+
isLoading: false;
|
|
56
|
+
isLoadingError: false;
|
|
57
|
+
isRefetchError: true;
|
|
58
|
+
isSuccess: false;
|
|
59
|
+
isPlaceholderData: false;
|
|
60
|
+
status: "error";
|
|
61
|
+
dataUpdatedAt: number;
|
|
62
|
+
errorUpdatedAt: number;
|
|
63
|
+
failureCount: number;
|
|
64
|
+
failureReason: Error | null;
|
|
65
|
+
errorUpdateCount: number;
|
|
66
|
+
isFetched: boolean;
|
|
67
|
+
isFetchedAfterMount: boolean;
|
|
68
|
+
isFetching: boolean;
|
|
69
|
+
isInitialLoading: boolean;
|
|
70
|
+
isPaused: boolean;
|
|
71
|
+
isRefetching: boolean;
|
|
72
|
+
isStale: boolean;
|
|
73
|
+
isEnabled: boolean;
|
|
74
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<EveryskFile, Error>>;
|
|
75
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
76
|
+
} | {
|
|
77
|
+
queryKey: string[];
|
|
78
|
+
data: EveryskFile;
|
|
79
|
+
error: null;
|
|
80
|
+
isError: false;
|
|
81
|
+
isPending: false;
|
|
82
|
+
isLoading: false;
|
|
83
|
+
isLoadingError: false;
|
|
84
|
+
isRefetchError: false;
|
|
85
|
+
isSuccess: true;
|
|
86
|
+
isPlaceholderData: false;
|
|
87
|
+
status: "success";
|
|
88
|
+
dataUpdatedAt: number;
|
|
89
|
+
errorUpdatedAt: number;
|
|
90
|
+
failureCount: number;
|
|
91
|
+
failureReason: Error | null;
|
|
92
|
+
errorUpdateCount: number;
|
|
93
|
+
isFetched: boolean;
|
|
94
|
+
isFetchedAfterMount: boolean;
|
|
95
|
+
isFetching: boolean;
|
|
96
|
+
isInitialLoading: boolean;
|
|
97
|
+
isPaused: boolean;
|
|
98
|
+
isRefetching: boolean;
|
|
99
|
+
isStale: boolean;
|
|
100
|
+
isEnabled: boolean;
|
|
101
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<EveryskFile, Error>>;
|
|
102
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
103
|
+
} | {
|
|
104
|
+
queryKey: string[];
|
|
105
|
+
data: undefined;
|
|
106
|
+
error: Error;
|
|
107
|
+
isError: true;
|
|
108
|
+
isPending: false;
|
|
109
|
+
isLoading: false;
|
|
110
|
+
isLoadingError: true;
|
|
111
|
+
isRefetchError: false;
|
|
112
|
+
isSuccess: false;
|
|
113
|
+
isPlaceholderData: false;
|
|
114
|
+
status: "error";
|
|
115
|
+
dataUpdatedAt: number;
|
|
116
|
+
errorUpdatedAt: number;
|
|
117
|
+
failureCount: number;
|
|
118
|
+
failureReason: Error | null;
|
|
119
|
+
errorUpdateCount: number;
|
|
120
|
+
isFetched: boolean;
|
|
121
|
+
isFetchedAfterMount: boolean;
|
|
122
|
+
isFetching: boolean;
|
|
123
|
+
isInitialLoading: boolean;
|
|
124
|
+
isPaused: boolean;
|
|
125
|
+
isRefetching: boolean;
|
|
126
|
+
isStale: boolean;
|
|
127
|
+
isEnabled: boolean;
|
|
128
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<EveryskFile, Error>>;
|
|
129
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
130
|
+
} | {
|
|
131
|
+
queryKey: string[];
|
|
132
|
+
data: undefined;
|
|
133
|
+
error: null;
|
|
134
|
+
isError: false;
|
|
135
|
+
isPending: true;
|
|
136
|
+
isLoading: true;
|
|
137
|
+
isLoadingError: false;
|
|
138
|
+
isRefetchError: false;
|
|
139
|
+
isSuccess: false;
|
|
140
|
+
isPlaceholderData: false;
|
|
141
|
+
status: "pending";
|
|
142
|
+
dataUpdatedAt: number;
|
|
143
|
+
errorUpdatedAt: number;
|
|
144
|
+
failureCount: number;
|
|
145
|
+
failureReason: Error | null;
|
|
146
|
+
errorUpdateCount: number;
|
|
147
|
+
isFetched: boolean;
|
|
148
|
+
isFetchedAfterMount: boolean;
|
|
149
|
+
isFetching: boolean;
|
|
150
|
+
isInitialLoading: boolean;
|
|
151
|
+
isPaused: boolean;
|
|
152
|
+
isRefetching: boolean;
|
|
153
|
+
isStale: boolean;
|
|
154
|
+
isEnabled: boolean;
|
|
155
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<EveryskFile, Error>>;
|
|
156
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
157
|
+
} | {
|
|
158
|
+
queryKey: string[];
|
|
159
|
+
data: undefined;
|
|
160
|
+
error: null;
|
|
161
|
+
isError: false;
|
|
162
|
+
isPending: true;
|
|
163
|
+
isLoadingError: false;
|
|
164
|
+
isRefetchError: false;
|
|
165
|
+
isSuccess: false;
|
|
166
|
+
isPlaceholderData: false;
|
|
167
|
+
status: "pending";
|
|
168
|
+
dataUpdatedAt: number;
|
|
169
|
+
errorUpdatedAt: number;
|
|
170
|
+
failureCount: number;
|
|
171
|
+
failureReason: Error | null;
|
|
172
|
+
errorUpdateCount: number;
|
|
173
|
+
isFetched: boolean;
|
|
174
|
+
isFetchedAfterMount: boolean;
|
|
175
|
+
isFetching: boolean;
|
|
176
|
+
isLoading: boolean;
|
|
177
|
+
isInitialLoading: boolean;
|
|
178
|
+
isPaused: boolean;
|
|
179
|
+
isRefetching: boolean;
|
|
180
|
+
isStale: boolean;
|
|
181
|
+
isEnabled: boolean;
|
|
182
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<EveryskFile, Error>>;
|
|
183
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
184
|
+
} | {
|
|
185
|
+
queryKey: string[];
|
|
186
|
+
data: EveryskFile;
|
|
187
|
+
isError: false;
|
|
188
|
+
error: null;
|
|
189
|
+
isPending: false;
|
|
190
|
+
isLoading: false;
|
|
191
|
+
isLoadingError: false;
|
|
192
|
+
isRefetchError: false;
|
|
193
|
+
isSuccess: true;
|
|
194
|
+
isPlaceholderData: true;
|
|
195
|
+
status: "success";
|
|
196
|
+
dataUpdatedAt: number;
|
|
197
|
+
errorUpdatedAt: number;
|
|
198
|
+
failureCount: number;
|
|
199
|
+
failureReason: Error | null;
|
|
200
|
+
errorUpdateCount: number;
|
|
201
|
+
isFetched: boolean;
|
|
202
|
+
isFetchedAfterMount: boolean;
|
|
203
|
+
isFetching: boolean;
|
|
204
|
+
isInitialLoading: boolean;
|
|
205
|
+
isPaused: boolean;
|
|
206
|
+
isRefetching: boolean;
|
|
207
|
+
isStale: boolean;
|
|
208
|
+
isEnabled: boolean;
|
|
209
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<EveryskFile, Error>>;
|
|
210
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
211
|
+
};
|
|
212
|
+
//# sourceMappingURL=useFetchFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchFile.d.ts","sourceRoot":"","sources":["../../../src/hooks/file/useFetchFile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,KAAK,EAAsB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,MAAM,cAAc,CAAC,KAAK,GAAG,WAAW,EAAE,SAAS,GAAG,KAAK,IAAI,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAQzG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,YAAY,GAAI,iCAAuD,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BjG,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useAppAlert } from "../../contexts/appAlertContext/useAppAlert.js";
|
|
2
|
+
import { useAxios } from "../useAxios.js";
|
|
3
|
+
import { getFile } from "../../api/file.js";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
//#region src/hooks/file/useFetchFile.ts
|
|
7
|
+
var defaultQueryOptions = {
|
|
8
|
+
refetchOnMount: "always",
|
|
9
|
+
staleTime: 0,
|
|
10
|
+
gcTime: 0
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* useFetchFile
|
|
14
|
+
*
|
|
15
|
+
* Data-fetching hook built on TanStack Query to retrieve a single file 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 `EveryskFile` object.
|
|
23
|
+
* - `EveryskFile.data` represents the file content and is expected to be a Base64-encoded string
|
|
24
|
+
* when provided by the API (or when sending content through mutations).
|
|
25
|
+
*
|
|
26
|
+
* Parameters (FetchFileProps):
|
|
27
|
+
* @param {string} id
|
|
28
|
+
* EveryskFile identifier (required).
|
|
29
|
+
*
|
|
30
|
+
* @param {string} workspace
|
|
31
|
+
* Workspace the file belongs to (required by `getFile`).
|
|
32
|
+
*
|
|
33
|
+
* @param {EntityQueryOptions<any>} [queryOptions=defaultQueryOptions]
|
|
34
|
+
* TanStack Query options passed through to `useQuery` (e.g., enabled, staleTime, gcTime, etc.).
|
|
35
|
+
*
|
|
36
|
+
* Returns:
|
|
37
|
+
* @returns {object}
|
|
38
|
+
* TanStack Query's `query` object extended with:
|
|
39
|
+
* - `queryKey`: the cache key used by React Query
|
|
40
|
+
*
|
|
41
|
+
* Tip:
|
|
42
|
+
* - The returned `queryKey` can be reused by mutation hooks for cache invalidation:
|
|
43
|
+
* ```ts
|
|
44
|
+
* const fetch = useFetchFile({ id: "file-123", workspace: "ws-1" });
|
|
45
|
+
* useFileMutations({ queryKey: fetch.queryKey });
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* Example:
|
|
49
|
+
* ```ts
|
|
50
|
+
* const { data, isLoading } = useFetchFile({
|
|
51
|
+
* id: "file-123",
|
|
52
|
+
* workspace: "ws-1",
|
|
53
|
+
* });
|
|
54
|
+
* // data -> EveryskFile
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
var useFetchFile = ({ id, workspace, queryOptions = defaultQueryOptions }) => {
|
|
58
|
+
const { api } = useAxios();
|
|
59
|
+
const { showAlert } = useAppAlert();
|
|
60
|
+
const queryKey = [
|
|
61
|
+
"file",
|
|
62
|
+
id,
|
|
63
|
+
workspace
|
|
64
|
+
];
|
|
65
|
+
const query = useQuery({
|
|
66
|
+
queryKey,
|
|
67
|
+
queryFn: async () => {
|
|
68
|
+
return await getFile(api, id, workspace);
|
|
69
|
+
},
|
|
70
|
+
...queryOptions ?? {}
|
|
71
|
+
});
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!query.error) return;
|
|
74
|
+
showAlert({
|
|
75
|
+
severity: "error",
|
|
76
|
+
message: query.error.message
|
|
77
|
+
});
|
|
78
|
+
}, [query.error, showAlert]);
|
|
79
|
+
return {
|
|
80
|
+
...query,
|
|
81
|
+
queryKey
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
//#endregion
|
|
85
|
+
export { useFetchFile };
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=useFetchFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchFile.js","names":[],"sources":["../../../src/hooks/file/useFetchFile.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nimport { useQuery } from \"@tanstack/react-query\";\n\nimport { useAxios } from \"@/hooks/useAxios\";\nimport type { EveryskFile } from \"@/types/file\";\nimport { useAppAlert } from \"@/contexts/appAlertContext/useAppAlert\";\nimport { getFile } from \"@/api/file\";\nimport type { EntityQueryOptions, FetchEntityParams } from \"@/types/entityQuery\";\n\nexport type FetchFileProps<TData = EveryskFile, TSelected = TData> = FetchEntityParams<TData, TSelected>;\n\nconst defaultQueryOptions: EntityQueryOptions<EveryskFile> = {\n refetchOnMount: \"always\",\n staleTime: 0,\n gcTime: 0\n}\n\n/**\n * useFetchFile\n *\n * Data-fetching hook built on TanStack Query to retrieve a single file 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 `EveryskFile` object.\n * - `EveryskFile.data` represents the file content and is expected to be a Base64-encoded string\n * when provided by the API (or when sending content through mutations).\n *\n * Parameters (FetchFileProps):\n * @param {string} id\n * EveryskFile identifier (required).\n *\n * @param {string} workspace\n * Workspace the file belongs to (required by `getFile`).\n *\n * @param {EntityQueryOptions<any>} [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 = useFetchFile({ id: \"file-123\", workspace: \"ws-1\" });\n * useFileMutations({ queryKey: fetch.queryKey });\n * ```\n *\n * Example:\n * ```ts\n * const { data, isLoading } = useFetchFile({\n * id: \"file-123\",\n * workspace: \"ws-1\",\n * });\n * // data -> EveryskFile\n * ```\n */\nexport const useFetchFile = ({ id, workspace, queryOptions = defaultQueryOptions }: FetchFileProps) => {\n\n const { api } = useAxios();\n const { showAlert } = useAppAlert();\n\n const queryKey = [\"file\", id, workspace];\n\n const query = useQuery<EveryskFile>({\n queryKey,\n queryFn: async () => {\n const file = await getFile(api, id, workspace);\n return file;\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":";;;;;;AAYA,IAAM,sBAAuD;CACzD,gBAAgB;CAChB,WAAW;CACX,QAAQ;AACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,gBAAgB,EAAE,IAAI,WAAW,eAAe,0BAA0C;CAEnG,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,EAAE,cAAc,YAAY;CAElC,MAAM,WAAW;EAAC;EAAQ;EAAI;CAAS;CAEvC,MAAM,QAAQ,SAAsB;EAChC;EACA,SAAS,YAAY;GAEjB,OAAO,MADY,QAAQ,KAAK,IAAI,SAAS;EAEjD;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 { EveryskFile, FileListResponse } from "../../types/file.d.ts";
|
|
3
|
+
import type { FetchEntitiesParams } from "../../types/entityQuery.d.ts";
|
|
4
|
+
type PageToken = string | null;
|
|
5
|
+
type InfiniteOptions<TData> = Omit<UseInfiniteQueryOptions<FileListResponse, Error, TData, QueryKey, PageToken>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam">;
|
|
6
|
+
export type FetchInfiniteFileProps = FetchEntitiesParams<EveryskFile[], InfiniteOptions<EveryskFile[]>> & {
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* useFetchFiles
|
|
11
|
+
*
|
|
12
|
+
* Data-fetching hook built on TanStack Query's `useInfiniteQuery` to retrieve
|
|
13
|
+
* files with cursor-based pagination.
|
|
14
|
+
*
|
|
15
|
+
* It also:
|
|
16
|
+
* - flattens all pages into a single `EveryskFile[]` via `select`
|
|
17
|
+
*
|
|
18
|
+
* Important notes:
|
|
19
|
+
* - `query.data` returns a flat `EveryskFile[]` (all pages merged).
|
|
20
|
+
*
|
|
21
|
+
* Parameters (FetchInfiniteFileProps):
|
|
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 files to fetch per page.
|
|
34
|
+
*
|
|
35
|
+
* @param {InfiniteOptions<EveryskFile[]>} [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 } = useFetchFiles({
|
|
47
|
+
* filters: [{ field: "workspace", value: "ws-1" }],
|
|
48
|
+
* pageSize: 20,
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* // Flat list of all fetched files
|
|
52
|
+
* const files = query.data ?? [];
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function useFetchFiles({ filters, order, projection, pageSize, queryOptions }: FetchInfiniteFileProps): {
|
|
56
|
+
query: import("@tanstack/react-query").UseInfiniteQueryResult<EveryskFile[], Error>;
|
|
57
|
+
queryKey: unknown[];
|
|
58
|
+
};
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=useFetchFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchFiles.d.ts","sourceRoot":"","sources":["../../../src/hooks/file/useFetchFiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,uBAAuB,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItG,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,KAAK,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/B,KAAK,eAAe,CAAC,KAAK,IAAI,IAAI,CAC9B,uBAAuB,CAAC,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,EAC5E,UAAU,GAAG,SAAS,GAAG,kBAAkB,GAAG,kBAAkB,CACnE,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAC,WAAW,EAAE,EAAE,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG;IACtG,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAQF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,aAAa,CAAC,EAAE,OAAY,EAAE,KAAU,EAAE,UAAe,EAAE,QAAa,EAAE,YAAY,EAAE,EAAE,sBAAsB;;;EAoC/H"}
|