@memberjunction/react-linter 0.0.1 → 5.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component-linter.d.ts +77 -0
- package/dist/component-linter.d.ts.map +1 -0
- package/dist/component-linter.js +1206 -0
- package/dist/component-linter.js.map +1 -0
- package/dist/control-flow-analyzer.d.ts +184 -0
- package/dist/control-flow-analyzer.d.ts.map +1 -0
- package/dist/control-flow-analyzer.js +798 -0
- package/dist/control-flow-analyzer.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/library-lint-cache.d.ts +50 -0
- package/dist/library-lint-cache.d.ts.map +1 -0
- package/dist/library-lint-cache.js +173 -0
- package/dist/library-lint-cache.js.map +1 -0
- package/dist/lint-rule.d.ts +70 -0
- package/dist/lint-rule.d.ts.map +1 -0
- package/dist/lint-rule.js +30 -0
- package/dist/lint-rule.js.map +1 -0
- package/dist/lint-utils.d.ts +131 -0
- package/dist/lint-utils.d.ts.map +1 -0
- package/dist/lint-utils.js +358 -0
- package/dist/lint-utils.js.map +1 -0
- package/dist/linter-options.d.ts +51 -0
- package/dist/linter-options.d.ts.map +1 -0
- package/dist/linter-options.js +2 -0
- package/dist/linter-options.js.map +1 -0
- package/dist/prop-value-extractor.d.ts +147 -0
- package/dist/prop-value-extractor.d.ts.map +1 -0
- package/dist/prop-value-extractor.js +472 -0
- package/dist/prop-value-extractor.js.map +1 -0
- package/dist/runtime-rules/ai-tools-availability-check.d.ts +9 -0
- package/dist/runtime-rules/ai-tools-availability-check.d.ts.map +1 -0
- package/dist/runtime-rules/ai-tools-availability-check.js +223 -0
- package/dist/runtime-rules/ai-tools-availability-check.js.map +1 -0
- package/dist/runtime-rules/callback-event-validation.d.ts +22 -0
- package/dist/runtime-rules/callback-event-validation.d.ts.map +1 -0
- package/dist/runtime-rules/callback-event-validation.js +561 -0
- package/dist/runtime-rules/callback-event-validation.js.map +1 -0
- package/dist/runtime-rules/chart-field-validation.d.ts +10 -0
- package/dist/runtime-rules/chart-field-validation.d.ts.map +1 -0
- package/dist/runtime-rules/chart-field-validation.js +270 -0
- package/dist/runtime-rules/chart-field-validation.js.map +1 -0
- package/dist/runtime-rules/child-component-prop-validation.d.ts +11 -0
- package/dist/runtime-rules/child-component-prop-validation.d.ts.map +1 -0
- package/dist/runtime-rules/child-component-prop-validation.js +443 -0
- package/dist/runtime-rules/child-component-prop-validation.js.map +1 -0
- package/dist/runtime-rules/component-name-mismatch.d.ts +19 -0
- package/dist/runtime-rules/component-name-mismatch.d.ts.map +1 -0
- package/dist/runtime-rules/component-name-mismatch.js +82 -0
- package/dist/runtime-rules/component-name-mismatch.js.map +1 -0
- package/dist/runtime-rules/component-not-in-dependencies.d.ts +20 -0
- package/dist/runtime-rules/component-not-in-dependencies.d.ts.map +1 -0
- package/dist/runtime-rules/component-not-in-dependencies.js +92 -0
- package/dist/runtime-rules/component-not-in-dependencies.js.map +1 -0
- package/dist/runtime-rules/component-props-validation.d.ts +25 -0
- package/dist/runtime-rules/component-props-validation.d.ts.map +1 -0
- package/dist/runtime-rules/component-props-validation.js +228 -0
- package/dist/runtime-rules/component-props-validation.js.map +1 -0
- package/dist/runtime-rules/component-usage-without-destructuring.d.ts +20 -0
- package/dist/runtime-rules/component-usage-without-destructuring.d.ts.map +1 -0
- package/dist/runtime-rules/component-usage-without-destructuring.js +124 -0
- package/dist/runtime-rules/component-usage-without-destructuring.js.map +1 -0
- package/dist/runtime-rules/data-result-validation.d.ts +9 -0
- package/dist/runtime-rules/data-result-validation.d.ts.map +1 -0
- package/dist/runtime-rules/data-result-validation.js +763 -0
- package/dist/runtime-rules/data-result-validation.js.map +1 -0
- package/dist/runtime-rules/datagrid-field-validation.d.ts +10 -0
- package/dist/runtime-rules/datagrid-field-validation.d.ts.map +1 -0
- package/dist/runtime-rules/datagrid-field-validation.js +249 -0
- package/dist/runtime-rules/datagrid-field-validation.js.map +1 -0
- package/dist/runtime-rules/dependency-shadowing.d.ts +20 -0
- package/dist/runtime-rules/dependency-shadowing.d.ts.map +1 -0
- package/dist/runtime-rules/dependency-shadowing.js +147 -0
- package/dist/runtime-rules/dependency-shadowing.js.map +1 -0
- package/dist/runtime-rules/entity-field-access-validation.d.ts +12 -0
- package/dist/runtime-rules/entity-field-access-validation.d.ts.map +1 -0
- package/dist/runtime-rules/entity-field-access-validation.js +304 -0
- package/dist/runtime-rules/entity-field-access-validation.js.map +1 -0
- package/dist/runtime-rules/event-parameter-validation.d.ts +22 -0
- package/dist/runtime-rules/event-parameter-validation.d.ts.map +1 -0
- package/dist/runtime-rules/event-parameter-validation.js +406 -0
- package/dist/runtime-rules/event-parameter-validation.js.map +1 -0
- package/dist/runtime-rules/index.d.ts +61 -0
- package/dist/runtime-rules/index.d.ts.map +1 -0
- package/dist/runtime-rules/index.js +62 -0
- package/dist/runtime-rules/index.js.map +1 -0
- package/dist/runtime-rules/library-variable-names.d.ts +24 -0
- package/dist/runtime-rules/library-variable-names.d.ts.map +1 -0
- package/dist/runtime-rules/library-variable-names.js +88 -0
- package/dist/runtime-rules/library-variable-names.js.map +1 -0
- package/dist/runtime-rules/no-child-implementation.d.ts +18 -0
- package/dist/runtime-rules/no-child-implementation.d.ts.map +1 -0
- package/dist/runtime-rules/no-child-implementation.js +57 -0
- package/dist/runtime-rules/no-child-implementation.js.map +1 -0
- package/dist/runtime-rules/no-data-prop.d.ts +22 -0
- package/dist/runtime-rules/no-data-prop.d.ts.map +1 -0
- package/dist/runtime-rules/no-data-prop.js +111 -0
- package/dist/runtime-rules/no-data-prop.js.map +1 -0
- package/dist/runtime-rules/no-export-statements.d.ts +18 -0
- package/dist/runtime-rules/no-export-statements.d.ts.map +1 -0
- package/dist/runtime-rules/no-export-statements.js +143 -0
- package/dist/runtime-rules/no-export-statements.js.map +1 -0
- package/dist/runtime-rules/no-iife-wrapper.d.ts +18 -0
- package/dist/runtime-rules/no-iife-wrapper.d.ts.map +1 -0
- package/dist/runtime-rules/no-iife-wrapper.js +217 -0
- package/dist/runtime-rules/no-iife-wrapper.js.map +1 -0
- package/dist/runtime-rules/no-import-statements.d.ts +18 -0
- package/dist/runtime-rules/no-import-statements.d.ts.map +1 -0
- package/dist/runtime-rules/no-import-statements.js +65 -0
- package/dist/runtime-rules/no-import-statements.js.map +1 -0
- package/dist/runtime-rules/no-react-destructuring.d.ts +18 -0
- package/dist/runtime-rules/no-react-destructuring.d.ts.map +1 -0
- package/dist/runtime-rules/no-react-destructuring.js +60 -0
- package/dist/runtime-rules/no-react-destructuring.js.map +1 -0
- package/dist/runtime-rules/no-require-statements.d.ts +18 -0
- package/dist/runtime-rules/no-require-statements.d.ts.map +1 -0
- package/dist/runtime-rules/no-require-statements.js +109 -0
- package/dist/runtime-rules/no-require-statements.js.map +1 -0
- package/dist/runtime-rules/no-return-component.d.ts +18 -0
- package/dist/runtime-rules/no-return-component.d.ts.map +1 -0
- package/dist/runtime-rules/no-return-component.js +106 -0
- package/dist/runtime-rules/no-return-component.js.map +1 -0
- package/dist/runtime-rules/no-unwrap-utility-libs.d.ts +20 -0
- package/dist/runtime-rules/no-unwrap-utility-libs.d.ts.map +1 -0
- package/dist/runtime-rules/no-unwrap-utility-libs.js +75 -0
- package/dist/runtime-rules/no-unwrap-utility-libs.js.map +1 -0
- package/dist/runtime-rules/no-use-reducer.d.ts +19 -0
- package/dist/runtime-rules/no-use-reducer.d.ts.map +1 -0
- package/dist/runtime-rules/no-use-reducer.js +78 -0
- package/dist/runtime-rules/no-use-reducer.js.map +1 -0
- package/dist/runtime-rules/no-window-access.d.ts +23 -0
- package/dist/runtime-rules/no-window-access.d.ts.map +1 -0
- package/dist/runtime-rules/no-window-access.js +136 -0
- package/dist/runtime-rules/no-window-access.js.map +1 -0
- package/dist/runtime-rules/noisy-settings-updates.d.ts +18 -0
- package/dist/runtime-rules/noisy-settings-updates.d.ts.map +1 -0
- package/dist/runtime-rules/noisy-settings-updates.js +110 -0
- package/dist/runtime-rules/noisy-settings-updates.js.map +1 -0
- package/dist/runtime-rules/overflow-hidden-on-layout-container.d.ts +30 -0
- package/dist/runtime-rules/overflow-hidden-on-layout-container.d.ts.map +1 -0
- package/dist/runtime-rules/overflow-hidden-on-layout-container.js +220 -0
- package/dist/runtime-rules/overflow-hidden-on-layout-container.js.map +1 -0
- package/dist/runtime-rules/pass-standard-props.d.ts +19 -0
- package/dist/runtime-rules/pass-standard-props.d.ts.map +1 -0
- package/dist/runtime-rules/pass-standard-props.js +82 -0
- package/dist/runtime-rules/pass-standard-props.js.map +1 -0
- package/dist/runtime-rules/prefer-async-await.d.ts +17 -0
- package/dist/runtime-rules/prefer-async-await.d.ts.map +1 -0
- package/dist/runtime-rules/prefer-async-await.js +52 -0
- package/dist/runtime-rules/prefer-async-await.js.map +1 -0
- package/dist/runtime-rules/prefer-jsx-syntax.d.ts +17 -0
- package/dist/runtime-rules/prefer-jsx-syntax.d.ts.map +1 -0
- package/dist/runtime-rules/prefer-jsx-syntax.js +51 -0
- package/dist/runtime-rules/prefer-jsx-syntax.js.map +1 -0
- package/dist/runtime-rules/prop-state-sync.d.ts +19 -0
- package/dist/runtime-rules/prop-state-sync.d.ts.map +1 -0
- package/dist/runtime-rules/prop-state-sync.js +76 -0
- package/dist/runtime-rules/prop-state-sync.js.map +1 -0
- package/dist/runtime-rules/property-name-consistency.d.ts +20 -0
- package/dist/runtime-rules/property-name-consistency.d.ts.map +1 -0
- package/dist/runtime-rules/property-name-consistency.js +172 -0
- package/dist/runtime-rules/property-name-consistency.js.map +1 -0
- package/dist/runtime-rules/query-result-field-access-validation.d.ts +10 -0
- package/dist/runtime-rules/query-result-field-access-validation.d.ts.map +1 -0
- package/dist/runtime-rules/query-result-field-access-validation.js +304 -0
- package/dist/runtime-rules/query-result-field-access-validation.js.map +1 -0
- package/dist/runtime-rules/react-component-naming.d.ts +19 -0
- package/dist/runtime-rules/react-component-naming.d.ts.map +1 -0
- package/dist/runtime-rules/react-component-naming.js +72 -0
- package/dist/runtime-rules/react-component-naming.js.map +1 -0
- package/dist/runtime-rules/react-hooks-rules.d.ts +27 -0
- package/dist/runtime-rules/react-hooks-rules.d.ts.map +1 -0
- package/dist/runtime-rules/react-hooks-rules.js +223 -0
- package/dist/runtime-rules/react-hooks-rules.js.map +1 -0
- package/dist/runtime-rules/required-queries-not-called.d.ts +19 -0
- package/dist/runtime-rules/required-queries-not-called.d.ts.map +1 -0
- package/dist/runtime-rules/required-queries-not-called.js +146 -0
- package/dist/runtime-rules/required-queries-not-called.js.map +1 -0
- package/dist/runtime-rules/runquery-call-validation.d.ts +11 -0
- package/dist/runtime-rules/runquery-call-validation.d.ts.map +1 -0
- package/dist/runtime-rules/runquery-call-validation.js +886 -0
- package/dist/runtime-rules/runquery-call-validation.js.map +1 -0
- package/dist/runtime-rules/runview-call-validation.d.ts +10 -0
- package/dist/runtime-rules/runview-call-validation.d.ts.map +1 -0
- package/dist/runtime-rules/runview-call-validation.js +336 -0
- package/dist/runtime-rules/runview-call-validation.js.map +1 -0
- package/dist/runtime-rules/saved-user-settings-pattern.d.ts +19 -0
- package/dist/runtime-rules/saved-user-settings-pattern.d.ts.map +1 -0
- package/dist/runtime-rules/saved-user-settings-pattern.js +90 -0
- package/dist/runtime-rules/saved-user-settings-pattern.js.map +1 -0
- package/dist/runtime-rules/search-availability-check.d.ts +9 -0
- package/dist/runtime-rules/search-availability-check.d.ts.map +1 -0
- package/dist/runtime-rules/search-availability-check.js +220 -0
- package/dist/runtime-rules/search-availability-check.js.map +1 -0
- package/dist/runtime-rules/search-call-validation.d.ts +9 -0
- package/dist/runtime-rules/search-call-validation.d.ts.map +1 -0
- package/dist/runtime-rules/search-call-validation.js +336 -0
- package/dist/runtime-rules/search-call-validation.js.map +1 -0
- package/dist/runtime-rules/server-reload-on-client-operation.d.ts +18 -0
- package/dist/runtime-rules/server-reload-on-client-operation.d.ts.map +1 -0
- package/dist/runtime-rules/server-reload-on-client-operation.js +107 -0
- package/dist/runtime-rules/server-reload-on-client-operation.js.map +1 -0
- package/dist/runtime-rules/single-function-only.d.ts +18 -0
- package/dist/runtime-rules/single-function-only.d.ts.map +1 -0
- package/dist/runtime-rules/single-function-only.js +103 -0
- package/dist/runtime-rules/single-function-only.js.map +1 -0
- package/dist/runtime-rules/string-replace-all-occurrences.d.ts +19 -0
- package/dist/runtime-rules/string-replace-all-occurrences.d.ts.map +1 -0
- package/dist/runtime-rules/string-replace-all-occurrences.js +109 -0
- package/dist/runtime-rules/string-replace-all-occurrences.js.map +1 -0
- package/dist/runtime-rules/string-template-validation.d.ts +22 -0
- package/dist/runtime-rules/string-template-validation.d.ts.map +1 -0
- package/dist/runtime-rules/string-template-validation.js +163 -0
- package/dist/runtime-rules/string-template-validation.js.map +1 -0
- package/dist/runtime-rules/styles-validation.d.ts +10 -0
- package/dist/runtime-rules/styles-validation.d.ts.map +1 -0
- package/dist/runtime-rules/styles-validation.js +153 -0
- package/dist/runtime-rules/styles-validation.js.map +1 -0
- package/dist/runtime-rules/type-inference-errors.d.ts +23 -0
- package/dist/runtime-rules/type-inference-errors.d.ts.map +1 -0
- package/dist/runtime-rules/type-inference-errors.js +53 -0
- package/dist/runtime-rules/type-inference-errors.js.map +1 -0
- package/dist/runtime-rules/type-mismatch-operation.d.ts +23 -0
- package/dist/runtime-rules/type-mismatch-operation.d.ts.map +1 -0
- package/dist/runtime-rules/type-mismatch-operation.js +145 -0
- package/dist/runtime-rules/type-mismatch-operation.js.map +1 -0
- package/dist/runtime-rules/undefined-component-usage.d.ts +20 -0
- package/dist/runtime-rules/undefined-component-usage.d.ts.map +1 -0
- package/dist/runtime-rules/undefined-component-usage.js +138 -0
- package/dist/runtime-rules/undefined-component-usage.js.map +1 -0
- package/dist/runtime-rules/undefined-jsx-component.d.ts +25 -0
- package/dist/runtime-rules/undefined-jsx-component.d.ts.map +1 -0
- package/dist/runtime-rules/undefined-jsx-component.js +269 -0
- package/dist/runtime-rules/undefined-jsx-component.js.map +1 -0
- package/dist/runtime-rules/unsafe-array-operations.d.ts +25 -0
- package/dist/runtime-rules/unsafe-array-operations.d.ts.map +1 -0
- package/dist/runtime-rules/unsafe-array-operations.js +347 -0
- package/dist/runtime-rules/unsafe-array-operations.js.map +1 -0
- package/dist/runtime-rules/unsafe-formatting-methods.d.ts +24 -0
- package/dist/runtime-rules/unsafe-formatting-methods.d.ts.map +1 -0
- package/dist/runtime-rules/unsafe-formatting-methods.js +277 -0
- package/dist/runtime-rules/unsafe-formatting-methods.js.map +1 -0
- package/dist/runtime-rules/unused-component-dependencies.d.ts +19 -0
- package/dist/runtime-rules/unused-component-dependencies.d.ts.map +1 -0
- package/dist/runtime-rules/unused-component-dependencies.js +90 -0
- package/dist/runtime-rules/unused-component-dependencies.js.map +1 -0
- package/dist/runtime-rules/unused-libraries.d.ts +19 -0
- package/dist/runtime-rules/unused-libraries.d.ts.map +1 -0
- package/dist/runtime-rules/unused-libraries.js +127 -0
- package/dist/runtime-rules/unused-libraries.js.map +1 -0
- package/dist/runtime-rules/use-function-declaration.d.ts +18 -0
- package/dist/runtime-rules/use-function-declaration.d.ts.map +1 -0
- package/dist/runtime-rules/use-function-declaration.js +127 -0
- package/dist/runtime-rules/use-function-declaration.js.map +1 -0
- package/dist/runtime-rules/use-unwrap-components.d.ts +19 -0
- package/dist/runtime-rules/use-unwrap-components.d.ts.map +1 -0
- package/dist/runtime-rules/use-unwrap-components.js +84 -0
- package/dist/runtime-rules/use-unwrap-components.js.map +1 -0
- package/dist/runtime-rules/useeffect-unstable-dependencies.d.ts +23 -0
- package/dist/runtime-rules/useeffect-unstable-dependencies.d.ts.map +1 -0
- package/dist/runtime-rules/useeffect-unstable-dependencies.js +215 -0
- package/dist/runtime-rules/useeffect-unstable-dependencies.js.map +1 -0
- package/dist/runtime-rules/utilities-api-validation.d.ts +24 -0
- package/dist/runtime-rules/utilities-api-validation.d.ts.map +1 -0
- package/dist/runtime-rules/utilities-api-validation.js +121 -0
- package/dist/runtime-rules/utilities-api-validation.js.map +1 -0
- package/dist/runtime-rules/utilities-no-direct-instantiation.d.ts +20 -0
- package/dist/runtime-rules/utilities-no-direct-instantiation.d.ts.map +1 -0
- package/dist/runtime-rules/utilities-no-direct-instantiation.js +58 -0
- package/dist/runtime-rules/utilities-no-direct-instantiation.js.map +1 -0
- package/dist/runtime-rules/validate-component-references.d.ts +19 -0
- package/dist/runtime-rules/validate-component-references.d.ts.map +1 -0
- package/dist/runtime-rules/validate-component-references.js +255 -0
- package/dist/runtime-rules/validate-component-references.js.map +1 -0
- package/dist/schema-validation/component-prop-rule.d.ts +131 -0
- package/dist/schema-validation/component-prop-rule.d.ts.map +1 -0
- package/dist/schema-validation/component-prop-rule.js +625 -0
- package/dist/schema-validation/component-prop-rule.js.map +1 -0
- package/dist/schema-validation/index.d.ts +26 -0
- package/dist/schema-validation/index.d.ts.map +1 -0
- package/dist/schema-validation/index.js +26 -0
- package/dist/schema-validation/index.js.map +1 -0
- package/dist/schema-validation/semantic-validators/index.d.ts +23 -0
- package/dist/schema-validation/semantic-validators/index.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/index.js +23 -0
- package/dist/schema-validation/semantic-validators/index.js.map +1 -0
- package/dist/schema-validation/semantic-validators/required-when-validator.d.ts +43 -0
- package/dist/schema-validation/semantic-validators/required-when-validator.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/required-when-validator.js +94 -0
- package/dist/schema-validation/semantic-validators/required-when-validator.js.map +1 -0
- package/dist/schema-validation/semantic-validators/semantic-validator-registry.d.ts +122 -0
- package/dist/schema-validation/semantic-validators/semantic-validator-registry.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/semantic-validator-registry.js +166 -0
- package/dist/schema-validation/semantic-validators/semantic-validator-registry.js.map +1 -0
- package/dist/schema-validation/semantic-validators/semantic-validator.d.ts +260 -0
- package/dist/schema-validation/semantic-validators/semantic-validator.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/semantic-validator.js +301 -0
- package/dist/schema-validation/semantic-validators/semantic-validator.js.map +1 -0
- package/dist/schema-validation/semantic-validators/sql-where-clause-validator.d.ts +115 -0
- package/dist/schema-validation/semantic-validators/sql-where-clause-validator.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/sql-where-clause-validator.js +381 -0
- package/dist/schema-validation/semantic-validators/sql-where-clause-validator.js.map +1 -0
- package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.d.ts +60 -0
- package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.js +195 -0
- package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.js.map +1 -0
- package/dist/schema-validation/semantic-validators/validation-context.d.ts +335 -0
- package/dist/schema-validation/semantic-validators/validation-context.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/validation-context.js +13 -0
- package/dist/schema-validation/semantic-validators/validation-context.js.map +1 -0
- package/dist/styles-type-analyzer.d.ts +64 -0
- package/dist/styles-type-analyzer.d.ts.map +1 -0
- package/dist/styles-type-analyzer.js +242 -0
- package/dist/styles-type-analyzer.js.map +1 -0
- package/dist/type-context.d.ts +184 -0
- package/dist/type-context.d.ts.map +1 -0
- package/dist/type-context.js +415 -0
- package/dist/type-context.js.map +1 -0
- package/dist/type-inference-engine.d.ts +181 -0
- package/dist/type-inference-engine.d.ts.map +1 -0
- package/dist/type-inference-engine.js +1151 -0
- package/dist/type-inference-engine.js.map +1 -0
- package/dist/type-rules/type-compatibility-rule.d.ts +85 -0
- package/dist/type-rules/type-compatibility-rule.d.ts.map +1 -0
- package/dist/type-rules/type-compatibility-rule.js +211 -0
- package/dist/type-rules/type-compatibility-rule.js.map +1 -0
- package/package.json +35 -7
- package/README.md +0 -45
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subset-of-entity-fields-validator.js","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/subset-of-entity-fields-validator.ts"],"names":[],"mappings":"A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eAAe,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;gBAC9E,sCAAsC;gBACtC,UAAU,CAAC,IAAI,CACb,IAAI,CAAC,eAAe,CAClB,eAAe,EACf,IAAI,CAAC,kBAAkB,CACrB,UAAU,EACV,OAAO,EACP,UAAU,SAAS,0CAA0C,eAAe,gBAAgB,UAAU,GAAG,EACzG;oBACE,KAAK,EAAE,SAAS;oBAChB,WAAW,EAAE,eAAe;oBAC5B,UAAU;iBACX,CACF,EACD,QAAQ,EACR,QAAQ,eAAe,iBAAiB,SAAS,GAAG,EACpD;oBACE,KAAK,EAAE,SAAS;oBAChB,WAAW,EAAE,eAAe;oBAC5B,UAAU;oBACV,KAAK,EAAE,CAAC;iBACT,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,8EAA8E,CAAC;IACxF,CAAC;CACF,CAAA;AAzNY,6BAA6B;IADzC,aAAa,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;GAC/C,6BAA6B,CAyNzC"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Context
|
|
3
|
+
*
|
|
4
|
+
* Provides all the information a semantic validator needs to perform validation.
|
|
5
|
+
* This context is passed to validators by the linter rule and includes:
|
|
6
|
+
* - AST node and path information for location tracking
|
|
7
|
+
* - Component spec for type lookups
|
|
8
|
+
* - Sibling props for dependency resolution
|
|
9
|
+
* - Entity/query metadata from data requirements
|
|
10
|
+
* - Helper methods for common validation tasks
|
|
11
|
+
*/
|
|
12
|
+
import * as t from '@babel/types';
|
|
13
|
+
import { NodePath } from '@babel/traverse';
|
|
14
|
+
import { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
15
|
+
import type { SQLParserDialect } from '@memberjunction/sql-dialect';
|
|
16
|
+
import { TypeInferenceEngine } from '../../type-inference-engine.js';
|
|
17
|
+
import { ExtractedValue } from '../../prop-value-extractor.js';
|
|
18
|
+
/**
|
|
19
|
+
* Context object passed to semantic validators
|
|
20
|
+
*
|
|
21
|
+
* Contains all information needed to validate a prop value against semantic constraints.
|
|
22
|
+
*/
|
|
23
|
+
export interface ValidationContext {
|
|
24
|
+
/**
|
|
25
|
+
* The AST node being validated
|
|
26
|
+
*
|
|
27
|
+
* This is typically the JSXAttribute node, but validators can traverse
|
|
28
|
+
* to child nodes for more specific location information.
|
|
29
|
+
*/
|
|
30
|
+
node: t.Node;
|
|
31
|
+
/**
|
|
32
|
+
* Babel traversal path for the node
|
|
33
|
+
*
|
|
34
|
+
* Provides access to parent nodes, scope information, and AST manipulation.
|
|
35
|
+
* Validators should not modify the AST - this is read-only validation.
|
|
36
|
+
*/
|
|
37
|
+
path: NodePath<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Name of the component being validated
|
|
40
|
+
*
|
|
41
|
+
* Example: "DataGrid", "EntityDataGrid", "SimpleChart"
|
|
42
|
+
*/
|
|
43
|
+
componentName: string;
|
|
44
|
+
/**
|
|
45
|
+
* Full component specification
|
|
46
|
+
*
|
|
47
|
+
* Provides access to:
|
|
48
|
+
* - Type definitions (for custom type validation)
|
|
49
|
+
* - Data requirements (entities, queries)
|
|
50
|
+
* - Other properties (for cross-property validation)
|
|
51
|
+
* - Dependency specs (for validating nested components)
|
|
52
|
+
*/
|
|
53
|
+
componentSpec: ComponentSpec;
|
|
54
|
+
/**
|
|
55
|
+
* Name of the property being validated
|
|
56
|
+
*
|
|
57
|
+
* Example: "fields", "columns", "entityName", "extraFilter"
|
|
58
|
+
*/
|
|
59
|
+
propertyName: string;
|
|
60
|
+
/**
|
|
61
|
+
* Extracted value of the property
|
|
62
|
+
*
|
|
63
|
+
* This is the result of PropValueExtractor.extract() and can be:
|
|
64
|
+
* - Primitive: string, number, boolean, null
|
|
65
|
+
* - Array: Array of extracted values
|
|
66
|
+
* - Object: Record<string, ExtractedValue>
|
|
67
|
+
* - DynamicValue: { _type: 'identifier' | 'expression', name?, description? }
|
|
68
|
+
*
|
|
69
|
+
* If the value is a DynamicValue, validators should typically skip validation
|
|
70
|
+
* and return an empty violations array (the linter will warn the user).
|
|
71
|
+
*/
|
|
72
|
+
propertyValue: ExtractedValue;
|
|
73
|
+
/**
|
|
74
|
+
* Map of sibling props on the same JSX element
|
|
75
|
+
*
|
|
76
|
+
* Key is prop name, value is extracted value.
|
|
77
|
+
* Used for constraints with `dependsOn` to access related prop values.
|
|
78
|
+
*
|
|
79
|
+
* Example:
|
|
80
|
+
* ```typescript
|
|
81
|
+
* // <EntityDataGrid entityName="Members" fields={['FirstName', 'LastName']} />
|
|
82
|
+
* siblingProps.get('entityName') // => "Members"
|
|
83
|
+
* siblingProps.get('fields') // => ['FirstName', 'LastName']
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
siblingProps: Map<string, ExtractedValue>;
|
|
87
|
+
/**
|
|
88
|
+
* Map of entity name to entity metadata
|
|
89
|
+
*
|
|
90
|
+
* Populated from componentSpec.dataRequirements.entities
|
|
91
|
+
* Used by validators that check field names, entity references, etc.
|
|
92
|
+
*
|
|
93
|
+
* Example:
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const memberEntity = entities.get('Members');
|
|
96
|
+
* const fields = memberEntity.fields; // Array of EntityFieldInfo
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
entities: Map<string, EntityMetadata>;
|
|
100
|
+
/**
|
|
101
|
+
* Map of query name to query metadata
|
|
102
|
+
*
|
|
103
|
+
* Populated from componentSpec.dataRequirements.queries
|
|
104
|
+
* Used by validators that check query references and parameters.
|
|
105
|
+
*
|
|
106
|
+
* Example:
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const query = queries.get('Sales by Region');
|
|
109
|
+
* const params = query.parameters; // Array of QueryParameter
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
queries: Map<string, QueryMetadata>;
|
|
113
|
+
/**
|
|
114
|
+
* Type inference engine for checking expression types
|
|
115
|
+
*
|
|
116
|
+
* Used for advanced type checking beyond what PropValueExtractor provides.
|
|
117
|
+
* Can infer types of variables, function calls, etc.
|
|
118
|
+
*/
|
|
119
|
+
typeEngine: TypeInferenceEngine;
|
|
120
|
+
/**
|
|
121
|
+
* SQL dialect for WHERE clause parsing and validation.
|
|
122
|
+
*
|
|
123
|
+
* Used by the SqlWhereClauseValidator to parse SQL with the correct syntax
|
|
124
|
+
* for the target database platform (SQL Server, PostgreSQL, etc.).
|
|
125
|
+
* If not provided, the validator falls back to SQL Server dialect.
|
|
126
|
+
*/
|
|
127
|
+
dialect?: SQLParserDialect;
|
|
128
|
+
/**
|
|
129
|
+
* Get field metadata for an entity
|
|
130
|
+
*
|
|
131
|
+
* @param entityName - Name of the entity
|
|
132
|
+
* @returns Array of field info, or empty array if entity not found
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const fields = context.getEntityFields('Members');
|
|
137
|
+
* const fieldNames = fields.map(f => f.name);
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
getEntityFields(entityName: string): EntityFieldInfo[];
|
|
141
|
+
/**
|
|
142
|
+
* Get the data type of a specific field on an entity
|
|
143
|
+
*
|
|
144
|
+
* @param entityName - Name of the entity
|
|
145
|
+
* @param fieldName - Name of the field
|
|
146
|
+
* @returns Data type string (e.g., 'string', 'number', 'date'), or null if not found
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* const fieldType = context.getEntityFieldType('Members', 'JoinDate');
|
|
151
|
+
* // => 'date'
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
getEntityFieldType(entityName: string, fieldName: string): string | null;
|
|
155
|
+
/**
|
|
156
|
+
* Find field names similar to the given field name (for suggestions)
|
|
157
|
+
*
|
|
158
|
+
* Uses fuzzy matching (Levenshtein distance or similar) to find close matches.
|
|
159
|
+
* Useful for "Did you mean?" error messages.
|
|
160
|
+
*
|
|
161
|
+
* @param fieldName - The field name to find matches for
|
|
162
|
+
* @param entityName - Name of the entity to search in
|
|
163
|
+
* @param maxResults - Maximum number of suggestions (default: 3)
|
|
164
|
+
* @returns Array of similar field names, sorted by similarity
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const suggestions = context.findSimilarFieldNames('FristName', 'Members', 3);
|
|
169
|
+
* // => ['FirstName', 'FirstNameNormalized', 'FirstNameMasked']
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
findSimilarFieldNames(fieldName: string, entityName: string, maxResults?: number): string[];
|
|
173
|
+
/**
|
|
174
|
+
* Get parameter metadata for a query
|
|
175
|
+
*
|
|
176
|
+
* @param queryName - Name of the query
|
|
177
|
+
* @returns Array of parameter info, or empty array if query not found
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* const params = context.getQueryParameters('Sales by Region');
|
|
182
|
+
* const requiredParams = params.filter(p => p.required);
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
getQueryParameters(queryName: string): QueryParameter[];
|
|
186
|
+
/**
|
|
187
|
+
* Check if a query exists in the component's data requirements
|
|
188
|
+
*
|
|
189
|
+
* @param queryName - Name of the query to check
|
|
190
|
+
* @param categoryPath - Optional category path for disambiguation
|
|
191
|
+
* @returns True if the query exists
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```typescript
|
|
195
|
+
* if (!context.hasQuery('Sales Report', '/Reports/Sales')) {
|
|
196
|
+
* // Query not found
|
|
197
|
+
* }
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
hasQuery(queryName: string, categoryPath?: string): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Check if an entity exists in the component's data requirements
|
|
203
|
+
*
|
|
204
|
+
* @param entityName - Name of the entity to check
|
|
205
|
+
* @returns True if the entity exists
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* if (!context.hasEntity('Members')) {
|
|
210
|
+
* // Entity not found
|
|
211
|
+
* }
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
hasEntity(entityName: string): boolean;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Entity metadata extracted from data requirements
|
|
218
|
+
*/
|
|
219
|
+
export interface EntityMetadata {
|
|
220
|
+
/**
|
|
221
|
+
* Entity name
|
|
222
|
+
*/
|
|
223
|
+
name: string;
|
|
224
|
+
/**
|
|
225
|
+
* Entity description (if available)
|
|
226
|
+
*/
|
|
227
|
+
description?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Array of field metadata for this entity
|
|
230
|
+
*/
|
|
231
|
+
fields: EntityFieldInfo[];
|
|
232
|
+
/**
|
|
233
|
+
* Primary key field name(s)
|
|
234
|
+
*/
|
|
235
|
+
primaryKeys?: string[];
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Field metadata for an entity
|
|
239
|
+
*/
|
|
240
|
+
export interface EntityFieldInfo {
|
|
241
|
+
/**
|
|
242
|
+
* Field name
|
|
243
|
+
*/
|
|
244
|
+
name: string;
|
|
245
|
+
/**
|
|
246
|
+
* Data type (e.g., 'string', 'number', 'date', 'boolean')
|
|
247
|
+
*/
|
|
248
|
+
type: string;
|
|
249
|
+
/**
|
|
250
|
+
* SQL data type (e.g., 'nvarchar', 'int', 'datetime', 'bit')
|
|
251
|
+
*/
|
|
252
|
+
sqlType?: string;
|
|
253
|
+
/**
|
|
254
|
+
* Whether this field is required (NOT NULL)
|
|
255
|
+
*/
|
|
256
|
+
required?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Field description (if available)
|
|
259
|
+
*/
|
|
260
|
+
description?: string;
|
|
261
|
+
/**
|
|
262
|
+
* Whether this is a primary key field
|
|
263
|
+
*/
|
|
264
|
+
isPrimaryKey?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* If this is a foreign key, the related entity name
|
|
267
|
+
*/
|
|
268
|
+
relatedEntity?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Maximum length for string fields
|
|
271
|
+
*/
|
|
272
|
+
maxLength?: number;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Query metadata extracted from data requirements
|
|
276
|
+
*/
|
|
277
|
+
export interface QueryMetadata {
|
|
278
|
+
/**
|
|
279
|
+
* Query name
|
|
280
|
+
*/
|
|
281
|
+
name: string;
|
|
282
|
+
/**
|
|
283
|
+
* Query description (if available)
|
|
284
|
+
*/
|
|
285
|
+
description?: string;
|
|
286
|
+
/**
|
|
287
|
+
* Category path for disambiguation
|
|
288
|
+
*/
|
|
289
|
+
categoryPath?: string;
|
|
290
|
+
/**
|
|
291
|
+
* Array of parameter metadata for this query
|
|
292
|
+
*/
|
|
293
|
+
parameters: QueryParameter[];
|
|
294
|
+
/**
|
|
295
|
+
* Expected result fields (if specified)
|
|
296
|
+
*/
|
|
297
|
+
resultFields?: Array<{
|
|
298
|
+
name: string;
|
|
299
|
+
type: string;
|
|
300
|
+
}>;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Parameter metadata for a query
|
|
304
|
+
*/
|
|
305
|
+
export interface QueryParameter {
|
|
306
|
+
/**
|
|
307
|
+
* Parameter name
|
|
308
|
+
*/
|
|
309
|
+
name: string;
|
|
310
|
+
/**
|
|
311
|
+
* Parameter data type
|
|
312
|
+
*/
|
|
313
|
+
type: string;
|
|
314
|
+
/**
|
|
315
|
+
* SQL data type
|
|
316
|
+
*/
|
|
317
|
+
sqlType?: string;
|
|
318
|
+
/**
|
|
319
|
+
* Whether this parameter is required
|
|
320
|
+
*/
|
|
321
|
+
required?: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Default value if not provided
|
|
324
|
+
*/
|
|
325
|
+
defaultValue?: any;
|
|
326
|
+
/**
|
|
327
|
+
* Example/test value for documentation
|
|
328
|
+
*/
|
|
329
|
+
testValue?: any;
|
|
330
|
+
/**
|
|
331
|
+
* Parameter description (if available)
|
|
332
|
+
*/
|
|
333
|
+
description?: string;
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=validation-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-context.d.ts","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/validation-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAKhC;;;;;OAKG;IACH,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;IAEb;;;;;OAKG;IACH,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAMpB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;;;OAQG;IACH,aAAa,EAAE,aAAa,CAAC;IAM7B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,cAAc,CAAC;IAE9B;;;;;;;;;;;;OAYG;IACH,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAM1C;;;;;;;;;;;OAWG;IACH,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEtC;;;;;;;;;;;OAWG;IACH,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAMpC;;;;;OAKG;IACH,UAAU,EAAE,mBAAmB,CAA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OAAO,CAAC;IAEvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,UAAU,EAAE,cAAc,EAAE,CAAC;IAE7B;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,GAAG,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Context
|
|
3
|
+
*
|
|
4
|
+
* Provides all the information a semantic validator needs to perform validation.
|
|
5
|
+
* This context is passed to validators by the linter rule and includes:
|
|
6
|
+
* - AST node and path information for location tracking
|
|
7
|
+
* - Component spec for type lookups
|
|
8
|
+
* - Sibling props for dependency resolution
|
|
9
|
+
* - Entity/query metadata from data requirements
|
|
10
|
+
* - Helper methods for common validation tasks
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=validation-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-context.js","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/validation-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Analyzes the ComponentStyles TypeScript interface to validate style property access
|
|
3
|
+
* @module @memberjunction/react-test-harness
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Analyzes the ComponentStyles interface from @memberjunction/interactive-component-types
|
|
7
|
+
* to provide validation and suggestions for style property access
|
|
8
|
+
*/
|
|
9
|
+
export declare class StylesTypeAnalyzer {
|
|
10
|
+
private validPaths;
|
|
11
|
+
private propertyMap;
|
|
12
|
+
private defaultStyles;
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Analyzes the ComponentStyles interface to extract all valid property paths
|
|
16
|
+
*/
|
|
17
|
+
private analyzeComponentStylesInterface;
|
|
18
|
+
/**
|
|
19
|
+
* Finds an interface by name in a source file
|
|
20
|
+
*/
|
|
21
|
+
private findInterface;
|
|
22
|
+
/**
|
|
23
|
+
* Recursively extracts property paths from an interface
|
|
24
|
+
*/
|
|
25
|
+
private extractPaths;
|
|
26
|
+
/**
|
|
27
|
+
* Extracts paths from a type node
|
|
28
|
+
*/
|
|
29
|
+
private extractPathsFromType;
|
|
30
|
+
/**
|
|
31
|
+
* Adds a path to our tracking structures
|
|
32
|
+
*/
|
|
33
|
+
private addPath;
|
|
34
|
+
/**
|
|
35
|
+
* Loads structure from the actual runtime default styles
|
|
36
|
+
*/
|
|
37
|
+
private loadFallbackStructure;
|
|
38
|
+
/**
|
|
39
|
+
* Builds paths from a structure object
|
|
40
|
+
*/
|
|
41
|
+
private buildPathsFromStructure;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if a property path is valid
|
|
44
|
+
*/
|
|
45
|
+
isValidPath(pathArray: string[]): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Finds all paths containing a specific property name
|
|
48
|
+
*/
|
|
49
|
+
findPropertyPaths(propertyName: string): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Gets suggestions for an invalid path
|
|
52
|
+
*/
|
|
53
|
+
getSuggestionsForPath(invalidPath: string[]): {
|
|
54
|
+
correctPaths: string[];
|
|
55
|
+
availableAtParent: string[];
|
|
56
|
+
didYouMean: string | null;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Gets the actual default value from the runtime styles object
|
|
60
|
+
* This ensures we have a single source of truth for default values
|
|
61
|
+
*/
|
|
62
|
+
getDefaultValueForPath(pathArray: string[]): string;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=styles-type-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles-type-analyzer.d.ts","sourceRoot":"","sources":["../src/styles-type-analyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,aAAa,CAAkB;;IAYvC;;OAEG;IACH,OAAO,CAAC,+BAA+B;IA0CvC;;OAEG;IACH,OAAO,CAAC,aAAa;IAerB;;OAEG;IACH,OAAO,CAAC,YAAY;IAqBpB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;OAEG;IACH,OAAO,CAAC,OAAO;IAYf;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAM7B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAa/B;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO;IAMzC;;OAEG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE;IAWjD;;OAEG;IACH,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG;QAC5C,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,iBAAiB,EAAE,MAAM,EAAE,CAAC;QAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAC1B;IAgDD;;;OAGG;IACH,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM;CAgCpD"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Analyzes the ComponentStyles TypeScript interface to validate style property access
|
|
3
|
+
* @module @memberjunction/react-test-harness
|
|
4
|
+
*/
|
|
5
|
+
import * as ts from 'typescript';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import { createRequire } from 'module';
|
|
9
|
+
import { SetupStyles } from '@memberjunction/react-runtime';
|
|
10
|
+
// ESM compatibility: require.resolve is not available in ESM, use createRequire
|
|
11
|
+
// See: https://nodejs.org/api/module.html#modulecreaterequirefilename
|
|
12
|
+
const _require = createRequire(import.meta.url);
|
|
13
|
+
/**
|
|
14
|
+
* Analyzes the ComponentStyles interface from @memberjunction/interactive-component-types
|
|
15
|
+
* to provide validation and suggestions for style property access
|
|
16
|
+
*/
|
|
17
|
+
export class StylesTypeAnalyzer {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.validPaths = new Set();
|
|
20
|
+
this.propertyMap = new Map();
|
|
21
|
+
// Get the default styles from the runtime - single source of truth
|
|
22
|
+
this.defaultStyles = SetupStyles();
|
|
23
|
+
this.analyzeComponentStylesInterface();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Analyzes the ComponentStyles interface to extract all valid property paths
|
|
27
|
+
*/
|
|
28
|
+
analyzeComponentStylesInterface() {
|
|
29
|
+
try {
|
|
30
|
+
// Find the type definition file
|
|
31
|
+
const typePackagePath = _require.resolve('@memberjunction/interactive-component-types');
|
|
32
|
+
const packageDir = path.dirname(typePackagePath);
|
|
33
|
+
const typeFile = path.join(packageDir, 'src', 'runtime-types.ts');
|
|
34
|
+
// Check if file exists, if not try the dist version
|
|
35
|
+
const actualFile = fs.existsSync(typeFile)
|
|
36
|
+
? typeFile
|
|
37
|
+
: path.join(packageDir, 'runtime-types.d.ts');
|
|
38
|
+
if (!fs.existsSync(actualFile)) {
|
|
39
|
+
// Fallback to hardcoded structure if we can't find the file
|
|
40
|
+
this.loadFallbackStructure();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const sourceCode = fs.readFileSync(actualFile, 'utf-8');
|
|
44
|
+
// Create a TypeScript program to parse the file
|
|
45
|
+
const sourceFile = ts.createSourceFile(actualFile, sourceCode, ts.ScriptTarget.Latest, true);
|
|
46
|
+
// Find the ComponentStyles interface
|
|
47
|
+
const interfaceNode = this.findInterface(sourceFile, 'ComponentStyles');
|
|
48
|
+
if (interfaceNode) {
|
|
49
|
+
this.extractPaths(interfaceNode, []);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Fallback if we can't find the interface
|
|
53
|
+
this.loadFallbackStructure();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
console.warn('Failed to analyze ComponentStyles interface, using fallback structure:', error);
|
|
58
|
+
this.loadFallbackStructure();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Finds an interface by name in a source file
|
|
63
|
+
*/
|
|
64
|
+
findInterface(sourceFile, name) {
|
|
65
|
+
let result;
|
|
66
|
+
const visit = (node) => {
|
|
67
|
+
if (ts.isInterfaceDeclaration(node) && node.name?.text === name) {
|
|
68
|
+
result = node;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
ts.forEachChild(node, visit);
|
|
72
|
+
};
|
|
73
|
+
visit(sourceFile);
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Recursively extracts property paths from an interface
|
|
78
|
+
*/
|
|
79
|
+
extractPaths(node, currentPath) {
|
|
80
|
+
if (ts.isInterfaceDeclaration(node) || ts.isTypeLiteralNode(node)) {
|
|
81
|
+
const members = ts.isInterfaceDeclaration(node) ? node.members : node.members;
|
|
82
|
+
members.forEach(member => {
|
|
83
|
+
if (ts.isPropertySignature(member) && member.name && ts.isIdentifier(member.name)) {
|
|
84
|
+
const propName = member.name.text;
|
|
85
|
+
const newPath = [...currentPath, propName];
|
|
86
|
+
// Add this path
|
|
87
|
+
this.addPath(newPath);
|
|
88
|
+
// If the type is an object/interface, recurse
|
|
89
|
+
if (member.type) {
|
|
90
|
+
this.extractPathsFromType(member.type, newPath);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Extracts paths from a type node
|
|
98
|
+
*/
|
|
99
|
+
extractPathsFromType(typeNode, currentPath) {
|
|
100
|
+
if (ts.isTypeLiteralNode(typeNode)) {
|
|
101
|
+
this.extractPaths(typeNode, currentPath);
|
|
102
|
+
}
|
|
103
|
+
else if (ts.isUnionTypeNode(typeNode)) {
|
|
104
|
+
// For union types, we might have object literals
|
|
105
|
+
typeNode.types.forEach(type => {
|
|
106
|
+
if (ts.isTypeLiteralNode(type)) {
|
|
107
|
+
this.extractPaths(type, currentPath);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Adds a path to our tracking structures
|
|
114
|
+
*/
|
|
115
|
+
addPath(pathArray) {
|
|
116
|
+
const pathStr = pathArray.join('.');
|
|
117
|
+
this.validPaths.add(pathStr);
|
|
118
|
+
// Add to property map for quick lookup
|
|
119
|
+
const lastProp = pathArray[pathArray.length - 1];
|
|
120
|
+
if (!this.propertyMap.has(lastProp)) {
|
|
121
|
+
this.propertyMap.set(lastProp, []);
|
|
122
|
+
}
|
|
123
|
+
this.propertyMap.get(lastProp).push(pathStr);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Loads structure from the actual runtime default styles
|
|
127
|
+
*/
|
|
128
|
+
loadFallbackStructure() {
|
|
129
|
+
// Use the actual default styles as the structure source
|
|
130
|
+
// We need to cast through unknown because ComponentStyles doesn't have an index signature
|
|
131
|
+
this.buildPathsFromStructure(this.defaultStyles, []);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Builds paths from a structure object
|
|
135
|
+
*/
|
|
136
|
+
buildPathsFromStructure(obj, currentPath) {
|
|
137
|
+
for (const key in obj) {
|
|
138
|
+
const newPath = [...currentPath, key];
|
|
139
|
+
this.addPath(newPath);
|
|
140
|
+
const value = obj[key];
|
|
141
|
+
// Check if it's an object but not a boolean (which was being compared incorrectly)
|
|
142
|
+
if (value && typeof value === 'object') {
|
|
143
|
+
this.buildPathsFromStructure(value, newPath);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Checks if a property path is valid
|
|
149
|
+
*/
|
|
150
|
+
isValidPath(pathArray) {
|
|
151
|
+
// Remove 'styles' from the beginning if present
|
|
152
|
+
const cleanPath = pathArray[0] === 'styles' ? pathArray.slice(1) : pathArray;
|
|
153
|
+
return this.validPaths.has(cleanPath.join('.'));
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Finds all paths containing a specific property name
|
|
157
|
+
*/
|
|
158
|
+
findPropertyPaths(propertyName) {
|
|
159
|
+
const paths = [];
|
|
160
|
+
// Look for exact matches
|
|
161
|
+
if (this.propertyMap.has(propertyName)) {
|
|
162
|
+
paths.push(...this.propertyMap.get(propertyName));
|
|
163
|
+
}
|
|
164
|
+
return paths;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Gets suggestions for an invalid path
|
|
168
|
+
*/
|
|
169
|
+
getSuggestionsForPath(invalidPath) {
|
|
170
|
+
// Remove 'styles' prefix if present
|
|
171
|
+
const cleanPath = invalidPath[0] === 'styles' ? invalidPath.slice(1) : invalidPath;
|
|
172
|
+
const suggestions = {
|
|
173
|
+
correctPaths: [],
|
|
174
|
+
availableAtParent: [],
|
|
175
|
+
didYouMean: null
|
|
176
|
+
};
|
|
177
|
+
// Find where the misplaced property might exist
|
|
178
|
+
const lastProp = cleanPath[cleanPath.length - 1];
|
|
179
|
+
suggestions.correctPaths = this.findPropertyPaths(lastProp)
|
|
180
|
+
.map(p => 'styles.' + p);
|
|
181
|
+
// Get available properties at the parent level
|
|
182
|
+
if (cleanPath.length > 1) {
|
|
183
|
+
const parentPath = cleanPath.slice(0, -1).join('.');
|
|
184
|
+
this.validPaths.forEach(validPath => {
|
|
185
|
+
if (validPath.startsWith(parentPath + '.')) {
|
|
186
|
+
const nextProp = validPath.substring(parentPath.length + 1).split('.')[0];
|
|
187
|
+
if (nextProp && !suggestions.availableAtParent.includes(nextProp)) {
|
|
188
|
+
suggestions.availableAtParent.push(nextProp);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
// At root level, show root properties
|
|
195
|
+
this.validPaths.forEach(validPath => {
|
|
196
|
+
const rootProp = validPath.split('.')[0];
|
|
197
|
+
if (!suggestions.availableAtParent.includes(rootProp)) {
|
|
198
|
+
suggestions.availableAtParent.push(rootProp);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
// Generate "did you mean" suggestion
|
|
203
|
+
if (suggestions.correctPaths.length > 0) {
|
|
204
|
+
suggestions.didYouMean = suggestions.correctPaths[0];
|
|
205
|
+
}
|
|
206
|
+
return suggestions;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Gets the actual default value from the runtime styles object
|
|
210
|
+
* This ensures we have a single source of truth for default values
|
|
211
|
+
*/
|
|
212
|
+
getDefaultValueForPath(pathArray) {
|
|
213
|
+
const cleanPath = pathArray[0] === 'styles' ? pathArray.slice(1) : pathArray;
|
|
214
|
+
// Navigate the actual default styles object to get the real value
|
|
215
|
+
// Cast through unknown because ComponentStyles doesn't have an index signature
|
|
216
|
+
let current = this.defaultStyles;
|
|
217
|
+
for (const prop of cleanPath) {
|
|
218
|
+
if (current && typeof current === 'object' && prop in current) {
|
|
219
|
+
current = current[prop];
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
// Path doesn't exist in defaults, return empty string
|
|
223
|
+
return "undefined";
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// If we found a value, return it properly quoted
|
|
227
|
+
if (current !== undefined && current !== null) {
|
|
228
|
+
// For string values, add quotes
|
|
229
|
+
if (typeof current === 'string') {
|
|
230
|
+
return `'${current}'`;
|
|
231
|
+
}
|
|
232
|
+
// For objects (intermediate paths), return undefined since we can't provide a meaningful default
|
|
233
|
+
if (typeof current === 'object') {
|
|
234
|
+
return "{}";
|
|
235
|
+
}
|
|
236
|
+
// For other primitive types, convert to string
|
|
237
|
+
return String(current);
|
|
238
|
+
}
|
|
239
|
+
return "undefined";
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=styles-type-analyzer.js.map
|