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,703 @@
|
|
|
1
|
+
import { execFileSync, spawnSync } from 'node:child_process'
|
|
2
|
+
import { access, readFile } from 'node:fs/promises'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
|
|
6
|
+
const strToolDirectory = path.dirname(fileURLToPath(import.meta.url))
|
|
7
|
+
const strProjectRoot = path.resolve(strToolDirectory, '../..')
|
|
8
|
+
const strDefaultManifest = path.resolve(strToolDirectory, 'manifest.json')
|
|
9
|
+
const strSourceManifestReference = 'tools/component-governance/manifest.json'
|
|
10
|
+
const objRevisionPattern = /^[a-f0-9]{40}$/
|
|
11
|
+
const objEmbeddedRevisionPattern = /\b[a-f0-9]{40}\b/i
|
|
12
|
+
|
|
13
|
+
class ComponentGovernanceError extends Error {
|
|
14
|
+
constructor(strCode, strMessage, strFix) {
|
|
15
|
+
super(strMessage)
|
|
16
|
+
this.name = 'ComponentGovernanceError'
|
|
17
|
+
this.strCode = strCode
|
|
18
|
+
this.strFix = strFix
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const fnFail = (strCode, strMessage, strFix) => {
|
|
23
|
+
throw new ComponentGovernanceError(strCode, strMessage, strFix)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const fnRequireString = (value, strPath) => {
|
|
27
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
28
|
+
fnFail(
|
|
29
|
+
'COMPONENT_MANIFEST_INVALID',
|
|
30
|
+
`${strPath} 必须是非空字符串。`,
|
|
31
|
+
`修复 ${strSourceManifestReference} 后重试。`
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
return value
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const fnRequireStringArray = (value, strPath) => {
|
|
38
|
+
if (
|
|
39
|
+
!Array.isArray(value) ||
|
|
40
|
+
value.length === 0 ||
|
|
41
|
+
value.some((strValue) => typeof strValue !== 'string' || !strValue.trim())
|
|
42
|
+
) {
|
|
43
|
+
fnFail(
|
|
44
|
+
'COMPONENT_MANIFEST_INVALID',
|
|
45
|
+
`${strPath} 必须是非空字符串数组。`,
|
|
46
|
+
`修复 ${strSourceManifestReference} 后重试。`
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
return value
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const fnResolveProjectPath = (strRelativePath) => {
|
|
53
|
+
const strPath = fnRequireString(strRelativePath, '项目相对路径')
|
|
54
|
+
if (path.isAbsolute(strPath)) {
|
|
55
|
+
fnFail(
|
|
56
|
+
'COMPONENT_MANIFEST_PATH_INVALID',
|
|
57
|
+
`清单路径不能是绝对路径:${strPath}。`,
|
|
58
|
+
'只记录仓库根目录下的相对路径。'
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
const strResolvedPath = path.resolve(strProjectRoot, strPath)
|
|
62
|
+
if (
|
|
63
|
+
strResolvedPath !== strProjectRoot &&
|
|
64
|
+
!strResolvedPath.startsWith(`${strProjectRoot}${path.sep}`)
|
|
65
|
+
) {
|
|
66
|
+
fnFail(
|
|
67
|
+
'COMPONENT_MANIFEST_PATH_INVALID',
|
|
68
|
+
`清单路径越过了仓库边界:${strPath}。`,
|
|
69
|
+
'删除 .. 路径段并只引用当前仓库文件。'
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
return strResolvedPath
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const fnReadJson = async (strFilePath, strCode) => {
|
|
76
|
+
try {
|
|
77
|
+
return JSON.parse(await readFile(strFilePath, 'utf8'))
|
|
78
|
+
} catch (objError) {
|
|
79
|
+
fnFail(
|
|
80
|
+
strCode,
|
|
81
|
+
`${path.relative(strProjectRoot, strFilePath)} 不存在或不是有效 JSON。`,
|
|
82
|
+
objError instanceof Error ? objError.message : '修复 JSON 后重试。'
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const fnAssertFile = async (strRelativePath, strCode, strFix) => {
|
|
88
|
+
const strFilePath = fnResolveProjectPath(strRelativePath)
|
|
89
|
+
try {
|
|
90
|
+
await access(strFilePath)
|
|
91
|
+
} catch {
|
|
92
|
+
fnFail(strCode, `缺少 ${strRelativePath}。`, strFix)
|
|
93
|
+
}
|
|
94
|
+
return strFilePath
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const fnValidateManifest = (objManifest) => {
|
|
98
|
+
if (!objManifest || typeof objManifest !== 'object') {
|
|
99
|
+
fnFail(
|
|
100
|
+
'COMPONENT_MANIFEST_INVALID',
|
|
101
|
+
'组件源码清单必须是 JSON 对象。',
|
|
102
|
+
`修复 ${strSourceManifestReference} 后重试。`
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
if (objManifest.schemaVersion !== 1) {
|
|
106
|
+
fnFail(
|
|
107
|
+
'COMPONENT_MANIFEST_VERSION_UNSUPPORTED',
|
|
108
|
+
`不支持 schemaVersion ${String(objManifest.schemaVersion)}。`,
|
|
109
|
+
'使用当前脚本支持的 schemaVersion 1。'
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
if (
|
|
113
|
+
!Array.isArray(objManifest.components) ||
|
|
114
|
+
objManifest.components.length === 0
|
|
115
|
+
) {
|
|
116
|
+
fnFail(
|
|
117
|
+
'COMPONENT_MANIFEST_INVALID',
|
|
118
|
+
'components 必须是非空数组。',
|
|
119
|
+
`修复 ${strSourceManifestReference} 后重试。`
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
if (!Array.isArray(objManifest.thirdParty)) {
|
|
123
|
+
fnFail(
|
|
124
|
+
'COMPONENT_MANIFEST_INVALID',
|
|
125
|
+
'thirdParty 必须是数组。',
|
|
126
|
+
`修复 ${strSourceManifestReference} 后重试。`
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const objNames = new Set()
|
|
131
|
+
const objLocalPaths = new Set()
|
|
132
|
+
for (const [nIndex, objComponent] of objManifest.components.entries()) {
|
|
133
|
+
const strPrefix = `components[${nIndex}]`
|
|
134
|
+
const strName = fnRequireString(objComponent?.name, `${strPrefix}.name`)
|
|
135
|
+
if (objNames.has(strName)) {
|
|
136
|
+
fnFail(
|
|
137
|
+
'COMPONENT_MANIFEST_DUPLICATE',
|
|
138
|
+
`组件 ${strName} 在清单中重复。`,
|
|
139
|
+
'每个内建组件只保留一条来源记录。'
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
objNames.add(strName)
|
|
143
|
+
const strLocalPath = fnRequireString(
|
|
144
|
+
objComponent.localPath,
|
|
145
|
+
`${strPrefix}.localPath`
|
|
146
|
+
)
|
|
147
|
+
if (objLocalPaths.has(strLocalPath)) {
|
|
148
|
+
fnFail(
|
|
149
|
+
'COMPONENT_MANIFEST_DUPLICATE',
|
|
150
|
+
`本地源码路径 ${strLocalPath} 在清单中重复。`,
|
|
151
|
+
'每个源码目录只能归属于一个内建组件。'
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
objLocalPaths.add(strLocalPath)
|
|
155
|
+
const strPublicEntry = fnRequireString(
|
|
156
|
+
objComponent.publicEntry,
|
|
157
|
+
`${strPrefix}.publicEntry`
|
|
158
|
+
)
|
|
159
|
+
const strSourceNote = fnRequireString(
|
|
160
|
+
objComponent.sourceNote,
|
|
161
|
+
`${strPrefix}.sourceNote`
|
|
162
|
+
)
|
|
163
|
+
if (
|
|
164
|
+
strPublicEntry !== `${strLocalPath}/index.ts` ||
|
|
165
|
+
strSourceNote !== `${strLocalPath}/SOURCE.md`
|
|
166
|
+
) {
|
|
167
|
+
fnFail(
|
|
168
|
+
'COMPONENT_MANIFEST_PATH_INVALID',
|
|
169
|
+
`${strName} 的公共入口或 SOURCE.md 不在组件根目录。`,
|
|
170
|
+
'使用 <localPath>/index.ts 与 <localPath>/SOURCE.md,避免额外模块层。'
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
fnRequireString(
|
|
174
|
+
objComponent.source?.repository,
|
|
175
|
+
`${strPrefix}.source.repository`
|
|
176
|
+
)
|
|
177
|
+
const strRevision = fnRequireString(
|
|
178
|
+
objComponent.source?.revision,
|
|
179
|
+
`${strPrefix}.source.revision`
|
|
180
|
+
)
|
|
181
|
+
if (!objRevisionPattern.test(strRevision)) {
|
|
182
|
+
fnFail(
|
|
183
|
+
'COMPONENT_SOURCE_REVISION_INVALID',
|
|
184
|
+
`${strName} 的 revision 必须是完整的 40 位 Git Commit。`,
|
|
185
|
+
'从干净来源仓库执行 git rev-parse HEAD 后更新清单。'
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
fnRequireString(
|
|
189
|
+
objComponent.source.packageVersion,
|
|
190
|
+
`${strPrefix}.source.packageVersion`
|
|
191
|
+
)
|
|
192
|
+
fnRequireString(
|
|
193
|
+
objComponent.source.importedAt,
|
|
194
|
+
`${strPrefix}.source.importedAt`
|
|
195
|
+
)
|
|
196
|
+
fnRequireStringArray(
|
|
197
|
+
objComponent.source.includedPaths,
|
|
198
|
+
`${strPrefix}.source.includedPaths`
|
|
199
|
+
)
|
|
200
|
+
fnRequireStringArray(
|
|
201
|
+
objComponent.source.excludedCapabilities,
|
|
202
|
+
`${strPrefix}.source.excludedCapabilities`
|
|
203
|
+
)
|
|
204
|
+
const strLicenseStatus = fnRequireString(
|
|
205
|
+
objComponent.source.license?.status,
|
|
206
|
+
`${strPrefix}.source.license.status`
|
|
207
|
+
)
|
|
208
|
+
const strDistributionPolicy = fnRequireString(
|
|
209
|
+
objComponent.source.license?.distributionPolicy,
|
|
210
|
+
`${strPrefix}.source.license.distributionPolicy`
|
|
211
|
+
)
|
|
212
|
+
if (!['documented', 'not-provided'].includes(strLicenseStatus)) {
|
|
213
|
+
fnFail(
|
|
214
|
+
'COMPONENT_SOURCE_LICENSE_STATUS_INVALID',
|
|
215
|
+
`${strName} 使用了未知许可证状态 ${strLicenseStatus}。`,
|
|
216
|
+
'只使用 not-provided 或完成权属材料后的 documented。'
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
if (!['authorized', 'internal-only'].includes(strDistributionPolicy)) {
|
|
220
|
+
fnFail(
|
|
221
|
+
'COMPONENT_SOURCE_DISTRIBUTION_INVALID',
|
|
222
|
+
`${strName} 使用了未知分发策略 ${strDistributionPolicy}。`,
|
|
223
|
+
'只使用 internal-only 或取得书面授权后的 authorized。'
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
if (
|
|
227
|
+
strLicenseStatus === 'not-provided' &&
|
|
228
|
+
strDistributionPolicy !== 'internal-only'
|
|
229
|
+
) {
|
|
230
|
+
fnFail(
|
|
231
|
+
'COMPONENT_SOURCE_DISTRIBUTION_UNSAFE',
|
|
232
|
+
`${strName} 未提供许可证,却声明为 ${strDistributionPolicy}。`,
|
|
233
|
+
'在取得书面权属与再分发授权前保持 internal-only。'
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
fnRequireStringArray(
|
|
237
|
+
objComponent.localAdaptations,
|
|
238
|
+
`${strPrefix}.localAdaptations`
|
|
239
|
+
)
|
|
240
|
+
fnRequireStringArray(
|
|
241
|
+
objComponent.regressionTests,
|
|
242
|
+
`${strPrefix}.regressionTests`
|
|
243
|
+
)
|
|
244
|
+
const arrRequiredCommands = fnRequireStringArray(
|
|
245
|
+
objComponent.requiredCommands,
|
|
246
|
+
`${strPrefix}.requiredCommands`
|
|
247
|
+
)
|
|
248
|
+
if (
|
|
249
|
+
!arrRequiredCommands.includes('pnpm components:check') ||
|
|
250
|
+
!arrRequiredCommands.includes('pnpm verify')
|
|
251
|
+
) {
|
|
252
|
+
fnFail(
|
|
253
|
+
'COMPONENT_REGRESSION_COMMAND_MISSING',
|
|
254
|
+
`${strName} 缺少标准治理或全量验证命令。`,
|
|
255
|
+
'requiredCommands 必须同时包含 pnpm components:check 与 pnpm verify。'
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
for (const [nIndex, objDependency] of objManifest.thirdParty.entries()) {
|
|
261
|
+
const strPrefix = `thirdParty[${nIndex}]`
|
|
262
|
+
fnRequireString(objDependency?.packageName, `${strPrefix}.packageName`)
|
|
263
|
+
fnRequireString(
|
|
264
|
+
objDependency.expectedVersion,
|
|
265
|
+
`${strPrefix}.expectedVersion`
|
|
266
|
+
)
|
|
267
|
+
fnRequireString(
|
|
268
|
+
objDependency.expectedLicense,
|
|
269
|
+
`${strPrefix}.expectedLicense`
|
|
270
|
+
)
|
|
271
|
+
fnRequireString(objDependency.licenseFile, `${strPrefix}.licenseFile`)
|
|
272
|
+
fnRequireStringArray(objDependency.usedBy, `${strPrefix}.usedBy`)
|
|
273
|
+
fnRequireString(
|
|
274
|
+
objDependency.productionPolicy,
|
|
275
|
+
`${strPrefix}.productionPolicy`
|
|
276
|
+
)
|
|
277
|
+
if (!Array.isArray(objDependency.policyEvidence)) {
|
|
278
|
+
fnFail(
|
|
279
|
+
'COMPONENT_MANIFEST_INVALID',
|
|
280
|
+
`${strPrefix}.policyEvidence 必须是数组。`,
|
|
281
|
+
`修复 ${strSourceManifestReference} 后重试。`
|
|
282
|
+
)
|
|
283
|
+
}
|
|
284
|
+
for (const [
|
|
285
|
+
nEvidenceIndex,
|
|
286
|
+
objEvidence,
|
|
287
|
+
] of objDependency.policyEvidence.entries()) {
|
|
288
|
+
fnRequireString(
|
|
289
|
+
objEvidence?.path,
|
|
290
|
+
`${strPrefix}.policyEvidence[${nEvidenceIndex}].path`
|
|
291
|
+
)
|
|
292
|
+
fnRequireStringArray(
|
|
293
|
+
objEvidence.markers,
|
|
294
|
+
`${strPrefix}.policyEvidence[${nEvidenceIndex}].markers`
|
|
295
|
+
)
|
|
296
|
+
}
|
|
297
|
+
for (const strConsumer of objDependency.usedBy) {
|
|
298
|
+
if (!objNames.has(strConsumer)) {
|
|
299
|
+
fnFail(
|
|
300
|
+
'COMPONENT_MANIFEST_INVALID',
|
|
301
|
+
`${objDependency.packageName} 引用了未知组件 ${strConsumer}。`,
|
|
302
|
+
'把 usedBy 限制为 components 中已登记的名称。'
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return objManifest
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const fnCheckComponent = async (objComponent) => {
|
|
311
|
+
const [strPublicEntryPath, strSourceNotePath] = await Promise.all([
|
|
312
|
+
fnAssertFile(
|
|
313
|
+
objComponent.publicEntry,
|
|
314
|
+
'COMPONENT_PUBLIC_ENTRY_MISSING',
|
|
315
|
+
`恢复 ${objComponent.name} 公共入口。`
|
|
316
|
+
),
|
|
317
|
+
fnAssertFile(
|
|
318
|
+
objComponent.sourceNote,
|
|
319
|
+
'COMPONENT_SOURCE_NOTE_MISSING',
|
|
320
|
+
`恢复 ${objComponent.name} 的 SOURCE.md。`
|
|
321
|
+
),
|
|
322
|
+
fnAssertFile(
|
|
323
|
+
objComponent.localPath,
|
|
324
|
+
'COMPONENT_SOURCE_DIRECTORY_MISSING',
|
|
325
|
+
`恢复 ${objComponent.name} 本地源码目录。`
|
|
326
|
+
),
|
|
327
|
+
...objComponent.regressionTests.map((strTestPath) =>
|
|
328
|
+
fnAssertFile(
|
|
329
|
+
strTestPath,
|
|
330
|
+
'COMPONENT_REGRESSION_EVIDENCE_MISSING',
|
|
331
|
+
`恢复 ${objComponent.name} 回归测试或更新清单。`
|
|
332
|
+
)
|
|
333
|
+
),
|
|
334
|
+
])
|
|
335
|
+
const [strPublicEntry, strSourceNote] = await Promise.all([
|
|
336
|
+
readFile(strPublicEntryPath, 'utf8'),
|
|
337
|
+
readFile(strSourceNotePath, 'utf8'),
|
|
338
|
+
])
|
|
339
|
+
if (!strPublicEntry.includes(objComponent.name)) {
|
|
340
|
+
fnFail(
|
|
341
|
+
'COMPONENT_PUBLIC_ENTRY_INVALID',
|
|
342
|
+
`${objComponent.publicEntry} 没有导出 ${objComponent.name}。`,
|
|
343
|
+
'恢复稳定公共组件边界,业务不得依赖内部目录。'
|
|
344
|
+
)
|
|
345
|
+
}
|
|
346
|
+
if (
|
|
347
|
+
!strSourceNote.includes(strSourceManifestReference) ||
|
|
348
|
+
!strSourceNote.includes('pnpm components:check')
|
|
349
|
+
) {
|
|
350
|
+
fnFail(
|
|
351
|
+
'COMPONENT_SOURCE_NOTE_INVALID',
|
|
352
|
+
`${objComponent.sourceNote} 没有指向唯一清单或治理命令。`,
|
|
353
|
+
`引用 ${strSourceManifestReference} 并说明 pnpm components:check。`
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
if (objEmbeddedRevisionPattern.test(strSourceNote)) {
|
|
357
|
+
fnFail(
|
|
358
|
+
'COMPONENT_SOURCE_REVISION_DUPLICATED',
|
|
359
|
+
`${objComponent.sourceNote} 重复保存了 Git revision。`,
|
|
360
|
+
`只在 ${strSourceManifestReference} 保存 revision,SOURCE.md 只描述本地改造。`
|
|
361
|
+
)
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const fnCheckThirdParty = async (objDependency, objPackage) => {
|
|
366
|
+
if (!objPackage.dependencies?.[objDependency.packageName]) {
|
|
367
|
+
fnFail(
|
|
368
|
+
'COMPONENT_DEPENDENCY_NOT_DIRECT',
|
|
369
|
+
`${objDependency.packageName} 未声明为直接运行时依赖。`,
|
|
370
|
+
'恢复 dependencies 声明,许可证治理不能依赖传递依赖。'
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
const strDependencyRoot = path.resolve(
|
|
374
|
+
strProjectRoot,
|
|
375
|
+
'node_modules',
|
|
376
|
+
objDependency.packageName
|
|
377
|
+
)
|
|
378
|
+
const objInstalledPackage = await fnReadJson(
|
|
379
|
+
path.resolve(strDependencyRoot, 'package.json'),
|
|
380
|
+
'COMPONENT_DEPENDENCY_NOT_INSTALLED'
|
|
381
|
+
)
|
|
382
|
+
if (objInstalledPackage.version !== objDependency.expectedVersion) {
|
|
383
|
+
fnFail(
|
|
384
|
+
'COMPONENT_DEPENDENCY_VERSION_DRIFT',
|
|
385
|
+
`${objDependency.packageName} 实际版本 ${String(objInstalledPackage.version)} 与清单 ${objDependency.expectedVersion} 不一致。`,
|
|
386
|
+
'确认升级影响和许可证后更新锁文件与组件源码清单。'
|
|
387
|
+
)
|
|
388
|
+
}
|
|
389
|
+
if (objInstalledPackage.license !== objDependency.expectedLicense) {
|
|
390
|
+
fnFail(
|
|
391
|
+
'COMPONENT_DEPENDENCY_LICENSE_DRIFT',
|
|
392
|
+
`${objDependency.packageName} 的 package.json#license 已变化。`,
|
|
393
|
+
'暂停发布,复核新许可证文本和分发义务后更新清单。'
|
|
394
|
+
)
|
|
395
|
+
}
|
|
396
|
+
try {
|
|
397
|
+
await access(path.resolve(strDependencyRoot, objDependency.licenseFile))
|
|
398
|
+
} catch {
|
|
399
|
+
fnFail(
|
|
400
|
+
'COMPONENT_DEPENDENCY_LICENSE_FILE_MISSING',
|
|
401
|
+
`${objDependency.packageName} 缺少 ${objDependency.licenseFile}。`,
|
|
402
|
+
'重新安装依赖;仍缺失时暂停发布并联系依赖维护方。'
|
|
403
|
+
)
|
|
404
|
+
}
|
|
405
|
+
for (const objEvidence of objDependency.policyEvidence) {
|
|
406
|
+
const strEvidencePath = await fnAssertFile(
|
|
407
|
+
objEvidence.path,
|
|
408
|
+
'COMPONENT_LICENSE_POLICY_EVIDENCE_MISSING',
|
|
409
|
+
`恢复 ${objDependency.packageName} 的许可证策略证据。`
|
|
410
|
+
)
|
|
411
|
+
const strEvidence = await readFile(strEvidencePath, 'utf8')
|
|
412
|
+
for (const strMarker of objEvidence.markers) {
|
|
413
|
+
if (!strEvidence.includes(strMarker)) {
|
|
414
|
+
fnFail(
|
|
415
|
+
'COMPONENT_LICENSE_POLICY_EVIDENCE_INVALID',
|
|
416
|
+
`${objEvidence.path} 缺少 ${objDependency.packageName} 策略标记 ${strMarker}。`,
|
|
417
|
+
'恢复构建门禁或测试后再发布。'
|
|
418
|
+
)
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const fnCheckManifest = async (objManifest) => {
|
|
425
|
+
const objPackage = await fnReadJson(
|
|
426
|
+
path.resolve(strProjectRoot, 'package.json'),
|
|
427
|
+
'COMPONENT_PROJECT_PACKAGE_INVALID'
|
|
428
|
+
)
|
|
429
|
+
if (
|
|
430
|
+
objPackage.scripts?.['components:check'] !==
|
|
431
|
+
'node tools/component-governance/check.mjs check' ||
|
|
432
|
+
objPackage.scripts?.['components:diff'] !==
|
|
433
|
+
'node tools/component-governance/check.mjs diff' ||
|
|
434
|
+
!objPackage.scripts?.verify?.includes('pnpm components:check')
|
|
435
|
+
) {
|
|
436
|
+
fnFail(
|
|
437
|
+
'COMPONENT_GOVERNANCE_GATE_MISSING',
|
|
438
|
+
'package.json 没有把组件源码检查接入 verify。',
|
|
439
|
+
'恢复 components:check,并让 verify 在测试和构建前执行它。'
|
|
440
|
+
)
|
|
441
|
+
}
|
|
442
|
+
const [strPackageSource, strLockSource] = await Promise.all([
|
|
443
|
+
readFile(path.resolve(strProjectRoot, 'package.json'), 'utf8'),
|
|
444
|
+
readFile(path.resolve(strProjectRoot, 'pnpm-lock.yaml'), 'utf8'),
|
|
445
|
+
])
|
|
446
|
+
if (
|
|
447
|
+
/@hgw\/|frontend\/package\//.test(`${strPackageSource}\n${strLockSource}`)
|
|
448
|
+
) {
|
|
449
|
+
fnFail(
|
|
450
|
+
'COMPONENT_PRIVATE_PACKAGE_REFERENCE_FOUND',
|
|
451
|
+
'package.json 或锁文件重新出现了内部组件包引用。',
|
|
452
|
+
'移除私有包依赖,继续使用仓库内 AppPageForm/AppTable 源码。'
|
|
453
|
+
)
|
|
454
|
+
}
|
|
455
|
+
await Promise.all([
|
|
456
|
+
...objManifest.components.map(fnCheckComponent),
|
|
457
|
+
...objManifest.thirdParty.map((objDependency) =>
|
|
458
|
+
fnCheckThirdParty(objDependency, objPackage)
|
|
459
|
+
),
|
|
460
|
+
])
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const fnRunGit = (strSourceRoot, arrArguments) => {
|
|
464
|
+
try {
|
|
465
|
+
return execFileSync('git', ['-C', strSourceRoot, ...arrArguments], {
|
|
466
|
+
encoding: 'utf8',
|
|
467
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
468
|
+
}).trim()
|
|
469
|
+
} catch (objError) {
|
|
470
|
+
const strReason = objError?.stderr?.toString().trim()
|
|
471
|
+
fnFail(
|
|
472
|
+
'COMPONENT_SOURCE_GIT_FAILED',
|
|
473
|
+
`无法读取来源 Git 仓库${strReason ? `:${strReason}` : '。'}`,
|
|
474
|
+
'确认 --source-root 指向可读取的 Git 仓库。'
|
|
475
|
+
)
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
const fnCheckGitSuccess = (strSourceRoot, arrArguments) =>
|
|
480
|
+
spawnSync('git', ['-C', strSourceRoot, ...arrArguments], {
|
|
481
|
+
encoding: 'utf8',
|
|
482
|
+
stdio: 'ignore',
|
|
483
|
+
}).status === 0
|
|
484
|
+
|
|
485
|
+
const fnListLicenseFiles = (strSourceRoot, strRevision) =>
|
|
486
|
+
fnRunGit(strSourceRoot, ['ls-tree', '-r', '--name-only', strRevision])
|
|
487
|
+
.split('\n')
|
|
488
|
+
.filter((strFilePath) => /(^|\/)(LICENSE|NOTICE)(\.|$)/i.test(strFilePath))
|
|
489
|
+
.sort()
|
|
490
|
+
|
|
491
|
+
const fnDiffComponentSource = (objComponent, strSourceRoot) => {
|
|
492
|
+
if (!fnCheckGitSuccess(strSourceRoot, ['rev-parse', '--git-dir'])) {
|
|
493
|
+
fnFail(
|
|
494
|
+
'COMPONENT_SOURCE_NOT_GIT_REPOSITORY',
|
|
495
|
+
`${strSourceRoot} 不是 Git 仓库。`,
|
|
496
|
+
'把 --source-root 指向对应内部来源仓库。'
|
|
497
|
+
)
|
|
498
|
+
}
|
|
499
|
+
const strStatus = fnRunGit(strSourceRoot, ['status', '--porcelain=v1'])
|
|
500
|
+
if (strStatus) {
|
|
501
|
+
fnFail(
|
|
502
|
+
'COMPONENT_SOURCE_DIRTY',
|
|
503
|
+
`${objComponent.name} 来源仓库存在未提交修改。`,
|
|
504
|
+
'提交、暂存到其他分支或恢复来源工作区后再生成升级差异。'
|
|
505
|
+
)
|
|
506
|
+
}
|
|
507
|
+
const strRemote = fnRunGit(strSourceRoot, ['remote', 'get-url', 'origin'])
|
|
508
|
+
.replace(/\.git$/, '')
|
|
509
|
+
.replace(/\\/g, '/')
|
|
510
|
+
if (!strRemote.endsWith(objComponent.source.repository)) {
|
|
511
|
+
fnFail(
|
|
512
|
+
'COMPONENT_SOURCE_REPOSITORY_MISMATCH',
|
|
513
|
+
`来源 origin 与 ${objComponent.source.repository} 不匹配。`,
|
|
514
|
+
'确认没有把同名组件的其他仓库作为升级来源。'
|
|
515
|
+
)
|
|
516
|
+
}
|
|
517
|
+
const strBaseRevision = objComponent.source.revision
|
|
518
|
+
if (
|
|
519
|
+
!fnCheckGitSuccess(strSourceRoot, [
|
|
520
|
+
'cat-file',
|
|
521
|
+
'-e',
|
|
522
|
+
`${strBaseRevision}^{commit}`,
|
|
523
|
+
])
|
|
524
|
+
) {
|
|
525
|
+
fnFail(
|
|
526
|
+
'COMPONENT_SOURCE_REVISION_NOT_FOUND',
|
|
527
|
+
`${objComponent.name} 已记录 revision 不在来源仓库中。`,
|
|
528
|
+
'执行 git fetch --all --prune,仍不存在时核对清单与来源仓库。'
|
|
529
|
+
)
|
|
530
|
+
}
|
|
531
|
+
const strTargetRevision = fnRunGit(strSourceRoot, ['rev-parse', 'HEAD'])
|
|
532
|
+
if (
|
|
533
|
+
strTargetRevision !== strBaseRevision &&
|
|
534
|
+
!fnCheckGitSuccess(strSourceRoot, [
|
|
535
|
+
'merge-base',
|
|
536
|
+
'--is-ancestor',
|
|
537
|
+
strBaseRevision,
|
|
538
|
+
strTargetRevision,
|
|
539
|
+
])
|
|
540
|
+
) {
|
|
541
|
+
fnFail(
|
|
542
|
+
'COMPONENT_SOURCE_HISTORY_DIVERGED',
|
|
543
|
+
`${objComponent.name} 候选 HEAD 不是已记录 revision 的后继。`,
|
|
544
|
+
'切换到正式升级分支;不要用无共同升级历史的提交覆盖本地源码。'
|
|
545
|
+
)
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const arrDiffArguments = [
|
|
549
|
+
'diff',
|
|
550
|
+
'--name-status',
|
|
551
|
+
`${strBaseRevision}..${strTargetRevision}`,
|
|
552
|
+
'--',
|
|
553
|
+
...objComponent.source.includedPaths,
|
|
554
|
+
]
|
|
555
|
+
const strDiff = fnRunGit(strSourceRoot, arrDiffArguments)
|
|
556
|
+
const arrChangedFiles = strDiff ? strDiff.split('\n') : []
|
|
557
|
+
const arrBaseLicenses = fnListLicenseFiles(strSourceRoot, strBaseRevision)
|
|
558
|
+
const arrTargetLicenses = fnListLicenseFiles(strSourceRoot, strTargetRevision)
|
|
559
|
+
const bLicenseChanged =
|
|
560
|
+
JSON.stringify(arrBaseLicenses) !== JSON.stringify(arrTargetLicenses)
|
|
561
|
+
|
|
562
|
+
process.stdout.write(
|
|
563
|
+
`[PASS] COMPONENT_SOURCE_IDENTIFIED ${objComponent.name} 来源、工作区和 Git 历史有效。\n`
|
|
564
|
+
)
|
|
565
|
+
process.stdout.write(` 已记录:${strBaseRevision}\n`)
|
|
566
|
+
process.stdout.write(` 候选: ${strTargetRevision}\n`)
|
|
567
|
+
if (arrChangedFiles.length === 0) {
|
|
568
|
+
process.stdout.write(
|
|
569
|
+
`[PASS] COMPONENT_SOURCE_CURRENT ${objComponent.name} 纳入范围的源码没有候选变化。\n`
|
|
570
|
+
)
|
|
571
|
+
} else {
|
|
572
|
+
process.stdout.write(
|
|
573
|
+
`[INFO] COMPONENT_UPGRADE_AVAILABLE ${objComponent.name} 有 ${arrChangedFiles.length} 个候选文件变化:\n`
|
|
574
|
+
)
|
|
575
|
+
for (const strChangedFile of arrChangedFiles) {
|
|
576
|
+
process.stdout.write(` ${strChangedFile}\n`)
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
if (bLicenseChanged) {
|
|
580
|
+
process.stdout.write(
|
|
581
|
+
'[WARN] COMPONENT_SOURCE_LICENSE_CHANGED 来源 LICENSE/NOTICE 文件集合发生变化,必须在同步前完成权属评审。\n'
|
|
582
|
+
)
|
|
583
|
+
process.stdout.write(` 旧:${arrBaseLicenses.join(', ') || '无'}\n`)
|
|
584
|
+
process.stdout.write(` 新:${arrTargetLicenses.join(', ') || '无'}\n`)
|
|
585
|
+
}
|
|
586
|
+
process.stdout.write(
|
|
587
|
+
'[INFO] COMPONENT_UPGRADE_VERIFICATION 同步后必须执行:\n'
|
|
588
|
+
)
|
|
589
|
+
for (const strCommand of objComponent.requiredCommands) {
|
|
590
|
+
process.stdout.write(` ${strCommand}\n`)
|
|
591
|
+
}
|
|
592
|
+
for (const strTestPath of objComponent.regressionTests) {
|
|
593
|
+
process.stdout.write(` 回归证据:${strTestPath}\n`)
|
|
594
|
+
}
|
|
595
|
+
process.stdout.write(
|
|
596
|
+
' 本命令不会修改本地组件或清单;完成选择性同步与评审后再更新 revision。\n'
|
|
597
|
+
)
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const fnParseArguments = (arrArguments) => {
|
|
601
|
+
const [strCommand, ...arrRawOptions] = arrArguments
|
|
602
|
+
const arrOptions =
|
|
603
|
+
arrRawOptions[0] === '--' ? arrRawOptions.slice(1) : arrRawOptions
|
|
604
|
+
if (strCommand !== 'check' && strCommand !== 'diff') {
|
|
605
|
+
fnFail(
|
|
606
|
+
'COMPONENT_GOVERNANCE_ARGUMENT_INVALID',
|
|
607
|
+
`不支持命令 ${strCommand ?? '(empty)'}。`,
|
|
608
|
+
'使用 pnpm components:check,或 pnpm components:diff -- --component <name> --source-root <path>。'
|
|
609
|
+
)
|
|
610
|
+
}
|
|
611
|
+
const objOptions = {}
|
|
612
|
+
for (let nIndex = 0; nIndex < arrOptions.length; nIndex += 2) {
|
|
613
|
+
const strKey = arrOptions[nIndex]
|
|
614
|
+
const strValue = arrOptions[nIndex + 1]
|
|
615
|
+
if (
|
|
616
|
+
!['--component', '--manifest', '--source-root'].includes(strKey) ||
|
|
617
|
+
!strValue ||
|
|
618
|
+
strValue.startsWith('--')
|
|
619
|
+
) {
|
|
620
|
+
fnFail(
|
|
621
|
+
'COMPONENT_GOVERNANCE_ARGUMENT_INVALID',
|
|
622
|
+
`参数 ${strKey ?? '(empty)'} 缺少值或不受支持。`,
|
|
623
|
+
'只使用 --component、--source-root 和测试/迁移所需的 --manifest。'
|
|
624
|
+
)
|
|
625
|
+
}
|
|
626
|
+
if (objOptions[strKey]) {
|
|
627
|
+
fnFail(
|
|
628
|
+
'COMPONENT_GOVERNANCE_ARGUMENT_INVALID',
|
|
629
|
+
`参数 ${strKey} 重复。`,
|
|
630
|
+
'每个参数只提供一次。'
|
|
631
|
+
)
|
|
632
|
+
}
|
|
633
|
+
objOptions[strKey] = strValue
|
|
634
|
+
}
|
|
635
|
+
if (
|
|
636
|
+
strCommand === 'check' &&
|
|
637
|
+
(objOptions['--component'] || objOptions['--source-root'])
|
|
638
|
+
) {
|
|
639
|
+
fnFail(
|
|
640
|
+
'COMPONENT_GOVERNANCE_ARGUMENT_INVALID',
|
|
641
|
+
'check 不接受 --component 或 --source-root。',
|
|
642
|
+
'直接执行 pnpm components:check。'
|
|
643
|
+
)
|
|
644
|
+
}
|
|
645
|
+
if (
|
|
646
|
+
strCommand === 'diff' &&
|
|
647
|
+
(!objOptions['--component'] || !objOptions['--source-root'])
|
|
648
|
+
) {
|
|
649
|
+
fnFail(
|
|
650
|
+
'COMPONENT_GOVERNANCE_ARGUMENT_INVALID',
|
|
651
|
+
'diff 必须同时提供 --component 和 --source-root。',
|
|
652
|
+
'执行 pnpm components:diff -- --component <name> --source-root <path>。'
|
|
653
|
+
)
|
|
654
|
+
}
|
|
655
|
+
return { objOptions, strCommand }
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const fnMain = async () => {
|
|
659
|
+
try {
|
|
660
|
+
const { objOptions, strCommand } = fnParseArguments(process.argv.slice(2))
|
|
661
|
+
const strManifestPath = path.resolve(
|
|
662
|
+
process.cwd(),
|
|
663
|
+
objOptions['--manifest'] ?? strDefaultManifest
|
|
664
|
+
)
|
|
665
|
+
const objManifest = fnValidateManifest(
|
|
666
|
+
await fnReadJson(strManifestPath, 'COMPONENT_MANIFEST_JSON_INVALID')
|
|
667
|
+
)
|
|
668
|
+
if (strCommand === 'check') {
|
|
669
|
+
await fnCheckManifest(objManifest)
|
|
670
|
+
process.stdout.write(
|
|
671
|
+
`[PASS] COMPONENT_GOVERNANCE_READY ${objManifest.components.length} 个内建组件与 ${objManifest.thirdParty.length} 个第三方许可证边界通过检查。\n`
|
|
672
|
+
)
|
|
673
|
+
return
|
|
674
|
+
}
|
|
675
|
+
const objComponent = objManifest.components.find(
|
|
676
|
+
(objItem) => objItem.name === objOptions['--component']
|
|
677
|
+
)
|
|
678
|
+
if (!objComponent) {
|
|
679
|
+
fnFail(
|
|
680
|
+
'COMPONENT_GOVERNANCE_COMPONENT_UNKNOWN',
|
|
681
|
+
`清单中不存在 ${objOptions['--component']}。`,
|
|
682
|
+
`可选组件:${objManifest.components.map((objItem) => objItem.name).join(', ')}。`
|
|
683
|
+
)
|
|
684
|
+
}
|
|
685
|
+
fnDiffComponentSource(
|
|
686
|
+
objComponent,
|
|
687
|
+
path.resolve(process.cwd(), objOptions['--source-root'])
|
|
688
|
+
)
|
|
689
|
+
} catch (objError) {
|
|
690
|
+
if (objError instanceof ComponentGovernanceError) {
|
|
691
|
+
process.stderr.write(`[ERROR] ${objError.strCode} ${objError.message}\n`)
|
|
692
|
+
if (objError.strFix)
|
|
693
|
+
process.stderr.write(` 修复:${objError.strFix}\n`)
|
|
694
|
+
} else {
|
|
695
|
+
process.stderr.write(
|
|
696
|
+
`[ERROR] COMPONENT_GOVERNANCE_INTERNAL ${objError instanceof Error ? objError.message : '未知错误'}\n`
|
|
697
|
+
)
|
|
698
|
+
}
|
|
699
|
+
process.exitCode = 1
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
await fnMain()
|