@dataparade/cli 0.0.12 → 0.0.14
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/package.json +5 -8
- package/dist/src/ai-enrichment/candidate-selector.d.ts +4 -4
- package/dist/src/ai-enrichment/candidate-selector.js +37 -32
- package/dist/src/ai-enrichment/fallbacks.d.ts +2 -2
- package/dist/src/ai-enrichment/fallbacks.js +227 -83
- package/dist/src/ai-enrichment/merge-rules.d.ts +5 -3
- package/dist/src/ai-enrichment/merge-rules.js +225 -35
- package/dist/src/ai-enrichment/non-pii-signal-rules.js +2 -6
- package/dist/src/ai-enrichment/openai-proposals-response.schema.d.ts +1 -1
- package/dist/src/ai-enrichment/pii-signal-rules.js +2 -6
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.d.ts +2 -2
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.js +4 -4
- package/dist/src/ai-enrichment/property-priority.d.ts +5 -0
- package/dist/src/ai-enrichment/property-priority.js +23 -0
- package/dist/src/ai-enrichment/provider-prompt.d.ts +5 -5
- package/dist/src/ai-enrichment/provider-prompt.js +24 -15
- package/dist/src/ai-enrichment/provider-topology-rules.js +2 -6
- package/dist/src/ai-enrichment/providers/provider-contract.d.ts +6 -0
- package/dist/src/ai-enrichment/providers/provider-contract.js +62 -2
- package/dist/src/ai-enrichment/red-flags.d.ts +46 -0
- package/dist/src/ai-enrichment/red-flags.js +365 -0
- package/dist/src/ai-enrichment/sensitive-paths.d.ts +1 -1
- package/dist/src/ai-enrichment/sensitive-paths.js +3 -3
- package/dist/src/ai-enrichment/third-party-data-flow.js +3 -3
- package/dist/src/ai-enrichment/third-party-evidence.d.ts +3 -3
- package/dist/src/ai-enrichment/third-party-evidence.js +96 -93
- package/dist/src/ai-enrichment/third-party-subtype.js +2 -2
- package/dist/src/ai-enrichment/tools/index.d.ts +1 -1
- package/dist/src/ai-enrichment/types.d.ts +1 -1
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/cli.js +161 -143
- package/dist/src/config/file.d.ts +1 -1
- package/dist/src/config/file.js +21 -20
- package/dist/src/config/resolve.d.ts +1 -1
- package/dist/src/config/resolve.js +75 -69
- package/dist/src/core/pipeline/graph-mapping.d.ts +1 -6
- package/dist/src/core/pipeline/graph-mapping.js +3 -314
- package/dist/src/core/pipeline/orchestrator-result.d.ts +9 -6
- package/dist/src/core/pipeline/orchestrator.d.ts +2 -26
- package/dist/src/core/pipeline/orchestrator.js +4 -77
- package/dist/src/core/pipeline/scan-pipeline.d.ts +4 -3
- package/dist/src/core/pipeline/scan-pipeline.js +82 -128
- package/dist/src/core/schema/index.d.ts +2 -2
- package/dist/src/core/schema/index.js +4 -2
- package/dist/src/core/schema/scan-config.schema.d.ts +4 -3
- package/dist/src/core/schema/scan-config.schema.js +18 -17
- package/dist/src/core/schema/scan-result.schema.d.ts +2 -456
- package/dist/src/core/schema/scan-result.schema.js +12 -240
- package/dist/src/core/types/component.d.ts +1 -18
- package/dist/src/core/types/component.js +15 -0
- package/dist/src/core/types/config.d.ts +1 -64
- package/dist/src/core/types/config.js +15 -0
- package/dist/src/core/types/data-flow.d.ts +1 -24
- package/dist/src/core/types/data-flow.js +15 -0
- package/dist/src/core/types/detection.d.ts +1 -12
- package/dist/src/core/types/detection.js +15 -17
- package/dist/src/core/types/file.d.ts +1 -14
- package/dist/src/core/types/file.js +15 -0
- package/dist/src/core/types/index.d.ts +1 -7
- package/dist/src/core/types/index.js +1 -7
- package/dist/src/core/types/progress.d.ts +1 -9
- package/dist/src/core/types/progress.js +15 -0
- package/dist/src/core/types/result.d.ts +1 -140
- package/dist/src/core/types/result.js +15 -0
- package/dist/src/evals/run-model-matrix.js +2 -1
- package/dist/src/output/json.d.ts +11 -3
- package/dist/src/output/json.js +10 -5
- package/dist/src/platform-api/estimate-scan-footprint.js +9 -10
- package/dist/src/scanner-package-root.d.ts +2 -0
- package/dist/src/scanner-package-root.js +12 -0
- package/dist/tests/cli/cli.spec.js +18 -15
- package/dist/tests/unit/ai-enrichment/candidate-selector.spec.js +80 -49
- package/dist/tests/unit/ai-enrichment/fallbacks.spec.js +78 -0
- package/dist/tests/unit/ai-enrichment/merge-rules.spec.js +658 -166
- package/dist/tests/unit/ai-enrichment/provider-contract.spec.js +78 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt.spec.js +80 -75
- package/dist/tests/unit/ai-enrichment/red-flags.spec.js +227 -0
- package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.js +2 -2
- package/dist/tests/unit/ai-enrichment/third-party-evidence.spec.js +38 -34
- package/dist/tests/unit/cli/scan-command-ai-flags.spec.js +5 -3
- package/dist/tests/unit/cli/scan-command-e2e-backend-lambda-orphan.spec.js +60 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-app-plus-terraform.spec.js +2 -2
- package/dist/tests/unit/cli/scan-command-e2e-occupied-section-hubs.spec.js +58 -0
- package/dist/tests/unit/cli/scan-command-e2e-ruby-basic.spec.js +46 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sentry-route-env.spec.js +2 -1
- package/dist/tests/unit/cli/scan-command-exit-code.spec.js +7 -5
- package/dist/tests/unit/cli/scan-quota-flow.spec.js +8 -0
- package/dist/tests/unit/core/cpp-dotnet-scan.spec.js +4 -3
- package/dist/tests/unit/core/go-scan.spec.js +7 -6
- package/dist/tests/unit/core/graph-mapping.spec.js +2 -1
- package/dist/tests/unit/core/invariant-tests-dedupe-determinism.spec.js +7 -6
- package/dist/tests/unit/core/jvm-scan.spec.js +6 -5
- package/dist/tests/unit/core/no-source-code-leakage.spec.js +2 -1
- package/dist/tests/unit/core/orchestrator.spec.js +21 -20
- package/dist/tests/unit/core/output-json.spec.js +3 -2
- package/dist/tests/unit/core/parsing-error-handling-nonfatal.spec.js +2 -1
- package/dist/tests/unit/core/scan-result-language-stats.spec.js +2 -1
- package/dist/tests/unit/core/terraform-json-overlay.spec.js +2 -1
- package/dist/tests/unit/publish-manifest.spec.js +3 -2
- package/package.json +5 -8
- package/dist/src/analyzers/cpp/cpp-detection-config.d.ts +0 -73
- package/dist/src/analyzers/cpp/cpp-detection-config.js +0 -137
- package/dist/src/analyzers/cpp/dependency-manifests.d.ts +0 -8
- package/dist/src/analyzers/cpp/dependency-manifests.js +0 -130
- package/dist/src/analyzers/cpp/detector.d.ts +0 -3
- package/dist/src/analyzers/cpp/detector.js +0 -21
- package/dist/src/analyzers/cpp/index.d.ts +0 -2
- package/dist/src/analyzers/cpp/index.js +0 -11
- package/dist/src/analyzers/cpp/manifest-parsers.d.ts +0 -13
- package/dist/src/analyzers/cpp/manifest-parsers.js +0 -104
- package/dist/src/analyzers/cpp/parser.d.ts +0 -35
- package/dist/src/analyzers/cpp/parser.js +0 -206
- package/dist/src/analyzers/cpp/patterns.d.ts +0 -3
- package/dist/src/analyzers/cpp/patterns.js +0 -37
- package/dist/src/analyzers/csharp/csharp-detection-config.d.ts +0 -100
- package/dist/src/analyzers/csharp/csharp-detection-config.js +0 -160
- package/dist/src/analyzers/csharp/dependency-manifests.d.ts +0 -13
- package/dist/src/analyzers/csharp/dependency-manifests.js +0 -184
- package/dist/src/analyzers/csharp/detector.d.ts +0 -3
- package/dist/src/analyzers/csharp/detector.js +0 -21
- package/dist/src/analyzers/csharp/index.d.ts +0 -2
- package/dist/src/analyzers/csharp/index.js +0 -11
- package/dist/src/analyzers/csharp/manifest-parsers.d.ts +0 -34
- package/dist/src/analyzers/csharp/manifest-parsers.js +0 -130
- package/dist/src/analyzers/csharp/parser.d.ts +0 -48
- package/dist/src/analyzers/csharp/parser.js +0 -277
- package/dist/src/analyzers/csharp/patterns.d.ts +0 -3
- package/dist/src/analyzers/csharp/patterns.js +0 -57
- package/dist/src/analyzers/go/dependency-manifests.d.ts +0 -10
- package/dist/src/analyzers/go/dependency-manifests.js +0 -117
- package/dist/src/analyzers/go/detector.d.ts +0 -3
- package/dist/src/analyzers/go/detector.js +0 -21
- package/dist/src/analyzers/go/go-detection-config.d.ts +0 -97
- package/dist/src/analyzers/go/go-detection-config.js +0 -164
- package/dist/src/analyzers/go/index.d.ts +0 -2
- package/dist/src/analyzers/go/index.js +0 -11
- package/dist/src/analyzers/go/manifest-parsers.d.ts +0 -20
- package/dist/src/analyzers/go/manifest-parsers.js +0 -104
- package/dist/src/analyzers/go/parser.d.ts +0 -40
- package/dist/src/analyzers/go/parser.js +0 -186
- package/dist/src/analyzers/go/patterns.d.ts +0 -3
- package/dist/src/analyzers/go/patterns.js +0 -50
- package/dist/src/analyzers/jvm/dependency-manifests.d.ts +0 -16
- package/dist/src/analyzers/jvm/dependency-manifests.js +0 -205
- package/dist/src/analyzers/jvm/detector.d.ts +0 -3
- package/dist/src/analyzers/jvm/detector.js +0 -21
- package/dist/src/analyzers/jvm/index.d.ts +0 -9
- package/dist/src/analyzers/jvm/index.js +0 -18
- package/dist/src/analyzers/jvm/jvm-detection-config.d.ts +0 -136
- package/dist/src/analyzers/jvm/jvm-detection-config.js +0 -195
- package/dist/src/analyzers/jvm/manifest-parsers.d.ts +0 -61
- package/dist/src/analyzers/jvm/manifest-parsers.js +0 -246
- package/dist/src/analyzers/jvm/parser.d.ts +0 -54
- package/dist/src/analyzers/jvm/parser.js +0 -419
- package/dist/src/analyzers/jvm/patterns.d.ts +0 -3
- package/dist/src/analyzers/jvm/patterns.js +0 -64
- package/dist/src/analyzers/php/dependency-manifests.d.ts +0 -10
- package/dist/src/analyzers/php/dependency-manifests.js +0 -117
- package/dist/src/analyzers/php/detector.d.ts +0 -3
- package/dist/src/analyzers/php/detector.js +0 -20
- package/dist/src/analyzers/php/index.d.ts +0 -2
- package/dist/src/analyzers/php/index.js +0 -11
- package/dist/src/analyzers/php/manifest-parsers.d.ts +0 -14
- package/dist/src/analyzers/php/manifest-parsers.js +0 -40
- package/dist/src/analyzers/php/parser.d.ts +0 -42
- package/dist/src/analyzers/php/parser.js +0 -297
- package/dist/src/analyzers/php/patterns.d.ts +0 -3
- package/dist/src/analyzers/php/patterns.js +0 -49
- package/dist/src/analyzers/php/php-detection-config.d.ts +0 -104
- package/dist/src/analyzers/php/php-detection-config.js +0 -192
- package/dist/src/analyzers/python/dependency-manifests.d.ts +0 -8
- package/dist/src/analyzers/python/dependency-manifests.js +0 -131
- package/dist/src/analyzers/python/detector.d.ts +0 -3
- package/dist/src/analyzers/python/detector.js +0 -22
- package/dist/src/analyzers/python/index.d.ts +0 -2
- package/dist/src/analyzers/python/index.js +0 -11
- package/dist/src/analyzers/python/manifest-parsers.d.ts +0 -3
- package/dist/src/analyzers/python/manifest-parsers.js +0 -134
- package/dist/src/analyzers/python/parser.d.ts +0 -27
- package/dist/src/analyzers/python/parser.js +0 -194
- package/dist/src/analyzers/python/patterns.d.ts +0 -8
- package/dist/src/analyzers/python/patterns.js +0 -51
- package/dist/src/analyzers/python/python-detection-config.d.ts +0 -93
- package/dist/src/analyzers/python/python-detection-config.js +0 -168
- package/dist/src/analyzers/registry.d.ts +0 -13
- package/dist/src/analyzers/registry.js +0 -78
- package/dist/src/analyzers/shared/c-family-calls.d.ts +0 -26
- package/dist/src/analyzers/shared/c-family-calls.js +0 -118
- package/dist/src/analyzers/shared/manifest-budgets.d.ts +0 -19
- package/dist/src/analyzers/shared/manifest-budgets.js +0 -21
- package/dist/src/analyzers/shared/manifest-fs.d.ts +0 -13
- package/dist/src/analyzers/shared/manifest-fs.js +0 -138
- package/dist/src/analyzers/shared/property-inference.d.ts +0 -8
- package/dist/src/analyzers/shared/property-inference.js +0 -165
- package/dist/src/analyzers/shared/strip-comments.d.ts +0 -32
- package/dist/src/analyzers/shared/strip-comments.js +0 -168
- package/dist/src/analyzers/terraform/detector.d.ts +0 -10
- package/dist/src/analyzers/terraform/detector.js +0 -198
- package/dist/src/analyzers/terraform/index.d.ts +0 -2
- package/dist/src/analyzers/terraform/index.js +0 -13
- package/dist/src/analyzers/terraform/parser.d.ts +0 -29
- package/dist/src/analyzers/terraform/parser.js +0 -202
- package/dist/src/analyzers/terraform/terraform-detection-config.d.ts +0 -48
- package/dist/src/analyzers/terraform/terraform-detection-config.js +0 -218
- package/dist/src/analyzers/terraform/terraform-exec.d.ts +0 -11
- package/dist/src/analyzers/terraform/terraform-exec.js +0 -35
- package/dist/src/analyzers/terraform/terraform-module-manifest.d.ts +0 -19
- package/dist/src/analyzers/terraform/terraform-module-manifest.js +0 -75
- package/dist/src/analyzers/terraform/terraform-show-json.d.ts +0 -15
- package/dist/src/analyzers/terraform/terraform-show-json.js +0 -188
- package/dist/src/analyzers/terraform/terraform-utility-resource.d.ts +0 -12
- package/dist/src/analyzers/terraform/terraform-utility-resource.js +0 -30
- package/dist/src/analyzers/types.d.ts +0 -5
- package/dist/src/analyzers/types.js +0 -2
- package/dist/src/analyzers/typescript/actor-detection.d.ts +0 -4
- package/dist/src/analyzers/typescript/actor-detection.js +0 -15
- package/dist/src/analyzers/typescript/dependency-manifests.d.ts +0 -9
- package/dist/src/analyzers/typescript/dependency-manifests.js +0 -131
- package/dist/src/analyzers/typescript/detector.d.ts +0 -3
- package/dist/src/analyzers/typescript/detector.js +0 -23
- package/dist/src/analyzers/typescript/index.d.ts +0 -2
- package/dist/src/analyzers/typescript/index.js +0 -11
- package/dist/src/analyzers/typescript/manifest-parsers.d.ts +0 -1
- package/dist/src/analyzers/typescript/manifest-parsers.js +0 -30
- package/dist/src/analyzers/typescript/parser.d.ts +0 -44
- package/dist/src/analyzers/typescript/parser.js +0 -287
- package/dist/src/analyzers/typescript/third-party-detection.d.ts +0 -4
- package/dist/src/analyzers/typescript/third-party-detection.js +0 -16
- package/dist/src/analyzers/typescript/typescript-detection-config.d.ts +0 -105
- package/dist/src/analyzers/typescript/typescript-detection-config.js +0 -219
- package/dist/src/analyzers/typescript/typescript-detection.d.ts +0 -11
- package/dist/src/analyzers/typescript/typescript-detection.js +0 -55
- package/dist/src/classifier/application-injection.d.ts +0 -12
- package/dist/src/classifier/application-injection.js +0 -335
- package/dist/src/classifier/classify.d.ts +0 -3
- package/dist/src/classifier/classify.js +0 -15
- package/dist/src/classifier/component-factory.d.ts +0 -3
- package/dist/src/classifier/component-factory.js +0 -488
- package/dist/src/classifier/config.d.ts +0 -38
- package/dist/src/classifier/config.js +0 -260
- package/dist/src/classifier/enhance-defaults.d.ts +0 -28
- package/dist/src/classifier/enhance-defaults.js +0 -369
- package/dist/src/classifier/enhance.d.ts +0 -13
- package/dist/src/classifier/enhance.js +0 -295
- package/dist/src/classifier/external-url-third-party.d.ts +0 -26
- package/dist/src/classifier/external-url-third-party.js +0 -195
- package/dist/src/classifier/grouping.js +0 -2
- package/dist/src/classifier/main-application-selection.d.ts +0 -41
- package/dist/src/classifier/main-application-selection.js +0 -222
- package/dist/src/classifier/naming.d.ts +0 -4
- package/dist/src/classifier/naming.js +0 -78
- package/dist/src/classifier/postprocessing.d.ts +0 -18
- package/dist/src/classifier/postprocessing.js +0 -565
- package/dist/src/classifier/sectioning.d.ts +0 -5
- package/dist/src/classifier/sectioning.js +0 -60
- package/dist/src/classifier/terraform-provider-hub.d.ts +0 -6
- package/dist/src/classifier/terraform-provider-hub.js +0 -38
- package/dist/src/config/actor-detection-config.d.ts +0 -21
- package/dist/src/config/actor-detection-config.js +0 -97
- package/dist/src/config/property-detection-config.d.ts +0 -27
- package/dist/src/config/property-detection-config.js +0 -355
- package/dist/src/config/third-party-detection-config.d.ts +0 -25
- package/dist/src/config/third-party-detection-config.js +0 -97
- package/dist/src/core/pipeline/classifier-phase.d.ts +0 -7
- package/dist/src/core/pipeline/classifier-phase.js +0 -78
- package/dist/src/core/pipeline/dataflow-phase.d.ts +0 -7
- package/dist/src/core/pipeline/dataflow-phase.js +0 -10
- package/dist/src/core/pipeline/diagram-layout/app-section-layout.d.ts +0 -7
- package/dist/src/core/pipeline/diagram-layout/app-section-layout.js +0 -74
- package/dist/src/core/pipeline/diagram-layout/constants.d.ts +0 -11
- package/dist/src/core/pipeline/diagram-layout/constants.js +0 -14
- package/dist/src/core/pipeline/diagram-layout/edge-handles.d.ts +0 -3
- package/dist/src/core/pipeline/diagram-layout/edge-handles.js +0 -26
- package/dist/src/core/pipeline/diagram-layout/managed-provider-layout.d.ts +0 -3
- package/dist/src/core/pipeline/diagram-layout/managed-provider-layout.js +0 -40
- package/dist/src/core/pipeline/diagram-layout/minimal-terraform-layout.d.ts +0 -6
- package/dist/src/core/pipeline/diagram-layout/minimal-terraform-layout.js +0 -53
- package/dist/src/core/pipeline/diagram-layout/section-helpers.d.ts +0 -30
- package/dist/src/core/pipeline/diagram-layout/section-helpers.js +0 -62
- package/dist/src/core/pipeline/diagram-layout/terraform-lane-layout.d.ts +0 -3
- package/dist/src/core/pipeline/diagram-layout/terraform-lane-layout.js +0 -109
- package/dist/src/core/pipeline/diagram-layout/types.d.ts +0 -2
- package/dist/src/core/pipeline/diagram-layout/types.js +0 -2
- package/dist/src/core/pipeline/infer-data-flow-protocol.d.ts +0 -7
- package/dist/src/core/pipeline/infer-data-flow-protocol.js +0 -39
- package/dist/src/core/pipeline/mixed-app-terraform-scan.d.ts +0 -13
- package/dist/src/core/pipeline/mixed-app-terraform-scan.js +0 -81
- package/dist/src/core/pipeline/resolve-path-under-scan-root.d.ts +0 -7
- package/dist/src/core/pipeline/resolve-path-under-scan-root.js +0 -55
- package/dist/src/core/pipeline/sorting.d.ts +0 -3
- package/dist/src/core/pipeline/sorting.js +0 -48
- package/dist/src/core/pipeline/stable-component-ids.d.ts +0 -15
- package/dist/src/core/pipeline/stable-component-ids.js +0 -68
- package/dist/src/core/pipeline/structural-scan.d.ts +0 -19
- package/dist/src/core/pipeline/structural-scan.js +0 -452
- package/dist/src/core/pipeline/terraform-flow-utils.d.ts +0 -6
- package/dist/src/core/pipeline/terraform-flow-utils.js +0 -32
- package/dist/src/core/pipeline/terraform-minimal-services.d.ts +0 -31
- package/dist/src/core/pipeline/terraform-minimal-services.js +0 -225
- package/dist/src/core/sectioning/discover-service-sections.d.ts +0 -80
- package/dist/src/core/sectioning/discover-service-sections.js +0 -497
- package/dist/src/core/sectioning/section-runtime.d.ts +0 -21
- package/dist/src/core/sectioning/section-runtime.js +0 -148
- package/dist/src/core/terraform/component-predicates.d.ts +0 -13
- package/dist/src/core/terraform/component-predicates.js +0 -71
- package/dist/src/data-flow/application-hub.d.ts +0 -7
- package/dist/src/data-flow/application-hub.js +0 -88
- package/dist/src/data-flow/dedupe.d.ts +0 -7
- package/dist/src/data-flow/dedupe.js +0 -92
- package/dist/src/data-flow/detect.d.ts +0 -16
- package/dist/src/data-flow/detect.js +0 -203
- package/dist/src/data-flow/detector.d.ts +0 -15
- package/dist/src/data-flow/detector.js +0 -18
- package/dist/src/data-flow/drop-cross-section-flows.d.ts +0 -8
- package/dist/src/data-flow/drop-cross-section-flows.js +0 -32
- package/dist/src/data-flow/ensure-actor-flow.d.ts +0 -16
- package/dist/src/data-flow/ensure-actor-flow.js +0 -101
- package/dist/src/data-flow/ensure-manifest-declared-flows.d.ts +0 -14
- package/dist/src/data-flow/ensure-manifest-declared-flows.js +0 -76
- package/dist/src/data-flow/ensure-section-api-flows.d.ts +0 -6
- package/dist/src/data-flow/ensure-section-api-flows.js +0 -57
- package/dist/src/data-flow/flow-builder.d.ts +0 -5
- package/dist/src/data-flow/flow-builder.js +0 -80
- package/dist/src/data-flow/import-graph.d.ts +0 -10
- package/dist/src/data-flow/import-graph.js +0 -147
- package/dist/src/data-flow/index.d.ts +0 -8
- package/dist/src/data-flow/index.js +0 -20
- package/dist/src/data-flow/internal-fetch.d.ts +0 -8
- package/dist/src/data-flow/internal-fetch.js +0 -209
- package/dist/src/data-flow/postprocess.d.ts +0 -9
- package/dist/src/data-flow/postprocess.js +0 -63
- package/dist/src/data-flow/rewire.d.ts +0 -10
- package/dist/src/data-flow/rewire.js +0 -93
- package/dist/src/data-flow/source-attribution.d.ts +0 -8
- package/dist/src/data-flow/source-attribution.js +0 -131
- package/dist/src/data-flow/source-resolution.d.ts +0 -13
- package/dist/src/data-flow/source-resolution.js +0 -61
- package/dist/src/data-flow/target-matching.d.ts +0 -21
- package/dist/src/data-flow/target-matching.js +0 -253
- package/dist/src/data-flow/terraform-flows.d.ts +0 -32
- package/dist/src/data-flow/terraform-flows.js +0 -170
- package/dist/src/ingest/file-system.d.ts +0 -17
- package/dist/src/ingest/file-system.js +0 -269
- package/dist/src/ingest/gitignore.d.ts +0 -12
- package/dist/src/ingest/gitignore.js +0 -127
- package/dist/src/ingest/sensitive-paths.d.ts +0 -2
- package/dist/src/ingest/sensitive-paths.js +0 -8
- package/dist/src/patterns/config.d.ts +0 -32
- package/dist/src/patterns/config.js +0 -286
- package/dist/src/patterns/detectors/cpp.d.ts +0 -8
- package/dist/src/patterns/detectors/cpp.js +0 -243
- package/dist/src/patterns/detectors/csharp.d.ts +0 -9
- package/dist/src/patterns/detectors/csharp.js +0 -385
- package/dist/src/patterns/detectors/go.d.ts +0 -9
- package/dist/src/patterns/detectors/go.js +0 -298
- package/dist/src/patterns/detectors/helpers.d.ts +0 -22
- package/dist/src/patterns/detectors/helpers.js +0 -73
- package/dist/src/patterns/detectors/jvm.d.ts +0 -15
- package/dist/src/patterns/detectors/jvm.js +0 -537
- package/dist/src/patterns/detectors/php.d.ts +0 -9
- package/dist/src/patterns/detectors/php.js +0 -466
- package/dist/src/patterns/detectors/python.d.ts +0 -9
- package/dist/src/patterns/detectors/python.js +0 -499
- package/dist/src/patterns/detectors/typescript.d.ts +0 -10
- package/dist/src/patterns/detectors/typescript.js +0 -480
- package/dist/src/patterns/engine.d.ts +0 -58
- package/dist/src/patterns/engine.js +0 -148
- package/dist/src/patterns/flow-source-patterns.d.ts +0 -6
- package/dist/src/patterns/flow-source-patterns.js +0 -39
- package/dist/src/patterns/frontend-frameworks.d.ts +0 -4
- package/dist/src/patterns/frontend-frameworks.js +0 -25
- package/dist/src/patterns/scan-exclusions.d.ts +0 -14
- package/dist/src/patterns/scan-exclusions.js +0 -96
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.d.ts +0 -2
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.js +0 -8
- package/dist/tests/fixtures/e2e-ts-sample/db.d.ts +0 -3
- package/dist/tests/fixtures/e2e-ts-sample/db.js +0 -7
- package/dist/tests/fixtures/e2e-ts-sample/external-api.d.ts +0 -1
- package/dist/tests/fixtures/e2e-ts-sample/external-api.js +0 -18
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.d.ts +0 -3
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.js +0 -7
- package/dist/tests/fixtures/e2e-ts-sample/server.d.ts +0 -14
- package/dist/tests/fixtures/e2e-ts-sample/server.js +0 -4
- package/dist/tests/fixtures/e2e-ts-sentry-route-env/server.js +0 -24
- package/dist/tests/fixtures/ingest-basic/src/index.d.ts +0 -1
- package/dist/tests/fixtures/ingest-basic/src/index.js +0 -6
- package/dist/tests/fixtures/mixed-language-basic/api.d.ts +0 -2
- package/dist/tests/fixtures/mixed-language-basic/api.js +0 -12
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.js +0 -6
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.js +0 -6
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.js +0 -7
- package/dist/tests/fixtures/typescript-basic/app/route.d.ts +0 -1
- package/dist/tests/fixtures/typescript-basic/app/route.js +0 -7
- package/dist/tests/fixtures/typescript-basic/db-client-import.d.ts +0 -2
- package/dist/tests/fixtures/typescript-basic/db-client-import.js +0 -8
- package/dist/tests/fixtures/typescript-basic/db.d.ts +0 -3
- package/dist/tests/fixtures/typescript-basic/db.js +0 -7
- package/dist/tests/fixtures/typescript-basic/external-api.d.ts +0 -1
- package/dist/tests/fixtures/typescript-basic/external-api.js +0 -18
- package/dist/tests/fixtures/typescript-basic/pg-client.d.ts +0 -3
- package/dist/tests/fixtures/typescript-basic/pg-client.js +0 -7
- package/dist/tests/fixtures/typescript-basic/server.d.ts +0 -14
- package/dist/tests/fixtures/typescript-basic/server.js +0 -4
- 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 +0 -2
- package/dist/tests/unit/analyzers/cpp/dependency-manifests.spec.js +0 -66
- package/dist/tests/unit/analyzers/cpp/parser.spec.js +0 -80
- package/dist/tests/unit/analyzers/cpp/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/cpp/patterns.spec.js +0 -141
- package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.js +0 -75
- package/dist/tests/unit/analyzers/csharp/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/csharp/parser.spec.js +0 -118
- package/dist/tests/unit/analyzers/csharp/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/csharp/patterns.spec.js +0 -210
- package/dist/tests/unit/analyzers/go/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/go/dependency-manifests.spec.js +0 -96
- package/dist/tests/unit/analyzers/go/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/go/parser.spec.js +0 -110
- package/dist/tests/unit/analyzers/go/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/go/patterns.spec.js +0 -239
- package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.js +0 -179
- package/dist/tests/unit/analyzers/jvm/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/jvm/parser.spec.js +0 -195
- package/dist/tests/unit/analyzers/jvm/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/jvm/patterns.spec.js +0 -284
- package/dist/tests/unit/analyzers/php/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/php/dependency-manifests.spec.js +0 -54
- package/dist/tests/unit/analyzers/php/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/php/parser.spec.js +0 -128
- package/dist/tests/unit/analyzers/php/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/php/patterns.spec.js +0 -334
- package/dist/tests/unit/analyzers/python/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/python/parser.spec.js +0 -104
- package/dist/tests/unit/analyzers/python/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/python/patterns.spec.js +0 -458
- package/dist/tests/unit/analyzers/registry.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/registry.spec.js +0 -234
- package/dist/tests/unit/analyzers/terraform/classifier-subtype-parity.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/classifier-subtype-parity.spec.js +0 -87
- package/dist/tests/unit/analyzers/terraform/detector.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/detector.spec.js +0 -110
- package/dist/tests/unit/analyzers/terraform/generated-provider-hints.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/generated-provider-hints.spec.js +0 -53
- package/dist/tests/unit/analyzers/terraform/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/parser.spec.js +0 -56
- package/dist/tests/unit/analyzers/terraform/terraform-module-manifest.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/terraform-module-manifest.spec.js +0 -63
- package/dist/tests/unit/analyzers/terraform/terraform-utility-resource.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/terraform-utility-resource.spec.js +0 -19
- package/dist/tests/unit/analyzers/terraform-exec.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform-exec.spec.js +0 -27
- package/dist/tests/unit/analyzers/terraform-show-json.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform-show-json.spec.js +0 -77
- package/dist/tests/unit/analyzers/typescript/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/dependency-manifests.spec.js +0 -61
- package/dist/tests/unit/analyzers/typescript/detector.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/detector.spec.js +0 -413
- package/dist/tests/unit/analyzers/typescript/external-apis-auth0.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/external-apis-auth0.spec.js +0 -49
- package/dist/tests/unit/analyzers/typescript/external-apis-sentry.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/external-apis-sentry.spec.js +0 -27
- package/dist/tests/unit/analyzers/typescript/fixture-integration.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/fixture-integration.spec.js +0 -64
- package/dist/tests/unit/analyzers/typescript/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/parser.spec.js +0 -99
- package/dist/tests/unit/analyzers/typescript/pattern-config.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/pattern-config.spec.js +0 -24
- package/dist/tests/unit/analyzers/typescript/property-detection.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/property-detection.spec.js +0 -160
- package/dist/tests/unit/classifier/classify.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/classify.spec.js +0 -1521
- package/dist/tests/unit/classifier/enhance.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/enhance.spec.js +0 -400
- package/dist/tests/unit/classifier/external-url-third-party.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/external-url-third-party.spec.js +0 -83
- package/dist/tests/unit/classifier/frontend-framework-grouping.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/frontend-framework-grouping.spec.js +0 -44
- package/dist/tests/unit/classifier/terraform-grouping.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/terraform-grouping.spec.js +0 -96
- package/dist/tests/unit/config/property-detection-config.spec.d.ts +0 -1
- package/dist/tests/unit/config/property-detection-config.spec.js +0 -38
- package/dist/tests/unit/core/classifier-phase-regressions.spec.d.ts +0 -1
- package/dist/tests/unit/core/classifier-phase-regressions.spec.js +0 -68
- package/dist/tests/unit/core/cpp-dotnet-sections.spec.d.ts +0 -1
- package/dist/tests/unit/core/cpp-dotnet-sections.spec.js +0 -46
- package/dist/tests/unit/core/dependency-manifest-performance-budgets.spec.d.ts +0 -1
- package/dist/tests/unit/core/dependency-manifest-performance-budgets.spec.js +0 -66
- package/dist/tests/unit/core/dependency-manifest-toggles-confidence.spec.d.ts +0 -1
- package/dist/tests/unit/core/dependency-manifest-toggles-confidence.spec.js +0 -132
- package/dist/tests/unit/core/discover-service-sections.spec.d.ts +0 -1
- package/dist/tests/unit/core/discover-service-sections.spec.js +0 -204
- package/dist/tests/unit/core/infer-data-flow-protocol.spec.d.ts +0 -1
- package/dist/tests/unit/core/infer-data-flow-protocol.spec.js +0 -37
- package/dist/tests/unit/core/manifest-package-hub.spec.d.ts +0 -1
- package/dist/tests/unit/core/manifest-package-hub.spec.js +0 -53
- package/dist/tests/unit/core/monorepo-package-sections.spec.d.ts +0 -1
- package/dist/tests/unit/core/monorepo-package-sections.spec.js +0 -121
- package/dist/tests/unit/core/resolve-path-under-scan-root.spec.d.ts +0 -1
- package/dist/tests/unit/core/resolve-path-under-scan-root.spec.js +0 -54
- package/dist/tests/unit/core/section-discovery-excludes.spec.d.ts +0 -1
- package/dist/tests/unit/core/section-discovery-excludes.spec.js +0 -49
- package/dist/tests/unit/core/section-runtime.spec.d.ts +0 -1
- package/dist/tests/unit/core/section-runtime.spec.js +0 -166
- package/dist/tests/unit/core/stable-component-ids.spec.d.ts +0 -1
- package/dist/tests/unit/core/stable-component-ids.spec.js +0 -112
- package/dist/tests/unit/core/structural-scan.spec.d.ts +0 -1
- package/dist/tests/unit/core/structural-scan.spec.js +0 -83
- package/dist/tests/unit/core/terraform-minimal-services.spec.d.ts +0 -1
- package/dist/tests/unit/core/terraform-minimal-services.spec.js +0 -378
- package/dist/tests/unit/data-flow/application-hub.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/application-hub.spec.js +0 -48
- package/dist/tests/unit/data-flow/cross-section-terraform-bridge.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/cross-section-terraform-bridge.spec.js +0 -95
- package/dist/tests/unit/data-flow/dedupe.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/dedupe.spec.js +0 -134
- package/dist/tests/unit/data-flow/detector.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/detector.spec.js +0 -1254
- package/dist/tests/unit/data-flow/drop-cross-section-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/drop-cross-section-flows.spec.js +0 -132
- package/dist/tests/unit/data-flow/ensure-actor-flow.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/ensure-actor-flow.spec.js +0 -233
- package/dist/tests/unit/data-flow/ensure-manifest-declared-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/ensure-manifest-declared-flows.spec.js +0 -125
- package/dist/tests/unit/data-flow/ensure-section-api-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/ensure-section-api-flows.spec.js +0 -40
- package/dist/tests/unit/data-flow/postprocess.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/postprocess.spec.js +0 -78
- package/dist/tests/unit/data-flow/rewire.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/rewire.spec.js +0 -194
- package/dist/tests/unit/data-flow/terraform-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/terraform-flows.spec.js +0 -199
- package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.js +0 -56
- package/dist/tests/unit/ingest/env-exclusion.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/env-exclusion.spec.js +0 -43
- package/dist/tests/unit/ingest/file-system.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/file-system.spec.js +0 -180
- package/dist/tests/unit/ingest/gitignore.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/gitignore.spec.js +0 -30
- package/dist/tests/unit/ingest/jvm-languages.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/jvm-languages.spec.js +0 -47
- package/dist/tests/unit/ingest/php-languages.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/php-languages.spec.js +0 -40
- package/dist/tests/unit/patterns/scan-exclusions.spec.d.ts +0 -1
- package/dist/tests/unit/patterns/scan-exclusions.spec.js +0 -58
- package/patterns/README.md +0 -322
- package/patterns/actor.patterns.yaml +0 -51
- package/patterns/aws-terraform-catalog.snapshot.json +0 -1760
- package/patterns/aws-terraform-service-hints.generated.json +0 -1446
- package/patterns/azure-terraform-catalog.snapshot.json +0 -1195
- package/patterns/azure-terraform-service-hints.generated.json +0 -864
- package/patterns/classifier/actors.classifier.yaml +0 -17
- package/patterns/classifier/components.classifier.yaml +0 -110
- package/patterns/classifier/third-party.classifier.yaml +0 -169
- package/patterns/cpp.md +0 -176
- package/patterns/cpp.patterns.yaml +0 -314
- package/patterns/csharp.md +0 -211
- package/patterns/csharp.patterns.yaml +0 -375
- package/patterns/go.md +0 -211
- package/patterns/go.patterns.yaml +0 -429
- package/patterns/jvm.md +0 -160
- package/patterns/jvm.patterns.yaml +0 -884
- package/patterns/kubernetes-terraform-catalog.snapshot.json +0 -94
- package/patterns/kubernetes-terraform-service-hints.generated.json +0 -258
- package/patterns/non-pii-signals.rules.yaml +0 -84
- package/patterns/php.md +0 -74
- package/patterns/php.patterns.yaml +0 -311
- package/patterns/pii-signals.rules.yaml +0 -115
- package/patterns/property.patterns.yaml +0 -431
- package/patterns/provider-topology.rules.yaml +0 -765
- package/patterns/python.md +0 -211
- package/patterns/python.patterns.yaml +0 -337
- package/patterns/terraform.md +0 -37
- package/patterns/terraform.patterns.yaml +0 -495
- package/patterns/third-party.patterns.yaml +0 -182
- package/patterns/typescript.patterns.yaml +0 -361
- /package/dist/{src/classifier/grouping.d.ts → tests/unit/ai-enrichment/red-flags.spec.d.ts} +0 -0
- /package/dist/tests/{fixtures/e2e-ts-sentry-route-env/server.d.ts → unit/cli/scan-command-e2e-backend-lambda-orphan.spec.d.ts} +0 -0
- /package/dist/tests/unit/{analyzers/cpp/dependency-manifests.spec.d.ts → cli/scan-command-e2e-occupied-section-hubs.spec.d.ts} +0 -0
- /package/dist/tests/unit/{analyzers/cpp/parser.spec.d.ts → cli/scan-command-e2e-ruby-basic.spec.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.applyDeterministicInferenceFallbacks = applyDeterministicInferenceFallbacks;
|
|
4
|
-
const
|
|
4
|
+
const scanner_1 = require("@dataparade/scanner");
|
|
5
5
|
const provider_topology_rules_1 = require("./provider-topology-rules");
|
|
6
6
|
const provider_topology_shared_1 = require("./provider-topology-shared");
|
|
7
7
|
function componentById(components) {
|
|
@@ -11,12 +11,14 @@ function flowPairKey(flow) {
|
|
|
11
11
|
return `${flow.sourceComponentId}::${flow.targetComponentId}`;
|
|
12
12
|
}
|
|
13
13
|
function preferFlow(existing, candidate) {
|
|
14
|
-
const existingFallback = existing.id.startsWith(
|
|
15
|
-
const candidateFallback = candidate.id.startsWith(
|
|
14
|
+
const existingFallback = existing.id.startsWith('flow_fallback_');
|
|
15
|
+
const candidateFallback = candidate.id.startsWith('flow_fallback_');
|
|
16
16
|
if (existingFallback !== candidateFallback) {
|
|
17
17
|
return existingFallback ? candidate : existing;
|
|
18
18
|
}
|
|
19
|
-
return (candidate.confidence ?? 0) > (existing.confidence ?? 0)
|
|
19
|
+
return (candidate.confidence ?? 0) > (existing.confidence ?? 0)
|
|
20
|
+
? candidate
|
|
21
|
+
: existing;
|
|
20
22
|
}
|
|
21
23
|
function dedupeDirectionalFlows(flows) {
|
|
22
24
|
const chosen = new Map();
|
|
@@ -36,7 +38,7 @@ function dedupeDirectionalFlows(flows) {
|
|
|
36
38
|
.filter((flow) => Boolean(flow));
|
|
37
39
|
}
|
|
38
40
|
function unorderedFlowPairKey(flow) {
|
|
39
|
-
return [flow.sourceComponentId, flow.targetComponentId].sort().join(
|
|
41
|
+
return [flow.sourceComponentId, flow.targetComponentId].sort().join('::');
|
|
40
42
|
}
|
|
41
43
|
function enforceSingleDirectionPerPair(flows) {
|
|
42
44
|
const chosen = new Map();
|
|
@@ -65,40 +67,166 @@ function isConcreteServiceSectionId(sectionId, policy) {
|
|
|
65
67
|
return true;
|
|
66
68
|
}
|
|
67
69
|
function sectionHasMainApplicationAsset(components, sectionId) {
|
|
68
|
-
return components.some((c) => c.type ===
|
|
69
|
-
String(c.properties?.section_id ??
|
|
70
|
+
return components.some((c) => c.type === 'asset' &&
|
|
71
|
+
String(c.properties?.section_id ?? '') === sectionId &&
|
|
70
72
|
(c.properties?.isMainApplication === true ||
|
|
71
|
-
c.properties?.isMainApplication ===
|
|
73
|
+
c.properties?.isMainApplication === 'true'));
|
|
74
|
+
}
|
|
75
|
+
function nextSyntheticComponentId(components) {
|
|
76
|
+
let maxNumericId = 0;
|
|
77
|
+
for (const component of components) {
|
|
78
|
+
const match = /^cmp_(\d+)$/.exec(component.id);
|
|
79
|
+
if (match) {
|
|
80
|
+
const num = Number.parseInt(match[1], 10);
|
|
81
|
+
if (!Number.isNaN(num) && num > maxNumericId)
|
|
82
|
+
maxNumericId = num;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return `cmp_${maxNumericId + 1}`;
|
|
86
|
+
}
|
|
87
|
+
const INJECTED_SECTION_HUB_SOURCE_CONTEXT = 'injected_project_placeholder';
|
|
88
|
+
/**
|
|
89
|
+
* Ensures every concrete service section with components has a main-app hub,
|
|
90
|
+
* and connects that hub to orphan third parties in the same section.
|
|
91
|
+
*/
|
|
92
|
+
function ensureSectionHubsAndOrphanThirdPartyFlows(components, flows, policy) {
|
|
93
|
+
const nextComponents = components.map((c) => ({
|
|
94
|
+
...c,
|
|
95
|
+
properties: { ...c.properties },
|
|
96
|
+
}));
|
|
97
|
+
const occupied = new Set();
|
|
98
|
+
for (const c of nextComponents) {
|
|
99
|
+
const sid = String(c.properties?.section_id ?? '').trim();
|
|
100
|
+
if (isConcreteServiceSectionId(sid, policy))
|
|
101
|
+
occupied.add(sid);
|
|
102
|
+
}
|
|
103
|
+
const sortedSections = [...occupied].sort((a, b) => a.localeCompare(b));
|
|
104
|
+
for (const sectionId of sortedSections) {
|
|
105
|
+
if (sectionHasMainApplicationAsset(nextComponents, sectionId))
|
|
106
|
+
continue;
|
|
107
|
+
const sectionAssets = nextComponents.filter((c) => c.type === 'asset' &&
|
|
108
|
+
String(c.properties?.section_id ?? '') === sectionId &&
|
|
109
|
+
!c.properties?.managed_by_provider &&
|
|
110
|
+
!c.properties?.managed_service_key &&
|
|
111
|
+
c.subType !== 'database');
|
|
112
|
+
const promoteable = sectionAssets.find((c) => c.subType === 'application' ||
|
|
113
|
+
c.subType === 'service' ||
|
|
114
|
+
c.subType === 'api' ||
|
|
115
|
+
c.subType === undefined);
|
|
116
|
+
const sample = nextComponents.find((c) => String(c.properties?.section_id ?? '') === sectionId);
|
|
117
|
+
const label = String(sample?.properties?.section_label ?? '').trim() || sectionId;
|
|
118
|
+
const role = String(sample?.properties?.section_role ?? '').trim() || 'service';
|
|
119
|
+
if (promoteable) {
|
|
120
|
+
promoteable.properties = {
|
|
121
|
+
...promoteable.properties,
|
|
122
|
+
isMainApplication: true,
|
|
123
|
+
section_id: sectionId,
|
|
124
|
+
section_label: String(promoteable.properties?.section_label ?? '').trim() || label,
|
|
125
|
+
section_role: String(promoteable.properties?.section_role ?? '').trim() || role,
|
|
126
|
+
};
|
|
127
|
+
if (promoteable.properties?.isSectionApiNode !== true &&
|
|
128
|
+
promoteable.properties?.isSectionApiNode !== 'true') {
|
|
129
|
+
promoteable.name = label;
|
|
130
|
+
}
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
nextComponents.push({
|
|
134
|
+
id: nextSyntheticComponentId(nextComponents),
|
|
135
|
+
name: label,
|
|
136
|
+
type: 'asset',
|
|
137
|
+
subType: 'application',
|
|
138
|
+
confidence: 1,
|
|
139
|
+
detectedFrom: [],
|
|
140
|
+
sourceLocations: [],
|
|
141
|
+
properties: {
|
|
142
|
+
section_id: sectionId,
|
|
143
|
+
section_label: label,
|
|
144
|
+
section_role: role,
|
|
145
|
+
isMainApplication: true,
|
|
146
|
+
sourceContext: INJECTED_SECTION_HUB_SOURCE_CONTEXT,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
const byId = componentById(nextComponents);
|
|
151
|
+
const nextFlows = [...flows];
|
|
152
|
+
const pairKeys = new Set(nextFlows.map((f) => flowPairKey(f)));
|
|
153
|
+
const hasInSectionInbound = new Set();
|
|
154
|
+
for (const flow of nextFlows) {
|
|
155
|
+
const source = byId.get(flow.sourceComponentId);
|
|
156
|
+
const target = byId.get(flow.targetComponentId);
|
|
157
|
+
if (!source || !target || target.type !== 'third_party')
|
|
158
|
+
continue;
|
|
159
|
+
const sourceSection = String(source.properties?.section_id ?? '').trim();
|
|
160
|
+
const targetSection = String(target.properties?.section_id ?? '').trim();
|
|
161
|
+
if (!sourceSection || sourceSection !== targetSection)
|
|
162
|
+
continue;
|
|
163
|
+
hasInSectionInbound.add(target.id);
|
|
164
|
+
}
|
|
165
|
+
const orphanThirdParties = nextComponents
|
|
166
|
+
.filter((c) => {
|
|
167
|
+
if (c.type !== 'third_party')
|
|
168
|
+
return false;
|
|
169
|
+
if (hasInSectionInbound.has(c.id))
|
|
170
|
+
return false;
|
|
171
|
+
const sid = String(c.properties?.section_id ?? '').trim();
|
|
172
|
+
return isConcreteServiceSectionId(sid, policy);
|
|
173
|
+
})
|
|
174
|
+
.sort((a, b) => a.id.localeCompare(b.id));
|
|
175
|
+
for (const tp of orphanThirdParties) {
|
|
176
|
+
const sectionId = String(tp.properties?.section_id ?? '').trim();
|
|
177
|
+
const hub = nextComponents.find((c) => c.type === 'asset' &&
|
|
178
|
+
String(c.properties?.section_id ?? '') === sectionId &&
|
|
179
|
+
(c.properties?.isMainApplication === true ||
|
|
180
|
+
c.properties?.isMainApplication === 'true'));
|
|
181
|
+
if (!hub || hub.id === tp.id)
|
|
182
|
+
continue;
|
|
183
|
+
const key = flowPairKey({
|
|
184
|
+
sourceComponentId: hub.id,
|
|
185
|
+
targetComponentId: tp.id,
|
|
186
|
+
});
|
|
187
|
+
if (pairKeys.has(key))
|
|
188
|
+
continue;
|
|
189
|
+
pairKeys.add(key);
|
|
190
|
+
nextFlows.push({
|
|
191
|
+
id: `flow_fallback_${nextFlows.length + 1}`,
|
|
192
|
+
sourceComponentId: hub.id,
|
|
193
|
+
targetComponentId: tp.id,
|
|
194
|
+
type: 'api_call',
|
|
195
|
+
confidence: 0.6,
|
|
196
|
+
description: 'Section hub to orphan third party',
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return { components: nextComponents, flows: nextFlows };
|
|
72
200
|
}
|
|
73
201
|
function getStringValues(value) {
|
|
74
|
-
if (typeof value ===
|
|
202
|
+
if (typeof value === 'string')
|
|
75
203
|
return [value.toLowerCase()];
|
|
76
204
|
if (!Array.isArray(value))
|
|
77
205
|
return [];
|
|
78
206
|
return value
|
|
79
|
-
.filter((v) => typeof v ===
|
|
207
|
+
.filter((v) => typeof v === 'string')
|
|
80
208
|
.map((v) => v.toLowerCase());
|
|
81
209
|
}
|
|
82
210
|
function componentMatchesProvider(component, keys) {
|
|
83
211
|
const serviceNameValues = getStringValues(component.properties?.serviceName);
|
|
84
|
-
const name = (component.name ||
|
|
212
|
+
const name = (component.name || '').trim().toLowerCase();
|
|
85
213
|
const corpus = new Set([name, ...serviceNameValues]);
|
|
86
214
|
return keys.some((k) => corpus.has(k) || name.includes(k));
|
|
87
215
|
}
|
|
88
216
|
function isManagedResourceComponent(component, managedResource, fallbackPolicy) {
|
|
89
|
-
if (!(component.type ===
|
|
217
|
+
if (!(component.type === 'asset' && component.subType === 'database'))
|
|
90
218
|
return false;
|
|
91
219
|
const clients = getStringValues(component.properties?.client);
|
|
92
220
|
const dbTypeValues = getStringValues(component.properties?.databaseType);
|
|
93
|
-
const name = (component.name ||
|
|
221
|
+
const name = (component.name || '').toLowerCase();
|
|
94
222
|
const corpus = [...clients, ...dbTypeValues, name];
|
|
95
223
|
const hints = managedResource.matchHints.length > 0
|
|
96
224
|
? managedResource.matchHints
|
|
97
225
|
: fallbackPolicy.managedResourceMatchHintsByKind[managedResource.kind];
|
|
98
|
-
if (managedResource.kind ===
|
|
226
|
+
if (managedResource.kind === 'database') {
|
|
99
227
|
return corpus.some((v) => hints.some((hint) => v.includes(hint)));
|
|
100
228
|
}
|
|
101
|
-
if (managedResource.kind ===
|
|
229
|
+
if (managedResource.kind === 'cache') {
|
|
102
230
|
return corpus.some((v) => hints.some((hint) => v.includes(hint)));
|
|
103
231
|
}
|
|
104
232
|
return false;
|
|
@@ -122,9 +250,14 @@ function hasDirectClientMatch(component, directKeys, viaKeys) {
|
|
|
122
250
|
});
|
|
123
251
|
}
|
|
124
252
|
function normalizeSectionId(raw) {
|
|
125
|
-
const value = String(raw ??
|
|
126
|
-
|
|
127
|
-
|
|
253
|
+
const value = String(raw ?? '')
|
|
254
|
+
.trim()
|
|
255
|
+
.toLowerCase();
|
|
256
|
+
if (!value ||
|
|
257
|
+
value === 'root' ||
|
|
258
|
+
value === '<unsectioned>' ||
|
|
259
|
+
value === 'global') {
|
|
260
|
+
return '';
|
|
128
261
|
}
|
|
129
262
|
return value;
|
|
130
263
|
}
|
|
@@ -168,7 +301,9 @@ function providerUsageCorpus(provider, flows) {
|
|
|
168
301
|
continue;
|
|
169
302
|
if (Array.isArray(signal)) {
|
|
170
303
|
for (const item of signal) {
|
|
171
|
-
const text = String(item ??
|
|
304
|
+
const text = String(item ?? '')
|
|
305
|
+
.trim()
|
|
306
|
+
.toLowerCase();
|
|
172
307
|
if (text)
|
|
173
308
|
corpus.push(text);
|
|
174
309
|
}
|
|
@@ -190,7 +325,8 @@ function providerUsageCorpus(provider, flows) {
|
|
|
190
325
|
corpus.push(fp.toLowerCase());
|
|
191
326
|
}
|
|
192
327
|
for (const flow of flows) {
|
|
193
|
-
if (flow.targetComponentId !== provider.id &&
|
|
328
|
+
if (flow.targetComponentId !== provider.id &&
|
|
329
|
+
flow.sourceComponentId !== provider.id)
|
|
194
330
|
continue;
|
|
195
331
|
if (flow.description)
|
|
196
332
|
corpus.push(flow.description.toLowerCase());
|
|
@@ -207,19 +343,21 @@ function hasUsageSignal(corpus, signals) {
|
|
|
207
343
|
return signals.some((sig) => corpus.some((entry) => entry.includes(sig)));
|
|
208
344
|
}
|
|
209
345
|
function isPostgresLikeDatabase(component, policy) {
|
|
210
|
-
if (!(component.type ===
|
|
346
|
+
if (!(component.type === 'asset' && component.subType === 'database'))
|
|
211
347
|
return false;
|
|
212
348
|
const clients = getStringValues(component.properties?.client);
|
|
213
|
-
const name = (component.name ||
|
|
349
|
+
const name = (component.name || '').toLowerCase();
|
|
214
350
|
const corpus = [...clients, name];
|
|
215
351
|
return corpus.some((v) => policy.postgresLikeSignals.some((signal) => v.includes(signal)));
|
|
216
352
|
}
|
|
217
353
|
function isGenericLocalPgNode(component, policy) {
|
|
218
|
-
if (!(component.type ===
|
|
354
|
+
if (!(component.type === 'asset' && component.subType === 'database'))
|
|
219
355
|
return false;
|
|
220
356
|
if (component.properties?.managed_by_provider)
|
|
221
357
|
return false;
|
|
222
|
-
const name = String(component.name ??
|
|
358
|
+
const name = String(component.name ?? '')
|
|
359
|
+
.trim()
|
|
360
|
+
.toLowerCase();
|
|
223
361
|
const clients = getStringValues(component.properties?.client);
|
|
224
362
|
const genericName = policy.genericPgNodeNames.includes(name);
|
|
225
363
|
const genericClient = clients.some((v) => policy.genericPgClientSignals.includes(v));
|
|
@@ -228,9 +366,9 @@ function isGenericLocalPgNode(component, policy) {
|
|
|
228
366
|
function collapseGenericPgIntoManagedProviderNodes(components, flows, rulesByProviderServiceName, policy) {
|
|
229
367
|
const managedBySection = new Map();
|
|
230
368
|
for (const component of components) {
|
|
231
|
-
if (component.properties?.managed_service_key !==
|
|
369
|
+
if (component.properties?.managed_service_key !== 'postgres')
|
|
232
370
|
continue;
|
|
233
|
-
if (typeof component.properties?.managed_by_provider !==
|
|
371
|
+
if (typeof component.properties?.managed_by_provider !== 'string')
|
|
234
372
|
continue;
|
|
235
373
|
const sectionId = normalizeSectionId(component.properties?.section_id);
|
|
236
374
|
if (!sectionId)
|
|
@@ -244,12 +382,12 @@ function collapseGenericPgIntoManagedProviderNodes(components, flows, rulesByPro
|
|
|
244
382
|
const sectionId = normalizeSectionId(component.properties?.section_id);
|
|
245
383
|
if (!sectionId)
|
|
246
384
|
continue;
|
|
247
|
-
if (component.type ===
|
|
385
|
+
if (component.type === 'third_party') {
|
|
248
386
|
const list = providersBySection.get(sectionId) ?? [];
|
|
249
387
|
list.push(component);
|
|
250
388
|
providersBySection.set(sectionId, list);
|
|
251
389
|
}
|
|
252
|
-
const managedBy = String(component.properties?.managed_by_provider ??
|
|
390
|
+
const managedBy = String(component.properties?.managed_by_provider ?? '').trim();
|
|
253
391
|
if (!managedBy)
|
|
254
392
|
continue;
|
|
255
393
|
managedChildrenByProvider.set(managedBy, (managedChildrenByProvider.get(managedBy) ?? 0) + 1);
|
|
@@ -268,22 +406,25 @@ function collapseGenericPgIntoManagedProviderNodes(components, flows, rulesByPro
|
|
|
268
406
|
const providerWithTopology = providers.find((provider) => (managedChildrenByProvider.get(provider.id) ?? 0) > 0);
|
|
269
407
|
if (!providerWithTopology)
|
|
270
408
|
continue;
|
|
271
|
-
const providerServiceName = String(providerWithTopology.properties?.serviceName ??
|
|
409
|
+
const providerServiceName = String(providerWithTopology.properties?.serviceName ??
|
|
410
|
+
providerWithTopology.name ??
|
|
411
|
+
'')
|
|
272
412
|
.trim()
|
|
273
|
-
.toLowerCase() ||
|
|
413
|
+
.toLowerCase() || 'provider';
|
|
274
414
|
const providerRule = rulesByProviderServiceName.get(providerServiceName);
|
|
275
415
|
const providerDisplay = providerDisplayFromServiceName(providerServiceName);
|
|
276
416
|
component.name = `${providerDisplay} Pg`;
|
|
277
417
|
component.properties = {
|
|
278
418
|
...component.properties,
|
|
279
419
|
managed_by_provider: providerWithTopology.id,
|
|
280
|
-
managed_service_key:
|
|
420
|
+
managed_service_key: 'postgres',
|
|
281
421
|
serviceName: providerWithTopology.properties?.serviceName ?? providerServiceName,
|
|
282
|
-
generated_by:
|
|
422
|
+
generated_by: 'provider_topology_fallback',
|
|
283
423
|
};
|
|
284
424
|
// Drop pre-collapse local DB flows for this node; keep provider->managed link only.
|
|
285
425
|
for (const flow of flows) {
|
|
286
|
-
const touchesComponent = flow.sourceComponentId === component.id ||
|
|
426
|
+
const touchesComponent = flow.sourceComponentId === component.id ||
|
|
427
|
+
flow.targetComponentId === component.id;
|
|
287
428
|
if (!touchesComponent)
|
|
288
429
|
continue;
|
|
289
430
|
const isProviderManagedLink = flow.sourceComponentId === providerWithTopology.id &&
|
|
@@ -298,8 +439,9 @@ function collapseGenericPgIntoManagedProviderNodes(components, flows, rulesByPro
|
|
|
298
439
|
id: `flow_fallback_${flows.length + 1}`,
|
|
299
440
|
sourceComponentId: providerWithTopology.id,
|
|
300
441
|
targetComponentId: component.id,
|
|
301
|
-
type:
|
|
302
|
-
confidence: providerRule?.confidence.collapseManagedPostgresFlowConfidence ??
|
|
442
|
+
type: 'database_query',
|
|
443
|
+
confidence: providerRule?.confidence.collapseManagedPostgresFlowConfidence ??
|
|
444
|
+
0.78,
|
|
303
445
|
description: `${providerWithTopology.name} provides ${component.name}`,
|
|
304
446
|
});
|
|
305
447
|
}
|
|
@@ -324,9 +466,9 @@ function removeDirectFlowsToManagedPostgres(components, flows) {
|
|
|
324
466
|
const target = byId.get(flow.targetComponentId);
|
|
325
467
|
if (!target)
|
|
326
468
|
return true;
|
|
327
|
-
if (target.properties?.managed_service_key !==
|
|
469
|
+
if (target.properties?.managed_service_key !== 'postgres')
|
|
328
470
|
return true;
|
|
329
|
-
const providerId = String(target.properties?.managed_by_provider ??
|
|
471
|
+
const providerId = String(target.properties?.managed_by_provider ?? '');
|
|
330
472
|
if (!providerId)
|
|
331
473
|
return true;
|
|
332
474
|
// Keep only provider -> managed-postgres linkage.
|
|
@@ -383,21 +525,23 @@ function providerEvidenceForManagedNode(provider, managedNode) {
|
|
|
383
525
|
sourceLocations: [...sourceLocations],
|
|
384
526
|
};
|
|
385
527
|
}
|
|
386
|
-
const filteredDetectedFrom = detectedFrom.filter((ref) => evidencePatterns.has(String(ref.pattern ??
|
|
528
|
+
const filteredDetectedFrom = detectedFrom.filter((ref) => evidencePatterns.has(String(ref.pattern ?? '').toLowerCase()));
|
|
387
529
|
const filteredSourceLocations = dedupeSourceLocations(filteredDetectedFrom
|
|
388
530
|
.map((ref) => ref.sourceLocation)
|
|
389
531
|
.filter((loc) => Boolean(loc)));
|
|
390
532
|
return {
|
|
391
|
-
detectedFrom: filteredDetectedFrom.length > 0
|
|
533
|
+
detectedFrom: filteredDetectedFrom.length > 0
|
|
534
|
+
? filteredDetectedFrom
|
|
535
|
+
: [...detectedFrom],
|
|
392
536
|
sourceLocations: filteredSourceLocations.length > 0
|
|
393
537
|
? filteredSourceLocations
|
|
394
538
|
: [...sourceLocations],
|
|
395
539
|
};
|
|
396
540
|
}
|
|
397
541
|
function isProviderManagedDatabaseTarget(target, provider, rule) {
|
|
398
|
-
const cloudProvider = String(target.properties?.cloud_provider ??
|
|
399
|
-
const targetService = String(target.properties?.serviceName ??
|
|
400
|
-
const targetVendor = String(target.properties?.vendor ??
|
|
542
|
+
const cloudProvider = String(target.properties?.cloud_provider ?? '').toLowerCase();
|
|
543
|
+
const targetService = String(target.properties?.serviceName ?? '').toLowerCase();
|
|
544
|
+
const targetVendor = String(target.properties?.vendor ?? '').toLowerCase();
|
|
401
545
|
const providerKey = rule.providerId.toLowerCase();
|
|
402
546
|
const hints = [cloudProvider, targetService, targetVendor];
|
|
403
547
|
if (hints.some((h) => h.includes(providerKey)))
|
|
@@ -408,22 +552,19 @@ function isProviderManagedDatabaseTarget(target, provider, rule) {
|
|
|
408
552
|
return false;
|
|
409
553
|
}
|
|
410
554
|
const targetClients = getStringValues(target.properties?.client);
|
|
411
|
-
const targetName = String(target.name ??
|
|
412
|
-
const databaseRule = rule.managedResources.find((resource) => resource.kind ===
|
|
555
|
+
const targetName = String(target.name ?? '').toLowerCase();
|
|
556
|
+
const databaseRule = rule.managedResources.find((resource) => resource.kind === 'database');
|
|
413
557
|
const sharedFileSignals = databaseRule?.directClients ?? [];
|
|
414
|
-
const allowsSharedFileProviderInference = [
|
|
415
|
-
...targetClients,
|
|
416
|
-
targetName,
|
|
417
|
-
].some((value) => sharedFileSignals.some((signal) => value.includes(signal)));
|
|
558
|
+
const allowsSharedFileProviderInference = [...targetClients, targetName].some((value) => sharedFileSignals.some((signal) => value.includes(signal)));
|
|
418
559
|
if (!allowsSharedFileProviderInference) {
|
|
419
560
|
return false;
|
|
420
561
|
}
|
|
421
562
|
const targetFiles = new Set((target.sourceLocations ?? [])
|
|
422
563
|
.map((loc) => loc.filePath)
|
|
423
|
-
.filter((p) => typeof p ===
|
|
564
|
+
.filter((p) => typeof p === 'string'));
|
|
424
565
|
const providerFiles = new Set((provider.sourceLocations ?? [])
|
|
425
566
|
.map((loc) => loc.filePath)
|
|
426
|
-
.filter((p) => typeof p ===
|
|
567
|
+
.filter((p) => typeof p === 'string'));
|
|
427
568
|
for (const file of targetFiles) {
|
|
428
569
|
if (providerFiles.has(file))
|
|
429
570
|
return true;
|
|
@@ -431,22 +572,22 @@ function isProviderManagedDatabaseTarget(target, provider, rule) {
|
|
|
431
572
|
return false;
|
|
432
573
|
}
|
|
433
574
|
function selectPreferredApiSource(source, target, components) {
|
|
434
|
-
if (source.type !==
|
|
575
|
+
if (source.type !== 'asset')
|
|
435
576
|
return undefined;
|
|
436
|
-
if (target.type !==
|
|
577
|
+
if (target.type !== 'third_party')
|
|
437
578
|
return undefined;
|
|
438
579
|
const isMainApp = source.properties?.isMainApplication === true;
|
|
439
580
|
if (!isMainApp)
|
|
440
581
|
return undefined;
|
|
441
|
-
const sourceSection = String(source.properties?.section_id ??
|
|
582
|
+
const sourceSection = String(source.properties?.section_id ?? '');
|
|
442
583
|
const candidates = components.filter((c) => {
|
|
443
584
|
if (c.id === source.id)
|
|
444
585
|
return false;
|
|
445
|
-
if (c.type !==
|
|
586
|
+
if (c.type !== 'asset')
|
|
446
587
|
return false;
|
|
447
|
-
if (String(c.properties?.section_id ??
|
|
588
|
+
if (String(c.properties?.section_id ?? '') !== sourceSection)
|
|
448
589
|
return false;
|
|
449
|
-
if (c.subType !==
|
|
590
|
+
if (c.subType !== 'api')
|
|
450
591
|
return false;
|
|
451
592
|
return true;
|
|
452
593
|
});
|
|
@@ -455,21 +596,22 @@ function selectPreferredApiSource(source, target, components) {
|
|
|
455
596
|
return candidates[0];
|
|
456
597
|
}
|
|
457
598
|
function applyDeterministicInferenceFallbacks(components, flows) {
|
|
458
|
-
const
|
|
599
|
+
const fallbackPolicy = (0, provider_topology_rules_1.loadProviderTopologyFallbackPolicy)();
|
|
600
|
+
const ensured = ensureSectionHubsAndOrphanThirdPartyFlows(components, flows, fallbackPolicy);
|
|
601
|
+
const nextComponents = ensured.components.map((c) => ({
|
|
459
602
|
...c,
|
|
460
603
|
properties: { ...c.properties },
|
|
461
604
|
}));
|
|
462
605
|
const byId = componentById(nextComponents);
|
|
463
|
-
const next = flows.map((flow) => ({ ...flow }));
|
|
606
|
+
const next = ensured.flows.map((flow) => ({ ...flow }));
|
|
464
607
|
const keys = new Set(next.map((flow) => flowPairKey(flow)));
|
|
465
|
-
const fallbackPolicy = (0, provider_topology_rules_1.loadProviderTopologyFallbackPolicy)();
|
|
466
608
|
for (const flow of next) {
|
|
467
609
|
const source = byId.get(flow.sourceComponentId);
|
|
468
610
|
const target = byId.get(flow.targetComponentId);
|
|
469
611
|
if (!source || !target)
|
|
470
612
|
continue;
|
|
471
613
|
// Actor/customer should generally call the app/API, not the opposite.
|
|
472
|
-
if (source.type ===
|
|
614
|
+
if (source.type === 'asset' && target.type === 'actor') {
|
|
473
615
|
const originalSource = flow.sourceComponentId;
|
|
474
616
|
flow.sourceComponentId = flow.targetComponentId;
|
|
475
617
|
flow.targetComponentId = originalSource;
|
|
@@ -490,7 +632,7 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
490
632
|
}
|
|
491
633
|
const providerRules = (0, provider_topology_rules_1.loadProviderTopologyRules)();
|
|
492
634
|
for (const rule of providerRules) {
|
|
493
|
-
const providers = nextComponents.filter((component) => component.type ===
|
|
635
|
+
const providers = nextComponents.filter((component) => component.type === 'third_party' &&
|
|
494
636
|
componentMatchesProvider(component, rule.providerMatchKeys));
|
|
495
637
|
if (providers.length === 0)
|
|
496
638
|
continue;
|
|
@@ -504,7 +646,7 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
504
646
|
...provider.properties,
|
|
505
647
|
serviceName: canonicalService,
|
|
506
648
|
};
|
|
507
|
-
const sectionId = String(provider.properties?.section_id ??
|
|
649
|
+
const sectionId = String(provider.properties?.section_id ?? 'root');
|
|
508
650
|
const usageCorpus = collectSectionRolledUpProviderUsageCorpus({
|
|
509
651
|
provider,
|
|
510
652
|
providersInRule: providers,
|
|
@@ -530,12 +672,12 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
530
672
|
})
|
|
531
673
|
: undefined;
|
|
532
674
|
const terraformTargetsForNode = nextComponents.filter((c) => {
|
|
533
|
-
if (c.type !==
|
|
675
|
+
if (c.type !== 'asset')
|
|
534
676
|
return false;
|
|
535
|
-
if (typeof c.properties?.managed_by_provider ===
|
|
677
|
+
if (typeof c.properties?.managed_by_provider === 'string')
|
|
536
678
|
return false;
|
|
537
679
|
const addr = c.properties?.terraform_address;
|
|
538
|
-
if (typeof addr !==
|
|
680
|
+
if (typeof addr !== 'string' || addr.startsWith('provider.'))
|
|
539
681
|
return false;
|
|
540
682
|
if (!areComponentsSectionCompatible(provider, c))
|
|
541
683
|
return false;
|
|
@@ -555,7 +697,7 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
555
697
|
if (terraformTargetsForNode.length > 0) {
|
|
556
698
|
const multi = terraformTargetsForNode.length > 1;
|
|
557
699
|
for (const t of terraformTargetsForNode) {
|
|
558
|
-
const blockLabel = String(t.properties?.block_name ??
|
|
700
|
+
const blockLabel = String(t.properties?.block_name ?? '').trim();
|
|
559
701
|
t.name = multi
|
|
560
702
|
? `${managedNode.label} · ${blockLabel || t.id}`
|
|
561
703
|
: managedNode.label;
|
|
@@ -566,9 +708,10 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
566
708
|
managed_by_provider: provider.id,
|
|
567
709
|
managed_service_key: managedNode.key,
|
|
568
710
|
serviceName: provider.properties?.serviceName ?? rule.providerId,
|
|
569
|
-
generated_by:
|
|
711
|
+
generated_by: 'provider_topology_fallback',
|
|
570
712
|
section_id: t.properties?.section_id ?? sectionId,
|
|
571
|
-
section_label: t.properties?.section_label ??
|
|
713
|
+
section_label: t.properties?.section_label ??
|
|
714
|
+
provider.properties?.section_label,
|
|
572
715
|
section_role: t.properties?.section_role ?? provider.properties?.section_role,
|
|
573
716
|
};
|
|
574
717
|
const providerToServiceKey = `${provider.id}::${t.id}`;
|
|
@@ -588,7 +731,9 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
588
731
|
}
|
|
589
732
|
const existing = nextComponents.find((c) => c.properties?.managed_by_provider === provider.id &&
|
|
590
733
|
c.properties?.managed_service_key === managedNode.key);
|
|
591
|
-
const existingImplicitManaged = !existing
|
|
734
|
+
const existingImplicitManaged = !existing
|
|
735
|
+
? implicitManagedCandidate
|
|
736
|
+
: undefined;
|
|
592
737
|
const serviceNode = existingImplicitManaged ??
|
|
593
738
|
existing ??
|
|
594
739
|
(() => {
|
|
@@ -605,11 +750,11 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
605
750
|
properties: {
|
|
606
751
|
section_id: sectionId,
|
|
607
752
|
section_label: provider.properties?.section_label ?? sectionId,
|
|
608
|
-
section_role: provider.properties?.section_role ??
|
|
753
|
+
section_role: provider.properties?.section_role ?? 'service',
|
|
609
754
|
managed_by_provider: provider.id,
|
|
610
755
|
managed_service_key: managedNode.key,
|
|
611
756
|
serviceName: provider.properties?.serviceName ?? rule.providerId,
|
|
612
|
-
generated_by:
|
|
757
|
+
generated_by: 'provider_topology_fallback',
|
|
613
758
|
},
|
|
614
759
|
};
|
|
615
760
|
nextComponents.push(created);
|
|
@@ -622,7 +767,7 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
622
767
|
...serviceNode.properties,
|
|
623
768
|
managed_by_provider: provider.id,
|
|
624
769
|
managed_service_key: managedNode.key,
|
|
625
|
-
generated_by:
|
|
770
|
+
generated_by: 'provider_topology_fallback',
|
|
626
771
|
};
|
|
627
772
|
}
|
|
628
773
|
const providerToServiceKey = `${provider.id}::${serviceNode.id}`;
|
|
@@ -660,7 +805,7 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
660
805
|
id: `flow_fallback_${next.length + 1}`,
|
|
661
806
|
sourceComponentId: provider.id,
|
|
662
807
|
targetComponentId: target.id,
|
|
663
|
-
type:
|
|
808
|
+
type: 'database_query',
|
|
664
809
|
confidence: rule.confidence.providerToManagedResourceFlowConfidence,
|
|
665
810
|
description: `${provider.name} managed ${target.name}`,
|
|
666
811
|
});
|
|
@@ -680,14 +825,13 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
680
825
|
if (!areSectionCompatible(sourceComponent, provider, target))
|
|
681
826
|
continue;
|
|
682
827
|
const sourceTfAddr = sourceComponent.properties?.terraform_address;
|
|
683
|
-
if (typeof sourceTfAddr ===
|
|
828
|
+
if (typeof sourceTfAddr === 'string' &&
|
|
684
829
|
sourceTfAddr.trim().length > 0) {
|
|
685
830
|
// IaC resources already live in the provider plane; skip SDK-style
|
|
686
831
|
// "source → provider" hops and keep direct edges (e.g. RDS → managed PG).
|
|
687
832
|
continue;
|
|
688
833
|
}
|
|
689
|
-
const preferredSource = selectPreferredApiSource(sourceComponent, provider, nextComponents) ??
|
|
690
|
-
sourceComponent;
|
|
834
|
+
const preferredSource = selectPreferredApiSource(sourceComponent, provider, nextComponents) ?? sourceComponent;
|
|
691
835
|
const sourceToProviderKey = `${preferredSource.id}::${provider.id}`;
|
|
692
836
|
if (!keys.has(sourceToProviderKey)) {
|
|
693
837
|
keys.add(sourceToProviderKey);
|
|
@@ -695,7 +839,7 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
695
839
|
id: `flow_fallback_${next.length + 1}`,
|
|
696
840
|
sourceComponentId: preferredSource.id,
|
|
697
841
|
targetComponentId: provider.id,
|
|
698
|
-
type:
|
|
842
|
+
type: 'api_call',
|
|
699
843
|
confidence: Math.max(rule.confidence.sourceToProviderFlowConfidenceFloor, flow.confidence),
|
|
700
844
|
description: `${preferredSource.id} accesses ${target.name} via ${provider.name}`,
|
|
701
845
|
});
|
|
@@ -716,7 +860,7 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
716
860
|
}
|
|
717
861
|
const collapsedComponents = collapseGenericPgIntoManagedProviderNodes(nextComponents, next, rulesByProviderServiceName, fallbackPolicy);
|
|
718
862
|
removeDirectFlowsToManagedPostgres(collapsedComponents, next);
|
|
719
|
-
(0,
|
|
863
|
+
(0, scanner_1.appendTerraformBareProviderAttachmentFlows)({
|
|
720
864
|
components: collapsedComponents,
|
|
721
865
|
flows: next,
|
|
722
866
|
pairKeys: keys,
|
|
@@ -727,12 +871,12 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
727
871
|
for (const target of components) {
|
|
728
872
|
if (source.id === target.id)
|
|
729
873
|
continue;
|
|
730
|
-
if (source.type !==
|
|
874
|
+
if (source.type !== 'actor')
|
|
731
875
|
continue;
|
|
732
|
-
if (target.type !==
|
|
876
|
+
if (target.type !== 'asset')
|
|
733
877
|
continue;
|
|
734
|
-
const sourceSection = String(source.properties.section_id ??
|
|
735
|
-
const targetSection = String(target.properties.section_id ??
|
|
878
|
+
const sourceSection = String(source.properties.section_id ?? '');
|
|
879
|
+
const targetSection = String(target.properties.section_id ?? '');
|
|
736
880
|
if (!targetSection || sourceSection === targetSection)
|
|
737
881
|
continue;
|
|
738
882
|
// Do not synthesize edges from a section-scoped actor into another service
|
|
@@ -751,7 +895,7 @@ function applyDeterministicInferenceFallbacks(components, flows) {
|
|
|
751
895
|
id: `flow_fallback_${next.length + 1}`,
|
|
752
896
|
sourceComponentId: source.id,
|
|
753
897
|
targetComponentId: target.id,
|
|
754
|
-
type:
|
|
898
|
+
type: 'api_call',
|
|
755
899
|
confidence: fallbackPolicy.crossSectionActorAssetFlowConfidence,
|
|
756
900
|
});
|
|
757
901
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { DetectedComponent } from
|
|
2
|
-
import type { DetectedDataFlow } from
|
|
3
|
-
import type { AiMergeResult, AiMergeThresholds, AiProposal } from
|
|
1
|
+
import type { DetectedComponent } from '../core/types/component';
|
|
2
|
+
import type { DetectedDataFlow } from '../core/types/data-flow';
|
|
3
|
+
import type { AiMergeResult, AiMergeThresholds, AiProposal } from './types';
|
|
4
|
+
/** PRD §4.4 / task 2.2 — AI data-action assignments gated at ≥ 0.72. */
|
|
5
|
+
export declare const DATA_ACTION_MIN_CONFIDENCE = 0.72;
|
|
4
6
|
/** When true, flow_patch proposals are not applied — data-flow graph stays exactly as detected before AI. */
|
|
5
7
|
export interface MergeAiProposalsOptions {
|
|
6
8
|
preserveDataFlowTopology?: boolean;
|