@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,159 @@
|
|
|
1
|
+
import type { Datastore } from "@/types/datastore";
|
|
2
|
+
import type { AnyRecord } from "@/types/anyRecord";
|
|
3
|
+
|
|
4
|
+
type Cell = string | number | null;
|
|
5
|
+
type DatastoreData = Cell[][];
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Converts a datastore table (2D array) into an array of objects.
|
|
9
|
+
*
|
|
10
|
+
* The input `data` is expected to be a 2D array where:
|
|
11
|
+
* - Row 0 typically contains the headers (but headers are provided explicitly via `headers`)
|
|
12
|
+
* - Rows 1..N contain the data values
|
|
13
|
+
*
|
|
14
|
+
* Key behaviors:
|
|
15
|
+
* - Skips the first row of `data` (starts at index 1), assuming it is the header row.
|
|
16
|
+
* - Adds a `datastoreId` field to every generated object so each record can be traced
|
|
17
|
+
* back to its source datastore.
|
|
18
|
+
* - Maps each header to the corresponding cell value by column index.
|
|
19
|
+
*
|
|
20
|
+
* @template T A record type whose values are compatible with `Cell` (string | number | null).
|
|
21
|
+
*
|
|
22
|
+
* @param datastoreId The id of the datastore to attach to each row as `datastoreId`.
|
|
23
|
+
* @param headers The column names used as object keys (positionally aligned with row cells).
|
|
24
|
+
* @param data The datastore matrix (rows x columns). Row 0 is assumed to be headers.
|
|
25
|
+
*
|
|
26
|
+
* @returns An array of objects (one per data row), each containing:
|
|
27
|
+
* - `datastoreId`
|
|
28
|
+
* - one property per header (with the corresponding cell value)
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const headers = ["name", "age"];
|
|
32
|
+
* const data = [
|
|
33
|
+
* ["name", "age"],
|
|
34
|
+
* ["Alice", 30],
|
|
35
|
+
* ["Bob", null],
|
|
36
|
+
* ];
|
|
37
|
+
* const rows = tableToObjects("ds_123", headers, data);
|
|
38
|
+
* // [
|
|
39
|
+
* // { datastoreId: "ds_123", name: "Alice", age: 30 },
|
|
40
|
+
* // { datastoreId: "ds_123", name: "Bob", age: null }
|
|
41
|
+
* // ]
|
|
42
|
+
*/
|
|
43
|
+
export const tableToObjects = <T extends Record<string, Cell>>(datastoreId: string, headers: string[], data: DatastoreData): T[] => {
|
|
44
|
+
const result: T[] = [];
|
|
45
|
+
|
|
46
|
+
for (let i = 1; i < data?.length; i++) {
|
|
47
|
+
const item: Record<string, Cell> = {};
|
|
48
|
+
|
|
49
|
+
item.datastoreId = datastoreId;
|
|
50
|
+
|
|
51
|
+
headers.forEach((header: string, index: number) => {
|
|
52
|
+
item[header] = data[i][index];
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
result.push(item as T);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Converts an array of objects into a datastore table (2D array).
|
|
63
|
+
*
|
|
64
|
+
* Key behaviors:
|
|
65
|
+
* - Produces a 2D array where the first row is the provided `headers`.
|
|
66
|
+
* - For each object in `data`, creates a row by mapping `headers` to values in the object.
|
|
67
|
+
* - If a header is missing in an object, the corresponding cell is set to `null`.
|
|
68
|
+
*
|
|
69
|
+
* @template T A record type whose values are compatible with `Cell` (string | number | null).
|
|
70
|
+
*
|
|
71
|
+
* @param headers Column names (and output table header row).
|
|
72
|
+
* @param data Array of objects to convert into rows.
|
|
73
|
+
*
|
|
74
|
+
* @returns A datastore matrix where:
|
|
75
|
+
* - Row 0 is `headers`
|
|
76
|
+
* - Rows 1..N contain cell values aligned with `headers`
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* const headers = ["name", "age"];
|
|
80
|
+
* const rows = objectsToTable(headers, [
|
|
81
|
+
* { name: "Alice", age: 30 },
|
|
82
|
+
* { name: "Bob" }, // age missing -> null
|
|
83
|
+
* ]);
|
|
84
|
+
* // [
|
|
85
|
+
* // ["name", "age"],
|
|
86
|
+
* // ["Alice", 30],
|
|
87
|
+
* // ["Bob", null]
|
|
88
|
+
* // ]
|
|
89
|
+
*/
|
|
90
|
+
export const objectsToTable = <T extends Record<string, Cell>>(headers: string[] ,data: T[]): DatastoreData => {
|
|
91
|
+
const rows: DatastoreData = data.map((d) => headers.map<Cell>((h) => d[h as string] ?? null));
|
|
92
|
+
|
|
93
|
+
return [headers, ...rows];
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Flattens multiple datastore row arrays into a single array.
|
|
98
|
+
*
|
|
99
|
+
* This is typically used after fetching multiple datastores, where each datastore is
|
|
100
|
+
* represented as `AnyRecord[]` (i.e., an array of row objects).
|
|
101
|
+
*
|
|
102
|
+
* @param datastores A list of datastores, each represented as an array of row objects.
|
|
103
|
+
*
|
|
104
|
+
* @returns A single array containing all rows from all datastores, in the same order.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* const merged = mergeDatastores([
|
|
108
|
+
* [{ datastoreId: "a", x: 1 }],
|
|
109
|
+
* [{ datastoreId: "b", x: 2 }, { datastoreId: "b", x: 3 }],
|
|
110
|
+
* ]);
|
|
111
|
+
* // [{...}, {...}, {...}]
|
|
112
|
+
*/
|
|
113
|
+
export const mergeDatastores = (datastores: AnyRecord[][]): AnyRecord[] => {
|
|
114
|
+
const result: AnyRecord[] = [];
|
|
115
|
+
|
|
116
|
+
datastores.forEach((datastore: AnyRecord[]) => {
|
|
117
|
+
result.push(...datastore);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
return result;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* buildDatastoreProps
|
|
125
|
+
*
|
|
126
|
+
* Extracts and maps the metadata properties of a `Datastore` into a plain object
|
|
127
|
+
* for UI usage, discarding raw data rows.
|
|
128
|
+
*
|
|
129
|
+
* - `header` is derived from `datastore.data?.[0]` (the first row of the data matrix),
|
|
130
|
+
* which is expected to contain the column names. Falls back to `[]` if not present.
|
|
131
|
+
*
|
|
132
|
+
* @param {Datastore} datastore - The source datastore object.
|
|
133
|
+
* @returns Metadata object with the datastore's descriptive properties and header.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* const meta = buildDatastoreProps(datastore);
|
|
137
|
+
* // {
|
|
138
|
+
* // name: "my-datastore",
|
|
139
|
+
* // workspace: "ws-1",
|
|
140
|
+
* // header: ["col1", "col2"],
|
|
141
|
+
* // ...
|
|
142
|
+
* // }
|
|
143
|
+
*/
|
|
144
|
+
export const buildDatastoreProps = (datastore: Datastore) => {
|
|
145
|
+
return {
|
|
146
|
+
name: datastore.name,
|
|
147
|
+
date: datastore.date,
|
|
148
|
+
version: datastore.version,
|
|
149
|
+
description: datastore.description,
|
|
150
|
+
tags: datastore.tags,
|
|
151
|
+
link_uid: datastore.link_uid,
|
|
152
|
+
workspace: datastore.workspace,
|
|
153
|
+
date_time: datastore.date_time,
|
|
154
|
+
created: datastore.created,
|
|
155
|
+
updated: datastore.updated,
|
|
156
|
+
level: datastore.level,
|
|
157
|
+
header: datastore.data?.[0] || [],
|
|
158
|
+
};
|
|
159
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { QueryClient, type QueryClientConfig, type QueryFunction } from "@tanstack/react-query";
|
|
2
|
+
|
|
3
|
+
async function throwIfResNotOk(res: Response) {
|
|
4
|
+
if (!res.ok) {
|
|
5
|
+
const text = (await res.text()) || res.statusText;
|
|
6
|
+
throw new Error(`${res.status}: ${text}`);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type UnauthorizedBehavior = "returnNull" | "throw";
|
|
11
|
+
export const getQueryFn: <T>(options: {
|
|
12
|
+
on401: UnauthorizedBehavior;
|
|
13
|
+
}) => QueryFunction<T> =
|
|
14
|
+
({ on401: unauthorizedBehavior }) =>
|
|
15
|
+
async ({ queryKey }) => {
|
|
16
|
+
const res = await fetch(queryKey.join("/") as string, {
|
|
17
|
+
credentials: "include",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (unauthorizedBehavior === "returnNull" && res.status === 401) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
await throwIfResNotOk(res);
|
|
25
|
+
return await res.json();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* createQueryClient
|
|
30
|
+
*
|
|
31
|
+
* Builds a `QueryClient` carrying the defaults every Everysk app shares: the fetch-based
|
|
32
|
+
* `queryFn` above, no retries, no refetch on focus or interval, and `staleTime: Infinity`.
|
|
33
|
+
*
|
|
34
|
+
* This is a factory rather than the shared instance the template exported. A module-level
|
|
35
|
+
* `new QueryClient()` inside a published package is a single cache shared by every consumer
|
|
36
|
+
* of that copy of the module: it cannot be configured per app, it cannot be reset, and in
|
|
37
|
+
* tests it leaks state from one case into the next. The app owns the instance and passes it
|
|
38
|
+
* to `QueryClientProvider` — `EveryskApp` does this for you when you don't pass one.
|
|
39
|
+
*
|
|
40
|
+
* @param {QueryClientConfig} [config] - Merged over the defaults, one level deep, so passing
|
|
41
|
+
* `defaultOptions.queries` replaces the whole `queries` object rather than merging into it.
|
|
42
|
+
* @returns {QueryClient} A fresh client.
|
|
43
|
+
*/
|
|
44
|
+
export const createQueryClient = (config?: QueryClientConfig): QueryClient =>
|
|
45
|
+
new QueryClient({
|
|
46
|
+
...config,
|
|
47
|
+
defaultOptions: {
|
|
48
|
+
queries: {
|
|
49
|
+
queryFn: getQueryFn({ on401: "throw" }),
|
|
50
|
+
refetchInterval: false,
|
|
51
|
+
refetchOnWindowFocus: false,
|
|
52
|
+
staleTime: Infinity,
|
|
53
|
+
retry: false,
|
|
54
|
+
},
|
|
55
|
+
mutations: {
|
|
56
|
+
retry: false,
|
|
57
|
+
},
|
|
58
|
+
...config?.defaultOptions,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The portfolio entity slice: API calls, entity hooks and types.
|
|
2
|
+
//
|
|
3
|
+
// Re-exported from the package root rather than its own subpath: nothing here carries an
|
|
4
|
+
// optional peer, so there is nothing for a subpath to isolate.
|
|
5
|
+
//
|
|
6
|
+
// `export *` rather than a hand-written list: a slice is exactly "everything these modules
|
|
7
|
+
// expose", and an enumerated list silently drops an export when the slice grows.
|
|
8
|
+
|
|
9
|
+
export * from "@/api/portfolio";
|
|
10
|
+
export * from "@/types/portfolio";
|
|
11
|
+
export * from "@/hooks/portfolio/useFetchPortfolio";
|
|
12
|
+
export * from "@/hooks/portfolio/useFetchPortfolios";
|
|
13
|
+
export * from "@/hooks/portfolio/usePortfolioMutations";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// The profile entity slice: API calls, entity hooks and types.
|
|
2
|
+
//
|
|
3
|
+
// Re-exported from the package root rather than its own subpath: nothing here carries an
|
|
4
|
+
// optional peer, so there is nothing for a subpath to isolate.
|
|
5
|
+
//
|
|
6
|
+
// `export *` rather than a hand-written list: a slice is exactly "everything these modules
|
|
7
|
+
// expose", and an enumerated list silently drops an export when the slice grows.
|
|
8
|
+
|
|
9
|
+
export * from "@/api/profile";
|
|
10
|
+
export * from "@/types/profile";
|
|
11
|
+
export * from "@/hooks/profile/useFetchProfile";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// `@everysk/apps-sdk/socket` — real-time notifications over Socket.IO.
|
|
2
|
+
//
|
|
3
|
+
// `socket.io-client` is an OPTIONAL peer, so an app without real-time features does not
|
|
4
|
+
// install it.
|
|
5
|
+
//
|
|
6
|
+
// This layer supersedes the broadcast channel context that used to be a core provider: it
|
|
7
|
+
// covers both cross-tab messaging and server push, which is what `modules.json` already said
|
|
8
|
+
// about the `socket` module. `WebSocketProvider` only needs to wrap its children, so it goes
|
|
9
|
+
// in `EveryskApp`'s `providers` array rather than into a named slot.
|
|
10
|
+
|
|
11
|
+
export * from "@/contexts/webSocketContext";
|
|
12
|
+
export * from "@/contexts/webSocketContext/provider";
|
|
13
|
+
export * from "@/contexts/webSocketContext/types";
|
|
14
|
+
export * from "@/contexts/webSocketContext/constants";
|
|
15
|
+
export * from "@/contexts/webSocketContext/handler";
|
|
16
|
+
export * from "@/contexts/webSocketContext/hooks/useWebSocket";
|
|
17
|
+
export * from "@/contexts/webSocketContext/hooks/useWebSocketSubscription";
|
|
18
|
+
export * from "@/contexts/webSocketContext/hooks/useAppNotificationSubscription";
|
|
19
|
+
export * from "@/api/websocketsConfig";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// `@everysk/apps-sdk/test` — helpers for testing apps built on the SDK.
|
|
2
|
+
//
|
|
3
|
+
// A separate subpath so the testing-library peers stay optional: an app that never imports
|
|
4
|
+
// this entry point does not need them installed.
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
renderWithProviders,
|
|
8
|
+
renderHookWithProviders,
|
|
9
|
+
createTestQueryClient,
|
|
10
|
+
} from "./renderWithProviders";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
let lastKey: string | null = null;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* agGridEnterpriseMock
|
|
5
|
+
*
|
|
6
|
+
* A stand-in for `ag-grid-enterprise`, for a test that renders something registering the AG Grid
|
|
7
|
+
* licence. The real `LicenseManager` validates the key and warns on the console when it does not
|
|
8
|
+
* like it, which is noise a test neither needs nor should depend on.
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { getAgGridLicenseKey } from "@everysk/apps-sdk/test/mocks";
|
|
12
|
+
*
|
|
13
|
+
* vi.mock("ag-grid-enterprise", async () =>
|
|
14
|
+
* (await import("@everysk/apps-sdk/test/mocks")).agGridEnterpriseMock(),
|
|
15
|
+
* );
|
|
16
|
+
*
|
|
17
|
+
* it("registers the licence the app passes", () => {
|
|
18
|
+
* render(<App />);
|
|
19
|
+
* expect(getAgGridLicenseKey()).toBe("test-key");
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* `setLicenseKey` is a plain function rather than a `vi.fn`, and the key is captured at module
|
|
24
|
+
* level, for the same reason the socket double is built that way: a config with `restoreMocks`
|
|
25
|
+
* wipes a `vi.fn`'s implementation between tests, so a spy created inside the factory stops
|
|
26
|
+
* recording after the first case. Reading the captured key works whatever the config does.
|
|
27
|
+
*
|
|
28
|
+
* Opt-in, never applied from the shared setup file — `ag-grid-enterprise` is an OPTIONAL peer,
|
|
29
|
+
* and `vi.mock` on a module that cannot be resolved fails the whole test file at transform time.
|
|
30
|
+
*/
|
|
31
|
+
export const agGridEnterpriseMock = () => ({
|
|
32
|
+
LicenseManager: {
|
|
33
|
+
setLicenseKey: (key: string) => {
|
|
34
|
+
lastKey = key;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/** The licence key last registered, or null when nothing registered one. */
|
|
40
|
+
export const getAgGridLicenseKey = (): string | null => lastKey;
|
|
41
|
+
|
|
42
|
+
/** Drops the captured key between tests. */
|
|
43
|
+
export const resetAgGridLicense = (): void => {
|
|
44
|
+
lastKey = null;
|
|
45
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
type ColumnDef = { field?: string; headerName?: string };
|
|
4
|
+
type Row = Record<string, unknown>;
|
|
5
|
+
|
|
6
|
+
type AgGridReactProps = {
|
|
7
|
+
rowData?: Row[] | null;
|
|
8
|
+
columnDefs?: ColumnDef[] | null;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* agGridReactMock
|
|
14
|
+
*
|
|
15
|
+
* A stand-in for `ag-grid-react` that renders the data as plain DOM instead of running AG
|
|
16
|
+
* Grid's layout, virtualisation and ResizeObserver work — which is what makes grid tests slow
|
|
17
|
+
* under jsdom.
|
|
18
|
+
*
|
|
19
|
+
* It is deliberately not a black box: rows and cells are rendered with test ids, so
|
|
20
|
+
* assertions about *what the grid was given* keep working. Only the rendering engine is gone.
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { agGridReactMock } from "@everysk/apps-sdk/test/mocks";
|
|
24
|
+
*
|
|
25
|
+
* vi.mock("ag-grid-react", agGridReactMock);
|
|
26
|
+
*
|
|
27
|
+
* it("lists the portfolios", () => {
|
|
28
|
+
* renderWithProviders(<PortfolioGrid />);
|
|
29
|
+
* expect(screen.getAllByTestId("ag-grid-row")).toHaveLength(3);
|
|
30
|
+
* expect(screen.getByTestId("ag-grid-cell-name")).toHaveTextContent("Fund A");
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* Opt-in on purpose. Applying this from the shared setup file would mock `ag-grid-react` for
|
|
35
|
+
* every app — including apps that never installed it, since it is an *optional* peer, and
|
|
36
|
+
* `vi.mock` on a module that cannot be resolved fails the whole test file at transform time.
|
|
37
|
+
*/
|
|
38
|
+
export const agGridReactMock = () => ({
|
|
39
|
+
AgGridReact: ({ rowData, columnDefs, children }: AgGridReactProps) => {
|
|
40
|
+
const rows = rowData ?? [];
|
|
41
|
+
const columns = columnDefs ?? [];
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div data-testid="ag-grid" data-row-count={rows.length}>
|
|
45
|
+
{rows.map((row, index) => (
|
|
46
|
+
<div key={index} data-testid="ag-grid-row">
|
|
47
|
+
{columns.map((column) => (
|
|
48
|
+
<span
|
|
49
|
+
key={column.field ?? column.headerName}
|
|
50
|
+
data-testid={`ag-grid-cell-${column.field ?? ""}`}
|
|
51
|
+
>
|
|
52
|
+
{String(row[column.field ?? ""] ?? "")}
|
|
53
|
+
</span>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
))}
|
|
57
|
+
{children}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// `@everysk/apps-sdk/test/mocks` — ready-made doubles for the slow or connection-bound
|
|
2
|
+
// third-party packages the SDK's optional layers sit on.
|
|
3
|
+
//
|
|
4
|
+
// All opt-in: each is a factory a test file hands to `vi.mock`, never applied from the shared
|
|
5
|
+
// setup file. Two reasons. A mock nobody declared is hard to debug when it surprises someone,
|
|
6
|
+
// and `ag-grid-react`, `ag-grid-enterprise` and `socket.io-client` are *optional* peers — `vi.mock` on a module that
|
|
7
|
+
// cannot be resolved fails the entire test file at transform time, so a global mock would
|
|
8
|
+
// break every suite in an app that never installed them.
|
|
9
|
+
|
|
10
|
+
export { agGridReactMock } from "./agGridReact";
|
|
11
|
+
export {
|
|
12
|
+
agGridEnterpriseMock,
|
|
13
|
+
getAgGridLicenseKey,
|
|
14
|
+
resetAgGridLicense,
|
|
15
|
+
} from "./agGridEnterprise";
|
|
16
|
+
export {
|
|
17
|
+
socketIoClientMock,
|
|
18
|
+
createMockSocket,
|
|
19
|
+
getMockSocket,
|
|
20
|
+
resetMockSocket,
|
|
21
|
+
} from "./socketIoClient";
|
|
22
|
+
export type { MockSocket, SocketEventHandler } from "./socketIoClient";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { vi, type Mock } from "vitest";
|
|
2
|
+
|
|
3
|
+
export type SocketEventHandler = (...args: unknown[]) => void;
|
|
4
|
+
|
|
5
|
+
// Typed with `Mock<signature>` rather than `ReturnType<typeof vi.fn>`: the latter erases the
|
|
6
|
+
// call signature, leaving the methods uncallable for a TypeScript consumer of this mock.
|
|
7
|
+
export type MockSocket = {
|
|
8
|
+
on: Mock<(event: string, handler: SocketEventHandler) => void>;
|
|
9
|
+
emit: Mock<(event: string, ...args: unknown[]) => void>;
|
|
10
|
+
removeAllListeners: Mock<() => void>;
|
|
11
|
+
disconnect: Mock<() => void>;
|
|
12
|
+
/** Every handler registered through `on`, keyed by event name. */
|
|
13
|
+
handlers: Record<string, SocketEventHandler>;
|
|
14
|
+
/** Invokes a registered handler, as the server would. No-op if nothing listens. */
|
|
15
|
+
fire: (event: string, ...args: unknown[]) => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
let lastSocket: MockSocket | null = null;
|
|
19
|
+
|
|
20
|
+
/** Builds a fake socket. Exported for tests that want one without mocking the module. */
|
|
21
|
+
export const createMockSocket = (): MockSocket => {
|
|
22
|
+
const handlers: Record<string, SocketEventHandler> = {};
|
|
23
|
+
|
|
24
|
+
const socket: MockSocket = {
|
|
25
|
+
handlers,
|
|
26
|
+
on: vi.fn((event: string, handler: SocketEventHandler) => {
|
|
27
|
+
handlers[event] = handler;
|
|
28
|
+
}),
|
|
29
|
+
emit: vi.fn(),
|
|
30
|
+
removeAllListeners: vi.fn(),
|
|
31
|
+
disconnect: vi.fn(),
|
|
32
|
+
fire: (event, ...args) => handlers[event]?.(...args),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return socket;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* socketIoClientMock
|
|
40
|
+
*
|
|
41
|
+
* A stand-in for `socket.io-client`: `io()` returns a fake socket that records listeners
|
|
42
|
+
* instead of opening a connection. Reach the socket with `getMockSocket()` and drive it with
|
|
43
|
+
* `fire(event, payload)`.
|
|
44
|
+
*
|
|
45
|
+
* Because `vi.mock` is hoisted above every import, the factory cannot close over a binding
|
|
46
|
+
* from this module directly — load it inside the factory:
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { getMockSocket } from "@everysk/apps-sdk/test/mocks";
|
|
50
|
+
*
|
|
51
|
+
* vi.mock("socket.io-client", async () =>
|
|
52
|
+
* (await import("@everysk/apps-sdk/test/mocks")).socketIoClientMock(),
|
|
53
|
+
* );
|
|
54
|
+
*
|
|
55
|
+
* it("reacts to a notification", () => {
|
|
56
|
+
* render(...);
|
|
57
|
+
* act(() => getMockSocket()?.fire("notification", { type: "DONE" }));
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export const socketIoClientMock = () => ({
|
|
62
|
+
// A plain function, not a vi.fn, and the socket is built per call rather than once when
|
|
63
|
+
// the factory runs. Both matter under this config: `restoreMocks: true` wipes a vi.fn's
|
|
64
|
+
// implementation between tests, and a socket created at factory time would be shared by
|
|
65
|
+
// every test in the file — and destroyed by the first `resetMockSocket()`.
|
|
66
|
+
io: () => {
|
|
67
|
+
lastSocket = createMockSocket();
|
|
68
|
+
return lastSocket;
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/** The socket handed out by the most recent `io()` call. */
|
|
73
|
+
export const getMockSocket = (): MockSocket | null => lastSocket;
|
|
74
|
+
|
|
75
|
+
/** Drops the reference between tests. */
|
|
76
|
+
export const resetMockSocket = (): void => {
|
|
77
|
+
lastSocket = null;
|
|
78
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
render,
|
|
5
|
+
renderHook,
|
|
6
|
+
type RenderOptions,
|
|
7
|
+
type RenderHookOptions,
|
|
8
|
+
} from "@testing-library/react";
|
|
9
|
+
import userEvent from "@testing-library/user-event";
|
|
10
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
11
|
+
|
|
12
|
+
import { EveryskApp, type ProviderComponent } from "@/EveryskApp";
|
|
13
|
+
import type { AnyRecord } from "@/types/anyRecord";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Test wrapper for apps built on this SDK.
|
|
17
|
+
*
|
|
18
|
+
* It renders through `EveryskApp` — the very component the app mounts — rather than
|
|
19
|
+
* re-listing the providers. The template's version duplicated the `App.tsx` tree and had to
|
|
20
|
+
* be kept in sync by hand, which is how you get a suite that passes while the app is broken.
|
|
21
|
+
*
|
|
22
|
+
* Each render gets a FRESH QueryClient with retries off and caching disabled, so tests never
|
|
23
|
+
* share server state. Pass your own via `options.queryClient` to seed the cache or assert on
|
|
24
|
+
* it. Optional providers (AG Grid's license, the socket provider) are not mounted by default:
|
|
25
|
+
* pass them in `options.providers` — the template's version wrapped every test in the
|
|
26
|
+
* broadcast provider, which is one of the things that kept it alive with no consumer.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/** Build an isolated QueryClient for a single test (no retries, no caching). */
|
|
30
|
+
export function createTestQueryClient(): QueryClient {
|
|
31
|
+
return new QueryClient({
|
|
32
|
+
defaultOptions: {
|
|
33
|
+
queries: { retry: false, gcTime: 0, staleTime: 0, refetchOnWindowFocus: false },
|
|
34
|
+
mutations: { retry: false },
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
type ProviderOptions = {
|
|
40
|
+
queryClient?: QueryClient;
|
|
41
|
+
/** Extra providers, mounted inside the core tree and around the subject. */
|
|
42
|
+
providers?: ProviderComponent[];
|
|
43
|
+
/** Injected instead of `window.APP_ID`, so a test needs no page globals. */
|
|
44
|
+
appId?: string | null;
|
|
45
|
+
/** Injected instead of `window.APP_CONFIG`. */
|
|
46
|
+
appEnvironmentVar?: AnyRecord;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const buildWrapper = ({ queryClient, providers, appId, appEnvironmentVar }: ProviderOptions & {
|
|
50
|
+
queryClient: QueryClient;
|
|
51
|
+
}) =>
|
|
52
|
+
function Wrapper({ children }: { children?: React.ReactNode }) {
|
|
53
|
+
return (
|
|
54
|
+
<EveryskApp
|
|
55
|
+
queryClient={queryClient}
|
|
56
|
+
providers={providers}
|
|
57
|
+
appId={appId}
|
|
58
|
+
appEnvironmentVar={appEnvironmentVar}
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
</EveryskApp>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Render a component inside the core provider tree.
|
|
67
|
+
*
|
|
68
|
+
* Returns everything from RTL's `render`, plus a ready `user` (userEvent.setup()) and the
|
|
69
|
+
* `queryClient` used, so assertions can reach the cache.
|
|
70
|
+
*/
|
|
71
|
+
export function renderWithProviders(
|
|
72
|
+
ui: ReactElement,
|
|
73
|
+
options: ProviderOptions & Omit<RenderOptions, "wrapper"> = {},
|
|
74
|
+
) {
|
|
75
|
+
const {
|
|
76
|
+
queryClient = createTestQueryClient(),
|
|
77
|
+
providers,
|
|
78
|
+
appId,
|
|
79
|
+
appEnvironmentVar,
|
|
80
|
+
...renderOptions
|
|
81
|
+
} = options;
|
|
82
|
+
const user = userEvent.setup();
|
|
83
|
+
|
|
84
|
+
const result = render(ui, {
|
|
85
|
+
wrapper: buildWrapper({ queryClient, providers, appId, appEnvironmentVar }),
|
|
86
|
+
...renderOptions,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return { user, queryClient, ...result };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Render a hook inside the core provider tree (for entity hooks that need QueryClient,
|
|
94
|
+
* AppAlert, AppConfig, etc.).
|
|
95
|
+
*/
|
|
96
|
+
export function renderHookWithProviders<Result, Props>(
|
|
97
|
+
hook: (initialProps: Props) => Result,
|
|
98
|
+
options: ProviderOptions & Omit<RenderHookOptions<Props>, "wrapper"> = {},
|
|
99
|
+
) {
|
|
100
|
+
const {
|
|
101
|
+
queryClient = createTestQueryClient(),
|
|
102
|
+
providers,
|
|
103
|
+
appId,
|
|
104
|
+
appEnvironmentVar,
|
|
105
|
+
...hookOptions
|
|
106
|
+
} = options;
|
|
107
|
+
|
|
108
|
+
const result = renderHook(hook, {
|
|
109
|
+
wrapper: buildWrapper({ queryClient, providers, appId, appEnvironmentVar }),
|
|
110
|
+
...hookOptions,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
return { queryClient, ...result };
|
|
114
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { afterEach, vi } from "vitest";
|
|
2
|
+
import { cleanup } from "@testing-library/react";
|
|
3
|
+
|
|
4
|
+
import "@testing-library/jest-dom/vitest";
|
|
5
|
+
|
|
6
|
+
// Unmount React trees and clear the jsdom document between tests so they stay isolated.
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
cleanup();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// jsdom does not implement matchMedia; MUI's `useMediaQuery` needs it. The theme no longer
|
|
12
|
+
// reads it — it is pinned to the brand dark theme — but responsive components still do.
|
|
13
|
+
if (!window.matchMedia) {
|
|
14
|
+
window.matchMedia = vi.fn().mockImplementation((query: string) => ({
|
|
15
|
+
matches: false,
|
|
16
|
+
media: query,
|
|
17
|
+
onchange: null,
|
|
18
|
+
addListener: vi.fn(),
|
|
19
|
+
removeListener: vi.fn(),
|
|
20
|
+
addEventListener: vi.fn(),
|
|
21
|
+
removeEventListener: vi.fn(),
|
|
22
|
+
dispatchEvent: vi.fn(),
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// jsdom does not implement ResizeObserver; several MUI components observe their container.
|
|
27
|
+
if (!globalThis.ResizeObserver) {
|
|
28
|
+
globalThis.ResizeObserver = class {
|
|
29
|
+
observe(): void {}
|
|
30
|
+
unobserve(): void {}
|
|
31
|
+
disconnect(): void {}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The template stubbed `BroadcastChannel` here, which jsdom does not implement. Nothing in
|
|
36
|
+
// the SDK constructs one any more — the broadcast context is gone, superseded by the socket
|
|
37
|
+
// layer — so the stub would only be dead setup. Whatever needs it can bring its own.
|
|
38
|
+
|
|
39
|
+
// Deliberately no `window.APP_ID` / `window.APP_CONFIG` defaults here.
|
|
40
|
+
//
|
|
41
|
+
// The template seeded them ("app_template", {}) because its providers read the globals
|
|
42
|
+
// directly and would otherwise see nothing. The SDK's providers handle absence on their own —
|
|
43
|
+
// `AppConfigProvider` reports `appId: null`, `BroadcastChannelProvider` falls back to its own
|
|
44
|
+
// channel name — and seeding the globals would hide exactly that path from the suite, which is
|
|
45
|
+
// the path every consumer hits in dev. A test that needs configuration injects it:
|
|
46
|
+
// `renderWithProviders(ui, { appId, appEnvironmentVar })`.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
|
|
3
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
4
|
+
import type { Theme } from "@mui/material/styles";
|
|
5
|
+
import { ThemeProvider as MuiThemeProvider } from "@mui/material/styles";
|
|
6
|
+
|
|
7
|
+
import { getBrandTheme } from "./themes";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The default an app mounts: the Everysk dark theme.
|
|
11
|
+
*
|
|
12
|
+
* Resolved once, at module load. It deliberately does not follow the OS `prefers-color-scheme`
|
|
13
|
+
* — doing that rendered the app light on a light desktop while every surrounding platform
|
|
14
|
+
* screen stayed dark. Choosing a theme is a decision the app makes about the surface it is
|
|
15
|
+
* embedded in, not one the viewer's laptop makes for it.
|
|
16
|
+
*/
|
|
17
|
+
const defaultTheme: Theme = getBrandTheme("dark");
|
|
18
|
+
|
|
19
|
+
export type ThemeProviderProps = React.PropsWithChildren<{
|
|
20
|
+
/**
|
|
21
|
+
* Overrides the default. Pass one of the catalog's themes, or any MUI theme of your own —
|
|
22
|
+
* `getTheme("Midnight Ember")`, `getBrandTheme("light")` for a light host, or a
|
|
23
|
+
* `createTheme` result. Omitted, the app gets the Everysk dark theme.
|
|
24
|
+
*/
|
|
25
|
+
theme?: Theme;
|
|
26
|
+
}>;
|
|
27
|
+
|
|
28
|
+
export const ThemeProvider = ({ children, theme }: ThemeProviderProps) => (
|
|
29
|
+
<MuiThemeProvider theme={theme ?? defaultTheme}>
|
|
30
|
+
<CssBaseline />
|
|
31
|
+
{children}
|
|
32
|
+
</MuiThemeProvider>
|
|
33
|
+
);
|