@dataparade/cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +592 -0
- package/dist/bin/cli.d.ts +2 -0
- package/dist/bin/cli.js +7 -0
- package/dist/bin/load-env.d.ts +2 -0
- package/dist/bin/load-env.js +4 -0
- package/dist/src/ai-enrichment/agent-orchestrator.d.ts +28 -0
- package/dist/src/ai-enrichment/agent-orchestrator.js +476 -0
- package/dist/src/ai-enrichment/agents/index.d.ts +4 -0
- package/dist/src/ai-enrichment/agents/index.js +50 -0
- package/dist/src/ai-enrichment/candidate-selector.d.ts +10 -0
- package/dist/src/ai-enrichment/candidate-selector.js +158 -0
- package/dist/src/ai-enrichment/fallbacks.d.ts +6 -0
- package/dist/src/ai-enrichment/fallbacks.js +762 -0
- package/dist/src/ai-enrichment/index.d.ts +15 -0
- package/dist/src/ai-enrichment/index.js +31 -0
- package/dist/src/ai-enrichment/merge-rules.d.ts +12 -0
- package/dist/src/ai-enrichment/merge-rules.js +321 -0
- package/dist/src/ai-enrichment/non-pii-signal-rules.d.ts +10 -0
- package/dist/src/ai-enrichment/non-pii-signal-rules.js +72 -0
- package/dist/src/ai-enrichment/openai-proposals-response.schema.d.ts +94 -0
- package/dist/src/ai-enrichment/openai-proposals-response.schema.js +82 -0
- package/dist/src/ai-enrichment/pii-signal-rules.d.ts +8 -0
- package/dist/src/ai-enrichment/pii-signal-rules.js +68 -0
- package/dist/src/ai-enrichment/pipeline.d.ts +2 -0
- package/dist/src/ai-enrichment/pipeline.js +48 -0
- package/dist/src/ai-enrichment/planner.d.ts +2 -0
- package/dist/src/ai-enrichment/planner.js +60 -0
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.d.ts +12 -0
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.js +45 -0
- package/dist/src/ai-enrichment/provider-prompt.d.ts +32 -0
- package/dist/src/ai-enrichment/provider-prompt.js +222 -0
- package/dist/src/ai-enrichment/provider-topology-rules.d.ts +52 -0
- package/dist/src/ai-enrichment/provider-topology-rules.js +190 -0
- package/dist/src/ai-enrichment/provider-topology-shared.d.ts +48 -0
- package/dist/src/ai-enrichment/provider-topology-shared.js +329 -0
- package/dist/src/ai-enrichment/providers/endpoint-resolution.d.ts +13 -0
- package/dist/src/ai-enrichment/providers/endpoint-resolution.js +41 -0
- package/dist/src/ai-enrichment/providers/families/chat-completions-family.d.ts +13 -0
- package/dist/src/ai-enrichment/providers/families/chat-completions-family.js +181 -0
- package/dist/src/ai-enrichment/providers/families/generate-content-family.d.ts +10 -0
- package/dist/src/ai-enrichment/providers/families/generate-content-family.js +93 -0
- package/dist/src/ai-enrichment/providers/families/messages-family.d.ts +10 -0
- package/dist/src/ai-enrichment/providers/families/messages-family.js +86 -0
- package/dist/src/ai-enrichment/providers/families/ollama-generate-family.d.ts +10 -0
- package/dist/src/ai-enrichment/providers/families/ollama-generate-family.js +69 -0
- package/dist/src/ai-enrichment/providers/fetch-with-timeout.d.ts +2 -0
- package/dist/src/ai-enrichment/providers/fetch-with-timeout.js +22 -0
- package/dist/src/ai-enrichment/providers/index.d.ts +16 -0
- package/dist/src/ai-enrichment/providers/index.js +40 -0
- package/dist/src/ai-enrichment/providers/mock.d.ts +5 -0
- package/dist/src/ai-enrichment/providers/mock.js +12 -0
- package/dist/src/ai-enrichment/providers/platform-proxy-provider.d.ts +20 -0
- package/dist/src/ai-enrichment/providers/platform-proxy-provider.js +116 -0
- package/dist/src/ai-enrichment/providers/presets.d.ts +14 -0
- package/dist/src/ai-enrichment/providers/presets.js +50 -0
- package/dist/src/ai-enrichment/providers/provider-contract.d.ts +20 -0
- package/dist/src/ai-enrichment/providers/provider-contract.js +703 -0
- package/dist/src/ai-enrichment/providers/provider-json-parse.d.ts +23 -0
- package/dist/src/ai-enrichment/providers/provider-json-parse.js +96 -0
- package/dist/src/ai-enrichment/providers/provider-output-token-budget.d.ts +5 -0
- package/dist/src/ai-enrichment/providers/provider-output-token-budget.js +11 -0
- package/dist/src/ai-enrichment/providers/provider-pricing.d.ts +7 -0
- package/dist/src/ai-enrichment/providers/provider-pricing.js +32 -0
- package/dist/src/ai-enrichment/providers/provider-runtime.d.ts +9 -0
- package/dist/src/ai-enrichment/providers/provider-runtime.js +54 -0
- package/dist/src/ai-enrichment/providers/resolve-provider.d.ts +27 -0
- package/dist/src/ai-enrichment/providers/resolve-provider.js +41 -0
- package/dist/src/ai-enrichment/providers/types.d.ts +24 -0
- package/dist/src/ai-enrichment/providers/types.js +2 -0
- package/dist/src/ai-enrichment/scan-paths.d.ts +9 -0
- package/dist/src/ai-enrichment/scan-paths.js +28 -0
- package/dist/src/ai-enrichment/sensitive-paths.d.ts +5 -0
- package/dist/src/ai-enrichment/sensitive-paths.js +10 -0
- package/dist/src/ai-enrichment/third-party-data-flow.d.ts +27 -0
- package/dist/src/ai-enrichment/third-party-data-flow.js +518 -0
- package/dist/src/ai-enrichment/third-party-evidence.d.ts +14 -0
- package/dist/src/ai-enrichment/third-party-evidence.js +426 -0
- package/dist/src/ai-enrichment/third-party-property-matrix.d.ts +14 -0
- package/dist/src/ai-enrichment/third-party-property-matrix.js +52 -0
- package/dist/src/ai-enrichment/third-party-subtype.d.ts +14 -0
- package/dist/src/ai-enrichment/third-party-subtype.js +166 -0
- package/dist/src/ai-enrichment/tools/index.d.ts +39 -0
- package/dist/src/ai-enrichment/tools/index.js +121 -0
- package/dist/src/ai-enrichment/types.d.ts +170 -0
- package/dist/src/ai-enrichment/types.js +12 -0
- package/dist/src/analyzers/python/dependency-manifests.d.ts +8 -0
- package/dist/src/analyzers/python/dependency-manifests.js +131 -0
- package/dist/src/analyzers/python/detector.d.ts +3 -0
- package/dist/src/analyzers/python/detector.js +22 -0
- package/dist/src/analyzers/python/index.d.ts +2 -0
- package/dist/src/analyzers/python/index.js +11 -0
- package/dist/src/analyzers/python/manifest-parsers.d.ts +3 -0
- package/dist/src/analyzers/python/manifest-parsers.js +134 -0
- package/dist/src/analyzers/python/parser.d.ts +26 -0
- package/dist/src/analyzers/python/parser.js +187 -0
- package/dist/src/analyzers/python/patterns.d.ts +7 -0
- package/dist/src/analyzers/python/patterns.js +106 -0
- package/dist/src/analyzers/python/python-detection-config.d.ts +75 -0
- package/dist/src/analyzers/python/python-detection-config.js +148 -0
- package/dist/src/analyzers/registry.d.ts +13 -0
- package/dist/src/analyzers/registry.js +60 -0
- package/dist/src/analyzers/shared/manifest-budgets.d.ts +19 -0
- package/dist/src/analyzers/shared/manifest-budgets.js +21 -0
- package/dist/src/analyzers/shared/manifest-fs.d.ts +13 -0
- package/dist/src/analyzers/shared/manifest-fs.js +138 -0
- package/dist/src/analyzers/shared/property-inference.d.ts +8 -0
- package/dist/src/analyzers/shared/property-inference.js +165 -0
- package/dist/src/analyzers/terraform/detector.d.ts +10 -0
- package/dist/src/analyzers/terraform/detector.js +198 -0
- package/dist/src/analyzers/terraform/index.d.ts +2 -0
- package/dist/src/analyzers/terraform/index.js +13 -0
- package/dist/src/analyzers/terraform/parser.d.ts +29 -0
- package/dist/src/analyzers/terraform/parser.js +202 -0
- package/dist/src/analyzers/terraform/terraform-detection-config.d.ts +48 -0
- package/dist/src/analyzers/terraform/terraform-detection-config.js +218 -0
- package/dist/src/analyzers/terraform/terraform-exec.d.ts +11 -0
- package/dist/src/analyzers/terraform/terraform-exec.js +35 -0
- package/dist/src/analyzers/terraform/terraform-module-manifest.d.ts +19 -0
- package/dist/src/analyzers/terraform/terraform-module-manifest.js +75 -0
- package/dist/src/analyzers/terraform/terraform-show-json.d.ts +15 -0
- package/dist/src/analyzers/terraform/terraform-show-json.js +188 -0
- package/dist/src/analyzers/terraform/terraform-utility-resource.d.ts +12 -0
- package/dist/src/analyzers/terraform/terraform-utility-resource.js +30 -0
- package/dist/src/analyzers/types.d.ts +5 -0
- package/dist/src/analyzers/types.js +2 -0
- package/dist/src/analyzers/typescript/actor-detection.d.ts +4 -0
- package/dist/src/analyzers/typescript/actor-detection.js +15 -0
- package/dist/src/analyzers/typescript/dependency-manifests.d.ts +9 -0
- package/dist/src/analyzers/typescript/dependency-manifests.js +131 -0
- package/dist/src/analyzers/typescript/detector.d.ts +3 -0
- package/dist/src/analyzers/typescript/detector.js +23 -0
- package/dist/src/analyzers/typescript/index.d.ts +2 -0
- package/dist/src/analyzers/typescript/index.js +11 -0
- package/dist/src/analyzers/typescript/manifest-parsers.d.ts +1 -0
- package/dist/src/analyzers/typescript/manifest-parsers.js +30 -0
- package/dist/src/analyzers/typescript/parser.d.ts +44 -0
- package/dist/src/analyzers/typescript/parser.js +287 -0
- package/dist/src/analyzers/typescript/third-party-detection.d.ts +4 -0
- package/dist/src/analyzers/typescript/third-party-detection.js +16 -0
- package/dist/src/analyzers/typescript/typescript-detection-config.d.ts +68 -0
- package/dist/src/analyzers/typescript/typescript-detection-config.js +171 -0
- package/dist/src/analyzers/typescript/typescript-detection.d.ts +10 -0
- package/dist/src/analyzers/typescript/typescript-detection.js +57 -0
- package/dist/src/classifier/application-injection.d.ts +12 -0
- package/dist/src/classifier/application-injection.js +335 -0
- package/dist/src/classifier/classify.d.ts +3 -0
- package/dist/src/classifier/classify.js +15 -0
- package/dist/src/classifier/component-factory.d.ts +3 -0
- package/dist/src/classifier/component-factory.js +488 -0
- package/dist/src/classifier/config.d.ts +38 -0
- package/dist/src/classifier/config.js +260 -0
- package/dist/src/classifier/enhance-defaults.d.ts +28 -0
- package/dist/src/classifier/enhance-defaults.js +369 -0
- package/dist/src/classifier/enhance.d.ts +13 -0
- package/dist/src/classifier/enhance.js +295 -0
- package/dist/src/classifier/external-url-third-party.d.ts +26 -0
- package/dist/src/classifier/external-url-third-party.js +195 -0
- package/dist/src/classifier/grouping.d.ts +1 -0
- package/dist/src/classifier/grouping.js +2 -0
- package/dist/src/classifier/main-application-selection.d.ts +41 -0
- package/dist/src/classifier/main-application-selection.js +222 -0
- package/dist/src/classifier/naming.d.ts +4 -0
- package/dist/src/classifier/naming.js +78 -0
- package/dist/src/classifier/postprocessing.d.ts +12 -0
- package/dist/src/classifier/postprocessing.js +510 -0
- package/dist/src/classifier/sectioning.d.ts +5 -0
- package/dist/src/classifier/sectioning.js +60 -0
- package/dist/src/classifier/terraform-provider-hub.d.ts +6 -0
- package/dist/src/classifier/terraform-provider-hub.js +38 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +498 -0
- package/dist/src/config/actor-detection-config.d.ts +21 -0
- package/dist/src/config/actor-detection-config.js +97 -0
- package/dist/src/config/env.d.ts +2 -0
- package/dist/src/config/env.js +75 -0
- package/dist/src/config/file.d.ts +6 -0
- package/dist/src/config/file.js +74 -0
- package/dist/src/config/inference-scope.d.ts +2 -0
- package/dist/src/config/inference-scope.js +15 -0
- package/dist/src/config/load-cli-env.d.ts +1 -0
- package/dist/src/config/load-cli-env.js +54 -0
- package/dist/src/config/normalize-ai-provider.d.ts +5 -0
- package/dist/src/config/normalize-ai-provider.js +18 -0
- package/dist/src/config/property-detection-config.d.ts +27 -0
- package/dist/src/config/property-detection-config.js +355 -0
- package/dist/src/config/redact.d.ts +3 -0
- package/dist/src/config/redact.js +14 -0
- package/dist/src/config/resolve.d.ts +15 -0
- package/dist/src/config/resolve.js +361 -0
- package/dist/src/config/scan-env.d.ts +7 -0
- package/dist/src/config/scan-env.js +38 -0
- package/dist/src/config/third-party-detection-config.d.ts +25 -0
- package/dist/src/config/third-party-detection-config.js +97 -0
- package/dist/src/config/types.d.ts +106 -0
- package/dist/src/config/types.js +2 -0
- package/dist/src/config/validate-scan-ai.d.ts +3 -0
- package/dist/src/config/validate-scan-ai.js +33 -0
- package/dist/src/core/pipeline/ai-orchestrator-options.d.ts +6 -0
- package/dist/src/core/pipeline/ai-orchestrator-options.js +46 -0
- package/dist/src/core/pipeline/classifier-phase.d.ts +7 -0
- package/dist/src/core/pipeline/classifier-phase.js +78 -0
- package/dist/src/core/pipeline/dataflow-phase.d.ts +7 -0
- package/dist/src/core/pipeline/dataflow-phase.js +10 -0
- package/dist/src/core/pipeline/diagram-layout/app-section-layout.d.ts +7 -0
- package/dist/src/core/pipeline/diagram-layout/app-section-layout.js +74 -0
- package/dist/src/core/pipeline/diagram-layout/constants.d.ts +11 -0
- package/dist/src/core/pipeline/diagram-layout/constants.js +14 -0
- package/dist/src/core/pipeline/diagram-layout/edge-handles.d.ts +3 -0
- package/dist/src/core/pipeline/diagram-layout/edge-handles.js +26 -0
- package/dist/src/core/pipeline/diagram-layout/managed-provider-layout.d.ts +3 -0
- package/dist/src/core/pipeline/diagram-layout/managed-provider-layout.js +40 -0
- package/dist/src/core/pipeline/diagram-layout/minimal-terraform-layout.d.ts +6 -0
- package/dist/src/core/pipeline/diagram-layout/minimal-terraform-layout.js +53 -0
- package/dist/src/core/pipeline/diagram-layout/section-helpers.d.ts +30 -0
- package/dist/src/core/pipeline/diagram-layout/section-helpers.js +62 -0
- package/dist/src/core/pipeline/diagram-layout/terraform-lane-layout.d.ts +3 -0
- package/dist/src/core/pipeline/diagram-layout/terraform-lane-layout.js +109 -0
- package/dist/src/core/pipeline/diagram-layout/types.d.ts +2 -0
- package/dist/src/core/pipeline/diagram-layout/types.js +2 -0
- package/dist/src/core/pipeline/graph-mapping.d.ts +6 -0
- package/dist/src/core/pipeline/graph-mapping.js +308 -0
- package/dist/src/core/pipeline/mixed-app-terraform-scan.d.ts +13 -0
- package/dist/src/core/pipeline/mixed-app-terraform-scan.js +81 -0
- package/dist/src/core/pipeline/orchestrator-result.d.ts +6 -0
- package/dist/src/core/pipeline/orchestrator-result.js +2 -0
- package/dist/src/core/pipeline/orchestrator.d.ts +26 -0
- package/dist/src/core/pipeline/orchestrator.js +79 -0
- package/dist/src/core/pipeline/resolve-path-under-scan-root.d.ts +7 -0
- package/dist/src/core/pipeline/resolve-path-under-scan-root.js +55 -0
- package/dist/src/core/pipeline/scan-pipeline.d.ts +6 -0
- package/dist/src/core/pipeline/scan-pipeline.js +364 -0
- package/dist/src/core/pipeline/sorting.d.ts +3 -0
- package/dist/src/core/pipeline/sorting.js +48 -0
- package/dist/src/core/pipeline/stable-component-ids.d.ts +15 -0
- package/dist/src/core/pipeline/stable-component-ids.js +68 -0
- package/dist/src/core/pipeline/structural-scan.d.ts +19 -0
- package/dist/src/core/pipeline/structural-scan.js +304 -0
- package/dist/src/core/pipeline/terraform-flow-utils.d.ts +6 -0
- package/dist/src/core/pipeline/terraform-flow-utils.js +32 -0
- package/dist/src/core/pipeline/terraform-minimal-services.d.ts +31 -0
- package/dist/src/core/pipeline/terraform-minimal-services.js +225 -0
- package/dist/src/core/schema/dataflow-wrapper.schema.d.ts +83 -0
- package/dist/src/core/schema/dataflow-wrapper.schema.js +40 -0
- package/dist/src/core/schema/diagram-graph.schema.d.ts +93 -0
- package/dist/src/core/schema/diagram-graph.schema.js +55 -0
- package/dist/src/core/schema/index.d.ts +4 -0
- package/dist/src/core/schema/index.js +20 -0
- package/dist/src/core/schema/scan-config.schema.d.ts +66 -0
- package/dist/src/core/schema/scan-config.schema.js +67 -0
- package/dist/src/core/schema/scan-result.schema.d.ts +450 -0
- package/dist/src/core/schema/scan-result.schema.js +236 -0
- package/dist/src/core/sectioning/discover-service-sections.d.ts +80 -0
- package/dist/src/core/sectioning/discover-service-sections.js +468 -0
- package/dist/src/core/sectioning/section-runtime.d.ts +21 -0
- package/dist/src/core/sectioning/section-runtime.js +148 -0
- package/dist/src/core/terraform/component-predicates.d.ts +13 -0
- package/dist/src/core/terraform/component-predicates.js +71 -0
- package/dist/src/core/types/component.d.ts +18 -0
- package/dist/src/core/types/component.js +2 -0
- package/dist/src/core/types/config.d.ts +57 -0
- package/dist/src/core/types/config.js +2 -0
- package/dist/src/core/types/data-flow.d.ts +24 -0
- package/dist/src/core/types/data-flow.js +2 -0
- package/dist/src/core/types/detection.d.ts +12 -0
- package/dist/src/core/types/detection.js +19 -0
- package/dist/src/core/types/file.d.ts +14 -0
- package/dist/src/core/types/file.js +2 -0
- package/dist/src/core/types/index.d.ts +7 -0
- package/dist/src/core/types/index.js +23 -0
- package/dist/src/core/types/progress.d.ts +9 -0
- package/dist/src/core/types/progress.js +2 -0
- package/dist/src/core/types/result.d.ts +140 -0
- package/dist/src/core/types/result.js +2 -0
- package/dist/src/data-flow/application-hub.d.ts +7 -0
- package/dist/src/data-flow/application-hub.js +88 -0
- package/dist/src/data-flow/dedupe.d.ts +7 -0
- package/dist/src/data-flow/dedupe.js +92 -0
- package/dist/src/data-flow/detect.d.ts +16 -0
- package/dist/src/data-flow/detect.js +203 -0
- package/dist/src/data-flow/detector.d.ts +15 -0
- package/dist/src/data-flow/detector.js +18 -0
- package/dist/src/data-flow/drop-cross-section-flows.d.ts +8 -0
- package/dist/src/data-flow/drop-cross-section-flows.js +32 -0
- package/dist/src/data-flow/ensure-actor-flow.d.ts +16 -0
- package/dist/src/data-flow/ensure-actor-flow.js +101 -0
- package/dist/src/data-flow/ensure-manifest-declared-flows.d.ts +14 -0
- package/dist/src/data-flow/ensure-manifest-declared-flows.js +76 -0
- package/dist/src/data-flow/ensure-section-api-flows.d.ts +6 -0
- package/dist/src/data-flow/ensure-section-api-flows.js +57 -0
- package/dist/src/data-flow/flow-builder.d.ts +5 -0
- package/dist/src/data-flow/flow-builder.js +80 -0
- package/dist/src/data-flow/import-graph.d.ts +10 -0
- package/dist/src/data-flow/import-graph.js +147 -0
- package/dist/src/data-flow/index.d.ts +8 -0
- package/dist/src/data-flow/index.js +20 -0
- package/dist/src/data-flow/internal-fetch.d.ts +8 -0
- package/dist/src/data-flow/internal-fetch.js +209 -0
- package/dist/src/data-flow/postprocess.d.ts +9 -0
- package/dist/src/data-flow/postprocess.js +63 -0
- package/dist/src/data-flow/rewire.d.ts +10 -0
- package/dist/src/data-flow/rewire.js +93 -0
- package/dist/src/data-flow/source-attribution.d.ts +8 -0
- package/dist/src/data-flow/source-attribution.js +131 -0
- package/dist/src/data-flow/source-resolution.d.ts +13 -0
- package/dist/src/data-flow/source-resolution.js +61 -0
- package/dist/src/data-flow/target-matching.d.ts +21 -0
- package/dist/src/data-flow/target-matching.js +253 -0
- package/dist/src/data-flow/terraform-flows.d.ts +32 -0
- package/dist/src/data-flow/terraform-flows.js +170 -0
- package/dist/src/evals/metrics.d.ts +18 -0
- package/dist/src/evals/metrics.js +58 -0
- package/dist/src/evals/run-model-matrix.d.ts +1 -0
- package/dist/src/evals/run-model-matrix.js +68 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +20 -0
- package/dist/src/ingest/file-system.d.ts +17 -0
- package/dist/src/ingest/file-system.js +239 -0
- package/dist/src/ingest/gitignore.d.ts +12 -0
- package/dist/src/ingest/gitignore.js +127 -0
- package/dist/src/ingest/sensitive-paths.d.ts +2 -0
- package/dist/src/ingest/sensitive-paths.js +8 -0
- package/dist/src/observability/scan-sentry.d.ts +20 -0
- package/dist/src/observability/scan-sentry.js +133 -0
- package/dist/src/output/json.d.ts +51 -0
- package/dist/src/output/json.js +59 -0
- package/dist/src/patterns/config.d.ts +22 -0
- package/dist/src/patterns/config.js +119 -0
- package/dist/src/patterns/detectors/helpers.d.ts +19 -0
- package/dist/src/patterns/detectors/helpers.js +68 -0
- package/dist/src/patterns/detectors/python.d.ts +8 -0
- package/dist/src/patterns/detectors/python.js +412 -0
- package/dist/src/patterns/detectors/typescript.d.ts +8 -0
- package/dist/src/patterns/detectors/typescript.js +328 -0
- package/dist/src/patterns/engine.d.ts +40 -0
- package/dist/src/patterns/engine.js +111 -0
- package/dist/src/patterns/flow-source-patterns.d.ts +6 -0
- package/dist/src/patterns/flow-source-patterns.js +39 -0
- package/dist/src/patterns/frontend-frameworks.d.ts +4 -0
- package/dist/src/patterns/frontend-frameworks.js +25 -0
- package/dist/src/patterns/scan-exclusions.d.ts +14 -0
- package/dist/src/patterns/scan-exclusions.js +76 -0
- package/dist/src/platform-api/dataparade-api-base-url.d.ts +8 -0
- package/dist/src/platform-api/dataparade-api-base-url.js +17 -0
- package/dist/src/platform-api/estimate-scan-footprint.d.ts +8 -0
- package/dist/src/platform-api/estimate-scan-footprint.js +120 -0
- package/dist/src/platform-api/scan-quota-client.d.ts +28 -0
- package/dist/src/platform-api/scan-quota-client.js +79 -0
- package/dist/src/tracing/langsmith-tracing.d.ts +37 -0
- package/dist/src/tracing/langsmith-tracing.js +171 -0
- package/dist/tests/cli/cli.spec.d.ts +1 -0
- package/dist/tests/cli/cli.spec.js +87 -0
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.d.ts +2 -0
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.js +8 -0
- package/dist/tests/fixtures/e2e-ts-sample/db.d.ts +3 -0
- package/dist/tests/fixtures/e2e-ts-sample/db.js +7 -0
- package/dist/tests/fixtures/e2e-ts-sample/external-api.d.ts +1 -0
- package/dist/tests/fixtures/e2e-ts-sample/external-api.js +18 -0
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.d.ts +3 -0
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.js +7 -0
- package/dist/tests/fixtures/e2e-ts-sample/server.d.ts +14 -0
- package/dist/tests/fixtures/e2e-ts-sample/server.js +4 -0
- package/dist/tests/fixtures/e2e-ts-sentry-route-env/server.d.ts +1 -0
- package/dist/tests/fixtures/e2e-ts-sentry-route-env/server.js +24 -0
- package/dist/tests/fixtures/ingest-basic/src/index.d.ts +1 -0
- package/dist/tests/fixtures/ingest-basic/src/index.js +6 -0
- package/dist/tests/fixtures/mixed-language-basic/api.d.ts +2 -0
- package/dist/tests/fixtures/mixed-language-basic/api.js +12 -0
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.d.ts +1 -0
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.js +6 -0
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.d.ts +1 -0
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.js +6 -0
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.d.ts +1 -0
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.js +7 -0
- package/dist/tests/fixtures/typescript-basic/app/route.d.ts +1 -0
- package/dist/tests/fixtures/typescript-basic/app/route.js +7 -0
- package/dist/tests/fixtures/typescript-basic/db-client-import.d.ts +2 -0
- package/dist/tests/fixtures/typescript-basic/db-client-import.js +8 -0
- package/dist/tests/fixtures/typescript-basic/db.d.ts +3 -0
- package/dist/tests/fixtures/typescript-basic/db.js +7 -0
- package/dist/tests/fixtures/typescript-basic/external-api.d.ts +1 -0
- package/dist/tests/fixtures/typescript-basic/external-api.js +18 -0
- package/dist/tests/fixtures/typescript-basic/pg-client.d.ts +3 -0
- package/dist/tests/fixtures/typescript-basic/pg-client.js +7 -0
- package/dist/tests/fixtures/typescript-basic/server.d.ts +14 -0
- package/dist/tests/fixtures/typescript-basic/server.js +4 -0
- package/dist/tests/fixtures/typescript-dependency-manifests-basic/src/index.d.ts +0 -0
- package/dist/tests/fixtures/typescript-dependency-manifests-basic/src/index.js +2 -0
- package/dist/tests/helpers/scan-result-builders.d.ts +2 -0
- package/dist/tests/helpers/scan-result-builders.js +15 -0
- package/dist/tests/schema/dataflow-wrapper.schema.spec.d.ts +1 -0
- package/dist/tests/schema/dataflow-wrapper.schema.spec.js +89 -0
- package/dist/tests/schema/diagram-graph.schema.spec.d.ts +1 -0
- package/dist/tests/schema/diagram-graph.schema.spec.js +48 -0
- package/dist/tests/schema/scan-config.schema.spec.d.ts +1 -0
- package/dist/tests/schema/scan-config.schema.spec.js +135 -0
- package/dist/tests/schema/scan-result.schema.spec.d.ts +1 -0
- package/dist/tests/schema/scan-result.schema.spec.js +177 -0
- package/dist/tests/unit/ai-enrichment/agent-orchestrator.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/agent-orchestrator.spec.js +483 -0
- package/dist/tests/unit/ai-enrichment/candidate-selector.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/candidate-selector.spec.js +106 -0
- package/dist/tests/unit/ai-enrichment/create-ai-provider.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/create-ai-provider.spec.js +32 -0
- package/dist/tests/unit/ai-enrichment/endpoint-resolution.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/endpoint-resolution.spec.js +47 -0
- package/dist/tests/unit/ai-enrichment/fallbacks.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/fallbacks.spec.js +1304 -0
- package/dist/tests/unit/ai-enrichment/families/chat-completions-family.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/families/chat-completions-family.spec.js +219 -0
- package/dist/tests/unit/ai-enrichment/families/generate-content-family.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/families/generate-content-family.spec.js +119 -0
- package/dist/tests/unit/ai-enrichment/families/messages-family.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/families/messages-family.spec.js +129 -0
- package/dist/tests/unit/ai-enrichment/families/ollama-generate-family.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/families/ollama-generate-family.spec.js +69 -0
- package/dist/tests/unit/ai-enrichment/merge-rules.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/merge-rules.spec.js +422 -0
- package/dist/tests/unit/ai-enrichment/openai-proposals-response.schema.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/openai-proposals-response.schema.spec.js +30 -0
- package/dist/tests/unit/ai-enrichment/pipeline.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/pipeline.spec.js +120 -0
- package/dist/tests/unit/ai-enrichment/planner.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/planner.spec.js +106 -0
- package/dist/tests/unit/ai-enrichment/platform-proxy-provider.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/platform-proxy-provider.spec.js +51 -0
- package/dist/tests/unit/ai-enrichment/provider-contract.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-contract.spec.js +244 -0
- package/dist/tests/unit/ai-enrichment/provider-json-parse.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-json-parse.spec.js +24 -0
- package/dist/tests/unit/ai-enrichment/provider-output-token-budget.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-output-token-budget.spec.js +15 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt-env.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt-env.spec.js +54 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt.spec.js +206 -0
- package/dist/tests/unit/ai-enrichment/provider-topology-terraform-aws.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-topology-terraform-aws.spec.js +43 -0
- package/dist/tests/unit/ai-enrichment/provider-topology-terraform-kubernetes.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-topology-terraform-kubernetes.spec.js +40 -0
- package/dist/tests/unit/ai-enrichment/providers/fetch-with-timeout.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/providers/fetch-with-timeout.spec.js +22 -0
- package/dist/tests/unit/ai-enrichment/resolve-provider.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/resolve-provider.spec.js +67 -0
- package/dist/tests/unit/ai-enrichment/scan-paths-exact.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/scan-paths-exact.spec.js +35 -0
- package/dist/tests/unit/ai-enrichment/scan-paths.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/scan-paths.spec.js +21 -0
- package/dist/tests/unit/ai-enrichment/sensitive-paths.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/sensitive-paths.spec.js +20 -0
- package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.js +963 -0
- package/dist/tests/unit/ai-enrichment/third-party-evidence.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/third-party-evidence.spec.js +117 -0
- package/dist/tests/unit/ai-enrichment/third-party-subtype.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/third-party-subtype.spec.js +45 -0
- package/dist/tests/unit/ai-enrichment/tools-validation.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/tools-validation.spec.js +66 -0
- package/dist/tests/unit/analyzers/python/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/python/parser.spec.js +104 -0
- package/dist/tests/unit/analyzers/python/patterns.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/python/patterns.spec.js +289 -0
- package/dist/tests/unit/analyzers/registry.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/registry.spec.js +234 -0
- package/dist/tests/unit/analyzers/terraform/classifier-subtype-parity.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/classifier-subtype-parity.spec.js +87 -0
- package/dist/tests/unit/analyzers/terraform/detector.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/detector.spec.js +110 -0
- package/dist/tests/unit/analyzers/terraform/generated-provider-hints.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/generated-provider-hints.spec.js +53 -0
- package/dist/tests/unit/analyzers/terraform/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/parser.spec.js +56 -0
- package/dist/tests/unit/analyzers/terraform/terraform-module-manifest.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/terraform-module-manifest.spec.js +63 -0
- package/dist/tests/unit/analyzers/terraform/terraform-utility-resource.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/terraform-utility-resource.spec.js +19 -0
- package/dist/tests/unit/analyzers/terraform-exec.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform-exec.spec.js +27 -0
- package/dist/tests/unit/analyzers/terraform-show-json.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform-show-json.spec.js +77 -0
- package/dist/tests/unit/analyzers/typescript/dependency-manifests.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/dependency-manifests.spec.js +61 -0
- package/dist/tests/unit/analyzers/typescript/detector.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/detector.spec.js +225 -0
- package/dist/tests/unit/analyzers/typescript/external-apis-auth0.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/external-apis-auth0.spec.js +49 -0
- package/dist/tests/unit/analyzers/typescript/external-apis-sentry.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/external-apis-sentry.spec.js +27 -0
- package/dist/tests/unit/analyzers/typescript/fixture-integration.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/fixture-integration.spec.js +64 -0
- package/dist/tests/unit/analyzers/typescript/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/parser.spec.js +99 -0
- package/dist/tests/unit/analyzers/typescript/pattern-config.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/pattern-config.spec.js +24 -0
- package/dist/tests/unit/analyzers/typescript/property-detection.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/property-detection.spec.js +138 -0
- package/dist/tests/unit/classifier/classify.spec.d.ts +1 -0
- package/dist/tests/unit/classifier/classify.spec.js +1453 -0
- package/dist/tests/unit/classifier/enhance.spec.d.ts +1 -0
- package/dist/tests/unit/classifier/enhance.spec.js +400 -0
- package/dist/tests/unit/classifier/external-url-third-party.spec.d.ts +1 -0
- package/dist/tests/unit/classifier/external-url-third-party.spec.js +83 -0
- package/dist/tests/unit/classifier/frontend-framework-grouping.spec.d.ts +1 -0
- package/dist/tests/unit/classifier/frontend-framework-grouping.spec.js +44 -0
- package/dist/tests/unit/classifier/terraform-grouping.spec.d.ts +1 -0
- package/dist/tests/unit/classifier/terraform-grouping.spec.js +96 -0
- package/dist/tests/unit/cli/config-command.spec.d.ts +1 -0
- package/dist/tests/unit/cli/config-command.spec.js +51 -0
- package/dist/tests/unit/cli/scan-command-ai-flags.spec.d.ts +0 -0
- package/dist/tests/unit/cli/scan-command-ai-flags.spec.js +149 -0
- package/dist/tests/unit/cli/scan-command-diagram-graph.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-diagram-graph.spec.js +26 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-app-plus-terraform.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-app-plus-terraform.spec.js +107 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-front-back-sections.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-front-back-sections.spec.js +74 -0
- package/dist/tests/unit/cli/scan-command-e2e-python-basic.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-python-basic.spec.js +43 -0
- package/dist/tests/unit/cli/scan-command-e2e-terraform-basic.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-terraform-basic.spec.js +62 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sample.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sample.spec.js +41 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sentry-route-env.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sentry-route-env.spec.js +85 -0
- package/dist/tests/unit/cli/scan-command-exit-code.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-exit-code.spec.js +131 -0
- package/dist/tests/unit/cli/scan-quota-flow.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-quota-flow.spec.js +76 -0
- package/dist/tests/unit/config/property-detection-config.spec.d.ts +1 -0
- package/dist/tests/unit/config/property-detection-config.spec.js +38 -0
- package/dist/tests/unit/config/redact.spec.d.ts +1 -0
- package/dist/tests/unit/config/redact.spec.js +19 -0
- package/dist/tests/unit/config/resolve-config.spec.d.ts +1 -0
- package/dist/tests/unit/config/resolve-config.spec.js +172 -0
- package/dist/tests/unit/config/scan-env-debug.spec.d.ts +1 -0
- package/dist/tests/unit/config/scan-env-debug.spec.js +17 -0
- package/dist/tests/unit/config/validate-scan-ai.spec.d.ts +1 -0
- package/dist/tests/unit/config/validate-scan-ai.spec.js +53 -0
- package/dist/tests/unit/core/classifier-phase-regressions.spec.d.ts +1 -0
- package/dist/tests/unit/core/classifier-phase-regressions.spec.js +68 -0
- package/dist/tests/unit/core/dependency-manifest-performance-budgets.spec.d.ts +1 -0
- package/dist/tests/unit/core/dependency-manifest-performance-budgets.spec.js +66 -0
- package/dist/tests/unit/core/dependency-manifest-toggles-confidence.spec.d.ts +1 -0
- package/dist/tests/unit/core/dependency-manifest-toggles-confidence.spec.js +132 -0
- package/dist/tests/unit/core/discover-service-sections.spec.d.ts +1 -0
- package/dist/tests/unit/core/discover-service-sections.spec.js +204 -0
- package/dist/tests/unit/core/graph-mapping.spec.d.ts +1 -0
- package/dist/tests/unit/core/graph-mapping.spec.js +779 -0
- package/dist/tests/unit/core/invariant-tests-dedupe-determinism.spec.d.ts +1 -0
- package/dist/tests/unit/core/invariant-tests-dedupe-determinism.spec.js +64 -0
- package/dist/tests/unit/core/manifest-package-hub.spec.d.ts +1 -0
- package/dist/tests/unit/core/manifest-package-hub.spec.js +53 -0
- package/dist/tests/unit/core/monorepo-package-sections.spec.d.ts +1 -0
- package/dist/tests/unit/core/monorepo-package-sections.spec.js +121 -0
- package/dist/tests/unit/core/no-source-code-leakage.spec.d.ts +1 -0
- package/dist/tests/unit/core/no-source-code-leakage.spec.js +48 -0
- package/dist/tests/unit/core/orchestrator.spec.d.ts +1 -0
- package/dist/tests/unit/core/orchestrator.spec.js +252 -0
- package/dist/tests/unit/core/output-json.spec.d.ts +1 -0
- package/dist/tests/unit/core/output-json.spec.js +65 -0
- package/dist/tests/unit/core/parsing-error-handling-nonfatal.spec.d.ts +1 -0
- package/dist/tests/unit/core/parsing-error-handling-nonfatal.spec.js +42 -0
- package/dist/tests/unit/core/resolve-path-under-scan-root.spec.d.ts +1 -0
- package/dist/tests/unit/core/resolve-path-under-scan-root.spec.js +54 -0
- package/dist/tests/unit/core/scan-result-language-stats.spec.d.ts +1 -0
- package/dist/tests/unit/core/scan-result-language-stats.spec.js +15 -0
- package/dist/tests/unit/core/section-discovery-excludes.spec.d.ts +1 -0
- package/dist/tests/unit/core/section-discovery-excludes.spec.js +49 -0
- package/dist/tests/unit/core/section-runtime.spec.d.ts +1 -0
- package/dist/tests/unit/core/section-runtime.spec.js +166 -0
- package/dist/tests/unit/core/stable-component-ids.spec.d.ts +1 -0
- package/dist/tests/unit/core/stable-component-ids.spec.js +112 -0
- package/dist/tests/unit/core/structural-scan.spec.d.ts +1 -0
- package/dist/tests/unit/core/structural-scan.spec.js +83 -0
- package/dist/tests/unit/core/terraform-json-overlay.spec.d.ts +1 -0
- package/dist/tests/unit/core/terraform-json-overlay.spec.js +36 -0
- package/dist/tests/unit/core/terraform-minimal-services.spec.d.ts +1 -0
- package/dist/tests/unit/core/terraform-minimal-services.spec.js +378 -0
- package/dist/tests/unit/data-flow/application-hub.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/application-hub.spec.js +48 -0
- package/dist/tests/unit/data-flow/cross-section-terraform-bridge.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/cross-section-terraform-bridge.spec.js +95 -0
- package/dist/tests/unit/data-flow/dedupe.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/dedupe.spec.js +134 -0
- package/dist/tests/unit/data-flow/detector.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/detector.spec.js +1254 -0
- package/dist/tests/unit/data-flow/drop-cross-section-flows.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/drop-cross-section-flows.spec.js +132 -0
- package/dist/tests/unit/data-flow/ensure-actor-flow.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/ensure-actor-flow.spec.js +233 -0
- package/dist/tests/unit/data-flow/ensure-manifest-declared-flows.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/ensure-manifest-declared-flows.spec.js +125 -0
- package/dist/tests/unit/data-flow/ensure-section-api-flows.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/ensure-section-api-flows.spec.js +40 -0
- package/dist/tests/unit/data-flow/postprocess.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/postprocess.spec.js +78 -0
- package/dist/tests/unit/data-flow/rewire.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/rewire.spec.js +194 -0
- package/dist/tests/unit/data-flow/terraform-flows.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/terraform-flows.spec.js +199 -0
- package/dist/tests/unit/evals/metrics.spec.d.ts +1 -0
- package/dist/tests/unit/evals/metrics.spec.js +54 -0
- package/dist/tests/unit/ingest/env-exclusion.spec.d.ts +1 -0
- package/dist/tests/unit/ingest/env-exclusion.spec.js +43 -0
- package/dist/tests/unit/ingest/file-system.spec.d.ts +1 -0
- package/dist/tests/unit/ingest/file-system.spec.js +180 -0
- package/dist/tests/unit/ingest/gitignore.spec.d.ts +1 -0
- package/dist/tests/unit/ingest/gitignore.spec.js +30 -0
- package/dist/tests/unit/observability/scan-sentry.spec.d.ts +1 -0
- package/dist/tests/unit/observability/scan-sentry.spec.js +60 -0
- package/dist/tests/unit/patterns/scan-exclusions.spec.d.ts +1 -0
- package/dist/tests/unit/patterns/scan-exclusions.spec.js +58 -0
- package/dist/tests/unit/pipeline/ai-orchestrator-options.spec.d.ts +1 -0
- package/dist/tests/unit/pipeline/ai-orchestrator-options.spec.js +19 -0
- package/dist/tests/unit/platform-api/dataparade-api-base-url.spec.d.ts +1 -0
- package/dist/tests/unit/platform-api/dataparade-api-base-url.spec.js +19 -0
- package/dist/tests/unit/platform-api/estimate-scan-footprint.spec.d.ts +1 -0
- package/dist/tests/unit/platform-api/estimate-scan-footprint.spec.js +50 -0
- package/dist/tests/unit/tracing/langsmith-tracing.spec.d.ts +1 -0
- package/dist/tests/unit/tracing/langsmith-tracing.spec.js +118 -0
- package/package.json +84 -0
|
@@ -0,0 +1,762 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyDeterministicInferenceFallbacks = applyDeterministicInferenceFallbacks;
|
|
4
|
+
const terraform_flows_1 = require("../data-flow/terraform-flows");
|
|
5
|
+
const provider_topology_rules_1 = require("./provider-topology-rules");
|
|
6
|
+
const provider_topology_shared_1 = require("./provider-topology-shared");
|
|
7
|
+
function componentById(components) {
|
|
8
|
+
return new Map(components.map((component) => [component.id, component]));
|
|
9
|
+
}
|
|
10
|
+
function flowPairKey(flow) {
|
|
11
|
+
return `${flow.sourceComponentId}::${flow.targetComponentId}`;
|
|
12
|
+
}
|
|
13
|
+
function preferFlow(existing, candidate) {
|
|
14
|
+
const existingFallback = existing.id.startsWith("flow_fallback_");
|
|
15
|
+
const candidateFallback = candidate.id.startsWith("flow_fallback_");
|
|
16
|
+
if (existingFallback !== candidateFallback) {
|
|
17
|
+
return existingFallback ? candidate : existing;
|
|
18
|
+
}
|
|
19
|
+
return (candidate.confidence ?? 0) > (existing.confidence ?? 0) ? candidate : existing;
|
|
20
|
+
}
|
|
21
|
+
function dedupeDirectionalFlows(flows) {
|
|
22
|
+
const chosen = new Map();
|
|
23
|
+
const order = [];
|
|
24
|
+
for (const flow of flows) {
|
|
25
|
+
const key = flowPairKey(flow);
|
|
26
|
+
const current = chosen.get(key);
|
|
27
|
+
if (!current) {
|
|
28
|
+
chosen.set(key, flow);
|
|
29
|
+
order.push(key);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
chosen.set(key, preferFlow(current, flow));
|
|
33
|
+
}
|
|
34
|
+
return order
|
|
35
|
+
.map((key) => chosen.get(key))
|
|
36
|
+
.filter((flow) => Boolean(flow));
|
|
37
|
+
}
|
|
38
|
+
function unorderedFlowPairKey(flow) {
|
|
39
|
+
return [flow.sourceComponentId, flow.targetComponentId].sort().join("::");
|
|
40
|
+
}
|
|
41
|
+
function enforceSingleDirectionPerPair(flows) {
|
|
42
|
+
const chosen = new Map();
|
|
43
|
+
const order = [];
|
|
44
|
+
for (const flow of flows) {
|
|
45
|
+
const key = unorderedFlowPairKey(flow);
|
|
46
|
+
const current = chosen.get(key);
|
|
47
|
+
if (!current) {
|
|
48
|
+
chosen.set(key, flow);
|
|
49
|
+
order.push(key);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
chosen.set(key, preferFlow(current, flow));
|
|
53
|
+
}
|
|
54
|
+
return order
|
|
55
|
+
.map((key) => chosen.get(key))
|
|
56
|
+
.filter((flow) => Boolean(flow));
|
|
57
|
+
}
|
|
58
|
+
/** True for service sections (not root / unsectioned / global). */
|
|
59
|
+
function isConcreteServiceSectionId(sectionId, policy) {
|
|
60
|
+
const sid = sectionId.trim();
|
|
61
|
+
if (!sid)
|
|
62
|
+
return false;
|
|
63
|
+
if (policy.nonConcreteSectionIds.includes(sid.toLowerCase()))
|
|
64
|
+
return false;
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
function sectionHasMainApplicationAsset(components, sectionId) {
|
|
68
|
+
return components.some((c) => c.type === "asset" &&
|
|
69
|
+
String(c.properties?.section_id ?? "") === sectionId &&
|
|
70
|
+
(c.properties?.isMainApplication === true ||
|
|
71
|
+
c.properties?.isMainApplication === "true"));
|
|
72
|
+
}
|
|
73
|
+
function getStringValues(value) {
|
|
74
|
+
if (typeof value === "string")
|
|
75
|
+
return [value.toLowerCase()];
|
|
76
|
+
if (!Array.isArray(value))
|
|
77
|
+
return [];
|
|
78
|
+
return value
|
|
79
|
+
.filter((v) => typeof v === "string")
|
|
80
|
+
.map((v) => v.toLowerCase());
|
|
81
|
+
}
|
|
82
|
+
function componentMatchesProvider(component, keys) {
|
|
83
|
+
const serviceNameValues = getStringValues(component.properties?.serviceName);
|
|
84
|
+
const name = (component.name || "").trim().toLowerCase();
|
|
85
|
+
const corpus = new Set([name, ...serviceNameValues]);
|
|
86
|
+
return keys.some((k) => corpus.has(k) || name.includes(k));
|
|
87
|
+
}
|
|
88
|
+
function isManagedResourceComponent(component, managedResource, fallbackPolicy) {
|
|
89
|
+
if (!(component.type === "asset" && component.subType === "database"))
|
|
90
|
+
return false;
|
|
91
|
+
const clients = getStringValues(component.properties?.client);
|
|
92
|
+
const dbTypeValues = getStringValues(component.properties?.databaseType);
|
|
93
|
+
const name = (component.name || "").toLowerCase();
|
|
94
|
+
const corpus = [...clients, ...dbTypeValues, name];
|
|
95
|
+
const hints = managedResource.matchHints.length > 0
|
|
96
|
+
? managedResource.matchHints
|
|
97
|
+
: fallbackPolicy.managedResourceMatchHintsByKind[managedResource.kind];
|
|
98
|
+
if (managedResource.kind === "database") {
|
|
99
|
+
return corpus.some((v) => hints.some((hint) => v.includes(hint)));
|
|
100
|
+
}
|
|
101
|
+
if (managedResource.kind === "cache") {
|
|
102
|
+
return corpus.some((v) => hints.some((hint) => v.includes(hint)));
|
|
103
|
+
}
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
function hasAnyClientMatch(component, keys) {
|
|
107
|
+
if (keys.length === 0)
|
|
108
|
+
return false;
|
|
109
|
+
const clients = getStringValues(component.properties?.client);
|
|
110
|
+
return clients.some((client) => keys.some((k) => client.includes(k)));
|
|
111
|
+
}
|
|
112
|
+
function hasDirectClientMatch(component, directKeys, viaKeys) {
|
|
113
|
+
if (directKeys.length === 0)
|
|
114
|
+
return false;
|
|
115
|
+
const clients = getStringValues(component.properties?.client);
|
|
116
|
+
return clients.some((client) => {
|
|
117
|
+
const matchesDirect = directKeys.some((k) => client.includes(k));
|
|
118
|
+
if (!matchesDirect)
|
|
119
|
+
return false;
|
|
120
|
+
const matchesVia = viaKeys.some((k) => client.includes(k));
|
|
121
|
+
return !matchesVia;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function normalizeSectionId(raw) {
|
|
125
|
+
const value = String(raw ?? "").trim().toLowerCase();
|
|
126
|
+
if (!value || value === "root" || value === "<unsectioned>" || value === "global") {
|
|
127
|
+
return "";
|
|
128
|
+
}
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
function areSectionCompatible(source, provider, target) {
|
|
132
|
+
const sourceSection = normalizeSectionId(source.properties?.section_id);
|
|
133
|
+
const providerSection = normalizeSectionId(provider.properties?.section_id);
|
|
134
|
+
const targetSection = normalizeSectionId(target.properties?.section_id);
|
|
135
|
+
if (providerSection && targetSection && providerSection !== targetSection) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
if (sourceSection && providerSection && sourceSection !== providerSection) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
function areComponentsSectionCompatible(left, right) {
|
|
144
|
+
const leftSection = normalizeSectionId(left.properties?.section_id);
|
|
145
|
+
const rightSection = normalizeSectionId(right.properties?.section_id);
|
|
146
|
+
if (leftSection && rightSection && leftSection !== rightSection) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
function providerUsageCorpus(provider, flows) {
|
|
152
|
+
const corpus = [];
|
|
153
|
+
const props = provider.properties ?? {};
|
|
154
|
+
const propSignals = [
|
|
155
|
+
provider.name,
|
|
156
|
+
props.serviceName,
|
|
157
|
+
props.client,
|
|
158
|
+
props.vendor,
|
|
159
|
+
props.integration_method,
|
|
160
|
+
props.api_type,
|
|
161
|
+
props.authentication_method,
|
|
162
|
+
props.section_id,
|
|
163
|
+
props.section_label,
|
|
164
|
+
props.section_role,
|
|
165
|
+
];
|
|
166
|
+
for (const signal of propSignals) {
|
|
167
|
+
if (signal == null)
|
|
168
|
+
continue;
|
|
169
|
+
if (Array.isArray(signal)) {
|
|
170
|
+
for (const item of signal) {
|
|
171
|
+
const text = String(item ?? "").trim().toLowerCase();
|
|
172
|
+
if (text)
|
|
173
|
+
corpus.push(text);
|
|
174
|
+
}
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
const text = String(signal).trim().toLowerCase();
|
|
178
|
+
if (text)
|
|
179
|
+
corpus.push(text);
|
|
180
|
+
}
|
|
181
|
+
for (const loc of provider.sourceLocations ?? []) {
|
|
182
|
+
if (loc.filePath)
|
|
183
|
+
corpus.push(loc.filePath.toLowerCase());
|
|
184
|
+
}
|
|
185
|
+
for (const ref of provider.detectedFrom ?? []) {
|
|
186
|
+
if (ref.pattern)
|
|
187
|
+
corpus.push(String(ref.pattern).toLowerCase());
|
|
188
|
+
const fp = ref.sourceLocation?.filePath;
|
|
189
|
+
if (fp)
|
|
190
|
+
corpus.push(fp.toLowerCase());
|
|
191
|
+
}
|
|
192
|
+
for (const flow of flows) {
|
|
193
|
+
if (flow.targetComponentId !== provider.id && flow.sourceComponentId !== provider.id)
|
|
194
|
+
continue;
|
|
195
|
+
if (flow.description)
|
|
196
|
+
corpus.push(flow.description.toLowerCase());
|
|
197
|
+
for (const loc of flow.sourceLocations ?? []) {
|
|
198
|
+
if (loc.filePath)
|
|
199
|
+
corpus.push(loc.filePath.toLowerCase());
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return corpus;
|
|
203
|
+
}
|
|
204
|
+
function hasUsageSignal(corpus, signals) {
|
|
205
|
+
if (signals.length === 0)
|
|
206
|
+
return false;
|
|
207
|
+
return signals.some((sig) => corpus.some((entry) => entry.includes(sig)));
|
|
208
|
+
}
|
|
209
|
+
function isPostgresLikeDatabase(component, policy) {
|
|
210
|
+
if (!(component.type === "asset" && component.subType === "database"))
|
|
211
|
+
return false;
|
|
212
|
+
const clients = getStringValues(component.properties?.client);
|
|
213
|
+
const name = (component.name || "").toLowerCase();
|
|
214
|
+
const corpus = [...clients, name];
|
|
215
|
+
return corpus.some((v) => policy.postgresLikeSignals.some((signal) => v.includes(signal)));
|
|
216
|
+
}
|
|
217
|
+
function isGenericLocalPgNode(component, policy) {
|
|
218
|
+
if (!(component.type === "asset" && component.subType === "database"))
|
|
219
|
+
return false;
|
|
220
|
+
if (component.properties?.managed_by_provider)
|
|
221
|
+
return false;
|
|
222
|
+
const name = String(component.name ?? "").trim().toLowerCase();
|
|
223
|
+
const clients = getStringValues(component.properties?.client);
|
|
224
|
+
const genericName = policy.genericPgNodeNames.includes(name);
|
|
225
|
+
const genericClient = clients.some((v) => policy.genericPgClientSignals.includes(v));
|
|
226
|
+
return genericName || genericClient;
|
|
227
|
+
}
|
|
228
|
+
function collapseGenericPgIntoManagedProviderNodes(components, flows, rulesByProviderServiceName, policy) {
|
|
229
|
+
const managedBySection = new Map();
|
|
230
|
+
for (const component of components) {
|
|
231
|
+
if (component.properties?.managed_service_key !== "postgres")
|
|
232
|
+
continue;
|
|
233
|
+
if (typeof component.properties?.managed_by_provider !== "string")
|
|
234
|
+
continue;
|
|
235
|
+
const sectionId = normalizeSectionId(component.properties?.section_id);
|
|
236
|
+
if (!sectionId)
|
|
237
|
+
continue;
|
|
238
|
+
if (!managedBySection.has(sectionId))
|
|
239
|
+
managedBySection.set(sectionId, component.id);
|
|
240
|
+
}
|
|
241
|
+
const providersBySection = new Map();
|
|
242
|
+
const managedChildrenByProvider = new Map();
|
|
243
|
+
for (const component of components) {
|
|
244
|
+
const sectionId = normalizeSectionId(component.properties?.section_id);
|
|
245
|
+
if (!sectionId)
|
|
246
|
+
continue;
|
|
247
|
+
if (component.type === "third_party") {
|
|
248
|
+
const list = providersBySection.get(sectionId) ?? [];
|
|
249
|
+
list.push(component);
|
|
250
|
+
providersBySection.set(sectionId, list);
|
|
251
|
+
}
|
|
252
|
+
const managedBy = String(component.properties?.managed_by_provider ?? "").trim();
|
|
253
|
+
if (!managedBy)
|
|
254
|
+
continue;
|
|
255
|
+
managedChildrenByProvider.set(managedBy, (managedChildrenByProvider.get(managedBy) ?? 0) + 1);
|
|
256
|
+
}
|
|
257
|
+
const flowIdsToRemove = new Set();
|
|
258
|
+
const removeIds = new Set();
|
|
259
|
+
for (const component of components) {
|
|
260
|
+
if (!isGenericLocalPgNode(component, policy))
|
|
261
|
+
continue;
|
|
262
|
+
const sectionId = normalizeSectionId(component.properties?.section_id);
|
|
263
|
+
if (!sectionId)
|
|
264
|
+
continue;
|
|
265
|
+
const managedId = managedBySection.get(sectionId);
|
|
266
|
+
if (!managedId || managedId === component.id) {
|
|
267
|
+
const providers = providersBySection.get(sectionId) ?? [];
|
|
268
|
+
const providerWithTopology = providers.find((provider) => (managedChildrenByProvider.get(provider.id) ?? 0) > 0);
|
|
269
|
+
if (!providerWithTopology)
|
|
270
|
+
continue;
|
|
271
|
+
const providerServiceName = String(providerWithTopology.properties?.serviceName ?? providerWithTopology.name ?? "")
|
|
272
|
+
.trim()
|
|
273
|
+
.toLowerCase() || "provider";
|
|
274
|
+
const providerRule = rulesByProviderServiceName.get(providerServiceName);
|
|
275
|
+
const providerDisplay = providerDisplayFromServiceName(providerServiceName);
|
|
276
|
+
component.name = `${providerDisplay} Pg`;
|
|
277
|
+
component.properties = {
|
|
278
|
+
...component.properties,
|
|
279
|
+
managed_by_provider: providerWithTopology.id,
|
|
280
|
+
managed_service_key: "postgres",
|
|
281
|
+
serviceName: providerWithTopology.properties?.serviceName ?? providerServiceName,
|
|
282
|
+
generated_by: "provider_topology_fallback",
|
|
283
|
+
};
|
|
284
|
+
// Drop pre-collapse local DB flows for this node; keep provider->managed link only.
|
|
285
|
+
for (const flow of flows) {
|
|
286
|
+
const touchesComponent = flow.sourceComponentId === component.id || flow.targetComponentId === component.id;
|
|
287
|
+
if (!touchesComponent)
|
|
288
|
+
continue;
|
|
289
|
+
const isProviderManagedLink = flow.sourceComponentId === providerWithTopology.id &&
|
|
290
|
+
flow.targetComponentId === component.id;
|
|
291
|
+
if (!isProviderManagedLink)
|
|
292
|
+
flowIdsToRemove.add(flow.id);
|
|
293
|
+
}
|
|
294
|
+
const existingProviderEdge = flows.some((flow) => flow.sourceComponentId === providerWithTopology.id &&
|
|
295
|
+
flow.targetComponentId === component.id);
|
|
296
|
+
if (!existingProviderEdge) {
|
|
297
|
+
flows.push({
|
|
298
|
+
id: `flow_fallback_${flows.length + 1}`,
|
|
299
|
+
sourceComponentId: providerWithTopology.id,
|
|
300
|
+
targetComponentId: component.id,
|
|
301
|
+
type: "database_query",
|
|
302
|
+
confidence: providerRule?.confidence.collapseManagedPostgresFlowConfidence ?? 0.78,
|
|
303
|
+
description: `${providerWithTopology.name} provides ${component.name}`,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
managedBySection.set(sectionId, component.id);
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
removeIds.add(component.id);
|
|
310
|
+
}
|
|
311
|
+
if (removeIds.size === 0 && flowIdsToRemove.size === 0)
|
|
312
|
+
return components;
|
|
313
|
+
const retainedFlows = flows.filter((flow) => !flowIdsToRemove.has(flow.id) &&
|
|
314
|
+
!removeIds.has(flow.sourceComponentId) &&
|
|
315
|
+
!removeIds.has(flow.targetComponentId) &&
|
|
316
|
+
flow.sourceComponentId !== flow.targetComponentId);
|
|
317
|
+
flows.length = 0;
|
|
318
|
+
flows.push(...retainedFlows);
|
|
319
|
+
return components.filter((component) => !removeIds.has(component.id));
|
|
320
|
+
}
|
|
321
|
+
function removeDirectFlowsToManagedPostgres(components, flows) {
|
|
322
|
+
const byId = new Map(components.map((component) => [component.id, component]));
|
|
323
|
+
const retained = flows.filter((flow) => {
|
|
324
|
+
const target = byId.get(flow.targetComponentId);
|
|
325
|
+
if (!target)
|
|
326
|
+
return true;
|
|
327
|
+
if (target.properties?.managed_service_key !== "postgres")
|
|
328
|
+
return true;
|
|
329
|
+
const providerId = String(target.properties?.managed_by_provider ?? "");
|
|
330
|
+
if (!providerId)
|
|
331
|
+
return true;
|
|
332
|
+
// Keep only provider -> managed-postgres linkage.
|
|
333
|
+
if (flow.sourceComponentId === providerId)
|
|
334
|
+
return true;
|
|
335
|
+
return false;
|
|
336
|
+
});
|
|
337
|
+
flows.length = 0;
|
|
338
|
+
flows.push(...retained);
|
|
339
|
+
}
|
|
340
|
+
function collectSectionRolledUpProviderUsageCorpus(input) {
|
|
341
|
+
const base = providerUsageCorpus(input.provider, input.flows);
|
|
342
|
+
const section = normalizeSectionId(input.provider.properties?.section_id);
|
|
343
|
+
if (!section)
|
|
344
|
+
return base;
|
|
345
|
+
const rolledUp = [...base];
|
|
346
|
+
for (const other of input.providersInRule) {
|
|
347
|
+
if (other.id === input.provider.id)
|
|
348
|
+
continue;
|
|
349
|
+
const otherSection = normalizeSectionId(other.properties?.section_id);
|
|
350
|
+
if (!otherSection)
|
|
351
|
+
continue;
|
|
352
|
+
if (!otherSection.startsWith(`${section}/`))
|
|
353
|
+
continue;
|
|
354
|
+
rolledUp.push(...providerUsageCorpus(other, input.flows));
|
|
355
|
+
}
|
|
356
|
+
return rolledUp;
|
|
357
|
+
}
|
|
358
|
+
function dedupeSourceLocations(locations) {
|
|
359
|
+
const seen = new Set();
|
|
360
|
+
const result = [];
|
|
361
|
+
for (const loc of locations) {
|
|
362
|
+
const key = `${loc.filePath}:${loc.startLine}:${loc.endLine}`;
|
|
363
|
+
if (seen.has(key))
|
|
364
|
+
continue;
|
|
365
|
+
seen.add(key);
|
|
366
|
+
result.push(loc);
|
|
367
|
+
}
|
|
368
|
+
return result;
|
|
369
|
+
}
|
|
370
|
+
function providerDisplayFromServiceName(value) {
|
|
371
|
+
const normalized = value.trim();
|
|
372
|
+
if (!normalized)
|
|
373
|
+
return normalized;
|
|
374
|
+
return normalized.charAt(0).toUpperCase() + normalized.slice(1);
|
|
375
|
+
}
|
|
376
|
+
function providerEvidenceForManagedNode(provider, managedNode) {
|
|
377
|
+
const detectedFrom = provider.detectedFrom ?? [];
|
|
378
|
+
const sourceLocations = provider.sourceLocations ?? [];
|
|
379
|
+
const evidencePatterns = new Set(managedNode.evidencePatterns);
|
|
380
|
+
if (evidencePatterns.size === 0) {
|
|
381
|
+
return {
|
|
382
|
+
detectedFrom: [...detectedFrom],
|
|
383
|
+
sourceLocations: [...sourceLocations],
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
const filteredDetectedFrom = detectedFrom.filter((ref) => evidencePatterns.has(String(ref.pattern ?? "").toLowerCase()));
|
|
387
|
+
const filteredSourceLocations = dedupeSourceLocations(filteredDetectedFrom
|
|
388
|
+
.map((ref) => ref.sourceLocation)
|
|
389
|
+
.filter((loc) => Boolean(loc)));
|
|
390
|
+
return {
|
|
391
|
+
detectedFrom: filteredDetectedFrom.length > 0 ? filteredDetectedFrom : [...detectedFrom],
|
|
392
|
+
sourceLocations: filteredSourceLocations.length > 0
|
|
393
|
+
? filteredSourceLocations
|
|
394
|
+
: [...sourceLocations],
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
function isProviderManagedDatabaseTarget(target, provider, rule) {
|
|
398
|
+
const cloudProvider = String(target.properties?.cloud_provider ?? "").toLowerCase();
|
|
399
|
+
const targetService = String(target.properties?.serviceName ?? "").toLowerCase();
|
|
400
|
+
const targetVendor = String(target.properties?.vendor ?? "").toLowerCase();
|
|
401
|
+
const providerKey = rule.providerId.toLowerCase();
|
|
402
|
+
const hints = [cloudProvider, targetService, targetVendor];
|
|
403
|
+
if (hints.some((h) => h.includes(providerKey)))
|
|
404
|
+
return true;
|
|
405
|
+
// Shared-file inference is intentionally conservative: only Supabase gets this
|
|
406
|
+
// fallback because projects often colocate supabase + pg references.
|
|
407
|
+
if (!rule.allowManagedDatabaseSharedFileInference) {
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
const targetClients = getStringValues(target.properties?.client);
|
|
411
|
+
const targetName = String(target.name ?? "").toLowerCase();
|
|
412
|
+
const databaseRule = rule.managedResources.find((resource) => resource.kind === "database");
|
|
413
|
+
const sharedFileSignals = databaseRule?.directClients ?? [];
|
|
414
|
+
const allowsSharedFileProviderInference = [
|
|
415
|
+
...targetClients,
|
|
416
|
+
targetName,
|
|
417
|
+
].some((value) => sharedFileSignals.some((signal) => value.includes(signal)));
|
|
418
|
+
if (!allowsSharedFileProviderInference) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
const targetFiles = new Set((target.sourceLocations ?? [])
|
|
422
|
+
.map((loc) => loc.filePath)
|
|
423
|
+
.filter((p) => typeof p === "string"));
|
|
424
|
+
const providerFiles = new Set((provider.sourceLocations ?? [])
|
|
425
|
+
.map((loc) => loc.filePath)
|
|
426
|
+
.filter((p) => typeof p === "string"));
|
|
427
|
+
for (const file of targetFiles) {
|
|
428
|
+
if (providerFiles.has(file))
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
function selectPreferredApiSource(source, target, components) {
|
|
434
|
+
if (source.type !== "asset")
|
|
435
|
+
return undefined;
|
|
436
|
+
if (target.type !== "third_party")
|
|
437
|
+
return undefined;
|
|
438
|
+
const isMainApp = source.properties?.isMainApplication === true;
|
|
439
|
+
if (!isMainApp)
|
|
440
|
+
return undefined;
|
|
441
|
+
const sourceSection = String(source.properties?.section_id ?? "");
|
|
442
|
+
const candidates = components.filter((c) => {
|
|
443
|
+
if (c.id === source.id)
|
|
444
|
+
return false;
|
|
445
|
+
if (c.type !== "asset")
|
|
446
|
+
return false;
|
|
447
|
+
if (String(c.properties?.section_id ?? "") !== sourceSection)
|
|
448
|
+
return false;
|
|
449
|
+
if (c.subType !== "api")
|
|
450
|
+
return false;
|
|
451
|
+
return true;
|
|
452
|
+
});
|
|
453
|
+
if (candidates.length === 0)
|
|
454
|
+
return undefined;
|
|
455
|
+
return candidates[0];
|
|
456
|
+
}
|
|
457
|
+
function applyDeterministicInferenceFallbacks(components, flows) {
|
|
458
|
+
const nextComponents = components.map((c) => ({
|
|
459
|
+
...c,
|
|
460
|
+
properties: { ...c.properties },
|
|
461
|
+
}));
|
|
462
|
+
const byId = componentById(nextComponents);
|
|
463
|
+
const next = flows.map((flow) => ({ ...flow }));
|
|
464
|
+
const keys = new Set(next.map((flow) => flowPairKey(flow)));
|
|
465
|
+
const fallbackPolicy = (0, provider_topology_rules_1.loadProviderTopologyFallbackPolicy)();
|
|
466
|
+
for (const flow of next) {
|
|
467
|
+
const source = byId.get(flow.sourceComponentId);
|
|
468
|
+
const target = byId.get(flow.targetComponentId);
|
|
469
|
+
if (!source || !target)
|
|
470
|
+
continue;
|
|
471
|
+
// Actor/customer should generally call the app/API, not the opposite.
|
|
472
|
+
if (source.type === "asset" && target.type === "actor") {
|
|
473
|
+
const originalSource = flow.sourceComponentId;
|
|
474
|
+
flow.sourceComponentId = flow.targetComponentId;
|
|
475
|
+
flow.targetComponentId = originalSource;
|
|
476
|
+
flow.confidence = Math.max(flow.confidence, fallbackPolicy.actorTargetReverseConfidenceFloor);
|
|
477
|
+
}
|
|
478
|
+
// Prefer backend API nodes as caller for third-party integrations when
|
|
479
|
+
// frontend/main-app and API coexist in the same section.
|
|
480
|
+
const preferredApi = selectPreferredApiSource(source, target, nextComponents);
|
|
481
|
+
if (preferredApi) {
|
|
482
|
+
flow.sourceComponentId = preferredApi.id;
|
|
483
|
+
flow.confidence = Math.max(flow.confidence, fallbackPolicy.preferredApiSourceConfidenceFloor);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
// Keep de-duplication keys aligned after directional rewrites above.
|
|
487
|
+
keys.clear();
|
|
488
|
+
for (const flow of next) {
|
|
489
|
+
keys.add(flowPairKey(flow));
|
|
490
|
+
}
|
|
491
|
+
const providerRules = (0, provider_topology_rules_1.loadProviderTopologyRules)();
|
|
492
|
+
for (const rule of providerRules) {
|
|
493
|
+
const providers = nextComponents.filter((component) => component.type === "third_party" &&
|
|
494
|
+
componentMatchesProvider(component, rule.providerMatchKeys));
|
|
495
|
+
if (providers.length === 0)
|
|
496
|
+
continue;
|
|
497
|
+
for (const provider of providers) {
|
|
498
|
+
const canonicalName = rule.providerDisplayName;
|
|
499
|
+
const canonicalService = rule.canonicalServiceName;
|
|
500
|
+
if (canonicalName && provider.name !== canonicalName) {
|
|
501
|
+
provider.name = canonicalName;
|
|
502
|
+
}
|
|
503
|
+
provider.properties = {
|
|
504
|
+
...provider.properties,
|
|
505
|
+
serviceName: canonicalService,
|
|
506
|
+
};
|
|
507
|
+
const sectionId = String(provider.properties?.section_id ?? "root");
|
|
508
|
+
const usageCorpus = collectSectionRolledUpProviderUsageCorpus({
|
|
509
|
+
provider,
|
|
510
|
+
providersInRule: providers,
|
|
511
|
+
flows: next,
|
|
512
|
+
});
|
|
513
|
+
for (const managedNode of rule.managedServiceNodes) {
|
|
514
|
+
const isImplicitManagedPostgresKey = fallbackPolicy.implicitManagedPostgresNodeKeys.includes(managedNode.key);
|
|
515
|
+
const postgresSignals = isImplicitManagedPostgresKey
|
|
516
|
+
? managedNode.usageSignals
|
|
517
|
+
: [];
|
|
518
|
+
const implicitManagedCandidate = isImplicitManagedPostgresKey
|
|
519
|
+
? nextComponents.find((c) => {
|
|
520
|
+
if (!isPostgresLikeDatabase(c, fallbackPolicy))
|
|
521
|
+
return false;
|
|
522
|
+
if (!areComponentsSectionCompatible(provider, c))
|
|
523
|
+
return false;
|
|
524
|
+
const explicitManagedTarget = isProviderManagedDatabaseTarget(c, provider, rule);
|
|
525
|
+
if (explicitManagedTarget)
|
|
526
|
+
return true;
|
|
527
|
+
// Provider-agnostic fallback: if provider section usage strongly
|
|
528
|
+
// signals managed postgres and local DB is postgres-like, adopt it.
|
|
529
|
+
return hasUsageSignal(usageCorpus, postgresSignals);
|
|
530
|
+
})
|
|
531
|
+
: undefined;
|
|
532
|
+
const terraformTargetsForNode = nextComponents.filter((c) => {
|
|
533
|
+
if (c.type !== "asset")
|
|
534
|
+
return false;
|
|
535
|
+
if (typeof c.properties?.managed_by_provider === "string")
|
|
536
|
+
return false;
|
|
537
|
+
const addr = c.properties?.terraform_address;
|
|
538
|
+
if (typeof addr !== "string" || addr.startsWith("provider."))
|
|
539
|
+
return false;
|
|
540
|
+
if (!areComponentsSectionCompatible(provider, c))
|
|
541
|
+
return false;
|
|
542
|
+
if (!(0, provider_topology_shared_1.terraformAssetBelongsToProviderRule)(c, rule.providerId))
|
|
543
|
+
return false;
|
|
544
|
+
return (0, provider_topology_shared_1.terraformAssetMatchesManagedServiceTopologyRule)(c, managedNode);
|
|
545
|
+
});
|
|
546
|
+
const corpusMatchFromCode = managedNode.usageSignals.some((sig) => usageCorpus.some((entry) => entry.includes(sig)));
|
|
547
|
+
const terraformTopologyEvidence = (0, provider_topology_shared_1.terraformSectionMatchesManagedServiceTopologyRule)(provider, rule.providerId, nextComponents, managedNode);
|
|
548
|
+
const corpusMatch = corpusMatchFromCode || terraformTopologyEvidence;
|
|
549
|
+
const shouldInclude = Boolean(implicitManagedCandidate) ||
|
|
550
|
+
terraformTargetsForNode.length > 0 ||
|
|
551
|
+
managedNode.alwaysInclude ||
|
|
552
|
+
corpusMatch;
|
|
553
|
+
if (!shouldInclude)
|
|
554
|
+
continue;
|
|
555
|
+
if (terraformTargetsForNode.length > 0) {
|
|
556
|
+
const multi = terraformTargetsForNode.length > 1;
|
|
557
|
+
for (const t of terraformTargetsForNode) {
|
|
558
|
+
const blockLabel = String(t.properties?.block_name ?? "").trim();
|
|
559
|
+
t.name = multi
|
|
560
|
+
? `${managedNode.label} · ${blockLabel || t.id}`
|
|
561
|
+
: managedNode.label;
|
|
562
|
+
t.type = managedNode.componentType;
|
|
563
|
+
t.subType = managedNode.componentSubType;
|
|
564
|
+
t.properties = {
|
|
565
|
+
...t.properties,
|
|
566
|
+
managed_by_provider: provider.id,
|
|
567
|
+
managed_service_key: managedNode.key,
|
|
568
|
+
serviceName: provider.properties?.serviceName ?? rule.providerId,
|
|
569
|
+
generated_by: "provider_topology_fallback",
|
|
570
|
+
section_id: t.properties?.section_id ?? sectionId,
|
|
571
|
+
section_label: t.properties?.section_label ?? provider.properties?.section_label,
|
|
572
|
+
section_role: t.properties?.section_role ?? provider.properties?.section_role,
|
|
573
|
+
};
|
|
574
|
+
const providerToServiceKey = `${provider.id}::${t.id}`;
|
|
575
|
+
if (!keys.has(providerToServiceKey)) {
|
|
576
|
+
keys.add(providerToServiceKey);
|
|
577
|
+
next.push({
|
|
578
|
+
id: `flow_fallback_${next.length + 1}`,
|
|
579
|
+
sourceComponentId: provider.id,
|
|
580
|
+
targetComponentId: t.id,
|
|
581
|
+
type: managedNode.flowType,
|
|
582
|
+
confidence: rule.confidence.providerToManagedNodeFlowConfidence,
|
|
583
|
+
description: `${provider.name} provides ${t.name}`,
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
continue;
|
|
588
|
+
}
|
|
589
|
+
const existing = nextComponents.find((c) => c.properties?.managed_by_provider === provider.id &&
|
|
590
|
+
c.properties?.managed_service_key === managedNode.key);
|
|
591
|
+
const existingImplicitManaged = !existing ? implicitManagedCandidate : undefined;
|
|
592
|
+
const serviceNode = existingImplicitManaged ??
|
|
593
|
+
existing ??
|
|
594
|
+
(() => {
|
|
595
|
+
const managedEvidence = providerEvidenceForManagedNode(provider, managedNode);
|
|
596
|
+
const id = `cmp_managed_${rule.providerId}_${managedNode.key}_${nextComponents.length + 1}`;
|
|
597
|
+
const created = {
|
|
598
|
+
id,
|
|
599
|
+
name: managedNode.label,
|
|
600
|
+
type: managedNode.componentType,
|
|
601
|
+
subType: managedNode.componentSubType,
|
|
602
|
+
confidence: Math.max(rule.confidence.managedNodeMinConfidence, provider.confidence),
|
|
603
|
+
detectedFrom: managedEvidence.detectedFrom,
|
|
604
|
+
sourceLocations: managedEvidence.sourceLocations,
|
|
605
|
+
properties: {
|
|
606
|
+
section_id: sectionId,
|
|
607
|
+
section_label: provider.properties?.section_label ?? sectionId,
|
|
608
|
+
section_role: provider.properties?.section_role ?? "service",
|
|
609
|
+
managed_by_provider: provider.id,
|
|
610
|
+
managed_service_key: managedNode.key,
|
|
611
|
+
serviceName: provider.properties?.serviceName ?? rule.providerId,
|
|
612
|
+
generated_by: "provider_topology_fallback",
|
|
613
|
+
},
|
|
614
|
+
};
|
|
615
|
+
nextComponents.push(created);
|
|
616
|
+
byId.set(id, created);
|
|
617
|
+
return created;
|
|
618
|
+
})();
|
|
619
|
+
if (serviceNode === existingImplicitManaged) {
|
|
620
|
+
serviceNode.name = managedNode.label;
|
|
621
|
+
serviceNode.properties = {
|
|
622
|
+
...serviceNode.properties,
|
|
623
|
+
managed_by_provider: provider.id,
|
|
624
|
+
managed_service_key: managedNode.key,
|
|
625
|
+
generated_by: "provider_topology_fallback",
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
const providerToServiceKey = `${provider.id}::${serviceNode.id}`;
|
|
629
|
+
if (!keys.has(providerToServiceKey)) {
|
|
630
|
+
keys.add(providerToServiceKey);
|
|
631
|
+
next.push({
|
|
632
|
+
id: `flow_fallback_${next.length + 1}`,
|
|
633
|
+
sourceComponentId: provider.id,
|
|
634
|
+
targetComponentId: serviceNode.id,
|
|
635
|
+
type: managedNode.flowType,
|
|
636
|
+
confidence: rule.confidence.providerToManagedNodeFlowConfidence,
|
|
637
|
+
description: `${provider.name} provides ${serviceNode.name}`,
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
for (const managedResource of rule.managedResources) {
|
|
642
|
+
const managedTargets = nextComponents.filter((component) => {
|
|
643
|
+
if (!isManagedResourceComponent(component, managedResource, fallbackPolicy))
|
|
644
|
+
return false;
|
|
645
|
+
if (!areComponentsSectionCompatible(provider, component))
|
|
646
|
+
return false;
|
|
647
|
+
const viaClientMatch = hasAnyClientMatch(component, managedResource.viaClients);
|
|
648
|
+
const providerManagedHint = isProviderManagedDatabaseTarget(component, provider, rule);
|
|
649
|
+
if (!viaClientMatch && !providerManagedHint)
|
|
650
|
+
return false;
|
|
651
|
+
return true;
|
|
652
|
+
});
|
|
653
|
+
for (const target of managedTargets) {
|
|
654
|
+
if (!areComponentsSectionCompatible(provider, target))
|
|
655
|
+
continue;
|
|
656
|
+
const providerToTargetKey = `${provider.id}::${target.id}`;
|
|
657
|
+
if (!keys.has(providerToTargetKey)) {
|
|
658
|
+
keys.add(providerToTargetKey);
|
|
659
|
+
next.push({
|
|
660
|
+
id: `flow_fallback_${next.length + 1}`,
|
|
661
|
+
sourceComponentId: provider.id,
|
|
662
|
+
targetComponentId: target.id,
|
|
663
|
+
type: "database_query",
|
|
664
|
+
confidence: rule.confidence.providerToManagedResourceFlowConfidence,
|
|
665
|
+
description: `${provider.name} managed ${target.name}`,
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
const directAccessExists = hasDirectClientMatch(target, managedResource.directClients, managedResource.viaClients);
|
|
669
|
+
const providerManagedHint = isProviderManagedDatabaseTarget(target, provider, rule);
|
|
670
|
+
if (directAccessExists && !providerManagedHint)
|
|
671
|
+
continue;
|
|
672
|
+
for (const flow of next) {
|
|
673
|
+
if (flow.targetComponentId !== target.id)
|
|
674
|
+
continue;
|
|
675
|
+
if (flow.sourceComponentId === provider.id)
|
|
676
|
+
continue;
|
|
677
|
+
const sourceComponent = byId.get(flow.sourceComponentId);
|
|
678
|
+
if (!sourceComponent)
|
|
679
|
+
continue;
|
|
680
|
+
if (!areSectionCompatible(sourceComponent, provider, target))
|
|
681
|
+
continue;
|
|
682
|
+
const sourceTfAddr = sourceComponent.properties?.terraform_address;
|
|
683
|
+
if (typeof sourceTfAddr === "string" &&
|
|
684
|
+
sourceTfAddr.trim().length > 0) {
|
|
685
|
+
// IaC resources already live in the provider plane; skip SDK-style
|
|
686
|
+
// "source → provider" hops and keep direct edges (e.g. RDS → managed PG).
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
const preferredSource = selectPreferredApiSource(sourceComponent, provider, nextComponents) ??
|
|
690
|
+
sourceComponent;
|
|
691
|
+
const sourceToProviderKey = `${preferredSource.id}::${provider.id}`;
|
|
692
|
+
if (!keys.has(sourceToProviderKey)) {
|
|
693
|
+
keys.add(sourceToProviderKey);
|
|
694
|
+
next.push({
|
|
695
|
+
id: `flow_fallback_${next.length + 1}`,
|
|
696
|
+
sourceComponentId: preferredSource.id,
|
|
697
|
+
targetComponentId: provider.id,
|
|
698
|
+
type: "api_call",
|
|
699
|
+
confidence: Math.max(rule.confidence.sourceToProviderFlowConfidenceFloor, flow.confidence),
|
|
700
|
+
description: `${preferredSource.id} accesses ${target.name} via ${provider.name}`,
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
if (fallbackPolicy.rewriteThroughProviderFlowTypes.includes(flow.type)) {
|
|
704
|
+
flow.sourceComponentId = provider.id;
|
|
705
|
+
flow.confidence = Math.max(flow.confidence, rule.confidence.rewiredFlowConfidenceFloor);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
const rulesByProviderServiceName = new Map();
|
|
713
|
+
for (const rule of providerRules) {
|
|
714
|
+
rulesByProviderServiceName.set(rule.providerId, rule);
|
|
715
|
+
rulesByProviderServiceName.set(rule.canonicalServiceName, rule);
|
|
716
|
+
}
|
|
717
|
+
const collapsedComponents = collapseGenericPgIntoManagedProviderNodes(nextComponents, next, rulesByProviderServiceName, fallbackPolicy);
|
|
718
|
+
removeDirectFlowsToManagedPostgres(collapsedComponents, next);
|
|
719
|
+
(0, terraform_flows_1.appendTerraformBareProviderAttachmentFlows)({
|
|
720
|
+
components: collapsedComponents,
|
|
721
|
+
flows: next,
|
|
722
|
+
pairKeys: keys,
|
|
723
|
+
});
|
|
724
|
+
// Cross-section fallback: if an actor and an asset exist in different
|
|
725
|
+
// sections with no link, ensure at least one directional api_call edge.
|
|
726
|
+
for (const source of components) {
|
|
727
|
+
for (const target of components) {
|
|
728
|
+
if (source.id === target.id)
|
|
729
|
+
continue;
|
|
730
|
+
if (source.type !== "actor")
|
|
731
|
+
continue;
|
|
732
|
+
if (target.type !== "asset")
|
|
733
|
+
continue;
|
|
734
|
+
const sourceSection = String(source.properties.section_id ?? "");
|
|
735
|
+
const targetSection = String(target.properties.section_id ?? "");
|
|
736
|
+
if (!targetSection || sourceSection === targetSection)
|
|
737
|
+
continue;
|
|
738
|
+
// Do not synthesize edges from a section-scoped actor into another service
|
|
739
|
+
// section (avoids cross-section service graph edges in monorepos).
|
|
740
|
+
if (isConcreteServiceSectionId(sourceSection, fallbackPolicy))
|
|
741
|
+
continue;
|
|
742
|
+
// When the target section already has a main application, actor→app edges are
|
|
743
|
+
// emitted by data-flow postprocess — skip redundant actor→leaf shortcuts.
|
|
744
|
+
if (sectionHasMainApplicationAsset(collapsedComponents, targetSection))
|
|
745
|
+
continue;
|
|
746
|
+
const key = `${source.id}::${target.id}`;
|
|
747
|
+
if (keys.has(key))
|
|
748
|
+
continue;
|
|
749
|
+
keys.add(key);
|
|
750
|
+
next.push({
|
|
751
|
+
id: `flow_fallback_${next.length + 1}`,
|
|
752
|
+
sourceComponentId: source.id,
|
|
753
|
+
targetComponentId: target.id,
|
|
754
|
+
type: "api_call",
|
|
755
|
+
confidence: fallbackPolicy.crossSectionActorAssetFlowConfidence,
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
const dedupedDirectional = dedupeDirectionalFlows(next);
|
|
760
|
+
const singleDirectionFlows = enforceSingleDirectionPerPair(dedupedDirectional);
|
|
761
|
+
return { components: collapsedComponents, dataFlows: singleDirectionFlows };
|
|
762
|
+
}
|