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,633 @@
|
|
|
1
|
+
import type { TableEngineMessages } from '../../shared/messages'
|
|
2
|
+
import {
|
|
3
|
+
deleteTableRowValue,
|
|
4
|
+
getTableRowValue,
|
|
5
|
+
setTableRowValue,
|
|
6
|
+
} from '../../shared/row'
|
|
7
|
+
import {
|
|
8
|
+
createTableRowIndex,
|
|
9
|
+
type TableRowTreeEntry,
|
|
10
|
+
} from '../../shared/treeRows'
|
|
11
|
+
import type { TableRow } from '../../shared/types'
|
|
12
|
+
import { cloneTableValue } from '../../shared/valueSnapshot'
|
|
13
|
+
import type { TableBaselineStore } from './baselineStore'
|
|
14
|
+
import {
|
|
15
|
+
indexTableCommitResults,
|
|
16
|
+
type CreateCommitResult,
|
|
17
|
+
type RemoveCommitResult,
|
|
18
|
+
type UpdateCommitResult,
|
|
19
|
+
} from './commitResultIndex'
|
|
20
|
+
import { TABLE_CLIENT_ROW_KEY_PREFIX } from './constants'
|
|
21
|
+
import {
|
|
22
|
+
createDirtyCellKey as cellKey,
|
|
23
|
+
type TableDirtyCellIndex,
|
|
24
|
+
} from './dirtyCellIndex'
|
|
25
|
+
import { encodeTableRowKey, isRowKey } from './rowKey'
|
|
26
|
+
import type {
|
|
27
|
+
ChangeSet,
|
|
28
|
+
CommitResult,
|
|
29
|
+
DirtyCell,
|
|
30
|
+
RowKey,
|
|
31
|
+
TableChangeSubmission,
|
|
32
|
+
TableCommitKeyRemap,
|
|
33
|
+
TableCommitSettlement,
|
|
34
|
+
VersionConflict,
|
|
35
|
+
} from './types'
|
|
36
|
+
|
|
37
|
+
export interface PendingCreate<T extends TableRow> {
|
|
38
|
+
row: T
|
|
39
|
+
error?: unknown
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface PendingRemove<T extends TableRow> {
|
|
43
|
+
row: T
|
|
44
|
+
error?: unknown
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type TableRowIndex<T extends TableRow> = Map<string, TableRowTreeEntry<T>>
|
|
48
|
+
interface FieldGenerationEntry {
|
|
49
|
+
cellId: string
|
|
50
|
+
prop: string
|
|
51
|
+
changedAt: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface TableCommitSettlementHost<T extends TableRow> {
|
|
55
|
+
baseline: TableBaselineStore<T>
|
|
56
|
+
dirtyCells: TableDirtyCellIndex
|
|
57
|
+
creates: Map<string, PendingCreate<T>>
|
|
58
|
+
removes: Map<string, PendingRemove<T>>
|
|
59
|
+
fieldGenerations: Map<string, number>
|
|
60
|
+
versionConflicts: Map<string, VersionConflict<T>>
|
|
61
|
+
getRowKey: (row: T) => RowKey
|
|
62
|
+
setRowKey: (row: T, rowKey: RowKey) => void
|
|
63
|
+
getVersion?: (row: T) => string | number | undefined
|
|
64
|
+
deleteDirtyCells: (rowKey: RowKey) => void
|
|
65
|
+
invalidateConflictCaches: () => void
|
|
66
|
+
messages: TableEngineMessages
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type PreparedCreate<T extends TableRow> =
|
|
70
|
+
| {
|
|
71
|
+
status: 'missing' | 'failed'
|
|
72
|
+
clientKey: string
|
|
73
|
+
pending: PendingCreate<T>
|
|
74
|
+
error: unknown
|
|
75
|
+
}
|
|
76
|
+
| {
|
|
77
|
+
status: 'success'
|
|
78
|
+
clientKey: string
|
|
79
|
+
pending: PendingCreate<T>
|
|
80
|
+
currentEntry?: TableRowTreeEntry<T>
|
|
81
|
+
current: T
|
|
82
|
+
item?: CreateCommitResult<T>
|
|
83
|
+
nextKey: RowKey
|
|
84
|
+
serverBaseline: T
|
|
85
|
+
version: string | number | undefined
|
|
86
|
+
fieldGenerations: readonly FieldGenerationEntry[]
|
|
87
|
+
rootIndex: number
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
type PreparedUpdate<T extends TableRow> =
|
|
91
|
+
| {
|
|
92
|
+
status: 'missing'
|
|
93
|
+
cells: readonly DirtyCell[]
|
|
94
|
+
}
|
|
95
|
+
| {
|
|
96
|
+
status: 'failed'
|
|
97
|
+
key: string
|
|
98
|
+
update: ChangeSet<T>['updates'][number]
|
|
99
|
+
item: UpdateCommitResult<T>
|
|
100
|
+
cells: readonly DirtyCell[]
|
|
101
|
+
conflict?: VersionConflict<T>
|
|
102
|
+
}
|
|
103
|
+
| {
|
|
104
|
+
status: 'success'
|
|
105
|
+
key: string
|
|
106
|
+
update: ChangeSet<T>['updates'][number]
|
|
107
|
+
item?: UpdateCommitResult<T>
|
|
108
|
+
row?: T
|
|
109
|
+
serverBaseline: T
|
|
110
|
+
version: string | number | undefined
|
|
111
|
+
submittedCells?: ReadonlyMap<string, number>
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type PreparedRemove<T extends TableRow> =
|
|
115
|
+
| {
|
|
116
|
+
status: 'missing' | 'failed'
|
|
117
|
+
rowKey: RowKey
|
|
118
|
+
pending: PendingRemove<T>
|
|
119
|
+
error: unknown
|
|
120
|
+
}
|
|
121
|
+
| { status: 'success'; rowKey: RowKey; key: string }
|
|
122
|
+
|
|
123
|
+
const indexDirtyCellsByRow = (dirtyCells: TableDirtyCellIndex) => {
|
|
124
|
+
const result = new Map<string, Array<[string, DirtyCell]>>()
|
|
125
|
+
for (const entry of dirtyCells) {
|
|
126
|
+
const key = encodeTableRowKey(entry[1].rowKey)
|
|
127
|
+
const rowCells = result.get(key)
|
|
128
|
+
if (rowCells) rowCells.push(entry)
|
|
129
|
+
else result.set(key, [entry])
|
|
130
|
+
}
|
|
131
|
+
return result
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** 一次扫描建立 rowKey→字段世代索引,避免每个新增行重复扫描完整 Map。 */
|
|
135
|
+
const indexFieldGenerationsByRow = (
|
|
136
|
+
fieldGenerations: ReadonlyMap<string, number>
|
|
137
|
+
) => {
|
|
138
|
+
const result = new Map<string, FieldGenerationEntry[]>()
|
|
139
|
+
fieldGenerations.forEach((changedAt, cellId) => {
|
|
140
|
+
const separator = cellId.indexOf('\u0000')
|
|
141
|
+
if (separator < 0) return
|
|
142
|
+
const rowKey = cellId.slice(0, separator)
|
|
143
|
+
const entry = {
|
|
144
|
+
cellId,
|
|
145
|
+
prop: cellId.slice(separator + 1),
|
|
146
|
+
changedAt,
|
|
147
|
+
}
|
|
148
|
+
const entries = result.get(rowKey)
|
|
149
|
+
if (entries) entries.push(entry)
|
|
150
|
+
else result.set(rowKey, [entry])
|
|
151
|
+
})
|
|
152
|
+
return result
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const prepareCreates = <T extends TableRow>(options: {
|
|
156
|
+
host: TableCommitSettlementHost<T>
|
|
157
|
+
submission: TableChangeSubmission<T>
|
|
158
|
+
results: ReadonlyMap<string, CreateCommitResult<T>>
|
|
159
|
+
rowIndex: TableRowIndex<T>
|
|
160
|
+
hasExplicitResult: boolean
|
|
161
|
+
fieldGenerationsByRow: ReadonlyMap<string, readonly FieldGenerationEntry[]>
|
|
162
|
+
}) => {
|
|
163
|
+
const { host, submission, results, rowIndex, hasExplicitResult } = options
|
|
164
|
+
const prepared: PreparedCreate<T>[] = []
|
|
165
|
+
const reservedKeys = new Set(rowIndex.keys())
|
|
166
|
+
for (const submitted of submission.changeSet.creates) {
|
|
167
|
+
const clientKey = submitted.clientKey
|
|
168
|
+
const pending = host.creates.get(clientKey)
|
|
169
|
+
if (!pending) continue
|
|
170
|
+
const item = results.get(clientKey)
|
|
171
|
+
if (hasExplicitResult && !item) {
|
|
172
|
+
prepared.push({
|
|
173
|
+
status: 'missing',
|
|
174
|
+
clientKey,
|
|
175
|
+
pending,
|
|
176
|
+
error: host.messages.strMissingCreateResult,
|
|
177
|
+
})
|
|
178
|
+
continue
|
|
179
|
+
}
|
|
180
|
+
if (item?.success === false) {
|
|
181
|
+
prepared.push({
|
|
182
|
+
status: 'failed',
|
|
183
|
+
clientKey,
|
|
184
|
+
pending,
|
|
185
|
+
error: item.error,
|
|
186
|
+
})
|
|
187
|
+
continue
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const currentEntry = rowIndex.get(encodeTableRowKey(clientKey))
|
|
191
|
+
const current = currentEntry?.row ?? pending.row
|
|
192
|
+
const serverBaseline = cloneTableValue(submitted.value) as T
|
|
193
|
+
if (item?.row) Object.assign(serverBaseline, cloneTableValue(item.row))
|
|
194
|
+
const nextKey =
|
|
195
|
+
item?.rowKey ?? (item?.row ? host.getRowKey(serverBaseline) : undefined)
|
|
196
|
+
if (!isRowKey(nextKey)) {
|
|
197
|
+
throw new Error(
|
|
198
|
+
`[TableComponent] Commit succeeded for create "${clientKey}" but no valid server rowKey was returned.`
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
if (
|
|
202
|
+
typeof nextKey === 'string' &&
|
|
203
|
+
nextKey.startsWith(TABLE_CLIENT_ROW_KEY_PREFIX)
|
|
204
|
+
) {
|
|
205
|
+
throw new Error(
|
|
206
|
+
`[TableComponent] Commit succeeded for create "${clientKey}" but retained a client rowKey.`
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
host.setRowKey(serverBaseline, nextKey)
|
|
210
|
+
if (host.getRowKey(serverBaseline) !== nextKey) {
|
|
211
|
+
throw new Error(
|
|
212
|
+
'[TableComponent] A functional rowKey resolver requires the committed row to contain its new server identity.'
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
const currentPreview = cloneTableValue(current)
|
|
216
|
+
if (item?.row) Object.assign(currentPreview, cloneTableValue(item.row))
|
|
217
|
+
host.setRowKey(currentPreview, nextKey)
|
|
218
|
+
if (host.getRowKey(currentPreview) !== nextKey) {
|
|
219
|
+
throw new Error(
|
|
220
|
+
'[TableComponent] The committed row does not resolve to the returned server rowKey.'
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
const encodedNextKey = encodeTableRowKey(nextKey)
|
|
224
|
+
const encodedClientKey = encodeTableRowKey(clientKey)
|
|
225
|
+
reservedKeys.delete(encodedClientKey)
|
|
226
|
+
if (
|
|
227
|
+
encodedNextKey !== encodedClientKey &&
|
|
228
|
+
reservedKeys.has(encodedNextKey)
|
|
229
|
+
) {
|
|
230
|
+
throw new Error(
|
|
231
|
+
`[TableComponent] Server rowKey "${String(nextKey)}" is already used by another row.`
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
reservedKeys.add(encodedNextKey)
|
|
235
|
+
|
|
236
|
+
prepared.push({
|
|
237
|
+
status: 'success',
|
|
238
|
+
clientKey,
|
|
239
|
+
pending,
|
|
240
|
+
currentEntry,
|
|
241
|
+
current,
|
|
242
|
+
item,
|
|
243
|
+
nextKey,
|
|
244
|
+
serverBaseline,
|
|
245
|
+
version: host.getVersion?.(serverBaseline),
|
|
246
|
+
fieldGenerations:
|
|
247
|
+
options.fieldGenerationsByRow.get(encodedClientKey) ?? [],
|
|
248
|
+
rootIndex: currentEntry?.path.length === 1 ? currentEntry.index : -1,
|
|
249
|
+
})
|
|
250
|
+
}
|
|
251
|
+
return prepared
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const prepareConflict = <T extends TableRow>(
|
|
255
|
+
host: TableCommitSettlementHost<T>,
|
|
256
|
+
key: string,
|
|
257
|
+
update: ChangeSet<T>['updates'][number],
|
|
258
|
+
item: UpdateCommitResult<T>,
|
|
259
|
+
rowIndex: TableRowIndex<T>,
|
|
260
|
+
submissionGeneration: number
|
|
261
|
+
): VersionConflict<T> | undefined => {
|
|
262
|
+
if (!item.conflict) return
|
|
263
|
+
const serverRow = cloneTableValue(item.conflict.serverRow)
|
|
264
|
+
const userPatch: Partial<T> = cloneTableValue(update.patch)
|
|
265
|
+
const row = rowIndex.get(key)?.row
|
|
266
|
+
if (row) {
|
|
267
|
+
const prefix = `${key}\u0000`
|
|
268
|
+
for (const [fieldKey, changedAt] of host.fieldGenerations) {
|
|
269
|
+
if (!fieldKey.startsWith(prefix) || changedAt <= submissionGeneration)
|
|
270
|
+
continue
|
|
271
|
+
const prop = fieldKey.slice(prefix.length)
|
|
272
|
+
const current = getTableRowValue(row, prop)
|
|
273
|
+
const server = getTableRowValue(serverRow, prop)
|
|
274
|
+
if (Object.is(current, server)) deleteTableRowValue(userPatch, prop)
|
|
275
|
+
else setTableRowValue(userPatch, prop, cloneTableValue(current))
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
rowKey: update.rowKey,
|
|
280
|
+
baseVersion: update.baseVersion,
|
|
281
|
+
serverVersion: item.conflict.serverVersion ?? host.getVersion?.(serverRow),
|
|
282
|
+
serverRow,
|
|
283
|
+
userPatch,
|
|
284
|
+
fields: item.conflict.fields?.map(String) ?? Object.keys(userPatch),
|
|
285
|
+
code: item.conflict.code,
|
|
286
|
+
error: item.error,
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const prepareUpdates = <T extends TableRow>(options: {
|
|
291
|
+
host: TableCommitSettlementHost<T>
|
|
292
|
+
submission: TableChangeSubmission<T>
|
|
293
|
+
results: ReadonlyMap<string, UpdateCommitResult<T>>
|
|
294
|
+
rowIndex: TableRowIndex<T>
|
|
295
|
+
hasExplicitResult: boolean
|
|
296
|
+
}) => {
|
|
297
|
+
const prepared: PreparedUpdate<T>[] = []
|
|
298
|
+
options.submission.changeSet.updates.forEach((update) => {
|
|
299
|
+
const key = encodeTableRowKey(update.rowKey)
|
|
300
|
+
const submittedCells = options.submission.cellGenerationsByRow.get(key)
|
|
301
|
+
const cells = [...(submittedCells?.keys() ?? [])]
|
|
302
|
+
.map((prop) => options.host.dirtyCells.get(cellKey(update.rowKey, prop)))
|
|
303
|
+
.filter((cell): cell is DirtyCell => Boolean(cell))
|
|
304
|
+
const item = options.results.get(key)
|
|
305
|
+
if (options.hasExplicitResult && !item) {
|
|
306
|
+
prepared.push({ status: 'missing', cells })
|
|
307
|
+
return
|
|
308
|
+
}
|
|
309
|
+
if (item?.success === false) {
|
|
310
|
+
prepared.push({
|
|
311
|
+
status: 'failed',
|
|
312
|
+
key,
|
|
313
|
+
update,
|
|
314
|
+
item,
|
|
315
|
+
cells,
|
|
316
|
+
conflict: prepareConflict(
|
|
317
|
+
options.host,
|
|
318
|
+
key,
|
|
319
|
+
update,
|
|
320
|
+
item,
|
|
321
|
+
options.rowIndex,
|
|
322
|
+
options.submission.generation
|
|
323
|
+
),
|
|
324
|
+
})
|
|
325
|
+
return
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const row = options.rowIndex.get(key)?.row
|
|
329
|
+
const previousBaseline = options.host.baseline.getRow(key)
|
|
330
|
+
const serverBaseline = cloneTableValue(previousBaseline ?? row ?? ({} as T))
|
|
331
|
+
Object.entries(update.patch).forEach(([prop, value]) =>
|
|
332
|
+
setTableRowValue(serverBaseline, prop, cloneTableValue(value))
|
|
333
|
+
)
|
|
334
|
+
if (item?.row) Object.assign(serverBaseline, cloneTableValue(item.row))
|
|
335
|
+
prepared.push({
|
|
336
|
+
status: 'success',
|
|
337
|
+
key,
|
|
338
|
+
update,
|
|
339
|
+
item,
|
|
340
|
+
row,
|
|
341
|
+
serverBaseline,
|
|
342
|
+
version: options.host.getVersion?.(serverBaseline),
|
|
343
|
+
submittedCells,
|
|
344
|
+
})
|
|
345
|
+
})
|
|
346
|
+
return prepared
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const prepareRemoves = <T extends TableRow>(options: {
|
|
350
|
+
host: TableCommitSettlementHost<T>
|
|
351
|
+
submission: TableChangeSubmission<T>
|
|
352
|
+
results: ReadonlyMap<string, RemoveCommitResult<T>>
|
|
353
|
+
hasExplicitResult: boolean
|
|
354
|
+
}) =>
|
|
355
|
+
options.submission.changeSet.removes.flatMap(
|
|
356
|
+
(submitted): PreparedRemove<T>[] => {
|
|
357
|
+
const rowKey = submitted.rowKey
|
|
358
|
+
const key = encodeTableRowKey(rowKey)
|
|
359
|
+
const pending = options.host.removes.get(key)
|
|
360
|
+
if (!pending) return []
|
|
361
|
+
const item = options.results.get(key)
|
|
362
|
+
if (options.hasExplicitResult && !item) {
|
|
363
|
+
return [
|
|
364
|
+
{
|
|
365
|
+
status: 'missing',
|
|
366
|
+
rowKey,
|
|
367
|
+
pending,
|
|
368
|
+
error: options.host.messages.strMissingRemoveResult,
|
|
369
|
+
},
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
if (item?.success === false) {
|
|
373
|
+
return [{ status: 'failed', rowKey, pending, error: item.error }]
|
|
374
|
+
}
|
|
375
|
+
return [{ status: 'success', rowKey, key }]
|
|
376
|
+
}
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
const setUpdateErrors = (
|
|
380
|
+
dirtyCells: TableDirtyCellIndex,
|
|
381
|
+
cells: readonly DirtyCell[],
|
|
382
|
+
error: unknown
|
|
383
|
+
) => {
|
|
384
|
+
cells.forEach((cell) => {
|
|
385
|
+
dirtyCells.upsert(cellKey(cell.rowKey, cell.prop), { ...cell, error })
|
|
386
|
+
})
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const remapCreateFieldGenerations = <T extends TableRow>(
|
|
390
|
+
host: TableCommitSettlementHost<T>,
|
|
391
|
+
prepared: Extract<PreparedCreate<T>, { status: 'success' }>,
|
|
392
|
+
submissionGeneration: number
|
|
393
|
+
) => {
|
|
394
|
+
prepared.fieldGenerations.forEach(({ cellId, prop, changedAt }) => {
|
|
395
|
+
host.fieldGenerations.delete(cellId)
|
|
396
|
+
if (changedAt <= submissionGeneration) return
|
|
397
|
+
const nextCellKey = cellKey(prepared.nextKey, prop)
|
|
398
|
+
host.fieldGenerations.set(nextCellKey, changedAt)
|
|
399
|
+
const original = getTableRowValue(prepared.serverBaseline, prop)
|
|
400
|
+
const currentValue = getTableRowValue(prepared.current, prop)
|
|
401
|
+
if (!Object.is(original, currentValue)) {
|
|
402
|
+
host.dirtyCells.upsert(nextCellKey, {
|
|
403
|
+
rowKey: prepared.nextKey,
|
|
404
|
+
prop,
|
|
405
|
+
original,
|
|
406
|
+
current: currentValue,
|
|
407
|
+
})
|
|
408
|
+
}
|
|
409
|
+
})
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
const reconcileDirtyCellsAfterUpdate = <T extends TableRow>(options: {
|
|
413
|
+
host: TableCommitSettlementHost<T>
|
|
414
|
+
rowKey: RowKey
|
|
415
|
+
row: T
|
|
416
|
+
serverBaseline: T
|
|
417
|
+
currentRowCells: readonly [string, DirtyCell][]
|
|
418
|
+
submittedCells?: ReadonlyMap<string, number>
|
|
419
|
+
}) => {
|
|
420
|
+
const visitedProps = new Set<string>()
|
|
421
|
+
for (const [cellId, cell] of options.currentRowCells) {
|
|
422
|
+
visitedProps.add(cell.prop)
|
|
423
|
+
const submittedAt = options.submittedCells?.get(cell.prop)
|
|
424
|
+
const currentAt = options.host.fieldGenerations.get(cellId)
|
|
425
|
+
if (submittedAt !== undefined && currentAt === submittedAt) {
|
|
426
|
+
options.host.dirtyCells.delete(cellId)
|
|
427
|
+
options.host.fieldGenerations.delete(cellId)
|
|
428
|
+
continue
|
|
429
|
+
}
|
|
430
|
+
const original = getTableRowValue(options.serverBaseline, cell.prop)
|
|
431
|
+
const current = getTableRowValue(options.row, cell.prop)
|
|
432
|
+
if (Object.is(original, current)) {
|
|
433
|
+
options.host.dirtyCells.delete(cellId)
|
|
434
|
+
options.host.fieldGenerations.delete(cellId)
|
|
435
|
+
} else {
|
|
436
|
+
options.host.dirtyCells.upsert(cellId, {
|
|
437
|
+
...cell,
|
|
438
|
+
original,
|
|
439
|
+
current,
|
|
440
|
+
error: undefined,
|
|
441
|
+
})
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
for (const [prop, submittedAt] of options.submittedCells ?? []) {
|
|
445
|
+
if (visitedProps.has(prop)) continue
|
|
446
|
+
const cellId = cellKey(options.rowKey, prop)
|
|
447
|
+
const currentAt = options.host.fieldGenerations.get(cellId)
|
|
448
|
+
if (currentAt === undefined || currentAt === submittedAt) {
|
|
449
|
+
options.host.fieldGenerations.delete(cellId)
|
|
450
|
+
continue
|
|
451
|
+
}
|
|
452
|
+
const original = getTableRowValue(options.serverBaseline, prop)
|
|
453
|
+
const current = getTableRowValue(options.row, prop)
|
|
454
|
+
if (Object.is(original, current)) {
|
|
455
|
+
options.host.fieldGenerations.delete(cellId)
|
|
456
|
+
continue
|
|
457
|
+
}
|
|
458
|
+
options.host.dirtyCells.upsert(cellId, {
|
|
459
|
+
rowKey: options.rowKey,
|
|
460
|
+
prop,
|
|
461
|
+
original,
|
|
462
|
+
current,
|
|
463
|
+
})
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* 先解析所有服务端结果和业务回调,再进入不可异步、不可调用外部函数的提交区。
|
|
469
|
+
* submission 必须来自请求发出前,禁止在响应阶段捕获实时 tracker 状态。
|
|
470
|
+
*/
|
|
471
|
+
export const applyTableCommitSettlement = <T extends TableRow>(options: {
|
|
472
|
+
host: TableCommitSettlementHost<T>
|
|
473
|
+
rows: T[]
|
|
474
|
+
result: CommitResult<T> | undefined
|
|
475
|
+
submission: TableChangeSubmission<T>
|
|
476
|
+
}): TableCommitSettlement<T> => {
|
|
477
|
+
const { host, rows, result, submission } = options
|
|
478
|
+
const hasExplicitResult = result !== undefined
|
|
479
|
+
const indexedResults = indexTableCommitResults(submission, result)
|
|
480
|
+
const createResults = indexedResults.creates
|
|
481
|
+
const updateResults = indexedResults.updates
|
|
482
|
+
const removeResults = indexedResults.removes
|
|
483
|
+
const rowIndex = createTableRowIndex(rows, (row) =>
|
|
484
|
+
encodeTableRowKey(host.getRowKey(row))
|
|
485
|
+
)
|
|
486
|
+
const fieldGenerationsByRow = indexFieldGenerationsByRow(
|
|
487
|
+
host.fieldGenerations
|
|
488
|
+
)
|
|
489
|
+
const creates = prepareCreates({
|
|
490
|
+
host,
|
|
491
|
+
submission,
|
|
492
|
+
results: createResults,
|
|
493
|
+
rowIndex,
|
|
494
|
+
hasExplicitResult,
|
|
495
|
+
fieldGenerationsByRow,
|
|
496
|
+
})
|
|
497
|
+
const updates = prepareUpdates({
|
|
498
|
+
host,
|
|
499
|
+
submission,
|
|
500
|
+
results: updateResults,
|
|
501
|
+
rowIndex,
|
|
502
|
+
hasExplicitResult,
|
|
503
|
+
})
|
|
504
|
+
const removes = prepareRemoves({
|
|
505
|
+
host,
|
|
506
|
+
submission,
|
|
507
|
+
results: removeResults,
|
|
508
|
+
hasExplicitResult,
|
|
509
|
+
})
|
|
510
|
+
const successfulCreates = creates.filter(
|
|
511
|
+
(item): item is Extract<PreparedCreate<T>, { status: 'success' }> =>
|
|
512
|
+
item.status === 'success'
|
|
513
|
+
)
|
|
514
|
+
const successfulUpdates = updates.filter(
|
|
515
|
+
(item): item is Extract<PreparedUpdate<T>, { status: 'success' }> =>
|
|
516
|
+
item.status === 'success'
|
|
517
|
+
)
|
|
518
|
+
const successfulRemoves = removes.filter(
|
|
519
|
+
(item): item is Extract<PreparedRemove<T>, { status: 'success' }> =>
|
|
520
|
+
item.status === 'success'
|
|
521
|
+
)
|
|
522
|
+
const commitBaseline = host.baseline.prepareSettlement({
|
|
523
|
+
upserts: [
|
|
524
|
+
...successfulCreates.map((item) => ({
|
|
525
|
+
key: encodeTableRowKey(item.nextKey),
|
|
526
|
+
row: item.serverBaseline,
|
|
527
|
+
version: item.version,
|
|
528
|
+
rootIndex: item.rootIndex,
|
|
529
|
+
})),
|
|
530
|
+
...successfulUpdates.flatMap((item) =>
|
|
531
|
+
item.row
|
|
532
|
+
? [
|
|
533
|
+
{
|
|
534
|
+
key: item.key,
|
|
535
|
+
row: item.serverBaseline,
|
|
536
|
+
version: item.version,
|
|
537
|
+
},
|
|
538
|
+
]
|
|
539
|
+
: []
|
|
540
|
+
),
|
|
541
|
+
],
|
|
542
|
+
removedKeys: new Set(successfulRemoves.map((item) => item.key)),
|
|
543
|
+
getEncodedKey: (row) => encodeTableRowKey(host.getRowKey(row)),
|
|
544
|
+
})
|
|
545
|
+
|
|
546
|
+
const keyRemaps: TableCommitKeyRemap<T>[] = []
|
|
547
|
+
creates.forEach((prepared) => {
|
|
548
|
+
if (prepared.status !== 'success') {
|
|
549
|
+
prepared.pending.error = prepared.error
|
|
550
|
+
return
|
|
551
|
+
}
|
|
552
|
+
if (prepared.item?.row) {
|
|
553
|
+
Object.entries(prepared.item.row).forEach(([prop, value]) => {
|
|
554
|
+
const changedAt = host.fieldGenerations.get(
|
|
555
|
+
cellKey(prepared.clientKey, prop)
|
|
556
|
+
)
|
|
557
|
+
if (!changedAt || changedAt <= submission.generation) {
|
|
558
|
+
setTableRowValue(prepared.current, prop, value)
|
|
559
|
+
}
|
|
560
|
+
})
|
|
561
|
+
}
|
|
562
|
+
host.setRowKey(prepared.current, prepared.nextKey)
|
|
563
|
+
host.creates.delete(prepared.clientKey)
|
|
564
|
+
remapCreateFieldGenerations(host, prepared, submission.generation)
|
|
565
|
+
keyRemaps.push({
|
|
566
|
+
previousKey: prepared.clientKey,
|
|
567
|
+
nextKey: prepared.nextKey,
|
|
568
|
+
row: prepared.current,
|
|
569
|
+
})
|
|
570
|
+
})
|
|
571
|
+
|
|
572
|
+
const dirtyCellsByRow = indexDirtyCellsByRow(host.dirtyCells)
|
|
573
|
+
updates.forEach((prepared) => {
|
|
574
|
+
if (prepared.status === 'missing') {
|
|
575
|
+
setUpdateErrors(
|
|
576
|
+
host.dirtyCells,
|
|
577
|
+
prepared.cells,
|
|
578
|
+
host.messages.strMissingUpdateResult
|
|
579
|
+
)
|
|
580
|
+
return
|
|
581
|
+
}
|
|
582
|
+
if (prepared.status === 'failed') {
|
|
583
|
+
if (prepared.conflict) {
|
|
584
|
+
host.versionConflicts.set(prepared.key, prepared.conflict)
|
|
585
|
+
host.invalidateConflictCaches()
|
|
586
|
+
}
|
|
587
|
+
prepared.cells.forEach((cell) => {
|
|
588
|
+
host.dirtyCells.upsert(cellKey(cell.rowKey, cell.prop), {
|
|
589
|
+
...cell,
|
|
590
|
+
error:
|
|
591
|
+
prepared.item.fieldErrors?.[cell.prop] ??
|
|
592
|
+
prepared.item.error ??
|
|
593
|
+
(prepared.item.conflict
|
|
594
|
+
? host.messages.strServerDataUpdated
|
|
595
|
+
: host.messages.strSaveFailed),
|
|
596
|
+
})
|
|
597
|
+
})
|
|
598
|
+
return
|
|
599
|
+
}
|
|
600
|
+
if (prepared.row && prepared.item?.row) {
|
|
601
|
+
Object.entries(prepared.item.row).forEach(([prop, value]) => {
|
|
602
|
+
const changedAt = host.fieldGenerations.get(
|
|
603
|
+
cellKey(prepared.update.rowKey, prop)
|
|
604
|
+
)
|
|
605
|
+
if (!changedAt || changedAt <= submission.generation) {
|
|
606
|
+
setTableRowValue(prepared.row!, prop, value)
|
|
607
|
+
}
|
|
608
|
+
})
|
|
609
|
+
}
|
|
610
|
+
if (host.versionConflicts.delete(prepared.key))
|
|
611
|
+
host.invalidateConflictCaches()
|
|
612
|
+
if (!prepared.row) return
|
|
613
|
+
reconcileDirtyCellsAfterUpdate({
|
|
614
|
+
host,
|
|
615
|
+
rowKey: prepared.update.rowKey,
|
|
616
|
+
row: prepared.row,
|
|
617
|
+
serverBaseline: prepared.serverBaseline,
|
|
618
|
+
currentRowCells: dirtyCellsByRow.get(prepared.key) ?? [],
|
|
619
|
+
submittedCells: prepared.submittedCells,
|
|
620
|
+
})
|
|
621
|
+
})
|
|
622
|
+
|
|
623
|
+
removes.forEach((prepared) => {
|
|
624
|
+
if (prepared.status !== 'success') {
|
|
625
|
+
prepared.pending.error = prepared.error
|
|
626
|
+
return
|
|
627
|
+
}
|
|
628
|
+
host.removes.delete(prepared.key)
|
|
629
|
+
host.deleteDirtyCells(prepared.rowKey)
|
|
630
|
+
})
|
|
631
|
+
commitBaseline()
|
|
632
|
+
return { rows, keyRemaps: Object.freeze(keyRemaps) }
|
|
633
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { TableRow } from '../../shared/types'
|
|
2
|
+
import { encodeTableRowKey } from './rowKey'
|
|
3
|
+
import type { CommitResult, TableChangeSubmission } from './types'
|
|
4
|
+
|
|
5
|
+
export type CreateCommitResult<T extends TableRow> = NonNullable<
|
|
6
|
+
CommitResult<T>['creates']
|
|
7
|
+
>[number]
|
|
8
|
+
export type UpdateCommitResult<T extends TableRow> = NonNullable<
|
|
9
|
+
CommitResult<T>['updates']
|
|
10
|
+
>[number]
|
|
11
|
+
export type RemoveCommitResult<T extends TableRow> = NonNullable<
|
|
12
|
+
CommitResult<T>['removes']
|
|
13
|
+
>[number]
|
|
14
|
+
|
|
15
|
+
const indexCommitResults = <T>(options: {
|
|
16
|
+
items: readonly T[] | undefined
|
|
17
|
+
getKey: (item: T) => string
|
|
18
|
+
submittedKeys: ReadonlySet<string>
|
|
19
|
+
label: string
|
|
20
|
+
}) => {
|
|
21
|
+
const result = new Map<string, T>()
|
|
22
|
+
for (const item of options.items ?? []) {
|
|
23
|
+
const key = options.getKey(item)
|
|
24
|
+
if (!options.submittedKeys.has(key)) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`[TableComponent] Server returned an unknown ${options.label} result "${key}".`
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
if (result.has(key)) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`[TableComponent] Server returned duplicate ${options.label} results for "${key}".`
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
result.set(key, item)
|
|
35
|
+
}
|
|
36
|
+
return result
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** 在提交任何状态前验证服务端结果只包含本次 submission 的唯一事务项。 */
|
|
40
|
+
export const indexTableCommitResults = <T extends TableRow>(
|
|
41
|
+
submission: TableChangeSubmission<T>,
|
|
42
|
+
result: CommitResult<T> | undefined
|
|
43
|
+
) => {
|
|
44
|
+
const submitted = {
|
|
45
|
+
creates: new Set(
|
|
46
|
+
submission.changeSet.creates.map((item) => item.clientKey)
|
|
47
|
+
),
|
|
48
|
+
updates: new Set(
|
|
49
|
+
submission.changeSet.updates.map((item) => encodeTableRowKey(item.rowKey))
|
|
50
|
+
),
|
|
51
|
+
removes: new Set(
|
|
52
|
+
submission.changeSet.removes.map((item) => encodeTableRowKey(item.rowKey))
|
|
53
|
+
),
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
creates: indexCommitResults({
|
|
57
|
+
items: result?.creates,
|
|
58
|
+
getKey: (item) => item.clientKey,
|
|
59
|
+
submittedKeys: submitted.creates,
|
|
60
|
+
label: 'create',
|
|
61
|
+
}),
|
|
62
|
+
updates: indexCommitResults({
|
|
63
|
+
items: result?.updates,
|
|
64
|
+
getKey: (item) => encodeTableRowKey(item.rowKey),
|
|
65
|
+
submittedKeys: submitted.updates,
|
|
66
|
+
label: 'update',
|
|
67
|
+
}),
|
|
68
|
+
removes: indexCommitResults({
|
|
69
|
+
items: result?.removes,
|
|
70
|
+
getKey: (item) => encodeTableRowKey(item.rowKey),
|
|
71
|
+
submittedKeys: submitted.removes,
|
|
72
|
+
label: 'remove',
|
|
73
|
+
}),
|
|
74
|
+
}
|
|
75
|
+
}
|