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,105 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
|
3
|
+
import os from 'node:os'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import test from 'node:test'
|
|
6
|
+
import {
|
|
7
|
+
fnPrepareReleaseArtifact,
|
|
8
|
+
fnVerifyReleaseArtifact,
|
|
9
|
+
} from '../../../tools/release/artifact.mjs'
|
|
10
|
+
|
|
11
|
+
const strCommit = 'a'.repeat(40)
|
|
12
|
+
|
|
13
|
+
const fnCreateFixture = async (objTestContext) => {
|
|
14
|
+
const strProjectRoot = await mkdtemp(
|
|
15
|
+
path.resolve(os.tmpdir(), 'react-admin-release-')
|
|
16
|
+
)
|
|
17
|
+
objTestContext.after(() =>
|
|
18
|
+
rm(strProjectRoot, { force: true, recursive: true })
|
|
19
|
+
)
|
|
20
|
+
await mkdir(path.resolve(strProjectRoot, 'dist/assets'), { recursive: true })
|
|
21
|
+
await mkdir(path.resolve(strProjectRoot, 'dist/.vite'), { recursive: true })
|
|
22
|
+
await Promise.all([
|
|
23
|
+
writeFile(
|
|
24
|
+
path.resolve(strProjectRoot, 'package.json'),
|
|
25
|
+
JSON.stringify({ version: '1.2.3' }),
|
|
26
|
+
'utf8'
|
|
27
|
+
),
|
|
28
|
+
writeFile(
|
|
29
|
+
path.resolve(strProjectRoot, 'dist/index.html'),
|
|
30
|
+
'<main>release</main>',
|
|
31
|
+
'utf8'
|
|
32
|
+
),
|
|
33
|
+
writeFile(
|
|
34
|
+
path.resolve(strProjectRoot, 'dist/assets/app.js'),
|
|
35
|
+
'console.log("release")',
|
|
36
|
+
'utf8'
|
|
37
|
+
),
|
|
38
|
+
writeFile(
|
|
39
|
+
path.resolve(strProjectRoot, 'dist/runtime-config.json'),
|
|
40
|
+
'{"environment":"replace-at-deploy"}',
|
|
41
|
+
'utf8'
|
|
42
|
+
),
|
|
43
|
+
writeFile(
|
|
44
|
+
path.resolve(strProjectRoot, 'dist/.vite/manifest.json'),
|
|
45
|
+
'{"index.html":{"file":"assets/app.js"}}',
|
|
46
|
+
'utf8'
|
|
47
|
+
),
|
|
48
|
+
])
|
|
49
|
+
return strProjectRoot
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
test('release artifact is deterministic and keeps runtime config external', async (objTestContext) => {
|
|
53
|
+
const strProjectRoot = await fnCreateFixture(objTestContext)
|
|
54
|
+
const objPreparedMetadata = await fnPrepareReleaseArtifact({
|
|
55
|
+
strCommit,
|
|
56
|
+
strProjectRoot,
|
|
57
|
+
})
|
|
58
|
+
const objVerifiedMetadata = await fnVerifyReleaseArtifact({
|
|
59
|
+
strExpectedCommit: strCommit,
|
|
60
|
+
strProjectRoot,
|
|
61
|
+
})
|
|
62
|
+
const strManifest = await readFile(
|
|
63
|
+
path.resolve(strProjectRoot, '.artifacts/release/artifact-manifest.sha256'),
|
|
64
|
+
'utf8'
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
assert.equal(objPreparedMetadata.strVersion, '1.2.3')
|
|
68
|
+
assert.deepEqual(objVerifiedMetadata, objPreparedMetadata)
|
|
69
|
+
assert.match(strManifest, /assets\/app\.js/)
|
|
70
|
+
assert.match(strManifest, /index\.html/)
|
|
71
|
+
assert.doesNotMatch(strManifest, /runtime-config\.json/)
|
|
72
|
+
assert.doesNotMatch(strManifest, /\.vite\/manifest\.json/)
|
|
73
|
+
await assert.rejects(
|
|
74
|
+
readFile(
|
|
75
|
+
path.resolve(
|
|
76
|
+
strProjectRoot,
|
|
77
|
+
'.artifacts/release/site/runtime-config.json'
|
|
78
|
+
)
|
|
79
|
+
),
|
|
80
|
+
{ code: 'ENOENT' }
|
|
81
|
+
)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
test('release verification rejects content and commit identity drift', async (objTestContext) => {
|
|
85
|
+
const strProjectRoot = await fnCreateFixture(objTestContext)
|
|
86
|
+
await fnPrepareReleaseArtifact({ strCommit, strProjectRoot })
|
|
87
|
+
|
|
88
|
+
await assert.rejects(
|
|
89
|
+
fnVerifyReleaseArtifact({
|
|
90
|
+
strExpectedCommit: 'b'.repeat(40),
|
|
91
|
+
strProjectRoot,
|
|
92
|
+
}),
|
|
93
|
+
/提交身份/
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
await writeFile(
|
|
97
|
+
path.resolve(strProjectRoot, '.artifacts/release/site/assets/app.js'),
|
|
98
|
+
'tampered',
|
|
99
|
+
'utf8'
|
|
100
|
+
)
|
|
101
|
+
await assert.rejects(
|
|
102
|
+
fnVerifyReleaseArtifact({ strExpectedCommit: strCommit, strProjectRoot }),
|
|
103
|
+
/摘要不一致/
|
|
104
|
+
)
|
|
105
|
+
})
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fnLoadRuntimeConfig,
|
|
3
|
+
fnParseRuntimeConfig,
|
|
4
|
+
RuntimeConfigError,
|
|
5
|
+
} from '@/config/runtimeConfig'
|
|
6
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
7
|
+
|
|
8
|
+
const objValidRuntimeConfig = {
|
|
9
|
+
nSchemaVersion: 1,
|
|
10
|
+
app: {
|
|
11
|
+
strTitle: ' Enterprise Admin ',
|
|
12
|
+
strDescription: ' 企业管理控制台 ',
|
|
13
|
+
strLogoPath: 'logo.svg',
|
|
14
|
+
strStorageNamespace: 'enterprise-admin',
|
|
15
|
+
strMode: 'demo',
|
|
16
|
+
},
|
|
17
|
+
api: {
|
|
18
|
+
strBaseUrl: 'https://api.example.com/',
|
|
19
|
+
},
|
|
20
|
+
auth: {
|
|
21
|
+
strAudience: 'admin-api',
|
|
22
|
+
strClientId: 'react-admin',
|
|
23
|
+
strScope: 'openid profile',
|
|
24
|
+
strSessionStorage: 'memory',
|
|
25
|
+
strSignInPath: '/api/v1/auth/login',
|
|
26
|
+
strRefreshPath: '/api/v1/auth/refresh',
|
|
27
|
+
strSignOutPath: '/api/v1/auth/logout',
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('runtime configuration', () => {
|
|
32
|
+
it('normalizes and freezes a valid public configuration', () => {
|
|
33
|
+
const objConfig = fnParseRuntimeConfig(objValidRuntimeConfig)
|
|
34
|
+
|
|
35
|
+
expect(objConfig.app.strTitle).toBe('Enterprise Admin')
|
|
36
|
+
expect(objConfig.api.strBaseUrl).toBe('https://api.example.com')
|
|
37
|
+
expect(Object.isFrozen(objConfig)).toBe(true)
|
|
38
|
+
expect(Object.isFrozen(objConfig.app)).toBe(true)
|
|
39
|
+
expect(objConfig.app.strBrandId).toBe('enterprise-admin')
|
|
40
|
+
expect(objConfig.app.strDarkLogoPath).toBe('logo.svg')
|
|
41
|
+
expect(objConfig.app.strFaviconPath).toBe('favicon.ico')
|
|
42
|
+
expect(objConfig.app.objTheme.objLight).toEqual({
|
|
43
|
+
strPrimaryColor: '#4068d5',
|
|
44
|
+
strPrimaryForegroundColor: '#ffffff',
|
|
45
|
+
strSecondaryColor: '#49beff',
|
|
46
|
+
strSecondaryForegroundColor: '#102a43',
|
|
47
|
+
strBrowserThemeColor: '#ffffff',
|
|
48
|
+
})
|
|
49
|
+
expect(Object.isFrozen(objConfig.app.objTheme)).toBe(true)
|
|
50
|
+
expect(Object.isFrozen(objConfig.app.objTheme.objLight)).toBe(true)
|
|
51
|
+
expect(Object.isFrozen(objConfig.api)).toBe(true)
|
|
52
|
+
expect(Object.isFrozen(objConfig.auth)).toBe(true)
|
|
53
|
+
expect(objConfig.observability).toEqual({
|
|
54
|
+
bEnabled: false,
|
|
55
|
+
strEnvironment: 'local',
|
|
56
|
+
})
|
|
57
|
+
expect(Object.isFrozen(objConfig.observability)).toBe(true)
|
|
58
|
+
expect(objConfig.locale).toEqual({
|
|
59
|
+
strLocale: 'zh-CN',
|
|
60
|
+
strTimeZone: 'Asia/Shanghai',
|
|
61
|
+
})
|
|
62
|
+
expect(Object.isFrozen(objConfig.locale)).toBe(true)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('accepts an explicit public observability environment without secrets', () => {
|
|
66
|
+
const objConfig = fnParseRuntimeConfig({
|
|
67
|
+
...objValidRuntimeConfig,
|
|
68
|
+
observability: {
|
|
69
|
+
bEnabled: true,
|
|
70
|
+
strEnvironment: 'staging-cn',
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
expect(objConfig.observability).toEqual({
|
|
75
|
+
bEnabled: true,
|
|
76
|
+
strEnvironment: 'staging-cn',
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('accepts a supported locale and rejects an invalid IANA timezone', () => {
|
|
81
|
+
expect(
|
|
82
|
+
fnParseRuntimeConfig({
|
|
83
|
+
...objValidRuntimeConfig,
|
|
84
|
+
locale: { strLocale: 'en-US', strTimeZone: 'UTC' },
|
|
85
|
+
}).locale
|
|
86
|
+
).toEqual({ strLocale: 'en-US', strTimeZone: 'UTC' })
|
|
87
|
+
|
|
88
|
+
expect(() =>
|
|
89
|
+
fnParseRuntimeConfig({
|
|
90
|
+
...objValidRuntimeConfig,
|
|
91
|
+
locale: { strLocale: 'zh-CN', strTimeZone: 'Mars/Olympus' },
|
|
92
|
+
})
|
|
93
|
+
).toThrowError(RuntimeConfigError)
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it('accepts restricted white-label assets and accessible semantic colors', () => {
|
|
97
|
+
const objConfig = fnParseRuntimeConfig({
|
|
98
|
+
...objValidRuntimeConfig,
|
|
99
|
+
app: {
|
|
100
|
+
...objValidRuntimeConfig.app,
|
|
101
|
+
strBrandId: 'acme.operations',
|
|
102
|
+
strDarkLogoPath: 'assets/acme-dark.png',
|
|
103
|
+
strFaviconPath: 'assets/acme-icon.png',
|
|
104
|
+
objTheme: {
|
|
105
|
+
objLight: {
|
|
106
|
+
strPrimaryColor: '#000000',
|
|
107
|
+
strPrimaryForegroundColor: '#ffffff',
|
|
108
|
+
strSecondaryColor: '#ffffff',
|
|
109
|
+
strSecondaryForegroundColor: '#000000',
|
|
110
|
+
strBrowserThemeColor: '#ffffff',
|
|
111
|
+
},
|
|
112
|
+
objDark: {
|
|
113
|
+
strPrimaryColor: '#ffffff',
|
|
114
|
+
strPrimaryForegroundColor: '#000000',
|
|
115
|
+
strSecondaryColor: '#000000',
|
|
116
|
+
strSecondaryForegroundColor: '#ffffff',
|
|
117
|
+
strBrowserThemeColor: '#000000',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
expect(objConfig.app.strBrandId).toBe('acme.operations')
|
|
124
|
+
expect(objConfig.app.strDarkLogoPath).toBe('assets/acme-dark.png')
|
|
125
|
+
expect(objConfig.app.objTheme.objDark.strPrimaryColor).toBe('#ffffff')
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('rejects arbitrary CSS, unsafe image data and inaccessible color pairs', () => {
|
|
129
|
+
const objUnsafeTheme = {
|
|
130
|
+
...objValidRuntimeConfig,
|
|
131
|
+
app: {
|
|
132
|
+
...objValidRuntimeConfig.app,
|
|
133
|
+
objTheme: {
|
|
134
|
+
objLight: {
|
|
135
|
+
strPrimaryColor: 'var(--arbitrary)',
|
|
136
|
+
strPrimaryForegroundColor: '#ffffff',
|
|
137
|
+
strSecondaryColor: '#ffffff',
|
|
138
|
+
strSecondaryForegroundColor: '#000000',
|
|
139
|
+
strBrowserThemeColor: '#ffffff',
|
|
140
|
+
},
|
|
141
|
+
objDark: {
|
|
142
|
+
strPrimaryColor: '#ffffff',
|
|
143
|
+
strPrimaryForegroundColor: '#000000',
|
|
144
|
+
strSecondaryColor: '#000000',
|
|
145
|
+
strSecondaryForegroundColor: '#ffffff',
|
|
146
|
+
strBrowserThemeColor: '#000000',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
expect(() => fnParseRuntimeConfig(objUnsafeTheme)).toThrowError(
|
|
152
|
+
RuntimeConfigError
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
const objUnsafeAsset = structuredClone(objValidRuntimeConfig)
|
|
156
|
+
objUnsafeAsset.app.strLogoPath =
|
|
157
|
+
'data:image/svg+xml,<svg onload="alert(1)" />'
|
|
158
|
+
expect(() => fnParseRuntimeConfig(objUnsafeAsset)).toThrowError(
|
|
159
|
+
RuntimeConfigError
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
const objLowContrast = structuredClone(objUnsafeTheme)
|
|
163
|
+
objLowContrast.app.objTheme.objLight.strPrimaryColor = '#ffffff'
|
|
164
|
+
objLowContrast.app.objTheme.objLight.strPrimaryForegroundColor = '#fefefe'
|
|
165
|
+
expect(() => fnParseRuntimeConfig(objLowContrast)).toThrowError(
|
|
166
|
+
/WCAG AA 4\.5:1/
|
|
167
|
+
)
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it('rejects unknown fields and unsafe URLs without echoing their values', () => {
|
|
171
|
+
expect(() =>
|
|
172
|
+
fnParseRuntimeConfig({
|
|
173
|
+
...objValidRuntimeConfig,
|
|
174
|
+
strClientSecret: 'must-not-appear',
|
|
175
|
+
})
|
|
176
|
+
).toThrowError(RuntimeConfigError)
|
|
177
|
+
|
|
178
|
+
try {
|
|
179
|
+
fnParseRuntimeConfig({
|
|
180
|
+
...objValidRuntimeConfig,
|
|
181
|
+
api: { strBaseUrl: 'https://user:secret@example.com' },
|
|
182
|
+
})
|
|
183
|
+
} catch (objError) {
|
|
184
|
+
expect(objError).toBeInstanceOf(RuntimeConfigError)
|
|
185
|
+
if (objError instanceof Error) {
|
|
186
|
+
expect(objError.message).not.toContain('secret')
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
it('loads the configuration without browser caching', async () => {
|
|
192
|
+
const fnFetch = vi.fn<typeof fetch>()
|
|
193
|
+
fnFetch.mockResolvedValue(
|
|
194
|
+
new Response(JSON.stringify(objValidRuntimeConfig), { status: 200 })
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
const objConfig = await fnLoadRuntimeConfig(fnFetch)
|
|
198
|
+
|
|
199
|
+
expect(objConfig.app.strMode).toBe('demo')
|
|
200
|
+
expect(fnFetch).toHaveBeenCalledWith('/runtime-config.json', {
|
|
201
|
+
cache: 'no-store',
|
|
202
|
+
credentials: 'same-origin',
|
|
203
|
+
headers: { Accept: 'application/json' },
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
it('returns stable error codes for HTTP and JSON failures', async () => {
|
|
208
|
+
const fnHttpFailure = vi.fn<typeof fetch>()
|
|
209
|
+
fnHttpFailure.mockResolvedValue(new Response(null, { status: 503 }))
|
|
210
|
+
const fnJsonFailure = vi.fn<typeof fetch>()
|
|
211
|
+
fnJsonFailure.mockResolvedValue(
|
|
212
|
+
new Response('{', {
|
|
213
|
+
headers: { 'Content-Type': 'application/json' },
|
|
214
|
+
status: 200,
|
|
215
|
+
})
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
await expect(fnLoadRuntimeConfig(fnHttpFailure)).rejects.toMatchObject({
|
|
219
|
+
strCode: 'load_failed',
|
|
220
|
+
})
|
|
221
|
+
await expect(fnLoadRuntimeConfig(fnJsonFailure)).rejects.toMatchObject({
|
|
222
|
+
strCode: 'invalid_json',
|
|
223
|
+
})
|
|
224
|
+
})
|
|
225
|
+
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import { spawnSync } from 'node:child_process'
|
|
3
|
+
import { readFileSync } from 'node:fs'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import test from 'node:test'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
7
|
+
|
|
8
|
+
const strProjectRoot = path.resolve(
|
|
9
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
10
|
+
'../../..'
|
|
11
|
+
)
|
|
12
|
+
const strCheckScript = path.resolve(strProjectRoot, 'tools/scaffold/check.mjs')
|
|
13
|
+
|
|
14
|
+
const fnRunCheck = (...arrArguments) =>
|
|
15
|
+
spawnSync(process.execPath, [strCheckScript, ...arrArguments], {
|
|
16
|
+
cwd: strProjectRoot,
|
|
17
|
+
encoding: 'utf8',
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('scaffold check validates real project contracts and keeps reminders actionable', () => {
|
|
21
|
+
const objPackage = JSON.parse(
|
|
22
|
+
readFileSync(path.resolve(strProjectRoot, 'package.json'), 'utf8')
|
|
23
|
+
)
|
|
24
|
+
const objResult = fnRunCheck()
|
|
25
|
+
|
|
26
|
+
assert.equal(
|
|
27
|
+
objPackage.scripts['scaffold:check'],
|
|
28
|
+
'node tools/scaffold/check.mjs'
|
|
29
|
+
)
|
|
30
|
+
assert.equal(objResult.status, 0, objResult.stderr || objResult.stdout)
|
|
31
|
+
assert.match(objResult.stdout, /BUILD_CONFIG_READY/)
|
|
32
|
+
assert.match(objResult.stdout, /RUNTIME_CONFIG_READY/)
|
|
33
|
+
assert.match(objResult.stdout, /OPENAPI_SERVICES_READY/)
|
|
34
|
+
assert.match(objResult.stdout, /PACKAGE_NAME_PLACEHOLDER/)
|
|
35
|
+
assert.match(objResult.stdout, /AUTH_CONFIG_PLACEHOLDER/)
|
|
36
|
+
assert.match(objResult.stdout, /脚手架基础检查通过/)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('strict scaffold check blocks handoff while placeholders remain', () => {
|
|
40
|
+
const objResult = fnRunCheck('--strict')
|
|
41
|
+
|
|
42
|
+
assert.equal(objResult.status, 1)
|
|
43
|
+
assert.match(objResult.stdout, /严格模式要求/)
|
|
44
|
+
assert.match(objResult.stdout, /0 个错误,\d+ 个提醒/)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('scaffold check rejects unknown options with a stable diagnostic', () => {
|
|
48
|
+
const objResult = fnRunCheck('--write')
|
|
49
|
+
|
|
50
|
+
assert.equal(objResult.status, 1)
|
|
51
|
+
assert.match(objResult.stdout, /CLI_ARGUMENT_INVALID/)
|
|
52
|
+
assert.match(objResult.stdout, /只使用 pnpm scaffold:check/)
|
|
53
|
+
})
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import { spawnSync } from 'node:child_process'
|
|
3
|
+
import { mkdir, mkdtemp, readFile, rm } from 'node:fs/promises'
|
|
4
|
+
import os from 'node:os'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
import test from 'node:test'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
import { fnCreateFeature } from '../../../tools/scaffold/create-feature.mjs'
|
|
9
|
+
|
|
10
|
+
const strProjectRoot = path.resolve(
|
|
11
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
12
|
+
'../../..'
|
|
13
|
+
)
|
|
14
|
+
const strFeatureScript = path.resolve(
|
|
15
|
+
strProjectRoot,
|
|
16
|
+
'tools/scaffold/create-feature.mjs'
|
|
17
|
+
)
|
|
18
|
+
const objFeatureOptions = {
|
|
19
|
+
strFeatureName: 'customerManagement',
|
|
20
|
+
strModelName: 'CustomerRecord',
|
|
21
|
+
strResourceKey: 'customer:record',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const fnCreateProjectFixture = async (objTestContext) => {
|
|
25
|
+
const strFixtureRoot = await mkdtemp(
|
|
26
|
+
path.join(os.tmpdir(), 'react-admin-feature-create-')
|
|
27
|
+
)
|
|
28
|
+
objTestContext.after(() =>
|
|
29
|
+
rm(strFixtureRoot, { force: true, recursive: true })
|
|
30
|
+
)
|
|
31
|
+
await Promise.all([
|
|
32
|
+
mkdir(path.resolve(strFixtureRoot, 'src/features'), { recursive: true }),
|
|
33
|
+
mkdir(path.resolve(strFixtureRoot, 'tests/unit/features'), {
|
|
34
|
+
recursive: true,
|
|
35
|
+
}),
|
|
36
|
+
])
|
|
37
|
+
return strFixtureRoot
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const fnReadGeneratedFiles = async (strFixtureRoot, arrFiles) =>
|
|
41
|
+
Promise.all(
|
|
42
|
+
arrFiles.map((strFilePath) =>
|
|
43
|
+
readFile(path.resolve(strFixtureRoot, strFilePath), 'utf8')
|
|
44
|
+
)
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
test('Feature generator previews source and tests without creating directories', async (objTestContext) => {
|
|
48
|
+
const strFixtureRoot = await fnCreateProjectFixture(objTestContext)
|
|
49
|
+
|
|
50
|
+
const objResult = await fnCreateFeature({
|
|
51
|
+
...objFeatureOptions,
|
|
52
|
+
strProjectRoot: strFixtureRoot,
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
assert.equal(objResult.bWrite, false)
|
|
56
|
+
assert.equal(objResult.arrFiles.length, 8)
|
|
57
|
+
assert.equal(
|
|
58
|
+
objResult.arrFiles.every(
|
|
59
|
+
(strFilePath) =>
|
|
60
|
+
strFilePath.startsWith('src/features/customerManagement/') ||
|
|
61
|
+
strFilePath.startsWith('tests/unit/features/customerManagement/')
|
|
62
|
+
),
|
|
63
|
+
true
|
|
64
|
+
)
|
|
65
|
+
await assert.rejects(
|
|
66
|
+
readFile(
|
|
67
|
+
path.resolve(strFixtureRoot, 'src/features/customerManagement/index.ts')
|
|
68
|
+
),
|
|
69
|
+
{ code: 'ENOENT' }
|
|
70
|
+
)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
test('Feature generator writes transformed contracts and refuses every overwrite', async (objTestContext) => {
|
|
74
|
+
const strFixtureRoot = await fnCreateProjectFixture(objTestContext)
|
|
75
|
+
|
|
76
|
+
const objResult = await fnCreateFeature({
|
|
77
|
+
...objFeatureOptions,
|
|
78
|
+
bWrite: true,
|
|
79
|
+
strProjectRoot: strFixtureRoot,
|
|
80
|
+
})
|
|
81
|
+
const arrSources = await fnReadGeneratedFiles(
|
|
82
|
+
strFixtureRoot,
|
|
83
|
+
objResult.arrFiles
|
|
84
|
+
)
|
|
85
|
+
const strCombinedSource = arrSources.join('\n')
|
|
86
|
+
const strPublicEntry = await readFile(
|
|
87
|
+
path.resolve(strFixtureRoot, 'src/features/customerManagement/index.ts'),
|
|
88
|
+
'utf8'
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
assert.equal(objResult.bWrite, true)
|
|
92
|
+
assert.match(strCombinedSource, /fnCreateCustomerRecordFeature/)
|
|
93
|
+
assert.match(strCombinedSource, /strFeatureKey = 'customerManagement'/)
|
|
94
|
+
assert.match(strCombinedSource, /strRecordResourceKey = 'customer:record'/)
|
|
95
|
+
assert.match(strCombinedSource, /@\/features\/customerManagement/)
|
|
96
|
+
assert.match(strCombinedSource, /customer:record:read/)
|
|
97
|
+
assert.match(strCombinedSource, /CUSTOMER_RECORD_CONFLICT/)
|
|
98
|
+
assert.doesNotMatch(
|
|
99
|
+
strPublicEntry,
|
|
100
|
+
/Repository|RecordDto|fnMapCustomerRecord/
|
|
101
|
+
)
|
|
102
|
+
assert.doesNotMatch(
|
|
103
|
+
strCombinedSource,
|
|
104
|
+
/featureTemplate|TemplateRecord|TEMPLATE_|template:record|template-user/
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
await assert.rejects(
|
|
108
|
+
fnCreateFeature({
|
|
109
|
+
...objFeatureOptions,
|
|
110
|
+
bWrite: true,
|
|
111
|
+
strProjectRoot: strFixtureRoot,
|
|
112
|
+
}),
|
|
113
|
+
(objError) => {
|
|
114
|
+
assert.equal(objError.strCode, 'FEATURE_CREATE_CONFLICT')
|
|
115
|
+
assert.match(objError.message, /不会覆盖已有 Feature/)
|
|
116
|
+
return true
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
assert.deepEqual(
|
|
120
|
+
await fnReadGeneratedFiles(strFixtureRoot, objResult.arrFiles),
|
|
121
|
+
arrSources
|
|
122
|
+
)
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
test('Feature generator blocks invalid names and cross-platform case collisions', async (objTestContext) => {
|
|
126
|
+
const strFixtureRoot = await fnCreateProjectFixture(objTestContext)
|
|
127
|
+
|
|
128
|
+
await assert.rejects(
|
|
129
|
+
fnCreateFeature({
|
|
130
|
+
...objFeatureOptions,
|
|
131
|
+
strFeatureName: '../customerManagement',
|
|
132
|
+
strProjectRoot: strFixtureRoot,
|
|
133
|
+
}),
|
|
134
|
+
(objError) => objError.strCode === 'FEATURE_CREATE_ARGUMENT_INVALID'
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
await mkdir(path.resolve(strFixtureRoot, 'src/features/CustomerManagement'))
|
|
138
|
+
await assert.rejects(
|
|
139
|
+
fnCreateFeature({
|
|
140
|
+
...objFeatureOptions,
|
|
141
|
+
strProjectRoot: strFixtureRoot,
|
|
142
|
+
}),
|
|
143
|
+
(objError) => {
|
|
144
|
+
assert.equal(objError.strCode, 'FEATURE_CREATE_CONFLICT')
|
|
145
|
+
assert.match(objError.message, /CustomerManagement/)
|
|
146
|
+
return true
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
test('Feature generator CLI documents boundaries and stable diagnostics', async () => {
|
|
152
|
+
const objPackage = JSON.parse(
|
|
153
|
+
await readFile(path.resolve(strProjectRoot, 'package.json'), 'utf8')
|
|
154
|
+
)
|
|
155
|
+
const objHelpResult = spawnSync(
|
|
156
|
+
process.execPath,
|
|
157
|
+
[strFeatureScript, '--help'],
|
|
158
|
+
{
|
|
159
|
+
cwd: strProjectRoot,
|
|
160
|
+
encoding: 'utf8',
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
const objInvalidResult = spawnSync(
|
|
164
|
+
process.execPath,
|
|
165
|
+
[strFeatureScript, '--name', 'customer-management'],
|
|
166
|
+
{ cwd: strProjectRoot, encoding: 'utf8' }
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
assert.equal(
|
|
170
|
+
objPackage.scripts['scaffold:feature'],
|
|
171
|
+
'node tools/scaffold/create-feature.mjs'
|
|
172
|
+
)
|
|
173
|
+
assert.equal(objHelpResult.status, 0)
|
|
174
|
+
assert.match(objHelpResult.stdout, /不会注册路由、菜单或生成 API 客户端/)
|
|
175
|
+
assert.equal(objInvalidResult.status, 1)
|
|
176
|
+
assert.match(objInvalidResult.stderr, /FEATURE_CREATE_ARGUMENT_INVALID/)
|
|
177
|
+
})
|