@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,426 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildThirdPartyHeuristicProposal = buildThirdPartyHeuristicProposal;
|
|
4
|
+
exports.verifyThirdPartyProposal = verifyThirdPartyProposal;
|
|
5
|
+
const KNOWN_VENDOR_DOCS = {
|
|
6
|
+
aws: "https://docs.aws.amazon.com",
|
|
7
|
+
stripe: "https://docs.stripe.com",
|
|
8
|
+
sentry: "https://docs.sentry.io",
|
|
9
|
+
auth0: "https://auth0.com/docs",
|
|
10
|
+
twilio: "https://www.twilio.com/docs",
|
|
11
|
+
slack: "https://api.slack.com",
|
|
12
|
+
github: "https://docs.github.com",
|
|
13
|
+
google: "https://cloud.google.com/docs",
|
|
14
|
+
azure: "https://learn.microsoft.com/azure",
|
|
15
|
+
};
|
|
16
|
+
function isSparse(value) {
|
|
17
|
+
if (value === null || value === undefined)
|
|
18
|
+
return true;
|
|
19
|
+
if (typeof value === "string")
|
|
20
|
+
return value.trim().length === 0;
|
|
21
|
+
if (Array.isArray(value))
|
|
22
|
+
return value.length === 0;
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
function toBand(score) {
|
|
26
|
+
if (score >= 0.85)
|
|
27
|
+
return "high";
|
|
28
|
+
if (score >= 0.65)
|
|
29
|
+
return "medium";
|
|
30
|
+
return "low";
|
|
31
|
+
}
|
|
32
|
+
function firstLineMatch(file, pattern) {
|
|
33
|
+
const lines = file.content.split(/\r?\n/);
|
|
34
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
35
|
+
const line = lines[i];
|
|
36
|
+
if (pattern.test(line)) {
|
|
37
|
+
return { line: i + 1, snippet: line.trim().slice(0, 160) };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
function componentSeedPaths(component) {
|
|
43
|
+
const seed = new Set();
|
|
44
|
+
const sectionId = component.properties.section_id;
|
|
45
|
+
if (typeof sectionId === "string" && sectionId.trim()) {
|
|
46
|
+
seed.add(sectionId.trim());
|
|
47
|
+
}
|
|
48
|
+
for (const loc of component.sourceLocations ?? []) {
|
|
49
|
+
if (loc.filePath?.trim())
|
|
50
|
+
seed.add(loc.filePath.trim());
|
|
51
|
+
}
|
|
52
|
+
for (const ref of component.detectedFrom ?? []) {
|
|
53
|
+
const fp = ref.sourceLocation?.filePath;
|
|
54
|
+
if (fp?.trim())
|
|
55
|
+
seed.add(fp.trim());
|
|
56
|
+
}
|
|
57
|
+
return seed;
|
|
58
|
+
}
|
|
59
|
+
function selectRelevantFiles(component, files) {
|
|
60
|
+
const seeds = [...componentSeedPaths(component)];
|
|
61
|
+
if (seeds.length === 0)
|
|
62
|
+
return [];
|
|
63
|
+
return files.filter((file) => seeds.some((seed) => file.path.startsWith(seed) || seed.startsWith(file.path)));
|
|
64
|
+
}
|
|
65
|
+
function extractEndpoints(files) {
|
|
66
|
+
const hits = [];
|
|
67
|
+
const re = /https?:\/\/[^\s"'`)<>\]]+/g;
|
|
68
|
+
for (const file of files) {
|
|
69
|
+
const lines = file.content.split(/\r?\n/);
|
|
70
|
+
lines.forEach((line, idx) => {
|
|
71
|
+
const matches = [...line.matchAll(re)];
|
|
72
|
+
for (const match of matches) {
|
|
73
|
+
const url = match[0];
|
|
74
|
+
if (!url)
|
|
75
|
+
continue;
|
|
76
|
+
hits.push({ url, filePath: file.path, line: idx + 1 });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return hits;
|
|
81
|
+
}
|
|
82
|
+
function parseDependencies(files) {
|
|
83
|
+
const out = new Set();
|
|
84
|
+
for (const file of files) {
|
|
85
|
+
if (!file.path.endsWith("package.json"))
|
|
86
|
+
continue;
|
|
87
|
+
try {
|
|
88
|
+
const parsed = JSON.parse(file.content);
|
|
89
|
+
for (const key of Object.keys(parsed.dependencies ?? {}))
|
|
90
|
+
out.add(key.toLowerCase());
|
|
91
|
+
for (const key of Object.keys(parsed.devDependencies ?? {}))
|
|
92
|
+
out.add(key.toLowerCase());
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// Ignore malformed package json in scanned repositories.
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return [...out].sort();
|
|
99
|
+
}
|
|
100
|
+
function inferVendor(component, evidence) {
|
|
101
|
+
const refs = [];
|
|
102
|
+
const candidates = new Set();
|
|
103
|
+
const fromName = component.name?.trim();
|
|
104
|
+
if (fromName)
|
|
105
|
+
candidates.add(fromName.toLowerCase());
|
|
106
|
+
const fromClient = component.properties.client;
|
|
107
|
+
if (typeof fromClient === "string" && fromClient.trim()) {
|
|
108
|
+
candidates.add(fromClient.trim().toLowerCase());
|
|
109
|
+
}
|
|
110
|
+
for (const dep of evidence.dependencyNames) {
|
|
111
|
+
const normalized = dep.replace(/^@/, "").split("/")[0]?.trim();
|
|
112
|
+
if (normalized)
|
|
113
|
+
candidates.add(normalized.toLowerCase());
|
|
114
|
+
}
|
|
115
|
+
for (const endpoint of evidence.endpoints) {
|
|
116
|
+
try {
|
|
117
|
+
const host = new URL(endpoint.url).hostname.replace(/^api\./, "");
|
|
118
|
+
const base = host.split(".")[0]?.toLowerCase();
|
|
119
|
+
if (base)
|
|
120
|
+
candidates.add(base);
|
|
121
|
+
refs.push({
|
|
122
|
+
filePath: endpoint.filePath,
|
|
123
|
+
startLine: endpoint.line,
|
|
124
|
+
endLine: endpoint.line,
|
|
125
|
+
reason: `endpoint host suggests vendor ${base ?? host}`,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
// Ignore invalid urls.
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const ranked = [...candidates]
|
|
133
|
+
.map((raw) => {
|
|
134
|
+
if (KNOWN_VENDOR_DOCS[raw])
|
|
135
|
+
return { raw, score: 0.92 };
|
|
136
|
+
if (raw.length >= 3)
|
|
137
|
+
return { raw, score: 0.78 };
|
|
138
|
+
return { raw, score: 0.62 };
|
|
139
|
+
})
|
|
140
|
+
.sort((a, b) => b.score - a.score || a.raw.localeCompare(b.raw));
|
|
141
|
+
const winner = ranked[0];
|
|
142
|
+
if (!winner)
|
|
143
|
+
return { score: 0, refs: [] };
|
|
144
|
+
const depEvidence = evidence.files.find((f) => f.path.endsWith("package.json"));
|
|
145
|
+
if (depEvidence) {
|
|
146
|
+
refs.push({
|
|
147
|
+
filePath: depEvidence.path,
|
|
148
|
+
startLine: 1,
|
|
149
|
+
endLine: 1,
|
|
150
|
+
reason: "dependency manifest contributes vendor inference",
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return { vendor: winner.raw[0].toUpperCase() + winner.raw.slice(1), score: winner.score, refs };
|
|
154
|
+
}
|
|
155
|
+
function inferAuthHints(files) {
|
|
156
|
+
const hints = new Set();
|
|
157
|
+
const patterns = [
|
|
158
|
+
{ id: "oauth2", re: /\boauth2?\b/i },
|
|
159
|
+
{ id: "jwt", re: /\bjwt\b/i },
|
|
160
|
+
{ id: "api_key", re: /\bapi[_-]?key\b/i },
|
|
161
|
+
{ id: "bearer_token", re: /\bbearer\b/i },
|
|
162
|
+
{ id: "basic_auth", re: /\bbasic auth\b/i },
|
|
163
|
+
];
|
|
164
|
+
for (const file of files) {
|
|
165
|
+
for (const pattern of patterns) {
|
|
166
|
+
if (pattern.re.test(file.content))
|
|
167
|
+
hints.add(pattern.id);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return hints;
|
|
171
|
+
}
|
|
172
|
+
function inferImportHints(files) {
|
|
173
|
+
const hints = new Set();
|
|
174
|
+
for (const file of files) {
|
|
175
|
+
const lines = file.content.split(/\r?\n/);
|
|
176
|
+
for (const line of lines) {
|
|
177
|
+
if (/\b(import|require)\b/.test(line))
|
|
178
|
+
hints.add("sdk");
|
|
179
|
+
if (/\bfetch\(|\baxios\b|\bhttp[s]?:\/\//i.test(line))
|
|
180
|
+
hints.add("api");
|
|
181
|
+
if (/\bgraphql\b|\/graphql\b/i.test(line))
|
|
182
|
+
hints.add("graphql");
|
|
183
|
+
if (/\bwebhook\b/i.test(line))
|
|
184
|
+
hints.add("webhook");
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return hints;
|
|
188
|
+
}
|
|
189
|
+
function buildBundle(candidate, component, files) {
|
|
190
|
+
const relevant = selectRelevantFiles(component, files);
|
|
191
|
+
const endpoints = extractEndpoints(relevant);
|
|
192
|
+
return {
|
|
193
|
+
candidate,
|
|
194
|
+
component,
|
|
195
|
+
files: relevant,
|
|
196
|
+
endpoints,
|
|
197
|
+
dependencyNames: parseDependencies(relevant),
|
|
198
|
+
authHints: inferAuthHints(relevant),
|
|
199
|
+
importHints: inferImportHints(relevant),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function buildPropertyEvidence(refs, property) {
|
|
203
|
+
return { [property]: refs.slice(0, 4) };
|
|
204
|
+
}
|
|
205
|
+
function buildThirdPartyHeuristicProposal(input) {
|
|
206
|
+
const bundle = buildBundle(input.candidate, input.component, input.files);
|
|
207
|
+
if (bundle.files.length === 0)
|
|
208
|
+
return undefined;
|
|
209
|
+
const setProperties = {};
|
|
210
|
+
const propertyEvidence = {};
|
|
211
|
+
const allEvidence = [];
|
|
212
|
+
const scores = [];
|
|
213
|
+
const vendorResult = inferVendor(bundle.component, bundle);
|
|
214
|
+
if (vendorResult.vendor && isSparse(bundle.component.properties.vendor)) {
|
|
215
|
+
setProperties.vendor = vendorResult.vendor;
|
|
216
|
+
propertyEvidence.vendor = vendorResult.refs;
|
|
217
|
+
allEvidence.push(...vendorResult.refs);
|
|
218
|
+
scores.push(vendorResult.score);
|
|
219
|
+
}
|
|
220
|
+
const vendorLower = typeof setProperties.vendor === "string"
|
|
221
|
+
? String(setProperties.vendor).toLowerCase()
|
|
222
|
+
: undefined;
|
|
223
|
+
if (vendorLower && isSparse(bundle.component.properties.serviceName)) {
|
|
224
|
+
setProperties.serviceName = String(setProperties.vendor);
|
|
225
|
+
propertyEvidence.serviceName = propertyEvidence.vendor ?? [];
|
|
226
|
+
scores.push(0.9);
|
|
227
|
+
}
|
|
228
|
+
if (vendorLower && isSparse(bundle.component.properties.client)) {
|
|
229
|
+
setProperties.client = vendorLower;
|
|
230
|
+
propertyEvidence.client = propertyEvidence.vendor ?? [];
|
|
231
|
+
scores.push(0.86);
|
|
232
|
+
}
|
|
233
|
+
if (isSparse(bundle.component.properties.integration_method)) {
|
|
234
|
+
const methods = [];
|
|
235
|
+
if (bundle.importHints.has("api"))
|
|
236
|
+
methods.push("api");
|
|
237
|
+
if (bundle.importHints.has("sdk"))
|
|
238
|
+
methods.push("sdk");
|
|
239
|
+
if (bundle.importHints.has("webhook"))
|
|
240
|
+
methods.push("webhook");
|
|
241
|
+
if (methods.length > 0) {
|
|
242
|
+
setProperties.integration_method = [...new Set(methods)];
|
|
243
|
+
const file = bundle.files[0];
|
|
244
|
+
const match = firstLineMatch(file, /\b(import|require|fetch\(|axios|webhook)\b/i);
|
|
245
|
+
if (match) {
|
|
246
|
+
propertyEvidence.integration_method = buildPropertyEvidence([
|
|
247
|
+
{
|
|
248
|
+
filePath: file.path,
|
|
249
|
+
startLine: match.line,
|
|
250
|
+
endLine: match.line,
|
|
251
|
+
reason: "integration style inferred from imports/call sites",
|
|
252
|
+
},
|
|
253
|
+
], "integration_method").integration_method;
|
|
254
|
+
allEvidence.push(...(propertyEvidence.integration_method ?? []));
|
|
255
|
+
}
|
|
256
|
+
scores.push(0.82);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (isSparse(bundle.component.properties.api_type)) {
|
|
260
|
+
let apiType;
|
|
261
|
+
if (bundle.importHints.has("graphql"))
|
|
262
|
+
apiType = "graphql";
|
|
263
|
+
else if (bundle.importHints.has("webhook"))
|
|
264
|
+
apiType = "webhook";
|
|
265
|
+
else if (bundle.endpoints.length > 0 || bundle.importHints.has("api"))
|
|
266
|
+
apiType = "rest";
|
|
267
|
+
if (apiType) {
|
|
268
|
+
setProperties.api_type = apiType;
|
|
269
|
+
const hit = bundle.endpoints[0];
|
|
270
|
+
if (hit) {
|
|
271
|
+
propertyEvidence.api_type = [
|
|
272
|
+
{
|
|
273
|
+
filePath: hit.filePath,
|
|
274
|
+
startLine: hit.line,
|
|
275
|
+
endLine: hit.line,
|
|
276
|
+
reason: `endpoint usage suggests ${apiType} API`,
|
|
277
|
+
},
|
|
278
|
+
];
|
|
279
|
+
allEvidence.push(...propertyEvidence.api_type);
|
|
280
|
+
}
|
|
281
|
+
scores.push(apiType === "graphql" ? 0.86 : 0.8);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (isSparse(bundle.component.properties.authentication_method)) {
|
|
285
|
+
let method;
|
|
286
|
+
if (bundle.authHints.has("oauth2"))
|
|
287
|
+
method = "oauth2";
|
|
288
|
+
else if (bundle.authHints.has("api_key"))
|
|
289
|
+
method = "api_key";
|
|
290
|
+
else if (bundle.authHints.has("bearer_token"))
|
|
291
|
+
method = "bearer_token";
|
|
292
|
+
else if (bundle.authHints.has("jwt"))
|
|
293
|
+
method = "jwt";
|
|
294
|
+
else if (bundle.authHints.has("basic_auth"))
|
|
295
|
+
method = "basic_auth";
|
|
296
|
+
if (method) {
|
|
297
|
+
setProperties.authentication_method = method;
|
|
298
|
+
const matchFile = bundle.files.find((file) => /\boauth2?\b|\bapi[_-]?key\b|\bbearer\b|\bjwt\b|\bbasic auth\b/i.test(file.content));
|
|
299
|
+
if (matchFile) {
|
|
300
|
+
const match = firstLineMatch(matchFile, /\boauth2?\b|\bapi[_-]?key\b|\bbearer\b|\bjwt\b|\bbasic auth\b/i);
|
|
301
|
+
if (match) {
|
|
302
|
+
propertyEvidence.authentication_method = [
|
|
303
|
+
{
|
|
304
|
+
filePath: matchFile.path,
|
|
305
|
+
startLine: match.line,
|
|
306
|
+
endLine: match.line,
|
|
307
|
+
reason: "auth token/header pattern detected",
|
|
308
|
+
},
|
|
309
|
+
];
|
|
310
|
+
allEvidence.push(...propertyEvidence.authentication_method);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
scores.push(0.78);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (bundle.endpoints.length > 0 && isSparse(bundle.component.properties.api_endpoint)) {
|
|
317
|
+
const endpoint = bundle.endpoints[0];
|
|
318
|
+
setProperties.api_endpoint = endpoint.url;
|
|
319
|
+
propertyEvidence.api_endpoint = [
|
|
320
|
+
{
|
|
321
|
+
filePath: endpoint.filePath,
|
|
322
|
+
startLine: endpoint.line,
|
|
323
|
+
endLine: endpoint.line,
|
|
324
|
+
reason: "external endpoint found in section code",
|
|
325
|
+
},
|
|
326
|
+
];
|
|
327
|
+
allEvidence.push(...propertyEvidence.api_endpoint);
|
|
328
|
+
scores.push(0.84);
|
|
329
|
+
}
|
|
330
|
+
if (bundle.endpoints.length > 0 && isSparse(bundle.component.properties.https_enforced)) {
|
|
331
|
+
const httpsOnly = bundle.endpoints.every((item) => item.url.startsWith("https://"));
|
|
332
|
+
setProperties.https_enforced = httpsOnly;
|
|
333
|
+
const endpoint = bundle.endpoints[0];
|
|
334
|
+
propertyEvidence.https_enforced = [
|
|
335
|
+
{
|
|
336
|
+
filePath: endpoint.filePath,
|
|
337
|
+
startLine: endpoint.line,
|
|
338
|
+
endLine: endpoint.line,
|
|
339
|
+
reason: httpsOnly ? "all discovered endpoints are HTTPS" : "non-HTTPS endpoint found",
|
|
340
|
+
},
|
|
341
|
+
];
|
|
342
|
+
allEvidence.push(...propertyEvidence.https_enforced);
|
|
343
|
+
scores.push(httpsOnly ? 0.9 : 0.7);
|
|
344
|
+
}
|
|
345
|
+
if (vendorLower && isSparse(bundle.component.properties.documentation_url)) {
|
|
346
|
+
const docs = KNOWN_VENDOR_DOCS[vendorLower];
|
|
347
|
+
if (docs) {
|
|
348
|
+
setProperties.documentation_url = docs;
|
|
349
|
+
propertyEvidence.documentation_url = propertyEvidence.vendor ?? [];
|
|
350
|
+
scores.push(0.86);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (bundle.dependencyNames.length > 0 && isSparse(bundle.component.properties.sdk_available)) {
|
|
354
|
+
setProperties.sdk_available = true;
|
|
355
|
+
const depFile = bundle.files.find((file) => file.path.endsWith("package.json"));
|
|
356
|
+
if (depFile) {
|
|
357
|
+
propertyEvidence.sdk_available = [
|
|
358
|
+
{
|
|
359
|
+
filePath: depFile.path,
|
|
360
|
+
startLine: 1,
|
|
361
|
+
endLine: 1,
|
|
362
|
+
reason: "dependency manifest indicates SDK/library usage",
|
|
363
|
+
},
|
|
364
|
+
];
|
|
365
|
+
allEvidence.push(...propertyEvidence.sdk_available);
|
|
366
|
+
}
|
|
367
|
+
scores.push(0.83);
|
|
368
|
+
}
|
|
369
|
+
if ((bundle.importHints.has("api") || bundle.importHints.has("sdk")) &&
|
|
370
|
+
isSparse(bundle.component.properties.integration_status)) {
|
|
371
|
+
setProperties.integration_status = "active";
|
|
372
|
+
const file = bundle.files[0];
|
|
373
|
+
if (file) {
|
|
374
|
+
propertyEvidence.integration_status = [
|
|
375
|
+
{
|
|
376
|
+
filePath: file.path,
|
|
377
|
+
startLine: 1,
|
|
378
|
+
endLine: 1,
|
|
379
|
+
reason: "client calls/imports indicate active integration",
|
|
380
|
+
},
|
|
381
|
+
];
|
|
382
|
+
allEvidence.push(...propertyEvidence.integration_status);
|
|
383
|
+
}
|
|
384
|
+
scores.push(0.8);
|
|
385
|
+
}
|
|
386
|
+
const normalizedSetProperties = { ...setProperties };
|
|
387
|
+
if (Object.keys(normalizedSetProperties).length === 0)
|
|
388
|
+
return undefined;
|
|
389
|
+
const confidenceScore = scores.length > 0 ? Math.max(0.65, Math.min(0.96, scores.reduce((a, b) => a + b, 0) / scores.length)) : 0.65;
|
|
390
|
+
return {
|
|
391
|
+
kind: "component_patch",
|
|
392
|
+
targetComponentId: bundle.component.id,
|
|
393
|
+
candidateType: "third_party",
|
|
394
|
+
setProperties: normalizedSetProperties,
|
|
395
|
+
propertyEvidence,
|
|
396
|
+
confidence: {
|
|
397
|
+
score: Number(confidenceScore.toFixed(2)),
|
|
398
|
+
band: toBand(confidenceScore),
|
|
399
|
+
},
|
|
400
|
+
evidence: allEvidence.slice(0, 16),
|
|
401
|
+
provider: "mock",
|
|
402
|
+
model: "third_party_evidence_v1",
|
|
403
|
+
agent: "tpAgent",
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function verifyPropertyEvidence(patch) {
|
|
407
|
+
if (!patch.propertyEvidence)
|
|
408
|
+
return false;
|
|
409
|
+
for (const key of Object.keys(patch.setProperties)) {
|
|
410
|
+
const refs = patch.propertyEvidence[key];
|
|
411
|
+
if (!refs || refs.length === 0)
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
return true;
|
|
415
|
+
}
|
|
416
|
+
function verifyThirdPartyProposal(proposal) {
|
|
417
|
+
if (proposal.kind !== "component_patch")
|
|
418
|
+
return { ok: false, reason: "not_component_patch" };
|
|
419
|
+
if (proposal.candidateType !== "third_party")
|
|
420
|
+
return { ok: false, reason: "not_third_party_candidate" };
|
|
421
|
+
if (proposal.evidence.length === 0)
|
|
422
|
+
return { ok: false, reason: "missing_evidence" };
|
|
423
|
+
if (!verifyPropertyEvidence(proposal))
|
|
424
|
+
return { ok: false, reason: "missing_property_evidence" };
|
|
425
|
+
return { ok: true };
|
|
426
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ThirdPartyInferenceKind = "direct" | "heuristic" | "not_inferable_v1";
|
|
2
|
+
export interface ThirdPartyPropertyMatrixEntry {
|
|
3
|
+
property: string;
|
|
4
|
+
kind: ThirdPartyInferenceKind;
|
|
5
|
+
notes: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* v1 matrix for third-party autofill. Keep this intentionally conservative:
|
|
9
|
+
* - `direct`: can usually be read from explicit code/config/docs signals.
|
|
10
|
+
* - `heuristic`: inferable from patterns but may need confidence gating.
|
|
11
|
+
* - `not_inferable_v1`: generally legal/commercial/governance fields.
|
|
12
|
+
*/
|
|
13
|
+
export declare const THIRD_PARTY_PROPERTY_MATRIX: ThirdPartyPropertyMatrixEntry[];
|
|
14
|
+
export declare function getThirdPartyPropertyInferability(property: string): ThirdPartyInferenceKind;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.THIRD_PARTY_PROPERTY_MATRIX = void 0;
|
|
4
|
+
exports.getThirdPartyPropertyInferability = getThirdPartyPropertyInferability;
|
|
5
|
+
/**
|
|
6
|
+
* v1 matrix for third-party autofill. Keep this intentionally conservative:
|
|
7
|
+
* - `direct`: can usually be read from explicit code/config/docs signals.
|
|
8
|
+
* - `heuristic`: inferable from patterns but may need confidence gating.
|
|
9
|
+
* - `not_inferable_v1`: generally legal/commercial/governance fields.
|
|
10
|
+
*/
|
|
11
|
+
exports.THIRD_PARTY_PROPERTY_MATRIX = [
|
|
12
|
+
{ property: "vendor", kind: "direct", notes: "Vendor name from package/import/domain evidence." },
|
|
13
|
+
{ property: "serviceName", kind: "direct", notes: "Service/vendor identity from evidence." },
|
|
14
|
+
{ property: "client", kind: "heuristic", notes: "Lowercase normalized vendor/client identifier." },
|
|
15
|
+
{ property: "integration_method", kind: "direct", notes: "API/SDK/webhook style integration markers." },
|
|
16
|
+
{ property: "api_type", kind: "heuristic", notes: "REST/GraphQL/webhook hints from usage and endpoints." },
|
|
17
|
+
{ property: "authentication_method", kind: "heuristic", notes: "Bearer/API key/OAuth/JWT/basic signals." },
|
|
18
|
+
{ property: "documentation_url", kind: "direct", notes: "Known vendor docs URL when vendor is high-confidence." },
|
|
19
|
+
{ property: "sdk_available", kind: "direct", notes: "Dependency/import evidence for vendor SDKs." },
|
|
20
|
+
{ property: "https_enforced", kind: "direct", notes: "All discovered endpoints use HTTPS." },
|
|
21
|
+
{ property: "api_endpoint", kind: "heuristic", notes: "Most representative vendor endpoint found in code/config." },
|
|
22
|
+
{ property: "integration_status", kind: "heuristic", notes: "Active when imports/calls indicate live usage." },
|
|
23
|
+
{
|
|
24
|
+
property: "technical_owner_team",
|
|
25
|
+
kind: "not_inferable_v1",
|
|
26
|
+
notes: "Org ownership is typically not provable from code.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
property: "vendor_soc2_iso27001",
|
|
30
|
+
kind: "not_inferable_v1",
|
|
31
|
+
notes: "Compliance attestations are not code-evidenced reliably.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
property: "data_processing_agreement_dpa",
|
|
35
|
+
kind: "not_inferable_v1",
|
|
36
|
+
notes: "Contractual/legal status requires non-code source of truth.",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
property: "dpa_expiry_date",
|
|
40
|
+
kind: "not_inferable_v1",
|
|
41
|
+
notes: "Contract date not reliably inferable from repository artifacts.",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
property: "vendor_support_contact",
|
|
45
|
+
kind: "not_inferable_v1",
|
|
46
|
+
notes: "Support contacts are usually contractual/ops metadata.",
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
const inferabilityByProperty = new Map(exports.THIRD_PARTY_PROPERTY_MATRIX.map((entry) => [entry.property, entry.kind]));
|
|
50
|
+
function getThirdPartyPropertyInferability(property) {
|
|
51
|
+
return inferabilityByProperty.get(property) ?? "not_inferable_v1";
|
|
52
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DetectedComponent } from "../core/types/component";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical third-party subtypes (aligned with product thirdPartyTypes + classifier catalog).
|
|
4
|
+
* `ai_provider` is accepted from the classifier and mapped in the UI to api_provider.
|
|
5
|
+
*/
|
|
6
|
+
export declare const THIRD_PARTY_SUBTYPE_TAXONOMY: readonly ["b2b_customer", "saas_service", "payment_processor", "cloud_provider", "api_provider", "ai_provider", "data_provider", "government_regulator", "partner", "ad_network", "professional_services", "data_processor", "data_controller", "joint_controller", "vendor", "service_provider", "marketing_partner", "analytics_provider", "support_provider", "consultant", "subprocessor", "other"];
|
|
7
|
+
export declare function normalizeThirdPartySubType(raw: string | undefined | null): (typeof THIRD_PARTY_SUBTYPE_TAXONOMY)[number] | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Infer a third-party subtype from vendor/client/name signals when the classifier
|
|
10
|
+
* did not match a catalog entry.
|
|
11
|
+
*/
|
|
12
|
+
export declare function inferThirdPartySubType(component: DetectedComponent): (typeof THIRD_PARTY_SUBTYPE_TAXONOMY)[number];
|
|
13
|
+
/** Fill missing subType on all third_party components (post-classify / post-AI). */
|
|
14
|
+
export declare function ensureThirdPartySubTypes(components: DetectedComponent[]): number;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.THIRD_PARTY_SUBTYPE_TAXONOMY = void 0;
|
|
4
|
+
exports.normalizeThirdPartySubType = normalizeThirdPartySubType;
|
|
5
|
+
exports.inferThirdPartySubType = inferThirdPartySubType;
|
|
6
|
+
exports.ensureThirdPartySubTypes = ensureThirdPartySubTypes;
|
|
7
|
+
const config_1 = require("../classifier/config");
|
|
8
|
+
/**
|
|
9
|
+
* Canonical third-party subtypes (aligned with product thirdPartyTypes + classifier catalog).
|
|
10
|
+
* `ai_provider` is accepted from the classifier and mapped in the UI to api_provider.
|
|
11
|
+
*/
|
|
12
|
+
exports.THIRD_PARTY_SUBTYPE_TAXONOMY = [
|
|
13
|
+
"b2b_customer",
|
|
14
|
+
"saas_service",
|
|
15
|
+
"payment_processor",
|
|
16
|
+
"cloud_provider",
|
|
17
|
+
"api_provider",
|
|
18
|
+
"ai_provider",
|
|
19
|
+
"data_provider",
|
|
20
|
+
"government_regulator",
|
|
21
|
+
"partner",
|
|
22
|
+
"ad_network",
|
|
23
|
+
"professional_services",
|
|
24
|
+
"data_processor",
|
|
25
|
+
"data_controller",
|
|
26
|
+
"joint_controller",
|
|
27
|
+
"vendor",
|
|
28
|
+
"service_provider",
|
|
29
|
+
"marketing_partner",
|
|
30
|
+
"analytics_provider",
|
|
31
|
+
"support_provider",
|
|
32
|
+
"consultant",
|
|
33
|
+
"subprocessor",
|
|
34
|
+
"other",
|
|
35
|
+
];
|
|
36
|
+
const SUBTYPE_ALIASES = {
|
|
37
|
+
saas: "saas_service",
|
|
38
|
+
saas_service: "saas_service",
|
|
39
|
+
"saas service": "saas_service",
|
|
40
|
+
api: "api_provider",
|
|
41
|
+
api_provider: "api_provider",
|
|
42
|
+
"api provider": "api_provider",
|
|
43
|
+
ai: "ai_provider",
|
|
44
|
+
ai_provider: "ai_provider",
|
|
45
|
+
"ai provider": "ai_provider",
|
|
46
|
+
llm: "ai_provider",
|
|
47
|
+
payment: "payment_processor",
|
|
48
|
+
payment_processor: "payment_processor",
|
|
49
|
+
cloud: "cloud_provider",
|
|
50
|
+
cloud_provider: "cloud_provider",
|
|
51
|
+
analytics: "analytics_provider",
|
|
52
|
+
analytics_provider: "analytics_provider",
|
|
53
|
+
auth: "saas_service",
|
|
54
|
+
identity: "saas_service",
|
|
55
|
+
database: "saas_service",
|
|
56
|
+
storage: "saas_service",
|
|
57
|
+
cdn: "saas_service",
|
|
58
|
+
email: "saas_service",
|
|
59
|
+
messaging: "saas_service",
|
|
60
|
+
};
|
|
61
|
+
const NAME_HEURISTICS = [
|
|
62
|
+
{ re: /\b(openai|anthropic|claude|gemini|cohere|mistral|llm|gpt)\b/i, subType: "ai_provider" },
|
|
63
|
+
{ re: /\b(stripe|paypal|braintree|adyen|checkout\.com)\b/i, subType: "payment_processor" },
|
|
64
|
+
{ re: /\b(aws|amazon web services|gcp|google cloud|azure|microsoft azure)\b/i, subType: "cloud_provider" },
|
|
65
|
+
{ re: /\b(auth0|okta|supabase|firebase|twilio|sendgrid|segment|sentry)\b/i, subType: "saas_service" },
|
|
66
|
+
{ re: /\b(google analytics|mixpanel|amplitude|heap)\b/i, subType: "analytics_provider" },
|
|
67
|
+
];
|
|
68
|
+
function normalizeToken(value) {
|
|
69
|
+
return value
|
|
70
|
+
.trim()
|
|
71
|
+
.toLowerCase()
|
|
72
|
+
.replace(/[\/\s]+/g, "_")
|
|
73
|
+
.replace(/-+/g, "_");
|
|
74
|
+
}
|
|
75
|
+
function normalizeThirdPartySubType(raw) {
|
|
76
|
+
if (!raw || !raw.trim())
|
|
77
|
+
return undefined;
|
|
78
|
+
const normalized = normalizeToken(raw);
|
|
79
|
+
if (exports.THIRD_PARTY_SUBTYPE_TAXONOMY.includes(normalized)) {
|
|
80
|
+
return normalized;
|
|
81
|
+
}
|
|
82
|
+
return SUBTYPE_ALIASES[normalized];
|
|
83
|
+
}
|
|
84
|
+
function collectMatchCandidates(component) {
|
|
85
|
+
const props = component.properties ?? {};
|
|
86
|
+
const out = [];
|
|
87
|
+
const push = (v) => {
|
|
88
|
+
if (typeof v === "string" && v.trim())
|
|
89
|
+
out.push(v.toLowerCase());
|
|
90
|
+
};
|
|
91
|
+
push(component.name);
|
|
92
|
+
push(props.client);
|
|
93
|
+
push(props.serviceName);
|
|
94
|
+
push(props.service_name);
|
|
95
|
+
push(props.vendor);
|
|
96
|
+
push(props.api_endpoint);
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
function inferFromClassifierCatalog(candidates) {
|
|
100
|
+
const { thirdParties } = (0, config_1.loadClassifierConfig)();
|
|
101
|
+
let bestLen = 0;
|
|
102
|
+
let bestSubType;
|
|
103
|
+
for (const tp of thirdParties) {
|
|
104
|
+
for (const mk of tp.matchKeys) {
|
|
105
|
+
const k = mk.toLowerCase().trim();
|
|
106
|
+
if (k.length < 3 || k.startsWith("@"))
|
|
107
|
+
continue;
|
|
108
|
+
for (const c of candidates) {
|
|
109
|
+
if (!c.includes(k))
|
|
110
|
+
continue;
|
|
111
|
+
if (k.length > bestLen) {
|
|
112
|
+
const normalized = normalizeThirdPartySubType(tp.subType);
|
|
113
|
+
if (!normalized)
|
|
114
|
+
continue;
|
|
115
|
+
bestLen = k.length;
|
|
116
|
+
bestSubType = normalized;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return bestSubType;
|
|
122
|
+
}
|
|
123
|
+
function inferFromNameHeuristics(candidates) {
|
|
124
|
+
const blob = candidates.join(" ");
|
|
125
|
+
for (const { re, subType } of NAME_HEURISTICS) {
|
|
126
|
+
if (re.test(blob))
|
|
127
|
+
return subType;
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Infer a third-party subtype from vendor/client/name signals when the classifier
|
|
133
|
+
* did not match a catalog entry.
|
|
134
|
+
*/
|
|
135
|
+
function inferThirdPartySubType(component) {
|
|
136
|
+
const existing = normalizeThirdPartySubType(component.subType);
|
|
137
|
+
if (existing)
|
|
138
|
+
return existing;
|
|
139
|
+
const candidates = collectMatchCandidates(component);
|
|
140
|
+
const fromCatalog = inferFromClassifierCatalog(candidates);
|
|
141
|
+
const normalizedCatalog = normalizeThirdPartySubType(fromCatalog);
|
|
142
|
+
if (normalizedCatalog)
|
|
143
|
+
return normalizedCatalog;
|
|
144
|
+
const fromHeuristic = inferFromNameHeuristics(candidates);
|
|
145
|
+
if (fromHeuristic)
|
|
146
|
+
return fromHeuristic;
|
|
147
|
+
return "saas_service";
|
|
148
|
+
}
|
|
149
|
+
/** Fill missing subType on all third_party components (post-classify / post-AI). */
|
|
150
|
+
function ensureThirdPartySubTypes(components) {
|
|
151
|
+
let filled = 0;
|
|
152
|
+
for (const component of components) {
|
|
153
|
+
if (component.type !== "third_party")
|
|
154
|
+
continue;
|
|
155
|
+
if (component.subType?.trim()) {
|
|
156
|
+
const normalized = normalizeThirdPartySubType(component.subType);
|
|
157
|
+
if (normalized && normalized !== component.subType) {
|
|
158
|
+
component.subType = normalized;
|
|
159
|
+
}
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
component.subType = inferThirdPartySubType(component);
|
|
163
|
+
filled += 1;
|
|
164
|
+
}
|
|
165
|
+
return filled;
|
|
166
|
+
}
|