@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,38 @@
|
|
|
1
|
+
import Backdrop from "@mui/material/Backdrop";
|
|
2
|
+
import Box from "@mui/material/Box";
|
|
3
|
+
import CircularProgress from "@mui/material/CircularProgress";
|
|
4
|
+
import Typography from "@mui/material/Typography";
|
|
5
|
+
|
|
6
|
+
interface GlobalLoadingProps {
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
backdrop?: boolean;
|
|
9
|
+
message?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const GlobalLoading = ({ isLoading, backdrop = true, message }: GlobalLoadingProps) => {
|
|
13
|
+
if (!isLoading) return null;
|
|
14
|
+
|
|
15
|
+
const content = (
|
|
16
|
+
<Box sx={{ display: "flex", flexDirection: "column", alignItems: "center", gap: 2 }}>
|
|
17
|
+
<CircularProgress color="primary" />
|
|
18
|
+
{message && <Typography color="text.secondary">{message}</Typography>}
|
|
19
|
+
</Box>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
if (!backdrop) {
|
|
23
|
+
return (
|
|
24
|
+
<Box sx={{ display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }}>
|
|
25
|
+
{content}
|
|
26
|
+
</Box>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Backdrop
|
|
32
|
+
open
|
|
33
|
+
sx={{ zIndex: (theme) => theme.zIndex.modal + 1, backgroundColor: "rgba(0, 0, 0, 0.3)" }}
|
|
34
|
+
>
|
|
35
|
+
{content}
|
|
36
|
+
</Backdrop>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import type { PropsWithChildren, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export const PageContainer = ({ header, footer, contentClassName, children }: PropsWithChildren<{ header?: ReactNode, footer?: ReactNode, contentClassName?: string }>) => {
|
|
5
|
+
return (
|
|
6
|
+
<div className="flex flex-col w-full h-full overflow-hidden">
|
|
7
|
+
{header}
|
|
8
|
+
<div className={clsx("flex shrink-1 grow-1 basis-auto overflow-auto", contentClassName)}>
|
|
9
|
+
{children}
|
|
10
|
+
</div>
|
|
11
|
+
{footer}
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
import AppBar from '@mui/material/AppBar';
|
|
4
|
+
import { useTheme, type Theme } from '@mui/material/styles';
|
|
5
|
+
import MuiToolbar from '@mui/material/Toolbar';
|
|
6
|
+
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
|
|
9
|
+
import { EveryskIcon } from '@/components/ui/EveryskIcon';
|
|
10
|
+
|
|
11
|
+
import type { AnyRecord } from '@/types/anyRecord';
|
|
12
|
+
|
|
13
|
+
export const Toolbar = ({ children, className }: PropsWithChildren<{ className?: string }>) => {
|
|
14
|
+
const theme: Theme = useTheme();
|
|
15
|
+
|
|
16
|
+
const styles: AnyRecord = {
|
|
17
|
+
light: {
|
|
18
|
+
color: 'transparent',
|
|
19
|
+
elevation: 0,
|
|
20
|
+
sx: {
|
|
21
|
+
border: "1px solid rgba(0, 0, 0, 0.12)"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
dark: {
|
|
25
|
+
// 'default', not ''. An empty string is not a value the AppBar API takes — it
|
|
26
|
+
// produced the class `MuiAppBar-color` with no variant suffix, which rendered the
|
|
27
|
+
// same only because the brand theme overrides AppBar anyway. This is the explicit
|
|
28
|
+
// spelling of what already happens, and it survives a theme that does not.
|
|
29
|
+
color: 'default',
|
|
30
|
+
elevation: 1
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<AppBar position='relative' {...styles?.[theme.palette.mode]}>
|
|
36
|
+
<MuiToolbar >
|
|
37
|
+
<div className={clsx("flex items-center gap-4", className)}>
|
|
38
|
+
<EveryskIcon />
|
|
39
|
+
{children}
|
|
40
|
+
</div>
|
|
41
|
+
</MuiToolbar>
|
|
42
|
+
</AppBar>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
|
|
3
|
+
import { LicenseManager } from "ag-grid-enterprise";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* setAgGridLicense
|
|
7
|
+
*
|
|
8
|
+
* Registers the AG Grid Enterprise license. A no-op when the key is missing or empty, so an
|
|
9
|
+
* app that has not configured one degrades to the watermark instead of throwing.
|
|
10
|
+
*
|
|
11
|
+
* The key is a **parameter**, not something this package reads from the environment. The
|
|
12
|
+
* template read `import.meta.env.VITE_AG_GRID_LICENSE_KEY` at module scope, which works
|
|
13
|
+
* inside an app and silently breaks inside a published package: Vite replaces
|
|
14
|
+
* `import.meta.env.VITE_*` with a literal at the build of whoever compiles the file, so the
|
|
15
|
+
* value would freeze to whatever the SDK's own CI had — nothing — and the consuming app's
|
|
16
|
+
* environment would never reach it. No build error, no runtime error, just the watermark.
|
|
17
|
+
*
|
|
18
|
+
* The app keeps ownership of its own environment:
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* // src/main.tsx
|
|
22
|
+
* setAgGridLicense(import.meta.env.VITE_AG_GRID_LICENSE_KEY);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param {string} [licenseKey] - The license key, typically from the app's build environment.
|
|
26
|
+
*/
|
|
27
|
+
export const setAgGridLicense = (licenseKey?: string): void => {
|
|
28
|
+
if (typeof licenseKey === "string" && licenseKey) {
|
|
29
|
+
LicenseManager.setLicenseKey(licenseKey);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type AgGridLicenseProviderProps = PropsWithChildren<{
|
|
34
|
+
/** The license key. Omitted or empty, the provider only renders its children. */
|
|
35
|
+
licenseKey?: string;
|
|
36
|
+
}>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* AgGridLicenseProvider
|
|
40
|
+
*
|
|
41
|
+
* Provider form of `setAgGridLicense`, for apps that would rather configure the license in
|
|
42
|
+
* the component tree than at bootstrap. It holds no context — it registers the key and
|
|
43
|
+
* renders its children.
|
|
44
|
+
*
|
|
45
|
+
* The registration happens in the render body rather than in an effect on purpose: AG Grid
|
|
46
|
+
* reads the license when a grid first renders, and an effect runs *after* that commit, so a
|
|
47
|
+
* grid mounted in the same commit would flash the watermark. React renders a parent's body
|
|
48
|
+
* before its children, which is exactly the ordering needed here. `setLicenseKey` is an
|
|
49
|
+
* idempotent setter on a module global, so StrictMode's double render is harmless.
|
|
50
|
+
*
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <EveryskApp>
|
|
53
|
+
* <AgGridLicenseProvider licenseKey={import.meta.env.VITE_AG_GRID_LICENSE_KEY}>
|
|
54
|
+
* <Routes />
|
|
55
|
+
* </AgGridLicenseProvider>
|
|
56
|
+
* </EveryskApp>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export const AgGridLicenseProvider = ({ children, licenseKey }: AgGridLicenseProviderProps) => {
|
|
60
|
+
setAgGridLicense(licenseKey);
|
|
61
|
+
|
|
62
|
+
return <>{children}</>;
|
|
63
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState, type PropsWithChildren } from "react";
|
|
2
|
+
import Alert from "@mui/material/Alert";
|
|
3
|
+
import Snackbar, { type SnackbarCloseReason } from "@mui/material/Snackbar";
|
|
4
|
+
|
|
5
|
+
import { AppAlertContext } from ".";
|
|
6
|
+
import type { AppAlertContextType, AppAlertState, ShowAlertOptions } from "./types";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* AppAlertProvider
|
|
10
|
+
*
|
|
11
|
+
* React context provider responsible for exposing a global application alert API and rendering
|
|
12
|
+
* a Material UI `Snackbar` + `Alert` pair anchored to the viewport.
|
|
13
|
+
*
|
|
14
|
+
* What this provider does:
|
|
15
|
+
* - Maintains an internal `AppAlertState` that controls:
|
|
16
|
+
* - visibility (`open`)
|
|
17
|
+
* - displayed text (`message`)
|
|
18
|
+
* - alert tone (`severity`)
|
|
19
|
+
* - auto-dismiss timing (`autoHideDuration`)
|
|
20
|
+
* - screen position (`anchorOrigin`)
|
|
21
|
+
* - Exposes an imperative API via context:
|
|
22
|
+
* - `showAlert(options)` to open/update the alert
|
|
23
|
+
* - `hideAlert()` to close the alert
|
|
24
|
+
* - Renders the `Snackbar`/`Alert` components once (at the provider level), so any descendant can
|
|
25
|
+
* trigger alerts without needing to manage UI state locally.
|
|
26
|
+
*
|
|
27
|
+
* Behavior:
|
|
28
|
+
* - `showAlert(options)` performs a shallow merge of the provided options into the current state
|
|
29
|
+
* and forces `open: true`.
|
|
30
|
+
* - `hideAlert()` sets `open: false` (preserving the remaining state).
|
|
31
|
+
* - Snackbar `onClose` ignores the `"clickaway"` reason to prevent accidental dismissals when the user
|
|
32
|
+
* clicks outside the toast.
|
|
33
|
+
*
|
|
34
|
+
* Performance / stability:
|
|
35
|
+
* - `showAlert` and `hideAlert` should be stable (e.g., created with `useCallback`) so the context value
|
|
36
|
+
* does not change on every render, avoiding unnecessary re-renders in consumers.
|
|
37
|
+
*
|
|
38
|
+
* Usage:
|
|
39
|
+
* ```ts
|
|
40
|
+
* <AppAlertProvider>
|
|
41
|
+
* <App />
|
|
42
|
+
* </AppAlertProvider>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
export const AppAlertProvider = ({ children }: PropsWithChildren) => {
|
|
47
|
+
const [state, setState] = useState<AppAlertState>({
|
|
48
|
+
open: false,
|
|
49
|
+
message: "",
|
|
50
|
+
severity: "info",
|
|
51
|
+
autoHideDuration: 4000,
|
|
52
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const hideAlert = useCallback(() => {
|
|
56
|
+
setState((prev) => ({ ...prev, open: false }));
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
const showAlert = useCallback((options: ShowAlertOptions) => {
|
|
60
|
+
setState((prev) => ({
|
|
61
|
+
...prev,
|
|
62
|
+
...options,
|
|
63
|
+
open: true,
|
|
64
|
+
}));
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
const value: AppAlertContextType = useMemo(
|
|
68
|
+
() => ({ showAlert, hideAlert }),
|
|
69
|
+
[showAlert, hideAlert]
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<AppAlertContext.Provider value={value}>
|
|
74
|
+
{children}
|
|
75
|
+
|
|
76
|
+
<Snackbar
|
|
77
|
+
open={state.open}
|
|
78
|
+
message={state.message}
|
|
79
|
+
autoHideDuration={state.autoHideDuration}
|
|
80
|
+
anchorOrigin={state.anchorOrigin}
|
|
81
|
+
onClose={(_, reason: SnackbarCloseReason) => {
|
|
82
|
+
if (reason === "clickaway") return;
|
|
83
|
+
hideAlert();
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
<Alert onClose={hideAlert} severity={state.severity} variant="filled" elevation={6}>
|
|
87
|
+
{state.message}
|
|
88
|
+
</Alert>
|
|
89
|
+
</Snackbar>
|
|
90
|
+
</AppAlertContext.Provider>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AlertColor } from "@mui/material/Alert";
|
|
2
|
+
import type { SnackbarProps } from "@mui/material/Snackbar";
|
|
3
|
+
|
|
4
|
+
export type AppAlertState = Omit<SnackbarProps, "open" | "onClose" | "message"> & {
|
|
5
|
+
open: boolean;
|
|
6
|
+
message: string;
|
|
7
|
+
severity: AlertColor;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type ShowAlertOptions = Partial<Omit<AppAlertState, "open">> & {
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type AppAlertContextType = {
|
|
15
|
+
showAlert: (options: ShowAlertOptions) => void;
|
|
16
|
+
hideAlert: () => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { AppAlertContext } from ".";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* useAppAlert
|
|
6
|
+
*
|
|
7
|
+
* Convenience hook that reads the alert API from `AppAlertContext`.
|
|
8
|
+
*
|
|
9
|
+
* Behavior:
|
|
10
|
+
* - Returns the functions exposed by `<AppAlertProvider>`, typically:
|
|
11
|
+
* - `showAlert(options)` to display an alert
|
|
12
|
+
* - `hideAlert()` to close the current alert
|
|
13
|
+
*
|
|
14
|
+
* Error handling:
|
|
15
|
+
* - Throws a descriptive error if called outside of an `<AppAlertProvider>` scope, to fail fast
|
|
16
|
+
* and prevent silent no-op alert calls.
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* ```ts
|
|
20
|
+
* const { showAlert } = useAppAlert();
|
|
21
|
+
*
|
|
22
|
+
* showAlert({
|
|
23
|
+
* message: "Saved successfully.",
|
|
24
|
+
* severity: "success",
|
|
25
|
+
* autoHideDuration: 3000,
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @throws {Error}
|
|
30
|
+
* Throws if the hook is used outside of `<AppAlertProvider>`.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export const useAppAlert = () => {
|
|
34
|
+
const ctx = useContext(AppAlertContext);
|
|
35
|
+
if (!ctx) {
|
|
36
|
+
throw new Error("useAppAlert must be used within <AppAlertProvider>.");
|
|
37
|
+
}
|
|
38
|
+
return ctx;
|
|
39
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import { AppConfigContext } from ".";
|
|
4
|
+
import type { AppConfigContextType, AppConfigProviderProps } from "./types";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AppConfigProvider
|
|
8
|
+
*
|
|
9
|
+
* React context provider responsible for exposing the application's runtime configuration
|
|
10
|
+
* (`AppConfigContextType`) to the component tree.
|
|
11
|
+
*
|
|
12
|
+
* Configuration sources, in order of precedence:
|
|
13
|
+
*
|
|
14
|
+
* 1. The `appId` / `appEnvironmentVar` props.
|
|
15
|
+
* Explicit injection, for tests and for hosts that resolve configuration themselves rather
|
|
16
|
+
* than through the page globals. A prop wins over the corresponding global; passing
|
|
17
|
+
* `appId={null}` forces "no app id" instead of falling through to `window.APP_ID`.
|
|
18
|
+
*
|
|
19
|
+
* 2. `window.APP_ID` and `window.APP_CONFIG`.
|
|
20
|
+
* Injected into the page by the platform (from the app's `config.json` `env_vars`) before
|
|
21
|
+
* the bundle executes.
|
|
22
|
+
*
|
|
23
|
+
* In dev there is no platform to inject them, so the app's dev server serves the `env_vars` at
|
|
24
|
+
* `/app-config.json` and the app merges them into `window.APP_CONFIG` during bootstrap, before
|
|
25
|
+
* React mounts. That merge is shallow and belongs to the app, not to this provider: nested
|
|
26
|
+
* objects are replaced whole, not deep-merged.
|
|
27
|
+
*
|
|
28
|
+
* Lifecycle notes:
|
|
29
|
+
* - This provider performs no network request and does not update its value after mount.
|
|
30
|
+
* - Because configuration is resolved before `createRoot(...).render(...)`, the tree receives a
|
|
31
|
+
* consistent configuration from the first render.
|
|
32
|
+
*
|
|
33
|
+
* Example:
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <AppConfigProvider>
|
|
36
|
+
* <App />
|
|
37
|
+
* </AppConfigProvider>
|
|
38
|
+
*
|
|
39
|
+
* // In a test, with no page globals:
|
|
40
|
+
* <AppConfigProvider appId="app_42" appEnvironmentVar={{ API_URL: "/api" }}>
|
|
41
|
+
* <ComponentUnderTest />
|
|
42
|
+
* </AppConfigProvider>
|
|
43
|
+
*
|
|
44
|
+
* // Consumer hook usage
|
|
45
|
+
* const { appId, appEnvironmentVar } = useAppConfig();
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export const AppConfigProvider = ({
|
|
49
|
+
children,
|
|
50
|
+
appId,
|
|
51
|
+
appEnvironmentVar,
|
|
52
|
+
}: AppConfigProviderProps) => {
|
|
53
|
+
const value: AppConfigContextType = useMemo(() => {
|
|
54
|
+
const globalConfig = (globalThis.window?.APP_CONFIG ?? {}) as Record<string, unknown>;
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
appId: appId !== undefined ? appId : (globalThis.window?.APP_ID ?? null),
|
|
58
|
+
appEnvironmentVar: appEnvironmentVar ?? globalConfig,
|
|
59
|
+
};
|
|
60
|
+
}, [appId, appEnvironmentVar]);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<AppConfigContext.Provider value={value}>
|
|
64
|
+
{children}
|
|
65
|
+
</AppConfigContext.Provider>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { AnyRecord } from "@/types/anyRecord";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The platform injects these into the host page before the bundle runs. Both are optional:
|
|
6
|
+
* this augmentation reaches every consumer of the package, and declaring them as required
|
|
7
|
+
* would be a lie in dev, where nothing injects them — `AppConfigProvider` itself has always
|
|
8
|
+
* read `window.APP_ID ?? null`.
|
|
9
|
+
*/
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
APP_ID?: string;
|
|
13
|
+
APP_CONFIG?: { [key: string]: unknown };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type AppConfigContextType = {
|
|
18
|
+
appId: string | null;
|
|
19
|
+
appEnvironmentVar: AnyRecord;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type AppConfigProviderProps = {
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
/** Overrides `window.APP_ID`. Pass `null` to force "no app id". */
|
|
25
|
+
appId?: string | null;
|
|
26
|
+
/** Overrides `window.APP_CONFIG` wholesale (not merged into it). */
|
|
27
|
+
appEnvironmentVar?: AnyRecord;
|
|
28
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
|
|
3
|
+
import { AppConfigContext } from ".";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* useAppConfig
|
|
7
|
+
*
|
|
8
|
+
* Convenience hook that reads the current application configuration from `AppConfigContext`.
|
|
9
|
+
*
|
|
10
|
+
* Behavior:
|
|
11
|
+
* - Returns the `AppConfigContextType` value provided by `<AppConfigProvider>`.
|
|
12
|
+
* - Throws a descriptive error if called outside of an `<AppConfigProvider>` scope, to fail fast and
|
|
13
|
+
* avoid undefined configuration usage throughout the app.
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* ```ts
|
|
17
|
+
* const { appId, appEnvironmentVar } = useAppConfig();
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @throws {Error}
|
|
21
|
+
* Throws if the hook is used outside of `<AppConfigProvider>`.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export const useAppConfig = () => {
|
|
25
|
+
const context = useContext(AppConfigContext);
|
|
26
|
+
if (!context) {
|
|
27
|
+
throw new Error("useAppConfig must be used within <AppConfigProvider>.");
|
|
28
|
+
}
|
|
29
|
+
return context;
|
|
30
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { io, type Socket } from "socket.io-client";
|
|
2
|
+
|
|
3
|
+
import type { WebSocketNotification, WebSocketStatus, WebsocketsConfig } from "./types";
|
|
4
|
+
|
|
5
|
+
function isWebSocketNotification(value: unknown): value is WebSocketNotification {
|
|
6
|
+
return (
|
|
7
|
+
typeof value === "object" &&
|
|
8
|
+
value !== null &&
|
|
9
|
+
typeof (value as Record<string, unknown>)["event_type"] === "string"
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
import { JOIN_EVENT, NOTIFICATION_EVENT } from "./constants";
|
|
13
|
+
|
|
14
|
+
type StatusListener = (status: Exclude<WebSocketStatus, "idle">) => void;
|
|
15
|
+
|
|
16
|
+
type WebSocketHandlerConfig = WebsocketsConfig & {
|
|
17
|
+
onStatusChange?: StatusListener;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WebSocketHandler
|
|
22
|
+
*
|
|
23
|
+
* Low-level Socket.IO wrapper with a pub/sub layer.
|
|
24
|
+
*
|
|
25
|
+
* - Connects to the notification server.
|
|
26
|
+
* - Joins the per-user channel.
|
|
27
|
+
* - Forwards notifications to registered listeners.
|
|
28
|
+
*
|
|
29
|
+
* API:
|
|
30
|
+
* - `listen(callback)`: register a notification listener; returns an unsubscribe function.
|
|
31
|
+
* - `close()`: disconnect the socket and clear all listeners.
|
|
32
|
+
*/
|
|
33
|
+
export class WebSocketHandler {
|
|
34
|
+
private _socket: Socket;
|
|
35
|
+
private _everyskUID: string;
|
|
36
|
+
private _listeners: Set<(msg: WebSocketNotification) => void> = new Set();
|
|
37
|
+
|
|
38
|
+
constructor({ appConnectionURL, appChannelID, everyskUID, onStatusChange }: WebSocketHandlerConfig) {
|
|
39
|
+
this._everyskUID = everyskUID;
|
|
40
|
+
|
|
41
|
+
this._socket = io(appConnectionURL, {
|
|
42
|
+
auth: { appChannelID, everyskUID },
|
|
43
|
+
transports: ["websocket"],
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
this._socket.on("connect", () => {
|
|
47
|
+
this._socket.emit(JOIN_EVENT, appChannelID);
|
|
48
|
+
onStatusChange?.("connected");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
this._socket.on("connect_error", (error) => {
|
|
52
|
+
console.error("Socket.IO connection error:", error);
|
|
53
|
+
onStatusChange?.("error");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
this._socket.on("disconnect", (reason: string) => {
|
|
57
|
+
console.error("Socket.IO disconnected:", reason);
|
|
58
|
+
onStatusChange?.(reason === "io server disconnect" ? "error" : "connecting");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
this._socket.on(NOTIFICATION_EVENT, (msg: unknown) => {
|
|
62
|
+
if (!isWebSocketNotification(msg)) return;
|
|
63
|
+
if (this._isEcho(msg)) return;
|
|
64
|
+
this._listeners.forEach((callback) => {
|
|
65
|
+
try {
|
|
66
|
+
callback(msg);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error("Socket.IO notification listener threw:", error);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private _isEcho(msg: WebSocketNotification): boolean {
|
|
75
|
+
// Echo-cancellation is disabled by default.
|
|
76
|
+
// Set ECHO_UID_FIELD to the message field that carries the originating uid
|
|
77
|
+
// once the server team confirms the field name.
|
|
78
|
+
const ECHO_UID_FIELD: string | null = null;
|
|
79
|
+
if (!ECHO_UID_FIELD) return false;
|
|
80
|
+
const originating = (msg as Record<string, unknown>)[ECHO_UID_FIELD];
|
|
81
|
+
return originating === this._everyskUID;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* listen
|
|
86
|
+
*
|
|
87
|
+
* Registers a listener that receives every incoming notification.
|
|
88
|
+
*
|
|
89
|
+
* @param {(msg: WebSocketNotification) => void} callback - Invoked for each notification.
|
|
90
|
+
* @returns {() => void} Unsubscribe function.
|
|
91
|
+
*/
|
|
92
|
+
listen(callback: (msg: WebSocketNotification) => void): () => void {
|
|
93
|
+
this._listeners.add(callback);
|
|
94
|
+
return () => this._listeners.delete(callback);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* close
|
|
99
|
+
*
|
|
100
|
+
* Clears all listeners and disconnects the socket.
|
|
101
|
+
* After calling this, the handler should be considered unusable.
|
|
102
|
+
*/
|
|
103
|
+
close(): void {
|
|
104
|
+
this._listeners.clear();
|
|
105
|
+
this._socket.removeAllListeners();
|
|
106
|
+
this._socket.disconnect();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useWebSocketSubscription } from "../useWebSocketSubscription";
|
|
2
|
+
import { APP_NOTIFICATION_EVENT_TYPE } from "../../constants";
|
|
3
|
+
import type { AppNotification, WebSocketNotification } from "../../types";
|
|
4
|
+
|
|
5
|
+
function isAppNotification(msg: WebSocketNotification): msg is AppNotification {
|
|
6
|
+
return (
|
|
7
|
+
msg.event_type === APP_NOTIFICATION_EVENT_TYPE &&
|
|
8
|
+
typeof msg["user_app_id"] === "string" &&
|
|
9
|
+
typeof msg["payload"] === "object" &&
|
|
10
|
+
msg["payload"] !== null
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* useAppNotificationSubscription
|
|
16
|
+
*
|
|
17
|
+
* Convenience wrapper around `useWebSocketSubscription` that only invokes the handler
|
|
18
|
+
* for `event_type === "USER_APP_NOTIFICATION"` messages. All other WebSocket events are ignored.
|
|
19
|
+
*
|
|
20
|
+
* @param {(msg: AppNotification) => void} handler
|
|
21
|
+
* Callback invoked for each app-targeted notification.
|
|
22
|
+
*
|
|
23
|
+
* Example:
|
|
24
|
+
* ```ts
|
|
25
|
+
* useAppNotificationSubscription((msg) => {
|
|
26
|
+
* queryClient.invalidateQueries({ queryKey: ["portfolios"] });
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export const useAppNotificationSubscription = (handler: (msg: AppNotification) => void) => {
|
|
31
|
+
useWebSocketSubscription((msg: WebSocketNotification) => {
|
|
32
|
+
if (isAppNotification(msg)) {
|
|
33
|
+
handler(msg);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
|
|
3
|
+
import { WebSocketContext } from "../..";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* useWebSocket
|
|
7
|
+
*
|
|
8
|
+
* Convenience hook that reads the WebSocket API from `WebSocketContext`.
|
|
9
|
+
*
|
|
10
|
+
* Returns: `{ subscribe, lastMessage, status }` (see `WebSocketContextType`).
|
|
11
|
+
*
|
|
12
|
+
* @throws {Error} If used outside of `<WebSocketProvider>`.
|
|
13
|
+
*/
|
|
14
|
+
export const useWebSocket = () => {
|
|
15
|
+
const context = useContext(WebSocketContext);
|
|
16
|
+
if (!context) throw new Error("useWebSocket must be used within <WebSocketProvider>.");
|
|
17
|
+
return context;
|
|
18
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
import { useWebSocket } from "../useWebSocket";
|
|
4
|
+
import type { WebSocketNotification } from "../../types";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* useWebSocketSubscription
|
|
8
|
+
*
|
|
9
|
+
* High-level helper hook that subscribes to all WebSocket notifications on mount
|
|
10
|
+
* and unsubscribes on unmount.
|
|
11
|
+
*
|
|
12
|
+
* Why this exists:
|
|
13
|
+
* - Enforces the correct subscription pattern (`useEffect` + cleanup).
|
|
14
|
+
* - Prevents accidental duplicate subscriptions from re-renders.
|
|
15
|
+
* - Uses a ref-backed handler so the subscription is not recreated when the callback
|
|
16
|
+
* identity changes — the latest handler is always called without re-subscribing.
|
|
17
|
+
*
|
|
18
|
+
* Filtering (e.g. by `msg.event_type`) is intentionally left to the consumer.
|
|
19
|
+
* See `useAppNotificationSubscription` for a typed convenience wrapper.
|
|
20
|
+
*
|
|
21
|
+
* @param {(msg: WebSocketNotification) => void} handler
|
|
22
|
+
* Callback invoked for every received notification.
|
|
23
|
+
*
|
|
24
|
+
* Example:
|
|
25
|
+
* ```ts
|
|
26
|
+
* useWebSocketSubscription((msg) => {
|
|
27
|
+
* if (msg.event_type === "WORKFLOW_EXECUTION_COMPLETED") {
|
|
28
|
+
* queryClient.invalidateQueries({ queryKey: ["workflows"] });
|
|
29
|
+
* }
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export const useWebSocketSubscription = (handler: (msg: WebSocketNotification) => void) => {
|
|
34
|
+
const { subscribe } = useWebSocket();
|
|
35
|
+
const handlerRef = useRef(handler);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
handlerRef.current = handler;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const unsubscribe = subscribe((msg: WebSocketNotification) => handlerRef.current(msg));
|
|
43
|
+
return unsubscribe;
|
|
44
|
+
}, [subscribe]);
|
|
45
|
+
};
|