@team-codeme/crud-forge 0.0.0-stage → 1.0.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/.cursor/agents/generator-engineer.md +31 -0
- package/.cursor/agents/keycloak-engineer.md +33 -0
- package/.cursor/agents/qa-engineer.md +32 -0
- package/.cursor/agents/security-reviewer.md +30 -0
- package/.cursor/mcp.json +13 -0
- package/.cursor/rules/crudforge-precautions.mdc +16 -0
- package/.cursor/rules/playwright-browser.mdc +30 -0
- package/.cursor/rules/readme-todo-sync.mdc +13 -0
- package/.env.qa.example +19 -0
- package/.github/workflows/qa-live.yml +32 -0
- package/.github/workflows/qa.yml +27 -0
- package/.vscode/settings.json +32 -0
- package/QA/IAM-PLAN.md +25 -0
- package/QA/IAM-RESULTS.md +39 -0
- package/QA/IAM-TESTCASES.md +36 -0
- package/QA/IAM-TODO.md +7 -0
- package/QA/KEYCLOAK-BOOTSTRAP.md +105 -0
- package/QA/PLAN.md +43 -0
- package/QA/RESULTS.md +59 -0
- package/QA/TESTCASES.md +65 -0
- package/QA/TODO.md +14 -0
- package/QA/pmb-dev/README.md +49 -0
- package/QA/pmb-dev/config/config.yml +152 -0
- package/QA/pmb-dev/gdl/i.gdl +17 -0
- package/README.md +851 -2
- package/Todo.md +207 -0
- package/assets/branding/crudforge-logo.png +0 -0
- package/assets/branding/crudforge-mark.png +0 -0
- package/branding/poster-crudforge.jpg +0 -0
- package/chat/last-chat/Investigating Mock Data Configuration.md +428 -0
- package/cli.js +167 -0
- package/config/default-config.yml +245 -0
- package/docs/performance/README.md +217 -0
- package/docs/performance/after.json +111 -0
- package/docs/performance/before.json +111 -0
- package/docs/quality/README.md +276 -0
- package/e2e/crudforge.e2e.yml +47 -0
- package/e2e/crudforge.field-profile.yml +33 -0
- package/e2e/crudforge.iam-live.yml +124 -0
- package/e2e/crudforge.iam.yml +62 -0
- package/e2e/tests/field-profile.spec.js +152 -0
- package/e2e/tests/generated-crud.spec.js +251 -0
- package/e2e/tests/iam-live.spec.js +149 -0
- package/e2e/tests/iam-pack.spec.js +151 -0
- package/e2e/tests/list-state.spec.js +73 -0
- package/features.csv +27 -0
- package/fuse-starter-pack/branding/crudforge-mark-source.jpg +0 -0
- package/fuse-starter-pack/branding/crudforge-mark-source.png +0 -0
- package/fuse-starter-pack/branding/crudforge-mark.png +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark-source.jpg +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark-source.png +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/Dockerfile +14 -0
- package/fuse-starter-pack/fuse-v21.1/LICENSE.md +6 -0
- package/fuse-starter-pack/fuse-v21.1/README.md +59 -0
- package/fuse-starter-pack/fuse-v21.1/angular.json +113 -0
- package/fuse-starter-pack/fuse-v21.1/eslint.config.ts +150 -0
- package/fuse-starter-pack/fuse-v21.1/nginx.conf +23 -0
- package/fuse-starter-pack/fuse-v21.1/nginx.dev.conf +18 -0
- package/fuse-starter-pack/fuse-v21.1/package-lock.json +11513 -0
- package/fuse-starter-pack/fuse-v21.1/package.json +69 -0
- package/fuse-starter-pack/fuse-v21.1/postcss.config.json +5 -0
- package/fuse-starter-pack/fuse-v21.1/prettier.config.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/proxy.conf.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/proxy.dev.conf.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/favicon.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/Geist-Italic.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/Geist.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/GeistMono-Italic.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/GeistMono.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/i18n/en.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/i18n/es.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/ES.svg +79 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/US.svg +14 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/where-to-find-other-flags.txt +5 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/logo/logo-mark.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/logo/logo.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/push.sh +27 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.config.server.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.config.ts +64 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.routes.server.ts +8 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.routes.ts +39 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.ts +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/index.ts +1 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/lucide.ts +1 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/provider.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/index.ts +2 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/local-storage.ts +109 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/provider.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/index.ts +2 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/media.ts +64 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/provider.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/index.ts +3 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/models/theming.ts +13 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/palette.ts +209 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/provider.ts +24 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/theming.ts +129 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/transloco/transloco-http-loader.ts +12 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/data/navigation.ts +176 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/layout.ts +77 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/language-switcher.ts +91 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/navigation.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/notifications.ts +252 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/scheme-switcher.ts +58 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/sidebar.ts +31 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/user.ts +132 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/data/academy.ts +753 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/data/model.ts +27 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/features/course.ts +318 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/features/courses.ts +228 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/routes.ts +14 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/data/contacts.ts +4372 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/data/model.ts +34 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/features/contact.ts +239 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/features/contacts.ts +185 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/data/file-manager.ts +261 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/data/model.ts +12 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/features/file-manager.ts +131 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/routes.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/ui/list.ts +164 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/faq.ts +288 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/guide.ts +134 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/home.ts +219 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/support.ts +161 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/routes.ts +33 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/data/model.ts +18 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/data/notes.ts +324 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/features/note.ts +152 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/features/notes.ts +118 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/data/model.ts +17 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/data/tasks.ts +562 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/features/task.ts +195 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/features/tasks.ts +271 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/analytics.ts +1620 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/finance.ts +1065 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/project.ts +376 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/analytics/analytics.ts +1096 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/finance/finance.ts +658 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/project/budget-table.ts +188 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/project/project.ts +565 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/routes.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/changelog/changelog.ts +932 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/building.ts +33 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/development.ts +42 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/installation.ts +47 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/routes.ts +45 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/error/features/error-page.ts +70 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/error/routes.ts +21 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/notifications/features/notifications.ts +262 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/notifications/routes.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/account.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/notifications.ts +134 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/plan-and-billing.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/security.ts +211 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/team.ts +188 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/layout.ts +109 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/routes.ts +37 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/welcome/welcome.component.ts +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/routes.ts +95 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/forgot-password/forgot-password.html +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/forgot-password/forgot-password.ts +51 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/reset-password/reset-password.html +82 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/reset-password/reset-password.ts +69 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-in/sign-in.html +132 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-in/sign-in.ts +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-up/sign-up.html +183 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-up/sign-up.ts +56 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/routes.ts +34 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/features/coming-soon.ts +156 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/layout/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/modules/home/features/home.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/modules/home/routes.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/routes.ts +30 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.mock.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.prod.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/index.html +66 -0
- package/fuse-starter-pack/fuse-v21.1/src/main.server.ts +11 -0
- package/fuse-starter-pack/fuse-v21.1/src/main.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/server.ts +70 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/base/base.css +63 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/base/typography.css +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/a.css +18 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/input.css +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/kbd.css +55 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/material.css +1149 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/styles.css +31 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/theme.css +147 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/utilities.css +563 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/variants.css +4 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/third-party/lucide-icons.css +12 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.app.json +16 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.json +37 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.spec.json +10 -0
- package/generator/README.md +12 -0
- package/generator/issues/.gitkeep +0 -0
- package/package.json +56 -4
- package/playwright.config.js +29 -0
- package/playwright.field-profile.config.js +6 -0
- package/playwright.iam-live.config.js +31 -0
- package/playwright.iam.config.js +29 -0
- package/playwright.list-state.config.js +6 -0
- package/playwright.performance.config.js +1 -0
- package/run-config-tests.sh +5 -0
- package/scripts/e2e-paths.js +89 -0
- package/scripts/e2e-prepare-field-profile.js +17 -0
- package/scripts/e2e-prepare-iam-live.js +135 -0
- package/scripts/e2e-prepare-iam.js +65 -0
- package/scripts/e2e-prepare.js +72 -0
- package/scripts/e2e-serve-iam-live.js +28 -0
- package/scripts/e2e-serve-iam.js +28 -0
- package/scripts/e2e-serve.js +28 -0
- package/scripts/performance/generate.js +17 -0
- package/scripts/performance/measure.js +55 -0
- package/scripts/postinstall.js +9 -0
- package/scripts/prepare-quality-apps.js +34 -0
- package/scripts/run-config-tests.js +63 -0
- package/src/assets/logo-with-lable.jpeg +0 -0
- package/src/assets/logo.jpeg +0 -0
- package/src/commands/bootstrap.js +92 -0
- package/src/commands/doctor.js +403 -0
- package/src/commands/generate.js +301 -0
- package/src/commands/init-config.js +310 -0
- package/src/commands/keycloak-options.js +182 -0
- package/src/commands/validate.js +52 -0
- package/src/config/auth-config.js +183 -0
- package/src/config/default-values.js +235 -0
- package/src/config/env-refs.js +71 -0
- package/src/config/field-preferences.js +99 -0
- package/src/config/input-sources.js +104 -0
- package/src/config/load-config.js +166 -0
- package/src/config/proxy-routes.js +44 -0
- package/src/generator/access-control-tools.js +334 -0
- package/src/generator/ai-docs.js +691 -0
- package/src/generator/application-tests.js +252 -0
- package/src/generator/auth-pack.js +965 -0
- package/src/generator/embed-config.js +431 -0
- package/src/generator/entity-layout.js +30 -0
- package/src/generator/fuse-build.js +57 -0
- package/src/generator/fuse-runtime.js +344 -0
- package/src/generator/generated-banner.js +137 -0
- package/src/generator/index.js +874 -0
- package/src/generator/project-output.js +126 -0
- package/src/generator/team-pack.js +220 -0
- package/src/index.js +68 -0
- package/src/parser/gdl-parser.js +169 -0
- package/src/parser/jdl-parser.js +171 -0
- package/src/presets/pmb-test.js +139 -0
- package/src/presets/static-source.js +73 -0
- package/src/presets/store.js +96 -0
- package/src/provision/admin-service.js +148 -0
- package/src/provision/bootstrap.js +147 -0
- package/src/provision/http.js +123 -0
- package/src/provision/keycloak-admin-rest.js +335 -0
- package/src/provision/state.js +51 -0
- package/src/provision/token.js +52 -0
- package/src/templates/angular/auth/access-control.service.ts.ejs +179 -0
- package/src/templates/angular/auth/access-ctrl.pipe.ts.ejs +20 -0
- package/src/templates/angular/auth/auth.guard.ts.ejs +27 -0
- package/src/templates/angular/auth/auth.interceptor.ts.ejs +53 -0
- package/src/templates/angular/auth/auth.service.ts.ejs +594 -0
- package/src/templates/angular/auth/auth.utils.ts.ejs +28 -0
- package/src/templates/angular/auth/current-user.ts.ejs +24 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.css.ejs +95 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.html.ejs +33 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.ts.ejs +23 -0
- package/src/templates/angular/auth/fuse-account.ts.ejs +234 -0
- package/src/templates/angular/auth/fuse-user.ts.ejs +264 -0
- package/src/templates/angular/auth/has-permission.directive.ts.ejs +51 -0
- package/src/templates/angular/auth/index.ts.ejs +24 -0
- package/src/templates/angular/auth/keycloak-admin.service.ts.ejs +670 -0
- package/src/templates/angular/auth/landing.guard.ts.ejs +61 -0
- package/src/templates/angular/auth/no-auth.guard.ts.ejs +19 -0
- package/src/templates/angular/auth/permission-attribute.util.ts.ejs +182 -0
- package/src/templates/angular/auth/sign-in.ts.ejs +60 -0
- package/src/templates/angular/entity/_entity_.model.ts.ejs +64 -0
- package/src/templates/angular/entity/_entity_.routes.ts.ejs +9 -0
- package/src/templates/angular/entity/components/forms/form/_entity_-form.component.html.ejs +168 -0
- package/src/templates/angular/entity/components/forms/form/_entity_-form.component.ts.ejs +175 -0
- package/src/templates/angular/entity/components/forms/form-page/_entity_-form-page.component.html.ejs +10 -0
- package/src/templates/angular/entity/components/forms/form-page/_entity_-form-page.component.ts.ejs +86 -0
- package/src/templates/angular/entity/components/forms/update/_entity_-form.service.ts.ejs +136 -0
- package/src/templates/angular/entity/components/interaction/actions/_entity_-actions.component.html.ejs +68 -0
- package/src/templates/angular/entity/components/interaction/actions/_entity_-actions.component.ts.ejs +69 -0
- package/src/templates/angular/entity/components/interaction/filter/_entity_-filter.component.html.ejs +111 -0
- package/src/templates/angular/entity/components/interaction/filter/_entity_-filter.component.ts.ejs +102 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.css.ejs +33 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.html.ejs +29 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.ts.ejs +93 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.css.ejs +54 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.html.ejs +58 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.ts.ejs +47 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.html.ejs +419 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.scss.ejs +48 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.ts.ejs +592 -0
- package/src/templates/angular/entity/service/_entity_.service.ts.ejs +153 -0
- package/src/templates/angular/entity/settings/_entity_.settings.ts.ejs +49 -0
- package/src/templates/angular/enums/_enum_.model.ts.ejs +11 -0
- package/src/templates/angular/iam/change-password.component.html.ejs +39 -0
- package/src/templates/angular/iam/change-password.component.ts.ejs +44 -0
- package/src/templates/angular/iam/no-access.component.ts.ejs +17 -0
- package/src/templates/angular/iam/role-list.component.html.ejs +331 -0
- package/src/templates/angular/iam/role-list.component.scss.ejs +107 -0
- package/src/templates/angular/iam/role-list.component.ts.ejs +597 -0
- package/src/templates/angular/iam/role-management/role-header.component.html.ejs +51 -0
- package/src/templates/angular/iam/role-management/role-header.component.ts.ejs +45 -0
- package/src/templates/angular/iam/role-management/role-inheritance.component.html.ejs +15 -0
- package/src/templates/angular/iam/role-management/role-inheritance.component.ts.ejs +19 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.css.ejs +24 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.html.ejs +108 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.ts.ejs +122 -0
- package/src/templates/angular/iam/role-management/role-users.component.html.ejs +104 -0
- package/src/templates/angular/iam/role-management/role-users.component.ts.ejs +53 -0
- package/src/templates/angular/iam/role-management/user-select-dialog.component.html.ejs +113 -0
- package/src/templates/angular/iam/role-management/user-select-dialog.component.ts.ejs +157 -0
- package/src/templates/angular/iam/role-permission-matrix.component.html.ejs +355 -0
- package/src/templates/angular/iam/role-permission-matrix.component.scss.ejs +217 -0
- package/src/templates/angular/iam/role-permission-matrix.component.ts.ejs +800 -0
- package/src/templates/angular/iam/screen-catalog.ts.ejs +147 -0
- package/src/templates/angular/iam/shared/confirm-dialog.component.ts.ejs +83 -0
- package/src/templates/angular/iam/shared/matrix-hierarchy.util.ts.ejs +196 -0
- package/src/templates/angular/iam/shared/permission-matrix-sound.ts.ejs +59 -0
- package/src/templates/angular/iam/shared/role-display.util.ts.ejs +43 -0
- package/src/templates/angular/iam/shared/role-permission-skeleton.component.ts.ejs +54 -0
- package/src/templates/angular/iam/shared/screen-matrix.util.ts.ejs +554 -0
- package/src/templates/angular/iam/shared/screen-navigation-map.ts.ejs +187 -0
- package/src/templates/angular/iam/shared/screen-navigation.registry.ts.ejs +64 -0
- package/src/templates/angular/iam/shared/text-highlight.pipe.ts.ejs +39 -0
- package/src/templates/angular/iam/user-access-matrix.component.html.ejs +212 -0
- package/src/templates/angular/iam/user-access-matrix.component.scss.ejs +34 -0
- package/src/templates/angular/iam/user-access-matrix.component.ts.ejs +239 -0
- package/src/templates/angular/iam/user-detail.component.html.ejs +143 -0
- package/src/templates/angular/iam/user-detail.component.ts.ejs +108 -0
- package/src/templates/angular/iam/user-form.component.html.ejs +63 -0
- package/src/templates/angular/iam/user-form.component.ts.ejs +100 -0
- package/src/templates/angular/iam/user-list.component.html.ejs +369 -0
- package/src/templates/angular/iam/user-list.component.scss.ejs +242 -0
- package/src/templates/angular/iam/user-list.component.ts.ejs +446 -0
- package/src/templates/angular/iam/user-management.routes.ts.ejs +47 -0
- package/src/templates/angular/iam/user-permission-matrix.component.html.ejs +231 -0
- package/src/templates/angular/iam/user-permission-matrix.component.scss.ejs +216 -0
- package/src/templates/angular/iam/user-permission-matrix.component.ts.ejs +516 -0
- package/src/templates/angular/shared/base/audit-user-name.pipe.ts.ejs +69 -0
- package/src/templates/angular/shared/base/base-filter.component.ts.ejs +245 -0
- package/src/templates/angular/shared/base/base-form.component.ts.ejs +109 -0
- package/src/templates/angular/shared/base/base-list.component.ts.ejs +507 -0
- package/src/templates/angular/shared/base/filter-types.ts.ejs +55 -0
- package/src/templates/angular/shared/base/input-format.directive.ts.ejs +47 -0
- package/src/templates/angular/shared/base/input-format.ts.ejs +15 -0
- package/src/templates/angular/shared/confirm-with-input-dialog.component.ts.ejs +91 -0
- package/src/templates/angular/shared/confirmation-dialog.component.ts.ejs +80 -0
- package/src/templates/angular/shared/list-styles.css.ejs +103 -0
- package/src/templates/angular/shared/loading-overlay.component.ts.ejs +24 -0
- package/src/templates/angular/shared/resizable.directive.ts.ejs +115 -0
- package/src/templates/angular/shared/snackbar-styles.css.ejs +11 -0
- package/src/templates/fuse-packs/access-control-tools/access-control-sync.js +819 -0
- package/src/templates/fuse-packs/access-control-tools/build-rename-map.js +67 -0
- package/src/templates/fuse-packs/access-control-tools/inject-qa-ids.js +14 -0
- package/src/templates/fuse-packs/access-control-tools/lib/hierarchy-scanner.js +628 -0
- package/src/templates/fuse-packs/access-control-tools/lib/hierarchy-scanner.test.js +323 -0
- package/src/templates/fuse-packs/access-control-tools/lib/html-scanner.js +362 -0
- package/src/templates/fuse-packs/access-control-tools/lib/id-rules.duplicate.test.js +136 -0
- package/src/templates/fuse-packs/access-control-tools/lib/id-rules.js +1095 -0
- package/src/templates/fuse-packs/access-control-tools/lib/ts-component-index.js +482 -0
- package/src/templates/fuse-packs/access-control-tools/output/.gitkeep +0 -0
- package/src/templates/fuse-packs/access-control-tools/run.sh +223 -0
- package/src/templates/fuse-packs/access-control-tools/scan-access-control.js +14 -0
- package/src/templates/fuse-packs/iam-assets/sound/apple-play.mp3 +0 -0
- package/src/templates/fuse-packs/iam-assets/sound/remove.mp3 +0 -0
- package/src/templates/generator/README.md +12 -0
- package/src/templates/testing/ci.cjs +45 -0
- package/src/templates/testing/mock.cjs +149 -0
- package/src/templates/testing/playwright.config.cjs +25 -0
- package/src/templates/testing/serve.cjs +22 -0
- package/src/templates/testing/smoke.spec.cjs +180 -0
- package/src/utils/branding.js +39 -0
- package/src/utils/colors.js +18 -0
- package/src/utils/diff.js +109 -0
- package/src/utils/merger.js +115 -0
- package/src/validator/backend-diagnostics.js +30 -0
- package/src/validator/blueprint-validator.js +276 -0
- package/src/validator/diagnostics.js +608 -0
- package/src/validator/pattern.js +28 -0
- package/test/auth-interceptor.js +84 -0
- package/test/auth-provision-checks.js +297 -0
- package/test/field-preferences.js +145 -0
- package/test/fixtures/field-profile.gdl +7 -0
- package/test/fixtures/mock.jdl +17 -0
- package/test/fixtures/mock.png +0 -0
- package/test/fixtures/performance/config.yml +33 -0
- package/test/fixtures/performance/large.gdl +199 -0
- package/test/fixtures/performance/small.gdl +7 -0
- package/test/fixtures/quality/custom.yml +22 -0
- package/test/fixtures/quality/go-duck.yml +22 -0
- package/test/fixtures/quality/jhipster.yml +30 -0
- package/test/fixtures/quality/representative.gdl +14 -0
- package/test/list-state.js +138 -0
- package/test/micro-functions-layout.js +95 -0
- package/test/performance-generation.js +32 -0
- package/test/pmb-preset.js +127 -0
- package/test/project-workflow.js +111 -0
- package/test/quality-features.js +250 -0
- package/test/verify-commands.js +83 -0
- package/test/verify.js +959 -0
- package/test-files/GDL/example.gdl +15 -0
- package/test-files/JDL/example.jdl +15 -0
- package/test-files/config/crudforge.config.yml +127 -0
- package/test-run.sh +272 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Regression tests for hierarchy scanner + TS AST component index.
|
|
5
|
+
* Run: node src/app/domains/admin/modules/apps/shared/access-control-tools/lib/hierarchy-scanner.test.js
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const os = require('os');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const assert = require('assert');
|
|
12
|
+
const { extractComponentsFromFile, buildComponentCatalog } = require('./ts-component-index');
|
|
13
|
+
const { buildScreenNavigationHierarchy } = require('./hierarchy-scanner');
|
|
14
|
+
|
|
15
|
+
const ORIGINAL_UNRESOLVED_SELECTORS = [
|
|
16
|
+
'app-geo-location-details',
|
|
17
|
+
'app-approval-type-dropdown',
|
|
18
|
+
'app-damage-loss-record-form',
|
|
19
|
+
'app-geo-location-map',
|
|
20
|
+
'app-geo-map',
|
|
21
|
+
'app-role-header',
|
|
22
|
+
'app-role-users',
|
|
23
|
+
'app-role-inheritance',
|
|
24
|
+
'app-role-permissions',
|
|
25
|
+
'app-paddy-stock-summary',
|
|
26
|
+
'app-table',
|
|
27
|
+
'app-about-building-card',
|
|
28
|
+
'app-atti-cards-list-card',
|
|
29
|
+
'app-capacity-details-card',
|
|
30
|
+
'app-manager-profile-card',
|
|
31
|
+
'app-assigned-staff-card',
|
|
32
|
+
'app-warehouse-audit-card',
|
|
33
|
+
'app-lease-details-card',
|
|
34
|
+
'app-warehouse-details-card',
|
|
35
|
+
'app-assigned-buildings-card',
|
|
36
|
+
'app-atti-card-summary-card',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
function write(file, content) {
|
|
40
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
41
|
+
fs.writeFileSync(file, content, 'utf8');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function testMultiComponentAstIndex() {
|
|
45
|
+
const source = `
|
|
46
|
+
import { Component } from '@angular/core';
|
|
47
|
+
|
|
48
|
+
@Component({
|
|
49
|
+
selector: 'app-damage-loss-record-form',
|
|
50
|
+
templateUrl: './form.html',
|
|
51
|
+
standalone: true,
|
|
52
|
+
imports: [],
|
|
53
|
+
})
|
|
54
|
+
export class DamageLossRecordFormComponent {
|
|
55
|
+
readonly SCREEN = 'damage-loss-record-form';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@Component({
|
|
59
|
+
selector: 'app-damage-action-choice-dialog',
|
|
60
|
+
template: '<p>dialog</p>',
|
|
61
|
+
standalone: true,
|
|
62
|
+
})
|
|
63
|
+
export class DamageActionChoiceDialogComponent {}
|
|
64
|
+
`;
|
|
65
|
+
const comps = extractComponentsFromFile('/virtual/form.component.ts', source);
|
|
66
|
+
assert.strictEqual(comps.length, 2, 'indexes both @Component declarations');
|
|
67
|
+
const form = comps.find((c) => c.selector === 'app-damage-loss-record-form');
|
|
68
|
+
assert.ok(form, 'form selector present');
|
|
69
|
+
assert.strictEqual(form.screenId, 'damage-loss-record-form');
|
|
70
|
+
assert.strictEqual(form.className, 'DamageLossRecordFormComponent');
|
|
71
|
+
const dialog = comps.find((c) => c.selector === 'app-damage-action-choice-dialog');
|
|
72
|
+
assert.ok(dialog);
|
|
73
|
+
assert.strictEqual(dialog.screenId, null);
|
|
74
|
+
console.log('✓ multi-component AST index');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function testSkipsInputScreenPassthrough() {
|
|
78
|
+
const source = `
|
|
79
|
+
import { Component, Input } from '@angular/core';
|
|
80
|
+
@Component({ selector: 'app-about-warehouse-card', template: '', standalone: true })
|
|
81
|
+
export class AboutWarehouseCard {
|
|
82
|
+
@Input() SCREEN: string = 'warehouse-detail';
|
|
83
|
+
}
|
|
84
|
+
@Component({ selector: 'app-warehouse-detail', templateUrl: './x.html', standalone: true })
|
|
85
|
+
export class WarehouseDetailComponent {
|
|
86
|
+
readonly SCREEN = 'warehouse-detail';
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
const comps = extractComponentsFromFile('/virtual/pages/warehouse-details/x.ts', source);
|
|
90
|
+
const card = comps.find((c) => c.className === 'AboutWarehouseCard');
|
|
91
|
+
const page = comps.find((c) => c.className === 'WarehouseDetailComponent');
|
|
92
|
+
assert.strictEqual(card.screenId, null, '@Input() SCREEN is not own screen id');
|
|
93
|
+
assert.strictEqual(page.screenId, 'warehouse-detail');
|
|
94
|
+
console.log('✓ skips @Input() SCREEN host passthrough');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function testHierarchyResolvesEmbedAndWithoutScreen() {
|
|
98
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ac-hier-'));
|
|
99
|
+
const appsRoot = path.join(root, 'apps');
|
|
100
|
+
const pages = path.join(appsRoot, 'pages', 'demo');
|
|
101
|
+
const shared = path.join(appsRoot, 'shared', 'components', 'widget');
|
|
102
|
+
const mf = path.join(appsRoot, 'micro-functions', 'demoModule', 'entities', 'item', 'form');
|
|
103
|
+
|
|
104
|
+
write(
|
|
105
|
+
path.join(pages, 'host-page.component.ts'),
|
|
106
|
+
`
|
|
107
|
+
import { Component } from '@angular/core';
|
|
108
|
+
@Component({
|
|
109
|
+
selector: 'app-host-page',
|
|
110
|
+
templateUrl: './host-page.component.html',
|
|
111
|
+
standalone: true,
|
|
112
|
+
})
|
|
113
|
+
export class HostPageComponent {
|
|
114
|
+
readonly SCREEN = 'host-page';
|
|
115
|
+
}
|
|
116
|
+
`
|
|
117
|
+
);
|
|
118
|
+
write(
|
|
119
|
+
path.join(pages, 'host-page.component.html'),
|
|
120
|
+
`
|
|
121
|
+
<app-item-form></app-item-form>
|
|
122
|
+
<app-shared-widget></app-shared-widget>
|
|
123
|
+
<app-totally-missing></app-totally-missing>
|
|
124
|
+
`
|
|
125
|
+
);
|
|
126
|
+
write(
|
|
127
|
+
path.join(mf, 'item-form.component.ts'),
|
|
128
|
+
`
|
|
129
|
+
import { Component } from '@angular/core';
|
|
130
|
+
@Component({
|
|
131
|
+
selector: 'app-item-form',
|
|
132
|
+
template: '<button>save</button>',
|
|
133
|
+
standalone: true,
|
|
134
|
+
})
|
|
135
|
+
export class ItemFormComponent {
|
|
136
|
+
readonly SCREEN = 'item-form';
|
|
137
|
+
}
|
|
138
|
+
`
|
|
139
|
+
);
|
|
140
|
+
write(
|
|
141
|
+
path.join(shared, 'shared-widget.component.ts'),
|
|
142
|
+
`
|
|
143
|
+
import { Component } from '@angular/core';
|
|
144
|
+
@Component({
|
|
145
|
+
selector: 'app-shared-widget',
|
|
146
|
+
template: '<span>w</span>',
|
|
147
|
+
standalone: true,
|
|
148
|
+
})
|
|
149
|
+
export class SharedWidgetComponent {}
|
|
150
|
+
`
|
|
151
|
+
);
|
|
152
|
+
write(
|
|
153
|
+
path.join(appsRoot, 'demo.routes.ts'),
|
|
154
|
+
`
|
|
155
|
+
export const routes = [
|
|
156
|
+
{ path: 'host', component: HostPageComponent },
|
|
157
|
+
{ path: 'lazy', loadComponent: () => import('./pages/demo/host-page.component').then(m => m.HostPageComponent) },
|
|
158
|
+
];
|
|
159
|
+
`
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const hierarchy = buildScreenNavigationHierarchy({
|
|
163
|
+
workItems: [
|
|
164
|
+
{
|
|
165
|
+
tsFile: path.join(pages, 'host-page.component.ts'),
|
|
166
|
+
className: 'HostPageComponent',
|
|
167
|
+
screenId: 'host-page',
|
|
168
|
+
screenName: 'I-Host',
|
|
169
|
+
templateContent: fs.readFileSync(path.join(pages, 'host-page.component.html'), 'utf8'),
|
|
170
|
+
htmlPath: path.join(pages, 'host-page.component.html'),
|
|
171
|
+
fileContent: fs.readFileSync(path.join(pages, 'host-page.component.ts'), 'utf8'),
|
|
172
|
+
sourceType: 'pages',
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
appsRoot,
|
|
176
|
+
adminRoutesFile: null,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
assert.ok(hierarchy.pages.length >= 1, 'host page emitted');
|
|
180
|
+
const page = hierarchy.pages.find((p) => p.hostScreenId === 'host-page');
|
|
181
|
+
assert.ok(page, 'host-page entry');
|
|
182
|
+
assert.ok(
|
|
183
|
+
page.embeddedScreens.some((e) => e.screenId === 'item-form'),
|
|
184
|
+
'item-form embedded'
|
|
185
|
+
);
|
|
186
|
+
assert.ok(
|
|
187
|
+
!page.embeddedScreens.some((e) => e.screenId === 'app-shared-widget'),
|
|
188
|
+
'does not invent SCREEN for shared widget'
|
|
189
|
+
);
|
|
190
|
+
assert.ok(
|
|
191
|
+
hierarchy.resolvedWithoutScreen.some((r) => r.selector === 'app-shared-widget'),
|
|
192
|
+
'shared widget classified resolvedWithoutScreen'
|
|
193
|
+
);
|
|
194
|
+
assert.ok(
|
|
195
|
+
hierarchy.unresolved.some((u) => u.selector === 'app-totally-missing'),
|
|
196
|
+
'missing selector stays unresolved'
|
|
197
|
+
);
|
|
198
|
+
assert.ok(
|
|
199
|
+
!hierarchy.unresolved.some((u) => u.selector === 'app-shared-widget'),
|
|
200
|
+
'resolved widgets are not unresolved'
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
// Multi-parent: same embed under second host must not merge permissions (separate page entries)
|
|
204
|
+
write(
|
|
205
|
+
path.join(pages, 'other-page.component.ts'),
|
|
206
|
+
`
|
|
207
|
+
import { Component } from '@angular/core';
|
|
208
|
+
@Component({
|
|
209
|
+
selector: 'app-other-page',
|
|
210
|
+
templateUrl: './other-page.component.html',
|
|
211
|
+
standalone: true,
|
|
212
|
+
})
|
|
213
|
+
export class OtherPageComponent {
|
|
214
|
+
readonly SCREEN = 'other-page';
|
|
215
|
+
}
|
|
216
|
+
`
|
|
217
|
+
);
|
|
218
|
+
write(path.join(pages, 'other-page.component.html'), `<app-item-form></app-item-form>`);
|
|
219
|
+
|
|
220
|
+
const again = buildScreenNavigationHierarchy({
|
|
221
|
+
workItems: [
|
|
222
|
+
{
|
|
223
|
+
tsFile: path.join(pages, 'host-page.component.ts'),
|
|
224
|
+
className: 'HostPageComponent',
|
|
225
|
+
screenId: 'host-page',
|
|
226
|
+
screenName: 'I-Host',
|
|
227
|
+
templateContent: fs.readFileSync(path.join(pages, 'host-page.component.html'), 'utf8'),
|
|
228
|
+
htmlPath: path.join(pages, 'host-page.component.html'),
|
|
229
|
+
fileContent: '',
|
|
230
|
+
sourceType: 'pages',
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
tsFile: path.join(pages, 'other-page.component.ts'),
|
|
234
|
+
className: 'OtherPageComponent',
|
|
235
|
+
screenId: 'other-page',
|
|
236
|
+
screenName: 'I-Other',
|
|
237
|
+
templateContent: `<app-item-form></app-item-form>`,
|
|
238
|
+
htmlPath: path.join(pages, 'other-page.component.html'),
|
|
239
|
+
fileContent: '',
|
|
240
|
+
sourceType: 'pages',
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
appsRoot,
|
|
244
|
+
adminRoutesFile: null,
|
|
245
|
+
});
|
|
246
|
+
const hosts = again.pages.filter((p) =>
|
|
247
|
+
p.embeddedScreens.some((e) => e.screenId === 'item-form')
|
|
248
|
+
);
|
|
249
|
+
assert.ok(hosts.length >= 2, 'reusable form listed under multiple parents');
|
|
250
|
+
assert.notStrictEqual(hosts[0].hostScreenId, hosts[1].hostScreenId);
|
|
251
|
+
|
|
252
|
+
// Idempotency
|
|
253
|
+
const third = buildScreenNavigationHierarchy({
|
|
254
|
+
workItems: again.pages.length
|
|
255
|
+
? [
|
|
256
|
+
{
|
|
257
|
+
tsFile: path.join(pages, 'host-page.component.ts'),
|
|
258
|
+
className: 'HostPageComponent',
|
|
259
|
+
screenId: 'host-page',
|
|
260
|
+
screenName: 'I-Host',
|
|
261
|
+
templateContent: fs.readFileSync(path.join(pages, 'host-page.component.html'), 'utf8'),
|
|
262
|
+
htmlPath: path.join(pages, 'host-page.component.html'),
|
|
263
|
+
fileContent: '',
|
|
264
|
+
sourceType: 'pages',
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
tsFile: path.join(pages, 'other-page.component.ts'),
|
|
268
|
+
className: 'OtherPageComponent',
|
|
269
|
+
screenId: 'other-page',
|
|
270
|
+
screenName: 'I-Other',
|
|
271
|
+
templateContent: `<app-item-form></app-item-form>`,
|
|
272
|
+
htmlPath: path.join(pages, 'other-page.component.html'),
|
|
273
|
+
fileContent: '',
|
|
274
|
+
sourceType: 'pages',
|
|
275
|
+
},
|
|
276
|
+
]
|
|
277
|
+
: [],
|
|
278
|
+
appsRoot,
|
|
279
|
+
adminRoutesFile: null,
|
|
280
|
+
});
|
|
281
|
+
assert.strictEqual(third.stats.embedEdgeCount, again.stats.embedEdgeCount);
|
|
282
|
+
assert.strictEqual(third.stats.unresolvedCount, again.stats.unresolvedCount);
|
|
283
|
+
assert.strictEqual(third.pages.length, again.pages.length);
|
|
284
|
+
|
|
285
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
286
|
+
console.log('✓ hierarchy embed / without-screen / multi-parent / idempotent');
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function testCatalogPrefersScreenOwnerForSelector() {
|
|
290
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ac-cat-'));
|
|
291
|
+
const appsRoot = path.join(root, 'apps');
|
|
292
|
+
const dir = path.join(appsRoot, 'micro-functions', 'x', 'entities', 'y', 'form');
|
|
293
|
+
write(
|
|
294
|
+
path.join(dir, 'multi.component.ts'),
|
|
295
|
+
`
|
|
296
|
+
import { Component } from '@angular/core';
|
|
297
|
+
@Component({ selector: 'app-form', template: '', standalone: true })
|
|
298
|
+
export class FormComponent { readonly SCREEN = 'the-form'; }
|
|
299
|
+
@Component({ selector: 'app-dialog', template: '', standalone: true })
|
|
300
|
+
export class DialogComponent {}
|
|
301
|
+
`
|
|
302
|
+
);
|
|
303
|
+
const catalog = buildComponentCatalog([path.join(appsRoot, 'micro-functions')]);
|
|
304
|
+
assert.strictEqual(catalog.bySelector.get('app-form')?.screenId, 'the-form');
|
|
305
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
306
|
+
console.log('✓ catalog selector prefers SCREEN owner');
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function testOriginalSelectorsDocumented() {
|
|
310
|
+
assert.strictEqual(ORIGINAL_UNRESOLVED_SELECTORS.length, 21);
|
|
311
|
+
console.log('✓ original unresolved selector baseline documented (21 unique / 36 rows)');
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function main() {
|
|
315
|
+
testMultiComponentAstIndex();
|
|
316
|
+
testSkipsInputScreenPassthrough();
|
|
317
|
+
testCatalogPrefersScreenOwnerForSelector();
|
|
318
|
+
testHierarchyResolvesEmbedAndWithoutScreen();
|
|
319
|
+
testOriginalSelectorsDocumented();
|
|
320
|
+
console.log('\nAll hierarchy scanner regression tests passed.');
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
main();
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
resolveComponentId,
|
|
5
|
+
toQaId,
|
|
6
|
+
ensureUniqueId,
|
|
7
|
+
deduceComponentName,
|
|
8
|
+
deduceComponentType,
|
|
9
|
+
generateComponentDescription,
|
|
10
|
+
} = require('./id-rules');
|
|
11
|
+
|
|
12
|
+
function hasAttribute(tagContent, attributeName) {
|
|
13
|
+
return new RegExp(`\\s${attributeName}\\s*=`).test(tagContent);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function setOrReplaceAttribute(tagContent, name, value) {
|
|
17
|
+
const pattern = new RegExp(`\\s${name}\\s*=\\s*(["'])([^"']*)\\1`, 'i');
|
|
18
|
+
if (pattern.test(tagContent)) {
|
|
19
|
+
return tagContent.replace(pattern, ` ${name}="${value}"`);
|
|
20
|
+
}
|
|
21
|
+
const tagNameMatch = tagContent.match(/^<([a-zA-Z0-9-]+)/);
|
|
22
|
+
if (!tagNameMatch) {
|
|
23
|
+
return tagContent;
|
|
24
|
+
}
|
|
25
|
+
return tagContent.replace(tagNameMatch[0], `${tagNameMatch[0]} ${name}="${value}"`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function injectAccessCtrlIntoTag(tagContent, componentId, options = {}) {
|
|
29
|
+
const { rewriteIds = false } = options;
|
|
30
|
+
const accessCtrlCheck = `SCREEN | accessCtrl: '${componentId}'`;
|
|
31
|
+
const existing = tagContent.match(/accessCtrl\s*:\s*['"]([^'"]+)['"]/);
|
|
32
|
+
|
|
33
|
+
if (existing) {
|
|
34
|
+
if (!rewriteIds || existing[1] === componentId) {
|
|
35
|
+
return { tag: tagContent, accessCtrlId: existing[1], changed: false };
|
|
36
|
+
}
|
|
37
|
+
const updated = tagContent.replace(
|
|
38
|
+
/accessCtrl\s*:\s*['"][^'"]+['"]/,
|
|
39
|
+
`accessCtrl: '${componentId}'`
|
|
40
|
+
);
|
|
41
|
+
return { tag: updated, accessCtrlId: componentId, changed: updated !== tagContent };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const ngIfDoubleQuote = tagContent.match(/\*ngIf\s*=\s*"([^"]+)"/);
|
|
45
|
+
const ngIfSingleQuote = tagContent.match(/\*ngIf\s*=\s*'([^']+)'/);
|
|
46
|
+
|
|
47
|
+
let updated = tagContent;
|
|
48
|
+
if (ngIfDoubleQuote) {
|
|
49
|
+
const existingCondition = ngIfDoubleQuote[1];
|
|
50
|
+
if (!existingCondition.includes('accessCtrl')) {
|
|
51
|
+
updated = tagContent.replace(
|
|
52
|
+
/\*ngIf\s*=\s*"([^"]+)"/,
|
|
53
|
+
`*ngIf="${existingCondition} && (${accessCtrlCheck})"`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
} else if (ngIfSingleQuote) {
|
|
57
|
+
const existingCondition = ngIfSingleQuote[1];
|
|
58
|
+
if (!existingCondition.includes('accessCtrl')) {
|
|
59
|
+
updated = tagContent.replace(
|
|
60
|
+
/\*ngIf\s*=\s*'([^']+)'/,
|
|
61
|
+
`*ngIf='${existingCondition} && (${accessCtrlCheck})'`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
const tagNameMatch = tagContent.match(/^<([a-zA-Z0-9-]+)/);
|
|
66
|
+
if (tagNameMatch) {
|
|
67
|
+
updated = tagContent.replace(tagNameMatch[0], `${tagNameMatch[0]} *ngIf="${accessCtrlCheck}"`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return { tag: updated, accessCtrlId: componentId, changed: updated !== tagContent };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function isInteractiveTag(tagContent) {
|
|
75
|
+
const tagNameMatch = tagContent.match(/^<([a-zA-Z0-9-]+)/);
|
|
76
|
+
if (!tagNameMatch) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
const tagName = tagNameMatch[1].toLowerCase();
|
|
80
|
+
const hasClick =
|
|
81
|
+
tagContent.includes('(click)=') ||
|
|
82
|
+
tagContent.includes('on-click=') ||
|
|
83
|
+
tagContent.includes('[click]=');
|
|
84
|
+
const hasMatButton = /mat-(raised-|icon-|stroked-|flat-|mini-)?button/i.test(tagContent);
|
|
85
|
+
const hasRouterLink = /routerLink\s*=|\[routerLink\]\s*=/.test(tagContent);
|
|
86
|
+
const hasButtonRole = /role\s*=\s*["']button["']/.test(tagContent);
|
|
87
|
+
const isSubmit = /\btype\s*=\s*["']submit["']/i.test(tagContent);
|
|
88
|
+
|
|
89
|
+
if (tagName === 'button' || hasMatButton || hasRouterLink || hasButtonRole || isSubmit) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Non-button containers only if they have a click
|
|
94
|
+
if (hasClick) {
|
|
95
|
+
const skipContainers = new Set([
|
|
96
|
+
'span',
|
|
97
|
+
'div',
|
|
98
|
+
'mat-icon',
|
|
99
|
+
'p',
|
|
100
|
+
'h1',
|
|
101
|
+
'h2',
|
|
102
|
+
'h3',
|
|
103
|
+
'h4',
|
|
104
|
+
'h5',
|
|
105
|
+
'h6',
|
|
106
|
+
'form',
|
|
107
|
+
'mat-form-field',
|
|
108
|
+
'mat-label',
|
|
109
|
+
'mat-select',
|
|
110
|
+
'mat-option',
|
|
111
|
+
'input',
|
|
112
|
+
'textarea',
|
|
113
|
+
'table',
|
|
114
|
+
'tr',
|
|
115
|
+
'td',
|
|
116
|
+
'th',
|
|
117
|
+
'ul',
|
|
118
|
+
'li',
|
|
119
|
+
'section',
|
|
120
|
+
'header',
|
|
121
|
+
'footer',
|
|
122
|
+
'main',
|
|
123
|
+
'nav',
|
|
124
|
+
]);
|
|
125
|
+
// Allow clickable cards/links; skip pure chrome containers unless they look intentional
|
|
126
|
+
if (skipContainers.has(tagName) && !/cursor-pointer|role\s*=\s*["']button["']/.test(tagContent)) {
|
|
127
|
+
// Still process if it's clearly an action wrapper with meaningful click — resolveComponentId will noise-filter
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function hasOtherStructuralDirective(tagContent) {
|
|
137
|
+
return /\*(?!ngIf)[a-zA-Z0-9]+/.test(tagContent);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function stripAccessCtrlFromTag(tagContent) {
|
|
141
|
+
let updated = tagContent;
|
|
142
|
+
|
|
143
|
+
// *ngIf="SCREEN | accessCtrl: 'x'" → remove whole *ngIf if only accessCtrl
|
|
144
|
+
updated = updated.replace(/\s*\*ngIf\s*=\s*"SCREEN\s*\|\s*accessCtrl:\s*'[^']+'"/g, '');
|
|
145
|
+
updated = updated.replace(/\s*\*ngIf\s*=\s*'SCREEN\s*\|\s*accessCtrl:\s*"[^"]+"'/g, '');
|
|
146
|
+
|
|
147
|
+
// *ngIf="foo && (SCREEN | accessCtrl: 'x')" → *ngIf="foo"
|
|
148
|
+
updated = updated.replace(
|
|
149
|
+
/(\*ngIf\s*=\s*")([^"]*?)\s*&&\s*\(SCREEN\s*\|\s*accessCtrl:\s*'[^']+'\)(")/g,
|
|
150
|
+
'$1$2$3'
|
|
151
|
+
);
|
|
152
|
+
updated = updated.replace(
|
|
153
|
+
/(\*ngIf\s*=\s*")([^"]*?)\s*&&\s*\(SCREEN\s*\|\s*accessCtrl:\s*"[^"]+"\)(")/g,
|
|
154
|
+
'$1$2$3'
|
|
155
|
+
);
|
|
156
|
+
// leading accessCtrl && rest
|
|
157
|
+
updated = updated.replace(
|
|
158
|
+
/(\*ngIf\s*=\s*")\(SCREEN\s*\|\s*accessCtrl:\s*'[^']+'\)\s*&&\s*/g,
|
|
159
|
+
'$1'
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
return updated;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function stripQaAttrsFromTag(tagContent) {
|
|
166
|
+
let updated = tagContent;
|
|
167
|
+
for (const name of ['data-qa-id', 'data-component-id', 'data-screen-id', 'id']) {
|
|
168
|
+
const pattern = new RegExp(`\\s${name}\\s*=\\s*(["'])[^"']*\\1`, 'i');
|
|
169
|
+
// Only strip id when it looks like a qa- id
|
|
170
|
+
if (name === 'id') {
|
|
171
|
+
updated = updated.replace(/\sid\s*=\s*(["'])qa-[^"']*\1/i, '');
|
|
172
|
+
} else {
|
|
173
|
+
updated = updated.replace(pattern, '');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return updated;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Process one opening tag for access-control + QA attrs.
|
|
181
|
+
*
|
|
182
|
+
* @returns {{ modifiedTag, tagChanged, skipped, skipReason, discovery }}
|
|
183
|
+
*/
|
|
184
|
+
function processTag(tagContent, screenId, screenName, usedIds, options = {}) {
|
|
185
|
+
const { injectAccess = true, injectQa = true, rewriteIds = false } = options;
|
|
186
|
+
|
|
187
|
+
if (!isInteractiveTag(tagContent)) {
|
|
188
|
+
return { modifiedTag: tagContent, tagChanged: false, skipped: true, skipReason: 'not-interactive' };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Angular: multiple structural directives on one element is illegal
|
|
192
|
+
if (hasOtherStructuralDirective(tagContent) && injectAccess) {
|
|
193
|
+
// Still allow QA-only attrs on *ngFor buttons
|
|
194
|
+
if (!injectQa) {
|
|
195
|
+
return { modifiedTag: tagContent, tagChanged: false, skipped: true, skipReason: 'structural-directive' };
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
let componentId = resolveComponentId(tagContent, screenId, { rewriteIds });
|
|
200
|
+
if (!componentId) {
|
|
201
|
+
// On rewrite, strip previously injected noise ids from the tag
|
|
202
|
+
if (rewriteIds && (/accessCtrl\s*:/.test(tagContent) || /data-qa-id\s*=/.test(tagContent) || /\sid\s*=\s*["']qa-/.test(tagContent))) {
|
|
203
|
+
let cleaned = tagContent;
|
|
204
|
+
cleaned = stripAccessCtrlFromTag(cleaned);
|
|
205
|
+
cleaned = stripQaAttrsFromTag(cleaned);
|
|
206
|
+
return {
|
|
207
|
+
modifiedTag: cleaned,
|
|
208
|
+
tagChanged: cleaned !== tagContent,
|
|
209
|
+
skipped: true,
|
|
210
|
+
skipReason: 'noise-stripped',
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
return { modifiedTag: tagContent, tagChanged: false, skipped: true, skipReason: 'noise-or-unresolved' };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
componentId = ensureUniqueId(componentId, usedIds);
|
|
217
|
+
|
|
218
|
+
let updated = tagContent;
|
|
219
|
+
let changed = false;
|
|
220
|
+
let accessCtrlId = componentId;
|
|
221
|
+
|
|
222
|
+
const canInjectAccess =
|
|
223
|
+
injectAccess && !hasOtherStructuralDirective(tagContent);
|
|
224
|
+
|
|
225
|
+
if (canInjectAccess) {
|
|
226
|
+
const accessResult = injectAccessCtrlIntoTag(updated, componentId, { rewriteIds });
|
|
227
|
+
updated = accessResult.tag;
|
|
228
|
+
accessCtrlId = accessResult.accessCtrlId || componentId;
|
|
229
|
+
if (accessResult.changed) {
|
|
230
|
+
changed = true;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (injectQa) {
|
|
235
|
+
const qaId = toQaId(screenId, componentId);
|
|
236
|
+
const attrs = [
|
|
237
|
+
['data-screen-id', screenId],
|
|
238
|
+
['data-component-id', componentId],
|
|
239
|
+
['data-qa-id', qaId],
|
|
240
|
+
];
|
|
241
|
+
// Prefer data-qa-id as primary selector; only set id= when missing to reduce *ngFor collisions
|
|
242
|
+
if (!hasAttribute(updated, 'id') || rewriteIds) {
|
|
243
|
+
attrs.push(['id', qaId]);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
for (const [name, value] of attrs) {
|
|
247
|
+
const before = updated;
|
|
248
|
+
const existingMatch = updated.match(new RegExp(`\\s${name}\\s*=\\s*(["'])([^"']*)\\1`, 'i'));
|
|
249
|
+
const shouldWrite =
|
|
250
|
+
rewriteIds ||
|
|
251
|
+
!existingMatch ||
|
|
252
|
+
(name === 'data-screen-id' && existingMatch[2] !== value);
|
|
253
|
+
|
|
254
|
+
if (shouldWrite) {
|
|
255
|
+
updated = setOrReplaceAttribute(updated, name, value);
|
|
256
|
+
}
|
|
257
|
+
if (updated !== before) {
|
|
258
|
+
changed = true;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const componentName = deduceComponentName(componentId, screenId);
|
|
264
|
+
const componentType = deduceComponentType(componentId, screenId);
|
|
265
|
+
const discovery = {
|
|
266
|
+
screenName,
|
|
267
|
+
screenId,
|
|
268
|
+
componentName,
|
|
269
|
+
componentId,
|
|
270
|
+
componentType,
|
|
271
|
+
description: generateComponentDescription(componentId, componentName, componentType, screenId),
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
return {
|
|
275
|
+
modifiedTag: updated,
|
|
276
|
+
tagChanged: changed,
|
|
277
|
+
skipped: false,
|
|
278
|
+
discovery,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function parseHtmlAndInject(htmlContent, screenId, screenName, options = {}) {
|
|
283
|
+
let result = '';
|
|
284
|
+
let index = 0;
|
|
285
|
+
let insideTag = false;
|
|
286
|
+
let quoteChar = null;
|
|
287
|
+
let tagStart = 0;
|
|
288
|
+
let modified = false;
|
|
289
|
+
const usedIds = new Set();
|
|
290
|
+
const discoveries = [];
|
|
291
|
+
const skipped = [];
|
|
292
|
+
|
|
293
|
+
while (index < htmlContent.length) {
|
|
294
|
+
const char = htmlContent[index];
|
|
295
|
+
|
|
296
|
+
if (!insideTag) {
|
|
297
|
+
if (char === '<') {
|
|
298
|
+
if (htmlContent.startsWith('<!--', index)) {
|
|
299
|
+
const commentEnd = htmlContent.indexOf('-->', index);
|
|
300
|
+
if (commentEnd !== -1) {
|
|
301
|
+
result += htmlContent.substring(index, commentEnd + 3);
|
|
302
|
+
index = commentEnd + 3;
|
|
303
|
+
} else {
|
|
304
|
+
result += htmlContent.substring(index);
|
|
305
|
+
index = htmlContent.length;
|
|
306
|
+
}
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (htmlContent[index + 1] === '/') {
|
|
311
|
+
result += char;
|
|
312
|
+
index++;
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
insideTag = true;
|
|
317
|
+
quoteChar = null;
|
|
318
|
+
tagStart = index;
|
|
319
|
+
index++;
|
|
320
|
+
} else {
|
|
321
|
+
result += char;
|
|
322
|
+
index++;
|
|
323
|
+
}
|
|
324
|
+
} else if (quoteChar) {
|
|
325
|
+
if (char === quoteChar && htmlContent[index - 1] !== '\\') {
|
|
326
|
+
quoteChar = null;
|
|
327
|
+
}
|
|
328
|
+
index++;
|
|
329
|
+
} else if (char === '"' || char === "'") {
|
|
330
|
+
quoteChar = char;
|
|
331
|
+
index++;
|
|
332
|
+
} else if (char === '>') {
|
|
333
|
+
insideTag = false;
|
|
334
|
+
const tagContent = htmlContent.substring(tagStart, index + 1);
|
|
335
|
+
const processed = processTag(tagContent, screenId, screenName, usedIds, options);
|
|
336
|
+
if (processed.tagChanged) {
|
|
337
|
+
modified = true;
|
|
338
|
+
}
|
|
339
|
+
if (processed.discovery) {
|
|
340
|
+
discoveries.push(processed.discovery);
|
|
341
|
+
}
|
|
342
|
+
if (processed.skipped && processed.skipReason === 'noise-or-unresolved') {
|
|
343
|
+
skipped.push({ reason: processed.skipReason, snippet: tagContent.slice(0, 120) });
|
|
344
|
+
}
|
|
345
|
+
result += processed.modifiedTag;
|
|
346
|
+
index++;
|
|
347
|
+
} else {
|
|
348
|
+
index++;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return { html: result, modified, discoveries, skipped };
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
module.exports = {
|
|
356
|
+
parseHtmlAndInject,
|
|
357
|
+
processTag,
|
|
358
|
+
isInteractiveTag,
|
|
359
|
+
hasOtherStructuralDirective,
|
|
360
|
+
injectAccessCtrlIntoTag,
|
|
361
|
+
setOrReplaceAttribute,
|
|
362
|
+
};
|