@next-vibe/checker 1.0.11 → 1.0.12
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/.dist/bin/vibe-runtime.js +10 -19
- package/.dist/bin/vibe-runtime.js.map +3 -3
- package/check.config.ts +4 -4
- package/package.json +2 -9
- package/src/app/api/[locale]/LICENSE +674 -0
- package/src/app/api/[locale]/i18n/de/index.ts +13 -0
- package/src/app/api/[locale]/i18n/en/index.ts +12 -0
- package/src/app/api/[locale]/i18n/pl/index.ts +11 -0
- package/src/app/api/[locale]/shared/i18n/de/index.ts +85 -0
- package/src/app/api/[locale]/shared/i18n/en/index.ts +83 -0
- package/src/app/api/[locale]/shared/i18n/pl/index.ts +85 -0
- package/src/app/api/[locale]/shared/stats-filtering.ts +202 -0
- package/src/app/api/[locale]/shared/types/common.schema.ts +55 -0
- package/src/app/api/[locale]/shared/types/response.schema.ts +372 -0
- package/src/app/api/[locale]/shared/types/stats-filtering.schema.ts +375 -0
- package/src/app/api/[locale]/shared/types/utils.ts +190 -0
- package/src/app/api/[locale]/shared/utils/base64.ts +49 -0
- package/src/app/api/[locale]/shared/utils/env-util.ts +40 -0
- package/src/app/api/[locale]/shared/utils/i18n/de/index.ts +21 -0
- package/src/app/api/[locale]/shared/utils/i18n/en/index.ts +19 -0
- package/src/app/api/[locale]/shared/utils/i18n/pl/index.ts +21 -0
- package/src/app/api/[locale]/shared/utils/index.ts +11 -0
- package/src/app/api/[locale]/shared/utils/object-path.ts +41 -0
- package/src/app/api/[locale]/shared/utils/object.test.ts +82 -0
- package/src/app/api/[locale]/shared/utils/object.ts +75 -0
- package/src/app/api/[locale]/shared/utils/parse-error.ts +134 -0
- package/src/app/api/[locale]/shared/utils/parse-json.ts +70 -0
- package/src/app/api/[locale]/shared/utils/time.ts +53 -0
- package/src/app/api/[locale]/shared/utils/validation.ts +127 -0
- package/src/app/api/[locale]/shared/utils/zod-required-fields.ts +116 -0
- package/src/app/api/[locale]/system/builder/definition.ts +1942 -0
- package/src/app/api/[locale]/system/builder/enum.ts +77 -0
- package/src/app/api/[locale]/system/builder/i18n/de/index.ts +677 -0
- package/src/app/api/[locale]/system/builder/i18n/en/index.ts +665 -0
- package/src/app/api/[locale]/system/builder/i18n/pl/index.ts +668 -0
- package/src/app/api/[locale]/system/builder/repository/build-executor.test.ts +182 -0
- package/src/app/api/[locale]/system/builder/repository/build-executor.ts +583 -0
- package/src/app/api/[locale]/system/builder/repository/bun-compiler.ts +261 -0
- package/src/app/api/[locale]/system/builder/repository/bundle-analyzer.ts +197 -0
- package/src/app/api/[locale]/system/builder/repository/config-loader.ts +159 -0
- package/src/app/api/[locale]/system/builder/repository/config-validator.ts +97 -0
- package/src/app/api/[locale]/system/builder/repository/constants.ts +125 -0
- package/src/app/api/[locale]/system/builder/repository/error-suggester.ts +75 -0
- package/src/app/api/[locale]/system/builder/repository/file-copier.ts +98 -0
- package/src/app/api/[locale]/system/builder/repository/folder-cleaner.ts +80 -0
- package/src/app/api/[locale]/system/builder/repository/index.ts +2 -0
- package/src/app/api/[locale]/system/builder/repository/npm-package-generator.ts +146 -0
- package/src/app/api/[locale]/system/builder/repository/output-formatter.ts +104 -0
- package/src/app/api/[locale]/system/builder/repository/profile-service.ts +79 -0
- package/src/app/api/[locale]/system/builder/repository/report-generator.ts +125 -0
- package/src/app/api/[locale]/system/builder/repository/vite-compiler.ts +291 -0
- package/src/app/api/[locale]/system/builder/route.ts +21 -0
- package/src/app/api/[locale]/system/builder/test-files/file1.ts +2 -0
- package/src/app/api/[locale]/system/builder/test-files/file2.tsx +10 -0
- package/src/app/api/[locale]/system/builder/test-files/file3.tsx +16 -0
- package/src/app/api/[locale]/system/builder/test-files/folderToCopy/fileInFolder.ts +2 -0
- package/src/app/api/[locale]/system/builder/test-files/test-config.ts +38 -0
- package/src/app/api/[locale]/system/builder/test-files/test-delete-config.ts +8 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/package.json +24 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/constants.ts +6 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/greet.ts +18 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/index.ts +7 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/utils/calculate.ts +27 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/tsconfig.json +19 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/tsconfig.tsbuildinfo +1 -0
- package/src/app/api/[locale]/system/builder/test-files/test3.css +1 -0
- package/src/app/api/[locale]/system/check/config/repository.ts +819 -0
- package/src/app/api/[locale]/system/check/config/shared.ts +396 -0
- package/src/app/api/[locale]/system/check/config/types.ts +616 -0
- package/src/app/api/[locale]/system/check/config/utils.ts +171 -0
- package/src/app/api/[locale]/system/check/i18n/de/index.ts +15 -0
- package/src/app/api/[locale]/system/check/i18n/en/index.ts +14 -0
- package/src/app/api/[locale]/system/check/i18n/pl/index.ts +15 -0
- package/src/app/api/[locale]/system/check/lint/definition.ts +414 -0
- package/src/app/api/[locale]/system/check/lint/enum.ts +37 -0
- package/src/app/api/[locale]/system/check/lint/i18n/de/index.ts +164 -0
- package/src/app/api/[locale]/system/check/lint/i18n/en/index.ts +162 -0
- package/src/app/api/[locale]/system/check/lint/i18n/pl/index.ts +164 -0
- package/src/app/api/[locale]/system/check/lint/repository.ts +753 -0
- package/src/app/api/[locale]/system/check/lint/route.ts +21 -0
- package/src/app/api/[locale]/system/check/oxlint/README.md +190 -0
- package/src/app/api/[locale]/system/check/oxlint/definition.ts +414 -0
- package/src/app/api/[locale]/system/check/oxlint/enum.ts +37 -0
- package/src/app/api/[locale]/system/check/oxlint/i18n/de/index.ts +171 -0
- package/src/app/api/[locale]/system/check/oxlint/i18n/en/index.ts +168 -0
- package/src/app/api/[locale]/system/check/oxlint/i18n/pl/index.ts +172 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/i18n/src/index.ts +372 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/jsx-capitalization/README.md +246 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/jsx-capitalization/src/index.ts +583 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/restricted-syntax/src/index.ts +500 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/restricted-syntax/test.tsx +74 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/shared/config-loader.ts +305 -0
- package/src/app/api/[locale]/system/check/oxlint/repository.ts +959 -0
- package/src/app/api/[locale]/system/check/oxlint/route.ts +21 -0
- package/src/app/api/[locale]/system/check/oxlint/types.ts +193 -0
- package/src/app/api/[locale]/system/check/test-project/bun.lock +449 -0
- package/src/app/api/[locale]/system/check/test-project/check.config.ts +989 -0
- package/src/app/api/[locale]/system/check/test-project/package.json +20 -0
- package/src/app/api/[locale]/system/check/test-project/src/constants.ts +6 -0
- package/src/app/api/[locale]/system/check/test-project/src/greet.ts +18 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/a11y-issues.tsx +107 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/eslint-issues.tsx +37 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/general-issues.ts +137 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/i18n-issues.tsx +129 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/jsx-capitalization-issues.tsx +131 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/nextjs-issues.tsx +95 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/promise-issues.ts +76 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/react-issues.tsx +95 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/restricted-syntax-issues.tsx +61 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/typescript-issues.ts +80 -0
- package/src/app/api/[locale]/system/check/test-project/src/utils/calculate.ts +27 -0
- package/src/app/api/[locale]/system/check/test-project/tsconfig.json +38 -0
- package/src/app/api/[locale]/system/check/test-project/tsconfig.tsbuildinfo +1 -0
- package/src/app/api/[locale]/system/check/typecheck/definition.ts +369 -0
- package/src/app/api/[locale]/system/check/typecheck/enum.ts +37 -0
- package/src/app/api/[locale]/system/check/typecheck/i18n/de/index.ts +159 -0
- package/src/app/api/[locale]/system/check/typecheck/i18n/en/index.ts +150 -0
- package/src/app/api/[locale]/system/check/typecheck/i18n/pl/index.ts +155 -0
- package/src/app/api/[locale]/system/check/typecheck/repository.ts +919 -0
- package/src/app/api/[locale]/system/check/typecheck/route.ts +22 -0
- package/src/app/api/[locale]/system/check/typecheck/utils.ts +168 -0
- package/src/app/api/[locale]/system/check/vibe-check/definition.ts +568 -0
- package/src/app/api/[locale]/system/check/vibe-check/enum.ts +69 -0
- package/src/app/api/[locale]/system/check/vibe-check/i18n/de/index.ts +192 -0
- package/src/app/api/[locale]/system/check/vibe-check/i18n/en/index.ts +189 -0
- package/src/app/api/[locale]/system/check/vibe-check/i18n/pl/index.ts +192 -0
- package/src/app/api/[locale]/system/check/vibe-check/repository.ts +545 -0
- package/src/app/api/[locale]/system/check/vibe-check/route.test.ts +1142 -0
- package/src/app/api/[locale]/system/check/vibe-check/route.ts +21 -0
- package/src/app/api/[locale]/system/generated/endpoint.ts +313 -0
- package/src/app/api/[locale]/system/generated/endpoints.ts +156 -0
- package/src/app/api/[locale]/system/generated/route-handlers.ts +224 -0
- package/src/app/api/[locale]/system/generators/endpoint/definition.ts +193 -0
- package/src/app/api/[locale]/system/generators/endpoint/i18n/de/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/endpoint/i18n/en/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/endpoint/i18n/pl/index.ts +50 -0
- package/src/app/api/[locale]/system/generators/endpoint/repository.ts +291 -0
- package/src/app/api/[locale]/system/generators/endpoint/route.ts +21 -0
- package/src/app/api/[locale]/system/generators/endpoints/definition.ts +246 -0
- package/src/app/api/[locale]/system/generators/endpoints/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/generators/endpoints/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/generators/endpoints/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/generators/endpoints/options-repository.ts +463 -0
- package/src/app/api/[locale]/system/generators/endpoints/repository.ts +383 -0
- package/src/app/api/[locale]/system/generators/endpoints/route.ts +18 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/definition.ts +194 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/i18n/de/index.ts +71 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/i18n/en/index.ts +69 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/i18n/pl/index.ts +71 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/repository.ts +294 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/route.ts +18 -0
- package/src/app/api/[locale]/system/generators/generate-all/definition.ts +355 -0
- package/src/app/api/[locale]/system/generators/generate-all/i18n/de/index.ts +96 -0
- package/src/app/api/[locale]/system/generators/generate-all/i18n/en/index.ts +94 -0
- package/src/app/api/[locale]/system/generators/generate-all/i18n/pl/index.ts +96 -0
- package/src/app/api/[locale]/system/generators/generate-all/repository.ts +257 -0
- package/src/app/api/[locale]/system/generators/generate-all/route.ts +20 -0
- package/src/app/api/[locale]/system/generators/i18n/de/index.ts +15 -0
- package/src/app/api/[locale]/system/generators/i18n/en/index.ts +14 -0
- package/src/app/api/[locale]/system/generators/i18n/pl/index.ts +15 -0
- package/src/app/api/[locale]/system/generators/route-handlers/definition.ts +198 -0
- package/src/app/api/[locale]/system/generators/route-handlers/i18n/de/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/route-handlers/i18n/en/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/route-handlers/i18n/pl/index.ts +50 -0
- package/src/app/api/[locale]/system/generators/route-handlers/repository.ts +277 -0
- package/src/app/api/[locale]/system/generators/route-handlers/route.ts +17 -0
- package/src/app/api/[locale]/system/generators/shared/utils.ts +233 -0
- package/src/app/api/[locale]/system/help/definition.ts +445 -0
- package/src/app/api/[locale]/system/help/i18n/de/index.ts +267 -0
- package/src/app/api/[locale]/system/help/i18n/en/index.ts +262 -0
- package/src/app/api/[locale]/system/help/i18n/pl/index.ts +265 -0
- package/src/app/api/[locale]/system/help/interactive/definition.ts +125 -0
- package/src/app/api/[locale]/system/help/interactive/i18n/de/index.ts +22 -0
- package/src/app/api/[locale]/system/help/interactive/i18n/en/index.ts +19 -0
- package/src/app/api/[locale]/system/help/interactive/i18n/pl/index.ts +22 -0
- package/src/app/api/[locale]/system/help/interactive/repository.ts +1025 -0
- package/src/app/api/[locale]/system/help/interactive/route.ts +53 -0
- package/src/app/api/[locale]/system/help/list/definition.ts +372 -0
- package/src/app/api/[locale]/system/help/list/repository.ts +110 -0
- package/src/app/api/[locale]/system/help/list/route.ts +21 -0
- package/src/app/api/[locale]/system/help/repository.ts +212 -0
- package/src/app/api/[locale]/system/help/route.ts +16 -0
- package/src/app/api/[locale]/system/i18n/de/index.ts +68 -0
- package/src/app/api/[locale]/system/i18n/en/index.ts +65 -0
- package/src/app/api/[locale]/system/i18n/pl/index.ts +66 -0
- package/src/app/api/[locale]/system/release-tool/definition.ts +3104 -0
- package/src/app/api/[locale]/system/release-tool/i18n/de/index.ts +813 -0
- package/src/app/api/[locale]/system/release-tool/i18n/en/index.ts +797 -0
- package/src/app/api/[locale]/system/release-tool/i18n/pl/index.ts +810 -0
- package/src/app/api/[locale]/system/release-tool/repository/asset-zipper.ts +128 -0
- package/src/app/api/[locale]/system/release-tool/repository/changelog-generator.ts +212 -0
- package/src/app/api/[locale]/system/release-tool/repository/ci-detector.ts +566 -0
- package/src/app/api/[locale]/system/release-tool/repository/config.ts +113 -0
- package/src/app/api/[locale]/system/release-tool/repository/constants.ts +407 -0
- package/src/app/api/[locale]/system/release-tool/repository/dependency-manager.ts +527 -0
- package/src/app/api/[locale]/system/release-tool/repository/git-service.ts +403 -0
- package/src/app/api/[locale]/system/release-tool/repository/hook-runner.ts +100 -0
- package/src/app/api/[locale]/system/release-tool/repository/index.ts +1 -0
- package/src/app/api/[locale]/system/release-tool/repository/notification-service.ts +638 -0
- package/src/app/api/[locale]/system/release-tool/repository/package-service.ts +169 -0
- package/src/app/api/[locale]/system/release-tool/repository/publisher.ts +253 -0
- package/src/app/api/[locale]/system/release-tool/repository/quality-runner.ts +428 -0
- package/src/app/api/[locale]/system/release-tool/repository/release-creator.ts +293 -0
- package/src/app/api/[locale]/system/release-tool/repository/release-executor.ts +1198 -0
- package/src/app/api/[locale]/system/release-tool/repository/snyk-service.ts +136 -0
- package/src/app/api/[locale]/system/release-tool/repository/utils.ts +642 -0
- package/src/app/api/[locale]/system/release-tool/repository/validation.ts +288 -0
- package/src/app/api/[locale]/system/release-tool/repository/version-service.ts +297 -0
- package/src/app/api/[locale]/system/release-tool/route.ts +21 -0
- package/src/app/api/[locale]/system/unified-interface/README.md +328 -0
- package/src/app/api/[locale]/system/unified-interface/cli/README.md +349 -0
- package/src/app/api/[locale]/system/unified-interface/cli/auth/cli-handler.ts +95 -0
- package/src/app/api/[locale]/system/unified-interface/cli/auth/cli-user.ts +146 -0
- package/src/app/api/[locale]/system/unified-interface/cli/auth/session-file.ts +266 -0
- package/src/app/api/[locale]/system/unified-interface/cli/env.ts +26 -0
- package/src/app/api/[locale]/system/unified-interface/cli/i18n/de/index.ts +157 -0
- package/src/app/api/[locale]/system/unified-interface/cli/i18n/en/index.ts +155 -0
- package/src/app/api/[locale]/system/unified-interface/cli/i18n/pl/index.ts +158 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/debug.ts +595 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/entry-point.ts +129 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/environment.ts +155 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/execution-errors.ts +452 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/parsing.ts +297 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/route-executor.ts +859 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/i18n/de/index.ts +12 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/i18n/en/index.ts +11 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/i18n/pl/index.ts +12 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/definition.ts +262 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/repository.ts +421 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/route.ts +25 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/definition.ts +181 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/i18n/de/index.ts +61 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/i18n/en/index.ts +59 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/i18n/pl/index.ts +61 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/repository.ts +195 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/route.ts +22 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/definition.ts +188 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/repository.ts +209 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/route.ts +24 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/definition.ts +200 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/repository.ts +113 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/route.ts +22 -0
- package/src/app/api/[locale]/system/unified-interface/cli/vibe-runtime.ts +304 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/core/base-renderer.ts +270 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/core/registry.ts +309 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/core/types.ts +126 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/i18n/de/index.ts +67 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/i18n/en/index.ts +65 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/i18n/pl/index.ts +67 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/accordion.ts +74 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/avatar.ts +39 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/badge.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-output.ts +298 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-quality-files.ts +89 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-quality-list.ts +298 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-quality-summary.ts +96 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/container.ts +186 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-card.ts +65 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-cards.ts +570 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-list.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-table.ts +385 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/editable-text.ts +99 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/empty-state.ts +55 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/errors.ts +67 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/grouped-list.ts +729 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/link-card.ts +87 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/link-list.ts +112 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/link.ts +59 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/loading.ts +50 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/markdown.ts +131 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/metric.ts +291 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/section.ts +120 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/stats-grid.ts +149 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/tabs.ts +61 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/text.ts +78 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/title.ts +42 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/renderers/response-renderer.ts +418 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/renderers/schema-handler.ts +534 -0
- package/src/app/api/[locale]/system/unified-interface/i18n/de/index.ts +42 -0
- package/src/app/api/[locale]/system/unified-interface/i18n/en/index.ts +40 -0
- package/src/app/api/[locale]/system/unified-interface/i18n/pl/index.ts +43 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/README.md +114 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/converter.ts +146 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/i18n/de/index.ts +182 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/i18n/en/index.ts +179 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/i18n/pl/index.ts +181 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/registry.ts +343 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/serve/definition.ts +147 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/serve/repository.ts +38 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/serve/route.ts +14 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/server/protocol-handler.ts +309 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/server/server.ts +154 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/server/stdio-transport.ts +193 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/types.ts +246 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/create-form.ts +1510 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/create.ts +581 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/endpoint-to-metadata.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/loader.ts +152 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definitions/registry.ts +265 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/permissions/registry.ts +680 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/executor.ts +220 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/handler.ts +325 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/multi.ts +184 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/request-validator.ts +201 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/single.ts +58 -0
- package/src/app/api/[locale]/system/unified-interface/shared/env/define-env-client.ts +49 -0
- package/src/app/api/[locale]/system/unified-interface/shared/env/define-env.ts +47 -0
- package/src/app/api/[locale]/system/unified-interface/shared/env/validation-logger.ts +58 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/enum.ts +110 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/specialized.ts +339 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/utils.test.ts +408 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/utils.ts +1349 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field-config/endpoint-field-types.ts +107 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field-config/field-config-types.ts +268 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/colors.ts +114 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/endpoint.ts +169 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/file-logger.ts +88 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/formatters.ts +177 -0
- package/src/app/api/[locale]/system/unified-interface/shared/server-only/auth/base-auth-handler.ts +82 -0
- package/src/app/api/[locale]/system/unified-interface/shared/server-only/auth/factory.ts +33 -0
- package/src/app/api/[locale]/system/unified-interface/shared/server-only/server-only.ts +4 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/actions.ts +289 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/endpoint.ts +1167 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/enums.ts +382 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/platform.ts +34 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/types.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/ui-config.ts +76 -0
- package/src/app/api/[locale]/system/unified-interface/shared/utils/error-types.ts +27 -0
- package/src/app/api/[locale]/system/unified-interface/shared/utils/path.ts +63 -0
- package/src/app/api/[locale]/system/unified-interface/shared/utils/scanner.ts +241 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/actions.ts +256 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/configs.ts +1158 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/helpers.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/accordion.ts +82 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/avatar.ts +75 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/badge.ts +89 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/code-output.ts +302 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/code-quality-list.ts +202 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/container.ts +129 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-card.ts +81 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-cards.ts +258 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-list.ts +123 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-table.ts +387 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/editable-text.ts +89 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/empty-state.ts +78 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/errors.ts +93 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/grouped-list.ts +448 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/index.ts +38 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/link-card.ts +130 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/link-list.ts +127 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/link.ts +68 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/loading.ts +81 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/markdown.ts +176 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/metric-card.ts +241 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/section.ts +90 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/stats-grid.ts +71 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/tabs.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/text.ts +105 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/title.ts +72 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/types.ts +240 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/field-helpers.ts +137 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/formatting.ts +437 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/url.ts +40 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/widget-helpers.ts +465 -0
- package/src/app/api/[locale]/user/auth/enum.ts +16 -0
- package/src/app/api/[locale]/user/auth/i18n/de/index.ts +227 -0
- package/src/app/api/[locale]/user/auth/i18n/en/index.ts +205 -0
- package/src/app/api/[locale]/user/auth/i18n/pl/index.ts +219 -0
- package/src/app/api/[locale]/user/auth/types.ts +110 -0
- package/src/app/api/[locale]/user/enum.ts +64 -0
- package/src/app/api/[locale]/user/private/i18n/de/index.ts +3 -0
- package/src/app/api/[locale]/user/private/i18n/en/index.ts +1 -0
- package/src/app/api/[locale]/user/private/i18n/pl/index.ts +3 -0
- package/src/app/api/[locale]/user/types.ts +118 -0
- package/src/app/api/[locale]/user/user-roles/enum.ts +112 -0
- package/src/app/api/[locale]/user/user-roles/i18n/de/index.ts +85 -0
- package/src/app/api/[locale]/user/user-roles/i18n/en/index.ts +83 -0
- package/src/app/api/[locale]/user/user-roles/i18n/pl/index.ts +86 -0
- package/src/app/api/[locale]/user/user-roles/types.ts +34 -0
- package/src/app/api/i18n/de/index.ts +6 -0
- package/src/app/api/i18n/en/index.ts +5 -0
- package/src/app/api/i18n/pl/index.ts +5 -0
- package/src/app/i18n/de/index.ts +6 -0
- package/src/app/i18n/en/index.ts +5 -0
- package/src/app/i18n/pl/index.ts +5 -0
|
@@ -0,0 +1,1167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Types for Endpoint Types System
|
|
3
|
+
*
|
|
4
|
+
* Fundamental type definitions used throughout the endpoint types system.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Route } from "next";
|
|
8
|
+
import type { z } from "zod";
|
|
9
|
+
|
|
10
|
+
import type { UserRoleValue } from "@/app/api/[locale]/user/user-roles/enum";
|
|
11
|
+
import type { TranslationKey } from "@/i18n/core/static-types";
|
|
12
|
+
|
|
13
|
+
import type { CreateApiEndpoint } from "../endpoints/definition/create";
|
|
14
|
+
import type { WidgetConfig } from "../widgets/configs";
|
|
15
|
+
import type {
|
|
16
|
+
ActionTiming,
|
|
17
|
+
ActionType,
|
|
18
|
+
CacheStrategy,
|
|
19
|
+
ComponentSize,
|
|
20
|
+
ComponentVariant,
|
|
21
|
+
InterfaceContext,
|
|
22
|
+
Methods,
|
|
23
|
+
} from "./enums";
|
|
24
|
+
import type { FieldUsage } from "./enums";
|
|
25
|
+
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// ENDPOINT REGISTRY TYPES
|
|
28
|
+
// ============================================================================
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Type alias for CreateApiEndpoint - accepts any generic parameters
|
|
32
|
+
* This is a branded type that any CreateApiEndpoint can be assigned to
|
|
33
|
+
*/
|
|
34
|
+
export type CreateApiEndpointAny = CreateApiEndpoint<
|
|
35
|
+
string,
|
|
36
|
+
Methods,
|
|
37
|
+
readonly UserRoleValue[],
|
|
38
|
+
string,
|
|
39
|
+
// oxlint-disable-next-line no-explicit-any
|
|
40
|
+
any
|
|
41
|
+
>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* API section type for nested endpoint structure
|
|
45
|
+
* Used in generated endpoints.ts file
|
|
46
|
+
* Accepts CreateApiEndpoint with any type parameters or CreateEndpointReturnInMethod
|
|
47
|
+
*/
|
|
48
|
+
export interface ApiSection {
|
|
49
|
+
readonly GET?: CreateApiEndpointAny;
|
|
50
|
+
readonly POST?: CreateApiEndpointAny;
|
|
51
|
+
readonly PUT?: CreateApiEndpointAny;
|
|
52
|
+
readonly PATCH?: CreateApiEndpointAny;
|
|
53
|
+
readonly DELETE?: CreateApiEndpointAny;
|
|
54
|
+
readonly [key: string]: CreateApiEndpointAny | ApiSection | undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ============================================================================
|
|
58
|
+
// SCHEMA TYPE PRESERVATION AND BACK-PROPAGATION SYSTEM
|
|
59
|
+
// ============================================================================
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Extract the Output type using Zod's built-in z.output<T>
|
|
63
|
+
* This ensures compatibility with the current Zod version
|
|
64
|
+
*/
|
|
65
|
+
export type ExtractOutput<T> = z.output<T>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Extract the Input type using Zod's built-in z.input<T>
|
|
69
|
+
* This ensures compatibility with the current Zod version
|
|
70
|
+
*/
|
|
71
|
+
export type ExtractInput<T> = z.input<T>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Extract Input, Output, and ZodType definition from z.ZodType<Output, ZodTypeDef, Input>
|
|
75
|
+
* This preserves complete type information for full type safety
|
|
76
|
+
*/
|
|
77
|
+
export type ExtractInputOutput<T> =
|
|
78
|
+
T extends z.ZodType<infer Output, infer ZodType, infer Input>
|
|
79
|
+
? { Input: Input; Output: Output; ZodType: ZodType }
|
|
80
|
+
: never;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Method usage structure
|
|
84
|
+
*/
|
|
85
|
+
interface MethodUsageStructure {
|
|
86
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
87
|
+
response?: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Check if usage object has method-specific structure
|
|
92
|
+
* Uses MethodUsageStructure for proper type checking
|
|
93
|
+
*/
|
|
94
|
+
type IsMethodSpecificUsage<TUsage> =
|
|
95
|
+
// FIXED: Check for string key syntax first (this works reliably)
|
|
96
|
+
TUsage extends { GET: MethodUsageStructure }
|
|
97
|
+
? true
|
|
98
|
+
: TUsage extends { POST: MethodUsageStructure }
|
|
99
|
+
? true
|
|
100
|
+
: TUsage extends { PUT: MethodUsageStructure }
|
|
101
|
+
? true
|
|
102
|
+
: TUsage extends { DELETE: MethodUsageStructure }
|
|
103
|
+
? true
|
|
104
|
+
: TUsage extends { PATCH: MethodUsageStructure }
|
|
105
|
+
? true
|
|
106
|
+
: // Fallback: Check for computed property syntax [Methods.X] (unreliable)
|
|
107
|
+
TUsage extends { [Methods.GET]: MethodUsageStructure }
|
|
108
|
+
? true
|
|
109
|
+
: TUsage extends { [Methods.POST]: MethodUsageStructure }
|
|
110
|
+
? true
|
|
111
|
+
: TUsage extends { [Methods.PUT]: MethodUsageStructure }
|
|
112
|
+
? true
|
|
113
|
+
: TUsage extends { [Methods.DELETE]: MethodUsageStructure }
|
|
114
|
+
? true
|
|
115
|
+
: TUsage extends { [Methods.PATCH]: MethodUsageStructure }
|
|
116
|
+
? true
|
|
117
|
+
: false;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Check if any method in method-specific usage supports the target usage
|
|
121
|
+
* More flexible version that checks method usage properties
|
|
122
|
+
*/
|
|
123
|
+
type AnyMethodSupportsUsage<
|
|
124
|
+
TUsage,
|
|
125
|
+
TTargetUsage extends FieldUsage,
|
|
126
|
+
> = TTargetUsage extends FieldUsage.Response
|
|
127
|
+
? // Use union types to check all possibilities in parallel
|
|
128
|
+
// String key syntax (primary)
|
|
129
|
+
TUsage extends { POST: { response: true } }
|
|
130
|
+
? true
|
|
131
|
+
: TUsage extends { GET: { response: true } }
|
|
132
|
+
? true
|
|
133
|
+
: TUsage extends { PUT: { response: true } }
|
|
134
|
+
? true
|
|
135
|
+
: TUsage extends { PATCH: { response: true } }
|
|
136
|
+
? true
|
|
137
|
+
: TUsage extends { DELETE: { response: true } }
|
|
138
|
+
? true
|
|
139
|
+
: // Computed property syntax (fallback)
|
|
140
|
+
TUsage extends { [Methods.POST]: { response: true } }
|
|
141
|
+
? true
|
|
142
|
+
: TUsage extends { [Methods.GET]: { response: true } }
|
|
143
|
+
? true
|
|
144
|
+
: TUsage extends { [Methods.PUT]: { response: true } }
|
|
145
|
+
? true
|
|
146
|
+
: TUsage extends { [Methods.PATCH]: { response: true } }
|
|
147
|
+
? true
|
|
148
|
+
: TUsage extends { [Methods.DELETE]: { response: true } }
|
|
149
|
+
? true
|
|
150
|
+
: false
|
|
151
|
+
: TTargetUsage extends FieldUsage.RequestData
|
|
152
|
+
? // Use union types to check all possibilities in parallel
|
|
153
|
+
// String key syntax (primary)
|
|
154
|
+
TUsage extends { POST: { request: "data" | "data&urlPathParams" } }
|
|
155
|
+
? true
|
|
156
|
+
: TUsage extends { PUT: { request: "data" | "data&urlPathParams" } }
|
|
157
|
+
? true
|
|
158
|
+
: TUsage extends { PATCH: { request: "data" | "data&urlPathParams" } }
|
|
159
|
+
? true
|
|
160
|
+
: // Computed property syntax (fallback)
|
|
161
|
+
TUsage extends {
|
|
162
|
+
[Methods.POST]: { request: "data" | "data&urlPathParams" };
|
|
163
|
+
}
|
|
164
|
+
? true
|
|
165
|
+
: TUsage extends {
|
|
166
|
+
[Methods.PUT]: { request: "data" | "data&urlPathParams" };
|
|
167
|
+
}
|
|
168
|
+
? true
|
|
169
|
+
: TUsage extends {
|
|
170
|
+
[Methods.PATCH]: { request: "data" | "data&urlPathParams" };
|
|
171
|
+
}
|
|
172
|
+
? true
|
|
173
|
+
: false
|
|
174
|
+
: false;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* USAGE MATCHING: Fixed to work correctly with method-specific patterns
|
|
178
|
+
* This now properly handles the case where method-specific usage should be filtered
|
|
179
|
+
*/
|
|
180
|
+
type MatchesUsage<TUsage, TTargetUsage extends FieldUsage> =
|
|
181
|
+
// Check if it's method-specific usage
|
|
182
|
+
IsMethodSpecificUsage<TUsage> extends true
|
|
183
|
+
? // For method-specific usage, check if ANY method supports the target usage
|
|
184
|
+
// This is correct for field inclusion - if any method needs the field, include it
|
|
185
|
+
AnyMethodSupportsUsage<TUsage, TTargetUsage>
|
|
186
|
+
: // Original simple usage matching for backward compatibility
|
|
187
|
+
TTargetUsage extends FieldUsage.RequestData
|
|
188
|
+
? TUsage extends { request: "data" | "data&urlPathParams" }
|
|
189
|
+
? true
|
|
190
|
+
: false
|
|
191
|
+
: TTargetUsage extends FieldUsage.RequestUrlParams
|
|
192
|
+
? TUsage extends { request: "urlPathParams" | "data&urlPathParams" }
|
|
193
|
+
? true
|
|
194
|
+
: false
|
|
195
|
+
: TTargetUsage extends FieldUsage.Response
|
|
196
|
+
? TUsage extends { response: true }
|
|
197
|
+
? true
|
|
198
|
+
: false
|
|
199
|
+
: false;
|
|
200
|
+
|
|
201
|
+
// Removed duplicate MatchesUsageForMethod - using the one defined later
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* COMPREHENSIVE SCHEMA INFERENCE: The complete type system
|
|
205
|
+
* Back-propagates all 3 type parameters (Output, ZodType, Input) through the entire chain
|
|
206
|
+
*/
|
|
207
|
+
/**
|
|
208
|
+
* Helper type to convert variant fields to Zod object schemas
|
|
209
|
+
* Uses string for pattern matching since fields have TKey=string
|
|
210
|
+
*/
|
|
211
|
+
type InferVariantSchemas<
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- kept for API compatibility
|
|
213
|
+
_TTranslationKey extends string,
|
|
214
|
+
TVariants extends readonly ObjectField<
|
|
215
|
+
Record<string, UnifiedField<string, z.ZodTypeAny>>,
|
|
216
|
+
FieldUsageConfig,
|
|
217
|
+
string,
|
|
218
|
+
WidgetConfig<string>
|
|
219
|
+
>[],
|
|
220
|
+
Usage extends FieldUsage,
|
|
221
|
+
> = TVariants extends readonly [infer Head, ...infer Tail]
|
|
222
|
+
? Head extends ObjectField<
|
|
223
|
+
Record<string, UnifiedField<string, z.ZodTypeAny>>,
|
|
224
|
+
FieldUsageConfig,
|
|
225
|
+
string,
|
|
226
|
+
WidgetConfig<string>
|
|
227
|
+
>
|
|
228
|
+
? Tail extends readonly ObjectField<
|
|
229
|
+
Record<string, UnifiedField<string, z.ZodTypeAny>>,
|
|
230
|
+
FieldUsageConfig,
|
|
231
|
+
string,
|
|
232
|
+
WidgetConfig<string>
|
|
233
|
+
>[]
|
|
234
|
+
? [
|
|
235
|
+
InferSchemaFromField<Head, Usage>,
|
|
236
|
+
...InferVariantSchemas<string, Tail, Usage>,
|
|
237
|
+
]
|
|
238
|
+
: [InferSchemaFromField<Head, Usage>]
|
|
239
|
+
: []
|
|
240
|
+
: [];
|
|
241
|
+
|
|
242
|
+
export type InferSchemaFromField<F, Usage extends FieldUsage> =
|
|
243
|
+
// Handle PrimitiveField - use string for pattern matching
|
|
244
|
+
F extends PrimitiveField<
|
|
245
|
+
infer TSchemaInferred,
|
|
246
|
+
FieldUsageConfig,
|
|
247
|
+
string,
|
|
248
|
+
WidgetConfig<string>
|
|
249
|
+
>
|
|
250
|
+
? F extends { usage: infer TUsage }
|
|
251
|
+
? MatchesUsage<TUsage, Usage> extends true
|
|
252
|
+
? TSchemaInferred
|
|
253
|
+
: z.ZodNever
|
|
254
|
+
: z.ZodNever
|
|
255
|
+
: // Handle ObjectUnionField - use string for pattern matching
|
|
256
|
+
F extends ObjectUnionField<
|
|
257
|
+
infer TDiscriminator extends string,
|
|
258
|
+
string,
|
|
259
|
+
infer TVariants,
|
|
260
|
+
FieldUsageConfig,
|
|
261
|
+
WidgetConfig<string>
|
|
262
|
+
>
|
|
263
|
+
? F extends { usage: infer TUsage }
|
|
264
|
+
? MatchesUsage<TUsage, Usage> extends true
|
|
265
|
+
? TVariants extends readonly [
|
|
266
|
+
ObjectField<
|
|
267
|
+
Record<string, UnifiedField<string, z.ZodTypeAny>>,
|
|
268
|
+
FieldUsageConfig,
|
|
269
|
+
string,
|
|
270
|
+
WidgetConfig<string>
|
|
271
|
+
>,
|
|
272
|
+
ObjectField<
|
|
273
|
+
Record<string, UnifiedField<string, z.ZodTypeAny>>,
|
|
274
|
+
FieldUsageConfig,
|
|
275
|
+
string,
|
|
276
|
+
WidgetConfig<string>
|
|
277
|
+
>,
|
|
278
|
+
...ObjectField<
|
|
279
|
+
Record<string, UnifiedField<string, z.ZodTypeAny>>,
|
|
280
|
+
FieldUsageConfig,
|
|
281
|
+
string,
|
|
282
|
+
WidgetConfig<string>
|
|
283
|
+
>[],
|
|
284
|
+
]
|
|
285
|
+
? z.ZodDiscriminatedUnion<
|
|
286
|
+
InferVariantSchemas<string, TVariants, Usage> extends infer T
|
|
287
|
+
? T extends readonly [
|
|
288
|
+
z.ZodObject<z.ZodRawShape>,
|
|
289
|
+
z.ZodObject<z.ZodRawShape>,
|
|
290
|
+
...z.ZodObject<z.ZodRawShape>[],
|
|
291
|
+
]
|
|
292
|
+
? T
|
|
293
|
+
: readonly [
|
|
294
|
+
z.ZodObject<z.ZodRawShape>,
|
|
295
|
+
z.ZodObject<z.ZodRawShape>,
|
|
296
|
+
]
|
|
297
|
+
: readonly [
|
|
298
|
+
z.ZodObject<z.ZodRawShape>,
|
|
299
|
+
z.ZodObject<z.ZodRawShape>,
|
|
300
|
+
],
|
|
301
|
+
TDiscriminator
|
|
302
|
+
>
|
|
303
|
+
: z.ZodNever
|
|
304
|
+
: z.ZodNever
|
|
305
|
+
: z.ZodNever
|
|
306
|
+
: // Handle ObjectField - use string for pattern matching
|
|
307
|
+
F extends ObjectField<
|
|
308
|
+
infer TChildren,
|
|
309
|
+
FieldUsageConfig,
|
|
310
|
+
string,
|
|
311
|
+
WidgetConfig<string>
|
|
312
|
+
>
|
|
313
|
+
? F extends { usage: infer TUsage }
|
|
314
|
+
? MatchesUsage<TUsage, Usage> extends true
|
|
315
|
+
? z.ZodObject<{
|
|
316
|
+
[K in keyof TChildren as InferSchemaFromField<
|
|
317
|
+
TChildren[K],
|
|
318
|
+
Usage
|
|
319
|
+
> extends z.ZodNever
|
|
320
|
+
? never
|
|
321
|
+
: K]: InferSchemaFromField<TChildren[K], Usage>;
|
|
322
|
+
}>
|
|
323
|
+
: z.ZodNever
|
|
324
|
+
: z.ZodNever
|
|
325
|
+
: // Handle ObjectOptionalField - use string for pattern matching
|
|
326
|
+
F extends ObjectOptionalField<
|
|
327
|
+
infer TChildren,
|
|
328
|
+
FieldUsageConfig,
|
|
329
|
+
string,
|
|
330
|
+
WidgetConfig<string>
|
|
331
|
+
>
|
|
332
|
+
? F extends { usage: infer TUsage }
|
|
333
|
+
? MatchesUsage<TUsage, Usage> extends true
|
|
334
|
+
? z.ZodOptional<
|
|
335
|
+
z.ZodNullable<
|
|
336
|
+
z.ZodObject<{
|
|
337
|
+
[K in keyof TChildren as InferSchemaFromField<
|
|
338
|
+
TChildren[K],
|
|
339
|
+
Usage
|
|
340
|
+
> extends z.ZodNever
|
|
341
|
+
? never
|
|
342
|
+
: K]: InferSchemaFromField<TChildren[K], Usage>;
|
|
343
|
+
}>
|
|
344
|
+
>
|
|
345
|
+
>
|
|
346
|
+
: z.ZodNever
|
|
347
|
+
: z.ZodNever
|
|
348
|
+
: // Handle ArrayField - use string for pattern matching
|
|
349
|
+
F extends ArrayField<
|
|
350
|
+
infer TChild,
|
|
351
|
+
FieldUsageConfig,
|
|
352
|
+
string,
|
|
353
|
+
WidgetConfig<string>
|
|
354
|
+
>
|
|
355
|
+
? F extends { usage: infer TUsage }
|
|
356
|
+
? MatchesUsage<TUsage, Usage> extends true
|
|
357
|
+
? z.ZodArray<
|
|
358
|
+
TChild extends UnifiedField<string, z.ZodTypeAny>
|
|
359
|
+
? InferSchemaFromField<TChild, Usage>
|
|
360
|
+
: TChild extends z.ZodTypeAny
|
|
361
|
+
? TChild
|
|
362
|
+
: z.ZodNever
|
|
363
|
+
>
|
|
364
|
+
: z.ZodNever
|
|
365
|
+
: z.ZodNever
|
|
366
|
+
: // Handle ArrayOptionalField - use string for pattern matching
|
|
367
|
+
F extends ArrayOptionalField<
|
|
368
|
+
infer TChild,
|
|
369
|
+
FieldUsageConfig,
|
|
370
|
+
string,
|
|
371
|
+
WidgetConfig<string>
|
|
372
|
+
>
|
|
373
|
+
? F extends { usage: infer TUsage }
|
|
374
|
+
? MatchesUsage<TUsage, Usage> extends true
|
|
375
|
+
? z.ZodNullable<
|
|
376
|
+
z.ZodArray<
|
|
377
|
+
TChild extends UnifiedField<string, z.ZodTypeAny>
|
|
378
|
+
? InferSchemaFromField<TChild, Usage>
|
|
379
|
+
: TChild extends z.ZodTypeAny
|
|
380
|
+
? TChild
|
|
381
|
+
: z.ZodNever
|
|
382
|
+
>
|
|
383
|
+
>
|
|
384
|
+
: z.ZodNever
|
|
385
|
+
: z.ZodNever
|
|
386
|
+
: // Fallback: If F is not a UnifiedField but is a ZodTypeAny, return it directly
|
|
387
|
+
F extends z.ZodTypeAny
|
|
388
|
+
? F
|
|
389
|
+
: z.ZodNever;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Infer the exact input type from a field structure for a specific usage
|
|
393
|
+
*/
|
|
394
|
+
export type InferInputFromField<
|
|
395
|
+
TTranslationKey extends string,
|
|
396
|
+
F extends UnifiedField<TTranslationKey, TSchema>,
|
|
397
|
+
Usage extends FieldUsage,
|
|
398
|
+
TSchema extends z.ZodTypeAny = z.ZodTypeAny,
|
|
399
|
+
> = ExtractInput<InferSchemaFromField<F, Usage>>;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Infer the exact output type from a field structure for a specific usage
|
|
403
|
+
*/
|
|
404
|
+
export type InferOutputFromField<
|
|
405
|
+
TTranslationKey extends string,
|
|
406
|
+
F extends UnifiedField<TTranslationKey, TSchema>,
|
|
407
|
+
Usage extends FieldUsage,
|
|
408
|
+
TSchema extends z.ZodTypeAny = z.ZodTypeAny,
|
|
409
|
+
> = ExtractOutput<InferSchemaFromField<F, Usage>>;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* METHOD-SPECIFIC USAGE MATCHING: Check if usage matches for a specific method
|
|
413
|
+
* This is the core logic that enables method-specific type inference
|
|
414
|
+
*/
|
|
415
|
+
type MatchesUsageForMethod<
|
|
416
|
+
TUsage,
|
|
417
|
+
TMethod extends Methods,
|
|
418
|
+
TTargetUsage extends FieldUsage,
|
|
419
|
+
> =
|
|
420
|
+
// Check if it's method-specific format first
|
|
421
|
+
TMethod extends keyof TUsage
|
|
422
|
+
? TUsage[TMethod] extends infer TMethodUsage
|
|
423
|
+
? TTargetUsage extends FieldUsage.RequestData
|
|
424
|
+
? TMethodUsage extends { request: "data" | "data&urlPathParams" }
|
|
425
|
+
? true
|
|
426
|
+
: false
|
|
427
|
+
: TTargetUsage extends FieldUsage.RequestUrlParams
|
|
428
|
+
? TMethodUsage extends {
|
|
429
|
+
request: "urlPathParams" | "data&urlPathParams";
|
|
430
|
+
}
|
|
431
|
+
? true
|
|
432
|
+
: false
|
|
433
|
+
: TTargetUsage extends FieldUsage.Response
|
|
434
|
+
? TMethodUsage extends { response: true }
|
|
435
|
+
? true
|
|
436
|
+
: false
|
|
437
|
+
: false
|
|
438
|
+
: false
|
|
439
|
+
: // Fall back to original logic for backward compatibility
|
|
440
|
+
TTargetUsage extends FieldUsage.RequestData
|
|
441
|
+
? TUsage extends { request: "data" | "data&urlPathParams" }
|
|
442
|
+
? true
|
|
443
|
+
: false
|
|
444
|
+
: TTargetUsage extends FieldUsage.RequestUrlParams
|
|
445
|
+
? TUsage extends { request: "urlPathParams" | "data&urlPathParams" }
|
|
446
|
+
? true
|
|
447
|
+
: false
|
|
448
|
+
: TTargetUsage extends FieldUsage.Response
|
|
449
|
+
? TUsage extends { response: true }
|
|
450
|
+
? true
|
|
451
|
+
: false
|
|
452
|
+
: false;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* METHOD-SPECIFIC SCHEMA INFERENCE: Infer schema for a specific HTTP method and usage
|
|
456
|
+
* This is the key missing piece that enables proper method-specific type inference
|
|
457
|
+
*/
|
|
458
|
+
/**
|
|
459
|
+
* Helper type to compute schemas for children once
|
|
460
|
+
* Avoids double evaluation that causes deep recursion
|
|
461
|
+
*/
|
|
462
|
+
type ComputeChildSchemas<
|
|
463
|
+
TTranslationKey extends string,
|
|
464
|
+
TChildren,
|
|
465
|
+
Method extends Methods,
|
|
466
|
+
Usage extends FieldUsage,
|
|
467
|
+
> = {
|
|
468
|
+
[K in keyof TChildren]: TChildren[K] extends UnifiedField<
|
|
469
|
+
TTranslationKey,
|
|
470
|
+
z.ZodTypeAny
|
|
471
|
+
>
|
|
472
|
+
? InferSchemaFromFieldForMethod<
|
|
473
|
+
TTranslationKey,
|
|
474
|
+
TChildren[K],
|
|
475
|
+
Method,
|
|
476
|
+
Usage,
|
|
477
|
+
z.ZodTypeAny
|
|
478
|
+
>
|
|
479
|
+
: never;
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Filter out never schemas from computed children
|
|
484
|
+
*/
|
|
485
|
+
type FilterNeverSchemas<TSchemas> = {
|
|
486
|
+
[K in keyof TSchemas as TSchemas[K] extends z.ZodNever
|
|
487
|
+
? never
|
|
488
|
+
: K]: TSchemas[K];
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
export type InferSchemaFromFieldForMethod<
|
|
492
|
+
TTranslationKey extends string,
|
|
493
|
+
F extends UnifiedField<TTranslationKey, TSchema>,
|
|
494
|
+
Method extends Methods,
|
|
495
|
+
Usage extends FieldUsage,
|
|
496
|
+
TSchema extends z.ZodTypeAny = z.ZodTypeAny,
|
|
497
|
+
> =
|
|
498
|
+
// Handle PrimitiveField
|
|
499
|
+
F extends PrimitiveField<
|
|
500
|
+
infer TFieldSchema,
|
|
501
|
+
FieldUsageConfig,
|
|
502
|
+
TTranslationKey,
|
|
503
|
+
WidgetConfig<TTranslationKey>
|
|
504
|
+
>
|
|
505
|
+
? F extends { usage: infer TUsage }
|
|
506
|
+
? MatchesUsageForMethod<TUsage, Method, Usage> extends true
|
|
507
|
+
? TFieldSchema
|
|
508
|
+
: Usage extends FieldUsage.RequestData
|
|
509
|
+
? z.ZodUndefined
|
|
510
|
+
: z.ZodNever
|
|
511
|
+
: Usage extends FieldUsage.RequestData
|
|
512
|
+
? z.ZodUndefined
|
|
513
|
+
: z.ZodNever
|
|
514
|
+
: // Handle ObjectField - process children based on their own usage
|
|
515
|
+
F extends ObjectField<
|
|
516
|
+
infer TChildren,
|
|
517
|
+
FieldUsageConfig,
|
|
518
|
+
TTranslationKey,
|
|
519
|
+
WidgetConfig<TTranslationKey>
|
|
520
|
+
>
|
|
521
|
+
? z.ZodObject<
|
|
522
|
+
FilterNeverSchemas<
|
|
523
|
+
ComputeChildSchemas<TTranslationKey, TChildren, Method, Usage>
|
|
524
|
+
>
|
|
525
|
+
>
|
|
526
|
+
: // Handle ObjectOptionalField - process children based on their own usage
|
|
527
|
+
F extends ObjectOptionalField<
|
|
528
|
+
infer TChildren,
|
|
529
|
+
FieldUsageConfig,
|
|
530
|
+
TTranslationKey,
|
|
531
|
+
WidgetConfig<TTranslationKey>
|
|
532
|
+
>
|
|
533
|
+
? z.ZodOptional<
|
|
534
|
+
z.ZodNullable<
|
|
535
|
+
z.ZodObject<
|
|
536
|
+
FilterNeverSchemas<
|
|
537
|
+
ComputeChildSchemas<TTranslationKey, TChildren, Method, Usage>
|
|
538
|
+
>
|
|
539
|
+
>
|
|
540
|
+
>
|
|
541
|
+
>
|
|
542
|
+
: // Handle ArrayField
|
|
543
|
+
F extends ArrayField<
|
|
544
|
+
infer TChild,
|
|
545
|
+
FieldUsageConfig,
|
|
546
|
+
TTranslationKey,
|
|
547
|
+
WidgetConfig<TTranslationKey>
|
|
548
|
+
>
|
|
549
|
+
? F extends { usage: infer TUsage }
|
|
550
|
+
? MatchesUsageForMethod<TUsage, Method, Usage> extends true
|
|
551
|
+
? z.ZodArray<
|
|
552
|
+
TChild extends UnifiedField<TTranslationKey, z.ZodTypeAny>
|
|
553
|
+
? InferSchemaFromFieldForMethod<
|
|
554
|
+
TTranslationKey,
|
|
555
|
+
TChild,
|
|
556
|
+
Method,
|
|
557
|
+
Usage,
|
|
558
|
+
z.ZodTypeAny
|
|
559
|
+
>
|
|
560
|
+
: TChild extends z.ZodTypeAny
|
|
561
|
+
? TChild
|
|
562
|
+
: z.ZodNever
|
|
563
|
+
>
|
|
564
|
+
: Usage extends FieldUsage.RequestData
|
|
565
|
+
? z.ZodUndefined
|
|
566
|
+
: z.ZodNever
|
|
567
|
+
: Usage extends FieldUsage.RequestData
|
|
568
|
+
? z.ZodUndefined
|
|
569
|
+
: z.ZodNever
|
|
570
|
+
: // Handle ArrayOptionalField
|
|
571
|
+
F extends ArrayOptionalField<
|
|
572
|
+
infer TChild,
|
|
573
|
+
FieldUsageConfig,
|
|
574
|
+
TTranslationKey,
|
|
575
|
+
WidgetConfig<TTranslationKey>
|
|
576
|
+
>
|
|
577
|
+
? F extends { usage: infer TUsage }
|
|
578
|
+
? MatchesUsageForMethod<TUsage, Method, Usage> extends true
|
|
579
|
+
? z.ZodNullable<
|
|
580
|
+
z.ZodArray<
|
|
581
|
+
TChild extends UnifiedField<TTranslationKey, z.ZodTypeAny>
|
|
582
|
+
? InferSchemaFromFieldForMethod<
|
|
583
|
+
TTranslationKey,
|
|
584
|
+
TChild,
|
|
585
|
+
Method,
|
|
586
|
+
Usage,
|
|
587
|
+
z.ZodTypeAny
|
|
588
|
+
>
|
|
589
|
+
: TChild extends z.ZodTypeAny
|
|
590
|
+
? TChild
|
|
591
|
+
: z.ZodNever
|
|
592
|
+
>
|
|
593
|
+
>
|
|
594
|
+
: Usage extends FieldUsage.RequestData
|
|
595
|
+
? z.ZodUndefined
|
|
596
|
+
: z.ZodNever
|
|
597
|
+
: Usage extends FieldUsage.RequestData
|
|
598
|
+
? z.ZodUndefined
|
|
599
|
+
: z.ZodNever
|
|
600
|
+
: z.ZodNever;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* METHOD-SPECIFIC INPUT TYPE INFERENCE
|
|
604
|
+
*/
|
|
605
|
+
export type InferInputFromFieldForMethod<
|
|
606
|
+
TTranslationKey extends string,
|
|
607
|
+
F extends UnifiedField<TTranslationKey, TSchema>,
|
|
608
|
+
Method extends Methods,
|
|
609
|
+
Usage extends FieldUsage,
|
|
610
|
+
TSchema extends z.ZodTypeAny = z.ZodTypeAny,
|
|
611
|
+
> = ExtractInput<
|
|
612
|
+
InferSchemaFromFieldForMethod<TTranslationKey, F, Method, Usage, TSchema>
|
|
613
|
+
>;
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* METHOD-SPECIFIC OUTPUT TYPE INFERENCE
|
|
617
|
+
*/
|
|
618
|
+
export type InferOutputFromFieldForMethod<
|
|
619
|
+
TTranslationKey extends string,
|
|
620
|
+
F extends UnifiedField<TTranslationKey, TSchema>,
|
|
621
|
+
Method extends Methods,
|
|
622
|
+
Usage extends FieldUsage,
|
|
623
|
+
TSchema extends z.ZodTypeAny = z.ZodTypeAny,
|
|
624
|
+
> = ExtractOutput<
|
|
625
|
+
InferSchemaFromFieldForMethod<TTranslationKey, F, Method, Usage, TSchema>
|
|
626
|
+
>;
|
|
627
|
+
|
|
628
|
+
// ============================================================================
|
|
629
|
+
// BASIC TYPE UTILITIES
|
|
630
|
+
// ============================================================================
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Field value types that can be handled by the system
|
|
634
|
+
*/
|
|
635
|
+
export type FieldValue = string | number | boolean | Date | null | undefined;
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Field usage configuration
|
|
639
|
+
* Supports both current format (backward compatible) and method-specific configuration
|
|
640
|
+
*/
|
|
641
|
+
export type FieldUsageConfig =
|
|
642
|
+
// applies to all methods
|
|
643
|
+
| { request: "data"; response?: never }
|
|
644
|
+
| { request: "urlPathParams"; response?: never }
|
|
645
|
+
| { request: "data&urlPathParams"; response?: never }
|
|
646
|
+
| { request?: never; response: true }
|
|
647
|
+
| { request: "data"; response: true }
|
|
648
|
+
| { request: "urlPathParams"; response: true }
|
|
649
|
+
| { request: "data&urlPathParams"; response: true }
|
|
650
|
+
// method-specific format
|
|
651
|
+
| {
|
|
652
|
+
[Methods.GET]?: {
|
|
653
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
654
|
+
response?: true;
|
|
655
|
+
};
|
|
656
|
+
[Methods.POST]?: {
|
|
657
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
658
|
+
response?: true;
|
|
659
|
+
};
|
|
660
|
+
[Methods.PUT]?: {
|
|
661
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
662
|
+
response?: true;
|
|
663
|
+
};
|
|
664
|
+
[Methods.PATCH]?: {
|
|
665
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
666
|
+
response?: true;
|
|
667
|
+
};
|
|
668
|
+
[Methods.DELETE]?: {
|
|
669
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
670
|
+
response?: true;
|
|
671
|
+
};
|
|
672
|
+
request?: never;
|
|
673
|
+
response?: never;
|
|
674
|
+
}
|
|
675
|
+
| {
|
|
676
|
+
[Methods.GET]?: {
|
|
677
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
678
|
+
response?: never;
|
|
679
|
+
};
|
|
680
|
+
[Methods.POST]?: {
|
|
681
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
682
|
+
response?: never;
|
|
683
|
+
};
|
|
684
|
+
[Methods.PUT]?: {
|
|
685
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
686
|
+
response?: never;
|
|
687
|
+
};
|
|
688
|
+
[Methods.PATCH]?: {
|
|
689
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
690
|
+
response?: never;
|
|
691
|
+
};
|
|
692
|
+
[Methods.DELETE]?: {
|
|
693
|
+
request?: "data" | "urlPathParams" | "data&urlPathParams";
|
|
694
|
+
response?: never;
|
|
695
|
+
};
|
|
696
|
+
request?: never;
|
|
697
|
+
response?: never;
|
|
698
|
+
}
|
|
699
|
+
// New method-specific format - urlPathParams request type
|
|
700
|
+
| {
|
|
701
|
+
[Methods.GET]?: { request?: "urlPathParams"; response?: true };
|
|
702
|
+
[Methods.POST]?: { request?: "urlPathParams"; response?: true };
|
|
703
|
+
[Methods.PUT]?: { request?: "urlPathParams"; response?: true };
|
|
704
|
+
[Methods.PATCH]?: { request?: "urlPathParams"; response?: true };
|
|
705
|
+
[Methods.DELETE]?: { request?: "urlPathParams"; response?: true };
|
|
706
|
+
request?: never;
|
|
707
|
+
response?: never;
|
|
708
|
+
}
|
|
709
|
+
| {
|
|
710
|
+
[Methods.GET]?: { request?: "urlPathParams"; response?: never };
|
|
711
|
+
[Methods.POST]?: { request?: "urlPathParams"; response?: never };
|
|
712
|
+
[Methods.PUT]?: { request?: "urlPathParams"; response?: never };
|
|
713
|
+
[Methods.PATCH]?: { request?: "urlPathParams"; response?: never };
|
|
714
|
+
[Methods.DELETE]?: { request?: "urlPathParams"; response?: never };
|
|
715
|
+
request?: never;
|
|
716
|
+
response?: never;
|
|
717
|
+
}
|
|
718
|
+
// New method-specific format - data&urlPathParams request type
|
|
719
|
+
| {
|
|
720
|
+
[Methods.GET]?: { request?: "data&urlPathParams"; response?: true };
|
|
721
|
+
[Methods.POST]?: { request?: "data&urlPathParams"; response?: true };
|
|
722
|
+
[Methods.PUT]?: { request?: "data&urlPathParams"; response?: true };
|
|
723
|
+
[Methods.PATCH]?: { request?: "data&urlPathParams"; response?: true };
|
|
724
|
+
[Methods.DELETE]?: { request?: "data&urlPathParams"; response?: true };
|
|
725
|
+
request?: never;
|
|
726
|
+
response?: never;
|
|
727
|
+
}
|
|
728
|
+
| {
|
|
729
|
+
[Methods.GET]?: { request?: "data&urlPathParams"; response?: never };
|
|
730
|
+
[Methods.POST]?: { request?: "data&urlPathParams"; response?: never };
|
|
731
|
+
[Methods.PUT]?: { request?: "data&urlPathParams"; response?: never };
|
|
732
|
+
[Methods.PATCH]?: { request?: "data&urlPathParams"; response?: never };
|
|
733
|
+
[Methods.DELETE]?: { request?: "data&urlPathParams"; response?: never };
|
|
734
|
+
request?: never;
|
|
735
|
+
response?: never;
|
|
736
|
+
}
|
|
737
|
+
// New method-specific format - response only
|
|
738
|
+
| {
|
|
739
|
+
[Methods.GET]?: { request?: never; response: true };
|
|
740
|
+
[Methods.POST]?: { request?: never; response: true };
|
|
741
|
+
[Methods.PUT]?: { request?: never; response: true };
|
|
742
|
+
[Methods.PATCH]?: { request?: never; response: true };
|
|
743
|
+
[Methods.DELETE]?: { request?: never; response: true };
|
|
744
|
+
request?: never;
|
|
745
|
+
response?: never;
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
export type ExamplesList<T, TExampleKey extends string> = {
|
|
749
|
+
[exampleKey in TExampleKey]: T; // & { id?: string };
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
// ============================================================================
|
|
753
|
+
// ACTION SYSTEM TYPES
|
|
754
|
+
// ============================================================================
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Action condition for conditional execution
|
|
758
|
+
*/
|
|
759
|
+
export interface ActionCondition {
|
|
760
|
+
field: string;
|
|
761
|
+
operator:
|
|
762
|
+
| "equals"
|
|
763
|
+
| "not_equals"
|
|
764
|
+
| "contains"
|
|
765
|
+
| "not_contains"
|
|
766
|
+
| "exists"
|
|
767
|
+
| "not_exists"
|
|
768
|
+
| "greater_than"
|
|
769
|
+
| "less_than";
|
|
770
|
+
value?: FieldValue;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Base action configuration
|
|
775
|
+
*/
|
|
776
|
+
export interface BaseActionConfig {
|
|
777
|
+
type: ActionType;
|
|
778
|
+
timing?: ActionTiming;
|
|
779
|
+
delay?: number;
|
|
780
|
+
conditions?: ActionCondition[];
|
|
781
|
+
contexts?: InterfaceContext[];
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Toast/Notification action
|
|
786
|
+
*/
|
|
787
|
+
export interface ToastActionConfig extends BaseActionConfig {
|
|
788
|
+
type: ActionType.TOAST | ActionType.NOTIFICATION | ActionType.ALERT;
|
|
789
|
+
message: TranslationKey;
|
|
790
|
+
variant?: ComponentVariant;
|
|
791
|
+
duration?: number;
|
|
792
|
+
title?: TranslationKey;
|
|
793
|
+
description?: TranslationKey;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Navigation action
|
|
798
|
+
*/
|
|
799
|
+
export interface NavigationActionConfig extends BaseActionConfig {
|
|
800
|
+
type:
|
|
801
|
+
| ActionType.ROUTER_PUSH
|
|
802
|
+
| ActionType.ROUTER_REPLACE
|
|
803
|
+
| ActionType.ROUTER_BACK
|
|
804
|
+
| ActionType.REDIRECT;
|
|
805
|
+
path?: string;
|
|
806
|
+
route?: Route;
|
|
807
|
+
params?: Record<string, string>;
|
|
808
|
+
query?: Record<string, string>;
|
|
809
|
+
replace?: boolean;
|
|
810
|
+
external?: boolean;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Data/Cache action
|
|
815
|
+
*/
|
|
816
|
+
export interface RefetchActionConfig extends BaseActionConfig {
|
|
817
|
+
type:
|
|
818
|
+
| ActionType.REFETCH
|
|
819
|
+
| ActionType.INVALIDATE_CACHE
|
|
820
|
+
| ActionType.UPDATE_CACHE
|
|
821
|
+
| ActionType.CLEAR_CACHE;
|
|
822
|
+
queryKeys?: string[][];
|
|
823
|
+
exact?: boolean;
|
|
824
|
+
data?: Record<string, FieldValue>;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Form action
|
|
829
|
+
*/
|
|
830
|
+
export interface FormActionConfig extends BaseActionConfig {
|
|
831
|
+
type:
|
|
832
|
+
| ActionType.RESET_FORM
|
|
833
|
+
| ActionType.CLEAR_FORM
|
|
834
|
+
| ActionType.SET_FORM_VALUES
|
|
835
|
+
| ActionType.FOCUS_FIELD;
|
|
836
|
+
formId?: string;
|
|
837
|
+
values?: Record<string, FieldValue>;
|
|
838
|
+
fieldName?: string;
|
|
839
|
+
resetToDefaults?: boolean;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* State action
|
|
844
|
+
*/
|
|
845
|
+
export interface StateActionConfig extends BaseActionConfig {
|
|
846
|
+
type:
|
|
847
|
+
| ActionType.SET_STATE
|
|
848
|
+
| ActionType.TOGGLE_STATE
|
|
849
|
+
| ActionType.UPDATE_STATE;
|
|
850
|
+
key: string;
|
|
851
|
+
value?: FieldValue;
|
|
852
|
+
updater?: (current: FieldValue) => FieldValue;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Custom action
|
|
857
|
+
*/
|
|
858
|
+
export interface CustomActionConfig extends BaseActionConfig {
|
|
859
|
+
type: ActionType.CUSTOM;
|
|
860
|
+
handler: string | ((context: ActionContext) => Promise<ActionResult>);
|
|
861
|
+
payload?: Record<string, FieldValue>;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Union type for all action configurations
|
|
866
|
+
*/
|
|
867
|
+
export type ActionConfig =
|
|
868
|
+
| ToastActionConfig
|
|
869
|
+
| NavigationActionConfig
|
|
870
|
+
| RefetchActionConfig
|
|
871
|
+
| FormActionConfig
|
|
872
|
+
| StateActionConfig
|
|
873
|
+
| CustomActionConfig;
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Action execution context
|
|
877
|
+
*/
|
|
878
|
+
export interface ActionContext {
|
|
879
|
+
context: InterfaceContext;
|
|
880
|
+
data?: Record<string, FieldValue>;
|
|
881
|
+
error?: Error;
|
|
882
|
+
endpoint?: Record<string, FieldValue>;
|
|
883
|
+
timestamp: string;
|
|
884
|
+
user: {
|
|
885
|
+
id: string;
|
|
886
|
+
roles: string[];
|
|
887
|
+
};
|
|
888
|
+
metadata?: Record<string, FieldValue>;
|
|
889
|
+
formValues?: Record<string, FieldValue>;
|
|
890
|
+
fieldValue?: FieldValue;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Action execution result
|
|
895
|
+
*/
|
|
896
|
+
export interface ActionResult {
|
|
897
|
+
success: boolean;
|
|
898
|
+
data?: Record<string, FieldValue>;
|
|
899
|
+
error?: string;
|
|
900
|
+
metadata?: Record<string, FieldValue>;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Lifecycle actions
|
|
905
|
+
*/
|
|
906
|
+
export interface LifecycleActions {
|
|
907
|
+
onSuccess?: ActionConfig[];
|
|
908
|
+
onError?: ActionConfig[];
|
|
909
|
+
onLoading?: ActionConfig[];
|
|
910
|
+
onComplete?: ActionConfig[];
|
|
911
|
+
onMount?: ActionConfig[];
|
|
912
|
+
onUnmount?: ActionConfig[];
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Interactive actions
|
|
917
|
+
*/
|
|
918
|
+
export interface InteractiveActions {
|
|
919
|
+
onClick?: ActionConfig[];
|
|
920
|
+
onDoubleClick?: ActionConfig[];
|
|
921
|
+
onHover?: ActionConfig[];
|
|
922
|
+
onFocus?: ActionConfig[];
|
|
923
|
+
onBlur?: ActionConfig[];
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Form field actions
|
|
928
|
+
*/
|
|
929
|
+
export interface FieldActions {
|
|
930
|
+
onChange?: ActionConfig[];
|
|
931
|
+
onValidation?: ActionConfig[];
|
|
932
|
+
onError?: ActionConfig[];
|
|
933
|
+
onClear?: ActionConfig[];
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Button action configuration
|
|
938
|
+
*/
|
|
939
|
+
export interface ButtonAction {
|
|
940
|
+
label: TranslationKey;
|
|
941
|
+
icon?: string;
|
|
942
|
+
variant?: ComponentVariant;
|
|
943
|
+
size?: ComponentSize;
|
|
944
|
+
actions: ActionConfig[];
|
|
945
|
+
conditions?: ActionCondition[];
|
|
946
|
+
disabled?: boolean;
|
|
947
|
+
loading?: boolean;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Context menu action
|
|
952
|
+
*/
|
|
953
|
+
export interface ContextMenuAction {
|
|
954
|
+
label: TranslationKey;
|
|
955
|
+
icon?: string;
|
|
956
|
+
actions: ActionConfig[];
|
|
957
|
+
separator?: boolean;
|
|
958
|
+
disabled?: boolean;
|
|
959
|
+
dangerous?: boolean;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Bulk action for data tables
|
|
964
|
+
*/
|
|
965
|
+
export interface BulkAction {
|
|
966
|
+
label: TranslationKey;
|
|
967
|
+
icon?: string;
|
|
968
|
+
variant?: ComponentVariant;
|
|
969
|
+
actions: ActionConfig[];
|
|
970
|
+
confirmationMessage?: TranslationKey;
|
|
971
|
+
requiresSelection?: boolean;
|
|
972
|
+
maxSelection?: number;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// ============================================================================
|
|
976
|
+
// FIELD SYSTEM TYPES
|
|
977
|
+
// ============================================================================
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Primitive field type
|
|
981
|
+
*/
|
|
982
|
+
export interface PrimitiveField<
|
|
983
|
+
out TSchema extends z.ZodTypeAny,
|
|
984
|
+
out TUsage extends FieldUsageConfig,
|
|
985
|
+
TKey extends string,
|
|
986
|
+
out TUIConfig extends WidgetConfig<TKey>,
|
|
987
|
+
> {
|
|
988
|
+
type: "primitive";
|
|
989
|
+
schema: TSchema;
|
|
990
|
+
usage: TUsage;
|
|
991
|
+
cache?: CacheStrategy;
|
|
992
|
+
ui: TUIConfig;
|
|
993
|
+
apiKey?: string;
|
|
994
|
+
uiKey?: string;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Object field type with children
|
|
999
|
+
*/
|
|
1000
|
+
export interface ObjectField<
|
|
1001
|
+
out TChildren,
|
|
1002
|
+
out TUsage extends FieldUsageConfig,
|
|
1003
|
+
TKey extends string,
|
|
1004
|
+
out TUIConfig extends WidgetConfig<TKey>,
|
|
1005
|
+
> {
|
|
1006
|
+
type: "object";
|
|
1007
|
+
usage: TUsage;
|
|
1008
|
+
cache?: CacheStrategy;
|
|
1009
|
+
ui: TUIConfig;
|
|
1010
|
+
children: TChildren;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* Optional object field type
|
|
1015
|
+
*/
|
|
1016
|
+
export interface ObjectOptionalField<
|
|
1017
|
+
out TChildren,
|
|
1018
|
+
out TUsage extends FieldUsageConfig,
|
|
1019
|
+
TKey extends string,
|
|
1020
|
+
out TUIConfig extends WidgetConfig<TKey>,
|
|
1021
|
+
> {
|
|
1022
|
+
type: "object-optional";
|
|
1023
|
+
usage: TUsage;
|
|
1024
|
+
cache?: CacheStrategy;
|
|
1025
|
+
ui: TUIConfig;
|
|
1026
|
+
children: TChildren;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Object union field type for discriminated unions
|
|
1031
|
+
*/
|
|
1032
|
+
export interface ObjectUnionField<
|
|
1033
|
+
out TDiscriminator extends string,
|
|
1034
|
+
TKey extends string,
|
|
1035
|
+
out TVariants extends readonly [
|
|
1036
|
+
ObjectField<
|
|
1037
|
+
Record<string, UnifiedField<TKey, z.ZodTypeAny>>,
|
|
1038
|
+
FieldUsageConfig,
|
|
1039
|
+
TKey,
|
|
1040
|
+
WidgetConfig<TKey>
|
|
1041
|
+
>,
|
|
1042
|
+
...ObjectField<
|
|
1043
|
+
Record<string, UnifiedField<TKey, z.ZodTypeAny>>,
|
|
1044
|
+
FieldUsageConfig,
|
|
1045
|
+
TKey,
|
|
1046
|
+
WidgetConfig<TKey>
|
|
1047
|
+
>[],
|
|
1048
|
+
],
|
|
1049
|
+
out TUsage extends FieldUsageConfig,
|
|
1050
|
+
out TUIConfig extends WidgetConfig<TKey>,
|
|
1051
|
+
> {
|
|
1052
|
+
type: "object-union";
|
|
1053
|
+
discriminator: TDiscriminator;
|
|
1054
|
+
variants: TVariants;
|
|
1055
|
+
usage: TUsage;
|
|
1056
|
+
cache?: CacheStrategy;
|
|
1057
|
+
ui: TUIConfig;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* Array field type
|
|
1062
|
+
*/
|
|
1063
|
+
export interface ArrayField<
|
|
1064
|
+
out TChild,
|
|
1065
|
+
out TUsage extends FieldUsageConfig,
|
|
1066
|
+
TKey extends string,
|
|
1067
|
+
out TUIConfig extends WidgetConfig<TKey>,
|
|
1068
|
+
> {
|
|
1069
|
+
type: "array";
|
|
1070
|
+
usage: TUsage;
|
|
1071
|
+
cache?: CacheStrategy;
|
|
1072
|
+
ui: TUIConfig;
|
|
1073
|
+
child: TChild;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Optional array field type
|
|
1078
|
+
*/
|
|
1079
|
+
export interface ArrayOptionalField<
|
|
1080
|
+
out TChild,
|
|
1081
|
+
out TUsage extends FieldUsageConfig,
|
|
1082
|
+
TKey extends string,
|
|
1083
|
+
out TUIConfig extends WidgetConfig<TKey>,
|
|
1084
|
+
> {
|
|
1085
|
+
type: "array-optional";
|
|
1086
|
+
usage: TUsage;
|
|
1087
|
+
cache?: CacheStrategy;
|
|
1088
|
+
ui: TUIConfig;
|
|
1089
|
+
child: TChild;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Widget field (UI-only, no schema)
|
|
1094
|
+
*/
|
|
1095
|
+
export interface WidgetField<
|
|
1096
|
+
out TUsage extends FieldUsageConfig,
|
|
1097
|
+
TKey extends string,
|
|
1098
|
+
out TUIConfig extends WidgetConfig<TKey>,
|
|
1099
|
+
> {
|
|
1100
|
+
type: "widget";
|
|
1101
|
+
usage: TUsage;
|
|
1102
|
+
cache?: CacheStrategy;
|
|
1103
|
+
ui: TUIConfig;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* Unified field type that supports all field configurations with enhanced type preservation
|
|
1108
|
+
*
|
|
1109
|
+
* TSchema: The Zod schema type for primitive fields
|
|
1110
|
+
* TKey: The translation key type - can be global TranslationKey or scoped translation keys
|
|
1111
|
+
*
|
|
1112
|
+
* When using scoped translations, pass the scoped key type:
|
|
1113
|
+
* UnifiedField<z.ZodTypeAny, ContactTranslationKey>
|
|
1114
|
+
*
|
|
1115
|
+
* This ensures all widget configs in the field tree use the correct translation key type.
|
|
1116
|
+
*
|
|
1117
|
+
*/
|
|
1118
|
+
export type UnifiedField<
|
|
1119
|
+
TKey extends string,
|
|
1120
|
+
TSchema extends z.ZodTypeAny = z.ZodTypeAny,
|
|
1121
|
+
> =
|
|
1122
|
+
| PrimitiveField<TSchema, FieldUsageConfig, TKey, WidgetConfig<TKey>>
|
|
1123
|
+
| ObjectField<
|
|
1124
|
+
Record<string, UnifiedField<TKey, z.ZodTypeAny>>,
|
|
1125
|
+
FieldUsageConfig,
|
|
1126
|
+
TKey,
|
|
1127
|
+
WidgetConfig<TKey>
|
|
1128
|
+
>
|
|
1129
|
+
| ObjectOptionalField<
|
|
1130
|
+
Record<string, UnifiedField<TKey, z.ZodTypeAny>>,
|
|
1131
|
+
FieldUsageConfig,
|
|
1132
|
+
TKey,
|
|
1133
|
+
WidgetConfig<TKey>
|
|
1134
|
+
>
|
|
1135
|
+
| ObjectUnionField<
|
|
1136
|
+
string,
|
|
1137
|
+
TKey,
|
|
1138
|
+
readonly [
|
|
1139
|
+
ObjectField<
|
|
1140
|
+
Record<string, UnifiedField<TKey, z.ZodTypeAny>>,
|
|
1141
|
+
FieldUsageConfig,
|
|
1142
|
+
TKey,
|
|
1143
|
+
WidgetConfig<TKey>
|
|
1144
|
+
>,
|
|
1145
|
+
...ObjectField<
|
|
1146
|
+
Record<string, UnifiedField<TKey, z.ZodTypeAny>>,
|
|
1147
|
+
FieldUsageConfig,
|
|
1148
|
+
TKey,
|
|
1149
|
+
WidgetConfig<TKey>
|
|
1150
|
+
>[],
|
|
1151
|
+
],
|
|
1152
|
+
FieldUsageConfig,
|
|
1153
|
+
WidgetConfig<TKey>
|
|
1154
|
+
>
|
|
1155
|
+
| ArrayField<
|
|
1156
|
+
UnifiedField<TKey, z.ZodTypeAny> | z.ZodTypeAny,
|
|
1157
|
+
FieldUsageConfig,
|
|
1158
|
+
TKey,
|
|
1159
|
+
WidgetConfig<TKey>
|
|
1160
|
+
>
|
|
1161
|
+
| ArrayOptionalField<
|
|
1162
|
+
UnifiedField<TKey, z.ZodTypeAny> | z.ZodTypeAny,
|
|
1163
|
+
FieldUsageConfig,
|
|
1164
|
+
TKey,
|
|
1165
|
+
WidgetConfig<TKey>
|
|
1166
|
+
>
|
|
1167
|
+
| WidgetField<FieldUsageConfig, TKey, WidgetConfig<TKey>>;
|