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,132 @@
|
|
|
1
|
+
# 部署模板
|
|
2
|
+
|
|
3
|
+
仓库内置单容器静态站点部署模板。Vite 产物由 Nginx 提供,宿主机反向代理负责
|
|
4
|
+
TLS、域名和 `/api/` 上游。模板中的域名、端口和 API 地址都是示例,初始化项目时必须
|
|
5
|
+
按环境替换。
|
|
6
|
+
|
|
7
|
+
## 流量结构
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
https://admin.example.com
|
|
11
|
+
├── /api/* -> 127.0.0.1:18085 -> backend
|
|
12
|
+
└── /* -> 127.0.0.1:8084 -> enterprise-react-admin:80
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
容器内的 [`nginx.conf`](nginx.conf) 只负责 SPA fallback、静态资源缓存和通用安全头。
|
|
16
|
+
宿主机路由片段位于 `host-nginx/`,不包含 `server {}`,由平台统一的 HTTPS Server
|
|
17
|
+
引入。CSP 允许源、响应头变更和依赖审计流程见
|
|
18
|
+
[`../docs/browser-security.md`](../docs/browser-security.md)。
|
|
19
|
+
|
|
20
|
+
## 不可变产物流
|
|
21
|
+
|
|
22
|
+
流水线只产生一次前端代码:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
verify
|
|
26
|
+
pnpm verify
|
|
27
|
+
└── dist
|
|
28
|
+
└── release:prepare → .artifacts/release
|
|
29
|
+
├── site/
|
|
30
|
+
├── artifact-manifest.sha256
|
|
31
|
+
└── artifact-metadata.json
|
|
32
|
+
│
|
|
33
|
+
package ▼
|
|
34
|
+
校验 Commit 与文件摘要 → 仅封装 Nginx 镜像 → 推送 GitLab Registry
|
|
35
|
+
│
|
|
36
|
+
deploy ▼
|
|
37
|
+
按 sha256 镜像摘要拉取 → 校验 Commit Label → 候选探活 → 正式容器
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`verify` Job 是唯一允许安装前端依赖、执行测试和运行 Vite Build 的阶段。`package` Job 只
|
|
41
|
+
消费它上传的 `.artifacts/release`,Dockerfile 不包含 Node、pnpm、源码或重新构建步骤;
|
|
42
|
+
`deploy` Job 只接受 Registry 返回的 `RELEASE_IMAGE_DIGEST`,不按可变 Tag 部署。候选容器
|
|
43
|
+
注入目标环境的 Runtime Config 后,使用真实 Chromium 打开 `/sign-in`;只有配置通过应用
|
|
44
|
+
自己的 Zod 契约、React 完成启动并渲染登录表单,才允许进入正式晋级。晋级期间旧容器会
|
|
45
|
+
改名并停止但不会删除;新容器创建、启动或公网探活失败时,Trap 会删除失败版本并恢复旧
|
|
46
|
+
容器。只有公网探活通过后才删除回滚容器。
|
|
47
|
+
|
|
48
|
+
发布清单记录每个静态文件的 SHA-256,元数据记录 Schema、应用版本、Git Commit、清单摘要
|
|
49
|
+
以及 `strRuntimeConfig: external`。任意文件缺失、增加、内容变化或 Commit 不匹配都会阻断
|
|
50
|
+
封装和部署。
|
|
51
|
+
|
|
52
|
+
`runtime-config.json` 有意不进入不可变静态目录。它属于部署环境,在候选和正式容器启动前
|
|
53
|
+
通过 GitLab File Variable 注入;因此同一镜像摘要可以晋级到多个环境,而无需重新编译。
|
|
54
|
+
生产平台仍需独立版本化 Runtime Config,并保证其 Schema Version 与目标镜像兼容。
|
|
55
|
+
|
|
56
|
+
## CI 变量
|
|
57
|
+
|
|
58
|
+
| 变量 | 类型 | 说明 |
|
|
59
|
+
| ------------------------------- | --------------- | -------------------------- |
|
|
60
|
+
| `ADMIN_PUBLIC_URL` | Variable | 应用公网 HTTPS 地址 |
|
|
61
|
+
| `ADMIN_RUNTIME_CONFIG_FILE` | File variable | 生产运行时配置 JSON |
|
|
62
|
+
| `ADMIN_WEB_HOST_PORT` | Variable | 宿主机应用端口,默认 8084 |
|
|
63
|
+
| `ENABLE_PRODUCTION_DEPLOY` | Variable | 显式设为 `true` 才允许部署 |
|
|
64
|
+
| `VITE_HANDSONTABLE_LICENSE_KEY` | Masked variable | Handsontable 商业许可证 |
|
|
65
|
+
|
|
66
|
+
GitLab 内建的 `CI_REGISTRY`、`CI_REGISTRY_IMAGE`、`CI_REGISTRY_USER` 和
|
|
67
|
+
`CI_REGISTRY_PASSWORD` 用于推送和拉取镜像。Registry 必须启用;部署身份应只拥有当前项目
|
|
68
|
+
镜像的最小读写权限。
|
|
69
|
+
|
|
70
|
+
## 宿主机示例
|
|
71
|
+
|
|
72
|
+
```nginx
|
|
73
|
+
server {
|
|
74
|
+
listen 443 ssl http2;
|
|
75
|
+
server_name admin.example.com;
|
|
76
|
+
|
|
77
|
+
ssl_certificate /etc/nginx/certs/admin.example.com/fullchain.pem;
|
|
78
|
+
ssl_certificate_key /etc/nginx/certs/admin.example.com/privkey.pem;
|
|
79
|
+
|
|
80
|
+
include /etc/nginx/react-admin-locations/*.conf;
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
生产部署默认关闭。仅当 main 分支的 `ENABLE_PRODUCTION_DEPLOY=true` 时显示手动部署
|
|
85
|
+
任务;任务拒绝非 HTTPS 地址、`example.com` 示例域名、无效宿主机端口以及缺失或无效 JSON
|
|
86
|
+
的 `ADMIN_RUNTIME_CONFIG_FILE`。该变量使用 GitLab File 类型,内容遵循
|
|
87
|
+
`public/runtime-config.json` 契约;生产应设置 `app.strMode=connected` 和
|
|
88
|
+
`auth.strSessionStorage=memory`。接入正式监控 Adapter 后,再设置
|
|
89
|
+
`observability.bEnabled=true` 和稳定的 `observability.strEnvironment`;运行时 JSON
|
|
90
|
+
不能写入任何密钥。
|
|
91
|
+
|
|
92
|
+
启用生产部署后,main 流水线自动封装并推送 Commit Tag,同时保存 Registry Digest;手动
|
|
93
|
+
`deploy` Job 只能消费该 Digest。候选容器的 Chromium 冒烟通过后才替换正式容器,正式
|
|
94
|
+
公网探活通过前始终保留可恢复的上一版。运行时配置响应禁止缓存。浏览器 DOM 不包含登录表单时,
|
|
95
|
+
流水线会以 `DEPLOY_BROWSER_SMOKE_APP_NOT_READY` 失败,并保留候选容器供当前 Job 清理。
|
|
96
|
+
|
|
97
|
+
`deploy/host-nginx/` 是平台基础设施示例,不由应用发布任务覆盖。交付平台应在首次接入或
|
|
98
|
+
端口/API 上游变化时单独评审、安装并执行 `nginx -t`;这样应用版本回滚不会夹带宿主机
|
|
99
|
+
配置变更。`ADMIN_WEB_HOST_PORT` 必须与平台已安装的 Web upstream 保持一致。
|
|
100
|
+
|
|
101
|
+
回滚时重新运行目标历史流水线的手动部署 Job,或由交付平台选择其保存的
|
|
102
|
+
`release-image.txt` Digest;禁止对旧 Commit 重新构建一个“同名”镜像冒充原产物。镜像、
|
|
103
|
+
流水线 Artifact 和 Registry 保留期应按项目恢复时间目标设置,模板中的 7/30 天只是最低
|
|
104
|
+
示例。
|
|
105
|
+
|
|
106
|
+
本地验证发布目录和运行时镜像:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pnpm verify
|
|
110
|
+
pnpm release:prepare
|
|
111
|
+
pnpm release:verify --commit "$(git rev-parse HEAD)"
|
|
112
|
+
docker build --build-arg APP_COMMIT_SHA="$(git rev-parse HEAD)" -t react-admin:local .
|
|
113
|
+
docker run --rm -d --name react-admin-candidate -p 127.0.0.1:8084:80 react-admin:local
|
|
114
|
+
docker cp public/runtime-config.json react-admin-candidate:/usr/share/nginx/html/runtime-config.json
|
|
115
|
+
pnpm deployment:smoke http://127.0.0.1:8084/sign-in
|
|
116
|
+
docker rm -f react-admin-candidate
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Dockerfile 的基础 Nginx 镜像使用 Digest 固定。升级 Nginx 时必须显式更新 Digest、重新执行
|
|
120
|
+
镜像构建和安全检查,不能只把浮动 Tag 当作已验证依赖。
|
|
121
|
+
|
|
122
|
+
## 验证
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
docker ps --filter name=enterprise-react-admin
|
|
126
|
+
cat release-image.txt
|
|
127
|
+
curl -I https://admin.example.com/sign-in
|
|
128
|
+
curl -I https://admin.example.com/runtime-config.json
|
|
129
|
+
curl -I https://admin.example.com/api/health
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
刷新任意前端路由应返回 SPA;API 请求应到达真实后端且不会落入 `index.html`。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
location /api/ {
|
|
2
|
+
proxy_pass http://127.0.0.1:18085;
|
|
3
|
+
proxy_http_version 1.1;
|
|
4
|
+
proxy_set_header Host $host;
|
|
5
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
6
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
7
|
+
proxy_set_header X-Forwarded-Host $host;
|
|
8
|
+
proxy_set_header X-Forwarded-Port $server_port;
|
|
9
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
10
|
+
proxy_set_header Connection "";
|
|
11
|
+
proxy_buffering off;
|
|
12
|
+
proxy_cache off;
|
|
13
|
+
proxy_read_timeout 3600s;
|
|
14
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
map $uri $str_runtime_config_cache_control {
|
|
2
|
+
default "";
|
|
3
|
+
/runtime-config.json "no-store, no-cache, must-revalidate";
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
server {
|
|
7
|
+
listen 80;
|
|
8
|
+
server_name _;
|
|
9
|
+
root /usr/share/nginx/html;
|
|
10
|
+
index index.html;
|
|
11
|
+
|
|
12
|
+
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; connect-src 'self'; font-src 'self' data:; form-action 'self'; frame-ancestors 'none'; frame-src 'self' blob: https:; img-src 'self' blob: data: https:; object-src 'none'; script-src 'self'; script-src-attr 'none'; style-src 'self' 'unsafe-inline'" always;
|
|
13
|
+
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
14
|
+
add_header Cross-Origin-Opener-Policy "same-origin" always;
|
|
15
|
+
add_header Cross-Origin-Resource-Policy "same-origin" always;
|
|
16
|
+
add_header Permissions-Policy "camera=(), geolocation=(), microphone=(), payment=(), usb=()" always;
|
|
17
|
+
add_header X-Frame-Options "DENY" always;
|
|
18
|
+
add_header X-Content-Type-Options "nosniff" always;
|
|
19
|
+
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
20
|
+
add_header Cache-Control $str_runtime_config_cache_control always;
|
|
21
|
+
|
|
22
|
+
gzip on;
|
|
23
|
+
gzip_min_length 1024;
|
|
24
|
+
gzip_types text/css application/javascript application/json image/svg+xml;
|
|
25
|
+
|
|
26
|
+
location /assets/ {
|
|
27
|
+
try_files $uri =404;
|
|
28
|
+
expires 1y;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
location = /index.html {
|
|
32
|
+
expires -1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
location / {
|
|
36
|
+
try_files $uri $uri/ /index.html;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# 通知与任务状态接口
|
|
2
|
+
|
|
3
|
+
这套能力为企业项目提供一个供应商无关的“活动摘要 + 实时更新”基础设施:统一未读数量、
|
|
4
|
+
近期后台任务状态、轮询/SSE/WebSocket 连接和断线恢复。它不提供通知中心、待办页面、
|
|
5
|
+
业务消息模板或任务详情;这些仍由具体项目 Feature 使用生成客户端实现。
|
|
6
|
+
|
|
7
|
+
公共入口统一从 `@/api/activity` 导入。这是按需能力,默认 `Application` 不装配
|
|
8
|
+
`ActivityProvider`;项目应在确实展示通知或任务状态的认证布局或 Feature 边界挂载它。
|
|
9
|
+
|
|
10
|
+
## 数据所有权
|
|
11
|
+
|
|
12
|
+
| 数据或状态 | 唯一所有者 | 说明 |
|
|
13
|
+
| ---------------------------- | ------------------------------- | -------------------------------------- |
|
|
14
|
+
| 未读数、近期任务状态 | TanStack Query 活动快照 | 按用户、会话、租户、工作空间和语言隔离 |
|
|
15
|
+
| 通知列表、待办列表、任务详情 | 所属 Feature 的 Query | 不复制进活动快照或 Zustand |
|
|
16
|
+
| 连接、重连轮次、最后事件 ID | `fnStartActivitySubscription()` | 仅为浏览器连接生命周期,不是服务端数据 |
|
|
17
|
+
| Token、权限和最终任务状态 | 认证会话与后端 | 前端展示和预检不能替代服务端授权 |
|
|
18
|
+
|
|
19
|
+
活动快照最多保存 100 条近期任务,只包含稳定任务 ID、通用状态、更新时间和可选进度。通知
|
|
20
|
+
标题、正文、发送人和业务跳转不进入全局摘要,避免把完整通知中心变成第二份全局缓存。
|
|
21
|
+
|
|
22
|
+
## 快照与事件契约
|
|
23
|
+
|
|
24
|
+
快照包含:
|
|
25
|
+
|
|
26
|
+
- `nUnreadCount`:后端确认的未读总数。
|
|
27
|
+
- `arrTaskStatuses`:近期任务的 `queued/running/succeeded/failed/cancelled` 状态。
|
|
28
|
+
- `strVersion`:完整快照版本。
|
|
29
|
+
- `strLastEventId`:快照已经包含的最后事件,用于断线续传。
|
|
30
|
+
|
|
31
|
+
实时传输只支持四类幂等事件:
|
|
32
|
+
|
|
33
|
+
| `strType` | 行为 |
|
|
34
|
+
| ---------------------- | ---------------------------------------------- |
|
|
35
|
+
| `snapshot-replaced` | 使用完整后端快照替换当前活动缓存 |
|
|
36
|
+
| `unread-count-changed` | 设置最新未读总数,不传增量 |
|
|
37
|
+
| `task-status-changed` | 按任务 ID 和更新时间合并,旧事件不能覆盖新状态 |
|
|
38
|
+
| `snapshot-invalidated` | 失效当前 Query,并通过快照接口重新确认 |
|
|
39
|
+
|
|
40
|
+
所有快照和事件在进入缓存前都会校验稳定 ID、非负未读数、任务状态、0–100 进度和 ISO 8601
|
|
41
|
+
时间。传输事件采用“至少一次”友好的设置值语义;不要发送 `unread + 1` 一类依赖客户端旧值
|
|
42
|
+
的指令。
|
|
43
|
+
|
|
44
|
+
## 使用生成客户端加载快照
|
|
45
|
+
|
|
46
|
+
项目 Adapter 负责把 Swagger DTO 映射为脚手架契约,不在基础设施中写死端点:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
const objActivitySource = fnCreateActivitySource(
|
|
50
|
+
async ({ objScope, objSignal }) => {
|
|
51
|
+
const objResponse = await objGeneratedApi.api.activitySummaryList(
|
|
52
|
+
{
|
|
53
|
+
tenantId: objScope.strTenantId,
|
|
54
|
+
workspaceId: objScope.strWorkspaceId,
|
|
55
|
+
},
|
|
56
|
+
{ signal: objSignal }
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
nUnreadCount: objResponse.data.unreadCount,
|
|
61
|
+
arrTaskStatuses: objResponse.data.tasks.map(fnMapTaskStatus),
|
|
62
|
+
strLastEventId: objResponse.data.lastEventId,
|
|
63
|
+
strVersion: objResponse.data.version,
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
标记已读、取消任务或重新执行任务属于业务 Mutation。成功后调用
|
|
70
|
+
`fnInvalidateActivitySnapshot(objQueryClient, objScope)`,让服务端重新确认摘要;不要直接
|
|
71
|
+
修改 Zustand 未读数。
|
|
72
|
+
|
|
73
|
+
## 选择传输方式
|
|
74
|
+
|
|
75
|
+
优先选择满足需求的最小能力:
|
|
76
|
+
|
|
77
|
+
| 方式 | 适用场景 | 主要代价 |
|
|
78
|
+
| --------- | -------------------------------------------- | ------------------------------------------ |
|
|
79
|
+
| 轮询 | 更新频率低、后端没有流式基础设施 | 请求数量更多,后台标签页计时器可能被节流 |
|
|
80
|
+
| SSE | 服务器单向推送通知和任务状态 | 原生 EventSource 不能设置 Authorization 头 |
|
|
81
|
+
| WebSocket | 已有双向实时网关或后续确实需要客户端上行消息 | 网关、鉴权、心跳和运维复杂度最高 |
|
|
82
|
+
|
|
83
|
+
### 轮询
|
|
84
|
+
|
|
85
|
+
轮询顺序执行,请求不会重叠;成功后等待固定间隔,失败交给统一指数退避控制器:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
const objActivityTransport = fnCreatePollingActivityTransport({
|
|
89
|
+
nIntervalMs: 30_000,
|
|
90
|
+
fnPoll: async ({ objScope, objSignal, strLastEventId }) => {
|
|
91
|
+
const objResponse = await objGeneratedApi.api.activityEventsList(
|
|
92
|
+
{
|
|
93
|
+
afterEventId: strLastEventId,
|
|
94
|
+
tenantId: objScope.strTenantId,
|
|
95
|
+
workspaceId: objScope.strWorkspaceId,
|
|
96
|
+
},
|
|
97
|
+
{ signal: objSignal }
|
|
98
|
+
)
|
|
99
|
+
return objResponse.data.events.map(fnMapActivityEvent)
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### SSE
|
|
105
|
+
|
|
106
|
+
浏览器原生 `EventSource` 不能附加 Bearer Token。不得把 Access Token、Refresh Token 或长期
|
|
107
|
+
凭据放进 URL。推荐同源 HttpOnly Cookie;或者先通过生成客户端获取一次性短期连接票据,
|
|
108
|
+
再异步创建 EventSource。若项目使用 Fetch 流式响应,可以包装成 `IActivityEventSourceLike`:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
const objActivityTransport = fnCreateSseActivityTransport({
|
|
112
|
+
fnCreateEventSource: async ({ objScope, objSignal }) => {
|
|
113
|
+
const objTicket = await objGeneratedApi.api.activityTicketCreate(
|
|
114
|
+
{ tenantId: objScope.strTenantId },
|
|
115
|
+
{ signal: objSignal }
|
|
116
|
+
)
|
|
117
|
+
return new EventSource(
|
|
118
|
+
`/api/v1/activity/stream?ticket=${encodeURIComponent(objTicket.data.ticket)}`
|
|
119
|
+
)
|
|
120
|
+
},
|
|
121
|
+
fnParseMessage: (strData) => fnMapActivityEvent(JSON.parse(strData)),
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
票据必须单次使用、短时过期、绑定用户和作用域,并避免进入访问日志。更推荐 Cookie 或
|
|
126
|
+
Fetch Header 方案;示例票据不是允许把会话 Token 写入查询字符串。
|
|
127
|
+
|
|
128
|
+
### WebSocket
|
|
129
|
+
|
|
130
|
+
浏览器 WebSocket 同样不能自行设置认证 Header。使用同源安全 Cookie或由生成客户端获取的
|
|
131
|
+
一次性连接票据,始终使用 `wss:`:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
const objActivityTransport = fnCreateWebSocketActivityTransport({
|
|
135
|
+
fnCreateWebSocket: async ({ objScope, objSignal, strLastEventId }) => {
|
|
136
|
+
const objTicket = await objGeneratedApi.api.activityTicketCreate(
|
|
137
|
+
{ tenantId: objScope.strTenantId },
|
|
138
|
+
{ signal: objSignal }
|
|
139
|
+
)
|
|
140
|
+
return new WebSocket(
|
|
141
|
+
`wss://example.test/activity?ticket=${encodeURIComponent(
|
|
142
|
+
objTicket.data.ticket
|
|
143
|
+
)}&after=${encodeURIComponent(strLastEventId ?? '')}`
|
|
144
|
+
)
|
|
145
|
+
},
|
|
146
|
+
fnParseMessage: (strData) => fnMapActivityEvent(JSON.parse(strData)),
|
|
147
|
+
})
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
基础设施只接受 UTF-8 文本帧。二进制协议、应用心跳、Ack 和客户端上行命令由确实需要
|
|
151
|
+
WebSocket 的项目 Adapter 负责,不能为了展示未读数默认引入。
|
|
152
|
+
|
|
153
|
+
## 应用和 React 使用
|
|
154
|
+
|
|
155
|
+
在 `Application` 内部的认证布局或拥有该能力的 Feature 边界注入快照和可选传输。该位置
|
|
156
|
+
已经具备 QueryClient、Locale 和租户/工作空间上下文:
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
<ActivityProvider
|
|
160
|
+
bIsEnabled={bIsAuthenticated}
|
|
161
|
+
objSource={objActivitySource}
|
|
162
|
+
objTransport={objActivityTransport}
|
|
163
|
+
objReconnectPolicy={{
|
|
164
|
+
nInitialDelayMs: 1_000,
|
|
165
|
+
nMaxDelayMs: 30_000,
|
|
166
|
+
nMultiplier: 2,
|
|
167
|
+
nJitterRatio: 0.2,
|
|
168
|
+
}}
|
|
169
|
+
>
|
|
170
|
+
{objChildren}
|
|
171
|
+
</ActivityProvider>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
普通组件读取摘要;任务入口按稳定 ID 订阅单条状态:
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
const {
|
|
178
|
+
nUnreadCount,
|
|
179
|
+
objConnectionState,
|
|
180
|
+
fnReconnect,
|
|
181
|
+
fnRetry,
|
|
182
|
+
} = useActivity()
|
|
183
|
+
const objExportTask = useActivityTaskStatus(strExportTaskId)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
`objConnectionState` 是 `idle/connecting/connected/reconnecting/error` 可判别联合。页面可以
|
|
187
|
+
在最终 `error` 状态提供 `fnReconnect()`,快照请求失败则调用 `fnRetry()`。连接错误不隐藏
|
|
188
|
+
应用子树;未读数和任务状态继续展示最后一次成功快照,并明确连接已降级。
|
|
189
|
+
|
|
190
|
+
## React 外使用
|
|
191
|
+
|
|
192
|
+
- `fnEnsureActivitySnapshot()`:Loader 或启动阶段确保快照存在。
|
|
193
|
+
- `fnGetCachedActivitySnapshot()`:同步读取 QueryClient 中的当前快照。
|
|
194
|
+
- `fnGetActivityTaskStatus()`:按稳定任务 ID 读取状态。
|
|
195
|
+
- `fnApplyActivityEvent()`:项目自有宿主把已映射事件写入统一 Query 缓存。
|
|
196
|
+
- `fnStartActivitySubscription()`:在 React 外启动同一重连控制器,调用方负责 `fnStop()`。
|
|
197
|
+
|
|
198
|
+
身份、租户、工作空间、会话版本或语言变化会产生新的活动 Query Key,并由 Provider 关闭
|
|
199
|
+
旧连接、取消旧请求、加载新快照后再连接。退出登录时,拥有该能力的认证布局应卸载 Provider
|
|
200
|
+
或把 `bIsEnabled` 设为 `false`。
|
|
201
|
+
|
|
202
|
+
## 断线与后端职责
|
|
203
|
+
|
|
204
|
+
- 自动重连使用带抖动的指数退避,默认 1 秒起步、30 秒封顶;可配置连续失败上限。
|
|
205
|
+
- 用户手动重连会清零连续失败轮次,并携带最后已应用事件 ID。
|
|
206
|
+
- 新连接建立后,旧连接的迟到事件会被忽略。
|
|
207
|
+
- 服务端应支持按事件 ID 续传;事件历史过期时发送 `snapshot-invalidated` 或完整快照。
|
|
208
|
+
- 服务端负责成员关系、权限、未读事实、任务执行、事件顺序和事件保留窗口。
|
|
209
|
+
- 前端不得因为实时连接成功就跳过普通 REST/Query 接口的权限校验。
|
|
210
|
+
|
|
211
|
+
## 不支持范围
|
|
212
|
+
|
|
213
|
+
- 不内置通知中心、待办/已办、任务详情、业务跳转或消息模板。
|
|
214
|
+
- 不提供跨标签页 Leader Election、Service Worker 后台推送或系统级桌面通知。
|
|
215
|
+
- 不把完整通知列表或任务列表持久化到 Local Storage。
|
|
216
|
+
- 不自动选择供应商、消息中间件、网关协议、心跳格式或 WebSocket SDK。
|
|
217
|
+
- 不用实时事件替代服务端最终状态、审计、幂等和权限判断。
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# 审计日志接入
|
|
2
|
+
|
|
3
|
+
`src/auditLogs` 提供审计列表、详情和导出的前端安全边界。它负责校验后端返回的
|
|
4
|
+
展示模型、复用统一 Query 作用域、协调取消与异步导出;不负责在浏览器
|
|
5
|
+
生成、保存或证明审计事实。
|
|
6
|
+
|
|
7
|
+
## 权威边界
|
|
8
|
+
|
|
9
|
+
| 层级 | 必须负责 | 不能交给前端 |
|
|
10
|
+
| --------------- | ----------------------------------------------------------------- | ----------------------------------------- |
|
|
11
|
+
| 业务后端 | 在权威事务附近生成事实,记录操作者、动作、目标、结果和请求关联 ID | 让浏览器上报“操作成功”作为事实 |
|
|
12
|
+
| 审计服务 | 授权查询、租户隔离、字段脱敏、留存、完整性、防篡改、检索和导出 | 依赖隐藏按钮保护日志 |
|
|
13
|
+
| Swagger Adapter | 调用生成客户端并映射列表、详情和任务结果 | 直接使用 `fetch`、拼接地址或返回管理密钥 |
|
|
14
|
+
| `src/auditLogs` | 运行时校验、缓存隔离、取消、任务生命周期 | 保存原始请求体、Token、Cookie 或任意 JSON |
|
|
15
|
+
| 审计 Feature | URL 筛选、AppTable 列、详情展示、错误与空状态 | 自行判断跨租户数据是否有权查看 |
|
|
16
|
+
|
|
17
|
+
前端不会提供 `fnCreateAuditEvent` 一类写入接口。登录、审批、删除、权限变更、导出
|
|
18
|
+
等审计事实必须由实际执行操作的后端产生;普通埋点、可观测性事件和控制台日志都
|
|
19
|
+
不能替代审计日志。
|
|
20
|
+
|
|
21
|
+
## 数据模型
|
|
22
|
+
|
|
23
|
+
列表项 `IAuditLogEntry` 只包含稳定 ID、时间、操作码、操作者/目标安全名称、执行
|
|
24
|
+
结果、请求关联 ID、安全摘要和后端已遮罩的 IP 地址。
|
|
25
|
+
|
|
26
|
+
详情不接受原始请求体或任意元数据对象,只接受两类有界字段:
|
|
27
|
+
|
|
28
|
+
- `IAuditLogChange`:字段 Key、纯文本名称、前后安全展示值和展示级别。
|
|
29
|
+
- `IAuditLogContextField`:受限上下文 Key、名称、安全展示值和展示级别。
|
|
30
|
+
|
|
31
|
+
展示级别为 `plain`、`masked` 或 `redacted`。`plain` 不代表前端可以自行解除脱敏,
|
|
32
|
+
它只表示后端已根据当前查看者权限确认该值可显示。所有内容仍应通过 React 普通
|
|
33
|
+
文本节点渲染,不得进入 `dangerouslySetInnerHTML`。
|
|
34
|
+
|
|
35
|
+
## Swagger 数据源
|
|
36
|
+
|
|
37
|
+
项目使用 `fnCreateAuditLogSource` 连接生成客户端。下面的方法和 DTO 名称仅表示映射
|
|
38
|
+
位置,以实际 OpenAPI 产物为准:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { fnCreateAuditLogSource } from '@/auditLogs'
|
|
42
|
+
import { objGeneratedApi } from '@/api/generated/project'
|
|
43
|
+
|
|
44
|
+
export const objAuditLogSource = fnCreateAuditLogSource({
|
|
45
|
+
async fnList({ objFilter, objSignal }) {
|
|
46
|
+
const objResponse = await objGeneratedApi.auditLogs.list(objFilter, {
|
|
47
|
+
signal: objSignal,
|
|
48
|
+
})
|
|
49
|
+
return {
|
|
50
|
+
arrEntries: objResponse.data.items.map(fnMapAuditLogEntry),
|
|
51
|
+
bHasMore: objResponse.data.hasMore,
|
|
52
|
+
nTotal: objResponse.data.total,
|
|
53
|
+
strNextCursor: objResponse.data.nextCursor,
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
async fnGetDetail({ objSignal, strAuditLogId }) {
|
|
57
|
+
const objResponse = await objGeneratedApi.auditLogs.detail(strAuditLogId, {
|
|
58
|
+
signal: objSignal,
|
|
59
|
+
})
|
|
60
|
+
return fnMapAuditLogDetail(objResponse.data)
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`objScope` 包含当前用户、会话版本、租户、工作空间和语言,可用于生成客户端需要的
|
|
66
|
+
非敏感请求参数或诊断,但不能替代服务端从认证会话重新确认身份。Adapter 必须把
|
|
67
|
+
`objSignal` 透传给生成客户端。
|
|
68
|
+
|
|
69
|
+
## 列表与详情
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { useAuditLogDetail, useAuditLogList } from '@/auditLogs'
|
|
73
|
+
|
|
74
|
+
const objListQuery = useAuditLogList({
|
|
75
|
+
objFilter: {
|
|
76
|
+
strAction: 'order.approve',
|
|
77
|
+
strStartedAt: '2026-08-01T00:00:00.000Z',
|
|
78
|
+
strEndedAt: '2026-08-31T23:59:59.999Z',
|
|
79
|
+
},
|
|
80
|
+
objSource: objAuditLogSource,
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const objDetailQuery = useAuditLogDetail({
|
|
84
|
+
bIsEnabled: Boolean(strSelectedAuditLogId),
|
|
85
|
+
objSource: objAuditLogSource,
|
|
86
|
+
strAuditLogId: strSelectedAuditLogId,
|
|
87
|
+
})
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
列表采用后端不透明游标,默认 50 条、最大 100 条。支持操作者、操作码、结果、时间
|
|
91
|
+
范围、请求关联 ID、业务对象及服务器重新授权的租户/工作空间筛选。返回列表会拒绝
|
|
92
|
+
重复 ID,并固定为时间倒序;详情返回的 ID 必须与请求完全一致。
|
|
93
|
+
|
|
94
|
+
需要刷新、分享和浏览器前进后退的筛选由审计 Feature 的路由 Schema 读写,游标只代表
|
|
95
|
+
当前分页过程,不应写入个人默认。Query 缓存按用户、会话版本、租户、工作空间、语言和
|
|
96
|
+
完整筛选隔离,不复制到 Zustand 或持久化存储。
|
|
97
|
+
|
|
98
|
+
## 安全导出
|
|
99
|
+
|
|
100
|
+
审计导出复用 `useFileTask`,支持同步完成或后台任务。结果只包含导出 ID、受保护下载
|
|
101
|
+
接口使用的文件 ID 和清理后的文件名,不允许 Adapter 返回任意外部 URL。
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
const objExportTask = useAuditLogExport({
|
|
105
|
+
objSource: {
|
|
106
|
+
async fnStartExport({ objRequest, objSignal }) {
|
|
107
|
+
const objResponse = await objGeneratedApi.auditExports.create(
|
|
108
|
+
objRequest,
|
|
109
|
+
{ signal: objSignal }
|
|
110
|
+
)
|
|
111
|
+
return objResponse.data.completed
|
|
112
|
+
? {
|
|
113
|
+
strMode: 'completed',
|
|
114
|
+
objResult: {
|
|
115
|
+
strExportId: objResponse.data.exportId,
|
|
116
|
+
strFileId: objResponse.data.fileId,
|
|
117
|
+
strFileName: objResponse.data.fileName,
|
|
118
|
+
},
|
|
119
|
+
}
|
|
120
|
+
: {
|
|
121
|
+
strMode: 'background',
|
|
122
|
+
strTaskId: objResponse.data.taskId,
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
async fnPollExport({ objSignal, strTaskId }) {
|
|
126
|
+
const objResponse = await objGeneratedApi.auditExports.detail(
|
|
127
|
+
strTaskId,
|
|
128
|
+
{ signal: objSignal }
|
|
129
|
+
)
|
|
130
|
+
return fnMapAuditExportTask(objResponse.data)
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
任务成功后再使用 `fnDownloadFile` 和生成客户端按 `strFileId` 下载。后端必须重新鉴权
|
|
137
|
+
文件归属和有效期,并限制时间范围、最大行数、允许字段和并发任务。CSV/XLSX 内容由
|
|
138
|
+
后端生成时必须防止公式注入;前端文件名清理和隐藏导出按钮都不能代替
|
|
139
|
+
这些控制。
|
|
140
|
+
|
|
141
|
+
## 服务端验收要求
|
|
142
|
+
|
|
143
|
+
- 审计写入与业务事务的失败语义明确,不能由浏览器伪造成功事实。
|
|
144
|
+
- 以服务端身份、租户和资源权限授权每次列表、详情、导出和文件下载。
|
|
145
|
+
- Token、Cookie、密码、密钥、完整请求体和敏感原值默认拒绝进入审计载荷。
|
|
146
|
+
- IP、手机号、邮箱、证件号等个人数据按角色、用途和保留期脱敏。
|
|
147
|
+
- 定义可信时钟、事件唯一 ID、不可变存储、完整性验证、归档和删除策略。
|
|
148
|
+
- 请求关联 ID 可从统一 API 错误追溯到审计事实,但不能包含凭据。
|
|
149
|
+
- 导出操作本身必须产生审计事实,并受行数、频率和数据字段限制。
|
|
150
|
+
|
|
151
|
+
## 前端验收范围
|
|
152
|
+
|
|
153
|
+
- 筛选、游标、时间戳、条数、列表重复 ID 和详情 ID 均经过运行时校验。
|
|
154
|
+
- 详情只能携带有界纯文本展示字段,不存在任意 JSON 或原始请求体入口。
|
|
155
|
+
- 后端 `401/403` 通过统一错误契约反馈,入口显隐不承担最终授权。
|
|
156
|
+
- Query Key 隔离身份和全部筛选,请求取消信号可到达 Swagger Adapter。
|
|
157
|
+
- 导出复用统一任务状态,任务 ID、文件 ID 和文件名经过校验。
|
|
158
|
+
- 不增加默认审计页面、路由、菜单、供应商 SDK 或首屏依赖。
|