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,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fnFreezeFeatureFlagJsonValue,
|
|
3
|
+
fnIsFeatureFlagJsonValue,
|
|
4
|
+
} from './catalog'
|
|
5
|
+
import { FeatureFlagError } from './errors'
|
|
6
|
+
import type {
|
|
7
|
+
IFeatureFlagCatalog,
|
|
8
|
+
IFeatureFlagDefinition,
|
|
9
|
+
IFeatureFlagEvaluation,
|
|
10
|
+
TFeatureFlagKind,
|
|
11
|
+
} from './types'
|
|
12
|
+
|
|
13
|
+
function fnIsFeatureFlagKind(strKind: string): strKind is TFeatureFlagKind {
|
|
14
|
+
return (
|
|
15
|
+
strKind === 'experiment' ||
|
|
16
|
+
strKind === 'killSwitch' ||
|
|
17
|
+
strKind === 'release'
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function fnNormalizeFeatureFlagDefinition(
|
|
22
|
+
objDefinition: IFeatureFlagDefinition
|
|
23
|
+
): IFeatureFlagDefinition {
|
|
24
|
+
const bHasValidStalePolicy = objDefinition.bAllowStale
|
|
25
|
+
? typeof objDefinition.nMaxStaleMs === 'number' &&
|
|
26
|
+
Number.isFinite(objDefinition.nMaxStaleMs) &&
|
|
27
|
+
objDefinition.nMaxStaleMs > 0
|
|
28
|
+
: objDefinition.nMaxStaleMs === undefined
|
|
29
|
+
const bHasValidKillSwitchPolicy =
|
|
30
|
+
objDefinition.strKind !== 'killSwitch' ||
|
|
31
|
+
(!objDefinition.bSafeDefault && !objDefinition.bAllowStale)
|
|
32
|
+
|
|
33
|
+
if (
|
|
34
|
+
!objDefinition.strKey.trim() ||
|
|
35
|
+
objDefinition.strKey.trim() !== objDefinition.strKey ||
|
|
36
|
+
!fnIsFeatureFlagKind(objDefinition.strKind) ||
|
|
37
|
+
typeof objDefinition.bSafeDefault !== 'boolean' ||
|
|
38
|
+
!bHasValidStalePolicy ||
|
|
39
|
+
!bHasValidKillSwitchPolicy ||
|
|
40
|
+
(objDefinition.objSafePayload !== undefined &&
|
|
41
|
+
!fnIsFeatureFlagJsonValue(objDefinition.objSafePayload)) ||
|
|
42
|
+
(objDefinition.strSafeVariant !== undefined &&
|
|
43
|
+
!objDefinition.strSafeVariant.trim())
|
|
44
|
+
) {
|
|
45
|
+
throw new FeatureFlagError(
|
|
46
|
+
'INVALID_DEFINITION',
|
|
47
|
+
`Feature Flag ${objDefinition.strKey || '<empty>'} 的本地定义无效。Kill Switch 必须默认关闭且不能使用过期结果。`
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return Object.freeze({
|
|
52
|
+
...objDefinition,
|
|
53
|
+
objSafePayload:
|
|
54
|
+
objDefinition.objSafePayload === undefined
|
|
55
|
+
? undefined
|
|
56
|
+
: fnFreezeFeatureFlagJsonValue(objDefinition.objSafePayload),
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 校验本地定义、拒绝重复 Key,并创建稳定的只读定义表。 */
|
|
61
|
+
export function fnCreateFeatureFlagRegistry(
|
|
62
|
+
arrDefinitions: readonly IFeatureFlagDefinition[]
|
|
63
|
+
): ReadonlyMap<string, IFeatureFlagDefinition> {
|
|
64
|
+
const objRegistry = new Map<string, IFeatureFlagDefinition>()
|
|
65
|
+
arrDefinitions.forEach((objDefinition) => {
|
|
66
|
+
const objNormalizedDefinition =
|
|
67
|
+
fnNormalizeFeatureFlagDefinition(objDefinition)
|
|
68
|
+
if (objRegistry.has(objNormalizedDefinition.strKey)) {
|
|
69
|
+
throw new FeatureFlagError(
|
|
70
|
+
'INVALID_DEFINITION',
|
|
71
|
+
`Feature Flag ${objNormalizedDefinition.strKey} 被重复定义。`
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
objRegistry.set(objNormalizedDefinition.strKey, objNormalizedDefinition)
|
|
75
|
+
})
|
|
76
|
+
return objRegistry
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function fnCreateSafeDefaultEvaluation(
|
|
80
|
+
objDefinition: IFeatureFlagDefinition,
|
|
81
|
+
strEvaluationReason: 'catalogExpired' | 'catalogUnavailable' | 'flagMissing'
|
|
82
|
+
): IFeatureFlagEvaluation {
|
|
83
|
+
return Object.freeze({
|
|
84
|
+
bEnabled: objDefinition.bSafeDefault,
|
|
85
|
+
bIsFallback: true,
|
|
86
|
+
nEvaluatedAt: 0,
|
|
87
|
+
objPayload: objDefinition.objSafePayload,
|
|
88
|
+
strEvaluationReason,
|
|
89
|
+
strEvaluationSource: 'safeDefault',
|
|
90
|
+
strKey: objDefinition.strKey,
|
|
91
|
+
strKind: objDefinition.strKind,
|
|
92
|
+
strVariant: objDefinition.strSafeVariant,
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** 按本地安全策略评估远端结果,不在前端执行人群或百分比规则。 */
|
|
97
|
+
export function fnEvaluateFeatureFlag(
|
|
98
|
+
objDefinition: IFeatureFlagDefinition,
|
|
99
|
+
objCatalog?: IFeatureFlagCatalog,
|
|
100
|
+
nNow = Date.now()
|
|
101
|
+
): IFeatureFlagEvaluation {
|
|
102
|
+
if (!objCatalog) {
|
|
103
|
+
return fnCreateSafeDefaultEvaluation(objDefinition, 'catalogUnavailable')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const objFlag = objCatalog.objFlags.get(objDefinition.strKey)
|
|
107
|
+
if (!objFlag) {
|
|
108
|
+
return fnCreateSafeDefaultEvaluation(objDefinition, 'flagMissing')
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const bIsFresh = nNow <= objCatalog.nExpiresAt
|
|
112
|
+
const bCanUseStale =
|
|
113
|
+
!bIsFresh &&
|
|
114
|
+
objDefinition.bAllowStale === true &&
|
|
115
|
+
objDefinition.nMaxStaleMs !== undefined &&
|
|
116
|
+
nNow <= objCatalog.nExpiresAt + objDefinition.nMaxStaleMs
|
|
117
|
+
|
|
118
|
+
if (!bIsFresh && !bCanUseStale) {
|
|
119
|
+
return fnCreateSafeDefaultEvaluation(objDefinition, 'catalogExpired')
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return Object.freeze({
|
|
123
|
+
bEnabled: objFlag.bEnabled,
|
|
124
|
+
bIsFallback: false,
|
|
125
|
+
nEvaluatedAt: objFlag.nEvaluatedAt,
|
|
126
|
+
objPayload: objFlag.objPayload,
|
|
127
|
+
strEvaluationReason: bIsFresh ? 'remoteEvaluation' : 'catalogExpired',
|
|
128
|
+
strEvaluationSource: bIsFresh ? 'remote' : 'stale',
|
|
129
|
+
strKey: objDefinition.strKey,
|
|
130
|
+
strKind: objDefinition.strKind,
|
|
131
|
+
strRemoteReason: objFlag.strReason,
|
|
132
|
+
strVariant: objFlag.strVariant,
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** 从本地定义表读取开关;未知 Key 立即失败,避免拼写错误静默上线。 */
|
|
137
|
+
export function fnGetFeatureFlagDefinition(
|
|
138
|
+
objRegistry: ReadonlyMap<string, IFeatureFlagDefinition>,
|
|
139
|
+
strKey: string
|
|
140
|
+
): IFeatureFlagDefinition {
|
|
141
|
+
const objDefinition = objRegistry.get(strKey)
|
|
142
|
+
if (!objDefinition) {
|
|
143
|
+
throw new FeatureFlagError(
|
|
144
|
+
'INVALID_DEFINITION',
|
|
145
|
+
`Feature Flag ${strKey || '<empty>'} 尚未在本地定义。`
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
return objDefinition
|
|
149
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IFeatureFlagScope, IFeatureFlagScopeContext } from './types'
|
|
2
|
+
|
|
3
|
+
function fnNormalizeScopeValue(strValue: string | undefined) {
|
|
4
|
+
const strNormalizedValue = strValue?.trim()
|
|
5
|
+
return strNormalizedValue || undefined
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** 创建不含凭据、可安全用于 Query Key 的 Feature Flag 作用域。 */
|
|
9
|
+
export function fnCreateFeatureFlagScope(
|
|
10
|
+
objContext: IFeatureFlagScopeContext = {}
|
|
11
|
+
): IFeatureFlagScope {
|
|
12
|
+
if (
|
|
13
|
+
objContext.nSessionGeneration !== undefined &&
|
|
14
|
+
(!Number.isInteger(objContext.nSessionGeneration) ||
|
|
15
|
+
objContext.nSessionGeneration < 0)
|
|
16
|
+
) {
|
|
17
|
+
throw new TypeError('Feature Flag 作用域的会话版本必须是非负整数。')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return Object.freeze({
|
|
21
|
+
nSessionGeneration: objContext.nSessionGeneration,
|
|
22
|
+
strEnvironment: fnNormalizeScopeValue(objContext.strEnvironment),
|
|
23
|
+
strTenantId: fnNormalizeScopeValue(objContext.strTenantId),
|
|
24
|
+
strUserId: fnNormalizeScopeValue(objContext.strUserId),
|
|
25
|
+
strWorkspaceId: fnNormalizeScopeValue(objContext.strWorkspaceId),
|
|
26
|
+
})
|
|
27
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
/** Feature Flag 可携带的递归只读 JSON 值。 */
|
|
4
|
+
export type TFeatureFlagJsonValue =
|
|
5
|
+
| boolean
|
|
6
|
+
| number
|
|
7
|
+
| string
|
|
8
|
+
| null
|
|
9
|
+
| readonly TFeatureFlagJsonValue[]
|
|
10
|
+
| { readonly [strKey: string]: TFeatureFlagJsonValue }
|
|
11
|
+
|
|
12
|
+
/** 开关的稳定用途分类。 */
|
|
13
|
+
export type TFeatureFlagKind = 'experiment' | 'killSwitch' | 'release'
|
|
14
|
+
|
|
15
|
+
/** 一次开关评估实际采用的数据来源。 */
|
|
16
|
+
export type TFeatureFlagEvaluationSource = 'remote' | 'safeDefault' | 'stale'
|
|
17
|
+
|
|
18
|
+
/** 开关使用当前结果的稳定原因,便于诊断而不暴露人群规则。 */
|
|
19
|
+
export type TFeatureFlagEvaluationReason =
|
|
20
|
+
| 'catalogExpired'
|
|
21
|
+
| 'catalogUnavailable'
|
|
22
|
+
| 'flagMissing'
|
|
23
|
+
| 'remoteEvaluation'
|
|
24
|
+
|
|
25
|
+
/** Feature Flag 边界的稳定错误分类。 */
|
|
26
|
+
export type TFeatureFlagErrorCode =
|
|
27
|
+
| 'INVALID_CATALOG'
|
|
28
|
+
| 'INVALID_DEFINITION'
|
|
29
|
+
| 'INVALID_FLAG'
|
|
30
|
+
| 'INVALID_SCOPE'
|
|
31
|
+
|
|
32
|
+
/** 后端已经完成灰度评估后的单个原始开关。 */
|
|
33
|
+
export interface IFeatureFlagPayload {
|
|
34
|
+
/** 当前作用域是否启用该能力。 */
|
|
35
|
+
bEnabled?: boolean
|
|
36
|
+
/** 实验分组或配置版本;普通布尔开关可以省略。 */
|
|
37
|
+
strVariant?: string
|
|
38
|
+
/** 与当前变体绑定的只读 JSON 配置,不得包含凭据或敏感信息。 */
|
|
39
|
+
objPayload?: TFeatureFlagJsonValue
|
|
40
|
+
/** 后端用于诊断的非敏感原因码,不应包含完整灰度规则。 */
|
|
41
|
+
strReason?: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** 后端统一 Feature Flag 接口返回的原始目录。 */
|
|
45
|
+
export interface IFeatureFlagCatalogPayload {
|
|
46
|
+
/** 服务端完成本次评估的毫秒时间戳。 */
|
|
47
|
+
nEvaluatedAt?: number
|
|
48
|
+
/** 本次评估结果允许使用到的毫秒时间戳。 */
|
|
49
|
+
nExpiresAt?: number
|
|
50
|
+
/** 以稳定开关 Key 为索引的已评估结果。 */
|
|
51
|
+
objFlags?: Readonly<Record<string, IFeatureFlagPayload | undefined>>
|
|
52
|
+
/** 后端目录或规则版本,用于诊断与刷新确认。 */
|
|
53
|
+
version?: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 前端本地声明的开关及其安全回退策略。 */
|
|
57
|
+
export interface IFeatureFlagDefinition {
|
|
58
|
+
/** 远端不可用、目录过期或 Key 缺失时采用的安全状态。 */
|
|
59
|
+
readonly bSafeDefault: boolean
|
|
60
|
+
/** 是否允许在远端目录过期后短暂使用最近一次结果。 */
|
|
61
|
+
readonly bAllowStale?: boolean
|
|
62
|
+
/** 允许使用过期结果的最长毫秒数;仅在 `bAllowStale` 时有效。 */
|
|
63
|
+
readonly nMaxStaleMs?: number
|
|
64
|
+
/** 安全默认状态配套的只读 JSON 配置。 */
|
|
65
|
+
readonly objSafePayload?: TFeatureFlagJsonValue
|
|
66
|
+
/** 跨环境稳定且由前后端共同约定的开关 Key。 */
|
|
67
|
+
readonly strKey: string
|
|
68
|
+
/** 开关用途;Kill Switch 会强制安全默认关闭且禁止过期结果。 */
|
|
69
|
+
readonly strKind: TFeatureFlagKind
|
|
70
|
+
/** 安全默认状态配套的实验分组或配置版本。 */
|
|
71
|
+
readonly strSafeVariant?: string
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** 除请求信号外,用于后端评估和隔离前端缓存的稳定作用域。 */
|
|
75
|
+
export interface IFeatureFlagScopeContext {
|
|
76
|
+
/** 登录、退出或授权上下文变化时递增的会话版本。 */
|
|
77
|
+
readonly nSessionGeneration?: number
|
|
78
|
+
/** 运行环境标识,例如 production 或 staging。 */
|
|
79
|
+
readonly strEnvironment?: string
|
|
80
|
+
/** 当前租户稳定标识。 */
|
|
81
|
+
readonly strTenantId?: string
|
|
82
|
+
/** 当前认证用户稳定标识;匿名场景可以省略。 */
|
|
83
|
+
readonly strUserId?: string
|
|
84
|
+
/** 当前组织、项目或工作空间稳定标识。 */
|
|
85
|
+
readonly strWorkspaceId?: string
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** 一个 Feature Flag 请求与缓存的完整身份。 */
|
|
89
|
+
export interface IFeatureFlagScope extends IFeatureFlagScopeContext {
|
|
90
|
+
/** 登录、退出或授权上下文变化时递增的会话版本。 */
|
|
91
|
+
readonly nSessionGeneration?: number
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** 后端 Feature Flag 请求所需的完整运行时上下文。 */
|
|
95
|
+
export interface IFeatureFlagRequestContext {
|
|
96
|
+
/** 按字典序排列、仅请求当前应用声明的开关 Key。 */
|
|
97
|
+
readonly arrFlagKeys: readonly string[]
|
|
98
|
+
/** 本次请求与缓存使用的稳定业务作用域。 */
|
|
99
|
+
readonly objScope: IFeatureFlagScope
|
|
100
|
+
/** QueryClient 取消或替换请求时触发的取消信号。 */
|
|
101
|
+
readonly objSignal: AbortSignal
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** 由 Swagger 生成客户端实现的后端 Feature Flag 请求函数。 */
|
|
105
|
+
export type TFeatureFlagRequest = (
|
|
106
|
+
objContext: IFeatureFlagRequestContext
|
|
107
|
+
) => Promise<IFeatureFlagCatalogPayload | undefined>
|
|
108
|
+
|
|
109
|
+
/** 项目对接后端或供应商 SDK 时实现的数据源契约。 */
|
|
110
|
+
export interface IFeatureFlagSource {
|
|
111
|
+
/** 加载当前作用域下已经由后端完成评估的开关目录。 */
|
|
112
|
+
readonly fnLoadCatalog: (
|
|
113
|
+
objContext: IFeatureFlagRequestContext
|
|
114
|
+
) => Promise<IFeatureFlagCatalog>
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** 经过运行时校验、可安全交给 Feature 使用的远端开关结果。 */
|
|
118
|
+
export interface IFeatureFlag {
|
|
119
|
+
/** 当前作用域是否启用该能力。 */
|
|
120
|
+
readonly bEnabled: boolean
|
|
121
|
+
/** 服务端完成本次评估的毫秒时间戳。 */
|
|
122
|
+
readonly nEvaluatedAt: number
|
|
123
|
+
/** 与当前变体绑定的深度冻结 JSON 配置。 */
|
|
124
|
+
readonly objPayload?: TFeatureFlagJsonValue
|
|
125
|
+
/** 跨环境稳定的开关 Key。 */
|
|
126
|
+
readonly strKey: string
|
|
127
|
+
/** 后端用于诊断的非敏感原因码。 */
|
|
128
|
+
readonly strReason?: string
|
|
129
|
+
/** 实验分组或配置版本。 */
|
|
130
|
+
readonly strVariant?: string
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** 单个作用域下已标准化的完整远端开关目录。 */
|
|
134
|
+
export interface IFeatureFlagCatalog {
|
|
135
|
+
/** 服务端完成本次目录评估的毫秒时间戳。 */
|
|
136
|
+
readonly nEvaluatedAt: number
|
|
137
|
+
/** 本次目录结果允许使用到的毫秒时间戳。 */
|
|
138
|
+
readonly nExpiresAt: number
|
|
139
|
+
/** 以稳定 Key 为索引的已评估开关。 */
|
|
140
|
+
readonly objFlags: ReadonlyMap<string, IFeatureFlag>
|
|
141
|
+
/** 后端目录或规则版本。 */
|
|
142
|
+
readonly version: string
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Feature 最终消费的开关评估结果。 */
|
|
146
|
+
export interface IFeatureFlagEvaluation {
|
|
147
|
+
/** 当前最终是否启用能力。 */
|
|
148
|
+
readonly bEnabled: boolean
|
|
149
|
+
/** 是否正在使用本地安全默认值。 */
|
|
150
|
+
readonly bIsFallback: boolean
|
|
151
|
+
/** 当前结果对应的服务端评估时间;本地默认值为 `0`。 */
|
|
152
|
+
readonly nEvaluatedAt: number
|
|
153
|
+
/** 当前变体携带的只读 JSON 配置。 */
|
|
154
|
+
readonly objPayload?: TFeatureFlagJsonValue
|
|
155
|
+
/** 当前结果使用本地默认或远端结果的稳定原因。 */
|
|
156
|
+
readonly strEvaluationReason: TFeatureFlagEvaluationReason
|
|
157
|
+
/** 当前结果的数据来源。 */
|
|
158
|
+
readonly strEvaluationSource: TFeatureFlagEvaluationSource
|
|
159
|
+
/** 开关稳定 Key。 */
|
|
160
|
+
readonly strKey: string
|
|
161
|
+
/** 本地定义的用途分类。 */
|
|
162
|
+
readonly strKind: TFeatureFlagKind
|
|
163
|
+
/** 后端返回的非敏感诊断原因码。 */
|
|
164
|
+
readonly strRemoteReason?: string
|
|
165
|
+
/** 当前采用的实验分组或配置版本。 */
|
|
166
|
+
readonly strVariant?: string
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Feature Flag Provider 的公共参数。 */
|
|
170
|
+
export interface IFeatureFlagProviderProps {
|
|
171
|
+
/** 本应用声明的开关和安全默认策略。 */
|
|
172
|
+
readonly arrDefinitions: readonly IFeatureFlagDefinition[]
|
|
173
|
+
/** 是否允许请求远端目录;关闭后所有开关立即使用安全默认值。 */
|
|
174
|
+
readonly bIsEnabled?: boolean
|
|
175
|
+
/** 始终渲染的应用子树;远端开关失败不会阻塞它。 */
|
|
176
|
+
readonly children: ReactNode
|
|
177
|
+
/** 当前用户、租户、工作空间和环境组成的评估作用域。 */
|
|
178
|
+
readonly objScope?: IFeatureFlagScopeContext
|
|
179
|
+
/** 由 Swagger 生成客户端或厂商 SDK 适配的数据源。 */
|
|
180
|
+
readonly objSource?: IFeatureFlagSource
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** 完整 Feature Flag 目录及诊断状态。 */
|
|
184
|
+
export interface IUseFeatureFlagCatalogResult {
|
|
185
|
+
/** 本地按字典序声明的所有开关 Key。 */
|
|
186
|
+
readonly arrKeys: readonly string[]
|
|
187
|
+
/** 是否已经配置远端数据源。 */
|
|
188
|
+
readonly bIsConfigured: boolean
|
|
189
|
+
/** 当前是否允许请求远端目录。 */
|
|
190
|
+
readonly bIsEnabled: boolean
|
|
191
|
+
/** 最近一次远端请求是否失败。 */
|
|
192
|
+
readonly bIsError: boolean
|
|
193
|
+
/** 是否正在进行首次请求或后台刷新。 */
|
|
194
|
+
readonly bIsFetching: boolean
|
|
195
|
+
/** 是否仍在进行首次远端请求。 */
|
|
196
|
+
readonly bIsLoading: boolean
|
|
197
|
+
/** 最近一次成功更新 Query 缓存的时间戳。 */
|
|
198
|
+
readonly nUpdatedAt: number
|
|
199
|
+
/** 当前已校验的远端目录;尚未成功时为空。 */
|
|
200
|
+
readonly objCatalog: IFeatureFlagCatalog | undefined
|
|
201
|
+
/** 最近一次请求失败时的标准 Error。 */
|
|
202
|
+
readonly objError: Error | null
|
|
203
|
+
/** 当前请求与缓存使用的稳定作用域。 */
|
|
204
|
+
readonly objScope: IFeatureFlagScope
|
|
205
|
+
/** 后端目录版本;尚未加载时为空。 */
|
|
206
|
+
readonly strVersion: string | null
|
|
207
|
+
/** 根据本地定义评估指定开关,未知 Key 会立即失败。 */
|
|
208
|
+
readonly fnEvaluate: (strKey: string) => IFeatureFlagEvaluation
|
|
209
|
+
/** 重新请求当前作用域的远端目录。 */
|
|
210
|
+
readonly fnRefetch: () => Promise<void>
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** 单个 Feature Flag Hook 返回的评估结果和加载诊断。 */
|
|
214
|
+
export interface IUseFeatureFlagResult extends IFeatureFlagEvaluation {
|
|
215
|
+
/** 是否已经配置远端数据源。 */
|
|
216
|
+
readonly bIsConfigured: boolean
|
|
217
|
+
/** 当前是否允许请求远端目录。 */
|
|
218
|
+
readonly bIsEnabled: boolean
|
|
219
|
+
/** 最近一次远端请求是否失败。 */
|
|
220
|
+
readonly bIsError: boolean
|
|
221
|
+
/** 是否正在进行首次请求或后台刷新。 */
|
|
222
|
+
readonly bIsFetching: boolean
|
|
223
|
+
/** 是否仍在进行首次远端请求;此时安全默认值仍可立即使用。 */
|
|
224
|
+
readonly bIsLoading: boolean
|
|
225
|
+
/** 最近一次请求失败时的标准 Error。 */
|
|
226
|
+
readonly objError: Error | null
|
|
227
|
+
/** 后端目录版本;尚未加载时为空。 */
|
|
228
|
+
readonly strVersion: string | null
|
|
229
|
+
/** 重新请求当前作用域的远端目录。 */
|
|
230
|
+
readonly fnRefetch: () => Promise<void>
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** 声明式开关渲染边界的公共参数。 */
|
|
234
|
+
export interface IFeatureGateProps {
|
|
235
|
+
/** 开关启用时渲染的内容。 */
|
|
236
|
+
readonly children: ReactNode
|
|
237
|
+
/** 开关关闭或回退为关闭时渲染的内容,默认不渲染。 */
|
|
238
|
+
readonly objFallback?: ReactNode
|
|
239
|
+
/** 本地定义表中已经声明的稳定开关 Key。 */
|
|
240
|
+
readonly strFlagKey: string
|
|
241
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Outlet } from '@tanstack/react-router'
|
|
2
|
+
import { objAppConfig } from '@/config/appConfig'
|
|
3
|
+
import { BrandLogo } from '@/components/BrandLogo'
|
|
4
|
+
|
|
5
|
+
export function AuthLayout() {
|
|
6
|
+
return (
|
|
7
|
+
<div className='flex min-h-svh w-full items-center justify-center px-4 py-8'>
|
|
8
|
+
<div className='flex w-full max-w-sm flex-col gap-6'>
|
|
9
|
+
<header className='flex items-center justify-center'>
|
|
10
|
+
<BrandLogo strClassName='me-2 size-8 rounded-lg object-contain' />
|
|
11
|
+
<h1 className='text-xl font-medium'>{objAppConfig.brand.strName}</h1>
|
|
12
|
+
</header>
|
|
13
|
+
<Outlet />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { useMemo, useState } from 'react'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
import { useForm } from 'react-hook-form'
|
|
4
|
+
import { zodResolver } from '@hookform/resolvers/zod'
|
|
5
|
+
import { useLocaleMessages } from '@/locale'
|
|
6
|
+
import { Loader2, LogIn } from 'lucide-react'
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
import { Button } from '@/components/ui/button'
|
|
9
|
+
import {
|
|
10
|
+
Form,
|
|
11
|
+
FormControl,
|
|
12
|
+
FormField,
|
|
13
|
+
FormItem,
|
|
14
|
+
FormLabel,
|
|
15
|
+
FormMessage,
|
|
16
|
+
} from '@/components/ui/form'
|
|
17
|
+
import { Input } from '@/components/ui/input'
|
|
18
|
+
import { PasswordInput } from '@/components/PasswordInput'
|
|
19
|
+
import { objSignInMessages } from '../messages'
|
|
20
|
+
import type { TSignInValues } from '../types'
|
|
21
|
+
|
|
22
|
+
interface IUserAuthFormProps extends Omit<
|
|
23
|
+
React.HTMLAttributes<HTMLFormElement>,
|
|
24
|
+
'onSubmit'
|
|
25
|
+
> {
|
|
26
|
+
strError?: string | null
|
|
27
|
+
fnOnSubmit: (objValues: TSignInValues) => void | Promise<void>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function UserAuthForm({
|
|
31
|
+
className: strClassName,
|
|
32
|
+
strError,
|
|
33
|
+
fnOnSubmit,
|
|
34
|
+
...objProps
|
|
35
|
+
}: IUserAuthFormProps) {
|
|
36
|
+
const [bIsLoading, fnSetIsLoading] = useState(false)
|
|
37
|
+
const { fnTranslate } = useLocaleMessages(objSignInMessages)
|
|
38
|
+
const objFormSchema = useMemo(
|
|
39
|
+
() =>
|
|
40
|
+
z.object({
|
|
41
|
+
phone: z.string().trim().min(1, fnTranslate('accountRequired')),
|
|
42
|
+
password: z
|
|
43
|
+
.string()
|
|
44
|
+
.min(1, fnTranslate('passwordRequired'))
|
|
45
|
+
.min(7, fnTranslate('passwordMinimum')),
|
|
46
|
+
}),
|
|
47
|
+
[fnTranslate]
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
const objForm = useForm<TSignInValues>({
|
|
51
|
+
resolver: zodResolver(objFormSchema),
|
|
52
|
+
defaultValues: {
|
|
53
|
+
phone: '',
|
|
54
|
+
password: '',
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
async function fnHandleSubmit(objData: TSignInValues) {
|
|
59
|
+
fnSetIsLoading(true)
|
|
60
|
+
try {
|
|
61
|
+
await fnOnSubmit(objData)
|
|
62
|
+
} finally {
|
|
63
|
+
fnSetIsLoading(false)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Form {...objForm}>
|
|
69
|
+
<form
|
|
70
|
+
onSubmit={objForm.handleSubmit(fnHandleSubmit)}
|
|
71
|
+
className={cn('grid gap-3', strClassName)}
|
|
72
|
+
{...objProps}
|
|
73
|
+
>
|
|
74
|
+
<FormField
|
|
75
|
+
control={objForm.control}
|
|
76
|
+
name='phone'
|
|
77
|
+
render={({ field: objField }) => (
|
|
78
|
+
<FormItem>
|
|
79
|
+
<FormLabel>{fnTranslate('accountLabel')}</FormLabel>
|
|
80
|
+
<FormControl>
|
|
81
|
+
<Input
|
|
82
|
+
inputMode='tel'
|
|
83
|
+
autoComplete='username'
|
|
84
|
+
placeholder={fnTranslate('accountPlaceholder')}
|
|
85
|
+
{...objField}
|
|
86
|
+
/>
|
|
87
|
+
</FormControl>
|
|
88
|
+
<FormMessage />
|
|
89
|
+
</FormItem>
|
|
90
|
+
)}
|
|
91
|
+
/>
|
|
92
|
+
<FormField
|
|
93
|
+
control={objForm.control}
|
|
94
|
+
name='password'
|
|
95
|
+
render={({ field: objField }) => (
|
|
96
|
+
<FormItem>
|
|
97
|
+
<FormLabel>{fnTranslate('passwordLabel')}</FormLabel>
|
|
98
|
+
<FormControl>
|
|
99
|
+
<PasswordInput
|
|
100
|
+
autoComplete='current-password'
|
|
101
|
+
placeholder='********'
|
|
102
|
+
{...objField}
|
|
103
|
+
/>
|
|
104
|
+
</FormControl>
|
|
105
|
+
<FormMessage />
|
|
106
|
+
</FormItem>
|
|
107
|
+
)}
|
|
108
|
+
/>
|
|
109
|
+
{strError ? (
|
|
110
|
+
<p role='alert' className='text-sm text-destructive'>
|
|
111
|
+
{strError}
|
|
112
|
+
</p>
|
|
113
|
+
) : null}
|
|
114
|
+
<Button className='mt-2' disabled={bIsLoading}>
|
|
115
|
+
{bIsLoading ? <Loader2 className='animate-spin' /> : <LogIn />}
|
|
116
|
+
{fnTranslate('submit')}
|
|
117
|
+
</Button>
|
|
118
|
+
</form>
|
|
119
|
+
</Form>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { useNavigate, useSearch } from '@tanstack/react-router'
|
|
3
|
+
import { objAppConfig } from '@/config/appConfig'
|
|
4
|
+
import { useLocaleMessages } from '@/locale'
|
|
5
|
+
import { fnReadAuthError, fnSignInWithCredentials } from '@/api/authSession'
|
|
6
|
+
import { objDemoCredentials } from '@/api/demoAuthClient'
|
|
7
|
+
import { fnGetPostSignInPath } from '@/lib/navigationRedirect'
|
|
8
|
+
import {
|
|
9
|
+
Card,
|
|
10
|
+
CardContent,
|
|
11
|
+
CardDescription,
|
|
12
|
+
CardHeader,
|
|
13
|
+
CardTitle,
|
|
14
|
+
} from '@/components/ui/card'
|
|
15
|
+
import { UserAuthForm } from './components/UserAuthForm'
|
|
16
|
+
import { objSignInMessages } from './messages'
|
|
17
|
+
import type { TSignInValues } from './types'
|
|
18
|
+
|
|
19
|
+
export function SignIn() {
|
|
20
|
+
const fnNavigate = useNavigate()
|
|
21
|
+
const { fnTranslate } = useLocaleMessages(objSignInMessages)
|
|
22
|
+
const { redirect: strRedirect } = useSearch({ from: '/_guest/sign-in' })
|
|
23
|
+
const [strAuthError, fnSetAuthError] = useState<string | null>(null)
|
|
24
|
+
|
|
25
|
+
async function fnHandleSignIn(objValues: TSignInValues) {
|
|
26
|
+
fnSetAuthError(null)
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
await fnSignInWithCredentials({
|
|
30
|
+
strPhone: objValues.phone,
|
|
31
|
+
strPassword: objValues.password,
|
|
32
|
+
})
|
|
33
|
+
} catch (objError) {
|
|
34
|
+
fnSetAuthError(
|
|
35
|
+
fnReadAuthError(objError, {
|
|
36
|
+
strFallbackMessage: fnTranslate('fallbackError'),
|
|
37
|
+
strNetworkMessage: fnTranslate('networkError'),
|
|
38
|
+
})
|
|
39
|
+
)
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
await fnNavigate({
|
|
44
|
+
href: fnGetPostSignInPath(strRedirect),
|
|
45
|
+
replace: true,
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Card className='w-full gap-4'>
|
|
51
|
+
<CardHeader>
|
|
52
|
+
<CardTitle className='text-lg tracking-tight'>
|
|
53
|
+
{fnTranslate('cardTitle')}
|
|
54
|
+
</CardTitle>
|
|
55
|
+
<CardDescription>{fnTranslate('cardDescription')}</CardDescription>
|
|
56
|
+
</CardHeader>
|
|
57
|
+
<CardContent>
|
|
58
|
+
{objAppConfig.runtime.strMode === 'demo' ? (
|
|
59
|
+
<div className='mb-4 rounded-lg border border-primary/20 bg-primary/5 p-3 text-sm'>
|
|
60
|
+
<p className='font-medium'>{fnTranslate('demoTitle')}</p>
|
|
61
|
+
<p className='mt-1 text-muted-foreground'>
|
|
62
|
+
{fnTranslate('demoAccount')} {objDemoCredentials.strPhone},{' '}
|
|
63
|
+
{fnTranslate('demoPassword')} {objDemoCredentials.strPassword}
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
66
|
+
) : null}
|
|
67
|
+
<UserAuthForm strError={strAuthError} fnOnSubmit={fnHandleSignIn} />
|
|
68
|
+
</CardContent>
|
|
69
|
+
</Card>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { fnDefineLocaleMessages } from '@/locale'
|
|
2
|
+
|
|
3
|
+
/** 登录 Feature 自有的完整中英文语言包。 */
|
|
4
|
+
export const objSignInMessages = fnDefineLocaleMessages({
|
|
5
|
+
'en-US': {
|
|
6
|
+
accountLabel: 'Phone number',
|
|
7
|
+
accountPlaceholder: 'Enter your phone number',
|
|
8
|
+
accountRequired: 'Enter your phone number.',
|
|
9
|
+
cardDescription: 'Use an authorized organization account to continue.',
|
|
10
|
+
cardTitle: 'Sign in',
|
|
11
|
+
demoAccount: 'Account',
|
|
12
|
+
demoPassword: 'password',
|
|
13
|
+
demoTitle: 'Demo mode',
|
|
14
|
+
fallbackError: 'Sign-in failed. Check your account and password.',
|
|
15
|
+
networkError: 'Could not reach the authentication service. Try again.',
|
|
16
|
+
passwordLabel: 'Password',
|
|
17
|
+
passwordMinimum: 'Password must contain at least 7 characters.',
|
|
18
|
+
passwordRequired: 'Enter your password.',
|
|
19
|
+
submit: 'Sign in',
|
|
20
|
+
},
|
|
21
|
+
'zh-CN': {
|
|
22
|
+
accountLabel: '手机号',
|
|
23
|
+
accountPlaceholder: '请输入手机号',
|
|
24
|
+
accountRequired: '请输入手机号。',
|
|
25
|
+
cardDescription: '请使用已获授权的组织账号继续访问。',
|
|
26
|
+
cardTitle: '登录',
|
|
27
|
+
demoAccount: '账号',
|
|
28
|
+
demoPassword: '密码',
|
|
29
|
+
demoTitle: '演示模式',
|
|
30
|
+
fallbackError: '登录失败,请检查手机号和密码。',
|
|
31
|
+
networkError: '无法连接认证服务,请稍后重试。',
|
|
32
|
+
passwordLabel: '密码',
|
|
33
|
+
passwordMinimum: '密码至少需要 7 个字符。',
|
|
34
|
+
passwordRequired: '请输入密码。',
|
|
35
|
+
submit: '登录',
|
|
36
|
+
},
|
|
37
|
+
})
|