@team-codeme/crud-forge 0.0.0-stage → 1.0.1
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,115 @@
|
|
|
1
|
+
const MARKERS = [
|
|
2
|
+
{ start: /\/\/ cforge-custom-code-start(?::(\w+))?/, end: /\/\/ cforge-custom-code-end/ },
|
|
3
|
+
{ start: /\/\* cforge-custom-code-start(?::(\w+))? \*\//, end: /\/\* cforge-custom-code-end \*\// },
|
|
4
|
+
{ start: /<!-- cforge-custom-code-start(?::(\w+))? -->/, end: /<!-- cforge-custom-code-end -->/ }
|
|
5
|
+
];
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Extracts developer custom sections from a file.
|
|
9
|
+
* @param {string} content
|
|
10
|
+
* @returns {object} - Key-value map of zone identifier to its content.
|
|
11
|
+
*/
|
|
12
|
+
function extractZones(content) {
|
|
13
|
+
const zones = {};
|
|
14
|
+
if (!content) return zones;
|
|
15
|
+
|
|
16
|
+
const lines = content.split(/\r?\n/);
|
|
17
|
+
let activeZoneKey = null;
|
|
18
|
+
let activeZoneContent = [];
|
|
19
|
+
let unnamedIndex = 0;
|
|
20
|
+
|
|
21
|
+
for (const line of lines) {
|
|
22
|
+
if (activeZoneKey === null) {
|
|
23
|
+
let match = null;
|
|
24
|
+
for (const m of MARKERS) {
|
|
25
|
+
match = line.match(m.start);
|
|
26
|
+
if (match) break;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (match) {
|
|
30
|
+
const label = match[1] || `unnamed_${unnamedIndex++}`;
|
|
31
|
+
activeZoneKey = label;
|
|
32
|
+
activeZoneContent = [];
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
let isEnd = false;
|
|
36
|
+
for (const m of MARKERS) {
|
|
37
|
+
if (m.end.test(line)) {
|
|
38
|
+
isEnd = true;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (isEnd) {
|
|
44
|
+
zones[activeZoneKey] = activeZoneContent.join('\n');
|
|
45
|
+
activeZoneKey = null;
|
|
46
|
+
} else {
|
|
47
|
+
activeZoneContent.push(line);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return zones;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Merges extracted custom zones from oldContent into empty templates of newContent.
|
|
56
|
+
* @param {string} oldContent - File content on disk containing developer additions.
|
|
57
|
+
* @param {string} newContent - Newly generated EJS template content.
|
|
58
|
+
* @returns {string} - Combined output.
|
|
59
|
+
*/
|
|
60
|
+
function mergeContent(oldContent, newContent) {
|
|
61
|
+
const oldZones = extractZones(oldContent);
|
|
62
|
+
if (Object.keys(oldZones).length === 0) {
|
|
63
|
+
return newContent; // No custom code to merge
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const lines = newContent.split(/\r?\n/);
|
|
67
|
+
const result = [];
|
|
68
|
+
|
|
69
|
+
let skippingIndex = false;
|
|
70
|
+
let unnamedIndex = 0;
|
|
71
|
+
|
|
72
|
+
for (let idx = 0; idx < lines.length; idx++) {
|
|
73
|
+
const line = lines[idx];
|
|
74
|
+
|
|
75
|
+
if (skippingIndex) {
|
|
76
|
+
let isEnd = false;
|
|
77
|
+
for (const m of MARKERS) {
|
|
78
|
+
if (m.end.test(line)) {
|
|
79
|
+
isEnd = true;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (isEnd) {
|
|
84
|
+
result.push(line);
|
|
85
|
+
skippingIndex = false;
|
|
86
|
+
}
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
let match = null;
|
|
91
|
+
for (const m of MARKERS) {
|
|
92
|
+
match = line.match(m.start);
|
|
93
|
+
if (match) break;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (match) {
|
|
97
|
+
const label = match[1] || `unnamed_${unnamedIndex++}`;
|
|
98
|
+
result.push(line); // Push the start marker line
|
|
99
|
+
|
|
100
|
+
if (oldZones[label] !== undefined) {
|
|
101
|
+
result.push(oldZones[label]);
|
|
102
|
+
skippingIndex = true; // Skip empty EJS block content until we reach the end marker
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
result.push(line);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return result.join('\n');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
module.exports = {
|
|
113
|
+
extractZones,
|
|
114
|
+
mergeContent
|
|
115
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Backend selection is metadata, never evidence that a deployed service supports a feature.
|
|
2
|
+
// Keep contract checks separate from syntax/naming rules; no vendor naming conventions.
|
|
3
|
+
function checkBackend(config, add) {
|
|
4
|
+
for (const [key, supported] of Object.entries({
|
|
5
|
+
endpointStyle: "kebab-plural",
|
|
6
|
+
responseType: "http-response",
|
|
7
|
+
dateLibrary: "dayjs",
|
|
8
|
+
})) {
|
|
9
|
+
if (config.api?.[key] !== undefined && config.api[key] !== supported)
|
|
10
|
+
add(
|
|
11
|
+
"unsupported-api-setting",
|
|
12
|
+
`api.${key}=${config.api[key]} is not implemented by the current service templates.`,
|
|
13
|
+
0,
|
|
14
|
+
undefined,
|
|
15
|
+
undefined,
|
|
16
|
+
`Use ${supported} or implement and test a contract adapter.`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
if (config.backend?.kind)
|
|
20
|
+
add(
|
|
21
|
+
"backend-unverified",
|
|
22
|
+
`The ${config.backend.kind} label does not verify a live API contract. Pagination, routing and authorization require backend integration tests.`,
|
|
23
|
+
0,
|
|
24
|
+
undefined,
|
|
25
|
+
undefined,
|
|
26
|
+
"Verify the configured API against the deployed backend.",
|
|
27
|
+
"warning",
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
module.exports = { checkBackend };
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const JDL_PRIMITIVES = new Set([
|
|
5
|
+
'String', 'Integer', 'Long', 'BigDecimal', 'Float', 'Double',
|
|
6
|
+
'Boolean', 'LocalDate', 'Instant', 'ZonedDateTime', 'TextBlob', 'UUID'
|
|
7
|
+
]);
|
|
8
|
+
|
|
9
|
+
const GDL_PRIMITIVES = new Set([
|
|
10
|
+
'string', 'bool', 'int', 'long', 'double', 'bigDecimal', 'date', 'datetime'
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const GDL_TO_JDL_TYPES = {
|
|
14
|
+
string: 'String',
|
|
15
|
+
bool: 'Boolean',
|
|
16
|
+
int: 'Integer',
|
|
17
|
+
long: 'Long',
|
|
18
|
+
double: 'Double',
|
|
19
|
+
bigDecimal: 'BigDecimal',
|
|
20
|
+
date: 'LocalDate',
|
|
21
|
+
datetime: 'Instant'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const RECOGNIZED_VALIDATIONS = new Set([
|
|
25
|
+
'required', 'min', 'max', 'minlength', 'maxlength', 'pattern'
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const RELATIONSHIP_TYPES = new Set([
|
|
29
|
+
'OneToOne', 'ManyToOne', 'OneToMany', 'ManyToMany'
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Normalizes types to JDL equivalents for checking validation rules.
|
|
34
|
+
*/
|
|
35
|
+
function normalizeType(type) {
|
|
36
|
+
return GDL_TO_JDL_TYPES[type] || type;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Formats a validation error message with line contents and caret pointer.
|
|
41
|
+
*/
|
|
42
|
+
function formatError(line, lineNum, col, message, errorType = 'Semantic Error') {
|
|
43
|
+
const linePadding = ' ';
|
|
44
|
+
const caretSpacing = ' '.repeat(col - 1);
|
|
45
|
+
return `Error at line ${lineNum}, column ${col}:
|
|
46
|
+
${linePadding}${line}
|
|
47
|
+
${linePadding}${caretSpacing}^
|
|
48
|
+
${errorType}: ${message}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Validates JDL or GDL blueprint files.
|
|
53
|
+
* @param {string} content - Raw content of the schema.
|
|
54
|
+
* @param {boolean} isGdl - True if validating a GDL file.
|
|
55
|
+
* @returns {string[]} - List of formatted validation error messages.
|
|
56
|
+
*/
|
|
57
|
+
function validateBlueprint(content, isGdl = false) {
|
|
58
|
+
const errors = [];
|
|
59
|
+
const lines = content.split(/\r?\n/);
|
|
60
|
+
|
|
61
|
+
// 1. Bracket balances check
|
|
62
|
+
let openBraces = 0;
|
|
63
|
+
let closeBraces = 0;
|
|
64
|
+
lines.forEach((line, index) => {
|
|
65
|
+
const cleanLine = line.replace(/\/\/.*$/, ''); // ignore comment parts
|
|
66
|
+
openBraces += (cleanLine.match(/\{/g) || []).length;
|
|
67
|
+
closeBraces += (cleanLine.match(/\}/g) || []).length;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (openBraces !== closeBraces) {
|
|
71
|
+
errors.push(`Syntactic Error: Mismatched curly braces in blueprint file. Found ${openBraces} open braces and ${closeBraces} close braces.`);
|
|
72
|
+
return errors;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 2. Pass 1: Parse declared entities and enums to check for duplicates and map names
|
|
76
|
+
const declaredEntities = new Set();
|
|
77
|
+
const declaredEnums = new Set();
|
|
78
|
+
|
|
79
|
+
let currentBlockType = null; // 'entity' | 'enum' | 'relationship'
|
|
80
|
+
|
|
81
|
+
lines.forEach((line, index) => {
|
|
82
|
+
const lineNum = index + 1;
|
|
83
|
+
const cleanLine = line.replace(/\/\/.*$/, '').trim();
|
|
84
|
+
if (!cleanLine) return;
|
|
85
|
+
|
|
86
|
+
if (currentBlockType === null) {
|
|
87
|
+
const entityMatch = cleanLine.match(/(?:@\w+\s+)*entity\s+(\w+)/);
|
|
88
|
+
const enumMatch = cleanLine.match(/enum\s+(\w+)/);
|
|
89
|
+
const relMatch = cleanLine.match(/relationship\s+(\w+)/);
|
|
90
|
+
|
|
91
|
+
if (entityMatch) {
|
|
92
|
+
const name = entityMatch[1];
|
|
93
|
+
if (declaredEntities.has(name) || declaredEnums.has(name)) {
|
|
94
|
+
const col = line.indexOf(name) + 1;
|
|
95
|
+
errors.push(formatError(line, lineNum, col, `Duplicate declaration of entity "${name}".`, 'Duplicate Error'));
|
|
96
|
+
}
|
|
97
|
+
declaredEntities.add(name);
|
|
98
|
+
if (cleanLine.includes('{')) {
|
|
99
|
+
currentBlockType = 'entity';
|
|
100
|
+
}
|
|
101
|
+
} else if (enumMatch) {
|
|
102
|
+
const name = enumMatch[1];
|
|
103
|
+
if (declaredEntities.has(name) || declaredEnums.has(name)) {
|
|
104
|
+
const col = line.indexOf(name) + 1;
|
|
105
|
+
errors.push(formatError(line, lineNum, col, `Duplicate declaration of enum "${name}".`, 'Duplicate Error'));
|
|
106
|
+
}
|
|
107
|
+
declaredEnums.add(name);
|
|
108
|
+
if (cleanLine.includes('{')) {
|
|
109
|
+
currentBlockType = 'enum';
|
|
110
|
+
}
|
|
111
|
+
} else if (relMatch) {
|
|
112
|
+
if (cleanLine.includes('{')) {
|
|
113
|
+
currentBlockType = 'relationship';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
if (cleanLine.includes('}')) {
|
|
118
|
+
currentBlockType = null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// If duplicate errors exist, terminate early
|
|
124
|
+
if (errors.length > 0) return errors;
|
|
125
|
+
|
|
126
|
+
// 3. Pass 2: Line-by-line detailed block validations
|
|
127
|
+
currentBlockType = null;
|
|
128
|
+
let currentBlockName = '';
|
|
129
|
+
|
|
130
|
+
lines.forEach((line, index) => {
|
|
131
|
+
const lineNum = index + 1;
|
|
132
|
+
const cleanLine = line.replace(/\/\/.*$/, '').trim();
|
|
133
|
+
if (!cleanLine) return;
|
|
134
|
+
|
|
135
|
+
if (currentBlockType === null) {
|
|
136
|
+
const entityMatch = line.match(/(?:@\w+\s+)*entity\s+(\w+)/);
|
|
137
|
+
const enumMatch = line.match(/enum\s+(\w+)/);
|
|
138
|
+
const relMatch = line.match(/relationship\s+(\w+)/);
|
|
139
|
+
|
|
140
|
+
if (entityMatch) {
|
|
141
|
+
currentBlockName = entityMatch[1];
|
|
142
|
+
if (line.includes('{')) {
|
|
143
|
+
currentBlockType = 'entity';
|
|
144
|
+
}
|
|
145
|
+
} else if (enumMatch) {
|
|
146
|
+
currentBlockName = enumMatch[1];
|
|
147
|
+
if (line.includes('{')) {
|
|
148
|
+
currentBlockType = 'enum';
|
|
149
|
+
}
|
|
150
|
+
} else if (relMatch) {
|
|
151
|
+
currentBlockName = relMatch[1];
|
|
152
|
+
if (!RELATIONSHIP_TYPES.has(currentBlockName)) {
|
|
153
|
+
const col = line.indexOf(currentBlockName) + 1;
|
|
154
|
+
errors.push(formatError(line, lineNum, col, `Invalid relationship type "${currentBlockName}". Allowed types: ${Array.from(RELATIONSHIP_TYPES).join(', ')}.`));
|
|
155
|
+
}
|
|
156
|
+
if (line.includes('{')) {
|
|
157
|
+
currentBlockType = 'relationship';
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
// We are inside a block
|
|
162
|
+
if (cleanLine.includes('}')) {
|
|
163
|
+
currentBlockType = null;
|
|
164
|
+
currentBlockName = '';
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (currentBlockType === 'entity') {
|
|
169
|
+
// Parse fields
|
|
170
|
+
// JDL Syntax: fieldName fieldType [validations]
|
|
171
|
+
// GDL Syntax: fieldType fieldName [validations]
|
|
172
|
+
const jdlRegex = /^(\w+)\s+([\w<>]+)(.*)/;
|
|
173
|
+
const gdlRegex = /^([\w<>]+)\s+(\w+)(.*)/;
|
|
174
|
+
const regex = isGdl ? gdlRegex : jdlRegex;
|
|
175
|
+
|
|
176
|
+
const match = cleanLine.match(regex);
|
|
177
|
+
if (!match) {
|
|
178
|
+
errors.push(formatError(line, lineNum, 1, 'Malformed field definition. Expected format: "<fieldName> <fieldType> [validations]" (JDL) or "<fieldType> <fieldName> [validations]" (GDL).', 'Syntax Error'));
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const fieldName = isGdl ? match[2] : match[1];
|
|
183
|
+
const fieldType = isGdl ? match[1] : match[2];
|
|
184
|
+
const validationsStr = match[3].trim();
|
|
185
|
+
|
|
186
|
+
// Check if field type is known
|
|
187
|
+
const isPrimitive = isGdl ? GDL_PRIMITIVES.has(fieldType) : JDL_PRIMITIVES.has(fieldType);
|
|
188
|
+
const isEnum = declaredEnums.has(fieldType);
|
|
189
|
+
|
|
190
|
+
if (!isPrimitive && !isEnum) {
|
|
191
|
+
const col = line.indexOf(fieldType) + 1;
|
|
192
|
+
if (declaredEntities.has(fieldType)) {
|
|
193
|
+
errors.push(formatError(line, lineNum, col, `Entity "${fieldType}" cannot be declared as a field type inside another entity. Entity joins must be defined in relationship blocks.`));
|
|
194
|
+
} else {
|
|
195
|
+
errors.push(formatError(line, lineNum, col, `Unknown field type "${fieldType}". Must be a primitive type or declared enum.`));
|
|
196
|
+
}
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Validate validation constraints
|
|
201
|
+
if (validationsStr) {
|
|
202
|
+
const tokens = validationsStr.split(/\s+/);
|
|
203
|
+
for (const token of tokens) {
|
|
204
|
+
const valMatch = token.match(/^(\w+)(?:\(([^)]+)\))?$/);
|
|
205
|
+
if (!valMatch) {
|
|
206
|
+
const col = line.indexOf(token) + 1;
|
|
207
|
+
errors.push(formatError(line, lineNum, col, `Malformed validation rule syntax "${token}".`, 'Syntax Error'));
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const ruleName = valMatch[1];
|
|
212
|
+
if (!RECOGNIZED_VALIDATIONS.has(ruleName)) {
|
|
213
|
+
const col = line.indexOf(ruleName) + 1;
|
|
214
|
+
errors.push(formatError(line, lineNum, col, `Unrecognized validation rule "${ruleName}". Allowed rules: ${Array.from(RECOGNIZED_VALIDATIONS).join(', ')}.`));
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Semantic checks matching validations to types
|
|
219
|
+
const normType = normalizeType(fieldType);
|
|
220
|
+
const isNumeric = ['Integer', 'Long', 'Float', 'Double', 'BigDecimal'].includes(normType);
|
|
221
|
+
const isString = ['String', 'TextBlob', 'UUID'].includes(normType);
|
|
222
|
+
|
|
223
|
+
if (isNumeric) {
|
|
224
|
+
if (['minlength', 'maxlength', 'pattern'].includes(ruleName)) {
|
|
225
|
+
const col = line.indexOf(ruleName) + 1;
|
|
226
|
+
errors.push(formatError(line, lineNum, col, `Validation rule "${ruleName}" is not applicable to numeric type "${fieldType}".`));
|
|
227
|
+
}
|
|
228
|
+
} else if (isString) {
|
|
229
|
+
if (['min', 'max'].includes(ruleName)) {
|
|
230
|
+
const col = line.indexOf(ruleName) + 1;
|
|
231
|
+
errors.push(formatError(line, lineNum, col, `Validation rule "${ruleName}" is not applicable to string type "${fieldType}".`));
|
|
232
|
+
}
|
|
233
|
+
} else {
|
|
234
|
+
// Boolean, Date types, or Enums only accept 'required'
|
|
235
|
+
if (ruleName !== 'required') {
|
|
236
|
+
const col = line.indexOf(ruleName) + 1;
|
|
237
|
+
errors.push(formatError(line, lineNum, col, `Validation rule "${ruleName}" is not applicable to type "${fieldType}". Only "required" is supported.`));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
} else if (currentBlockType === 'relationship') {
|
|
243
|
+
// Validate relationship line
|
|
244
|
+
// JDL: SourceEntity(sourceFieldName) to TargetEntity(targetFieldName)
|
|
245
|
+
// GDL: SourceEntity{sourceFieldName} to TargetEntity{targetFieldName}
|
|
246
|
+
const jdlRelRegex = /^(\w+)(?:\((\w+)\))?\s+to\s+(\w+)(?:\((\w+)\))?/;
|
|
247
|
+
const gdlRelRegex = /^(\w+)(?:\{([\w()]+)\})?\s+to\s+(\w+)(?:\{([\w()]+)\})?/;
|
|
248
|
+
const relRegex = isGdl ? gdlRelRegex : jdlRelRegex;
|
|
249
|
+
|
|
250
|
+
const match = cleanLine.match(relRegex);
|
|
251
|
+
if (!match) {
|
|
252
|
+
errors.push(formatError(line, lineNum, 1, 'Malformed relationship line. Expected format: "SourceEntity(field) to TargetEntity(field)" (JDL) or "SourceEntity{field} to TargetEntity{field}" (GDL).', 'Syntax Error'));
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const sourceEntity = match[1];
|
|
257
|
+
const targetEntity = match[3];
|
|
258
|
+
|
|
259
|
+
if (!declaredEntities.has(sourceEntity)) {
|
|
260
|
+
const col = line.indexOf(sourceEntity) + 1;
|
|
261
|
+
errors.push(formatError(line, lineNum, col, `Source entity "${sourceEntity}" is not defined in this blueprint.`));
|
|
262
|
+
}
|
|
263
|
+
if (!declaredEntities.has(targetEntity)) {
|
|
264
|
+
const col = line.indexOf(targetEntity) + 1;
|
|
265
|
+
errors.push(formatError(line, lineNum, col, `Target entity "${targetEntity}" is not defined in this blueprint.`));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
return errors;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
module.exports = {
|
|
275
|
+
validateBlueprint
|
|
276
|
+
};
|