@frontmcp/uipack 0.6.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/CLAUDE.md +246 -0
- package/LICENSE +201 -0
- package/README.md +150 -0
- package/adapters/index.d.ts +13 -0
- package/adapters/index.d.ts.map +1 -0
- package/adapters/index.js +462 -0
- package/adapters/platform-meta.d.ts +166 -0
- package/adapters/platform-meta.d.ts.map +1 -0
- package/adapters/response-builder.d.ts +108 -0
- package/adapters/response-builder.d.ts.map +1 -0
- package/adapters/serving-mode.d.ts +107 -0
- package/adapters/serving-mode.d.ts.map +1 -0
- package/base-template/bridge.d.ts +90 -0
- package/base-template/bridge.d.ts.map +1 -0
- package/base-template/default-base-template.d.ts +92 -0
- package/base-template/default-base-template.d.ts.map +1 -0
- package/base-template/index.d.ts +15 -0
- package/base-template/index.d.ts.map +1 -0
- package/base-template/index.js +1398 -0
- package/base-template/polyfills.d.ts +31 -0
- package/base-template/polyfills.d.ts.map +1 -0
- package/base-template/theme-styles.d.ts +74 -0
- package/base-template/theme-styles.d.ts.map +1 -0
- package/bridge-runtime/iife-generator.d.ts +62 -0
- package/bridge-runtime/iife-generator.d.ts.map +1 -0
- package/bridge-runtime/index.d.ts +10 -0
- package/bridge-runtime/index.d.ts.map +1 -0
- package/bridge-runtime/index.js +883 -0
- package/build/cdn-resources.d.ts +243 -0
- package/build/cdn-resources.d.ts.map +1 -0
- package/build/index.d.ts +295 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +6861 -0
- package/build/widget-manifest.d.ts +362 -0
- package/build/widget-manifest.d.ts.map +1 -0
- package/bundler/cache.d.ts +173 -0
- package/bundler/cache.d.ts.map +1 -0
- package/bundler/file-cache/component-builder.d.ts +167 -0
- package/bundler/file-cache/component-builder.d.ts.map +1 -0
- package/bundler/file-cache/hash-calculator.d.ts +155 -0
- package/bundler/file-cache/hash-calculator.d.ts.map +1 -0
- package/bundler/file-cache/index.d.ts +12 -0
- package/bundler/file-cache/index.d.ts.map +1 -0
- package/bundler/file-cache/storage/filesystem.d.ts +149 -0
- package/bundler/file-cache/storage/filesystem.d.ts.map +1 -0
- package/bundler/file-cache/storage/index.d.ts +11 -0
- package/bundler/file-cache/storage/index.d.ts.map +1 -0
- package/bundler/file-cache/storage/interface.d.ts +152 -0
- package/bundler/file-cache/storage/interface.d.ts.map +1 -0
- package/bundler/file-cache/storage/redis.d.ts +139 -0
- package/bundler/file-cache/storage/redis.d.ts.map +1 -0
- package/bundler/index.d.ts +35 -0
- package/bundler/index.d.ts.map +1 -0
- package/bundler/index.js +2947 -0
- package/bundler/sandbox/enclave-adapter.d.ts +121 -0
- package/bundler/sandbox/enclave-adapter.d.ts.map +1 -0
- package/bundler/sandbox/executor.d.ts +14 -0
- package/bundler/sandbox/executor.d.ts.map +1 -0
- package/bundler/sandbox/policy.d.ts +62 -0
- package/bundler/sandbox/policy.d.ts.map +1 -0
- package/bundler/types.d.ts +702 -0
- package/bundler/types.d.ts.map +1 -0
- package/dependency/cdn-registry.d.ts +98 -0
- package/dependency/cdn-registry.d.ts.map +1 -0
- package/dependency/import-map.d.ts +186 -0
- package/dependency/import-map.d.ts.map +1 -0
- package/dependency/import-parser.d.ts +82 -0
- package/dependency/import-parser.d.ts.map +1 -0
- package/dependency/index.d.ts +17 -0
- package/dependency/index.d.ts.map +1 -0
- package/dependency/index.js +3215 -0
- package/dependency/resolver.d.ts +164 -0
- package/dependency/resolver.d.ts.map +1 -0
- package/dependency/schemas.d.ts +486 -0
- package/dependency/schemas.d.ts.map +1 -0
- package/dependency/template-loader.d.ts +204 -0
- package/dependency/template-loader.d.ts.map +1 -0
- package/dependency/template-processor.d.ts +118 -0
- package/dependency/template-processor.d.ts.map +1 -0
- package/dependency/types.d.ts +739 -0
- package/dependency/types.d.ts.map +1 -0
- package/esm/adapters/index.d.ts +13 -0
- package/esm/adapters/index.d.ts.map +1 -0
- package/esm/adapters/index.js +427 -0
- package/esm/adapters/platform-meta.d.ts +166 -0
- package/esm/adapters/platform-meta.d.ts.map +1 -0
- package/esm/adapters/response-builder.d.ts +108 -0
- package/esm/adapters/response-builder.d.ts.map +1 -0
- package/esm/adapters/serving-mode.d.ts +107 -0
- package/esm/adapters/serving-mode.d.ts.map +1 -0
- package/esm/base-template/bridge.d.ts +90 -0
- package/esm/base-template/bridge.d.ts.map +1 -0
- package/esm/base-template/default-base-template.d.ts +92 -0
- package/esm/base-template/default-base-template.d.ts.map +1 -0
- package/esm/base-template/index.d.ts +15 -0
- package/esm/base-template/index.d.ts.map +1 -0
- package/esm/base-template/index.js +1364 -0
- package/esm/base-template/polyfills.d.ts +31 -0
- package/esm/base-template/polyfills.d.ts.map +1 -0
- package/esm/base-template/theme-styles.d.ts +74 -0
- package/esm/base-template/theme-styles.d.ts.map +1 -0
- package/esm/bridge-runtime/iife-generator.d.ts +62 -0
- package/esm/bridge-runtime/iife-generator.d.ts.map +1 -0
- package/esm/bridge-runtime/index.d.ts +10 -0
- package/esm/bridge-runtime/index.d.ts.map +1 -0
- package/esm/bridge-runtime/index.js +853 -0
- package/esm/build/cdn-resources.d.ts +243 -0
- package/esm/build/cdn-resources.d.ts.map +1 -0
- package/esm/build/index.d.ts +295 -0
- package/esm/build/index.d.ts.map +1 -0
- package/esm/build/index.js +6786 -0
- package/esm/build/widget-manifest.d.ts +362 -0
- package/esm/build/widget-manifest.d.ts.map +1 -0
- package/esm/bundler/cache.d.ts +173 -0
- package/esm/bundler/cache.d.ts.map +1 -0
- package/esm/bundler/file-cache/component-builder.d.ts +167 -0
- package/esm/bundler/file-cache/component-builder.d.ts.map +1 -0
- package/esm/bundler/file-cache/hash-calculator.d.ts +155 -0
- package/esm/bundler/file-cache/hash-calculator.d.ts.map +1 -0
- package/esm/bundler/file-cache/index.d.ts +12 -0
- package/esm/bundler/file-cache/index.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/filesystem.d.ts +149 -0
- package/esm/bundler/file-cache/storage/filesystem.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/index.d.ts +11 -0
- package/esm/bundler/file-cache/storage/index.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/interface.d.ts +152 -0
- package/esm/bundler/file-cache/storage/interface.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/redis.d.ts +139 -0
- package/esm/bundler/file-cache/storage/redis.d.ts.map +1 -0
- package/esm/bundler/index.d.ts +35 -0
- package/esm/bundler/index.d.ts.map +1 -0
- package/esm/bundler/index.js +2882 -0
- package/esm/bundler/sandbox/enclave-adapter.d.ts +121 -0
- package/esm/bundler/sandbox/enclave-adapter.d.ts.map +1 -0
- package/esm/bundler/sandbox/executor.d.ts +14 -0
- package/esm/bundler/sandbox/executor.d.ts.map +1 -0
- package/esm/bundler/sandbox/policy.d.ts +62 -0
- package/esm/bundler/sandbox/policy.d.ts.map +1 -0
- package/esm/bundler/types.d.ts +702 -0
- package/esm/bundler/types.d.ts.map +1 -0
- package/esm/dependency/cdn-registry.d.ts +98 -0
- package/esm/dependency/cdn-registry.d.ts.map +1 -0
- package/esm/dependency/import-map.d.ts +186 -0
- package/esm/dependency/import-map.d.ts.map +1 -0
- package/esm/dependency/import-parser.d.ts +82 -0
- package/esm/dependency/import-parser.d.ts.map +1 -0
- package/esm/dependency/index.d.ts +17 -0
- package/esm/dependency/index.d.ts.map +1 -0
- package/esm/dependency/index.js +3096 -0
- package/esm/dependency/resolver.d.ts +164 -0
- package/esm/dependency/resolver.d.ts.map +1 -0
- package/esm/dependency/schemas.d.ts +486 -0
- package/esm/dependency/schemas.d.ts.map +1 -0
- package/esm/dependency/template-loader.d.ts +204 -0
- package/esm/dependency/template-loader.d.ts.map +1 -0
- package/esm/dependency/template-processor.d.ts +118 -0
- package/esm/dependency/template-processor.d.ts.map +1 -0
- package/esm/dependency/types.d.ts +739 -0
- package/esm/dependency/types.d.ts.map +1 -0
- package/esm/handlebars/expression-extractor.d.ts +147 -0
- package/esm/handlebars/expression-extractor.d.ts.map +1 -0
- package/esm/handlebars/helpers.d.ts +339 -0
- package/esm/handlebars/helpers.d.ts.map +1 -0
- package/esm/handlebars/index.d.ts +195 -0
- package/esm/handlebars/index.d.ts.map +1 -0
- package/esm/handlebars/index.js +587 -0
- package/esm/index.d.ts +50 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +12434 -0
- package/esm/package.json +68 -0
- package/esm/registry/index.d.ts +46 -0
- package/esm/registry/index.d.ts.map +1 -0
- package/esm/registry/index.js +6237 -0
- package/esm/registry/render-template.d.ts +91 -0
- package/esm/registry/render-template.d.ts.map +1 -0
- package/esm/registry/tool-ui.registry.d.ts +294 -0
- package/esm/registry/tool-ui.registry.d.ts.map +1 -0
- package/esm/registry/uri-utils.d.ts +56 -0
- package/esm/registry/uri-utils.d.ts.map +1 -0
- package/esm/renderers/cache.d.ts +145 -0
- package/esm/renderers/cache.d.ts.map +1 -0
- package/esm/renderers/html.renderer.d.ts +123 -0
- package/esm/renderers/html.renderer.d.ts.map +1 -0
- package/esm/renderers/index.d.ts +36 -0
- package/esm/renderers/index.d.ts.map +1 -0
- package/esm/renderers/index.js +1654 -0
- package/esm/renderers/mdx.renderer.d.ts +120 -0
- package/esm/renderers/mdx.renderer.d.ts.map +1 -0
- package/esm/renderers/registry.d.ts +133 -0
- package/esm/renderers/registry.d.ts.map +1 -0
- package/esm/renderers/types.d.ts +342 -0
- package/esm/renderers/types.d.ts.map +1 -0
- package/esm/renderers/utils/detect.d.ts +107 -0
- package/esm/renderers/utils/detect.d.ts.map +1 -0
- package/esm/renderers/utils/hash.d.ts +40 -0
- package/esm/renderers/utils/hash.d.ts.map +1 -0
- package/esm/renderers/utils/index.d.ts +9 -0
- package/esm/renderers/utils/index.d.ts.map +1 -0
- package/esm/renderers/utils/transpiler.d.ts +89 -0
- package/esm/renderers/utils/transpiler.d.ts.map +1 -0
- package/esm/runtime/adapters/html.adapter.d.ts +59 -0
- package/esm/runtime/adapters/html.adapter.d.ts.map +1 -0
- package/esm/runtime/adapters/index.d.ts +26 -0
- package/esm/runtime/adapters/index.d.ts.map +1 -0
- package/esm/runtime/adapters/mdx.adapter.d.ts +73 -0
- package/esm/runtime/adapters/mdx.adapter.d.ts.map +1 -0
- package/esm/runtime/adapters/types.d.ts +95 -0
- package/esm/runtime/adapters/types.d.ts.map +1 -0
- package/esm/runtime/csp.d.ts +48 -0
- package/esm/runtime/csp.d.ts.map +1 -0
- package/esm/runtime/index.d.ts +17 -0
- package/esm/runtime/index.d.ts.map +1 -0
- package/esm/runtime/index.js +4976 -0
- package/esm/runtime/mcp-bridge.d.ts +101 -0
- package/esm/runtime/mcp-bridge.d.ts.map +1 -0
- package/esm/runtime/renderer-runtime.d.ts +133 -0
- package/esm/runtime/renderer-runtime.d.ts.map +1 -0
- package/esm/runtime/sanitizer.d.ts +172 -0
- package/esm/runtime/sanitizer.d.ts.map +1 -0
- package/esm/runtime/types.d.ts +415 -0
- package/esm/runtime/types.d.ts.map +1 -0
- package/esm/runtime/wrapper.d.ts +421 -0
- package/esm/runtime/wrapper.d.ts.map +1 -0
- package/esm/styles/index.d.ts +8 -0
- package/esm/styles/index.d.ts.map +1 -0
- package/esm/styles/index.js +171 -0
- package/esm/styles/variants.d.ts +51 -0
- package/esm/styles/variants.d.ts.map +1 -0
- package/esm/theme/cdn.d.ts +195 -0
- package/esm/theme/cdn.d.ts.map +1 -0
- package/esm/theme/index.d.ts +18 -0
- package/esm/theme/index.d.ts.map +1 -0
- package/esm/theme/index.js +700 -0
- package/esm/theme/platforms.d.ts +107 -0
- package/esm/theme/platforms.d.ts.map +1 -0
- package/esm/theme/presets/github-openai.d.ts +50 -0
- package/esm/theme/presets/github-openai.d.ts.map +1 -0
- package/esm/theme/presets/index.d.ts +11 -0
- package/esm/theme/presets/index.d.ts.map +1 -0
- package/esm/theme/theme.d.ts +396 -0
- package/esm/theme/theme.d.ts.map +1 -0
- package/esm/tool-template/builder.d.ts +213 -0
- package/esm/tool-template/builder.d.ts.map +1 -0
- package/esm/tool-template/index.d.ts +16 -0
- package/esm/tool-template/index.d.ts.map +1 -0
- package/esm/tool-template/index.js +3518 -0
- package/esm/types/index.d.ts +14 -0
- package/esm/types/index.d.ts.map +1 -0
- package/esm/types/index.js +75 -0
- package/esm/types/ui-config.d.ts +641 -0
- package/esm/types/ui-config.d.ts.map +1 -0
- package/esm/types/ui-runtime.d.ts +1008 -0
- package/esm/types/ui-runtime.d.ts.map +1 -0
- package/esm/typings/cache/cache-adapter.d.ts +125 -0
- package/esm/typings/cache/cache-adapter.d.ts.map +1 -0
- package/esm/typings/cache/index.d.ts +10 -0
- package/esm/typings/cache/index.d.ts.map +1 -0
- package/esm/typings/cache/memory-cache.d.ts +92 -0
- package/esm/typings/cache/memory-cache.d.ts.map +1 -0
- package/esm/typings/dts-parser.d.ts +90 -0
- package/esm/typings/dts-parser.d.ts.map +1 -0
- package/esm/typings/index.d.ts +48 -0
- package/esm/typings/index.d.ts.map +1 -0
- package/esm/typings/index.js +812 -0
- package/esm/typings/schemas.d.ts +232 -0
- package/esm/typings/schemas.d.ts.map +1 -0
- package/esm/typings/type-fetcher.d.ts +89 -0
- package/esm/typings/type-fetcher.d.ts.map +1 -0
- package/esm/typings/types.d.ts +320 -0
- package/esm/typings/types.d.ts.map +1 -0
- package/esm/utils/escape-html.d.ts +58 -0
- package/esm/utils/escape-html.d.ts.map +1 -0
- package/esm/utils/index.d.ts +10 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +40 -0
- package/esm/utils/safe-stringify.d.ts +30 -0
- package/esm/utils/safe-stringify.d.ts.map +1 -0
- package/esm/validation/error-box.d.ts +56 -0
- package/esm/validation/error-box.d.ts.map +1 -0
- package/esm/validation/index.d.ts +13 -0
- package/esm/validation/index.d.ts.map +1 -0
- package/esm/validation/index.js +542 -0
- package/esm/validation/schema-paths.d.ts +118 -0
- package/esm/validation/schema-paths.d.ts.map +1 -0
- package/esm/validation/template-validator.d.ts +143 -0
- package/esm/validation/template-validator.d.ts.map +1 -0
- package/esm/validation/wrapper.d.ts +97 -0
- package/esm/validation/wrapper.d.ts.map +1 -0
- package/handlebars/expression-extractor.d.ts +147 -0
- package/handlebars/expression-extractor.d.ts.map +1 -0
- package/handlebars/helpers.d.ts +339 -0
- package/handlebars/helpers.d.ts.map +1 -0
- package/handlebars/index.d.ts +195 -0
- package/handlebars/index.d.ts.map +1 -0
- package/handlebars/index.js +666 -0
- package/index.d.ts +50 -0
- package/index.d.ts.map +1 -0
- package/index.js +12683 -0
- package/package.json +66 -0
- package/registry/index.d.ts +46 -0
- package/registry/index.d.ts.map +1 -0
- package/registry/index.js +6280 -0
- package/registry/render-template.d.ts +91 -0
- package/registry/render-template.d.ts.map +1 -0
- package/registry/tool-ui.registry.d.ts +294 -0
- package/registry/tool-ui.registry.d.ts.map +1 -0
- package/registry/uri-utils.d.ts +56 -0
- package/registry/uri-utils.d.ts.map +1 -0
- package/renderers/cache.d.ts +145 -0
- package/renderers/cache.d.ts.map +1 -0
- package/renderers/html.renderer.d.ts +123 -0
- package/renderers/html.renderer.d.ts.map +1 -0
- package/renderers/index.d.ts +36 -0
- package/renderers/index.d.ts.map +1 -0
- package/renderers/index.js +1706 -0
- package/renderers/mdx.renderer.d.ts +120 -0
- package/renderers/mdx.renderer.d.ts.map +1 -0
- package/renderers/registry.d.ts +133 -0
- package/renderers/registry.d.ts.map +1 -0
- package/renderers/types.d.ts +342 -0
- package/renderers/types.d.ts.map +1 -0
- package/renderers/utils/detect.d.ts +107 -0
- package/renderers/utils/detect.d.ts.map +1 -0
- package/renderers/utils/hash.d.ts +40 -0
- package/renderers/utils/hash.d.ts.map +1 -0
- package/renderers/utils/index.d.ts +9 -0
- package/renderers/utils/index.d.ts.map +1 -0
- package/renderers/utils/transpiler.d.ts +89 -0
- package/renderers/utils/transpiler.d.ts.map +1 -0
- package/runtime/adapters/html.adapter.d.ts +59 -0
- package/runtime/adapters/html.adapter.d.ts.map +1 -0
- package/runtime/adapters/index.d.ts +26 -0
- package/runtime/adapters/index.d.ts.map +1 -0
- package/runtime/adapters/mdx.adapter.d.ts +73 -0
- package/runtime/adapters/mdx.adapter.d.ts.map +1 -0
- package/runtime/adapters/types.d.ts +95 -0
- package/runtime/adapters/types.d.ts.map +1 -0
- package/runtime/csp.d.ts +48 -0
- package/runtime/csp.d.ts.map +1 -0
- package/runtime/index.d.ts +17 -0
- package/runtime/index.d.ts.map +1 -0
- package/runtime/index.js +5052 -0
- package/runtime/mcp-bridge.d.ts +101 -0
- package/runtime/mcp-bridge.d.ts.map +1 -0
- package/runtime/renderer-runtime.d.ts +133 -0
- package/runtime/renderer-runtime.d.ts.map +1 -0
- package/runtime/sanitizer.d.ts +172 -0
- package/runtime/sanitizer.d.ts.map +1 -0
- package/runtime/types.d.ts +415 -0
- package/runtime/types.d.ts.map +1 -0
- package/runtime/wrapper.d.ts +421 -0
- package/runtime/wrapper.d.ts.map +1 -0
- package/styles/index.d.ts +8 -0
- package/styles/index.d.ts.map +1 -0
- package/styles/index.js +222 -0
- package/styles/variants.d.ts +51 -0
- package/styles/variants.d.ts.map +1 -0
- package/theme/cdn.d.ts +195 -0
- package/theme/cdn.d.ts.map +1 -0
- package/theme/index.d.ts +18 -0
- package/theme/index.d.ts.map +1 -0
- package/theme/index.js +757 -0
- package/theme/platforms.d.ts +107 -0
- package/theme/platforms.d.ts.map +1 -0
- package/theme/presets/github-openai.d.ts +50 -0
- package/theme/presets/github-openai.d.ts.map +1 -0
- package/theme/presets/index.d.ts +11 -0
- package/theme/presets/index.d.ts.map +1 -0
- package/theme/theme.d.ts +396 -0
- package/theme/theme.d.ts.map +1 -0
- package/tool-template/builder.d.ts +213 -0
- package/tool-template/builder.d.ts.map +1 -0
- package/tool-template/index.d.ts +16 -0
- package/tool-template/index.d.ts.map +1 -0
- package/tool-template/index.js +3562 -0
- package/types/index.d.ts +14 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +108 -0
- package/types/ui-config.d.ts +641 -0
- package/types/ui-config.d.ts.map +1 -0
- package/types/ui-runtime.d.ts +1008 -0
- package/types/ui-runtime.d.ts.map +1 -0
- package/typings/cache/cache-adapter.d.ts +125 -0
- package/typings/cache/cache-adapter.d.ts.map +1 -0
- package/typings/cache/index.d.ts +10 -0
- package/typings/cache/index.d.ts.map +1 -0
- package/typings/cache/memory-cache.d.ts +92 -0
- package/typings/cache/memory-cache.d.ts.map +1 -0
- package/typings/dts-parser.d.ts +90 -0
- package/typings/dts-parser.d.ts.map +1 -0
- package/typings/index.d.ts +48 -0
- package/typings/index.d.ts.map +1 -0
- package/typings/index.js +868 -0
- package/typings/schemas.d.ts +232 -0
- package/typings/schemas.d.ts.map +1 -0
- package/typings/type-fetcher.d.ts +89 -0
- package/typings/type-fetcher.d.ts.map +1 -0
- package/typings/types.d.ts +320 -0
- package/typings/types.d.ts.map +1 -0
- package/utils/escape-html.d.ts +58 -0
- package/utils/escape-html.d.ts.map +1 -0
- package/utils/index.d.ts +10 -0
- package/utils/index.d.ts.map +1 -0
- package/utils/index.js +70 -0
- package/utils/safe-stringify.d.ts +30 -0
- package/utils/safe-stringify.d.ts.map +1 -0
- package/validation/error-box.d.ts +56 -0
- package/validation/error-box.d.ts.map +1 -0
- package/validation/index.d.ts +13 -0
- package/validation/index.d.ts.map +1 -0
- package/validation/index.js +583 -0
- package/validation/schema-paths.d.ts +118 -0
- package/validation/schema-paths.d.ts.map +1 -0
- package/validation/template-validator.d.ts +143 -0
- package/validation/template-validator.d.ts.map +1 -0
- package/validation/wrapper.d.ts +97 -0
- package/validation/wrapper.d.ts.map +1 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates Handlebars templates against Zod schemas to catch
|
|
5
|
+
* references to non-existent fields.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/**
|
|
11
|
+
* Validation error types.
|
|
12
|
+
*/
|
|
13
|
+
export type ValidationErrorType = 'missing_field' | 'invalid_path' | 'type_mismatch';
|
|
14
|
+
/**
|
|
15
|
+
* Validation warning types.
|
|
16
|
+
*/
|
|
17
|
+
export type ValidationWarningType = 'optional_field' | 'array_access' | 'deep_path' | 'dynamic_path';
|
|
18
|
+
/**
|
|
19
|
+
* A validation error for a missing or invalid field.
|
|
20
|
+
*/
|
|
21
|
+
export interface TemplateValidationError {
|
|
22
|
+
/** Error type */
|
|
23
|
+
type: ValidationErrorType;
|
|
24
|
+
/** The invalid path (e.g., "output.city") */
|
|
25
|
+
path: string;
|
|
26
|
+
/** The full Handlebars expression */
|
|
27
|
+
expression: string;
|
|
28
|
+
/** Line number in template */
|
|
29
|
+
line: number;
|
|
30
|
+
/** Column position */
|
|
31
|
+
column: number;
|
|
32
|
+
/** Human-readable error message */
|
|
33
|
+
message: string;
|
|
34
|
+
/** Suggested similar paths */
|
|
35
|
+
suggestions: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A validation warning (non-blocking).
|
|
39
|
+
*/
|
|
40
|
+
export interface TemplateValidationWarning {
|
|
41
|
+
/** Warning type */
|
|
42
|
+
type: ValidationWarningType;
|
|
43
|
+
/** The path that triggered the warning */
|
|
44
|
+
path: string;
|
|
45
|
+
/** The full Handlebars expression */
|
|
46
|
+
expression: string;
|
|
47
|
+
/** Line number in template */
|
|
48
|
+
line: number;
|
|
49
|
+
/** Human-readable warning message */
|
|
50
|
+
message: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Result of template validation.
|
|
54
|
+
*/
|
|
55
|
+
export interface TemplateValidationResult {
|
|
56
|
+
/** Whether the template is valid (no errors) */
|
|
57
|
+
valid: boolean;
|
|
58
|
+
/** Validation errors (missing fields, etc.) */
|
|
59
|
+
errors: TemplateValidationError[];
|
|
60
|
+
/** Validation warnings (optional fields, etc.) */
|
|
61
|
+
warnings: TemplateValidationWarning[];
|
|
62
|
+
/** All paths found in the template */
|
|
63
|
+
templatePaths: string[];
|
|
64
|
+
/** All valid paths from the schema */
|
|
65
|
+
schemaPaths: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Options for template validation.
|
|
69
|
+
*/
|
|
70
|
+
export interface ValidateTemplateOptions {
|
|
71
|
+
/** Schema for input.* paths (optional) */
|
|
72
|
+
inputSchema?: z.ZodTypeAny;
|
|
73
|
+
/** Warn when accessing optional fields without {{#if}} guard */
|
|
74
|
+
warnOnOptional?: boolean;
|
|
75
|
+
/** Suggest similar paths for typos */
|
|
76
|
+
suggestSimilar?: boolean;
|
|
77
|
+
/** Maximum Levenshtein distance for suggestions */
|
|
78
|
+
maxSuggestionDistance?: number;
|
|
79
|
+
/** Tool name for error messages */
|
|
80
|
+
toolName?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Validate a Handlebars template against an output schema.
|
|
84
|
+
*
|
|
85
|
+
* @param template - The Handlebars template string
|
|
86
|
+
* @param outputSchema - Zod schema for the output
|
|
87
|
+
* @param options - Validation options
|
|
88
|
+
* @returns Validation result with errors and warnings
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const result = validateTemplate(
|
|
93
|
+
* '<div>{{output.temperature}} in {{output.city}}</div>',
|
|
94
|
+
* z.object({ temperature: z.number() })
|
|
95
|
+
* );
|
|
96
|
+
*
|
|
97
|
+
* if (!result.valid) {
|
|
98
|
+
* console.warn('Template has issues:', result.errors);
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare function validateTemplate(template: string, outputSchema: z.ZodTypeAny, options?: ValidateTemplateOptions): TemplateValidationResult;
|
|
103
|
+
/**
|
|
104
|
+
* Format validation result as console warnings.
|
|
105
|
+
*
|
|
106
|
+
* @param result - Validation result
|
|
107
|
+
* @param toolName - Tool name for context
|
|
108
|
+
* @returns Formatted warning string
|
|
109
|
+
*/
|
|
110
|
+
export declare function formatValidationWarnings(result: TemplateValidationResult, toolName: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* Log validation warnings to console in development mode.
|
|
113
|
+
*
|
|
114
|
+
* @param result - Validation result
|
|
115
|
+
* @param toolName - Tool name for context
|
|
116
|
+
*/
|
|
117
|
+
export declare function logValidationWarnings(result: TemplateValidationResult, toolName: string): void;
|
|
118
|
+
/**
|
|
119
|
+
* Validate template and throw if invalid.
|
|
120
|
+
*
|
|
121
|
+
* @param template - The template to validate
|
|
122
|
+
* @param outputSchema - Output schema
|
|
123
|
+
* @param toolName - Tool name for error message
|
|
124
|
+
* @throws Error if template has validation errors
|
|
125
|
+
*/
|
|
126
|
+
export declare function assertTemplateValid(template: string, outputSchema: z.ZodTypeAny, toolName: string): void;
|
|
127
|
+
/**
|
|
128
|
+
* Quickly check if a template is valid against a schema.
|
|
129
|
+
*
|
|
130
|
+
* @param template - The template to validate
|
|
131
|
+
* @param outputSchema - Output schema
|
|
132
|
+
* @returns true if valid, false otherwise
|
|
133
|
+
*/
|
|
134
|
+
export declare function isTemplateValid(template: string, outputSchema: z.ZodTypeAny): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Get missing fields from a template.
|
|
137
|
+
*
|
|
138
|
+
* @param template - The template to check
|
|
139
|
+
* @param outputSchema - Output schema
|
|
140
|
+
* @returns Array of missing field paths
|
|
141
|
+
*/
|
|
142
|
+
export declare function getMissingFields(template: string, outputSchema: z.ZodTypeAny): string[];
|
|
143
|
+
//# sourceMappingURL=template-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-validator.d.ts","sourceRoot":"","sources":["../../../src/validation/template-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,cAAc,GAAG,eAAe,CAAC;AAErF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG,cAAc,GAAG,WAAW,GAAG,cAAc,CAAC;AAErG;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iBAAiB;IACjB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,mBAAmB;IACnB,IAAI,EAAE,qBAAqB,CAAC;IAC5B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,gDAAgD;IAChD,KAAK,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAClC,kDAAkD;IAClD,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IACtC,sCAAsC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,sCAAsC;IACtC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,0CAA0C;IAC1C,WAAW,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;IAC3B,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sCAAsC;IACtC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mDAAmD;IACnD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,CAAC,CAAC,UAAU,EAC1B,OAAO,GAAE,uBAA4B,GACpC,wBAAwB,CAsG1B;AA4HD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CA0CnG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAK9F;AAMD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOxG;AAMD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,UAAU,GAAG,OAAO,CAGrF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,UAAU,GAAG,MAAM,EAAE,CAGvF"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file wrapper.ts
|
|
3
|
+
* @description Validation wrapper utilities for component input validation.
|
|
4
|
+
*
|
|
5
|
+
* Provides functions to validate component options against Zod schemas
|
|
6
|
+
* and return either the validated data or an error box HTML string.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { validateOptions } from '@frontmcp/ui';
|
|
11
|
+
* import { z } from 'zod';
|
|
12
|
+
*
|
|
13
|
+
* const schema = z.object({ variant: z.enum(['primary', 'secondary']) });
|
|
14
|
+
*
|
|
15
|
+
* const result = validateOptions(options, {
|
|
16
|
+
* componentName: 'Button',
|
|
17
|
+
* schema,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* if (!result.success) return result.error; // Returns error box HTML
|
|
21
|
+
*
|
|
22
|
+
* // Use result.data safely
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @module @frontmcp/ui/validation/wrapper
|
|
26
|
+
*/
|
|
27
|
+
import { type ZodSchema } from 'zod';
|
|
28
|
+
/**
|
|
29
|
+
* Configuration for validation
|
|
30
|
+
*/
|
|
31
|
+
export interface ValidationConfig {
|
|
32
|
+
/** Name of the component being validated */
|
|
33
|
+
componentName: string;
|
|
34
|
+
/** Zod schema to validate against */
|
|
35
|
+
schema: ZodSchema;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Result of validation - either success with data or failure with error HTML
|
|
39
|
+
*/
|
|
40
|
+
export type ValidationResult<T> = {
|
|
41
|
+
success: true;
|
|
42
|
+
data: T;
|
|
43
|
+
} | {
|
|
44
|
+
success: false;
|
|
45
|
+
error: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Validates input against a Zod schema
|
|
49
|
+
*
|
|
50
|
+
* Returns either:
|
|
51
|
+
* - `{ success: true, data: T }` with validated/parsed data
|
|
52
|
+
* - `{ success: false, error: string }` with error box HTML
|
|
53
|
+
*
|
|
54
|
+
* @param options - The options object to validate
|
|
55
|
+
* @param config - Validation configuration (component name and schema)
|
|
56
|
+
* @returns ValidationResult with either data or error HTML
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const result = validateOptions({ variant: 'invalid' }, {
|
|
61
|
+
* componentName: 'Button',
|
|
62
|
+
* schema: ButtonOptionsSchema,
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* if (!result.success) {
|
|
66
|
+
* return result.error; // Error box HTML
|
|
67
|
+
* }
|
|
68
|
+
*
|
|
69
|
+
* // result.data is typed and validated
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function validateOptions<T>(options: unknown, config: ValidationConfig): ValidationResult<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Higher-order function to wrap a component function with validation
|
|
75
|
+
*
|
|
76
|
+
* Creates a new function that validates the options before calling the
|
|
77
|
+
* original component. If validation fails, returns the error box HTML
|
|
78
|
+
* instead of calling the component.
|
|
79
|
+
*
|
|
80
|
+
* @param componentFn - The original component function
|
|
81
|
+
* @param config - Validation configuration
|
|
82
|
+
* @returns Wrapped function that validates before calling
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const buttonImpl = (text: string, opts: ButtonOptions) => `<button>...</button>`;
|
|
87
|
+
*
|
|
88
|
+
* const button = withValidation(buttonImpl, {
|
|
89
|
+
* componentName: 'Button',
|
|
90
|
+
* schema: ButtonOptionsSchema,
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* // button() now validates options before rendering
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function withValidation<TInput, TOptions>(componentFn: (input: TInput, options: TOptions) => string, config: ValidationConfig): (input: TInput, options: unknown) => string;
|
|
97
|
+
//# sourceMappingURL=wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../src/validation/wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AAOrC;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,MAAM,EAAE,SAAS,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAiBjG;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAiBlG;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,EAC7C,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,KAAK,MAAM,EACzD,MAAM,EAAE,gBAAgB,GACvB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,CAU7C"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handlebars Expression Extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts variable paths from Handlebars templates for validation
|
|
5
|
+
* against schemas.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Type of Handlebars expression.
|
|
11
|
+
*/
|
|
12
|
+
export type ExpressionType = 'variable' | 'helper' | 'block' | 'block-close';
|
|
13
|
+
/**
|
|
14
|
+
* Extracted expression with metadata.
|
|
15
|
+
*/
|
|
16
|
+
export interface ExtractedExpression {
|
|
17
|
+
/** The variable path (e.g., "output.temperature") */
|
|
18
|
+
path: string;
|
|
19
|
+
/** The full expression (e.g., "{{output.temperature}}") */
|
|
20
|
+
fullExpression: string;
|
|
21
|
+
/** Line number in template (1-indexed) */
|
|
22
|
+
line: number;
|
|
23
|
+
/** Column position (1-indexed) */
|
|
24
|
+
column: number;
|
|
25
|
+
/** Type of expression */
|
|
26
|
+
type: ExpressionType;
|
|
27
|
+
/** For helpers, the helper name */
|
|
28
|
+
helperName?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Result of expression extraction.
|
|
32
|
+
*/
|
|
33
|
+
export interface ExtractionResult {
|
|
34
|
+
/** All extracted expressions */
|
|
35
|
+
expressions: ExtractedExpression[];
|
|
36
|
+
/** Unique variable paths */
|
|
37
|
+
paths: string[];
|
|
38
|
+
/** Paths starting with "output." */
|
|
39
|
+
outputPaths: string[];
|
|
40
|
+
/** Paths starting with "input." */
|
|
41
|
+
inputPaths: string[];
|
|
42
|
+
/** Paths starting with "structuredContent." */
|
|
43
|
+
structuredContentPaths: string[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Extract all Handlebars expressions from a template.
|
|
47
|
+
*
|
|
48
|
+
* @param template - Handlebars template string
|
|
49
|
+
* @returns Array of extracted expressions with metadata
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const expressions = extractExpressions('<div>{{output.name}}</div>');
|
|
54
|
+
* // [{ path: 'output.name', fullExpression: '{{output.name}}', ... }]
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function extractExpressions(template: string): ExtractedExpression[];
|
|
58
|
+
/**
|
|
59
|
+
* Extract all variable paths from a template.
|
|
60
|
+
*
|
|
61
|
+
* @param template - Handlebars template string
|
|
62
|
+
* @returns Array of unique variable paths
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const paths = extractVariablePaths('<div>{{output.a}} {{input.b}}</div>');
|
|
67
|
+
* // ['output.a', 'input.b']
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function extractVariablePaths(template: string): string[];
|
|
71
|
+
/**
|
|
72
|
+
* Extract only output.* paths from a template.
|
|
73
|
+
*
|
|
74
|
+
* @param template - Handlebars template string
|
|
75
|
+
* @returns Array of unique output paths
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const paths = extractOutputPaths('<div>{{output.temp}} {{input.city}}</div>');
|
|
80
|
+
* // ['output.temp']
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function extractOutputPaths(template: string): string[];
|
|
84
|
+
/**
|
|
85
|
+
* Extract only input.* paths from a template.
|
|
86
|
+
*
|
|
87
|
+
* @param template - Handlebars template string
|
|
88
|
+
* @returns Array of unique input paths
|
|
89
|
+
*/
|
|
90
|
+
export declare function extractInputPaths(template: string): string[];
|
|
91
|
+
/**
|
|
92
|
+
* Extract only structuredContent.* paths from a template.
|
|
93
|
+
*
|
|
94
|
+
* @param template - Handlebars template string
|
|
95
|
+
* @returns Array of unique structuredContent paths
|
|
96
|
+
*/
|
|
97
|
+
export declare function extractStructuredContentPaths(template: string): string[];
|
|
98
|
+
/**
|
|
99
|
+
* Comprehensive extraction returning all path categories.
|
|
100
|
+
*
|
|
101
|
+
* @param template - Handlebars template string
|
|
102
|
+
* @returns Extraction result with categorized paths
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const result = extractAll('<div>{{output.a}} {{input.b}}</div>');
|
|
107
|
+
* // {
|
|
108
|
+
* // expressions: [...],
|
|
109
|
+
* // paths: ['output.a', 'input.b'],
|
|
110
|
+
* // outputPaths: ['output.a'],
|
|
111
|
+
* // inputPaths: ['input.b'],
|
|
112
|
+
* // structuredContentPaths: []
|
|
113
|
+
* // }
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function extractAll(template: string): ExtractionResult;
|
|
117
|
+
/**
|
|
118
|
+
* Check if a template contains any Handlebars expressions with variable paths.
|
|
119
|
+
*
|
|
120
|
+
* @param template - Handlebars template string
|
|
121
|
+
* @returns true if template contains variable paths
|
|
122
|
+
*/
|
|
123
|
+
export declare function hasVariablePaths(template: string): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Get expression details at a specific line and column.
|
|
126
|
+
*
|
|
127
|
+
* @param template - Handlebars template string
|
|
128
|
+
* @param line - Line number (1-indexed)
|
|
129
|
+
* @param column - Column number (1-indexed)
|
|
130
|
+
* @returns Expression at position or undefined
|
|
131
|
+
*/
|
|
132
|
+
export declare function getExpressionAt(template: string, line: number, column: number): ExtractedExpression | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Normalize a path for comparison.
|
|
135
|
+
* Converts array index access to wildcard format.
|
|
136
|
+
*
|
|
137
|
+
* @param path - Variable path
|
|
138
|
+
* @returns Normalized path
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* normalizePath('output.items.0.name'); // 'output.items.[].name'
|
|
143
|
+
* normalizePath('output.data[0].value'); // 'output.data.[].value'
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export declare function normalizePath(path: string): string;
|
|
147
|
+
//# sourceMappingURL=expression-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression-extractor.d.ts","sourceRoot":"","sources":["../../src/handlebars/expression-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,aAAa,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,cAAc,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,4BAA4B;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,oCAAoC;IACpC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mCAAmC;IACnC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,+CAA+C;IAC/C,sBAAsB,EAAE,MAAM,EAAE,CAAC;CAClC;AAwCD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAmE1E;AAgDD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAI/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAExE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAW7D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAS/G;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQlD"}
|