driftdetect-detectors 0.1.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/accessibility/alt-text.d.ts +63 -0
- package/dist/accessibility/alt-text.d.ts.map +1 -0
- package/dist/accessibility/alt-text.js +100 -0
- package/dist/accessibility/alt-text.js.map +1 -0
- package/dist/accessibility/aria-roles.d.ts +65 -0
- package/dist/accessibility/aria-roles.d.ts.map +1 -0
- package/dist/accessibility/aria-roles.js +87 -0
- package/dist/accessibility/aria-roles.js.map +1 -0
- package/dist/accessibility/focus-management.d.ts +62 -0
- package/dist/accessibility/focus-management.d.ts.map +1 -0
- package/dist/accessibility/focus-management.js +88 -0
- package/dist/accessibility/focus-management.js.map +1 -0
- package/dist/accessibility/heading-hierarchy.d.ts +66 -0
- package/dist/accessibility/heading-hierarchy.d.ts.map +1 -0
- package/dist/accessibility/heading-hierarchy.js +94 -0
- package/dist/accessibility/heading-hierarchy.js.map +1 -0
- package/dist/accessibility/index.d.ts +25 -0
- package/dist/accessibility/index.d.ts.map +1 -0
- package/dist/accessibility/index.js +21 -0
- package/dist/accessibility/index.js.map +1 -0
- package/dist/accessibility/keyboard-nav.d.ts +63 -0
- package/dist/accessibility/keyboard-nav.d.ts.map +1 -0
- package/dist/accessibility/keyboard-nav.js +86 -0
- package/dist/accessibility/keyboard-nav.js.map +1 -0
- package/dist/accessibility/semantic-html.d.ts +76 -0
- package/dist/accessibility/semantic-html.d.ts.map +1 -0
- package/dist/accessibility/semantic-html.js +204 -0
- package/dist/accessibility/semantic-html.js.map +1 -0
- package/dist/api/client-patterns.d.ts +121 -0
- package/dist/api/client-patterns.d.ts.map +1 -0
- package/dist/api/client-patterns.js +478 -0
- package/dist/api/client-patterns.js.map +1 -0
- package/dist/api/error-format.d.ts +140 -0
- package/dist/api/error-format.d.ts.map +1 -0
- package/dist/api/error-format.js +614 -0
- package/dist/api/error-format.js.map +1 -0
- package/dist/api/http-methods.d.ts +255 -0
- package/dist/api/http-methods.d.ts.map +1 -0
- package/dist/api/http-methods.js +890 -0
- package/dist/api/http-methods.js.map +1 -0
- package/dist/api/index.d.ts +16 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +37 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/pagination.d.ts +133 -0
- package/dist/api/pagination.d.ts.map +1 -0
- package/dist/api/pagination.js +521 -0
- package/dist/api/pagination.js.map +1 -0
- package/dist/api/response-envelope.d.ts +261 -0
- package/dist/api/response-envelope.d.ts.map +1 -0
- package/dist/api/response-envelope.js +1050 -0
- package/dist/api/response-envelope.js.map +1 -0
- package/dist/api/retry-patterns.d.ts +117 -0
- package/dist/api/retry-patterns.d.ts.map +1 -0
- package/dist/api/retry-patterns.js +480 -0
- package/dist/api/retry-patterns.js.map +1 -0
- package/dist/api/route-structure.d.ts +128 -0
- package/dist/api/route-structure.d.ts.map +1 -0
- package/dist/api/route-structure.js +738 -0
- package/dist/api/route-structure.js.map +1 -0
- package/dist/auth/audit-logging.d.ts +80 -0
- package/dist/auth/audit-logging.d.ts.map +1 -0
- package/dist/auth/audit-logging.js +370 -0
- package/dist/auth/audit-logging.js.map +1 -0
- package/dist/auth/index.d.ts +33 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +49 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/middleware-usage.d.ts +65 -0
- package/dist/auth/middleware-usage.d.ts.map +1 -0
- package/dist/auth/middleware-usage.js +192 -0
- package/dist/auth/middleware-usage.js.map +1 -0
- package/dist/auth/permission-checks.d.ts +60 -0
- package/dist/auth/permission-checks.d.ts.map +1 -0
- package/dist/auth/permission-checks.js +159 -0
- package/dist/auth/permission-checks.js.map +1 -0
- package/dist/auth/rbac-patterns.d.ts +68 -0
- package/dist/auth/rbac-patterns.d.ts.map +1 -0
- package/dist/auth/rbac-patterns.js +143 -0
- package/dist/auth/rbac-patterns.js.map +1 -0
- package/dist/auth/resource-ownership.d.ts +77 -0
- package/dist/auth/resource-ownership.d.ts.map +1 -0
- package/dist/auth/resource-ownership.js +324 -0
- package/dist/auth/resource-ownership.js.map +1 -0
- package/dist/auth/token-handling.d.ts +64 -0
- package/dist/auth/token-handling.d.ts.map +1 -0
- package/dist/auth/token-handling.js +151 -0
- package/dist/auth/token-handling.js.map +1 -0
- package/dist/base/ast-detector.d.ts +421 -0
- package/dist/base/ast-detector.d.ts.map +1 -0
- package/dist/base/ast-detector.js +699 -0
- package/dist/base/ast-detector.js.map +1 -0
- package/dist/base/base-detector.d.ts +366 -0
- package/dist/base/base-detector.d.ts.map +1 -0
- package/dist/base/base-detector.js +170 -0
- package/dist/base/base-detector.js.map +1 -0
- package/dist/base/index.d.ts +12 -0
- package/dist/base/index.d.ts.map +1 -0
- package/dist/base/index.js +17 -0
- package/dist/base/index.js.map +1 -0
- package/dist/base/regex-detector.d.ts +421 -0
- package/dist/base/regex-detector.d.ts.map +1 -0
- package/dist/base/regex-detector.js +537 -0
- package/dist/base/regex-detector.js.map +1 -0
- package/dist/base/structural-detector.d.ts +424 -0
- package/dist/base/structural-detector.d.ts.map +1 -0
- package/dist/base/structural-detector.js +731 -0
- package/dist/base/structural-detector.js.map +1 -0
- package/dist/base/types.d.ts +53 -0
- package/dist/base/types.d.ts.map +1 -0
- package/dist/base/types.js +5 -0
- package/dist/base/types.js.map +1 -0
- package/dist/components/component-structure.d.ts +163 -0
- package/dist/components/component-structure.d.ts.map +1 -0
- package/dist/components/component-structure.js +500 -0
- package/dist/components/component-structure.js.map +1 -0
- package/dist/components/composition.d.ts +287 -0
- package/dist/components/composition.d.ts.map +1 -0
- package/dist/components/composition.js +1123 -0
- package/dist/components/composition.js.map +1 -0
- package/dist/components/duplicate-detection.d.ts +251 -0
- package/dist/components/duplicate-detection.d.ts.map +1 -0
- package/dist/components/duplicate-detection.js +804 -0
- package/dist/components/duplicate-detection.js.map +1 -0
- package/dist/components/index.d.ts +16 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +51 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/near-duplicate.d.ts +402 -0
- package/dist/components/near-duplicate.d.ts.map +1 -0
- package/dist/components/near-duplicate.js +1090 -0
- package/dist/components/near-duplicate.js.map +1 -0
- package/dist/components/props-patterns.d.ts +194 -0
- package/dist/components/props-patterns.d.ts.map +1 -0
- package/dist/components/props-patterns.js +795 -0
- package/dist/components/props-patterns.js.map +1 -0
- package/dist/components/ref-forwarding.d.ts +250 -0
- package/dist/components/ref-forwarding.d.ts.map +1 -0
- package/dist/components/ref-forwarding.js +832 -0
- package/dist/components/ref-forwarding.js.map +1 -0
- package/dist/components/state-patterns.d.ts +291 -0
- package/dist/components/state-patterns.d.ts.map +1 -0
- package/dist/components/state-patterns.js +970 -0
- package/dist/components/state-patterns.js.map +1 -0
- package/dist/config/config-validation.d.ts +74 -0
- package/dist/config/config-validation.d.ts.map +1 -0
- package/dist/config/config-validation.js +446 -0
- package/dist/config/config-validation.js.map +1 -0
- package/dist/config/default-values.d.ts +72 -0
- package/dist/config/default-values.d.ts.map +1 -0
- package/dist/config/default-values.js +386 -0
- package/dist/config/default-values.js.map +1 -0
- package/dist/config/env-naming.d.ts +73 -0
- package/dist/config/env-naming.d.ts.map +1 -0
- package/dist/config/env-naming.js +429 -0
- package/dist/config/env-naming.js.map +1 -0
- package/dist/config/environment-detection.d.ts +72 -0
- package/dist/config/environment-detection.d.ts.map +1 -0
- package/dist/config/environment-detection.js +400 -0
- package/dist/config/environment-detection.js.map +1 -0
- package/dist/config/feature-flags.d.ts +72 -0
- package/dist/config/feature-flags.d.ts.map +1 -0
- package/dist/config/feature-flags.js +384 -0
- package/dist/config/feature-flags.js.map +1 -0
- package/dist/config/index.d.ts +27 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +43 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/required-optional.d.ts +71 -0
- package/dist/config/required-optional.d.ts.map +1 -0
- package/dist/config/required-optional.js +344 -0
- package/dist/config/required-optional.js.map +1 -0
- package/dist/data-access/connection-pooling.d.ts +63 -0
- package/dist/data-access/connection-pooling.d.ts.map +1 -0
- package/dist/data-access/connection-pooling.js +297 -0
- package/dist/data-access/connection-pooling.js.map +1 -0
- package/dist/data-access/dto-patterns.d.ts +64 -0
- package/dist/data-access/dto-patterns.d.ts.map +1 -0
- package/dist/data-access/dto-patterns.js +291 -0
- package/dist/data-access/dto-patterns.js.map +1 -0
- package/dist/data-access/index.d.ts +31 -0
- package/dist/data-access/index.d.ts.map +1 -0
- package/dist/data-access/index.js +49 -0
- package/dist/data-access/index.js.map +1 -0
- package/dist/data-access/n-plus-one.d.ts +60 -0
- package/dist/data-access/n-plus-one.d.ts.map +1 -0
- package/dist/data-access/n-plus-one.js +264 -0
- package/dist/data-access/n-plus-one.js.map +1 -0
- package/dist/data-access/query-patterns.d.ts +64 -0
- package/dist/data-access/query-patterns.d.ts.map +1 -0
- package/dist/data-access/query-patterns.js +314 -0
- package/dist/data-access/query-patterns.js.map +1 -0
- package/dist/data-access/repository-pattern.d.ts +62 -0
- package/dist/data-access/repository-pattern.d.ts.map +1 -0
- package/dist/data-access/repository-pattern.js +257 -0
- package/dist/data-access/repository-pattern.js.map +1 -0
- package/dist/data-access/transaction-patterns.d.ts +61 -0
- package/dist/data-access/transaction-patterns.d.ts.map +1 -0
- package/dist/data-access/transaction-patterns.js +277 -0
- package/dist/data-access/transaction-patterns.js.map +1 -0
- package/dist/data-access/validation-patterns.d.ts +62 -0
- package/dist/data-access/validation-patterns.d.ts.map +1 -0
- package/dist/data-access/validation-patterns.js +301 -0
- package/dist/data-access/validation-patterns.js.map +1 -0
- package/dist/documentation/deprecation.d.ts +62 -0
- package/dist/documentation/deprecation.d.ts.map +1 -0
- package/dist/documentation/deprecation.js +83 -0
- package/dist/documentation/deprecation.js.map +1 -0
- package/dist/documentation/example-code.d.ts +64 -0
- package/dist/documentation/example-code.d.ts.map +1 -0
- package/dist/documentation/example-code.js +79 -0
- package/dist/documentation/example-code.js.map +1 -0
- package/dist/documentation/index.d.ts +22 -0
- package/dist/documentation/index.d.ts.map +1 -0
- package/dist/documentation/index.js +19 -0
- package/dist/documentation/index.js.map +1 -0
- package/dist/documentation/jsdoc-patterns.d.ts +72 -0
- package/dist/documentation/jsdoc-patterns.d.ts.map +1 -0
- package/dist/documentation/jsdoc-patterns.js +92 -0
- package/dist/documentation/jsdoc-patterns.js.map +1 -0
- package/dist/documentation/readme-structure.d.ts +67 -0
- package/dist/documentation/readme-structure.d.ts.map +1 -0
- package/dist/documentation/readme-structure.js +76 -0
- package/dist/documentation/readme-structure.js.map +1 -0
- package/dist/documentation/todo-patterns.d.ts +67 -0
- package/dist/documentation/todo-patterns.d.ts.map +1 -0
- package/dist/documentation/todo-patterns.js +73 -0
- package/dist/documentation/todo-patterns.js.map +1 -0
- package/dist/errors/async-errors.d.ts +72 -0
- package/dist/errors/async-errors.d.ts.map +1 -0
- package/dist/errors/async-errors.js +214 -0
- package/dist/errors/async-errors.js.map +1 -0
- package/dist/errors/circuit-breaker.d.ts +53 -0
- package/dist/errors/circuit-breaker.d.ts.map +1 -0
- package/dist/errors/circuit-breaker.js +241 -0
- package/dist/errors/circuit-breaker.js.map +1 -0
- package/dist/errors/error-codes.d.ts +73 -0
- package/dist/errors/error-codes.d.ts.map +1 -0
- package/dist/errors/error-codes.js +211 -0
- package/dist/errors/error-codes.js.map +1 -0
- package/dist/errors/error-logging.d.ts +73 -0
- package/dist/errors/error-logging.d.ts.map +1 -0
- package/dist/errors/error-logging.js +256 -0
- package/dist/errors/error-logging.js.map +1 -0
- package/dist/errors/error-propagation.d.ts +73 -0
- package/dist/errors/error-propagation.d.ts.map +1 -0
- package/dist/errors/error-propagation.js +244 -0
- package/dist/errors/error-propagation.js.map +1 -0
- package/dist/errors/exception-hierarchy.d.ts +75 -0
- package/dist/errors/exception-hierarchy.d.ts.map +1 -0
- package/dist/errors/exception-hierarchy.js +259 -0
- package/dist/errors/exception-hierarchy.js.map +1 -0
- package/dist/errors/index.d.ts +31 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +49 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/try-catch-placement.d.ts +73 -0
- package/dist/errors/try-catch-placement.d.ts.map +1 -0
- package/dist/errors/try-catch-placement.js +214 -0
- package/dist/errors/try-catch-placement.js.map +1 -0
- package/dist/index.d.ts +221 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +245 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/context-fields.d.ts +48 -0
- package/dist/logging/context-fields.d.ts.map +1 -0
- package/dist/logging/context-fields.js +160 -0
- package/dist/logging/context-fields.js.map +1 -0
- package/dist/logging/correlation-ids.d.ts +44 -0
- package/dist/logging/correlation-ids.d.ts.map +1 -0
- package/dist/logging/correlation-ids.js +144 -0
- package/dist/logging/correlation-ids.js.map +1 -0
- package/dist/logging/health-checks.d.ts +45 -0
- package/dist/logging/health-checks.d.ts.map +1 -0
- package/dist/logging/health-checks.js +165 -0
- package/dist/logging/health-checks.js.map +1 -0
- package/dist/logging/index.d.ts +31 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +49 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/log-levels.d.ts +46 -0
- package/dist/logging/log-levels.d.ts.map +1 -0
- package/dist/logging/log-levels.js +178 -0
- package/dist/logging/log-levels.js.map +1 -0
- package/dist/logging/metric-naming.d.ts +46 -0
- package/dist/logging/metric-naming.d.ts.map +1 -0
- package/dist/logging/metric-naming.js +157 -0
- package/dist/logging/metric-naming.js.map +1 -0
- package/dist/logging/pii-redaction.d.ts +44 -0
- package/dist/logging/pii-redaction.d.ts.map +1 -0
- package/dist/logging/pii-redaction.js +166 -0
- package/dist/logging/pii-redaction.js.map +1 -0
- package/dist/logging/structured-format.d.ts +53 -0
- package/dist/logging/structured-format.d.ts.map +1 -0
- package/dist/logging/structured-format.js +235 -0
- package/dist/logging/structured-format.js.map +1 -0
- package/dist/performance/bundle-size.d.ts +79 -0
- package/dist/performance/bundle-size.d.ts.map +1 -0
- package/dist/performance/bundle-size.js +276 -0
- package/dist/performance/bundle-size.js.map +1 -0
- package/dist/performance/caching-patterns.d.ts +78 -0
- package/dist/performance/caching-patterns.d.ts.map +1 -0
- package/dist/performance/caching-patterns.js +257 -0
- package/dist/performance/caching-patterns.js.map +1 -0
- package/dist/performance/code-splitting.d.ts +86 -0
- package/dist/performance/code-splitting.d.ts.map +1 -0
- package/dist/performance/code-splitting.js +447 -0
- package/dist/performance/code-splitting.js.map +1 -0
- package/dist/performance/debounce-throttle.d.ts +75 -0
- package/dist/performance/debounce-throttle.d.ts.map +1 -0
- package/dist/performance/debounce-throttle.js +232 -0
- package/dist/performance/debounce-throttle.js.map +1 -0
- package/dist/performance/index.d.ts +28 -0
- package/dist/performance/index.d.ts.map +1 -0
- package/dist/performance/index.js +39 -0
- package/dist/performance/index.js.map +1 -0
- package/dist/performance/lazy-loading.d.ts +75 -0
- package/dist/performance/lazy-loading.d.ts.map +1 -0
- package/dist/performance/lazy-loading.js +233 -0
- package/dist/performance/lazy-loading.js.map +1 -0
- package/dist/performance/memoization.d.ts +75 -0
- package/dist/performance/memoization.d.ts.map +1 -0
- package/dist/performance/memoization.js +251 -0
- package/dist/performance/memoization.js.map +1 -0
- package/dist/registry/detector-registry.d.ts +266 -0
- package/dist/registry/detector-registry.d.ts.map +1 -0
- package/dist/registry/detector-registry.js +526 -0
- package/dist/registry/detector-registry.js.map +1 -0
- package/dist/registry/index.d.ts +10 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +10 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/loader.d.ts +232 -0
- package/dist/registry/loader.d.ts.map +1 -0
- package/dist/registry/loader.js +419 -0
- package/dist/registry/loader.js.map +1 -0
- package/dist/registry/types.d.ts +111 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +19 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/security/csp-headers.d.ts +78 -0
- package/dist/security/csp-headers.d.ts.map +1 -0
- package/dist/security/csp-headers.js +401 -0
- package/dist/security/csp-headers.js.map +1 -0
- package/dist/security/csrf-protection.d.ts +72 -0
- package/dist/security/csrf-protection.d.ts.map +1 -0
- package/dist/security/csrf-protection.js +344 -0
- package/dist/security/csrf-protection.js.map +1 -0
- package/dist/security/index.d.ts +30 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +48 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/input-sanitization.d.ts +74 -0
- package/dist/security/input-sanitization.d.ts.map +1 -0
- package/dist/security/input-sanitization.js +373 -0
- package/dist/security/input-sanitization.js.map +1 -0
- package/dist/security/rate-limiting.d.ts +81 -0
- package/dist/security/rate-limiting.d.ts.map +1 -0
- package/dist/security/rate-limiting.js +535 -0
- package/dist/security/rate-limiting.js.map +1 -0
- package/dist/security/secret-management.d.ts +83 -0
- package/dist/security/secret-management.d.ts.map +1 -0
- package/dist/security/secret-management.js +547 -0
- package/dist/security/secret-management.js.map +1 -0
- package/dist/security/sql-injection.d.ts +76 -0
- package/dist/security/sql-injection.d.ts.map +1 -0
- package/dist/security/sql-injection.js +383 -0
- package/dist/security/sql-injection.js.map +1 -0
- package/dist/security/xss-prevention.d.ts +80 -0
- package/dist/security/xss-prevention.d.ts.map +1 -0
- package/dist/security/xss-prevention.js +416 -0
- package/dist/security/xss-prevention.js.map +1 -0
- package/dist/structural/barrel-exports.d.ts +178 -0
- package/dist/structural/barrel-exports.d.ts.map +1 -0
- package/dist/structural/barrel-exports.js +553 -0
- package/dist/structural/barrel-exports.js.map +1 -0
- package/dist/structural/circular-deps.d.ts +140 -0
- package/dist/structural/circular-deps.d.ts.map +1 -0
- package/dist/structural/circular-deps.js +422 -0
- package/dist/structural/circular-deps.js.map +1 -0
- package/dist/structural/co-location.d.ts +202 -0
- package/dist/structural/co-location.d.ts.map +1 -0
- package/dist/structural/co-location.js +640 -0
- package/dist/structural/co-location.js.map +1 -0
- package/dist/structural/directory-structure.d.ts +151 -0
- package/dist/structural/directory-structure.d.ts.map +1 -0
- package/dist/structural/directory-structure.js +457 -0
- package/dist/structural/directory-structure.js.map +1 -0
- package/dist/structural/file-naming.d.ts +61 -0
- package/dist/structural/file-naming.d.ts.map +1 -0
- package/dist/structural/file-naming.js +231 -0
- package/dist/structural/file-naming.js.map +1 -0
- package/dist/structural/import-ordering.d.ts +212 -0
- package/dist/structural/import-ordering.d.ts.map +1 -0
- package/dist/structural/import-ordering.js +821 -0
- package/dist/structural/import-ordering.js.map +1 -0
- package/dist/structural/index.d.ts +23 -0
- package/dist/structural/index.d.ts.map +1 -0
- package/dist/structural/index.js +26 -0
- package/dist/structural/index.js.map +1 -0
- package/dist/structural/module-boundaries.d.ts +164 -0
- package/dist/structural/module-boundaries.d.ts.map +1 -0
- package/dist/structural/module-boundaries.js +616 -0
- package/dist/structural/module-boundaries.js.map +1 -0
- package/dist/structural/package-boundaries.d.ts +182 -0
- package/dist/structural/package-boundaries.d.ts.map +1 -0
- package/dist/structural/package-boundaries.js +602 -0
- package/dist/structural/package-boundaries.js.map +1 -0
- package/dist/styling/class-naming.d.ts +263 -0
- package/dist/styling/class-naming.d.ts.map +1 -0
- package/dist/styling/class-naming.js +892 -0
- package/dist/styling/class-naming.js.map +1 -0
- package/dist/styling/color-usage.d.ts +213 -0
- package/dist/styling/color-usage.d.ts.map +1 -0
- package/dist/styling/color-usage.js +732 -0
- package/dist/styling/color-usage.js.map +1 -0
- package/dist/styling/design-tokens.d.ts +212 -0
- package/dist/styling/design-tokens.d.ts.map +1 -0
- package/dist/styling/design-tokens.js +748 -0
- package/dist/styling/design-tokens.js.map +1 -0
- package/dist/styling/index.d.ts +16 -0
- package/dist/styling/index.d.ts.map +1 -0
- package/dist/styling/index.js +56 -0
- package/dist/styling/index.js.map +1 -0
- package/dist/styling/responsive.d.ts +304 -0
- package/dist/styling/responsive.d.ts.map +1 -0
- package/dist/styling/responsive.js +888 -0
- package/dist/styling/responsive.js.map +1 -0
- package/dist/styling/spacing-scale.d.ts +248 -0
- package/dist/styling/spacing-scale.d.ts.map +1 -0
- package/dist/styling/spacing-scale.js +865 -0
- package/dist/styling/spacing-scale.js.map +1 -0
- package/dist/styling/tailwind-patterns.d.ts +305 -0
- package/dist/styling/tailwind-patterns.d.ts.map +1 -0
- package/dist/styling/tailwind-patterns.js +1181 -0
- package/dist/styling/tailwind-patterns.js.map +1 -0
- package/dist/styling/typography.d.ts +281 -0
- package/dist/styling/typography.d.ts.map +1 -0
- package/dist/styling/typography.js +1004 -0
- package/dist/styling/typography.js.map +1 -0
- package/dist/styling/z-index-scale.d.ts +270 -0
- package/dist/styling/z-index-scale.d.ts.map +1 -0
- package/dist/styling/z-index-scale.js +714 -0
- package/dist/styling/z-index-scale.js.map +1 -0
- package/dist/testing/co-location.d.ts +42 -0
- package/dist/testing/co-location.d.ts.map +1 -0
- package/dist/testing/co-location.js +134 -0
- package/dist/testing/co-location.js.map +1 -0
- package/dist/testing/describe-naming.d.ts +47 -0
- package/dist/testing/describe-naming.d.ts.map +1 -0
- package/dist/testing/describe-naming.js +150 -0
- package/dist/testing/describe-naming.js.map +1 -0
- package/dist/testing/file-naming.d.ts +44 -0
- package/dist/testing/file-naming.d.ts.map +1 -0
- package/dist/testing/file-naming.js +131 -0
- package/dist/testing/file-naming.js.map +1 -0
- package/dist/testing/fixture-patterns.d.ts +52 -0
- package/dist/testing/fixture-patterns.d.ts.map +1 -0
- package/dist/testing/fixture-patterns.js +228 -0
- package/dist/testing/fixture-patterns.js.map +1 -0
- package/dist/testing/index.d.ts +31 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +49 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock-patterns.d.ts +53 -0
- package/dist/testing/mock-patterns.d.ts.map +1 -0
- package/dist/testing/mock-patterns.js +264 -0
- package/dist/testing/mock-patterns.js.map +1 -0
- package/dist/testing/setup-teardown.d.ts +55 -0
- package/dist/testing/setup-teardown.d.ts.map +1 -0
- package/dist/testing/setup-teardown.js +262 -0
- package/dist/testing/setup-teardown.js.map +1 -0
- package/dist/testing/test-structure.d.ts +51 -0
- package/dist/testing/test-structure.d.ts.map +1 -0
- package/dist/testing/test-structure.js +225 -0
- package/dist/testing/test-structure.js.map +1 -0
- package/dist/types/any-usage.d.ts +99 -0
- package/dist/types/any-usage.d.ts.map +1 -0
- package/dist/types/any-usage.js +641 -0
- package/dist/types/any-usage.js.map +1 -0
- package/dist/types/file-location.d.ts +76 -0
- package/dist/types/file-location.d.ts.map +1 -0
- package/dist/types/file-location.js +395 -0
- package/dist/types/file-location.js.map +1 -0
- package/dist/types/generic-patterns.d.ts +97 -0
- package/dist/types/generic-patterns.d.ts.map +1 -0
- package/dist/types/generic-patterns.js +615 -0
- package/dist/types/generic-patterns.js.map +1 -0
- package/dist/types/index.d.ts +31 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +43 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/interface-vs-type.d.ts +81 -0
- package/dist/types/interface-vs-type.d.ts.map +1 -0
- package/dist/types/interface-vs-type.js +440 -0
- package/dist/types/interface-vs-type.js.map +1 -0
- package/dist/types/naming-conventions.d.ts +84 -0
- package/dist/types/naming-conventions.d.ts.map +1 -0
- package/dist/types/naming-conventions.js +455 -0
- package/dist/types/naming-conventions.js.map +1 -0
- package/dist/types/type-assertions.d.ts +98 -0
- package/dist/types/type-assertions.d.ts.map +1 -0
- package/dist/types/type-assertions.js +639 -0
- package/dist/types/type-assertions.js.map +1 -0
- package/dist/types/utility-types.d.ts +110 -0
- package/dist/types/utility-types.d.ts.map +1 -0
- package/dist/types/utility-types.js +547 -0
- package/dist/types/utility-types.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection Pooling Detector - Database connection pool pattern detection
|
|
3
|
+
*
|
|
4
|
+
* Detects connection pooling patterns including:
|
|
5
|
+
* - Pool configuration
|
|
6
|
+
* - Connection management
|
|
7
|
+
* - Pool size settings
|
|
8
|
+
* - Connection lifecycle
|
|
9
|
+
*
|
|
10
|
+
* @requirements 13.7 - Connection pooling detection
|
|
11
|
+
*/
|
|
12
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Patterns
|
|
15
|
+
// ============================================================================
|
|
16
|
+
export const POOL_CONFIG_PATTERNS = [
|
|
17
|
+
// JavaScript/TypeScript
|
|
18
|
+
/pool\s*:\s*\{/gi,
|
|
19
|
+
/connectionPool\s*:\s*\{/gi,
|
|
20
|
+
/poolConfig\s*:\s*\{/gi,
|
|
21
|
+
/createPool\s*\(/gi,
|
|
22
|
+
/Pool\s*\(/gi,
|
|
23
|
+
// Python
|
|
24
|
+
/pool_size\s*=/gi,
|
|
25
|
+
/max_overflow\s*=/gi,
|
|
26
|
+
/pool_pre_ping\s*=/gi,
|
|
27
|
+
/create_engine\s*\([^)]*pool/gi,
|
|
28
|
+
/QueuePool/gi,
|
|
29
|
+
/NullPool/gi,
|
|
30
|
+
/StaticPool/gi,
|
|
31
|
+
/AsyncAdaptedQueuePool/gi,
|
|
32
|
+
];
|
|
33
|
+
export const POOL_SIZE_PATTERNS = [
|
|
34
|
+
// JavaScript/TypeScript
|
|
35
|
+
/(?:max|min|poolSize|connectionLimit)\s*:\s*(\d+)/gi,
|
|
36
|
+
/max_connections\s*[=:]\s*(\d+)/gi,
|
|
37
|
+
/pool_size\s*[=:]\s*(\d+)/gi,
|
|
38
|
+
/CONNECTION_POOL_SIZE\s*[=:]\s*(\d+)/gi,
|
|
39
|
+
// Python
|
|
40
|
+
/pool_size\s*=\s*(\d+)/gi,
|
|
41
|
+
/max_overflow\s*=\s*(\d+)/gi,
|
|
42
|
+
/POOL_SIZE\s*=\s*(\d+)/gi,
|
|
43
|
+
];
|
|
44
|
+
export const CONNECTION_TIMEOUT_PATTERNS = [
|
|
45
|
+
/(?:connectionTimeout|connectTimeout|acquireTimeout)\s*:\s*(\d+)/gi,
|
|
46
|
+
/connection_timeout\s*[=:]\s*(\d+)/gi,
|
|
47
|
+
/timeout\s*:\s*(\d+)/gi,
|
|
48
|
+
];
|
|
49
|
+
export const IDLE_TIMEOUT_PATTERNS = [
|
|
50
|
+
/(?:idleTimeout|idleTimeoutMillis|idle_timeout)\s*:\s*(\d+)/gi,
|
|
51
|
+
/evictionRunIntervalMillis\s*:\s*(\d+)/gi,
|
|
52
|
+
/softIdleTimeoutMillis\s*:\s*(\d+)/gi,
|
|
53
|
+
];
|
|
54
|
+
export const CONNECTION_ACQUIRE_PATTERNS = [
|
|
55
|
+
// JavaScript/TypeScript
|
|
56
|
+
/\.getConnection\s*\(/gi,
|
|
57
|
+
/\.acquire\s*\(/gi,
|
|
58
|
+
/\.connect\s*\(/gi,
|
|
59
|
+
/pool\.query\s*\(/gi,
|
|
60
|
+
// Python
|
|
61
|
+
/engine\.connect\s*\(/gi,
|
|
62
|
+
/\.get_connection\s*\(/gi,
|
|
63
|
+
/connection_pool\.getconn\s*\(/gi,
|
|
64
|
+
/pool\.connection\s*\(/gi,
|
|
65
|
+
];
|
|
66
|
+
export const CONNECTION_RELEASE_PATTERNS = [
|
|
67
|
+
// JavaScript/TypeScript
|
|
68
|
+
/\.release\s*\(/gi,
|
|
69
|
+
/\.end\s*\(/gi,
|
|
70
|
+
/\.destroy\s*\(/gi,
|
|
71
|
+
/connection\.close\s*\(/gi,
|
|
72
|
+
// Python
|
|
73
|
+
/connection\.close\s*\(/gi,
|
|
74
|
+
/\.putconn\s*\(/gi,
|
|
75
|
+
/\.dispose\s*\(/gi,
|
|
76
|
+
/session\.close\s*\(/gi,
|
|
77
|
+
];
|
|
78
|
+
export const CONNECTION_LEAK_PATTERNS = [
|
|
79
|
+
/getConnection\s*\([^)]*\)[^]*?(?!\.release|\.end|finally)/gis,
|
|
80
|
+
];
|
|
81
|
+
// ============================================================================
|
|
82
|
+
// Analysis Functions
|
|
83
|
+
// ============================================================================
|
|
84
|
+
export function shouldExcludeFile(filePath) {
|
|
85
|
+
const excludePatterns = [
|
|
86
|
+
/\.test\.[jt]sx?$/,
|
|
87
|
+
/\.spec\.[jt]sx?$/,
|
|
88
|
+
/__tests__\//,
|
|
89
|
+
/\.d\.ts$/,
|
|
90
|
+
/node_modules\//,
|
|
91
|
+
];
|
|
92
|
+
return excludePatterns.some((p) => p.test(filePath));
|
|
93
|
+
}
|
|
94
|
+
export function detectPoolConfig(content) {
|
|
95
|
+
const results = [];
|
|
96
|
+
const lines = content.split('\n');
|
|
97
|
+
for (let i = 0; i < lines.length; i++) {
|
|
98
|
+
const line = lines[i];
|
|
99
|
+
for (const pattern of POOL_CONFIG_PATTERNS) {
|
|
100
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
101
|
+
let match;
|
|
102
|
+
while ((match = regex.exec(line)) !== null) {
|
|
103
|
+
results.push({
|
|
104
|
+
type: 'pool-config',
|
|
105
|
+
line: i + 1,
|
|
106
|
+
column: match.index + 1,
|
|
107
|
+
match: match[0],
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return results;
|
|
113
|
+
}
|
|
114
|
+
export function detectPoolSize(content) {
|
|
115
|
+
const results = [];
|
|
116
|
+
const lines = content.split('\n');
|
|
117
|
+
for (let i = 0; i < lines.length; i++) {
|
|
118
|
+
const line = lines[i];
|
|
119
|
+
for (const pattern of POOL_SIZE_PATTERNS) {
|
|
120
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
121
|
+
let match;
|
|
122
|
+
while ((match = regex.exec(line)) !== null) {
|
|
123
|
+
results.push({
|
|
124
|
+
type: 'pool-size',
|
|
125
|
+
line: i + 1,
|
|
126
|
+
column: match.index + 1,
|
|
127
|
+
match: match[0],
|
|
128
|
+
value: match[1],
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return results;
|
|
134
|
+
}
|
|
135
|
+
export function detectConnectionTimeout(content) {
|
|
136
|
+
const results = [];
|
|
137
|
+
const lines = content.split('\n');
|
|
138
|
+
for (let i = 0; i < lines.length; i++) {
|
|
139
|
+
const line = lines[i];
|
|
140
|
+
for (const pattern of CONNECTION_TIMEOUT_PATTERNS) {
|
|
141
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
142
|
+
let match;
|
|
143
|
+
while ((match = regex.exec(line)) !== null) {
|
|
144
|
+
results.push({
|
|
145
|
+
type: 'connection-timeout',
|
|
146
|
+
line: i + 1,
|
|
147
|
+
column: match.index + 1,
|
|
148
|
+
match: match[0],
|
|
149
|
+
value: match[1],
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return results;
|
|
155
|
+
}
|
|
156
|
+
export function detectIdleTimeout(content) {
|
|
157
|
+
const results = [];
|
|
158
|
+
const lines = content.split('\n');
|
|
159
|
+
for (let i = 0; i < lines.length; i++) {
|
|
160
|
+
const line = lines[i];
|
|
161
|
+
for (const pattern of IDLE_TIMEOUT_PATTERNS) {
|
|
162
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
163
|
+
let match;
|
|
164
|
+
while ((match = regex.exec(line)) !== null) {
|
|
165
|
+
results.push({
|
|
166
|
+
type: 'idle-timeout',
|
|
167
|
+
line: i + 1,
|
|
168
|
+
column: match.index + 1,
|
|
169
|
+
match: match[0],
|
|
170
|
+
value: match[1],
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return results;
|
|
176
|
+
}
|
|
177
|
+
export function detectConnectionAcquire(content) {
|
|
178
|
+
const results = [];
|
|
179
|
+
const lines = content.split('\n');
|
|
180
|
+
for (let i = 0; i < lines.length; i++) {
|
|
181
|
+
const line = lines[i];
|
|
182
|
+
for (const pattern of CONNECTION_ACQUIRE_PATTERNS) {
|
|
183
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
184
|
+
let match;
|
|
185
|
+
while ((match = regex.exec(line)) !== null) {
|
|
186
|
+
results.push({
|
|
187
|
+
type: 'connection-acquire',
|
|
188
|
+
line: i + 1,
|
|
189
|
+
column: match.index + 1,
|
|
190
|
+
match: match[0],
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return results;
|
|
196
|
+
}
|
|
197
|
+
export function detectConnectionRelease(content) {
|
|
198
|
+
const results = [];
|
|
199
|
+
const lines = content.split('\n');
|
|
200
|
+
for (let i = 0; i < lines.length; i++) {
|
|
201
|
+
const line = lines[i];
|
|
202
|
+
for (const pattern of CONNECTION_RELEASE_PATTERNS) {
|
|
203
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
204
|
+
let match;
|
|
205
|
+
while ((match = regex.exec(line)) !== null) {
|
|
206
|
+
results.push({
|
|
207
|
+
type: 'connection-release',
|
|
208
|
+
line: i + 1,
|
|
209
|
+
column: match.index + 1,
|
|
210
|
+
match: match[0],
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return results;
|
|
216
|
+
}
|
|
217
|
+
export function analyzeConnectionPooling(content, filePath) {
|
|
218
|
+
if (shouldExcludeFile(filePath)) {
|
|
219
|
+
return {
|
|
220
|
+
patterns: [],
|
|
221
|
+
violations: [],
|
|
222
|
+
hasPoolConfig: false,
|
|
223
|
+
poolSettings: {},
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
const patterns = [
|
|
227
|
+
...detectPoolConfig(content),
|
|
228
|
+
...detectPoolSize(content),
|
|
229
|
+
...detectConnectionTimeout(content),
|
|
230
|
+
...detectIdleTimeout(content),
|
|
231
|
+
...detectConnectionAcquire(content),
|
|
232
|
+
...detectConnectionRelease(content),
|
|
233
|
+
];
|
|
234
|
+
const violations = [];
|
|
235
|
+
// Check for connection acquire without release
|
|
236
|
+
const acquires = patterns.filter((p) => p.type === 'connection-acquire');
|
|
237
|
+
const releases = patterns.filter((p) => p.type === 'connection-release');
|
|
238
|
+
if (acquires.length > 0 && releases.length === 0) {
|
|
239
|
+
violations.push({
|
|
240
|
+
type: 'connection-leak',
|
|
241
|
+
line: acquires[0].line,
|
|
242
|
+
column: acquires[0].column,
|
|
243
|
+
match: acquires[0].match,
|
|
244
|
+
message: 'Connection acquired but no release detected - potential connection leak',
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
// Extract pool settings
|
|
248
|
+
const poolSettings = {};
|
|
249
|
+
for (const pattern of patterns) {
|
|
250
|
+
if (pattern.value) {
|
|
251
|
+
poolSettings[pattern.type] = pattern.value;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const hasPoolConfig = patterns.some((p) => p.type === 'pool-config' || p.type === 'pool-size');
|
|
255
|
+
return {
|
|
256
|
+
patterns,
|
|
257
|
+
violations,
|
|
258
|
+
hasPoolConfig,
|
|
259
|
+
poolSettings,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
// ============================================================================
|
|
263
|
+
// Detector Class
|
|
264
|
+
// ============================================================================
|
|
265
|
+
export class ConnectionPoolingDetector extends RegexDetector {
|
|
266
|
+
id = 'data-access/connection-pooling';
|
|
267
|
+
name = 'Connection Pooling Detector';
|
|
268
|
+
description = 'Detects database connection pooling patterns and potential leaks';
|
|
269
|
+
category = 'data-access';
|
|
270
|
+
subcategory = 'connection-pooling';
|
|
271
|
+
supportedLanguages = ['typescript', 'javascript', 'python'];
|
|
272
|
+
async detect(context) {
|
|
273
|
+
if (!this.supportsLanguage(context.language)) {
|
|
274
|
+
return this.createEmptyResult();
|
|
275
|
+
}
|
|
276
|
+
const analysis = analyzeConnectionPooling(context.content, context.file);
|
|
277
|
+
if (analysis.patterns.length === 0 && analysis.violations.length === 0) {
|
|
278
|
+
return this.createEmptyResult();
|
|
279
|
+
}
|
|
280
|
+
const confidence = analysis.hasPoolConfig ? 0.9 : 0.7;
|
|
281
|
+
return this.createResult([], [], confidence, {
|
|
282
|
+
custom: {
|
|
283
|
+
patterns: analysis.patterns,
|
|
284
|
+
violations: analysis.violations,
|
|
285
|
+
hasPoolConfig: analysis.hasPoolConfig,
|
|
286
|
+
poolSettings: analysis.poolSettings,
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
generateQuickFix(_violation) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
export function createConnectionPoolingDetector() {
|
|
295
|
+
return new ConnectionPoolingDetector();
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=connection-pooling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-pooling.js","sourceRoot":"","sources":["../../src/data-access/connection-pooling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AA2C1D,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAE/E,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,wBAAwB;IACxB,iBAAiB;IACjB,2BAA2B;IAC3B,uBAAuB;IACvB,mBAAmB;IACnB,aAAa;IACb,SAAS;IACT,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,+BAA+B;IAC/B,aAAa;IACb,YAAY;IACZ,cAAc;IACd,yBAAyB;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,wBAAwB;IACxB,oDAAoD;IACpD,kCAAkC;IAClC,4BAA4B;IAC5B,uCAAuC;IACvC,SAAS;IACT,yBAAyB;IACzB,4BAA4B;IAC5B,yBAAyB;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,mEAAmE;IACnE,qCAAqC;IACrC,uBAAuB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,8DAA8D;IAC9D,yCAAyC;IACzC,qCAAqC;CACtC,CAAC;AAE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AAC,aAAa;gBACrC,YAAY,EAAE,QAAQ,CAAC,YAAY;aACpC;SACF,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB,CAAC,UAAqB;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,UAAU,+BAA+B;IAC7C,OAAO,IAAI,yBAAyB,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DTO Patterns Detector - Data Transfer Object pattern detection
|
|
3
|
+
*
|
|
4
|
+
* Detects DTO patterns including:
|
|
5
|
+
* - DTO class definitions
|
|
6
|
+
* - DTO interfaces
|
|
7
|
+
* - Mapper functions
|
|
8
|
+
* - Transformation patterns
|
|
9
|
+
*
|
|
10
|
+
* @requirements 13.5 - DTO pattern detection
|
|
11
|
+
*/
|
|
12
|
+
import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
|
|
13
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
14
|
+
import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
|
|
15
|
+
export type DTOPatternType = 'dto-class' | 'dto-interface' | 'dto-type' | 'mapper-function' | 'transformer-class' | 'serializer';
|
|
16
|
+
export type DTOViolationType = 'missing-dto' | 'entity-exposure' | 'inconsistent-naming';
|
|
17
|
+
export interface DTOPatternInfo {
|
|
18
|
+
type: DTOPatternType;
|
|
19
|
+
line: number;
|
|
20
|
+
column: number;
|
|
21
|
+
match: string;
|
|
22
|
+
name?: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
export interface DTOViolationInfo {
|
|
25
|
+
type: DTOViolationType;
|
|
26
|
+
line: number;
|
|
27
|
+
column: number;
|
|
28
|
+
match: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
export interface DTOAnalysis {
|
|
32
|
+
patterns: DTOPatternInfo[];
|
|
33
|
+
violations: DTOViolationInfo[];
|
|
34
|
+
hasDTOs: boolean;
|
|
35
|
+
dtoCount: number;
|
|
36
|
+
}
|
|
37
|
+
export declare const DTO_CLASS_PATTERNS: RegExp[];
|
|
38
|
+
export declare const DTO_INTERFACE_PATTERNS: RegExp[];
|
|
39
|
+
export declare const DTO_TYPE_PATTERNS: RegExp[];
|
|
40
|
+
export declare const MAPPER_FUNCTION_PATTERNS: RegExp[];
|
|
41
|
+
export declare const TRANSFORMER_CLASS_PATTERNS: RegExp[];
|
|
42
|
+
export declare const SERIALIZER_PATTERNS: RegExp[];
|
|
43
|
+
export declare const ENTITY_EXPOSURE_PATTERNS: RegExp[];
|
|
44
|
+
export declare function shouldExcludeFile(filePath: string): boolean;
|
|
45
|
+
export declare function detectDTOClasses(content: string): DTOPatternInfo[];
|
|
46
|
+
export declare function detectDTOInterfaces(content: string): DTOPatternInfo[];
|
|
47
|
+
export declare function detectDTOTypes(content: string): DTOPatternInfo[];
|
|
48
|
+
export declare function detectMapperFunctions(content: string): DTOPatternInfo[];
|
|
49
|
+
export declare function detectTransformerClasses(content: string): DTOPatternInfo[];
|
|
50
|
+
export declare function detectSerializers(content: string): DTOPatternInfo[];
|
|
51
|
+
export declare function detectEntityExposureViolations(content: string): DTOViolationInfo[];
|
|
52
|
+
export declare function analyzeDTOPatterns(content: string, filePath: string): DTOAnalysis;
|
|
53
|
+
export declare class DTOPatternsDetector extends RegexDetector {
|
|
54
|
+
readonly id = "data-access/dto-patterns";
|
|
55
|
+
readonly name = "DTO Patterns Detector";
|
|
56
|
+
readonly description = "Detects Data Transfer Object patterns and identifies entity exposure";
|
|
57
|
+
readonly category: PatternCategory;
|
|
58
|
+
readonly subcategory = "dto-patterns";
|
|
59
|
+
readonly supportedLanguages: Language[];
|
|
60
|
+
detect(context: DetectionContext): Promise<DetectionResult>;
|
|
61
|
+
generateQuickFix(_violation: Violation): QuickFix | null;
|
|
62
|
+
}
|
|
63
|
+
export declare function createDTOPatternsDetector(): DTOPatternsDetector;
|
|
64
|
+
//# sourceMappingURL=dto-patterns.d.ts.map
|
|
@@ -0,0 +1 @@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
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DTO Patterns Detector - Data Transfer Object pattern detection
|
|
3
|
+
*
|
|
4
|
+
* Detects DTO patterns including:
|
|
5
|
+
* - DTO class definitions
|
|
6
|
+
* - DTO interfaces
|
|
7
|
+
* - Mapper functions
|
|
8
|
+
* - Transformation patterns
|
|
9
|
+
*
|
|
10
|
+
* @requirements 13.5 - DTO pattern detection
|
|
11
|
+
*/
|
|
12
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Patterns
|
|
15
|
+
// ============================================================================
|
|
16
|
+
export const DTO_CLASS_PATTERNS = [
|
|
17
|
+
// JavaScript/TypeScript
|
|
18
|
+
/class\s+(\w+(?:DTO|Dto|Request|Response|Input|Output))\s*(?:extends|implements|\{)/gi,
|
|
19
|
+
/export\s+class\s+(\w+(?:DTO|Dto))/gi,
|
|
20
|
+
// Python
|
|
21
|
+
/class\s+(\w+(?:DTO|Dto|Request|Response|Input|Output))\s*\(/gi,
|
|
22
|
+
/class\s+(\w+(?:Schema|Model))\s*\(\s*(?:BaseModel|Schema)\s*\)/gi, // Pydantic
|
|
23
|
+
/@dataclass/gi,
|
|
24
|
+
];
|
|
25
|
+
export const DTO_INTERFACE_PATTERNS = [
|
|
26
|
+
/interface\s+(\w+(?:DTO|Dto|Request|Response|Input|Output))/gi,
|
|
27
|
+
/export\s+interface\s+(\w+(?:DTO|Dto))/gi,
|
|
28
|
+
];
|
|
29
|
+
export const DTO_TYPE_PATTERNS = [
|
|
30
|
+
/type\s+(\w+(?:DTO|Dto|Request|Response|Input|Output))\s*=/gi,
|
|
31
|
+
/export\s+type\s+(\w+(?:DTO|Dto))\s*=/gi,
|
|
32
|
+
];
|
|
33
|
+
export const MAPPER_FUNCTION_PATTERNS = [
|
|
34
|
+
// JavaScript/TypeScript
|
|
35
|
+
/function\s+(to\w+|from\w+|map\w+|transform\w+)\s*\(/gi,
|
|
36
|
+
/const\s+(to\w+|from\w+|map\w+|transform\w+)\s*=\s*(?:\([^)]*\)|[^=])\s*=>/gi,
|
|
37
|
+
/(\w+)\.toDTO\s*\(/gi,
|
|
38
|
+
/(\w+)\.fromDTO\s*\(/gi,
|
|
39
|
+
// Python
|
|
40
|
+
/def\s+(to_\w+|from_\w+|map_\w+|transform_\w+)\s*\(/gi,
|
|
41
|
+
/def\s+(to_dict|from_dict|to_model|from_model)\s*\(/gi,
|
|
42
|
+
/\.model_dump\s*\(/gi, // Pydantic v2
|
|
43
|
+
/\.dict\s*\(/gi, // Pydantic v1
|
|
44
|
+
/\.model_validate\s*\(/gi, // Pydantic v2
|
|
45
|
+
/\.parse_obj\s*\(/gi, // Pydantic v1
|
|
46
|
+
];
|
|
47
|
+
export const TRANSFORMER_CLASS_PATTERNS = [
|
|
48
|
+
/class\s+(\w+(?:Transformer|Mapper|Converter))/gi,
|
|
49
|
+
/@Transform\s*\(/gi,
|
|
50
|
+
/class-transformer/gi,
|
|
51
|
+
];
|
|
52
|
+
export const SERIALIZER_PATTERNS = [
|
|
53
|
+
// JavaScript/TypeScript
|
|
54
|
+
/class\s+(\w+Serializer)/gi,
|
|
55
|
+
/\.serialize\s*\(/gi,
|
|
56
|
+
/\.deserialize\s*\(/gi,
|
|
57
|
+
/JSON\.stringify\s*\(/gi,
|
|
58
|
+
/JSON\.parse\s*\(/gi,
|
|
59
|
+
// Python
|
|
60
|
+
/class\s+(\w+Serializer)\s*\(/gi,
|
|
61
|
+
/json\.dumps\s*\(/gi,
|
|
62
|
+
/json\.loads\s*\(/gi,
|
|
63
|
+
/\.json\s*\(\s*\)/gi, // Pydantic .json()
|
|
64
|
+
/jsonable_encoder\s*\(/gi, // FastAPI
|
|
65
|
+
];
|
|
66
|
+
export const ENTITY_EXPOSURE_PATTERNS = [
|
|
67
|
+
/return\s+(?:await\s+)?(?:this\.)?(?:prisma|db)\.\w+\.(find|create|update)/gi,
|
|
68
|
+
/res\.(?:json|send)\s*\(\s*(?:await\s+)?(?:this\.)?(?:prisma|db)\./gi,
|
|
69
|
+
];
|
|
70
|
+
// ============================================================================
|
|
71
|
+
// Analysis Functions
|
|
72
|
+
// ============================================================================
|
|
73
|
+
export function shouldExcludeFile(filePath) {
|
|
74
|
+
const excludePatterns = [
|
|
75
|
+
/\.test\.[jt]sx?$/,
|
|
76
|
+
/\.spec\.[jt]sx?$/,
|
|
77
|
+
/__tests__\//,
|
|
78
|
+
/\.d\.ts$/,
|
|
79
|
+
/node_modules\//,
|
|
80
|
+
];
|
|
81
|
+
return excludePatterns.some((p) => p.test(filePath));
|
|
82
|
+
}
|
|
83
|
+
export function detectDTOClasses(content) {
|
|
84
|
+
const results = [];
|
|
85
|
+
const lines = content.split('\n');
|
|
86
|
+
for (let i = 0; i < lines.length; i++) {
|
|
87
|
+
const line = lines[i];
|
|
88
|
+
for (const pattern of DTO_CLASS_PATTERNS) {
|
|
89
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
90
|
+
let match;
|
|
91
|
+
while ((match = regex.exec(line)) !== null) {
|
|
92
|
+
results.push({
|
|
93
|
+
type: 'dto-class',
|
|
94
|
+
line: i + 1,
|
|
95
|
+
column: match.index + 1,
|
|
96
|
+
match: match[0],
|
|
97
|
+
name: match[1],
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return results;
|
|
103
|
+
}
|
|
104
|
+
export function detectDTOInterfaces(content) {
|
|
105
|
+
const results = [];
|
|
106
|
+
const lines = content.split('\n');
|
|
107
|
+
for (let i = 0; i < lines.length; i++) {
|
|
108
|
+
const line = lines[i];
|
|
109
|
+
for (const pattern of DTO_INTERFACE_PATTERNS) {
|
|
110
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
111
|
+
let match;
|
|
112
|
+
while ((match = regex.exec(line)) !== null) {
|
|
113
|
+
results.push({
|
|
114
|
+
type: 'dto-interface',
|
|
115
|
+
line: i + 1,
|
|
116
|
+
column: match.index + 1,
|
|
117
|
+
match: match[0],
|
|
118
|
+
name: match[1],
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return results;
|
|
124
|
+
}
|
|
125
|
+
export function detectDTOTypes(content) {
|
|
126
|
+
const results = [];
|
|
127
|
+
const lines = content.split('\n');
|
|
128
|
+
for (let i = 0; i < lines.length; i++) {
|
|
129
|
+
const line = lines[i];
|
|
130
|
+
for (const pattern of DTO_TYPE_PATTERNS) {
|
|
131
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
132
|
+
let match;
|
|
133
|
+
while ((match = regex.exec(line)) !== null) {
|
|
134
|
+
results.push({
|
|
135
|
+
type: 'dto-type',
|
|
136
|
+
line: i + 1,
|
|
137
|
+
column: match.index + 1,
|
|
138
|
+
match: match[0],
|
|
139
|
+
name: match[1],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return results;
|
|
145
|
+
}
|
|
146
|
+
export function detectMapperFunctions(content) {
|
|
147
|
+
const results = [];
|
|
148
|
+
const lines = content.split('\n');
|
|
149
|
+
for (let i = 0; i < lines.length; i++) {
|
|
150
|
+
const line = lines[i];
|
|
151
|
+
for (const pattern of MAPPER_FUNCTION_PATTERNS) {
|
|
152
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
153
|
+
let match;
|
|
154
|
+
while ((match = regex.exec(line)) !== null) {
|
|
155
|
+
results.push({
|
|
156
|
+
type: 'mapper-function',
|
|
157
|
+
line: i + 1,
|
|
158
|
+
column: match.index + 1,
|
|
159
|
+
match: match[0],
|
|
160
|
+
name: match[1],
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return results;
|
|
166
|
+
}
|
|
167
|
+
export function detectTransformerClasses(content) {
|
|
168
|
+
const results = [];
|
|
169
|
+
const lines = content.split('\n');
|
|
170
|
+
for (let i = 0; i < lines.length; i++) {
|
|
171
|
+
const line = lines[i];
|
|
172
|
+
for (const pattern of TRANSFORMER_CLASS_PATTERNS) {
|
|
173
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
174
|
+
let match;
|
|
175
|
+
while ((match = regex.exec(line)) !== null) {
|
|
176
|
+
results.push({
|
|
177
|
+
type: 'transformer-class',
|
|
178
|
+
line: i + 1,
|
|
179
|
+
column: match.index + 1,
|
|
180
|
+
match: match[0],
|
|
181
|
+
name: match[1],
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return results;
|
|
187
|
+
}
|
|
188
|
+
export function detectSerializers(content) {
|
|
189
|
+
const results = [];
|
|
190
|
+
const lines = content.split('\n');
|
|
191
|
+
for (let i = 0; i < lines.length; i++) {
|
|
192
|
+
const line = lines[i];
|
|
193
|
+
for (const pattern of SERIALIZER_PATTERNS) {
|
|
194
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
195
|
+
let match;
|
|
196
|
+
while ((match = regex.exec(line)) !== null) {
|
|
197
|
+
results.push({
|
|
198
|
+
type: 'serializer',
|
|
199
|
+
line: i + 1,
|
|
200
|
+
column: match.index + 1,
|
|
201
|
+
match: match[0],
|
|
202
|
+
name: match[1],
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return results;
|
|
208
|
+
}
|
|
209
|
+
export function detectEntityExposureViolations(content) {
|
|
210
|
+
const results = [];
|
|
211
|
+
const lines = content.split('\n');
|
|
212
|
+
for (let i = 0; i < lines.length; i++) {
|
|
213
|
+
const line = lines[i];
|
|
214
|
+
for (const pattern of ENTITY_EXPOSURE_PATTERNS) {
|
|
215
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
216
|
+
let match;
|
|
217
|
+
while ((match = regex.exec(line)) !== null) {
|
|
218
|
+
results.push({
|
|
219
|
+
type: 'entity-exposure',
|
|
220
|
+
line: i + 1,
|
|
221
|
+
column: match.index + 1,
|
|
222
|
+
match: match[0],
|
|
223
|
+
message: 'Direct entity exposure detected - consider using DTOs',
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return results;
|
|
229
|
+
}
|
|
230
|
+
export function analyzeDTOPatterns(content, filePath) {
|
|
231
|
+
if (shouldExcludeFile(filePath)) {
|
|
232
|
+
return {
|
|
233
|
+
patterns: [],
|
|
234
|
+
violations: [],
|
|
235
|
+
hasDTOs: false,
|
|
236
|
+
dtoCount: 0,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const patterns = [
|
|
240
|
+
...detectDTOClasses(content),
|
|
241
|
+
...detectDTOInterfaces(content),
|
|
242
|
+
...detectDTOTypes(content),
|
|
243
|
+
...detectMapperFunctions(content),
|
|
244
|
+
...detectTransformerClasses(content),
|
|
245
|
+
...detectSerializers(content),
|
|
246
|
+
];
|
|
247
|
+
const violations = detectEntityExposureViolations(content);
|
|
248
|
+
const dtoDefinitions = patterns.filter((p) => p.type === 'dto-class' || p.type === 'dto-interface' || p.type === 'dto-type');
|
|
249
|
+
return {
|
|
250
|
+
patterns,
|
|
251
|
+
violations,
|
|
252
|
+
hasDTOs: dtoDefinitions.length > 0,
|
|
253
|
+
dtoCount: dtoDefinitions.length,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
// ============================================================================
|
|
257
|
+
// Detector Class
|
|
258
|
+
// ============================================================================
|
|
259
|
+
export class DTOPatternsDetector extends RegexDetector {
|
|
260
|
+
id = 'data-access/dto-patterns';
|
|
261
|
+
name = 'DTO Patterns Detector';
|
|
262
|
+
description = 'Detects Data Transfer Object patterns and identifies entity exposure';
|
|
263
|
+
category = 'data-access';
|
|
264
|
+
subcategory = 'dto-patterns';
|
|
265
|
+
supportedLanguages = ['typescript', 'javascript', 'python'];
|
|
266
|
+
async detect(context) {
|
|
267
|
+
if (!this.supportsLanguage(context.language)) {
|
|
268
|
+
return this.createEmptyResult();
|
|
269
|
+
}
|
|
270
|
+
const analysis = analyzeDTOPatterns(context.content, context.file);
|
|
271
|
+
if (analysis.patterns.length === 0 && analysis.violations.length === 0) {
|
|
272
|
+
return this.createEmptyResult();
|
|
273
|
+
}
|
|
274
|
+
const confidence = analysis.hasDTOs ? 0.9 : 0.7;
|
|
275
|
+
return this.createResult([], [], confidence, {
|
|
276
|
+
custom: {
|
|
277
|
+
patterns: analysis.patterns,
|
|
278
|
+
violations: analysis.violations,
|
|
279
|
+
hasDTOs: analysis.hasDTOs,
|
|
280
|
+
dtoCount: analysis.dtoCount,
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
generateQuickFix(_violation) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
export function createDTOPatternsDetector() {
|
|
289
|
+
return new DTOPatternsDetector();
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=dto-patterns.js.map
|