driftdetect-core 0.4.6 → 0.5.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/call-graph/extractors/csharp-data-access-extractor.d.ts +8 -0
- package/dist/call-graph/extractors/csharp-data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/csharp-data-access-extractor.js +8 -0
- package/dist/call-graph/extractors/csharp-data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/csharp-extractor.d.ts +35 -0
- package/dist/call-graph/extractors/csharp-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/csharp-extractor.js +362 -4
- package/dist/call-graph/extractors/csharp-extractor.js.map +1 -1
- package/dist/call-graph/extractors/csharp-hybrid-extractor.d.ts +37 -0
- package/dist/call-graph/extractors/csharp-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/csharp-hybrid-extractor.js +408 -0
- package/dist/call-graph/extractors/csharp-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/extractors/hybrid-extractor-base.d.ts +102 -0
- package/dist/call-graph/extractors/hybrid-extractor-base.d.ts.map +1 -0
- package/dist/call-graph/extractors/hybrid-extractor-base.js +289 -0
- package/dist/call-graph/extractors/hybrid-extractor-base.js.map +1 -0
- package/dist/call-graph/extractors/index.d.ts +17 -13
- package/dist/call-graph/extractors/index.d.ts.map +1 -1
- package/dist/call-graph/extractors/index.js +24 -23
- package/dist/call-graph/extractors/index.js.map +1 -1
- package/dist/call-graph/extractors/java-data-access-extractor.d.ts +8 -0
- package/dist/call-graph/extractors/java-data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/java-data-access-extractor.js +8 -0
- package/dist/call-graph/extractors/java-data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/java-extractor.d.ts +15 -0
- package/dist/call-graph/extractors/java-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/java-extractor.js +120 -4
- package/dist/call-graph/extractors/java-extractor.js.map +1 -1
- package/dist/call-graph/extractors/java-hybrid-extractor.d.ts +36 -0
- package/dist/call-graph/extractors/java-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/java-hybrid-extractor.js +426 -0
- package/dist/call-graph/extractors/java-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/extractors/php-data-access-extractor.d.ts +8 -0
- package/dist/call-graph/extractors/php-data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/php-data-access-extractor.js +8 -0
- package/dist/call-graph/extractors/php-data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/php-extractor.d.ts +48 -1
- package/dist/call-graph/extractors/php-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/php-extractor.js +460 -6
- package/dist/call-graph/extractors/php-extractor.js.map +1 -1
- package/dist/call-graph/extractors/php-hybrid-extractor.d.ts +35 -0
- package/dist/call-graph/extractors/php-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/php-hybrid-extractor.js +393 -0
- package/dist/call-graph/extractors/php-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/extractors/python-data-access-extractor.d.ts +8 -0
- package/dist/call-graph/extractors/python-data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/python-data-access-extractor.js +8 -0
- package/dist/call-graph/extractors/python-data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/python-hybrid-extractor.d.ts +85 -0
- package/dist/call-graph/extractors/python-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/python-hybrid-extractor.js +462 -0
- package/dist/call-graph/extractors/python-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/extractors/regex/base-regex-extractor.d.ts +154 -0
- package/dist/call-graph/extractors/regex/base-regex-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/base-regex-extractor.js +346 -0
- package/dist/call-graph/extractors/regex/base-regex-extractor.js.map +1 -0
- package/dist/call-graph/extractors/regex/csharp-regex.d.ts +34 -0
- package/dist/call-graph/extractors/regex/csharp-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/csharp-regex.js +393 -0
- package/dist/call-graph/extractors/regex/csharp-regex.js.map +1 -0
- package/dist/call-graph/extractors/regex/index.d.ts +25 -0
- package/dist/call-graph/extractors/regex/index.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/index.js +66 -0
- package/dist/call-graph/extractors/regex/index.js.map +1 -0
- package/dist/call-graph/extractors/regex/java-regex.d.ts +34 -0
- package/dist/call-graph/extractors/regex/java-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/java-regex.js +327 -0
- package/dist/call-graph/extractors/regex/java-regex.js.map +1 -0
- package/dist/call-graph/extractors/regex/php-regex.d.ts +30 -0
- package/dist/call-graph/extractors/regex/php-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/php-regex.js +333 -0
- package/dist/call-graph/extractors/regex/php-regex.js.map +1 -0
- package/dist/call-graph/extractors/regex/python-regex.d.ts +46 -0
- package/dist/call-graph/extractors/regex/python-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/python-regex.js +380 -0
- package/dist/call-graph/extractors/regex/python-regex.js.map +1 -0
- package/dist/call-graph/extractors/regex/typescript-regex.d.ts +27 -0
- package/dist/call-graph/extractors/regex/typescript-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/typescript-regex.js +349 -0
- package/dist/call-graph/extractors/regex/typescript-regex.js.map +1 -0
- package/dist/call-graph/extractors/semantic-data-access-scanner.d.ts +7 -0
- package/dist/call-graph/extractors/semantic-data-access-scanner.d.ts.map +1 -1
- package/dist/call-graph/extractors/semantic-data-access-scanner.js +7 -0
- package/dist/call-graph/extractors/semantic-data-access-scanner.js.map +1 -1
- package/dist/call-graph/extractors/types.d.ts +111 -0
- package/dist/call-graph/extractors/types.d.ts.map +1 -0
- package/dist/call-graph/extractors/types.js +68 -0
- package/dist/call-graph/extractors/types.js.map +1 -0
- package/dist/call-graph/extractors/typescript-data-access-extractor.d.ts +8 -0
- package/dist/call-graph/extractors/typescript-data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/typescript-data-access-extractor.js +8 -0
- package/dist/call-graph/extractors/typescript-data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/typescript-hybrid-extractor.d.ts +116 -0
- package/dist/call-graph/extractors/typescript-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/typescript-hybrid-extractor.js +635 -0
- package/dist/call-graph/extractors/typescript-hybrid-extractor.js.map +1 -0
- package/dist/error-handling/error-handling-analyzer.d.ts +73 -0
- package/dist/error-handling/error-handling-analyzer.d.ts.map +1 -0
- package/dist/error-handling/error-handling-analyzer.js +706 -0
- package/dist/error-handling/error-handling-analyzer.js.map +1 -0
- package/dist/error-handling/index.d.ts +8 -0
- package/dist/error-handling/index.d.ts.map +1 -0
- package/dist/error-handling/index.js +8 -0
- package/dist/error-handling/index.js.map +1 -0
- package/dist/error-handling/types.d.ts +307 -0
- package/dist/error-handling/types.d.ts.map +1 -0
- package/dist/error-handling/types.js +7 -0
- package/dist/error-handling/types.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/lake/pattern-shard-store.d.ts +6 -0
- package/dist/lake/pattern-shard-store.d.ts.map +1 -1
- package/dist/lake/pattern-shard-store.js +6 -0
- package/dist/lake/pattern-shard-store.js.map +1 -1
- package/dist/module-coupling/coupling-analyzer.d.ts +73 -0
- package/dist/module-coupling/coupling-analyzer.d.ts.map +1 -0
- package/dist/module-coupling/coupling-analyzer.js +668 -0
- package/dist/module-coupling/coupling-analyzer.js.map +1 -0
- package/dist/module-coupling/index.d.ts +9 -0
- package/dist/module-coupling/index.d.ts.map +1 -0
- package/dist/module-coupling/index.js +9 -0
- package/dist/module-coupling/index.js.map +1 -0
- package/dist/module-coupling/types.d.ts +273 -0
- package/dist/module-coupling/types.d.ts.map +1 -0
- package/dist/module-coupling/types.js +8 -0
- package/dist/module-coupling/types.js.map +1 -0
- package/dist/patterns/adapters/index.d.ts +11 -0
- package/dist/patterns/adapters/index.d.ts.map +1 -0
- package/dist/patterns/adapters/index.js +11 -0
- package/dist/patterns/adapters/index.js.map +1 -0
- package/dist/patterns/adapters/pattern-store-adapter.d.ts +59 -0
- package/dist/patterns/adapters/pattern-store-adapter.d.ts.map +1 -0
- package/dist/patterns/adapters/pattern-store-adapter.js +468 -0
- package/dist/patterns/adapters/pattern-store-adapter.js.map +1 -0
- package/dist/patterns/adapters/service-factory.d.ts +40 -0
- package/dist/patterns/adapters/service-factory.d.ts.map +1 -0
- package/dist/patterns/adapters/service-factory.js +144 -0
- package/dist/patterns/adapters/service-factory.js.map +1 -0
- package/dist/patterns/errors.d.ts +32 -0
- package/dist/patterns/errors.d.ts.map +1 -0
- package/dist/patterns/errors.js +45 -0
- package/dist/patterns/errors.js.map +1 -0
- package/dist/patterns/impl/cached-repository.d.ts +79 -0
- package/dist/patterns/impl/cached-repository.d.ts.map +1 -0
- package/dist/patterns/impl/cached-repository.js +296 -0
- package/dist/patterns/impl/cached-repository.js.map +1 -0
- package/dist/patterns/impl/file-repository.d.ts +75 -0
- package/dist/patterns/impl/file-repository.d.ts.map +1 -0
- package/dist/patterns/impl/file-repository.js +507 -0
- package/dist/patterns/impl/file-repository.js.map +1 -0
- package/dist/patterns/impl/index.d.ts +16 -0
- package/dist/patterns/impl/index.d.ts.map +1 -0
- package/dist/patterns/impl/index.js +21 -0
- package/dist/patterns/impl/index.js.map +1 -0
- package/dist/patterns/impl/memory-repository.d.ts +56 -0
- package/dist/patterns/impl/memory-repository.d.ts.map +1 -0
- package/dist/patterns/impl/memory-repository.js +323 -0
- package/dist/patterns/impl/memory-repository.js.map +1 -0
- package/dist/patterns/impl/pattern-service.d.ts +52 -0
- package/dist/patterns/impl/pattern-service.d.ts.map +1 -0
- package/dist/patterns/impl/pattern-service.js +382 -0
- package/dist/patterns/impl/pattern-service.js.map +1 -0
- package/dist/patterns/impl/repository-factory.d.ts +44 -0
- package/dist/patterns/impl/repository-factory.d.ts.map +1 -0
- package/dist/patterns/impl/repository-factory.js +140 -0
- package/dist/patterns/impl/repository-factory.js.map +1 -0
- package/dist/patterns/impl/unified-file-repository.d.ts +111 -0
- package/dist/patterns/impl/unified-file-repository.d.ts.map +1 -0
- package/dist/patterns/impl/unified-file-repository.js +677 -0
- package/dist/patterns/impl/unified-file-repository.js.map +1 -0
- package/dist/patterns/index.d.ts +23 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +41 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/repository.d.ts +241 -0
- package/dist/patterns/repository.d.ts.map +1 -0
- package/dist/patterns/repository.js +23 -0
- package/dist/patterns/repository.js.map +1 -0
- package/dist/patterns/service.d.ts +245 -0
- package/dist/patterns/service.d.ts.map +1 -0
- package/dist/patterns/service.js +25 -0
- package/dist/patterns/service.js.map +1 -0
- package/dist/patterns/types.d.ts +227 -0
- package/dist/patterns/types.d.ts.map +1 -0
- package/dist/patterns/types.js +117 -0
- package/dist/patterns/types.js.map +1 -0
- package/dist/store/pattern-store.d.ts +6 -0
- package/dist/store/pattern-store.d.ts.map +1 -1
- package/dist/store/pattern-store.js +6 -0
- package/dist/store/pattern-store.js.map +1 -1
- package/dist/test-topology/extractors/base-test-extractor.d.ts +89 -0
- package/dist/test-topology/extractors/base-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/base-test-extractor.js +187 -0
- package/dist/test-topology/extractors/base-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/csharp-test-extractor.d.ts +23 -0
- package/dist/test-topology/extractors/csharp-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/csharp-test-extractor.js +367 -0
- package/dist/test-topology/extractors/csharp-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/index.d.ts +12 -0
- package/dist/test-topology/extractors/index.d.ts.map +1 -0
- package/dist/test-topology/extractors/index.js +12 -0
- package/dist/test-topology/extractors/index.js.map +1 -0
- package/dist/test-topology/extractors/java-test-extractor.d.ts +20 -0
- package/dist/test-topology/extractors/java-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/java-test-extractor.js +275 -0
- package/dist/test-topology/extractors/java-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/php-test-extractor.d.ts +24 -0
- package/dist/test-topology/extractors/php-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/php-test-extractor.js +409 -0
- package/dist/test-topology/extractors/php-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/python-test-extractor.d.ts +23 -0
- package/dist/test-topology/extractors/python-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/python-test-extractor.js +342 -0
- package/dist/test-topology/extractors/python-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/regex/csharp-test-regex.d.ts +51 -0
- package/dist/test-topology/extractors/regex/csharp-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/csharp-test-regex.js +383 -0
- package/dist/test-topology/extractors/regex/csharp-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/regex/index.d.ts +18 -0
- package/dist/test-topology/extractors/regex/index.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/index.js +43 -0
- package/dist/test-topology/extractors/regex/index.js.map +1 -0
- package/dist/test-topology/extractors/regex/java-test-regex.d.ts +50 -0
- package/dist/test-topology/extractors/regex/java-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/java-test-regex.js +370 -0
- package/dist/test-topology/extractors/regex/java-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/regex/php-test-regex.d.ts +56 -0
- package/dist/test-topology/extractors/regex/php-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/php-test-regex.js +503 -0
- package/dist/test-topology/extractors/regex/php-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/regex/python-test-regex.d.ts +57 -0
- package/dist/test-topology/extractors/regex/python-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/python-test-regex.js +381 -0
- package/dist/test-topology/extractors/regex/python-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/regex/typescript-test-regex.d.ts +60 -0
- package/dist/test-topology/extractors/regex/typescript-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/typescript-test-regex.js +368 -0
- package/dist/test-topology/extractors/regex/typescript-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/typescript-test-extractor.d.ts +24 -0
- package/dist/test-topology/extractors/typescript-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/typescript-test-extractor.js +266 -0
- package/dist/test-topology/extractors/typescript-test-extractor.js.map +1 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.d.ts +98 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.d.ts.map +1 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.js +555 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.js.map +1 -0
- package/dist/test-topology/index.d.ts +16 -0
- package/dist/test-topology/index.d.ts.map +1 -0
- package/dist/test-topology/index.js +19 -0
- package/dist/test-topology/index.js.map +1 -0
- package/dist/test-topology/test-topology-analyzer.d.ts +85 -0
- package/dist/test-topology/test-topology-analyzer.d.ts.map +1 -0
- package/dist/test-topology/test-topology-analyzer.js +538 -0
- package/dist/test-topology/test-topology-analyzer.js.map +1 -0
- package/dist/test-topology/types.d.ts +300 -0
- package/dist/test-topology/types.d.ts.map +1 -0
- package/dist/test-topology/types.js +7 -0
- package/dist/test-topology/types.js.map +1 -0
- package/dist/wrappers/clustering/clusterer.d.ts +43 -0
- package/dist/wrappers/clustering/clusterer.d.ts.map +1 -0
- package/dist/wrappers/clustering/clusterer.js +374 -0
- package/dist/wrappers/clustering/clusterer.js.map +1 -0
- package/dist/wrappers/clustering/exclusions.d.ts +47 -0
- package/dist/wrappers/clustering/exclusions.d.ts.map +1 -0
- package/dist/wrappers/clustering/exclusions.js +318 -0
- package/dist/wrappers/clustering/exclusions.js.map +1 -0
- package/dist/wrappers/clustering/index.d.ts +6 -0
- package/dist/wrappers/clustering/index.d.ts.map +1 -0
- package/dist/wrappers/clustering/index.js +6 -0
- package/dist/wrappers/clustering/index.js.map +1 -0
- package/dist/wrappers/detection/detector.d.ts +69 -0
- package/dist/wrappers/detection/detector.d.ts.map +1 -0
- package/dist/wrappers/detection/detector.js +279 -0
- package/dist/wrappers/detection/detector.js.map +1 -0
- package/dist/wrappers/detection/index.d.ts +5 -0
- package/dist/wrappers/detection/index.d.ts.map +1 -0
- package/dist/wrappers/detection/index.js +5 -0
- package/dist/wrappers/detection/index.js.map +1 -0
- package/dist/wrappers/export/index.d.ts +5 -0
- package/dist/wrappers/export/index.d.ts.map +1 -0
- package/dist/wrappers/export/index.js +5 -0
- package/dist/wrappers/export/index.js.map +1 -0
- package/dist/wrappers/export/json.d.ts +127 -0
- package/dist/wrappers/export/json.d.ts.map +1 -0
- package/dist/wrappers/export/json.js +160 -0
- package/dist/wrappers/export/json.js.map +1 -0
- package/dist/wrappers/index.d.ts +56 -0
- package/dist/wrappers/index.d.ts.map +1 -0
- package/dist/wrappers/index.js +159 -0
- package/dist/wrappers/index.js.map +1 -0
- package/dist/wrappers/integration/adapter.d.ts +52 -0
- package/dist/wrappers/integration/adapter.d.ts.map +1 -0
- package/dist/wrappers/integration/adapter.js +209 -0
- package/dist/wrappers/integration/adapter.js.map +1 -0
- package/dist/wrappers/integration/index.d.ts +9 -0
- package/dist/wrappers/integration/index.d.ts.map +1 -0
- package/dist/wrappers/integration/index.js +12 -0
- package/dist/wrappers/integration/index.js.map +1 -0
- package/dist/wrappers/integration/pattern-adapter.d.ts +52 -0
- package/dist/wrappers/integration/pattern-adapter.d.ts.map +1 -0
- package/dist/wrappers/integration/pattern-adapter.js +192 -0
- package/dist/wrappers/integration/pattern-adapter.js.map +1 -0
- package/dist/wrappers/integration/scanner.d.ts +85 -0
- package/dist/wrappers/integration/scanner.d.ts.map +1 -0
- package/dist/wrappers/integration/scanner.js +367 -0
- package/dist/wrappers/integration/scanner.js.map +1 -0
- package/dist/wrappers/primitives/discovery.d.ts +57 -0
- package/dist/wrappers/primitives/discovery.d.ts.map +1 -0
- package/dist/wrappers/primitives/discovery.js +389 -0
- package/dist/wrappers/primitives/discovery.js.map +1 -0
- package/dist/wrappers/primitives/index.d.ts +6 -0
- package/dist/wrappers/primitives/index.d.ts.map +1 -0
- package/dist/wrappers/primitives/index.js +6 -0
- package/dist/wrappers/primitives/index.js.map +1 -0
- package/dist/wrappers/primitives/registry.d.ts +63 -0
- package/dist/wrappers/primitives/registry.d.ts.map +1 -0
- package/dist/wrappers/primitives/registry.js +447 -0
- package/dist/wrappers/primitives/registry.js.map +1 -0
- package/dist/wrappers/types.d.ts +137 -0
- package/dist/wrappers/types.d.ts.map +1 -0
- package/dist/wrappers/types.js +7 -0
- package/dist/wrappers/types.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework Wrapper Detection
|
|
3
|
+
*
|
|
4
|
+
* Automatically detect custom abstractions built on top of framework primitives.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { analyzeWrappers } from '@drift/core/wrappers';
|
|
9
|
+
*
|
|
10
|
+
* const result = await analyzeWrappers({
|
|
11
|
+
* projectPath: '/path/to/project',
|
|
12
|
+
* language: 'typescript',
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* console.log(`Found ${result.clusters.length} wrapper patterns`);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export type { PrimitiveSourceType, PrimitiveSource, DetectedPrimitive, SupportedLanguage, WrapperFunction, WrapperCategory, WrapperCluster, FactoryType, FactoryFunction, DecoratorWrapper, AsyncType, ErrorHandlingPattern, AsyncWrapper, WrapperAnalysisResult, FrameworkInfo, WrapperSummary, PrimitiveRegistry, FrameworkDetectionResult, } from './types.js';
|
|
19
|
+
export { REACT_PRIMITIVES, REACT_ECOSYSTEM_PRIMITIVES, VUE_PRIMITIVES, SVELTE_PRIMITIVES, ANGULAR_PRIMITIVES, EXPRESS_PRIMITIVES, JS_TESTING_PRIMITIVES, FASTAPI_PRIMITIVES, DJANGO_PRIMITIVES, FLASK_PRIMITIVES, SQLALCHEMY_PRIMITIVES, CELERY_PRIMITIVES, PYDANTIC_PRIMITIVES, PYTHON_TESTING_PRIMITIVES, SPRING_PRIMITIVES, JAVA_TESTING_PRIMITIVES, ASPNET_PRIMITIVES, EFCORE_PRIMITIVES, CSHARP_TESTING_PRIMITIVES, LARAVEL_PRIMITIVES, SYMFONY_PRIMITIVES, PHP_TESTING_PRIMITIVES, TYPESCRIPT_PRIMITIVES, PYTHON_PRIMITIVES, JAVA_PRIMITIVES, CSHARP_PRIMITIVES, PHP_PRIMITIVES, ALL_PRIMITIVES, getPrimitiveNames, getFrameworkNames, findPrimitiveFramework, looksLikePrimitive, getPrimitiveCount, getPrimitivesByCategory, } from './primitives/registry.js';
|
|
20
|
+
export { discoverPrimitives, detectFrameworks, filterByConfidence, groupByFramework, groupByCategory, type ImportInfo, type DecoratorUsage, type FunctionUsage, type DiscoveryContext, } from './primitives/discovery.js';
|
|
21
|
+
export { detectWrappers, getWrappersByDepth, getWrappersForPrimitive, getWrapperCallChain, calculateWrapperStats, type FunctionInfo, type ParameterInfo, type CallInfo, type DetectionContext, type DetectionOptions, } from './detection/detector.js';
|
|
22
|
+
export { clusterWrappers, inferCategory, calculateConfidence, detectNamingPatterns, getClustersByCategory, getMostCommonPrimitives, findRelatedClusters, type ClusteringOptions, } from './clustering/clusterer.js';
|
|
23
|
+
export { applyExclusions, applyClusterExclusions, getLanguageExclusions, createExclusionRule, excludeByName, excludeByFile, EXCLUSION_RULES, type ExclusionRule, type ExclusionResult, } from './clustering/exclusions.js';
|
|
24
|
+
export { exportToJson, buildExportResult, parseJsonExport, validateExport, type WrapperExportOptions, type WrapperExportResult, type ProjectMetadata, type FrameworkExport, type PrimitiveExport, type WrapperExport, type WrapperFlags, type ClusterExport, type ClusterMetrics, type SummaryExport, } from './export/index.js';
|
|
25
|
+
export { mapLanguage, convertFunction, convertImport, buildDiscoveryContext, buildDetectionContext, filterExtractions, calculateExtractionStats, type AdapterOptions, type ExtractionStats, WrapperScanner, createWrapperScanner, type WrapperScannerConfig, type WrapperScanResult, clusterToPattern, wrapperToLocation, clustersToPatterns, generatePatternId, extractPatternMetadata, isWrapperPattern, extractWrapperInfo, type WrapperToPatternOptions, } from './integration/index.js';
|
|
26
|
+
import type { WrapperAnalysisResult } from './types.js';
|
|
27
|
+
import { type DiscoveryContext } from './primitives/discovery.js';
|
|
28
|
+
import { type DetectionContext } from './detection/detector.js';
|
|
29
|
+
import { type ExclusionRule } from './clustering/exclusions.js';
|
|
30
|
+
export interface AnalysisOptions {
|
|
31
|
+
/** Minimum confidence for clusters (0-1) */
|
|
32
|
+
minConfidence?: number | undefined;
|
|
33
|
+
/** Minimum cluster size */
|
|
34
|
+
minClusterSize?: number | undefined;
|
|
35
|
+
/** Maximum wrapper depth to traverse */
|
|
36
|
+
maxDepth?: number | undefined;
|
|
37
|
+
/** Include test files in analysis */
|
|
38
|
+
includeTestFiles?: boolean | undefined;
|
|
39
|
+
/** Apply exclusion rules to filter false positives */
|
|
40
|
+
applyExclusions?: boolean | undefined;
|
|
41
|
+
/** Custom exclusion rules (in addition to built-in rules) */
|
|
42
|
+
customExclusions?: ExclusionRule[] | undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Perform complete wrapper analysis on a codebase
|
|
46
|
+
*/
|
|
47
|
+
export declare function analyzeWrappers(discoveryContext: DiscoveryContext, detectionContext: Omit<DetectionContext, 'primitives'>, options?: AnalysisOptions): WrapperAnalysisResult;
|
|
48
|
+
/**
|
|
49
|
+
* Quick analysis - just get clusters without full details
|
|
50
|
+
*/
|
|
51
|
+
export declare function quickAnalyze(discoveryContext: DiscoveryContext, detectionContext: Omit<DetectionContext, 'primitives'>): {
|
|
52
|
+
clusterCount: number;
|
|
53
|
+
wrapperCount: number;
|
|
54
|
+
topPatterns: string[];
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wrappers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,YAAY,EAEV,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EAGjB,eAAe,EACf,eAAe,EACf,cAAc,EAGd,WAAW,EACX,eAAe,EACf,gBAAgB,EAGhB,SAAS,EACT,oBAAoB,EACpB,YAAY,EAGZ,qBAAqB,EACrB,aAAa,EACb,cAAc,EAGd,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAEL,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EAGtB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EAGd,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,cAA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2B,CAAC;AACxG,OAAO,EAAyC,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEvG,OAAO,EAAkE,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhI,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,qCAAqC;IACrC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,sDAAsD;IACtD,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,6DAA6D;IAC7D,gBAAgB,CAAC,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;CAChD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,EACtD,OAAO,GAAE,eAAoB,GAC5B,qBAAqB,CAqHvB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,GACrD;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAWvE"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework Wrapper Detection
|
|
3
|
+
*
|
|
4
|
+
* Automatically detect custom abstractions built on top of framework primitives.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { analyzeWrappers } from '@drift/core/wrappers';
|
|
9
|
+
*
|
|
10
|
+
* const result = await analyzeWrappers({
|
|
11
|
+
* projectPath: '/path/to/project',
|
|
12
|
+
* language: 'typescript',
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* console.log(`Found ${result.clusters.length} wrapper patterns`);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
// Primitive registry
|
|
19
|
+
export {
|
|
20
|
+
// Individual registries
|
|
21
|
+
REACT_PRIMITIVES, REACT_ECOSYSTEM_PRIMITIVES, VUE_PRIMITIVES, SVELTE_PRIMITIVES, ANGULAR_PRIMITIVES, EXPRESS_PRIMITIVES, JS_TESTING_PRIMITIVES, FASTAPI_PRIMITIVES, DJANGO_PRIMITIVES, FLASK_PRIMITIVES, SQLALCHEMY_PRIMITIVES, CELERY_PRIMITIVES, PYDANTIC_PRIMITIVES, PYTHON_TESTING_PRIMITIVES, SPRING_PRIMITIVES, JAVA_TESTING_PRIMITIVES, ASPNET_PRIMITIVES, EFCORE_PRIMITIVES, CSHARP_TESTING_PRIMITIVES, LARAVEL_PRIMITIVES, SYMFONY_PRIMITIVES, PHP_TESTING_PRIMITIVES,
|
|
22
|
+
// Combined registries
|
|
23
|
+
TYPESCRIPT_PRIMITIVES, PYTHON_PRIMITIVES, JAVA_PRIMITIVES, CSHARP_PRIMITIVES, PHP_PRIMITIVES, ALL_PRIMITIVES,
|
|
24
|
+
// Utility functions
|
|
25
|
+
getPrimitiveNames, getFrameworkNames, findPrimitiveFramework, looksLikePrimitive, getPrimitiveCount, getPrimitivesByCategory, } from './primitives/registry.js';
|
|
26
|
+
// Primitive discovery
|
|
27
|
+
export { discoverPrimitives, detectFrameworks, filterByConfidence, groupByFramework, groupByCategory, } from './primitives/discovery.js';
|
|
28
|
+
// Wrapper detection
|
|
29
|
+
export { detectWrappers, getWrappersByDepth, getWrappersForPrimitive, getWrapperCallChain, calculateWrapperStats, } from './detection/detector.js';
|
|
30
|
+
// Clustering
|
|
31
|
+
export { clusterWrappers, inferCategory, calculateConfidence, detectNamingPatterns, getClustersByCategory, getMostCommonPrimitives, findRelatedClusters, } from './clustering/clusterer.js';
|
|
32
|
+
// Exclusions
|
|
33
|
+
export { applyExclusions, applyClusterExclusions, getLanguageExclusions, createExclusionRule, excludeByName, excludeByFile, EXCLUSION_RULES, } from './clustering/exclusions.js';
|
|
34
|
+
// Export formats
|
|
35
|
+
export { exportToJson, buildExportResult, parseJsonExport, validateExport, } from './export/index.js';
|
|
36
|
+
// Integration with call graph
|
|
37
|
+
export {
|
|
38
|
+
// Adapter utilities
|
|
39
|
+
mapLanguage, convertFunction, convertImport, buildDiscoveryContext, buildDetectionContext, filterExtractions, calculateExtractionStats,
|
|
40
|
+
// Scanner
|
|
41
|
+
WrapperScanner, createWrapperScanner,
|
|
42
|
+
// Pattern adapter
|
|
43
|
+
clusterToPattern, wrapperToLocation, clustersToPatterns, generatePatternId, extractPatternMetadata, isWrapperPattern, extractWrapperInfo, } from './integration/index.js';
|
|
44
|
+
import { discoverPrimitives, detectFrameworks } from './primitives/discovery.js';
|
|
45
|
+
import { detectWrappers, calculateWrapperStats } from './detection/detector.js';
|
|
46
|
+
import { clusterWrappers, getMostCommonPrimitives } from './clustering/clusterer.js';
|
|
47
|
+
import { applyExclusions, applyClusterExclusions, getLanguageExclusions } from './clustering/exclusions.js';
|
|
48
|
+
/**
|
|
49
|
+
* Perform complete wrapper analysis on a codebase
|
|
50
|
+
*/
|
|
51
|
+
export function analyzeWrappers(discoveryContext, detectionContext, options = {}) {
|
|
52
|
+
const { minConfidence = 0.3, minClusterSize = 2, maxDepth, includeTestFiles, applyExclusions: shouldApplyExclusions = true, customExclusions = [], } = options;
|
|
53
|
+
// 1. Discover primitives
|
|
54
|
+
const primitives = discoverPrimitives(discoveryContext);
|
|
55
|
+
// 2. Detect frameworks
|
|
56
|
+
const frameworkResults = detectFrameworks(discoveryContext);
|
|
57
|
+
const frameworks = frameworkResults.map((fw) => ({
|
|
58
|
+
name: fw.framework,
|
|
59
|
+
version: fw.version,
|
|
60
|
+
primitiveCount: primitives.filter((p) => p.framework === fw.framework).length,
|
|
61
|
+
language: discoveryContext.language,
|
|
62
|
+
}));
|
|
63
|
+
// 3. Detect wrappers
|
|
64
|
+
const fullDetectionContext = {
|
|
65
|
+
...detectionContext,
|
|
66
|
+
primitives,
|
|
67
|
+
};
|
|
68
|
+
let wrappers = detectWrappers(fullDetectionContext, {
|
|
69
|
+
maxDepth,
|
|
70
|
+
includeTestFiles,
|
|
71
|
+
});
|
|
72
|
+
// 4. Apply exclusion rules to filter false positives
|
|
73
|
+
if (shouldApplyExclusions) {
|
|
74
|
+
const languageRules = getLanguageExclusions(discoveryContext.language);
|
|
75
|
+
const allRules = [...languageRules, ...customExclusions];
|
|
76
|
+
const exclusionResult = applyExclusions(wrappers, allRules);
|
|
77
|
+
wrappers = exclusionResult.included;
|
|
78
|
+
}
|
|
79
|
+
// 5. Cluster wrappers
|
|
80
|
+
let clusters = clusterWrappers(wrappers, primitives, {
|
|
81
|
+
minConfidence,
|
|
82
|
+
minClusterSize,
|
|
83
|
+
});
|
|
84
|
+
// 6. Apply cluster-level exclusions
|
|
85
|
+
if (shouldApplyExclusions) {
|
|
86
|
+
clusters = applyClusterExclusions(clusters, minClusterSize, minConfidence);
|
|
87
|
+
}
|
|
88
|
+
// 7. Calculate summary
|
|
89
|
+
const stats = calculateWrapperStats(wrappers);
|
|
90
|
+
const mostCommon = getMostCommonPrimitives(clusters, 1);
|
|
91
|
+
const wrappersByLanguage = {
|
|
92
|
+
typescript: 0,
|
|
93
|
+
python: 0,
|
|
94
|
+
java: 0,
|
|
95
|
+
csharp: 0,
|
|
96
|
+
php: 0,
|
|
97
|
+
};
|
|
98
|
+
wrappersByLanguage[discoveryContext.language] = wrappers.length;
|
|
99
|
+
const wrappersByCategory = {
|
|
100
|
+
'state-management': 0,
|
|
101
|
+
'data-fetching': 0,
|
|
102
|
+
'side-effects': 0,
|
|
103
|
+
'authentication': 0,
|
|
104
|
+
'authorization': 0,
|
|
105
|
+
'validation': 0,
|
|
106
|
+
'dependency-injection': 0,
|
|
107
|
+
'middleware': 0,
|
|
108
|
+
'testing': 0,
|
|
109
|
+
'logging': 0,
|
|
110
|
+
'caching': 0,
|
|
111
|
+
'error-handling': 0,
|
|
112
|
+
'async-utilities': 0,
|
|
113
|
+
'form-handling': 0,
|
|
114
|
+
'routing': 0,
|
|
115
|
+
'factory': 0,
|
|
116
|
+
'decorator': 0,
|
|
117
|
+
'utility': 0,
|
|
118
|
+
'other': 0,
|
|
119
|
+
};
|
|
120
|
+
for (const cluster of clusters) {
|
|
121
|
+
wrappersByCategory[cluster.category] += cluster.wrappers.length;
|
|
122
|
+
}
|
|
123
|
+
const mostUsedWrapper = wrappers.reduce((max, w) => (w.calledBy.length > (max?.calledBy.length ?? 0) ? w : max), wrappers[0]);
|
|
124
|
+
const summary = {
|
|
125
|
+
totalWrappers: stats.totalWrappers,
|
|
126
|
+
totalClusters: clusters.length,
|
|
127
|
+
avgDepth: stats.avgDepth,
|
|
128
|
+
maxDepth: stats.maxDepth,
|
|
129
|
+
mostWrappedPrimitive: mostCommon[0]?.primitive ?? 'N/A',
|
|
130
|
+
mostUsedWrapper: mostUsedWrapper?.name ?? 'N/A',
|
|
131
|
+
wrappersByLanguage,
|
|
132
|
+
wrappersByCategory,
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
frameworks,
|
|
136
|
+
primitives,
|
|
137
|
+
wrappers,
|
|
138
|
+
clusters,
|
|
139
|
+
factories: [], // TODO: Implement factory detection
|
|
140
|
+
decoratorWrappers: [], // TODO: Implement decorator wrapper detection
|
|
141
|
+
asyncWrappers: [], // TODO: Implement async wrapper detection
|
|
142
|
+
summary,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Quick analysis - just get clusters without full details
|
|
147
|
+
*/
|
|
148
|
+
export function quickAnalyze(discoveryContext, detectionContext) {
|
|
149
|
+
const result = analyzeWrappers(discoveryContext, detectionContext, {
|
|
150
|
+
minConfidence: 0.7,
|
|
151
|
+
minClusterSize: 2,
|
|
152
|
+
});
|
|
153
|
+
return {
|
|
154
|
+
clusterCount: result.clusters.length,
|
|
155
|
+
wrapperCount: result.wrappers.length,
|
|
156
|
+
topPatterns: result.clusters.slice(0, 5).map((c) => c.name),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wrappers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAmCH,qBAAqB;AACrB,OAAO;AACL,wBAAwB;AACxB,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB;AAEtB,sBAAsB;AACtB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc;AAEd,oBAAoB;AACpB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAElC,sBAAsB;AACtB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,GAKhB,MAAM,2BAA2B,CAAC;AAEnC,oBAAoB;AACpB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,GAMtB,MAAM,yBAAyB,CAAC;AAEjC,aAAa;AACb,OAAO,EACL,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,oBAAoB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
|
|
5
|
+
* Converts FileExtractionResult to DiscoveryContext and DetectionContext.
|
|
6
|
+
*/
|
|
7
|
+
import type { FileExtractionResult, FunctionExtraction, CallExtraction, ImportExtraction, CallGraphLanguage } from '../../call-graph/types.js';
|
|
8
|
+
import type { SupportedLanguage, DetectedPrimitive } from '../types.js';
|
|
9
|
+
import type { FunctionInfo, DetectionContext } from '../detection/detector.js';
|
|
10
|
+
import type { ImportInfo, DiscoveryContext } from '../primitives/discovery.js';
|
|
11
|
+
/**
|
|
12
|
+
* Map call graph language to wrapper supported language
|
|
13
|
+
*/
|
|
14
|
+
export declare function mapLanguage(lang: CallGraphLanguage): SupportedLanguage | null;
|
|
15
|
+
/**
|
|
16
|
+
* Convert FunctionExtraction to FunctionInfo for wrapper detection
|
|
17
|
+
*/
|
|
18
|
+
export declare function convertFunction(func: FunctionExtraction, file: string, language: SupportedLanguage, calls: CallExtraction[]): FunctionInfo;
|
|
19
|
+
/**
|
|
20
|
+
* Convert ImportExtraction to ImportInfo for primitive discovery
|
|
21
|
+
*/
|
|
22
|
+
export declare function convertImport(imp: ImportExtraction): ImportInfo;
|
|
23
|
+
/**
|
|
24
|
+
* Build DiscoveryContext from FileExtractionResult(s)
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildDiscoveryContext(extractions: FileExtractionResult[], language: SupportedLanguage): DiscoveryContext;
|
|
27
|
+
/**
|
|
28
|
+
* Build DetectionContext from FileExtractionResult(s)
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildDetectionContext(extractions: FileExtractionResult[], primitives: DetectedPrimitive[], language: SupportedLanguage): DetectionContext;
|
|
31
|
+
export interface AdapterOptions {
|
|
32
|
+
/** Include test files in analysis */
|
|
33
|
+
includeTestFiles?: boolean | undefined;
|
|
34
|
+
/** Filter to specific file patterns */
|
|
35
|
+
filePatterns?: string[] | undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Filter extractions based on options
|
|
39
|
+
*/
|
|
40
|
+
export declare function filterExtractions(extractions: FileExtractionResult[], options?: AdapterOptions): FileExtractionResult[];
|
|
41
|
+
export interface ExtractionStats {
|
|
42
|
+
totalFiles: number;
|
|
43
|
+
totalFunctions: number;
|
|
44
|
+
totalCalls: number;
|
|
45
|
+
totalImports: number;
|
|
46
|
+
byLanguage: Record<string, number>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Calculate statistics from extractions
|
|
50
|
+
*/
|
|
51
|
+
export declare function calculateExtractionStats(extractions: FileExtractionResult[]): ExtractionStats;
|
|
52
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/wrappers/integration/adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EACV,YAAY,EAGZ,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,UAAU,EAGV,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAMpC;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,iBAAiB,GAAG,iBAAiB,GAAG,IAAI,CAU7E;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,cAAc,EAAE,GACtB,YAAY,CAmBd;AA+BD;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,gBAAgB,GAAG,UAAU,CAW/D;AAMD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,oBAAoB,EAAE,EACnC,QAAQ,EAAE,iBAAiB,GAC1B,gBAAgB,CAwClB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,oBAAoB,EAAE,EACnC,UAAU,EAAE,iBAAiB,EAAE,EAC/B,QAAQ,EAAE,iBAAiB,GAC1B,gBAAgB,CAmBlB;AAMD,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACrC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,oBAAoB,EAAE,EACnC,OAAO,GAAE,cAAmB,GAC3B,oBAAoB,EAAE,CAgBxB;AA8BD,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,oBAAoB,EAAE,GAClC,eAAe,CAsBjB"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Call Graph to Wrapper Detection Adapter
|
|
3
|
+
*
|
|
4
|
+
* Bridges the call graph infrastructure with wrapper detection.
|
|
5
|
+
* Converts FileExtractionResult to DiscoveryContext and DetectionContext.
|
|
6
|
+
*/
|
|
7
|
+
import { minimatch } from 'minimatch';
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Language Mapping
|
|
10
|
+
// =============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Map call graph language to wrapper supported language
|
|
13
|
+
*/
|
|
14
|
+
export function mapLanguage(lang) {
|
|
15
|
+
const mapping = {
|
|
16
|
+
typescript: 'typescript',
|
|
17
|
+
javascript: 'typescript', // Treat JS as TS for wrapper detection
|
|
18
|
+
python: 'python',
|
|
19
|
+
java: 'java',
|
|
20
|
+
csharp: 'csharp',
|
|
21
|
+
php: 'php',
|
|
22
|
+
};
|
|
23
|
+
return mapping[lang];
|
|
24
|
+
}
|
|
25
|
+
// =============================================================================
|
|
26
|
+
// Function Conversion
|
|
27
|
+
// =============================================================================
|
|
28
|
+
/**
|
|
29
|
+
* Convert FunctionExtraction to FunctionInfo for wrapper detection
|
|
30
|
+
*/
|
|
31
|
+
export function convertFunction(func, file, language, calls) {
|
|
32
|
+
// Filter calls that belong to this function (by line range)
|
|
33
|
+
const functionCalls = calls.filter((c) => c.line >= func.startLine && c.line <= func.endLine);
|
|
34
|
+
return {
|
|
35
|
+
name: func.name,
|
|
36
|
+
qualifiedName: func.qualifiedName,
|
|
37
|
+
file,
|
|
38
|
+
startLine: func.startLine,
|
|
39
|
+
endLine: func.endLine,
|
|
40
|
+
language,
|
|
41
|
+
isAsync: func.isAsync,
|
|
42
|
+
returnType: func.returnType,
|
|
43
|
+
parameters: func.parameters.map((p) => convertParameter(p)),
|
|
44
|
+
decorators: func.decorators,
|
|
45
|
+
calls: functionCalls.map(convertCall),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Convert parameter info
|
|
50
|
+
*/
|
|
51
|
+
function convertParameter(param) {
|
|
52
|
+
return {
|
|
53
|
+
name: param.name,
|
|
54
|
+
type: param.type,
|
|
55
|
+
defaultValue: param.hasDefault ? 'default' : undefined,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Convert call extraction to call info
|
|
60
|
+
*/
|
|
61
|
+
function convertCall(call) {
|
|
62
|
+
return {
|
|
63
|
+
calleeName: call.calleeName,
|
|
64
|
+
calleeQualifiedName: call.receiver
|
|
65
|
+
? `${call.receiver}.${call.calleeName}`
|
|
66
|
+
: call.calleeName,
|
|
67
|
+
line: call.line,
|
|
68
|
+
isCallback: false, // Could be enhanced with more analysis
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// =============================================================================
|
|
72
|
+
// Import Conversion
|
|
73
|
+
// =============================================================================
|
|
74
|
+
/**
|
|
75
|
+
* Convert ImportExtraction to ImportInfo for primitive discovery
|
|
76
|
+
*/
|
|
77
|
+
export function convertImport(imp) {
|
|
78
|
+
return {
|
|
79
|
+
source: imp.source,
|
|
80
|
+
names: imp.names.map((n) => ({
|
|
81
|
+
imported: n.imported,
|
|
82
|
+
local: n.local,
|
|
83
|
+
isDefault: n.isDefault,
|
|
84
|
+
})),
|
|
85
|
+
line: imp.line,
|
|
86
|
+
isTypeOnly: imp.isTypeOnly,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// =============================================================================
|
|
90
|
+
// Context Builders
|
|
91
|
+
// =============================================================================
|
|
92
|
+
/**
|
|
93
|
+
* Build DiscoveryContext from FileExtractionResult(s)
|
|
94
|
+
*/
|
|
95
|
+
export function buildDiscoveryContext(extractions, language) {
|
|
96
|
+
const imports = [];
|
|
97
|
+
const decorators = [];
|
|
98
|
+
const functionUsages = [];
|
|
99
|
+
for (const extraction of extractions) {
|
|
100
|
+
// Collect imports
|
|
101
|
+
for (const imp of extraction.imports) {
|
|
102
|
+
imports.push(convertImport(imp));
|
|
103
|
+
}
|
|
104
|
+
// Collect decorators from functions
|
|
105
|
+
for (const func of extraction.functions) {
|
|
106
|
+
for (const decorator of func.decorators) {
|
|
107
|
+
decorators.push({
|
|
108
|
+
name: decorator,
|
|
109
|
+
file: extraction.file,
|
|
110
|
+
line: func.startLine,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Collect function usages (calls)
|
|
115
|
+
for (const call of extraction.calls) {
|
|
116
|
+
functionUsages.push({
|
|
117
|
+
name: call.calleeName,
|
|
118
|
+
file: extraction.file,
|
|
119
|
+
line: call.line,
|
|
120
|
+
isMethodCall: call.isMethodCall,
|
|
121
|
+
receiver: call.receiver,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
imports,
|
|
127
|
+
decorators,
|
|
128
|
+
functionUsages,
|
|
129
|
+
language,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Build DetectionContext from FileExtractionResult(s)
|
|
134
|
+
*/
|
|
135
|
+
export function buildDetectionContext(extractions, primitives, language) {
|
|
136
|
+
const functions = [];
|
|
137
|
+
for (const extraction of extractions) {
|
|
138
|
+
const mappedLang = mapLanguage(extraction.language);
|
|
139
|
+
if (!mappedLang)
|
|
140
|
+
continue;
|
|
141
|
+
for (const func of extraction.functions) {
|
|
142
|
+
functions.push(convertFunction(func, extraction.file, mappedLang, extraction.calls));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
functions,
|
|
147
|
+
primitives,
|
|
148
|
+
language,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Filter extractions based on options
|
|
153
|
+
*/
|
|
154
|
+
export function filterExtractions(extractions, options = {}) {
|
|
155
|
+
let filtered = extractions;
|
|
156
|
+
// Filter test files if requested
|
|
157
|
+
if (!options.includeTestFiles) {
|
|
158
|
+
filtered = filtered.filter((e) => !isTestFile(e.file));
|
|
159
|
+
}
|
|
160
|
+
// Filter by file patterns if specified
|
|
161
|
+
if (options.filePatterns && options.filePatterns.length > 0) {
|
|
162
|
+
filtered = filtered.filter((e) => options.filePatterns.some((pattern) => matchesPattern(e.file, pattern)));
|
|
163
|
+
}
|
|
164
|
+
return filtered;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Check if file is a test file
|
|
168
|
+
*/
|
|
169
|
+
function isTestFile(filePath) {
|
|
170
|
+
const testPatterns = [
|
|
171
|
+
/\.test\.[jt]sx?$/,
|
|
172
|
+
/\.spec\.[jt]sx?$/,
|
|
173
|
+
/_test\.(py|go|java|cs|php)$/,
|
|
174
|
+
/Test\.(java|cs)$/,
|
|
175
|
+
/Tests?\//,
|
|
176
|
+
/__tests__\//,
|
|
177
|
+
/test_.*\.py$/,
|
|
178
|
+
];
|
|
179
|
+
return testPatterns.some((pattern) => pattern.test(filePath));
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Simple glob-like pattern matching using minimatch
|
|
183
|
+
*/
|
|
184
|
+
function matchesPattern(filePath, pattern) {
|
|
185
|
+
return minimatch(filePath, pattern);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Calculate statistics from extractions
|
|
189
|
+
*/
|
|
190
|
+
export function calculateExtractionStats(extractions) {
|
|
191
|
+
const byLanguage = {};
|
|
192
|
+
let totalFunctions = 0;
|
|
193
|
+
let totalCalls = 0;
|
|
194
|
+
let totalImports = 0;
|
|
195
|
+
for (const extraction of extractions) {
|
|
196
|
+
totalFunctions += extraction.functions.length;
|
|
197
|
+
totalCalls += extraction.calls.length;
|
|
198
|
+
totalImports += extraction.imports.length;
|
|
199
|
+
byLanguage[extraction.language] = (byLanguage[extraction.language] || 0) + 1;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
totalFiles: extractions.length,
|
|
203
|
+
totalFunctions,
|
|
204
|
+
totalCalls,
|
|
205
|
+
totalImports,
|
|
206
|
+
byLanguage,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/wrappers/integration/adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA6BtC,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,IAAuB;IACjD,MAAM,OAAO,GAAwD;QACnE,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,YAAY,EAAE,uCAAuC;Q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UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,cAAc,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;QAC9C,UAAU,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC;QACtC,YAAY,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC;QAE1C,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO;QACL,UAAU,EAAE,WAAW,CAAC,MAAM;QAC9B,cAAc;QACd,UAAU;QACV,YAAY;QACZ,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper Detection Integration
|
|
3
|
+
*
|
|
4
|
+
* Bridges wrapper detection with the call graph infrastructure.
|
|
5
|
+
*/
|
|
6
|
+
export { mapLanguage, convertFunction, convertImport, buildDiscoveryContext, buildDetectionContext, filterExtractions, calculateExtractionStats, type AdapterOptions, type ExtractionStats, } from './adapter.js';
|
|
7
|
+
export { WrapperScanner, createWrapperScanner, type WrapperScannerConfig, type WrapperScanResult, } from './scanner.js';
|
|
8
|
+
export { clusterToPattern, wrapperToLocation, clustersToPatterns, generatePatternId, extractPatternMetadata, isWrapperPattern, extractWrapperInfo, type WrapperToPatternOptions, } from './pattern-adapter.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wrappers/integration/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,WAAW,EACX,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper Detection Integration
|
|
3
|
+
*
|
|
4
|
+
* Bridges wrapper detection with the call graph infrastructure.
|
|
5
|
+
*/
|
|
6
|
+
// Adapter - type conversions between call graph and wrapper detection
|
|
7
|
+
export { mapLanguage, convertFunction, convertImport, buildDiscoveryContext, buildDetectionContext, filterExtractions, calculateExtractionStats, } from './adapter.js';
|
|
8
|
+
// Scanner - high-level scanning API
|
|
9
|
+
export { WrapperScanner, createWrapperScanner, } from './scanner.js';
|
|
10
|
+
// Pattern adapter - convert wrapper clusters to Drift patterns
|
|
11
|
+
export { clusterToPattern, wrapperToLocation, clustersToPatterns, generatePatternId, extractPatternMetadata, isWrapperPattern, extractWrapperInfo, } from './pattern-adapter.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wrappers/integration/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,sEAAsE;AACtE,OAAO,EACL,WAAW,EACX,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,GAGzB,MAAM,cAAc,CAAC;AAEtB,oCAAoC;AACpC,OAAO,EACL,cAAc,EACd,oBAAoB,GAGrB,MAAM,cAAc,CAAC;AAEtB,+DAA+D;AAC/D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,GAEnB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern System Integration
|
|
3
|
+
*
|
|
4
|
+
* Converts wrapper clusters to Drift patterns for integration with
|
|
5
|
+
* the existing pattern detection and management system.
|
|
6
|
+
*/
|
|
7
|
+
import type { WrapperCluster, WrapperFunction } from '../types.js';
|
|
8
|
+
import type { Pattern, PatternLocation, Severity } from '../../patterns/types.js';
|
|
9
|
+
export interface WrapperToPatternOptions {
|
|
10
|
+
/** Minimum confidence to convert (default: 0.5) */
|
|
11
|
+
minConfidence?: number | undefined;
|
|
12
|
+
/** Default severity for wrapper patterns (default: 'info') */
|
|
13
|
+
defaultSeverity?: Severity | undefined;
|
|
14
|
+
/** Prefix for pattern IDs (default: 'wrapper-') */
|
|
15
|
+
idPrefix?: string | undefined;
|
|
16
|
+
/** Include wrapper details in pattern description */
|
|
17
|
+
includeDetails?: boolean | undefined;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Convert a wrapper cluster to a Drift pattern
|
|
21
|
+
*/
|
|
22
|
+
export declare function clusterToPattern(cluster: WrapperCluster, options?: WrapperToPatternOptions): Pattern;
|
|
23
|
+
/**
|
|
24
|
+
* Convert a wrapper function to a pattern location
|
|
25
|
+
*/
|
|
26
|
+
export declare function wrapperToLocation(wrapper: WrapperFunction): PatternLocation;
|
|
27
|
+
/**
|
|
28
|
+
* Convert multiple clusters to patterns
|
|
29
|
+
*/
|
|
30
|
+
export declare function clustersToPatterns(clusters: WrapperCluster[], options?: WrapperToPatternOptions): Pattern[];
|
|
31
|
+
/**
|
|
32
|
+
* Generate a unique pattern ID for a wrapper cluster
|
|
33
|
+
*/
|
|
34
|
+
export declare function generatePatternId(cluster: WrapperCluster): string;
|
|
35
|
+
/**
|
|
36
|
+
* Extract pattern metadata from a wrapper cluster
|
|
37
|
+
*/
|
|
38
|
+
export declare function extractPatternMetadata(cluster: WrapperCluster): Record<string, unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* Check if a pattern was created from a wrapper cluster
|
|
41
|
+
*/
|
|
42
|
+
export declare function isWrapperPattern(pattern: Pattern): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Extract wrapper info from a pattern (if it's a wrapper pattern)
|
|
45
|
+
*/
|
|
46
|
+
export declare function extractWrapperInfo(pattern: Pattern): {
|
|
47
|
+
primitiveSignature: string[];
|
|
48
|
+
wrapperCategory: string;
|
|
49
|
+
avgDepth: number;
|
|
50
|
+
maxDepth: number;
|
|
51
|
+
} | null;
|
|
52
|
+
//# sourceMappingURL=pattern-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-adapter.d.ts","sourceRoot":"","sources":["../../../src/wrappers/integration/pattern-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,MAAM,aAAa,CAAC;AACpF,OAAO,KAAK,EACV,OAAO,EAEP,eAAe,EAEf,QAAQ,EACT,MAAM,yBAAyB,CAAC;AA6DjC,MAAM,WAAW,uBAAuB;IACtC,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,8DAA8D;IAC9D,eAAe,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACvC,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,qDAAqD;IACrD,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,cAAc,EACvB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAqDT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAA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