create-react-admin-template 0.0.0-stage → 0.1.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/README.md +46 -2
- package/bin/create.mjs +5 -0
- package/package.json +22 -4
- package/template/.dockerignore +12 -0
- package/template/.editorconfig +12 -0
- package/template/.env +14 -0
- package/template/.env.development +5 -0
- package/template/.env.production +2 -0
- package/template/.env.test +5 -0
- package/template/.github/workflows/ci.yml +40 -0
- package/template/.gitlab-ci.yml +208 -0
- package/template/.husky/commit-msg +1 -0
- package/template/.husky/pre-commit +1 -0
- package/template/.nvmrc +1 -0
- package/template/.prettierignore +11 -0
- package/template/.prettierrc +47 -0
- package/template/Dockerfile +16 -0
- package/template/README.md +372 -0
- package/template/build/advancedTable.ts +103 -0
- package/template/build/environment.ts +150 -0
- package/template/commitlint.config.js +32 -0
- package/template/components.json +21 -0
- package/template/deploy/README.md +132 -0
- package/template/deploy/host-nginx/react-admin-api.conf +14 -0
- package/template/deploy/host-nginx/react-admin-web.conf +8 -0
- package/template/deploy/nginx.conf +38 -0
- package/template/docs/activity-status.md +217 -0
- package/template/docs/audit-logs.md +158 -0
- package/template/docs/authentication-adapters.md +219 -0
- package/template/docs/browser-security.md +58 -0
- package/template/docs/bundle-budgets.md +65 -0
- package/template/docs/component-source-governance.md +99 -0
- package/template/docs/data-masking.md +169 -0
- package/template/docs/enterprise-scaffold.md +208 -0
- package/template/docs/feature-data-template.md +227 -0
- package/template/docs/feature-flags.md +169 -0
- package/template/docs/file-capabilities.md +196 -0
- package/template/docs/locale-and-i18n.md +132 -0
- package/template/docs/mutation-idempotency.md +24 -0
- package/template/docs/optional-editors.md +203 -0
- package/template/docs/page-feedback.md +83 -0
- package/template/docs/query-data-conventions.md +178 -0
- package/template/docs/realtime-collaboration.md +140 -0
- package/template/docs/reporting-printing-templates.md +156 -0
- package/template/docs/scaffold-capability-roadmap.md +226 -0
- package/template/docs/scaffold-guide.md +443 -0
- package/template/docs/template-changelog.md +30 -0
- package/template/docs/template-versioning.md +26 -0
- package/template/docs/tenant-workspace-context.md +147 -0
- package/template/docs/unsaved-changes.md +58 -0
- package/template/docs/white-label.md +102 -0
- package/template/eslint.config.js +697 -0
- package/template/gitignore +39 -0
- package/template/index.html +26 -0
- package/template/knip.config.ts +42 -0
- package/template/lint-staged.config.js +8 -0
- package/template/package.json +133 -0
- package/template/pnpm-lock.yaml +8694 -0
- package/template/public/favicon.ico +0 -0
- package/template/public/logo.svg +1 -0
- package/template/public/runtime-config.json +49 -0
- package/template/scaffold.template.json +5 -0
- package/template/src/Application.tsx +114 -0
- package/template/src/api/ApiError.ts +33 -0
- package/template/src/api/activity/ActivityProvider.tsx +167 -0
- package/template/src/api/activity/access.ts +13 -0
- package/template/src/api/activity/errors.ts +17 -0
- package/template/src/api/activity/index.ts +67 -0
- package/template/src/api/activity/model.ts +227 -0
- package/template/src/api/activity/query.ts +163 -0
- package/template/src/api/activity/source.ts +16 -0
- package/template/src/api/activity/subscription.ts +292 -0
- package/template/src/api/activity/transports.ts +271 -0
- package/template/src/api/activity/types.ts +402 -0
- package/template/src/api/authClient.ts +134 -0
- package/template/src/api/authSession.ts +307 -0
- package/template/src/api/clients/configureApiClient.ts +62 -0
- package/template/src/api/clients/httpStatus.ts +4 -0
- package/template/src/api/config/services.json +7 -0
- package/template/src/api/demoAuthClient.ts +46 -0
- package/template/src/api/enums/EnumCatalogProvider.tsx +169 -0
- package/template/src/api/enums/EnumDictionary.ts +55 -0
- package/template/src/api/enums/access.ts +130 -0
- package/template/src/api/enums/catalog.ts +216 -0
- package/template/src/api/enums/errors.ts +21 -0
- package/template/src/api/enums/index.ts +48 -0
- package/template/src/api/enums/query.ts +82 -0
- package/template/src/api/enums/scope.ts +58 -0
- package/template/src/api/enums/types.ts +251 -0
- package/template/src/api/hooks/error.ts +198 -0
- package/template/src/api/hooks/index.ts +4 -0
- package/template/src/api/hooks/request.ts +99 -0
- package/template/src/api/hooks/requestId.ts +65 -0
- package/template/src/api/hooks/response.ts +22 -0
- package/template/src/api/hooks/types.ts +20 -0
- package/template/src/api/idempotency/index.ts +1 -0
- package/template/src/api/idempotency/key.ts +23 -0
- package/template/src/api/index.ts +14 -0
- package/template/src/api/metadata/MetadataProvider.tsx +37 -0
- package/template/src/api/metadata/index.ts +2 -0
- package/template/src/api/metadata/types.ts +30 -0
- package/template/src/api/parameters/GlobalParameterProvider.tsx +210 -0
- package/template/src/api/parameters/access.ts +117 -0
- package/template/src/api/parameters/catalog.ts +170 -0
- package/template/src/api/parameters/errors.ts +21 -0
- package/template/src/api/parameters/index.ts +53 -0
- package/template/src/api/parameters/query.ts +84 -0
- package/template/src/api/parameters/scope.ts +58 -0
- package/template/src/api/parameters/types.ts +214 -0
- package/template/src/api/query/index.ts +13 -0
- package/template/src/api/query/keys.ts +155 -0
- package/template/src/api/query/mutation.ts +48 -0
- package/template/src/api/query/react.ts +36 -0
- package/template/src/api/query/scope.ts +38 -0
- package/template/src/api/query/types.ts +147 -0
- package/template/src/api/types.ts +144 -0
- package/template/src/application/types.ts +52 -0
- package/template/src/auditLogs/errors.ts +17 -0
- package/template/src/auditLogs/export.ts +85 -0
- package/template/src/auditLogs/index.ts +54 -0
- package/template/src/auditLogs/model.ts +526 -0
- package/template/src/auditLogs/query.ts +113 -0
- package/template/src/auditLogs/react.ts +36 -0
- package/template/src/auditLogs/source.ts +51 -0
- package/template/src/auditLogs/types.ts +357 -0
- package/template/src/authentication/controller.ts +351 -0
- package/template/src/authentication/index.ts +8 -0
- package/template/src/authentication/redirect.ts +72 -0
- package/template/src/authentication/types.ts +300 -0
- package/template/src/bootstrap.tsx +96 -0
- package/template/src/components/AppDataTable/AppDataTable.tsx +74 -0
- package/template/src/components/AppDataTable/index.ts +2 -0
- package/template/src/components/AppDataTable/types.ts +27 -0
- package/template/src/components/AppDialog/AppConfirmDialog.tsx +44 -0
- package/template/src/components/AppDialog/AppDialog.tsx +113 -0
- package/template/src/components/AppDialog/index.ts +3 -0
- package/template/src/components/AppDialog/messages.tsx +22 -0
- package/template/src/components/AppDialog/types.ts +53 -0
- package/template/src/components/AppPageForm/AppPageForm.tsx +21 -0
- package/template/src/components/AppPageForm/PageForm.tsx +765 -0
- package/template/src/components/AppPageForm/SOURCE.md +26 -0
- package/template/src/components/AppPageForm/config.ts +253 -0
- package/template/src/components/AppPageForm/controller.ts +580 -0
- package/template/src/components/AppPageForm/index.ts +2 -0
- package/template/src/components/AppPageForm/messages.ts +90 -0
- package/template/src/components/AppPageForm/optionUtils.ts +91 -0
- package/template/src/components/AppPageForm/options.ts +397 -0
- package/template/src/components/AppPageForm/query.ts +44 -0
- package/template/src/components/AppPageForm/style.css +119 -0
- package/template/src/components/AppPageForm/types.ts +632 -0
- package/template/src/components/AppPageForm/validation.ts +233 -0
- package/template/src/components/AppTable/AppTable.tsx +26 -0
- package/template/src/components/AppTable/SOURCE.md +72 -0
- package/template/src/components/AppTable/cell/customCell/TableCellLayer.tsx +73 -0
- package/template/src/components/AppTable/cell/customCell/actions/ActionDropdownCell.tsx +104 -0
- package/template/src/components/AppTable/cell/customCell/cellLayer.ts +358 -0
- package/template/src/components/AppTable/cell/customCell/componentProps.ts +30 -0
- package/template/src/components/AppTable/cell/customCell/date/TemporalPickerEditor.tsx +54 -0
- package/template/src/components/AppTable/cell/customCell/index.ts +2 -0
- package/template/src/components/AppTable/cell/customCell/select/SelectCellEditor.tsx +225 -0
- package/template/src/components/AppTable/cell/customCell/tableCellLayer.css +20 -0
- package/template/src/components/AppTable/cell/customCell/tooltip/TooltipCell.tsx +45 -0
- package/template/src/components/AppTable/cell/customCell/types.ts +63 -0
- package/template/src/components/AppTable/cell/customCell/useCellLayerLifecycle.ts +111 -0
- package/template/src/components/AppTable/cell/frameworkCell/TableCellComponentLayer.tsx +40 -0
- package/template/src/components/AppTable/cell/frameworkCell/cellComponentSession.ts +203 -0
- package/template/src/components/AppTable/cell/frameworkCell/index.ts +3 -0
- package/template/src/components/AppTable/cell/index.ts +2 -0
- package/template/src/components/AppTable/columns/TableColumnEditor.tsx +257 -0
- package/template/src/components/AppTable/columns/index.ts +1 -0
- package/template/src/components/AppTable/columns/useTableColumnPreferenceActions.ts +85 -0
- package/template/src/components/AppTable/config/defaults.ts +46 -0
- package/template/src/components/AppTable/config/index.ts +2 -0
- package/template/src/components/AppTable/config/license.ts +39 -0
- package/template/src/components/AppTable/config/resolver.ts +25 -0
- package/template/src/components/AppTable/config/types.ts +377 -0
- package/template/src/components/AppTable/engine/bottom/index.ts +1 -0
- package/template/src/components/AppTable/engine/bottom/types.ts +14 -0
- package/template/src/components/AppTable/engine/cell/constants.ts +32 -0
- package/template/src/components/AppTable/engine/cell/customCell/actions/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/actions/renderer.ts +162 -0
- package/template/src/components/AppTable/engine/cell/customCell/date/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/date/renderer.ts +116 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/editorBounds.ts +57 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/editorTrigger.ts +46 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/index.ts +3 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/layerEditor.ts +244 -0
- package/template/src/components/AppTable/engine/cell/customCell/index.ts +7 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/columnRenderer.ts +245 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/confirmInput.ts +57 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/display.ts +78 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/index.ts +3 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/itemList.ts +60 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/links.ts +131 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/selection.ts +41 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/shared.ts +71 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/step.ts +37 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/switch.ts +45 -0
- package/template/src/components/AppTable/engine/cell/customCell/select/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/select/renderer.ts +33 -0
- package/template/src/components/AppTable/engine/cell/customCell/tooltip/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/tooltip/tooltip.ts +94 -0
- package/template/src/components/AppTable/engine/cell/customCell/types.ts +82 -0
- package/template/src/components/AppTable/engine/cell/formatting.ts +355 -0
- package/template/src/components/AppTable/engine/cell/formula.ts +145 -0
- package/template/src/components/AppTable/engine/cell/index.ts +7 -0
- package/template/src/components/AppTable/engine/cell/multiSelect.ts +96 -0
- package/template/src/components/AppTable/engine/cell/options.ts +339 -0
- package/template/src/components/AppTable/engine/cell/types.ts +53 -0
- package/template/src/components/AppTable/engine/columns/column.ts +430 -0
- package/template/src/components/AppTable/engine/columns/config/columns.ts +33 -0
- package/template/src/components/AppTable/engine/columns/config/index.ts +4 -0
- package/template/src/components/AppTable/engine/columns/config/mutation.ts +138 -0
- package/template/src/components/AppTable/engine/columns/config/temporal.ts +11 -0
- package/template/src/components/AppTable/engine/columns/config/validation.ts +106 -0
- package/template/src/components/AppTable/engine/columns/constants.ts +6 -0
- package/template/src/components/AppTable/engine/columns/gridColumns.ts +332 -0
- package/template/src/components/AppTable/engine/columns/index.ts +4 -0
- package/template/src/components/AppTable/engine/columns/rendererPolicies.ts +129 -0
- package/template/src/components/AppTable/engine/component/resolver.ts +272 -0
- package/template/src/components/AppTable/engine/component/types.ts +384 -0
- package/template/src/components/AppTable/engine/config/constants.ts +33 -0
- package/template/src/components/AppTable/engine/config/grid/compiler.ts +65 -0
- package/template/src/components/AppTable/engine/config/grid/defaults.ts +82 -0
- package/template/src/components/AppTable/engine/config/grid/ownership.ts +35 -0
- package/template/src/components/AppTable/engine/config/grid/runtimeDelta.ts +34 -0
- package/template/src/components/AppTable/engine/config/grid/types.ts +30 -0
- package/template/src/components/AppTable/engine/pagination/config.ts +75 -0
- package/template/src/components/AppTable/engine/pagination/constants.ts +5 -0
- package/template/src/components/AppTable/engine/pagination/index.ts +3 -0
- package/template/src/components/AppTable/engine/pagination/types.ts +70 -0
- package/template/src/components/AppTable/engine/preference/index.ts +2 -0
- package/template/src/components/AppTable/engine/preference/preference.ts +535 -0
- package/template/src/components/AppTable/engine/preference/types.ts +28 -0
- package/template/src/components/AppTable/engine/right/index.ts +1 -0
- package/template/src/components/AppTable/engine/right/types.ts +18 -0
- package/template/src/components/AppTable/engine/search/config.ts +64 -0
- package/template/src/components/AppTable/engine/search/constants.ts +8 -0
- package/template/src/components/AppTable/engine/search/index.ts +7 -0
- package/template/src/components/AppTable/engine/search/localQuery.ts +145 -0
- package/template/src/components/AppTable/engine/search/query.ts +203 -0
- package/template/src/components/AppTable/engine/search/remoteQuery.ts +99 -0
- package/template/src/components/AppTable/engine/search/searchInteraction.ts +46 -0
- package/template/src/components/AppTable/engine/search/types.ts +155 -0
- package/template/src/components/AppTable/engine/selection/config.ts +13 -0
- package/template/src/components/AppTable/engine/selection/index.ts +4 -0
- package/template/src/components/AppTable/engine/selection/selection.ts +357 -0
- package/template/src/components/AppTable/engine/selection/selectionHeader.ts +88 -0
- package/template/src/components/AppTable/engine/selection/types.ts +66 -0
- package/template/src/components/AppTable/engine/shared/action.ts +11 -0
- package/template/src/components/AppTable/engine/shared/constants.ts +2 -0
- package/template/src/components/AppTable/engine/shared/decimal.ts +114 -0
- package/template/src/components/AppTable/engine/shared/feedback.ts +62 -0
- package/template/src/components/AppTable/engine/shared/index.ts +13 -0
- package/template/src/components/AppTable/engine/shared/interaction.ts +55 -0
- package/template/src/components/AppTable/engine/shared/messages.ts +161 -0
- package/template/src/components/AppTable/engine/shared/row.ts +32 -0
- package/template/src/components/AppTable/engine/shared/scheduler.ts +17 -0
- package/template/src/components/AppTable/engine/shared/tableKey.ts +31 -0
- package/template/src/components/AppTable/engine/shared/theme.ts +196 -0
- package/template/src/components/AppTable/engine/shared/treeRows.ts +155 -0
- package/template/src/components/AppTable/engine/shared/types.ts +58 -0
- package/template/src/components/AppTable/engine/shared/valueSnapshot.ts +46 -0
- package/template/src/components/AppTable/engine/summary/config/export.ts +117 -0
- package/template/src/components/AppTable/engine/summary/config/index.ts +3 -0
- package/template/src/components/AppTable/engine/summary/config/summary.ts +62 -0
- package/template/src/components/AppTable/engine/summary/config/types.ts +93 -0
- package/template/src/components/AppTable/engine/summary/constants.ts +13 -0
- package/template/src/components/AppTable/engine/summary/excelJs.ts +133 -0
- package/template/src/components/AppTable/engine/summary/export.ts +311 -0
- package/template/src/components/AppTable/engine/summary/index.ts +6 -0
- package/template/src/components/AppTable/engine/summary/selectionSum.ts +92 -0
- package/template/src/components/AppTable/engine/summary/summary.ts +457 -0
- package/template/src/components/AppTable/engine/table/clipboard/index.ts +1 -0
- package/template/src/components/AppTable/engine/table/clipboard/transfer.ts +9 -0
- package/template/src/components/AppTable/engine/table/controller/TableController.ts +802 -0
- package/template/src/components/AppTable/engine/table/controller/errors.ts +106 -0
- package/template/src/components/AppTable/engine/table/controller/index.ts +4 -0
- package/template/src/components/AppTable/engine/table/controller/latestAbortableTask.ts +33 -0
- package/template/src/components/AppTable/engine/table/controller/tableDataReplacement.ts +60 -0
- package/template/src/components/AppTable/engine/table/controller/tableDomainConfiguration.ts +94 -0
- package/template/src/components/AppTable/engine/table/controller/tableEditingCommands.ts +163 -0
- package/template/src/components/AppTable/engine/table/controller/tableGridHost.ts +324 -0
- package/template/src/components/AppTable/engine/table/controller/tableIdentity.ts +68 -0
- package/template/src/components/AppTable/engine/table/controller/tableMutationPipeline.ts +79 -0
- package/template/src/components/AppTable/engine/table/controller/tableQueryCoordinator.ts +187 -0
- package/template/src/components/AppTable/engine/table/controller/tableReportingCoordinator.ts +143 -0
- package/template/src/components/AppTable/engine/table/controller/tableSaveCoordinator.ts +227 -0
- package/template/src/components/AppTable/engine/table/controller/tableSaveValidation.ts +29 -0
- package/template/src/components/AppTable/engine/table/controller/tableSnapshot.ts +58 -0
- package/template/src/components/AppTable/engine/table/controller/types.ts +202 -0
- package/template/src/components/AppTable/engine/table/editing/baselineStore.ts +134 -0
- package/template/src/components/AppTable/engine/table/editing/changeSet.ts +492 -0
- package/template/src/components/AppTable/engine/table/editing/changeSetSettlement.ts +633 -0
- package/template/src/components/AppTable/engine/table/editing/commitResultIndex.ts +75 -0
- package/template/src/components/AppTable/engine/table/editing/constants.ts +15 -0
- package/template/src/components/AppTable/engine/table/editing/dirtyCellIndex.ts +96 -0
- package/template/src/components/AppTable/engine/table/editing/index.ts +6 -0
- package/template/src/components/AppTable/engine/table/editing/mutation.ts +173 -0
- package/template/src/components/AppTable/engine/table/editing/rowKey.ts +10 -0
- package/template/src/components/AppTable/engine/table/editing/types.ts +404 -0
- package/template/src/components/AppTable/engine/table/editing/validation.ts +452 -0
- package/template/src/components/AppTable/engine/table/grid/cellMeta.ts +90 -0
- package/template/src/components/AppTable/engine/table/grid/handsontable.ts +25 -0
- package/template/src/components/AppTable/engine/table/grid/handsontableExtensions.d.ts +26 -0
- package/template/src/components/AppTable/engine/table/grid/index.ts +5 -0
- package/template/src/components/AppTable/engine/table/grid/moduleRegistry.ts +39 -0
- package/template/src/components/AppTable/engine/table/grid/runtime.ts +31 -0
- package/template/src/components/AppTable/engine/table/grid/types.ts +25 -0
- package/template/src/components/AppTable/engine/table/hooks/fixedEndHooks.ts +44 -0
- package/template/src/components/AppTable/engine/table/hooks/gridHooks.ts +108 -0
- package/template/src/components/AppTable/engine/table/hooks/headerHooks.ts +103 -0
- package/template/src/components/AppTable/engine/table/hooks/index.ts +3 -0
- package/template/src/components/AppTable/engine/table/index.ts +6 -0
- package/template/src/components/AppTable/engine/table/layout/constants.ts +2 -0
- package/template/src/components/AppTable/engine/table/layout/dropdownMenu.ts +89 -0
- package/template/src/components/AppTable/engine/table/layout/fixedColumns.ts +44 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlay.ts +90 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlayAccessibility.ts +104 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlayRenderer.ts +690 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlaySignature.ts +58 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndRuntime.ts +137 -0
- package/template/src/components/AppTable/engine/table/layout/handsontableDomAdapter.ts +40 -0
- package/template/src/components/AppTable/engine/table/layout/height.ts +72 -0
- package/template/src/components/AppTable/engine/table/layout/index.ts +14 -0
- package/template/src/components/AppTable/engine/table/layout/layoutScheduler.ts +60 -0
- package/template/src/components/AppTable/engine/table/layout/mergeCells.ts +146 -0
- package/template/src/components/AppTable/engine/table/layout/nestedHeaders.ts +271 -0
- package/template/src/components/AppTable/engine/table/layout/types.ts +10 -0
- package/template/src/components/AppTable/engine/toolbar/index.ts +1 -0
- package/template/src/components/AppTable/engine/toolbar/types.ts +56 -0
- package/template/src/components/AppTable/index.ts +11 -0
- package/template/src/components/AppTable/messages.ts +256 -0
- package/template/src/components/AppTable/pagination/TablePaginationBar.tsx +193 -0
- package/template/src/components/AppTable/pagination/index.ts +1 -0
- package/template/src/components/AppTable/pagination/paginationItems.ts +56 -0
- package/template/src/components/AppTable/preference/index.ts +1 -0
- package/template/src/components/AppTable/preference/useTablePreference.ts +208 -0
- package/template/src/components/AppTable/reporting/index.ts +1 -0
- package/template/src/components/AppTable/reporting/useTableReporting.ts +342 -0
- package/template/src/components/AppTable/search/TableSearchBar.tsx +301 -0
- package/template/src/components/AppTable/search/TableSearchConditionEditor.tsx +254 -0
- package/template/src/components/AppTable/search/TableSearchField.tsx +338 -0
- package/template/src/components/AppTable/search/TableSearchFields.tsx +65 -0
- package/template/src/components/AppTable/search/constants.ts +9 -0
- package/template/src/components/AppTable/search/index.ts +3 -0
- package/template/src/components/AppTable/search/tableSearchBar.css +164 -0
- package/template/src/components/AppTable/search/types.ts +7 -0
- package/template/src/components/AppTable/search/useTableQuery.ts +373 -0
- package/template/src/components/AppTable/selection/index.ts +1 -0
- package/template/src/components/AppTable/selection/useTableSelection.ts +188 -0
- package/template/src/components/AppTable/sensitiveData.tsx +41 -0
- package/template/src/components/AppTable/shared/styles.ts +2 -0
- package/template/src/components/AppTable/styles/index.css +6 -0
- package/template/src/components/AppTable/styles/tableComponent.css +297 -0
- package/template/src/components/AppTable/styles/theme.css +133 -0
- package/template/src/components/AppTable/table/components/TableComponent.tsx +567 -0
- package/template/src/components/AppTable/table/components/TableErrorFeedback.tsx +36 -0
- package/template/src/components/AppTable/table/components/TableGridViewport.tsx +85 -0
- package/template/src/components/AppTable/table/components/index.ts +2 -0
- package/template/src/components/AppTable/table/components/types.ts +90 -0
- package/template/src/components/AppTable/table/controller/configuration.ts +89 -0
- package/template/src/components/AppTable/table/controller/index.ts +2 -0
- package/template/src/components/AppTable/table/controller/useTableController.ts +155 -0
- package/template/src/components/AppTable/table/controller/useTableLifecycle.ts +97 -0
- package/template/src/components/AppTable/table/grid/index.ts +1 -0
- package/template/src/components/AppTable/table/grid/useTableGrid.ts +857 -0
- package/template/src/components/AppTable/table/grid/useTableGridRuntimeSettings.ts +49 -0
- package/template/src/components/AppTable/table/index.ts +4 -0
- package/template/src/components/AppTable/table/layout/TablePanels.tsx +389 -0
- package/template/src/components/AppTable/table/layout/index.ts +7 -0
- package/template/src/components/AppTable/table/layout/types.ts +3 -0
- package/template/src/components/AppTable/table/layout/useResizablePanel.ts +213 -0
- package/template/src/components/AppTable/table/layout/useTableAdaptiveHeight.ts +238 -0
- package/template/src/components/AppTable/table/layout/useTablePanels.ts +329 -0
- package/template/src/components/AppTable/table/layout/useTableTheme.ts +123 -0
- package/template/src/components/AppTable/toolbar/TableToolbar.tsx +336 -0
- package/template/src/components/AppTable/toolbar/index.ts +1 -0
- package/template/src/components/BrandLogo/BrandLogo.tsx +41 -0
- package/template/src/components/BrandLogo/index.ts +1 -0
- package/template/src/components/Can/Can.tsx +19 -0
- package/template/src/components/Can/index.ts +7 -0
- package/template/src/components/Can/types.ts +41 -0
- package/template/src/components/EnumBadge/EnumBadge.tsx +44 -0
- package/template/src/components/EnumBadge/index.ts +2 -0
- package/template/src/components/EnumBadge/types.ts +16 -0
- package/template/src/components/EnumText/EnumText.tsx +33 -0
- package/template/src/components/EnumText/index.ts +2 -0
- package/template/src/components/EnumText/types.ts +13 -0
- package/template/src/components/FilePreview/FilePreview.tsx +120 -0
- package/template/src/components/FilePreview/index.ts +11 -0
- package/template/src/components/FilePreview/preview.ts +88 -0
- package/template/src/components/FilePreview/types.ts +91 -0
- package/template/src/components/FileUpload/FileUpload.tsx +172 -0
- package/template/src/components/FileUpload/index.ts +2 -0
- package/template/src/components/FileUpload/types.ts +32 -0
- package/template/src/components/JsonEditor/JsonEditor.tsx +103 -0
- package/template/src/components/JsonEditor/index.ts +1 -0
- package/template/src/components/JsonEditor/types.ts +14 -0
- package/template/src/components/PageFeedback/PageFeedback.tsx +194 -0
- package/template/src/components/PageFeedback/index.ts +10 -0
- package/template/src/components/PageFeedback/types.ts +31 -0
- package/template/src/components/PasswordInput/PasswordInput.tsx +50 -0
- package/template/src/components/PasswordInput/index.ts +1 -0
- package/template/src/components/RouteDialog/RouteDialog.tsx +20 -0
- package/template/src/components/RouteDialog/index.ts +2 -0
- package/template/src/components/RouteDialog/types.ts +8 -0
- package/template/src/components/RouteDialog/useRouteDialogNavigation.ts +30 -0
- package/template/src/components/SensitiveData/SensitiveData.tsx +337 -0
- package/template/src/components/SensitiveData/index.ts +2 -0
- package/template/src/components/SensitiveData/types.ts +31 -0
- package/template/src/components/StatusBadge/StatusBadge.tsx +28 -0
- package/template/src/components/StatusBadge/index.ts +2 -0
- package/template/src/components/StatusBadge/statusBadgeStyles.ts +30 -0
- package/template/src/components/StatusBadge/types.ts +7 -0
- package/template/src/components/layout/AppHeader/AppHeader.tsx +57 -0
- package/template/src/components/layout/AppHeader/HeaderSearch.tsx +160 -0
- package/template/src/components/layout/AppHeader/HeaderUserMenu.tsx +59 -0
- package/template/src/components/layout/AppHeader/ThemeControls.tsx +44 -0
- package/template/src/components/layout/AppHeader/index.ts +1 -0
- package/template/src/components/layout/AppHeader/themeOptions.ts +13 -0
- package/template/src/components/layout/AppSidebar.tsx +268 -0
- package/template/src/components/layout/PageContainer.tsx +16 -0
- package/template/src/components/ui/avatar.tsx +108 -0
- package/template/src/components/ui/badge.tsx +47 -0
- package/template/src/components/ui/button.tsx +63 -0
- package/template/src/components/ui/card.tsx +60 -0
- package/template/src/components/ui/checkbox.tsx +31 -0
- package/template/src/components/ui/collapsible.tsx +33 -0
- package/template/src/components/ui/command.tsx +181 -0
- package/template/src/components/ui/dialog.tsx +157 -0
- package/template/src/components/ui/dropdown-menu.tsx +254 -0
- package/template/src/components/ui/form.tsx +141 -0
- package/template/src/components/ui/input.tsx +20 -0
- package/template/src/components/ui/label.tsx +23 -0
- package/template/src/components/ui/pagination.tsx +127 -0
- package/template/src/components/ui/popover.tsx +41 -0
- package/template/src/components/ui/select.tsx +187 -0
- package/template/src/components/ui/separator.tsx +25 -0
- package/template/src/components/ui/sheet.tsx +142 -0
- package/template/src/components/ui/sidebar.tsx +878 -0
- package/template/src/components/ui/skeleton.tsx +13 -0
- package/template/src/components/ui/sonner.tsx +33 -0
- package/template/src/components/ui/tooltip.tsx +54 -0
- package/template/src/config/RuntimeConfigErrorPage.tsx +48 -0
- package/template/src/config/appConfig.ts +126 -0
- package/template/src/config/buildInfo.ts +8 -0
- package/template/src/config/observabilityAdapter.ts +8 -0
- package/template/src/config/runtimeConfig.ts +360 -0
- package/template/src/config/types.ts +195 -0
- package/template/src/context/ThemeProvider.tsx +84 -0
- package/template/src/context/UnsavedChangesProvider.tsx +123 -0
- package/template/src/context/applicationScope.ts +39 -0
- package/template/src/context/types.ts +41 -0
- package/template/src/dataMasking/index.ts +14 -0
- package/template/src/dataMasking/masking.ts +139 -0
- package/template/src/dataMasking/types.ts +144 -0
- package/template/src/featureFlags/FeatureFlagProvider.tsx +143 -0
- package/template/src/featureFlags/FeatureGate.tsx +12 -0
- package/template/src/featureFlags/catalog.ts +140 -0
- package/template/src/featureFlags/errors.ts +17 -0
- package/template/src/featureFlags/index.ts +43 -0
- package/template/src/featureFlags/query.ts +103 -0
- package/template/src/featureFlags/registry.ts +149 -0
- package/template/src/featureFlags/scope.ts +27 -0
- package/template/src/featureFlags/types.ts +241 -0
- package/template/src/features/auth/AuthLayout.tsx +17 -0
- package/template/src/features/auth/index.ts +2 -0
- package/template/src/features/auth/signIn/components/UserAuthForm.tsx +121 -0
- package/template/src/features/auth/signIn/index.tsx +71 -0
- package/template/src/features/auth/signIn/messages.ts +37 -0
- package/template/src/features/auth/signIn/types.ts +4 -0
- package/template/src/features/errors/ForbiddenError.tsx +34 -0
- package/template/src/features/errors/GeneralError.tsx +46 -0
- package/template/src/features/errors/MaintenanceError.tsx +31 -0
- package/template/src/features/errors/NotFoundError.tsx +34 -0
- package/template/src/features/errors/RouteError.tsx +72 -0
- package/template/src/features/errors/UnauthorizedError.tsx +34 -0
- package/template/src/features/errors/index.ts +6 -0
- package/template/src/features/errors/messages.ts +56 -0
- package/template/src/features/home/index.tsx +107 -0
- package/template/src/features/home/messages.ts +59 -0
- package/template/src/features/showcase/AccessShowcasePage.tsx +284 -0
- package/template/src/features/showcase/AdvancedTableDemo.tsx +120 -0
- package/template/src/features/showcase/FeedbackShowcasePage.tsx +142 -0
- package/template/src/features/showcase/FileShowcasePage.tsx +110 -0
- package/template/src/features/showcase/FormShowcasePage.tsx +156 -0
- package/template/src/features/showcase/MetadataShowcasePage.tsx +241 -0
- package/template/src/features/showcase/ShowcasePageHeader.tsx +24 -0
- package/template/src/features/showcase/TableShowcasePage.tsx +436 -0
- package/template/src/features/showcase/accessMessages.ts +67 -0
- package/template/src/features/showcase/index.ts +6 -0
- package/template/src/features/showcase/messages.ts +192 -0
- package/template/src/files/download.ts +82 -0
- package/template/src/files/errors.ts +15 -0
- package/template/src/files/filename.ts +61 -0
- package/template/src/files/index.ts +38 -0
- package/template/src/files/types.ts +299 -0
- package/template/src/files/useFileTask.ts +153 -0
- package/template/src/files/useFileUpload.ts +117 -0
- package/template/src/files/validation.ts +109 -0
- package/template/src/layouts/AppLayout.tsx +37 -0
- package/template/src/lib/accessControl.ts +42 -0
- package/template/src/lib/navigationRedirect.ts +26 -0
- package/template/src/lib/utils.ts +6 -0
- package/template/src/locale/LocaleProvider.tsx +37 -0
- package/template/src/locale/context.ts +15 -0
- package/template/src/locale/formatters.ts +123 -0
- package/template/src/locale/hooks.ts +35 -0
- package/template/src/locale/index.ts +17 -0
- package/template/src/locale/messages.ts +151 -0
- package/template/src/locale/types.ts +167 -0
- package/template/src/main.tsx +5 -0
- package/template/src/observability/browser.ts +37 -0
- package/template/src/observability/consoleAdapter.ts +18 -0
- package/template/src/observability/index.ts +26 -0
- package/template/src/observability/observer.ts +118 -0
- package/template/src/observability/redaction.ts +85 -0
- package/template/src/observability/types.ts +119 -0
- package/template/src/optionalEditors/controller.ts +327 -0
- package/template/src/optionalEditors/errors.ts +21 -0
- package/template/src/optionalEditors/index.ts +35 -0
- package/template/src/optionalEditors/model.ts +253 -0
- package/template/src/optionalEditors/react.ts +89 -0
- package/template/src/optionalEditors/types.ts +254 -0
- package/template/src/permissions/index.ts +3 -0
- package/template/src/permissions/types.ts +5 -0
- package/template/src/permissions/usePermission.ts +16 -0
- package/template/src/realtimeCollaboration/controller.ts +355 -0
- package/template/src/realtimeCollaboration/errors.ts +20 -0
- package/template/src/realtimeCollaboration/index.ts +39 -0
- package/template/src/realtimeCollaboration/model.ts +212 -0
- package/template/src/realtimeCollaboration/react.ts +72 -0
- package/template/src/realtimeCollaboration/types.ts +251 -0
- package/template/src/reporting/errors.ts +21 -0
- package/template/src/reporting/generation.ts +87 -0
- package/template/src/reporting/index.ts +42 -0
- package/template/src/reporting/model.ts +373 -0
- package/template/src/reporting/print.ts +16 -0
- package/template/src/reporting/query.ts +50 -0
- package/template/src/reporting/react.ts +17 -0
- package/template/src/reporting/source.ts +13 -0
- package/template/src/reporting/types.ts +219 -0
- package/template/src/router/RootRouteLayout.tsx +11 -0
- package/template/src/router/authLifecycle.ts +39 -0
- package/template/src/router/config.ts +293 -0
- package/template/src/router/interceptors.ts +48 -0
- package/template/src/router/lazyRouteComponents.ts +78 -0
- package/template/src/router/messages.ts +48 -0
- package/template/src/router/navigation.ts +167 -0
- package/template/src/router/router.ts +66 -0
- package/template/src/router/searchSchemas.ts +9 -0
- package/template/src/router/types.ts +76 -0
- package/template/src/stores/authSessionStorage.ts +27 -0
- package/template/src/stores/authStore.ts +165 -0
- package/template/src/stores/types.ts +36 -0
- package/template/src/stores/uiPreferenceStore.ts +34 -0
- package/template/src/styles/index.css +141 -0
- package/template/src/styles/theme.css +213 -0
- package/template/src/tenantWorkspace/TenantWorkspaceProvider.tsx +102 -0
- package/template/src/tenantWorkspace/index.ts +33 -0
- package/template/src/tenantWorkspace/store.ts +184 -0
- package/template/src/tenantWorkspace/switch.ts +206 -0
- package/template/src/tenantWorkspace/types.ts +155 -0
- package/template/src/vite-env.d.ts +20 -0
- package/template/stylelint.config.js +28 -0
- package/template/tests/integration/Application.test.tsx +269 -0
- package/template/tests/integration/layout/AppHeader.test.tsx +182 -0
- package/template/tests/integration/layout/AppSidebar.test.tsx +121 -0
- package/template/tests/integration/layout/__screenshots__/AppHeader.test.tsx/AppHeader-command-search-hides-the-duplicate-header-trigger-when-the-desktop-sidebar-collapses-1.png +0 -0
- package/template/tests/integration/router/__screenshots__/config.test.ts/route-tree-authentication-boundaries-exposes-only-scaffold-navigation-metadata-1.png +0 -0
- package/template/tests/integration/router/config.test.ts +123 -0
- package/template/tests/integration/router/interceptors.test.ts +100 -0
- package/template/tests/setup/accessibility.ts +25 -0
- package/template/tests/setup/runtimeConfig.ts +3 -0
- package/template/tests/unit/api/ApiError.test.ts +25 -0
- package/template/tests/unit/api/__screenshots__/authSession.test.ts/administrator-authentication-clears-the-session-if-a-refresh-identity-loses-administrator-access-1.png +0 -0
- package/template/tests/unit/api/__screenshots__/authSession.test.ts/administrator-authentication-creates-a-session-from-the-generated-login-response-for-an-admin-1.png +0 -0
- package/template/tests/unit/api/__screenshots__/authSession.test.ts/administrator-authentication-rejects-and-revokes-the-generated-login-result-for-an-ordinary-user-1.png +0 -0
- package/template/tests/unit/api/activity/ActivityProvider.test.tsx +131 -0
- package/template/tests/unit/api/activity/__screenshots__/transports.test.ts/activity-transport-adapters-polls-sequentially-and-advances-the-last-event-ID-1.png +0 -0
- package/template/tests/unit/api/activity/modelAndQuery.test.ts +144 -0
- package/template/tests/unit/api/activity/subscription.test.ts +103 -0
- package/template/tests/unit/api/activity/transports.test.ts +145 -0
- package/template/tests/unit/api/authClient.test.ts +110 -0
- package/template/tests/unit/api/authSession.test.ts +289 -0
- package/template/tests/unit/api/clients/configureApiClient.test.ts +198 -0
- package/template/tests/unit/api/demoAuthClient.test.ts +47 -0
- package/template/tests/unit/api/enums/access.test.ts +107 -0
- package/template/tests/unit/api/enums/catalog.test.ts +200 -0
- package/template/tests/unit/api/enums/query.test.ts +110 -0
- package/template/tests/unit/api/enums/useEnum.test.tsx +98 -0
- package/template/tests/unit/api/enums/useEnumCatalog.test.tsx +68 -0
- package/template/tests/unit/api/hooks/error.test.ts +168 -0
- package/template/tests/unit/api/hooks/request.test.ts +170 -0
- package/template/tests/unit/api/hooks/response.test.ts +46 -0
- package/template/tests/unit/api/metadata/MetadataProvider.test.tsx +102 -0
- package/template/tests/unit/api/parameters/catalog.test.ts +147 -0
- package/template/tests/unit/api/parameters/query.test.ts +78 -0
- package/template/tests/unit/api/parameters/useGlobalParameter.test.tsx +89 -0
- package/template/tests/unit/api/query/queryPolicy.test.ts +245 -0
- package/template/tests/unit/api/query/useAppQueryScope.test.tsx +74 -0
- package/template/tests/unit/auditLogs/auditLogHooks.test.tsx +194 -0
- package/template/tests/unit/auditLogs/auditLogs.test.ts +199 -0
- package/template/tests/unit/authentication/__screenshots__/authentication.test.ts/authentication-controller-completes-Step-up-callbacks-without-creating-a-second-login-result-1.png +0 -0
- package/template/tests/unit/authentication/__screenshots__/authentication.test.ts/authentication-controller-moves-from-challenge-to-completion-without-retaining-tokens-in-snapshot-1.png +0 -0
- package/template/tests/unit/authentication/authentication.test.ts +376 -0
- package/template/tests/unit/components/AppDialog.test.tsx +225 -0
- package/template/tests/unit/components/AppTable.test.tsx +129 -0
- package/template/tests/unit/components/AppTableLayoutTransition.test.ts +118 -0
- package/template/tests/unit/components/AppTableLocalization.test.ts +58 -0
- package/template/tests/unit/components/AppTableSensitiveData.test.ts +35 -0
- package/template/tests/unit/components/AppTableUpgrade.test.tsx +179 -0
- package/template/tests/unit/components/AppTableUpgradeCore.test.ts +258 -0
- package/template/tests/unit/components/BrandLogo.test.tsx +24 -0
- package/template/tests/unit/components/Can.test.tsx +80 -0
- package/template/tests/unit/components/Dialog.test.tsx +56 -0
- package/template/tests/unit/components/EnumPresentation.test.tsx +64 -0
- package/template/tests/unit/components/FilePreviewEngine.test.ts +51 -0
- package/template/tests/unit/components/JsonEditor.test.tsx +47 -0
- package/template/tests/unit/components/LocalizedSharedComponents.test.tsx +36 -0
- package/template/tests/unit/components/OverlayLayer.test.tsx +151 -0
- package/template/tests/unit/components/PageFeedback.test.tsx +143 -0
- package/template/tests/unit/components/PageForm.test.tsx +272 -0
- package/template/tests/unit/components/PageFormCore.test.ts +74 -0
- package/template/tests/unit/components/PasswordInput.test.tsx +105 -0
- package/template/tests/unit/components/ScaffoldComponents.test.tsx +64 -0
- package/template/tests/unit/components/SensitiveData.test.tsx +151 -0
- package/template/tests/unit/components/StatusBadge.test.tsx +36 -0
- package/template/tests/unit/components/TableComponent.test.tsx +644 -0
- package/template/tests/unit/components/TableCore.test.ts +145 -0
- package/template/tests/unit/components/ThemeAccessibility.test.tsx +27 -0
- package/template/tests/unit/components/__screenshots__/BatchOperationDialog.test.tsx/confirms-a-batch-action-and-presents-partial-failure-details-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/PageForm.test.tsx/PageForm-writes-uploaded-values-through-the-public-file-field-and-resets-dirty-state-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/PasswordInput.test.tsx/PasswordInput-toggles-the-password-visibility-when-the-show-password-button-is-clicked-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-pins-trailing-action-columns-and-removes-their-header-menu-by-default-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-renders-shadcn-components-through-cellComponent-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-renders-the-toolbar-without-a-bottom-divider-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-resyncs-adaptive-height-after-a-column-resize-changes-wrapped-row-height-1.png +0 -0
- package/template/tests/unit/config/RuntimeConfigErrorPage.test.tsx +23 -0
- package/template/tests/unit/config/appConfig.test.ts +98 -0
- package/template/tests/unit/config/appTableContracts.test.mjs +120 -0
- package/template/tests/unit/config/bundleBudget.test.mjs +190 -0
- package/template/tests/unit/config/componentGovernance.test.mjs +156 -0
- package/template/tests/unit/config/deployConfig.test.mjs +211 -0
- package/template/tests/unit/config/eslintConfig.test.mjs +101 -0
- package/template/tests/unit/config/featureBoundaries.test.mjs +126 -0
- package/template/tests/unit/config/npmPackage.test.mjs +37 -0
- package/template/tests/unit/config/releaseArtifact.test.mjs +105 -0
- package/template/tests/unit/config/runtimeConfig.test.ts +225 -0
- package/template/tests/unit/config/scaffoldCheck.test.mjs +53 -0
- package/template/tests/unit/config/scaffoldFeature.test.mjs +177 -0
- package/template/tests/unit/config/scaffoldInit.test.mjs +218 -0
- package/template/tests/unit/config/scaffoldProject.test.mjs +378 -0
- package/template/tests/unit/config/scaffoldTransaction.test.mjs +77 -0
- package/template/tests/unit/config/viteConfig.test.mjs +371 -0
- package/template/tests/unit/context/ThemeProvider.test.tsx +108 -0
- package/template/tests/unit/context/UnsavedChangesProvider.test.tsx +94 -0
- package/template/tests/unit/context/__screenshots__/ThemeProvider.test.tsx/ThemeProvider-uses-the-neutral-black-palette-for-the-app-and-scoped-table-theme-1.png +0 -0
- package/template/tests/unit/context/applicationScope.test.ts +62 -0
- package/template/tests/unit/dataMasking/dataMasking.test.ts +95 -0
- package/template/tests/unit/featureFlags/featureFlags.test.ts +169 -0
- package/template/tests/unit/featureFlags/useFeatureFlag.test.tsx +108 -0
- package/template/tests/unit/features/FeatureLocalization.test.tsx +54 -0
- package/template/tests/unit/features/RouteError.test.tsx +40 -0
- package/template/tests/unit/features/auth/signIn/UserAuthForm.test.tsx +79 -0
- package/template/tests/unit/features/auth/signIn/__screenshots__/UserAuthForm.test.tsx/UserAuthForm-passes-validated-values-to-onSubmit-1.png +0 -0
- package/template/tests/unit/features/auth/signIn/__screenshots__/UserAuthForm.test.tsx/UserAuthForm-shows-validation-messages-when-submitting-an-empty-form-1.png +0 -0
- package/template/tests/unit/files/fileHooks.test.tsx +130 -0
- package/template/tests/unit/files/files.test.ts +112 -0
- package/template/tests/unit/lib/accessControl.test.ts +69 -0
- package/template/tests/unit/locale/locale.test.tsx +90 -0
- package/template/tests/unit/observability/browser.test.ts +48 -0
- package/template/tests/unit/observability/observer.test.ts +115 -0
- package/template/tests/unit/optionalEditors/__screenshots__/useOptionalEditor.test.tsx/useOptionalEditor-fails-permission-precheck-before-loading-the-project-SDK-1.png +0 -0
- package/template/tests/unit/optionalEditors/__screenshots__/useOptionalEditor.test.tsx/useOptionalEditor-mounts-a-route-scoped-SDK-into-the-dedicated-host-with-permission-1.png +0 -0
- package/template/tests/unit/optionalEditors/optionalEditors.test.ts +313 -0
- package/template/tests/unit/optionalEditors/useOptionalEditor.test.tsx +141 -0
- package/template/tests/unit/realtimeCollaboration/collaboration.test.ts +240 -0
- package/template/tests/unit/realtimeCollaboration/useRealtimeCollaboration.test.tsx +115 -0
- package/template/tests/unit/reporting/reporting.test.ts +195 -0
- package/template/tests/unit/reporting/reportingHooks.test.tsx +203 -0
- package/template/tests/unit/router/authLifecycle.test.ts +55 -0
- package/template/tests/unit/router/navigation.test.ts +55 -0
- package/template/tests/unit/router/redirects.test.ts +22 -0
- package/template/tests/unit/scaffoldFeatureTemplate/featureTemplate.test.ts +42 -0
- package/template/tests/unit/scaffoldFeatureTemplate/publicContract.test.ts +28 -0
- package/template/tests/unit/scaffoldFeatureTemplate/queries.test.tsx +289 -0
- package/template/tests/unit/stores/authStore.test.ts +128 -0
- package/template/tests/unit/stores/uiPreferenceStore.test.ts +56 -0
- package/template/tests/unit/tenantWorkspace/tenantWorkspace.test.tsx +261 -0
- package/template/tools/bundle/budgets.json +48 -0
- package/template/tools/bundle/check.mjs +307 -0
- package/template/tools/component-governance/check.mjs +703 -0
- package/template/tools/component-governance/manifest.json +112 -0
- package/template/tools/deployment/browser-smoke.mjs +76 -0
- package/template/tools/deployment/browser-smoke.sh +141 -0
- package/template/tools/openapi/generate.mjs +268 -0
- package/template/tools/openapi/templates/README.md +14 -0
- package/template/tools/openapi/templates/base/README.md +7 -0
- package/template/tools/openapi/templates/base/data-contracts.eta +44 -0
- package/template/tools/openapi/templates/base/http-client.eta +3 -0
- package/template/tools/openapi/templates/base/http-clients/axios-http-client.eta +132 -0
- package/template/tools/openapi/templates/base/http-clients/fetch-http-client.eta +220 -0
- package/template/tools/openapi/templates/base/route-docs.eta +31 -0
- package/template/tools/openapi/templates/base/route-name.eta +43 -0
- package/template/tools/openapi/templates/base/route-type.eta +22 -0
- package/template/tools/openapi/templates/default/README.md +7 -0
- package/template/tools/openapi/templates/default/api.eta +67 -0
- package/template/tools/openapi/templates/default/http-client.eta +137 -0
- package/template/tools/openapi/templates/default/procedure-call.eta +99 -0
- package/template/tools/openapi/templates/default/route-docs.eta +40 -0
- package/template/tools/openapi/templates/default/route-types.eta +28 -0
- package/template/tools/openapi/templates/modular/README.md +7 -0
- package/template/tools/openapi/templates/modular/api.eta +28 -0
- package/template/tools/openapi/templates/modular/procedure-call.eta +99 -0
- package/template/tools/openapi/templates/modular/route-types.eta +18 -0
- package/template/tools/release/artifact.mjs +258 -0
- package/template/tools/scaffold/add-capability.mjs +409 -0
- package/template/tools/scaffold/capability-catalog.json +163 -0
- package/template/tools/scaffold/check.mjs +326 -0
- package/template/tools/scaffold/create-feature.mjs +444 -0
- package/template/tools/scaffold/create-project.mjs +482 -0
- package/template/tools/scaffold/init.example.json +64 -0
- package/template/tools/scaffold/init.mjs +419 -0
- package/template/tools/scaffold/lockfile.mjs +193 -0
- package/template/tools/scaffold/templates/feature/index.ts +19 -0
- package/template/tools/scaffold/templates/feature/model.ts +142 -0
- package/template/tools/scaffold/templates/feature/queries.ts +154 -0
- package/template/tools/scaffold/templates/feature/repository.ts +206 -0
- package/template/tools/scaffold/templates/feature/types.ts +168 -0
- package/template/tools/scaffold/workspace-transaction.mjs +111 -0
- package/template/tsconfig.app.json +31 -0
- package/template/tsconfig.json +12 -0
- package/template/tsconfig.node.json +24 -0
- package/template/vite.config.ts +121 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { ActivityError } from './errors'
|
|
2
|
+
import type {
|
|
3
|
+
IActivityTransportAdapter,
|
|
4
|
+
IActivityTransportConnectContext,
|
|
5
|
+
ICreatePollingActivityTransportOptions,
|
|
6
|
+
ICreateSseActivityTransportOptions,
|
|
7
|
+
ICreateWebSocketActivityTransportOptions,
|
|
8
|
+
TActivityEventInput,
|
|
9
|
+
} from './types'
|
|
10
|
+
|
|
11
|
+
const nDefaultConnectTimeoutMs = 10_000
|
|
12
|
+
|
|
13
|
+
function fnValidatePositiveDuration(nValue: number, strField: string) {
|
|
14
|
+
if (!Number.isFinite(nValue) || nValue <= 0) {
|
|
15
|
+
throw new ActivityError(
|
|
16
|
+
'INVALID_TRANSPORT_CONFIG',
|
|
17
|
+
`${strField} 必须是大于 0 的有限毫秒数。`
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
return nValue
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function fnCreateAbortError() {
|
|
24
|
+
return new DOMException('活动连接已取消。', 'AbortError')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** 使用生成客户端创建顺序执行、不会请求重叠的轮询 Adapter。 */
|
|
28
|
+
export function fnCreatePollingActivityTransport({
|
|
29
|
+
fnPoll,
|
|
30
|
+
nIntervalMs: nIntervalInput = 30_000,
|
|
31
|
+
}: ICreatePollingActivityTransportOptions): IActivityTransportAdapter {
|
|
32
|
+
const nIntervalMs = fnValidatePositiveDuration(nIntervalInput, 'nIntervalMs')
|
|
33
|
+
return Object.freeze({
|
|
34
|
+
strTransport: 'polling' as const,
|
|
35
|
+
fnConnect: async (objContext: IActivityTransportConnectContext) => {
|
|
36
|
+
let bIsClosed = false
|
|
37
|
+
let nTimer: ReturnType<typeof setTimeout> | undefined
|
|
38
|
+
let strLastEventId = objContext.strLastEventId
|
|
39
|
+
const fnClose = () => {
|
|
40
|
+
bIsClosed = true
|
|
41
|
+
if (nTimer !== undefined) clearTimeout(nTimer)
|
|
42
|
+
nTimer = undefined
|
|
43
|
+
}
|
|
44
|
+
const fnPollOnce = async () => {
|
|
45
|
+
const objEvents = await fnPoll({
|
|
46
|
+
objScope: objContext.objScope,
|
|
47
|
+
objSignal: objContext.objSignal,
|
|
48
|
+
...(strLastEventId ? { strLastEventId } : {}),
|
|
49
|
+
})
|
|
50
|
+
if (bIsClosed || objContext.objSignal.aborted) return
|
|
51
|
+
objContext.fnOnEvent(objEvents)
|
|
52
|
+
const arrEvents = Array.isArray(objEvents) ? objEvents : [objEvents]
|
|
53
|
+
strLastEventId = arrEvents.at(-1)?.strEventId ?? strLastEventId
|
|
54
|
+
}
|
|
55
|
+
const fnScheduleNextPoll = () => {
|
|
56
|
+
if (bIsClosed || objContext.objSignal.aborted) return
|
|
57
|
+
nTimer = setTimeout(() => {
|
|
58
|
+
void fnPollOnce()
|
|
59
|
+
.then(fnScheduleNextPoll)
|
|
60
|
+
.catch((objCaughtError) => {
|
|
61
|
+
if (!bIsClosed && !objContext.objSignal.aborted) {
|
|
62
|
+
objContext.fnOnDisconnect(
|
|
63
|
+
objCaughtError instanceof Error
|
|
64
|
+
? objCaughtError
|
|
65
|
+
: new Error('轮询请求抛出了非标准错误。', {
|
|
66
|
+
cause: objCaughtError,
|
|
67
|
+
})
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
}, nIntervalMs)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
objContext.objSignal.addEventListener('abort', fnClose, { once: true })
|
|
75
|
+
await fnPollOnce()
|
|
76
|
+
if (bIsClosed || objContext.objSignal.aborted) throw fnCreateAbortError()
|
|
77
|
+
fnScheduleNextPoll()
|
|
78
|
+
return Object.freeze({ fnClose })
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function fnCreateTextStreamConnection(
|
|
84
|
+
objContext: IActivityTransportConnectContext,
|
|
85
|
+
{
|
|
86
|
+
fnCloseStream,
|
|
87
|
+
fnParseMessage,
|
|
88
|
+
fnSetHandlers,
|
|
89
|
+
nConnectTimeoutMs,
|
|
90
|
+
strTransport,
|
|
91
|
+
}: {
|
|
92
|
+
fnCloseStream: () => void
|
|
93
|
+
fnParseMessage: (
|
|
94
|
+
strData: string
|
|
95
|
+
) => TActivityEventInput | readonly TActivityEventInput[]
|
|
96
|
+
fnSetHandlers: (objHandlers: {
|
|
97
|
+
fnOnClose: (objError: Error) => void
|
|
98
|
+
fnOnError: () => void
|
|
99
|
+
fnOnMessage: (strData: string) => void
|
|
100
|
+
fnOnOpen: () => void
|
|
101
|
+
}) => void
|
|
102
|
+
nConnectTimeoutMs: number
|
|
103
|
+
strTransport: 'sse' | 'websocket'
|
|
104
|
+
}
|
|
105
|
+
) {
|
|
106
|
+
return new Promise<{ readonly fnClose: () => void }>(
|
|
107
|
+
(fnResolve, fnReject) => {
|
|
108
|
+
let bIsClosed = false
|
|
109
|
+
let bIsOpen = false
|
|
110
|
+
const nTimeout = setTimeout(() => {
|
|
111
|
+
if (bIsClosed || bIsOpen) return
|
|
112
|
+
fnClose()
|
|
113
|
+
fnReject(
|
|
114
|
+
new ActivityError(
|
|
115
|
+
'TRANSPORT_DISCONNECTED',
|
|
116
|
+
`${strTransport.toUpperCase()} 首次连接超时。`
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
}, nConnectTimeoutMs)
|
|
120
|
+
const fnClose = () => {
|
|
121
|
+
if (bIsClosed) return
|
|
122
|
+
bIsClosed = true
|
|
123
|
+
clearTimeout(nTimeout)
|
|
124
|
+
fnCloseStream()
|
|
125
|
+
}
|
|
126
|
+
const fnFail = (objError: Error) => {
|
|
127
|
+
if (bIsClosed || objContext.objSignal.aborted) return
|
|
128
|
+
if (!bIsOpen) {
|
|
129
|
+
fnClose()
|
|
130
|
+
fnReject(objError)
|
|
131
|
+
} else {
|
|
132
|
+
fnClose()
|
|
133
|
+
objContext.fnOnDisconnect(objError)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
objContext.objSignal.addEventListener(
|
|
138
|
+
'abort',
|
|
139
|
+
() => {
|
|
140
|
+
const bWasOpen = bIsOpen
|
|
141
|
+
fnClose()
|
|
142
|
+
if (!bWasOpen) fnReject(fnCreateAbortError())
|
|
143
|
+
},
|
|
144
|
+
{ once: true }
|
|
145
|
+
)
|
|
146
|
+
fnSetHandlers({
|
|
147
|
+
fnOnClose: fnFail,
|
|
148
|
+
fnOnError: () =>
|
|
149
|
+
fnFail(
|
|
150
|
+
new ActivityError(
|
|
151
|
+
'TRANSPORT_DISCONNECTED',
|
|
152
|
+
`${strTransport.toUpperCase()} 连接发生错误。`
|
|
153
|
+
)
|
|
154
|
+
),
|
|
155
|
+
fnOnMessage: (strData) => {
|
|
156
|
+
if (bIsClosed || objContext.objSignal.aborted) return
|
|
157
|
+
try {
|
|
158
|
+
if (typeof strData !== 'string') {
|
|
159
|
+
throw new ActivityError(
|
|
160
|
+
'INVALID_EVENT',
|
|
161
|
+
'实时活动传输只接受 UTF-8 文本消息。'
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
objContext.fnOnEvent(fnParseMessage(strData))
|
|
165
|
+
} catch (objCaughtError) {
|
|
166
|
+
fnFail(
|
|
167
|
+
objCaughtError instanceof Error
|
|
168
|
+
? objCaughtError
|
|
169
|
+
: new ActivityError(
|
|
170
|
+
'INVALID_EVENT',
|
|
171
|
+
'实时消息解析器抛出了非标准错误。',
|
|
172
|
+
{ cause: objCaughtError }
|
|
173
|
+
)
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
fnOnOpen: () => {
|
|
178
|
+
if (bIsClosed || objContext.objSignal.aborted) return
|
|
179
|
+
bIsOpen = true
|
|
180
|
+
clearTimeout(nTimeout)
|
|
181
|
+
fnResolve(Object.freeze({ fnClose }))
|
|
182
|
+
},
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** 创建由统一控制器接管重连的 SSE Adapter。 */
|
|
189
|
+
export function fnCreateSseActivityTransport({
|
|
190
|
+
fnCreateEventSource,
|
|
191
|
+
fnParseMessage,
|
|
192
|
+
nConnectTimeoutMs: nConnectTimeoutInput = nDefaultConnectTimeoutMs,
|
|
193
|
+
}: ICreateSseActivityTransportOptions): IActivityTransportAdapter {
|
|
194
|
+
const nConnectTimeoutMs = fnValidatePositiveDuration(
|
|
195
|
+
nConnectTimeoutInput,
|
|
196
|
+
'nConnectTimeoutMs'
|
|
197
|
+
)
|
|
198
|
+
return Object.freeze({
|
|
199
|
+
strTransport: 'sse' as const,
|
|
200
|
+
fnConnect: async (objContext: IActivityTransportConnectContext) => {
|
|
201
|
+
const objEventSource = await fnCreateEventSource({
|
|
202
|
+
objScope: objContext.objScope,
|
|
203
|
+
objSignal: objContext.objSignal,
|
|
204
|
+
...(objContext.strLastEventId
|
|
205
|
+
? { strLastEventId: objContext.strLastEventId }
|
|
206
|
+
: {}),
|
|
207
|
+
})
|
|
208
|
+
if (objContext.objSignal.aborted) {
|
|
209
|
+
objEventSource.close()
|
|
210
|
+
throw fnCreateAbortError()
|
|
211
|
+
}
|
|
212
|
+
return fnCreateTextStreamConnection(objContext, {
|
|
213
|
+
fnCloseStream: () => objEventSource.close(),
|
|
214
|
+
fnParseMessage,
|
|
215
|
+
fnSetHandlers: ({ fnOnError, fnOnMessage, fnOnOpen }) => {
|
|
216
|
+
objEventSource.onerror = fnOnError
|
|
217
|
+
objEventSource.onmessage = (objEvent) => fnOnMessage(objEvent.data)
|
|
218
|
+
objEventSource.onopen = fnOnOpen
|
|
219
|
+
},
|
|
220
|
+
nConnectTimeoutMs,
|
|
221
|
+
strTransport: 'sse',
|
|
222
|
+
})
|
|
223
|
+
},
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** 创建由统一控制器接管重连的 WebSocket Adapter。 */
|
|
228
|
+
export function fnCreateWebSocketActivityTransport({
|
|
229
|
+
fnCreateWebSocket,
|
|
230
|
+
fnParseMessage,
|
|
231
|
+
nConnectTimeoutMs: nConnectTimeoutInput = nDefaultConnectTimeoutMs,
|
|
232
|
+
}: ICreateWebSocketActivityTransportOptions): IActivityTransportAdapter {
|
|
233
|
+
const nConnectTimeoutMs = fnValidatePositiveDuration(
|
|
234
|
+
nConnectTimeoutInput,
|
|
235
|
+
'nConnectTimeoutMs'
|
|
236
|
+
)
|
|
237
|
+
return Object.freeze({
|
|
238
|
+
strTransport: 'websocket' as const,
|
|
239
|
+
fnConnect: async (objContext: IActivityTransportConnectContext) => {
|
|
240
|
+
const objWebSocket = await fnCreateWebSocket({
|
|
241
|
+
objScope: objContext.objScope,
|
|
242
|
+
objSignal: objContext.objSignal,
|
|
243
|
+
...(objContext.strLastEventId
|
|
244
|
+
? { strLastEventId: objContext.strLastEventId }
|
|
245
|
+
: {}),
|
|
246
|
+
})
|
|
247
|
+
if (objContext.objSignal.aborted) {
|
|
248
|
+
objWebSocket.close()
|
|
249
|
+
throw fnCreateAbortError()
|
|
250
|
+
}
|
|
251
|
+
return fnCreateTextStreamConnection(objContext, {
|
|
252
|
+
fnCloseStream: () => objWebSocket.close(),
|
|
253
|
+
fnParseMessage,
|
|
254
|
+
fnSetHandlers: ({ fnOnClose, fnOnError, fnOnMessage, fnOnOpen }) => {
|
|
255
|
+
objWebSocket.onclose = (objEvent) =>
|
|
256
|
+
fnOnClose(
|
|
257
|
+
new ActivityError(
|
|
258
|
+
'TRANSPORT_DISCONNECTED',
|
|
259
|
+
`WebSocket 连接已关闭(${objEvent.code})。`
|
|
260
|
+
)
|
|
261
|
+
)
|
|
262
|
+
objWebSocket.onerror = fnOnError
|
|
263
|
+
objWebSocket.onmessage = (objEvent) => fnOnMessage(objEvent.data)
|
|
264
|
+
objWebSocket.onopen = fnOnOpen
|
|
265
|
+
},
|
|
266
|
+
nConnectTimeoutMs,
|
|
267
|
+
strTransport: 'websocket',
|
|
268
|
+
})
|
|
269
|
+
},
|
|
270
|
+
})
|
|
271
|
+
}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import type { IAppQueryScope } from '@/api/query/types'
|
|
3
|
+
import type { ActivityError } from './errors'
|
|
4
|
+
|
|
5
|
+
/** 脚手架统一支持的后台异步任务状态。 */
|
|
6
|
+
export type TActivityTaskState =
|
|
7
|
+
| 'queued'
|
|
8
|
+
| 'running'
|
|
9
|
+
| 'succeeded'
|
|
10
|
+
| 'failed'
|
|
11
|
+
| 'cancelled'
|
|
12
|
+
|
|
13
|
+
/** 后端活动快照中的任务状态输入。 */
|
|
14
|
+
export interface IActivityTaskStatusInput {
|
|
15
|
+
/** 后端任务的稳定唯一标识。 */
|
|
16
|
+
readonly strTaskId: string
|
|
17
|
+
/** 经项目 Adapter 映射后的通用任务状态。 */
|
|
18
|
+
readonly strState: TActivityTaskState
|
|
19
|
+
/** 任务最近一次变化的 ISO 8601 时间。 */
|
|
20
|
+
readonly strUpdatedAt: string
|
|
21
|
+
/** 已完成百分比,取值为 0 至 100;后端未知时省略。 */
|
|
22
|
+
readonly nProgressPercent?: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** 经校验、标准化和冻结后可进入 Query 缓存的任务状态。 */
|
|
26
|
+
export interface IActivityTaskStatus {
|
|
27
|
+
/** 后端任务的稳定唯一标识。 */
|
|
28
|
+
readonly strTaskId: string
|
|
29
|
+
/** 经项目 Adapter 映射后的通用任务状态。 */
|
|
30
|
+
readonly strState: TActivityTaskState
|
|
31
|
+
/** 标准化后的 ISO 8601 更新时间。 */
|
|
32
|
+
readonly strUpdatedAt: string
|
|
33
|
+
/** 已完成百分比,取值为 0 至 100;后端未知时省略。 */
|
|
34
|
+
readonly nProgressPercent?: number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** 项目 Adapter 返回的活动快照输入。 */
|
|
38
|
+
export interface IActivitySnapshotInput {
|
|
39
|
+
/** 当前作用域内尚未读取的通知数量。 */
|
|
40
|
+
readonly nUnreadCount: number
|
|
41
|
+
/** 当前用户近期关注的异步任务状态,最多 100 条。 */
|
|
42
|
+
readonly arrTaskStatuses: readonly IActivityTaskStatusInput[]
|
|
43
|
+
/** 后端快照版本,用于诊断和刷新确认。 */
|
|
44
|
+
readonly strVersion: string
|
|
45
|
+
/** 快照已经包含的最后一个实时事件 ID。 */
|
|
46
|
+
readonly strLastEventId?: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** TanStack Query 持有的完整活动快照。 */
|
|
50
|
+
export interface IActivitySnapshot {
|
|
51
|
+
/** 当前作用域内尚未读取的通知数量。 */
|
|
52
|
+
readonly nUnreadCount: number
|
|
53
|
+
/** 已按更新时间倒序排列的近期异步任务状态。 */
|
|
54
|
+
readonly arrTaskStatuses: readonly IActivityTaskStatus[]
|
|
55
|
+
/** 后端快照版本,用于诊断和刷新确认。 */
|
|
56
|
+
readonly strVersion: string
|
|
57
|
+
/** 快照或增量更新已经应用的最后一个事件 ID。 */
|
|
58
|
+
readonly strLastEventId?: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** 活动快照数据源的请求上下文。 */
|
|
62
|
+
export interface IActivitySnapshotRequestContext {
|
|
63
|
+
/** 用户、租户、工作空间、语言和会话组成的缓存作用域。 */
|
|
64
|
+
readonly objScope: IAppQueryScope
|
|
65
|
+
/** Query 取消、切换身份或卸载时触发的请求取消信号。 */
|
|
66
|
+
readonly objSignal: AbortSignal
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** 使用 Swagger 生成客户端加载活动快照的数据源。 */
|
|
70
|
+
export interface IActivitySource {
|
|
71
|
+
/** 返回当前作用域的完整未读数和近期任务状态。 */
|
|
72
|
+
readonly fnLoadSnapshot: (
|
|
73
|
+
objContext: IActivitySnapshotRequestContext
|
|
74
|
+
) => Promise<IActivitySnapshot>
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** 项目生成客户端请求函数的最小适配契约。 */
|
|
78
|
+
export type TActivitySnapshotRequest = (
|
|
79
|
+
objContext: IActivitySnapshotRequestContext
|
|
80
|
+
) => Promise<IActivitySnapshotInput>
|
|
81
|
+
|
|
82
|
+
/** 所有实时活动事件共有的稳定字段。 */
|
|
83
|
+
export interface IActivityEventBase {
|
|
84
|
+
/** 后端生成的稳定事件 ID,用于断线续传。 */
|
|
85
|
+
readonly strEventId: string
|
|
86
|
+
/** 事件在后端发生的 ISO 8601 时间。 */
|
|
87
|
+
readonly strOccurredAt: string
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** 用完整服务端快照替换当前缓存。 */
|
|
91
|
+
export interface IActivitySnapshotReplacedEventInput extends IActivityEventBase {
|
|
92
|
+
/** 可判别的事件类型。 */
|
|
93
|
+
readonly strType: 'snapshot-replaced'
|
|
94
|
+
/** 已包含该事件及更早变化的完整快照。 */
|
|
95
|
+
readonly objSnapshot: IActivitySnapshotInput
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** 当前作用域未读数量发生变化。 */
|
|
99
|
+
export interface IActivityUnreadCountChangedEventInput extends IActivityEventBase {
|
|
100
|
+
/** 可判别的事件类型。 */
|
|
101
|
+
readonly strType: 'unread-count-changed'
|
|
102
|
+
/** 后端确认的最新未读总数,不是增量。 */
|
|
103
|
+
readonly nUnreadCount: number
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** 一个后台异步任务的状态发生变化。 */
|
|
107
|
+
export interface IActivityTaskStatusChangedEventInput extends IActivityEventBase {
|
|
108
|
+
/** 可判别的事件类型。 */
|
|
109
|
+
readonly strType: 'task-status-changed'
|
|
110
|
+
/** 后端确认的该任务最新状态。 */
|
|
111
|
+
readonly objTaskStatus: IActivityTaskStatusInput
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** 服务端要求客户端重新获取完整活动快照。 */
|
|
115
|
+
export interface IActivitySnapshotInvalidatedEventInput extends IActivityEventBase {
|
|
116
|
+
/** 可判别的事件类型。 */
|
|
117
|
+
readonly strType: 'snapshot-invalidated'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** 传输 Adapter 可以交给基础设施的活动事件输入。 */
|
|
121
|
+
export type TActivityEventInput =
|
|
122
|
+
| IActivitySnapshotReplacedEventInput
|
|
123
|
+
| IActivityUnreadCountChangedEventInput
|
|
124
|
+
| IActivityTaskStatusChangedEventInput
|
|
125
|
+
| IActivitySnapshotInvalidatedEventInput
|
|
126
|
+
|
|
127
|
+
/** 经运行时校验后可以更新 Query 缓存的活动事件。 */
|
|
128
|
+
export type TActivityEvent =
|
|
129
|
+
| (IActivityEventBase & {
|
|
130
|
+
readonly strType: 'snapshot-replaced'
|
|
131
|
+
readonly objSnapshot: IActivitySnapshot
|
|
132
|
+
})
|
|
133
|
+
| IActivityUnreadCountChangedEventInput
|
|
134
|
+
| (IActivityEventBase & {
|
|
135
|
+
readonly strType: 'task-status-changed'
|
|
136
|
+
readonly objTaskStatus: IActivityTaskStatus
|
|
137
|
+
})
|
|
138
|
+
| IActivitySnapshotInvalidatedEventInput
|
|
139
|
+
|
|
140
|
+
/** 一次活动传输连接的关闭能力。 */
|
|
141
|
+
export interface IActivityTransportConnection {
|
|
142
|
+
/** 关闭底层轮询计时器、EventSource 或 WebSocket。 */
|
|
143
|
+
readonly fnClose: () => void
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** 传输 Adapter 建立连接时获得的作用域和回调。 */
|
|
147
|
+
export interface IActivityTransportConnectContext {
|
|
148
|
+
/** 当前用户、租户、工作空间、语言和会话作用域。 */
|
|
149
|
+
readonly objScope: IAppQueryScope
|
|
150
|
+
/** 关闭 Provider、切换作用域或开始新连接时触发。 */
|
|
151
|
+
readonly objSignal: AbortSignal
|
|
152
|
+
/** 断线续传时交给后端的最后事件 ID。 */
|
|
153
|
+
readonly strLastEventId?: string
|
|
154
|
+
/** 向快照缓存提交一个或多个事件。 */
|
|
155
|
+
readonly fnOnEvent: (
|
|
156
|
+
objEvent: TActivityEventInput | readonly TActivityEventInput[]
|
|
157
|
+
) => void
|
|
158
|
+
/** 非主动关闭导致连接失效时通知重连控制器。 */
|
|
159
|
+
readonly fnOnDisconnect: (objError: Error) => void
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** 轮询、SSE 和 WebSocket 共用的传输 Adapter。 */
|
|
163
|
+
export interface IActivityTransportAdapter {
|
|
164
|
+
/** 用于诊断和状态展示的底层传输类型。 */
|
|
165
|
+
readonly strTransport: TActivityTransport
|
|
166
|
+
/** 建立一个可关闭连接;首次握手失败时拒绝 Promise。 */
|
|
167
|
+
readonly fnConnect: (
|
|
168
|
+
objContext: IActivityTransportConnectContext
|
|
169
|
+
) => Promise<IActivityTransportConnection>
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** 脚手架内建的活动传输类型。 */
|
|
173
|
+
export type TActivityTransport = 'polling' | 'sse' | 'websocket'
|
|
174
|
+
|
|
175
|
+
/** 连接重试的指数退避配置。 */
|
|
176
|
+
export interface IActivityReconnectPolicy {
|
|
177
|
+
/** 第一次自动重连前的等待毫秒数。 */
|
|
178
|
+
readonly nInitialDelayMs?: number
|
|
179
|
+
/** 自动重连等待的毫秒上限。 */
|
|
180
|
+
readonly nMaxDelayMs?: number
|
|
181
|
+
/** 每次连续失败后的等待倍数。 */
|
|
182
|
+
readonly nMultiplier?: number
|
|
183
|
+
/** 随机抖动比例,取值为 0 至 1。 */
|
|
184
|
+
readonly nJitterRatio?: number
|
|
185
|
+
/** 连续连接失败上限;省略表示持续退避重连。 */
|
|
186
|
+
readonly nMaxAttempts?: number
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** 尚未启动或已经主动停止实时连接。 */
|
|
190
|
+
export interface IActivityIdleConnectionState {
|
|
191
|
+
/** 可判别的空闲状态。 */
|
|
192
|
+
readonly strStatus: 'idle'
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** 正在进行首次连接或手动重连。 */
|
|
196
|
+
export interface IActivityConnectingState {
|
|
197
|
+
/** 可判别的连接中状态。 */
|
|
198
|
+
readonly strStatus: 'connecting'
|
|
199
|
+
/** 当前使用的传输类型。 */
|
|
200
|
+
readonly strTransport: TActivityTransport
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** 实时连接已经建立。 */
|
|
204
|
+
export interface IActivityConnectedState {
|
|
205
|
+
/** 可判别的已连接状态。 */
|
|
206
|
+
readonly strStatus: 'connected'
|
|
207
|
+
/** 当前使用的传输类型。 */
|
|
208
|
+
readonly strTransport: TActivityTransport
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** 连接中断并等待自动重连。 */
|
|
212
|
+
export interface IActivityReconnectingState {
|
|
213
|
+
/** 可判别的重连等待状态。 */
|
|
214
|
+
readonly strStatus: 'reconnecting'
|
|
215
|
+
/** 当前使用的传输类型。 */
|
|
216
|
+
readonly strTransport: TActivityTransport
|
|
217
|
+
/** 当前连续重连轮次,从 1 开始。 */
|
|
218
|
+
readonly nAttempt: number
|
|
219
|
+
/** 下一次重连计划执行的毫秒时间戳。 */
|
|
220
|
+
readonly nRetryAt: number
|
|
221
|
+
/** 最近一次连接失败的安全错误。 */
|
|
222
|
+
readonly objError: ActivityError
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** 连续连接失败达到项目配置的上限。 */
|
|
226
|
+
export interface IActivityConnectionErrorState {
|
|
227
|
+
/** 可判别的最终错误状态。 */
|
|
228
|
+
readonly strStatus: 'error'
|
|
229
|
+
/** 当前使用的传输类型。 */
|
|
230
|
+
readonly strTransport: TActivityTransport
|
|
231
|
+
/** 已归一化的最终连接错误。 */
|
|
232
|
+
readonly objError: ActivityError
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** 实时连接的完整可判别状态。 */
|
|
236
|
+
export type TActivityConnectionState =
|
|
237
|
+
| IActivityIdleConnectionState
|
|
238
|
+
| IActivityConnectingState
|
|
239
|
+
| IActivityConnectedState
|
|
240
|
+
| IActivityReconnectingState
|
|
241
|
+
| IActivityConnectionErrorState
|
|
242
|
+
|
|
243
|
+
/** 非 React 订阅控制器的启动参数。 */
|
|
244
|
+
export interface IStartActivitySubscriptionOptions {
|
|
245
|
+
/** 当前作用域使用的轮询、SSE 或 WebSocket Adapter。 */
|
|
246
|
+
readonly objAdapter: IActivityTransportAdapter
|
|
247
|
+
/** 当前用户、租户、工作空间、语言和会话作用域。 */
|
|
248
|
+
readonly objScope: IAppQueryScope
|
|
249
|
+
/** 断线恢复时从该事件之后继续。 */
|
|
250
|
+
readonly strLastEventId?: string
|
|
251
|
+
/** 项目需要覆盖的重连退避参数。 */
|
|
252
|
+
readonly objReconnectPolicy?: IActivityReconnectPolicy
|
|
253
|
+
/** 每个已校验事件的唯一消费者。 */
|
|
254
|
+
readonly fnOnEvent: (objEvent: TActivityEvent) => void
|
|
255
|
+
/** 连接状态变化的可选诊断入口。 */
|
|
256
|
+
readonly fnOnStateChange?: (objState: TActivityConnectionState) => void
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** 一个正在运行或已经停止的活动订阅。 */
|
|
260
|
+
export interface IActivitySubscription {
|
|
261
|
+
/** 主动停止连接和所有自动重连计时器。 */
|
|
262
|
+
readonly fnStop: () => void
|
|
263
|
+
/** 立即关闭旧连接并从零开始手动重连。 */
|
|
264
|
+
readonly fnReconnect: () => void
|
|
265
|
+
/** 同步读取当前连接状态。 */
|
|
266
|
+
readonly fnGetState: () => TActivityConnectionState
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** 轮询 Adapter 调用项目生成客户端的请求参数。 */
|
|
270
|
+
export interface IActivityPollContext {
|
|
271
|
+
/** 当前完整应用查询作用域。 */
|
|
272
|
+
readonly objScope: IAppQueryScope
|
|
273
|
+
/** 停止轮询、切换身份或断线重连时触发。 */
|
|
274
|
+
readonly objSignal: AbortSignal
|
|
275
|
+
/** 断线续传时最近应用的事件 ID。 */
|
|
276
|
+
readonly strLastEventId?: string
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** 创建轮询 Adapter 的参数。 */
|
|
280
|
+
export interface ICreatePollingActivityTransportOptions {
|
|
281
|
+
/** 通过生成客户端请求一次增量事件。 */
|
|
282
|
+
readonly fnPoll: (
|
|
283
|
+
objContext: IActivityPollContext
|
|
284
|
+
) => Promise<TActivityEventInput | readonly TActivityEventInput[]>
|
|
285
|
+
/** 两次成功轮询开始时间之间的最小毫秒数。 */
|
|
286
|
+
readonly nIntervalMs?: number
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** EventSource 最小能力,允许项目包装 Cookie 或 Fetch 流式认证方案。 */
|
|
290
|
+
export interface IActivityEventSourceLike {
|
|
291
|
+
/** 底层连接成功回调。 */
|
|
292
|
+
onopen: ((objEvent: Event) => void) | null
|
|
293
|
+
/** 收到 UTF-8 文本消息回调。 */
|
|
294
|
+
onmessage: ((objEvent: MessageEvent<string>) => void) | null
|
|
295
|
+
/** 连接或协议错误回调。 */
|
|
296
|
+
onerror: ((objEvent: Event) => void) | null
|
|
297
|
+
/** 关闭底层流。 */
|
|
298
|
+
close: () => void
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** SSE/WebSocket 文本消息到活动事件的项目映射函数。 */
|
|
302
|
+
export type TActivityMessageParser = (
|
|
303
|
+
strData: string
|
|
304
|
+
) => TActivityEventInput | readonly TActivityEventInput[]
|
|
305
|
+
|
|
306
|
+
/** 创建 SSE Adapter 的参数。 */
|
|
307
|
+
export interface ICreateSseActivityTransportOptions {
|
|
308
|
+
/** 根据当前作用域和最后事件 ID 创建 EventSource 或兼容包装。 */
|
|
309
|
+
readonly fnCreateEventSource: (
|
|
310
|
+
objContext: Pick<
|
|
311
|
+
IActivityTransportConnectContext,
|
|
312
|
+
'objScope' | 'objSignal' | 'strLastEventId'
|
|
313
|
+
>
|
|
314
|
+
) => IActivityEventSourceLike | Promise<IActivityEventSourceLike>
|
|
315
|
+
/** 把后端文本消息校验并映射为通用活动事件输入。 */
|
|
316
|
+
readonly fnParseMessage: TActivityMessageParser
|
|
317
|
+
/** 首次 open 事件的等待上限,默认 10 秒。 */
|
|
318
|
+
readonly nConnectTimeoutMs?: number
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** WebSocket 最小能力,项目可以直接返回浏览器原生 WebSocket。 */
|
|
322
|
+
export interface IActivityWebSocketLike {
|
|
323
|
+
/** 底层握手成功回调。 */
|
|
324
|
+
onopen: ((objEvent: Event) => void) | null
|
|
325
|
+
/** 收到 UTF-8 文本消息回调。 */
|
|
326
|
+
onmessage: ((objEvent: MessageEvent<string>) => void) | null
|
|
327
|
+
/** 连接或协议错误回调。 */
|
|
328
|
+
onerror: ((objEvent: Event) => void) | null
|
|
329
|
+
/** 连接关闭回调。 */
|
|
330
|
+
onclose: ((objEvent: CloseEvent) => void) | null
|
|
331
|
+
/** 主动关闭底层连接。 */
|
|
332
|
+
close: () => void
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** 创建 WebSocket Adapter 的参数。 */
|
|
336
|
+
export interface ICreateWebSocketActivityTransportOptions {
|
|
337
|
+
/** 根据当前作用域和最后事件 ID 创建原生或兼容 WebSocket。 */
|
|
338
|
+
readonly fnCreateWebSocket: (
|
|
339
|
+
objContext: Pick<
|
|
340
|
+
IActivityTransportConnectContext,
|
|
341
|
+
'objScope' | 'objSignal' | 'strLastEventId'
|
|
342
|
+
>
|
|
343
|
+
) => IActivityWebSocketLike | Promise<IActivityWebSocketLike>
|
|
344
|
+
/** 把后端文本消息校验并映射为通用活动事件输入。 */
|
|
345
|
+
readonly fnParseMessage: TActivityMessageParser
|
|
346
|
+
/** 首次 open 事件的等待上限,默认 10 秒。 */
|
|
347
|
+
readonly nConnectTimeoutMs?: number
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/** ActivityProvider 的应用组合参数。 */
|
|
351
|
+
export interface IActivityProviderProps {
|
|
352
|
+
/** 是否允许加载快照并启动实时连接。 */
|
|
353
|
+
readonly bIsEnabled?: boolean
|
|
354
|
+
/** 始终渲染的应用子树;活动接口失败不会阻塞页面。 */
|
|
355
|
+
readonly children: ReactNode
|
|
356
|
+
/** 项目使用生成客户端实现的完整活动快照数据源。 */
|
|
357
|
+
readonly objSource?: IActivitySource
|
|
358
|
+
/** 可选的轮询、SSE 或 WebSocket 实时传输。 */
|
|
359
|
+
readonly objTransport?: IActivityTransportAdapter
|
|
360
|
+
/** 项目需要覆盖的自动重连退避参数。 */
|
|
361
|
+
readonly objReconnectPolicy?: IActivityReconnectPolicy
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** React 消费者读取的活动快照和连接生命周期。 */
|
|
365
|
+
export interface IUseActivityResult {
|
|
366
|
+
/** 当前快照中的近期任务状态。 */
|
|
367
|
+
readonly arrTaskStatuses: readonly IActivityTaskStatus[]
|
|
368
|
+
/** 是否配置了快照数据源。 */
|
|
369
|
+
readonly bIsConfigured: boolean
|
|
370
|
+
/** 当前认证状态是否允许加载。 */
|
|
371
|
+
readonly bIsEnabled: boolean
|
|
372
|
+
/** 快照查询是否失败。 */
|
|
373
|
+
readonly bIsError: boolean
|
|
374
|
+
/** 快照是否正在请求,包括后台刷新。 */
|
|
375
|
+
readonly bIsFetching: boolean
|
|
376
|
+
/** 是否正在进行首次快照加载。 */
|
|
377
|
+
readonly bIsLoading: boolean
|
|
378
|
+
/** 是否配置了实时传输 Adapter。 */
|
|
379
|
+
readonly bIsLiveConfigured: boolean
|
|
380
|
+
/** 当前未读通知总数;快照未加载时为 0。 */
|
|
381
|
+
readonly nUnreadCount: number
|
|
382
|
+
/** 当前完整活动快照。 */
|
|
383
|
+
readonly objSnapshot?: IActivitySnapshot
|
|
384
|
+
/** 最近一次快照加载错误。 */
|
|
385
|
+
readonly objSnapshotError: Error | null
|
|
386
|
+
/** 当前实时连接状态。 */
|
|
387
|
+
readonly objConnectionState: TActivityConnectionState
|
|
388
|
+
/** 手动重新获取完整快照。 */
|
|
389
|
+
readonly fnRefetch: () => Promise<void>
|
|
390
|
+
/** 立即重新建立实时连接;未配置或未加载快照时无操作。 */
|
|
391
|
+
readonly fnReconnect: () => void
|
|
392
|
+
/** 先恢复失败快照,再重新建立实时连接。 */
|
|
393
|
+
readonly fnRetry: () => Promise<void>
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** 活动快照和实时连接的稳定错误码。 */
|
|
397
|
+
export type TActivityErrorCode =
|
|
398
|
+
| 'INVALID_EVENT'
|
|
399
|
+
| 'INVALID_SNAPSHOT'
|
|
400
|
+
| 'INVALID_TRANSPORT_CONFIG'
|
|
401
|
+
| 'RECONNECT_EXHAUSTED'
|
|
402
|
+
| 'TRANSPORT_DISCONNECTED'
|