kirograph 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -8
- package/dist/architecture/layers/dart.d.ts +10 -0
- package/dist/architecture/layers/dart.d.ts.map +1 -0
- package/dist/architecture/layers/elixir.d.ts +6 -0
- package/dist/architecture/layers/elixir.d.ts.map +1 -0
- package/dist/architecture/layers/index.d.ts.map +1 -1
- package/dist/architecture/layers/ocaml.d.ts +6 -0
- package/dist/architecture/layers/ocaml.d.ts.map +1 -0
- package/dist/architecture/layers/scala.d.ts +6 -0
- package/dist/architecture/layers/scala.d.ts.map +1 -0
- package/dist/architecture/layers/solidity.d.ts +6 -0
- package/dist/architecture/layers/solidity.d.ts.map +1 -0
- package/dist/architecture/layers/vue.d.ts +6 -0
- package/dist/architecture/layers/vue.d.ts.map +1 -0
- package/dist/architecture/manifest/elm.d.ts +3 -0
- package/dist/architecture/manifest/elm.d.ts.map +1 -0
- package/dist/architecture/manifest/index.d.ts.map +1 -1
- package/dist/architecture/manifest/ocaml.d.ts +3 -0
- package/dist/architecture/manifest/ocaml.d.ts.map +1 -0
- package/dist/architecture/manifest/scala.d.ts +3 -0
- package/dist/architecture/manifest/scala.d.ts.map +1 -0
- package/dist/bin/banner.d.ts.map +1 -1
- package/dist/bin/commands/affected.d.ts.map +1 -1
- package/dist/bin/commands/attack-surface.d.ts +3 -0
- package/dist/bin/commands/attack-surface.d.ts.map +1 -0
- package/dist/bin/commands/attack-surface.js +7 -0
- package/dist/bin/commands/attack-surface.js.map +2 -2
- package/dist/bin/commands/benchmark.d.ts +9 -0
- package/dist/bin/commands/benchmark.d.ts.map +1 -0
- package/dist/bin/commands/budget.d.ts +6 -0
- package/dist/bin/commands/budget.d.ts.map +1 -0
- package/dist/bin/commands/caveman.d.ts +7 -0
- package/dist/bin/commands/caveman.d.ts.map +1 -0
- package/dist/bin/commands/communities.d.ts +3 -0
- package/dist/bin/commands/communities.d.ts.map +1 -0
- package/dist/bin/commands/compression.d.ts +7 -0
- package/dist/bin/commands/compression.d.ts.map +1 -0
- package/dist/bin/commands/context.d.ts.map +1 -1
- package/dist/bin/commands/data.d.ts +3 -0
- package/dist/bin/commands/data.d.ts.map +1 -0
- package/dist/bin/commands/dead-code.d.ts +3 -0
- package/dist/bin/commands/dead-code.d.ts.map +1 -0
- package/dist/bin/commands/dep-confusion.d.ts +3 -0
- package/dist/bin/commands/dep-confusion.d.ts.map +1 -0
- package/dist/bin/commands/docs.d.ts +3 -0
- package/dist/bin/commands/docs.d.ts.map +1 -0
- package/dist/bin/commands/exec.d.ts +11 -0
- package/dist/bin/commands/exec.d.ts.map +1 -0
- package/dist/bin/commands/export.d.ts +3 -0
- package/dist/bin/commands/export.d.ts.map +1 -0
- package/dist/bin/commands/flows.d.ts +3 -0
- package/dist/bin/commands/flows.d.ts.map +1 -0
- package/dist/bin/commands/gain.d.ts +6 -0
- package/dist/bin/commands/gain.d.ts.map +1 -0
- package/dist/bin/commands/help.d.ts +7 -0
- package/dist/bin/commands/help.d.ts.map +1 -1
- package/dist/bin/commands/help.js +20 -3
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/hotspots.d.ts +3 -0
- package/dist/bin/commands/hotspots.d.ts.map +1 -0
- package/dist/bin/commands/hotspots.js +94 -1
- package/dist/bin/commands/hotspots.js.map +3 -3
- package/dist/bin/commands/install.d.ts.map +1 -1
- package/dist/bin/commands/install.js +3 -3
- package/dist/bin/commands/install.js.map +2 -2
- package/dist/bin/commands/licenses.d.ts +3 -0
- package/dist/bin/commands/licenses.d.ts.map +1 -0
- package/dist/bin/commands/memory.d.ts +16 -0
- package/dist/bin/commands/memory.d.ts.map +1 -0
- package/dist/bin/commands/memory.js +151 -4
- package/dist/bin/commands/memory.js.map +2 -2
- package/dist/bin/commands/path.d.ts +3 -0
- package/dist/bin/commands/path.d.ts.map +1 -0
- package/dist/bin/commands/pattern.d.ts +3 -0
- package/dist/bin/commands/pattern.d.ts.map +1 -0
- package/dist/bin/commands/pattern.js +592 -0
- package/dist/bin/commands/pattern.js.map +7 -0
- package/dist/bin/commands/query.d.ts.map +1 -1
- package/dist/bin/commands/reachability.d.ts +3 -0
- package/dist/bin/commands/reachability.d.ts.map +1 -0
- package/dist/bin/commands/read.d.ts +6 -0
- package/dist/bin/commands/read.d.ts.map +1 -0
- package/dist/bin/commands/refactor.d.ts +3 -0
- package/dist/bin/commands/refactor.d.ts.map +1 -0
- package/dist/bin/commands/remediation.d.ts +3 -0
- package/dist/bin/commands/remediation.d.ts.map +1 -0
- package/dist/bin/commands/sbom.d.ts +3 -0
- package/dist/bin/commands/sbom.d.ts.map +1 -0
- package/dist/bin/commands/security-ci-report.d.ts +9 -0
- package/dist/bin/commands/security-ci-report.d.ts.map +1 -0
- package/dist/bin/commands/security-export.d.ts +2 -0
- package/dist/bin/commands/security-export.d.ts.map +1 -0
- package/dist/bin/commands/security-flows.d.ts +3 -0
- package/dist/bin/commands/security-flows.d.ts.map +1 -0
- package/dist/bin/commands/security-secrets.d.ts +3 -0
- package/dist/bin/commands/security-secrets.d.ts.map +1 -0
- package/dist/bin/commands/security.d.ts +3 -0
- package/dist/bin/commands/security.d.ts.map +1 -0
- package/dist/bin/commands/security.js +15 -0
- package/dist/bin/commands/security.js.map +2 -2
- package/dist/bin/commands/snapshot.d.ts +3 -0
- package/dist/bin/commands/snapshot.d.ts.map +1 -0
- package/dist/bin/commands/staleness.d.ts +3 -0
- package/dist/bin/commands/staleness.d.ts.map +1 -0
- package/dist/bin/commands/status.d.ts.map +1 -1
- package/dist/bin/commands/status.js +27 -0
- package/dist/bin/commands/status.js.map +2 -2
- package/dist/bin/commands/supply-chain.d.ts +3 -0
- package/dist/bin/commands/supply-chain.d.ts.map +1 -0
- package/dist/bin/commands/surprising.d.ts +3 -0
- package/dist/bin/commands/surprising.d.ts.map +1 -0
- package/dist/bin/commands/sync.d.ts.map +1 -1
- package/dist/bin/commands/uninit.d.ts.map +1 -1
- package/dist/bin/commands/utils.d.ts +5 -0
- package/dist/bin/commands/utils.d.ts.map +1 -1
- package/dist/bin/commands/vex.d.ts +3 -0
- package/dist/bin/commands/vex.d.ts.map +1 -0
- package/dist/bin/commands/vuln-suppress.d.ts +3 -0
- package/dist/bin/commands/vuln-suppress.d.ts.map +1 -0
- package/dist/bin/commands/vulns.d.ts +3 -0
- package/dist/bin/commands/vulns.d.ts.map +1 -0
- package/dist/bin/installer/archive.d.ts +47 -0
- package/dist/bin/installer/archive.d.ts.map +1 -0
- package/dist/bin/installer/auto-detect.d.ts +16 -0
- package/dist/bin/installer/auto-detect.d.ts.map +1 -0
- package/dist/bin/installer/caveman.d.ts +12 -0
- package/dist/bin/installer/caveman.d.ts.map +1 -0
- package/dist/bin/installer/cli-agent.d.ts +7 -2
- package/dist/bin/installer/cli-agent.d.ts.map +1 -1
- package/dist/bin/installer/cli-agent.js +6 -2
- package/dist/bin/installer/cli-agent.js.map +2 -2
- package/dist/bin/installer/common.d.ts +36 -0
- package/dist/bin/installer/common.d.ts.map +1 -0
- package/dist/bin/installer/common.js +2 -1
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/config-prompt.d.ts +1 -1
- package/dist/bin/installer/config-prompt.d.ts.map +1 -1
- package/dist/bin/installer/config-prompt.js +74 -2
- package/dist/bin/installer/config-prompt.js.map +2 -2
- package/dist/bin/installer/dashboard.d.ts.map +1 -1
- package/dist/bin/installer/detect.d.ts +30 -0
- package/dist/bin/installer/detect.d.ts.map +1 -0
- package/dist/bin/installer/hooks.d.ts +4 -1
- package/dist/bin/installer/hooks.d.ts.map +1 -1
- package/dist/bin/installer/hooks.js +34 -0
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/installer/index.d.ts +5 -4
- package/dist/bin/installer/index.d.ts.map +1 -1
- package/dist/bin/installer/index.js +38 -8
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/instructions.d.ts +14 -0
- package/dist/bin/installer/instructions.d.ts.map +1 -0
- package/dist/bin/installer/instructions.js +15 -1
- package/dist/bin/installer/instructions.js.map +2 -2
- package/dist/bin/installer/mcp.d.ts.map +1 -1
- package/dist/bin/installer/prompts.d.ts +17 -0
- package/dist/bin/installer/prompts.d.ts.map +1 -1
- package/dist/bin/installer/qdrant-dashboard.d.ts.map +1 -1
- package/dist/bin/installer/steering.d.ts +14 -2
- package/dist/bin/installer/steering.d.ts.map +1 -1
- package/dist/bin/installer/steering.js +81 -0
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/aider.d.ts +6 -0
- package/dist/bin/installer/targets/aider.d.ts.map +1 -0
- package/dist/bin/installer/targets/aider.js +3 -3
- package/dist/bin/installer/targets/aider.js.map +2 -2
- package/dist/bin/installer/targets/amp.d.ts +6 -0
- package/dist/bin/installer/targets/amp.d.ts.map +1 -0
- package/dist/bin/installer/targets/amp.js +3 -3
- package/dist/bin/installer/targets/amp.js.map +2 -2
- package/dist/bin/installer/targets/antigravity.d.ts +13 -0
- package/dist/bin/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/bin/installer/targets/antigravity.js +2 -2
- package/dist/bin/installer/targets/antigravity.js.map +2 -2
- package/dist/bin/installer/targets/augment.d.ts +6 -0
- package/dist/bin/installer/targets/augment.d.ts.map +1 -0
- package/dist/bin/installer/targets/augment.js +3 -3
- package/dist/bin/installer/targets/augment.js.map +2 -2
- package/dist/bin/installer/targets/claude.d.ts +6 -0
- package/dist/bin/installer/targets/claude.d.ts.map +1 -0
- package/dist/bin/installer/targets/claude.js +2 -2
- package/dist/bin/installer/targets/claude.js.map +2 -2
- package/dist/bin/installer/targets/cline.d.ts +13 -0
- package/dist/bin/installer/targets/cline.d.ts.map +1 -0
- package/dist/bin/installer/targets/cline.js +2 -2
- package/dist/bin/installer/targets/cline.js.map +2 -2
- package/dist/bin/installer/targets/codex.d.ts +6 -0
- package/dist/bin/installer/targets/codex.d.ts.map +1 -0
- package/dist/bin/installer/targets/codex.js +2 -2
- package/dist/bin/installer/targets/codex.js.map +2 -2
- package/dist/bin/installer/targets/continue.d.ts +12 -0
- package/dist/bin/installer/targets/continue.d.ts.map +1 -0
- package/dist/bin/installer/targets/continue.js +2 -2
- package/dist/bin/installer/targets/continue.js.map +2 -2
- package/dist/bin/installer/targets/copilot-cli.d.ts +12 -0
- package/dist/bin/installer/targets/copilot-cli.d.ts.map +1 -0
- package/dist/bin/installer/targets/copilot-cli.js +2 -2
- package/dist/bin/installer/targets/copilot-cli.js.map +2 -2
- package/dist/bin/installer/targets/copilot.d.ts +6 -0
- package/dist/bin/installer/targets/copilot.d.ts.map +1 -0
- package/dist/bin/installer/targets/copilot.js +2 -2
- package/dist/bin/installer/targets/copilot.js.map +2 -2
- package/dist/bin/installer/targets/cursor.d.ts +6 -0
- package/dist/bin/installer/targets/cursor.d.ts.map +1 -0
- package/dist/bin/installer/targets/cursor.js +2 -2
- package/dist/bin/installer/targets/cursor.js.map +2 -2
- package/dist/bin/installer/targets/devin.d.ts +13 -0
- package/dist/bin/installer/targets/devin.d.ts.map +1 -0
- package/dist/bin/installer/targets/devin.js +2 -2
- package/dist/bin/installer/targets/devin.js.map +2 -2
- package/dist/bin/installer/targets/gemini-cli.d.ts +16 -0
- package/dist/bin/installer/targets/gemini-cli.d.ts.map +1 -0
- package/dist/bin/installer/targets/gemini-cli.js +2 -2
- package/dist/bin/installer/targets/gemini-cli.js.map +2 -2
- package/dist/bin/installer/targets/generic.d.ts +59 -0
- package/dist/bin/installer/targets/generic.d.ts.map +1 -0
- package/dist/bin/installer/targets/generic.js +2 -2
- package/dist/bin/installer/targets/generic.js.map +2 -2
- package/dist/bin/installer/targets/goose.d.ts +6 -0
- package/dist/bin/installer/targets/goose.d.ts.map +1 -0
- package/dist/bin/installer/targets/goose.js +3 -3
- package/dist/bin/installer/targets/goose.js.map +2 -2
- package/dist/bin/installer/targets/index.d.ts +11 -0
- package/dist/bin/installer/targets/index.d.ts.map +1 -0
- package/dist/bin/installer/targets/index.js.map +1 -1
- package/dist/bin/installer/targets/junie.d.ts +13 -0
- package/dist/bin/installer/targets/junie.d.ts.map +1 -0
- package/dist/bin/installer/targets/junie.js +2 -2
- package/dist/bin/installer/targets/junie.js.map +2 -2
- package/dist/bin/installer/targets/kilo.d.ts +12 -0
- package/dist/bin/installer/targets/kilo.d.ts.map +1 -0
- package/dist/bin/installer/targets/kilo.js +2 -2
- package/dist/bin/installer/targets/kilo.js.map +2 -2
- package/dist/bin/installer/targets/kiro.d.ts +5 -0
- package/dist/bin/installer/targets/kiro.d.ts.map +1 -0
- package/dist/bin/installer/targets/kiro.js +4 -4
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- package/dist/bin/installer/targets/opencode.d.ts +13 -0
- package/dist/bin/installer/targets/opencode.d.ts.map +1 -0
- package/dist/bin/installer/targets/opencode.js +2 -2
- package/dist/bin/installer/targets/opencode.js.map +2 -2
- package/dist/bin/installer/targets/openhands.d.ts +6 -0
- package/dist/bin/installer/targets/openhands.d.ts.map +1 -0
- package/dist/bin/installer/targets/openhands.js +3 -3
- package/dist/bin/installer/targets/openhands.js.map +2 -2
- package/dist/bin/installer/targets/qoder.d.ts +12 -0
- package/dist/bin/installer/targets/qoder.d.ts.map +1 -0
- package/dist/bin/installer/targets/qoder.js +2 -2
- package/dist/bin/installer/targets/qoder.js.map +2 -2
- package/dist/bin/installer/targets/qwen.d.ts +12 -0
- package/dist/bin/installer/targets/qwen.d.ts.map +1 -0
- package/dist/bin/installer/targets/qwen.js +2 -2
- package/dist/bin/installer/targets/qwen.js.map +2 -2
- package/dist/bin/installer/targets/replit.d.ts +6 -0
- package/dist/bin/installer/targets/replit.d.ts.map +1 -0
- package/dist/bin/installer/targets/replit.js +3 -3
- package/dist/bin/installer/targets/replit.js.map +2 -2
- package/dist/bin/installer/targets/roo.d.ts +13 -0
- package/dist/bin/installer/targets/roo.d.ts.map +1 -0
- package/dist/bin/installer/targets/roo.js +2 -2
- package/dist/bin/installer/targets/roo.js.map +2 -2
- package/dist/bin/installer/targets/tabnine.d.ts +6 -0
- package/dist/bin/installer/targets/tabnine.d.ts.map +1 -0
- package/dist/bin/installer/targets/tabnine.js +3 -3
- package/dist/bin/installer/targets/tabnine.js.map +2 -2
- package/dist/bin/installer/targets/trae.d.ts +6 -0
- package/dist/bin/installer/targets/trae.d.ts.map +1 -0
- package/dist/bin/installer/targets/trae.js +3 -3
- package/dist/bin/installer/targets/trae.js.map +2 -2
- package/dist/bin/installer/targets/warp.d.ts +12 -0
- package/dist/bin/installer/targets/warp.d.ts.map +1 -0
- package/dist/bin/installer/targets/warp.js +2 -2
- package/dist/bin/installer/targets/warp.js.map +2 -2
- package/dist/bin/installer/targets/windsurf.d.ts +13 -0
- package/dist/bin/installer/targets/windsurf.d.ts.map +1 -0
- package/dist/bin/installer/targets/windsurf.js +2 -2
- package/dist/bin/installer/targets/windsurf.js.map +2 -2
- package/dist/bin/kirograph.js +3 -1
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/bin/progress.d.ts +16 -1
- package/dist/bin/progress.d.ts.map +1 -1
- package/dist/compression/filters/aws.d.ts +9 -0
- package/dist/compression/filters/aws.d.ts.map +1 -0
- package/dist/compression/filters/docker.d.ts +6 -0
- package/dist/compression/filters/docker.d.ts.map +1 -0
- package/dist/compression/filters/files.d.ts +6 -0
- package/dist/compression/filters/files.d.ts.map +1 -0
- package/dist/compression/filters/generic.d.ts +7 -0
- package/dist/compression/filters/generic.d.ts.map +1 -0
- package/dist/compression/filters/git.d.ts +6 -0
- package/dist/compression/filters/git.d.ts.map +1 -0
- package/dist/compression/filters/github.d.ts +6 -0
- package/dist/compression/filters/github.d.ts.map +1 -0
- package/dist/compression/filters/lint.d.ts +6 -0
- package/dist/compression/filters/lint.d.ts.map +1 -0
- package/dist/compression/filters/misc.d.ts +6 -0
- package/dist/compression/filters/misc.d.ts.map +1 -0
- package/dist/compression/filters/package.d.ts +6 -0
- package/dist/compression/filters/package.d.ts.map +1 -0
- package/dist/compression/filters/test.d.ts +6 -0
- package/dist/compression/filters/test.d.ts.map +1 -0
- package/dist/compression/index.d.ts +29 -0
- package/dist/compression/index.d.ts.map +1 -0
- package/dist/compression/naive-cost.d.ts +26 -0
- package/dist/compression/naive-cost.d.ts.map +1 -0
- package/dist/compression/tracker.d.ts +155 -0
- package/dist/compression/tracker.d.ts.map +1 -0
- package/dist/compression/types.d.ts +49 -0
- package/dist/compression/types.d.ts.map +1 -0
- package/dist/config.d.ts +90 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +55 -1
- package/dist/config.js.map +2 -2
- package/dist/core/lock-manager.d.ts +2 -0
- package/dist/core/lock-manager.d.ts.map +1 -1
- package/dist/core/pipeline.d.ts +4 -1
- package/dist/core/pipeline.d.ts.map +1 -1
- package/dist/core/pipeline.js +42 -0
- package/dist/core/pipeline.js.map +2 -2
- package/dist/core/snapshot.d.ts +58 -0
- package/dist/core/snapshot.d.ts.map +1 -0
- package/dist/data/filters.d.ts +23 -0
- package/dist/data/filters.d.ts.map +1 -0
- package/dist/data/indexer.d.ts +25 -0
- package/dist/data/indexer.d.ts.map +1 -0
- package/dist/data/linker.d.ts +37 -0
- package/dist/data/linker.d.ts.map +1 -0
- package/dist/data/lint.d.ts +27 -0
- package/dist/data/lint.d.ts.map +1 -0
- package/dist/data/parsers/csv.d.ts +11 -0
- package/dist/data/parsers/csv.d.ts.map +1 -0
- package/dist/data/parsers/excel.d.ts +10 -0
- package/dist/data/parsers/excel.d.ts.map +1 -0
- package/dist/data/parsers/index.d.ts +28 -0
- package/dist/data/parsers/index.d.ts.map +1 -0
- package/dist/data/parsers/json-array.d.ts +9 -0
- package/dist/data/parsers/json-array.d.ts.map +1 -0
- package/dist/data/parsers/jsonl.d.ts +9 -0
- package/dist/data/parsers/jsonl.d.ts.map +1 -0
- package/dist/data/parsers/parquet.d.ts +10 -0
- package/dist/data/parsers/parquet.d.ts.map +1 -0
- package/dist/data/profiler.d.ts +29 -0
- package/dist/data/profiler.d.ts.map +1 -0
- package/dist/data/queries.d.ts +95 -0
- package/dist/data/queries.d.ts.map +1 -0
- package/dist/data/types.d.ts +103 -0
- package/dist/data/types.d.ts.map +1 -0
- package/dist/db/database.d.ts +57 -0
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/database.js +19 -0
- package/dist/db/database.js.map +2 -2
- package/dist/db/patterns-schema.sql +23 -0
- package/dist/docs/formats/asciidoc.d.ts +9 -0
- package/dist/docs/formats/asciidoc.d.ts.map +1 -0
- package/dist/docs/formats/html.d.ts +10 -0
- package/dist/docs/formats/html.d.ts.map +1 -0
- package/dist/docs/formats/index.d.ts +31 -0
- package/dist/docs/formats/index.d.ts.map +1 -0
- package/dist/docs/formats/markdown.d.ts +11 -0
- package/dist/docs/formats/markdown.d.ts.map +1 -0
- package/dist/docs/formats/openapi.d.ts +17 -0
- package/dist/docs/formats/openapi.d.ts.map +1 -0
- package/dist/docs/formats/org.d.ts +9 -0
- package/dist/docs/formats/org.d.ts.map +1 -0
- package/dist/docs/formats/plaintext.d.ts +11 -0
- package/dist/docs/formats/plaintext.d.ts.map +1 -0
- package/dist/docs/formats/rdoc.d.ts +10 -0
- package/dist/docs/formats/rdoc.d.ts.map +1 -0
- package/dist/docs/formats/rst.d.ts +11 -0
- package/dist/docs/formats/rst.d.ts.map +1 -0
- package/dist/docs/indexer.d.ts +49 -0
- package/dist/docs/indexer.d.ts.map +1 -0
- package/dist/docs/linker.d.ts +30 -0
- package/dist/docs/linker.d.ts.map +1 -0
- package/dist/docs/lint.d.ts +27 -0
- package/dist/docs/lint.d.ts.map +1 -0
- package/dist/docs/queries.d.ts +78 -0
- package/dist/docs/queries.d.ts.map +1 -0
- package/dist/docs/section-id.d.ts +48 -0
- package/dist/docs/section-id.d.ts.map +1 -0
- package/dist/docs/summarizer.d.ts +13 -0
- package/dist/docs/summarizer.d.ts.map +1 -0
- package/dist/docs/types.d.ts +71 -0
- package/dist/docs/types.d.ts.map +1 -0
- package/dist/docs/vectors.d.ts +54 -0
- package/dist/docs/vectors.d.ts.map +1 -0
- package/dist/extraction/extractor.d.ts +1 -1
- package/dist/extraction/extractor.d.ts.map +1 -1
- package/dist/extraction/grammars.d.ts +6 -0
- package/dist/extraction/grammars.d.ts.map +1 -1
- package/dist/extraction/languages.d.ts.map +1 -1
- package/dist/extraction/notebook.d.ts +14 -0
- package/dist/extraction/notebook.d.ts.map +1 -0
- package/dist/frameworks/amplify.d.ts +9 -0
- package/dist/frameworks/amplify.d.ts.map +1 -0
- package/dist/frameworks/angular.d.ts +9 -0
- package/dist/frameworks/angular.d.ts.map +1 -0
- package/dist/frameworks/ansible.d.ts +8 -0
- package/dist/frameworks/ansible.d.ts.map +1 -0
- package/dist/frameworks/cloudformation.d.ts +9 -0
- package/dist/frameworks/cloudformation.d.ts.map +1 -0
- package/dist/frameworks/docker.d.ts +9 -0
- package/dist/frameworks/docker.d.ts.map +1 -0
- package/dist/frameworks/elixir.d.ts +6 -0
- package/dist/frameworks/elixir.d.ts.map +1 -0
- package/dist/frameworks/flutter.d.ts +12 -0
- package/dist/frameworks/flutter.d.ts.map +1 -0
- package/dist/frameworks/iac.d.ts +10 -0
- package/dist/frameworks/iac.d.ts.map +1 -0
- package/dist/frameworks/index.d.ts +14 -0
- package/dist/frameworks/index.d.ts.map +1 -1
- package/dist/frameworks/kubernetes.d.ts +9 -0
- package/dist/frameworks/kubernetes.d.ts.map +1 -0
- package/dist/frameworks/pulumi.d.ts +9 -0
- package/dist/frameworks/pulumi.d.ts.map +1 -0
- package/dist/frameworks/scala.d.ts +6 -0
- package/dist/frameworks/scala.d.ts.map +1 -0
- package/dist/frameworks/solidity.d.ts +6 -0
- package/dist/frameworks/solidity.d.ts.map +1 -0
- package/dist/frameworks/terraform.d.ts +14 -0
- package/dist/frameworks/terraform.d.ts.map +1 -0
- package/dist/frameworks/vue.d.ts +7 -0
- package/dist/frameworks/vue.d.ts.map +1 -0
- package/dist/graph/communities.d.ts +43 -0
- package/dist/graph/communities.d.ts.map +1 -0
- package/dist/graph/flows.d.ts +55 -0
- package/dist/graph/flows.d.ts.map +1 -0
- package/dist/graph/refactor.d.ts +43 -0
- package/dist/graph/refactor.d.ts.map +1 -0
- package/dist/index.d.ts +36 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/mcp/cache.d.ts +69 -0
- package/dist/mcp/cache.d.ts.map +1 -0
- package/dist/mcp/read-modes.d.ts +31 -0
- package/dist/mcp/read-modes.d.ts.map +1 -0
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +15 -2
- package/dist/mcp/server.js.map +2 -2
- package/dist/mcp/tool-names.d.ts +2 -0
- package/dist/mcp/tool-names.d.ts.map +1 -0
- package/dist/mcp/tool-names.js +4 -1
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.d.ts +12 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +397 -0
- package/dist/mcp/tools.js.map +2 -2
- package/dist/memory/compress.d.ts +19 -0
- package/dist/memory/compress.d.ts.map +1 -0
- package/dist/memory/database.d.ts +92 -0
- package/dist/memory/database.d.ts.map +1 -0
- package/dist/memory/database.js +38 -0
- package/dist/memory/database.js.map +2 -2
- package/dist/memory/index.d.ts +71 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +12 -2
- package/dist/memory/index.js.map +2 -2
- package/dist/memory/symbols.d.ts +21 -0
- package/dist/memory/symbols.d.ts.map +1 -0
- package/dist/memory/types.d.ts +78 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js.map +1 -1
- package/dist/memory/vectors.d.ts +43 -0
- package/dist/memory/vectors.d.ts.map +1 -0
- package/dist/patterns/graph.d.ts +16 -0
- package/dist/patterns/graph.d.ts.map +1 -0
- package/dist/patterns/graph.js +45 -0
- package/dist/patterns/graph.js.map +7 -0
- package/dist/patterns/index.d.ts +4 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +39 -0
- package/dist/patterns/index.js.map +7 -0
- package/dist/patterns/indexer.d.ts +15 -0
- package/dist/patterns/indexer.d.ts.map +1 -0
- package/dist/patterns/indexer.js +97 -0
- package/dist/patterns/indexer.js.map +7 -0
- package/dist/patterns/library/command-injection-go.yaml +11 -0
- package/dist/patterns/library/dangerous-eval-js.yaml +14 -0
- package/dist/patterns/library/dangerous-exec-py.yaml +13 -0
- package/dist/patterns/library/dangerous-reflection-java.yaml +8 -0
- package/dist/patterns/library/path-traversal-go.yaml +11 -0
- package/dist/patterns/library/path-traversal-py.yaml +12 -0
- package/dist/patterns/library/path-traversal-readfile-js.yaml +14 -0
- package/dist/patterns/library/prototype-pollution-js.yaml +12 -0
- package/dist/patterns/library/sql-injection-concat-js.yaml +12 -0
- package/dist/patterns/library/sql-injection-java.yaml +13 -0
- package/dist/patterns/library/sql-injection-py.yaml +12 -0
- package/dist/patterns/library/sql-injection-template-js.yaml +13 -0
- package/dist/patterns/library/weak-crypto-md5-js.yaml +13 -0
- package/dist/patterns/library/weak-crypto-py.yaml +13 -0
- package/dist/patterns/loader.d.ts +18 -0
- package/dist/patterns/loader.d.ts.map +1 -0
- package/dist/patterns/loader.js +277 -0
- package/dist/patterns/loader.js.map +7 -0
- package/dist/patterns/runner.d.ts +42 -0
- package/dist/patterns/runner.d.ts.map +1 -0
- package/dist/patterns/runner.js +277 -0
- package/dist/patterns/runner.js.map +7 -0
- package/dist/patterns/types.d.ts +27 -0
- package/dist/patterns/types.d.ts.map +1 -0
- package/dist/patterns/types.js +34 -0
- package/dist/patterns/types.js.map +7 -0
- package/dist/resolution/bridges/android-rn.d.ts +13 -0
- package/dist/resolution/bridges/android-rn.d.ts.map +1 -0
- package/dist/resolution/bridges/expo-modules.d.ts +10 -0
- package/dist/resolution/bridges/expo-modules.d.ts.map +1 -0
- package/dist/resolution/bridges/flutter-channel.d.ts +14 -0
- package/dist/resolution/bridges/flutter-channel.d.ts.map +1 -0
- package/dist/resolution/bridges/index.d.ts +40 -0
- package/dist/resolution/bridges/index.d.ts.map +1 -0
- package/dist/resolution/bridges/native-events.d.ts +10 -0
- package/dist/resolution/bridges/native-events.d.ts.map +1 -0
- package/dist/resolution/bridges/native-views.d.ts +13 -0
- package/dist/resolution/bridges/native-views.d.ts.map +1 -0
- package/dist/resolution/bridges/react-native.d.ts +9 -0
- package/dist/resolution/bridges/react-native.d.ts.map +1 -0
- package/dist/resolution/bridges/swift-objc.d.ts +14 -0
- package/dist/resolution/bridges/swift-objc.d.ts.map +1 -0
- package/dist/resolution/bridges/turbomodules.d.ts +10 -0
- package/dist/resolution/bridges/turbomodules.d.ts.map +1 -0
- package/dist/resolution/index.d.ts +28 -3
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/security/attack-surface.d.ts +46 -0
- package/dist/security/attack-surface.d.ts.map +1 -0
- package/dist/security/attack-surface.js +43 -1
- package/dist/security/attack-surface.js.map +2 -2
- package/dist/security/context-warnings.d.ts +40 -0
- package/dist/security/context-warnings.d.ts.map +1 -0
- package/dist/security/data-flows.d.ts +33 -0
- package/dist/security/data-flows.d.ts.map +1 -0
- package/dist/security/data-flows.js +65 -7
- package/dist/security/data-flows.js.map +2 -2
- package/dist/security/dep-confusion.d.ts +23 -0
- package/dist/security/dep-confusion.d.ts.map +1 -0
- package/dist/security/errors.d.ts +16 -0
- package/dist/security/errors.d.ts.map +1 -0
- package/dist/security/export/fix-suggestions.d.ts +21 -0
- package/dist/security/export/fix-suggestions.d.ts.map +1 -0
- package/dist/security/export/sbom.d.ts +33 -0
- package/dist/security/export/sbom.d.ts.map +1 -0
- package/dist/security/export/serialization.d.ts +62 -0
- package/dist/security/export/serialization.d.ts.map +1 -0
- package/dist/security/export/vex.d.ts +58 -0
- package/dist/security/export/vex.d.ts.map +1 -0
- package/dist/security/index.d.ts +21 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/integrator.d.ts +63 -0
- package/dist/security/integrator.d.ts.map +1 -0
- package/dist/security/license.d.ts +33 -0
- package/dist/security/license.d.ts.map +1 -0
- package/dist/security/manifest/adapter.d.ts +92 -0
- package/dist/security/manifest/adapter.d.ts.map +1 -0
- package/dist/security/manifest/parser.d.ts +73 -0
- package/dist/security/manifest/parser.d.ts.map +1 -0
- package/dist/security/manifest/plugins/cargo.d.ts +11 -0
- package/dist/security/manifest/plugins/cargo.d.ts.map +1 -0
- package/dist/security/manifest/plugins/composer.d.ts +11 -0
- package/dist/security/manifest/plugins/composer.d.ts.map +1 -0
- package/dist/security/manifest/plugins/go.d.ts +12 -0
- package/dist/security/manifest/plugins/go.d.ts.map +1 -0
- package/dist/security/manifest/plugins/gradle.d.ts +12 -0
- package/dist/security/manifest/plugins/gradle.d.ts.map +1 -0
- package/dist/security/manifest/plugins/hex.d.ts +11 -0
- package/dist/security/manifest/plugins/hex.d.ts.map +1 -0
- package/dist/security/manifest/plugins/maven.d.ts +11 -0
- package/dist/security/manifest/plugins/maven.d.ts.map +1 -0
- package/dist/security/manifest/plugins/npm.d.ts +11 -0
- package/dist/security/manifest/plugins/npm.d.ts.map +1 -0
- package/dist/security/manifest/plugins/nuget.d.ts +12 -0
- package/dist/security/manifest/plugins/nuget.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pip.d.ts +11 -0
- package/dist/security/manifest/plugins/pip.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pubspec.d.ts +11 -0
- package/dist/security/manifest/plugins/pubspec.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pyproject.d.ts +3 -0
- package/dist/security/manifest/plugins/pyproject.d.ts.map +1 -0
- package/dist/security/manifest/plugins/rubygems.d.ts +11 -0
- package/dist/security/manifest/plugins/rubygems.d.ts.map +1 -0
- package/dist/security/manifest/plugins/swift.d.ts +11 -0
- package/dist/security/manifest/plugins/swift.d.ts.map +1 -0
- package/dist/security/owasp.d.ts +16 -0
- package/dist/security/owasp.d.ts.map +1 -0
- package/dist/security/pipeline.d.ts +37 -0
- package/dist/security/pipeline.d.ts.map +1 -0
- package/dist/security/reachability.d.ts +67 -0
- package/dist/security/reachability.d.ts.map +1 -0
- package/dist/security/remediation.d.ts +51 -0
- package/dist/security/remediation.d.ts.map +1 -0
- package/dist/security/secrets.d.ts +38 -0
- package/dist/security/secrets.d.ts.map +1 -0
- package/dist/security/staleness.d.ts +43 -0
- package/dist/security/staleness.d.ts.map +1 -0
- package/dist/security/supply-chain.d.ts +34 -0
- package/dist/security/supply-chain.d.ts.map +1 -0
- package/dist/security/suppressions.d.ts +18 -0
- package/dist/security/suppressions.d.ts.map +1 -0
- package/dist/security/types.d.ts +144 -0
- package/dist/security/types.d.ts.map +1 -0
- package/dist/security/vuln/client.d.ts +90 -0
- package/dist/security/vuln/client.d.ts.map +1 -0
- package/dist/security/vuln/client.js.map +2 -2
- package/dist/security/vuln/epss-client.d.ts +26 -0
- package/dist/security/vuln/epss-client.d.ts.map +1 -0
- package/dist/security/vuln/index.d.ts +6 -0
- package/dist/security/vuln/index.d.ts.map +1 -0
- package/dist/security/vuln/osv-adapter.d.ts +58 -0
- package/dist/security/vuln/osv-adapter.d.ts.map +1 -0
- package/dist/security/vuln/types.d.ts +29 -0
- package/dist/security/vuln/types.d.ts.map +1 -0
- package/dist/sync/index.d.ts +4 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/types.d.ts +10 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vectors/index.d.ts +11 -3
- package/dist/vectors/index.d.ts.map +1 -1
- package/dist/vectors/qdrant-index.d.ts +10 -3
- package/dist/vectors/qdrant-index.d.ts.map +1 -1
- package/dist/vectors/typesense-index.d.ts.map +1 -1
- package/dist/watchmen/index.js +83 -0
- package/dist/watchmen/index.js.map +7 -0
- package/dist/watchmen/synthesize.js +475 -0
- package/dist/watchmen/synthesize.js.map +7 -0
- package/package.json +5 -2
- package/dist/security/context-warnings.test.js +0 -300
- package/dist/security/context-warnings.test.js.map +0 -7
- package/dist/security/export/fix-suggestions.test.js +0 -74
- package/dist/security/export/fix-suggestions.test.js.map +0 -7
- package/dist/security/export/sbom.test.js +0 -288
- package/dist/security/export/sbom.test.js.map +0 -7
- package/dist/security/export/serialization.test.js +0 -310
- package/dist/security/export/serialization.test.js.map +0 -7
- package/dist/security/export/vex.test.js +0 -278
- package/dist/security/export/vex.test.js.map +0 -7
- package/dist/security/integrator-transitives.test.js +0 -359
- package/dist/security/integrator-transitives.test.js.map +0 -7
- package/dist/security/integrator.test.js +0 -237
- package/dist/security/integrator.test.js.map +0 -7
- package/dist/security/manifest/adapter.test.js +0 -272
- package/dist/security/manifest/adapter.test.js.map +0 -7
- package/dist/security/manifest/parser.test.js +0 -110
- package/dist/security/manifest/parser.test.js.map +0 -7
- package/dist/security/manifest/plugins/cargo.test.js +0 -304
- package/dist/security/manifest/plugins/cargo.test.js.map +0 -7
- package/dist/security/manifest/plugins/go.test.js +0 -341
- package/dist/security/manifest/plugins/go.test.js.map +0 -7
- package/dist/security/manifest/plugins/maven.test.js +0 -389
- package/dist/security/manifest/plugins/maven.test.js.map +0 -7
- package/dist/security/manifest/plugins/npm.test.js +0 -298
- package/dist/security/manifest/plugins/npm.test.js.map +0 -7
- package/dist/security/manifest/plugins/pip.test.js +0 -208
- package/dist/security/manifest/plugins/pip.test.js.map +0 -7
- package/dist/security/reachability.test.js +0 -394
- package/dist/security/reachability.test.js.map +0 -7
- package/dist/security/vuln/client.test.js +0 -288
- package/dist/security/vuln/client.test.js.map +0 -7
- package/dist/security/vuln/osv-adapter.test.js +0 -391
- package/dist/security/vuln/osv-adapter.test.js.map +0 -7
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var import_vitest = require("vitest");
|
|
25
|
-
var import_sbom = require("./sbom");
|
|
26
|
-
var import_database = require("../../db/database");
|
|
27
|
-
var fs = __toESM(require("fs"));
|
|
28
|
-
var path = __toESM(require("path"));
|
|
29
|
-
var os = __toESM(require("os"));
|
|
30
|
-
function createTempProject() {
|
|
31
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "sbom-test-"));
|
|
32
|
-
fs.writeFileSync(
|
|
33
|
-
path.join(dir, "package.json"),
|
|
34
|
-
JSON.stringify({ name: "test-project", version: "1.0.0" })
|
|
35
|
-
);
|
|
36
|
-
return dir;
|
|
37
|
-
}
|
|
38
|
-
function setupDb(projectRoot) {
|
|
39
|
-
const db = new import_database.GraphDatabase(projectRoot);
|
|
40
|
-
db.applySecuritySchema();
|
|
41
|
-
return db;
|
|
42
|
-
}
|
|
43
|
-
function insertDependency(db, opts) {
|
|
44
|
-
const rawDb = db.getRawDb();
|
|
45
|
-
db.upsertNode({
|
|
46
|
-
id: opts.nodeId,
|
|
47
|
-
kind: "dependency",
|
|
48
|
-
name: opts.packageName,
|
|
49
|
-
qualifiedName: `${opts.ecosystem}/${opts.packageName}`,
|
|
50
|
-
filePath: opts.sourceManifests?.[0] ?? "package.json",
|
|
51
|
-
language: "unknown",
|
|
52
|
-
startLine: 0,
|
|
53
|
-
endLine: 0,
|
|
54
|
-
startColumn: 0,
|
|
55
|
-
endColumn: 0,
|
|
56
|
-
updatedAt: Date.now()
|
|
57
|
-
});
|
|
58
|
-
rawDb.run(
|
|
59
|
-
`INSERT OR REPLACE INTO sec_dependencies
|
|
60
|
-
(node_id, ecosystem, package_name, declared_constraint, resolved_version, scope, source_manifests)
|
|
61
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
|
62
|
-
[
|
|
63
|
-
opts.nodeId,
|
|
64
|
-
opts.ecosystem,
|
|
65
|
-
opts.packageName,
|
|
66
|
-
opts.declaredConstraint,
|
|
67
|
-
opts.resolvedVersion ?? null,
|
|
68
|
-
opts.scope ?? "production",
|
|
69
|
-
JSON.stringify(opts.sourceManifests ?? ["package.json"])
|
|
70
|
-
]
|
|
71
|
-
);
|
|
72
|
-
if (opts.isDirect !== false) {
|
|
73
|
-
db.insertEdge({
|
|
74
|
-
source: opts.nodeId,
|
|
75
|
-
target: opts.sourceManifests?.[0] ?? "package.json",
|
|
76
|
-
kind: "declared_in"
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function insertDependsOnEdge(db, source, target) {
|
|
81
|
-
db.insertEdge({ source, target, kind: "depends_on" });
|
|
82
|
-
}
|
|
83
|
-
(0, import_vitest.describe)("SBOMExporter", () => {
|
|
84
|
-
let projectRoot;
|
|
85
|
-
let db;
|
|
86
|
-
(0, import_vitest.beforeEach)(() => {
|
|
87
|
-
projectRoot = createTempProject();
|
|
88
|
-
db = setupDb(projectRoot);
|
|
89
|
-
});
|
|
90
|
-
(0, import_vitest.afterEach)(() => {
|
|
91
|
-
db.close();
|
|
92
|
-
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
93
|
-
});
|
|
94
|
-
(0, import_vitest.describe)("empty dependency graph", () => {
|
|
95
|
-
(0, import_vitest.it)("generates a valid CycloneDX 1.5 document with empty components", () => {
|
|
96
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
97
|
-
const sbom = exporter.export();
|
|
98
|
-
(0, import_vitest.expect)(sbom.bomFormat).toBe("CycloneDX");
|
|
99
|
-
(0, import_vitest.expect)(sbom.specVersion).toBe("1.5");
|
|
100
|
-
(0, import_vitest.expect)(sbom.version).toBe(1);
|
|
101
|
-
(0, import_vitest.expect)(sbom.components).toEqual([]);
|
|
102
|
-
(0, import_vitest.expect)(sbom.dependencies).toEqual([]);
|
|
103
|
-
(0, import_vitest.expect)(sbom.metadata).toBeDefined();
|
|
104
|
-
});
|
|
105
|
-
(0, import_vitest.it)("includes metadata with tool name, timestamp, and project name", () => {
|
|
106
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
107
|
-
const sbom = exporter.export();
|
|
108
|
-
const meta = sbom.metadata;
|
|
109
|
-
(0, import_vitest.expect)(meta.timestamp).toMatch(/^\d{4}-\d{2}-\d{2}T/);
|
|
110
|
-
(0, import_vitest.expect)(meta.tools.components[0].name).toBe("kirograph-sec");
|
|
111
|
-
(0, import_vitest.expect)(meta.tools.components[0].version).toBeDefined();
|
|
112
|
-
(0, import_vitest.expect)(meta.component.name).toBe("test-project");
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
(0, import_vitest.describe)("with dependencies", () => {
|
|
116
|
-
(0, import_vitest.beforeEach)(() => {
|
|
117
|
-
insertDependency(db, {
|
|
118
|
-
nodeId: "dep:npm:express",
|
|
119
|
-
ecosystem: "npm",
|
|
120
|
-
packageName: "express",
|
|
121
|
-
declaredConstraint: "^4.18.0",
|
|
122
|
-
resolvedVersion: "4.18.2",
|
|
123
|
-
scope: "production",
|
|
124
|
-
isDirect: true
|
|
125
|
-
});
|
|
126
|
-
insertDependency(db, {
|
|
127
|
-
nodeId: "dep:npm:lodash",
|
|
128
|
-
ecosystem: "npm",
|
|
129
|
-
packageName: "lodash",
|
|
130
|
-
declaredConstraint: "^4.17.0",
|
|
131
|
-
resolvedVersion: "4.17.21",
|
|
132
|
-
scope: "production",
|
|
133
|
-
isDirect: false
|
|
134
|
-
// transitive — no declared_in edge
|
|
135
|
-
});
|
|
136
|
-
insertDependsOnEdge(db, "dep:npm:express", "dep:npm:lodash");
|
|
137
|
-
});
|
|
138
|
-
(0, import_vitest.it)("includes all dependencies as components of type library", () => {
|
|
139
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
140
|
-
const sbom = exporter.export();
|
|
141
|
-
(0, import_vitest.expect)(sbom.components).toHaveLength(2);
|
|
142
|
-
(0, import_vitest.expect)(sbom.components.every((c) => c.type === "library")).toBe(true);
|
|
143
|
-
});
|
|
144
|
-
(0, import_vitest.it)("includes correct purl for each component", () => {
|
|
145
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
146
|
-
const sbom = exporter.export();
|
|
147
|
-
const express = sbom.components.find((c) => c.name === "express");
|
|
148
|
-
(0, import_vitest.expect)(express?.purl).toBe("pkg:npm/express@4.18.2");
|
|
149
|
-
const lodash = sbom.components.find((c) => c.name === "lodash");
|
|
150
|
-
(0, import_vitest.expect)(lodash?.purl).toBe("pkg:npm/lodash@4.17.21");
|
|
151
|
-
});
|
|
152
|
-
(0, import_vitest.it)('sets scope to "required" for direct and "optional" for transitive', () => {
|
|
153
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
154
|
-
const sbom = exporter.export();
|
|
155
|
-
const express = sbom.components.find((c) => c.name === "express");
|
|
156
|
-
(0, import_vitest.expect)(express?.scope).toBe("required");
|
|
157
|
-
const lodash = sbom.components.find((c) => c.name === "lodash");
|
|
158
|
-
(0, import_vitest.expect)(lodash?.scope).toBe("optional");
|
|
159
|
-
});
|
|
160
|
-
(0, import_vitest.it)("includes direct/transitive classification in properties", () => {
|
|
161
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
162
|
-
const sbom = exporter.export();
|
|
163
|
-
const express = sbom.components.find((c) => c.name === "express");
|
|
164
|
-
const expressClassification = express?.properties?.find(
|
|
165
|
-
(p) => p.name === "kirograph:classification"
|
|
166
|
-
);
|
|
167
|
-
(0, import_vitest.expect)(expressClassification?.value).toBe("direct");
|
|
168
|
-
const lodash = sbom.components.find((c) => c.name === "lodash");
|
|
169
|
-
const lodashClassification = lodash?.properties?.find(
|
|
170
|
-
(p) => p.name === "kirograph:classification"
|
|
171
|
-
);
|
|
172
|
-
(0, import_vitest.expect)(lodashClassification?.value).toBe("transitive");
|
|
173
|
-
});
|
|
174
|
-
(0, import_vitest.it)("includes dependency relationships reflecting depends_on edges", () => {
|
|
175
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
176
|
-
const sbom = exporter.export();
|
|
177
|
-
const expressDep = sbom.dependencies.find(
|
|
178
|
-
(d) => d.ref === "pkg:npm/express@4.18.2"
|
|
179
|
-
);
|
|
180
|
-
(0, import_vitest.expect)(expressDep).toBeDefined();
|
|
181
|
-
(0, import_vitest.expect)(expressDep?.dependsOn).toContain("pkg:npm/lodash@4.17.21");
|
|
182
|
-
const lodashDep = sbom.dependencies.find(
|
|
183
|
-
(d) => d.ref === "pkg:npm/lodash@4.17.21"
|
|
184
|
-
);
|
|
185
|
-
(0, import_vitest.expect)(lodashDep).toBeDefined();
|
|
186
|
-
(0, import_vitest.expect)(lodashDep?.dependsOn).toBeUndefined();
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
(0, import_vitest.describe)("version fallback", () => {
|
|
190
|
-
(0, import_vitest.it)("uses declared constraint when resolved version is not available", () => {
|
|
191
|
-
insertDependency(db, {
|
|
192
|
-
nodeId: "dep:npm:some-pkg",
|
|
193
|
-
ecosystem: "npm",
|
|
194
|
-
packageName: "some-pkg",
|
|
195
|
-
declaredConstraint: ">=2.0.0",
|
|
196
|
-
resolvedVersion: void 0,
|
|
197
|
-
isDirect: true
|
|
198
|
-
});
|
|
199
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
200
|
-
const sbom = exporter.export();
|
|
201
|
-
const comp = sbom.components.find((c) => c.name === "some-pkg");
|
|
202
|
-
(0, import_vitest.expect)(comp?.version).toBe(">=2.0.0");
|
|
203
|
-
(0, import_vitest.expect)(comp?.purl).toBe("pkg:npm/some-pkg@>=2.0.0");
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
(0, import_vitest.describe)("ecosystem purl mapping", () => {
|
|
207
|
-
(0, import_vitest.it)("maps go ecosystem to golang in purl", () => {
|
|
208
|
-
insertDependency(db, {
|
|
209
|
-
nodeId: "dep:go:github.com/gin-gonic/gin",
|
|
210
|
-
ecosystem: "go",
|
|
211
|
-
packageName: "github.com/gin-gonic/gin",
|
|
212
|
-
declaredConstraint: "v1.9.1",
|
|
213
|
-
resolvedVersion: "v1.9.1",
|
|
214
|
-
isDirect: true
|
|
215
|
-
});
|
|
216
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
217
|
-
const sbom = exporter.export();
|
|
218
|
-
const comp = sbom.components.find((c) => c.name === "github.com/gin-gonic/gin");
|
|
219
|
-
(0, import_vitest.expect)(comp?.purl).toBe("pkg:golang/github.com/gin-gonic/gin@v1.9.1");
|
|
220
|
-
});
|
|
221
|
-
(0, import_vitest.it)("maps python ecosystem to pypi in purl", () => {
|
|
222
|
-
insertDependency(db, {
|
|
223
|
-
nodeId: "dep:python:django",
|
|
224
|
-
ecosystem: "python",
|
|
225
|
-
packageName: "django",
|
|
226
|
-
declaredConstraint: "==4.2.0",
|
|
227
|
-
resolvedVersion: "4.2.0",
|
|
228
|
-
isDirect: true
|
|
229
|
-
});
|
|
230
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
231
|
-
const sbom = exporter.export();
|
|
232
|
-
const comp = sbom.components.find((c) => c.name === "django");
|
|
233
|
-
(0, import_vitest.expect)(comp?.purl).toBe("pkg:pypi/django@4.2.0");
|
|
234
|
-
});
|
|
235
|
-
(0, import_vitest.it)("maps cargo ecosystem correctly in purl", () => {
|
|
236
|
-
insertDependency(db, {
|
|
237
|
-
nodeId: "dep:cargo:serde",
|
|
238
|
-
ecosystem: "cargo",
|
|
239
|
-
packageName: "serde",
|
|
240
|
-
declaredConstraint: "1.0.188",
|
|
241
|
-
resolvedVersion: "1.0.188",
|
|
242
|
-
isDirect: true
|
|
243
|
-
});
|
|
244
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
245
|
-
const sbom = exporter.export();
|
|
246
|
-
const comp = sbom.components.find((c) => c.name === "serde");
|
|
247
|
-
(0, import_vitest.expect)(comp?.purl).toBe("pkg:cargo/serde@1.0.188");
|
|
248
|
-
});
|
|
249
|
-
(0, import_vitest.it)("maps maven ecosystem correctly in purl", () => {
|
|
250
|
-
insertDependency(db, {
|
|
251
|
-
nodeId: "dep:maven:org.apache.logging.log4j/log4j-core",
|
|
252
|
-
ecosystem: "maven",
|
|
253
|
-
packageName: "org.apache.logging.log4j/log4j-core",
|
|
254
|
-
declaredConstraint: "2.17.0",
|
|
255
|
-
resolvedVersion: "2.17.0",
|
|
256
|
-
isDirect: true
|
|
257
|
-
});
|
|
258
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
259
|
-
const sbom = exporter.export();
|
|
260
|
-
const comp = sbom.components.find(
|
|
261
|
-
(c) => c.name === "org.apache.logging.log4j/log4j-core"
|
|
262
|
-
);
|
|
263
|
-
(0, import_vitest.expect)(comp?.purl).toBe(
|
|
264
|
-
"pkg:maven/org.apache.logging.log4j/log4j-core@2.17.0"
|
|
265
|
-
);
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
(0, import_vitest.describe)("exportJSON", () => {
|
|
269
|
-
(0, import_vitest.it)("returns a pretty-printed JSON string", () => {
|
|
270
|
-
insertDependency(db, {
|
|
271
|
-
nodeId: "dep:npm:express",
|
|
272
|
-
ecosystem: "npm",
|
|
273
|
-
packageName: "express",
|
|
274
|
-
declaredConstraint: "^4.18.0",
|
|
275
|
-
resolvedVersion: "4.18.2",
|
|
276
|
-
isDirect: true
|
|
277
|
-
});
|
|
278
|
-
const exporter = new import_sbom.SBOMExporter(db, projectRoot);
|
|
279
|
-
const json = exporter.exportJSON();
|
|
280
|
-
const parsed = JSON.parse(json);
|
|
281
|
-
(0, import_vitest.expect)(parsed.bomFormat).toBe("CycloneDX");
|
|
282
|
-
(0, import_vitest.expect)(parsed.specVersion).toBe("1.5");
|
|
283
|
-
(0, import_vitest.expect)(json).toContain("\n");
|
|
284
|
-
(0, import_vitest.expect)(json).toContain(" ");
|
|
285
|
-
});
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
//# sourceMappingURL=sbom.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/security/export/sbom.test.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Unit tests for SBOMExporter \u2014 CycloneDX 1.5 SBOM generation\n */\nimport { describe, it, expect, beforeEach, afterEach } from 'vitest';\nimport { SBOMExporter } from './sbom';\nimport { GraphDatabase } from '../../db/database';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\n\n// \u2500\u2500 Test Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction createTempProject(): string {\n const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'sbom-test-'));\n // Create a package.json so the project name can be detected\n fs.writeFileSync(\n path.join(dir, 'package.json'),\n JSON.stringify({ name: 'test-project', version: '1.0.0' }),\n );\n return dir;\n}\n\nfunction setupDb(projectRoot: string): GraphDatabase {\n const db = new GraphDatabase(projectRoot);\n db.applySecuritySchema();\n return db;\n}\n\nfunction insertDependency(\n db: GraphDatabase,\n opts: {\n nodeId: string;\n ecosystem: string;\n packageName: string;\n declaredConstraint: string;\n resolvedVersion?: string;\n scope?: string;\n sourceManifests?: string[];\n isDirect?: boolean;\n },\n): void {\n const rawDb = db.getRawDb();\n\n // Insert into nodes table\n db.upsertNode({\n id: opts.nodeId,\n kind: 'dependency',\n name: opts.packageName,\n qualifiedName: `${opts.ecosystem}/${opts.packageName}`,\n filePath: opts.sourceManifests?.[0] ?? 'package.json',\n language: 'unknown',\n startLine: 0,\n endLine: 0,\n startColumn: 0,\n endColumn: 0,\n updatedAt: Date.now(),\n });\n\n // Insert into sec_dependencies\n rawDb.run(\n `INSERT OR REPLACE INTO sec_dependencies\n (node_id, ecosystem, package_name, declared_constraint, resolved_version, scope, source_manifests)\n VALUES (?, ?, ?, ?, ?, ?, ?)`,\n [\n opts.nodeId,\n opts.ecosystem,\n opts.packageName,\n opts.declaredConstraint,\n opts.resolvedVersion ?? null,\n opts.scope ?? 'production',\n JSON.stringify(opts.sourceManifests ?? ['package.json']),\n ],\n );\n\n // Create declared_in edge if direct\n if (opts.isDirect !== false) {\n db.insertEdge({\n source: opts.nodeId,\n target: opts.sourceManifests?.[0] ?? 'package.json',\n kind: 'declared_in',\n });\n }\n}\n\nfunction insertDependsOnEdge(db: GraphDatabase, source: string, target: string): void {\n db.insertEdge({ source, target, kind: 'depends_on' });\n}\n\n// \u2500\u2500 Tests \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ndescribe('SBOMExporter', () => {\n let projectRoot: string;\n let db: GraphDatabase;\n\n beforeEach(() => {\n projectRoot = createTempProject();\n db = setupDb(projectRoot);\n });\n\n afterEach(() => {\n db.close();\n fs.rmSync(projectRoot, { recursive: true, force: true });\n });\n\n describe('empty dependency graph', () => {\n it('generates a valid CycloneDX 1.5 document with empty components', () => {\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n expect(sbom.bomFormat).toBe('CycloneDX');\n expect(sbom.specVersion).toBe('1.5');\n expect(sbom.version).toBe(1);\n expect(sbom.components).toEqual([]);\n expect(sbom.dependencies).toEqual([]);\n expect(sbom.metadata).toBeDefined();\n });\n\n it('includes metadata with tool name, timestamp, and project name', () => {\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n const meta = sbom.metadata as any;\n expect(meta.timestamp).toMatch(/^\\d{4}-\\d{2}-\\d{2}T/);\n expect(meta.tools.components[0].name).toBe('kirograph-sec');\n expect(meta.tools.components[0].version).toBeDefined();\n expect(meta.component.name).toBe('test-project');\n });\n });\n\n describe('with dependencies', () => {\n beforeEach(() => {\n insertDependency(db, {\n nodeId: 'dep:npm:express',\n ecosystem: 'npm',\n packageName: 'express',\n declaredConstraint: '^4.18.0',\n resolvedVersion: '4.18.2',\n scope: 'production',\n isDirect: true,\n });\n\n insertDependency(db, {\n nodeId: 'dep:npm:lodash',\n ecosystem: 'npm',\n packageName: 'lodash',\n declaredConstraint: '^4.17.0',\n resolvedVersion: '4.17.21',\n scope: 'production',\n isDirect: false, // transitive \u2014 no declared_in edge\n });\n\n // express depends on lodash (transitive)\n insertDependsOnEdge(db, 'dep:npm:express', 'dep:npm:lodash');\n });\n\n it('includes all dependencies as components of type library', () => {\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n expect(sbom.components).toHaveLength(2);\n expect(sbom.components.every((c) => c.type === 'library')).toBe(true);\n });\n\n it('includes correct purl for each component', () => {\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n const express = sbom.components.find((c) => c.name === 'express');\n expect(express?.purl).toBe('pkg:npm/express@4.18.2');\n\n const lodash = sbom.components.find((c) => c.name === 'lodash');\n expect(lodash?.purl).toBe('pkg:npm/lodash@4.17.21');\n });\n\n it('sets scope to \"required\" for direct and \"optional\" for transitive', () => {\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n const express = sbom.components.find((c) => c.name === 'express');\n expect(express?.scope).toBe('required');\n\n const lodash = sbom.components.find((c) => c.name === 'lodash');\n expect(lodash?.scope).toBe('optional');\n });\n\n it('includes direct/transitive classification in properties', () => {\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n const express = sbom.components.find((c) => c.name === 'express');\n const expressClassification = express?.properties?.find(\n (p) => p.name === 'kirograph:classification',\n );\n expect(expressClassification?.value).toBe('direct');\n\n const lodash = sbom.components.find((c) => c.name === 'lodash');\n const lodashClassification = lodash?.properties?.find(\n (p) => p.name === 'kirograph:classification',\n );\n expect(lodashClassification?.value).toBe('transitive');\n });\n\n it('includes dependency relationships reflecting depends_on edges', () => {\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n const expressDep = sbom.dependencies.find(\n (d) => d.ref === 'pkg:npm/express@4.18.2',\n );\n expect(expressDep).toBeDefined();\n expect(expressDep?.dependsOn).toContain('pkg:npm/lodash@4.17.21');\n\n // lodash has no depends_on\n const lodashDep = sbom.dependencies.find(\n (d) => d.ref === 'pkg:npm/lodash@4.17.21',\n );\n expect(lodashDep).toBeDefined();\n expect(lodashDep?.dependsOn).toBeUndefined();\n });\n });\n\n describe('version fallback', () => {\n it('uses declared constraint when resolved version is not available', () => {\n insertDependency(db, {\n nodeId: 'dep:npm:some-pkg',\n ecosystem: 'npm',\n packageName: 'some-pkg',\n declaredConstraint: '>=2.0.0',\n resolvedVersion: undefined,\n isDirect: true,\n });\n\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n const comp = sbom.components.find((c) => c.name === 'some-pkg');\n expect(comp?.version).toBe('>=2.0.0');\n expect(comp?.purl).toBe('pkg:npm/some-pkg@>=2.0.0');\n });\n });\n\n describe('ecosystem purl mapping', () => {\n it('maps go ecosystem to golang in purl', () => {\n insertDependency(db, {\n nodeId: 'dep:go:github.com/gin-gonic/gin',\n ecosystem: 'go',\n packageName: 'github.com/gin-gonic/gin',\n declaredConstraint: 'v1.9.1',\n resolvedVersion: 'v1.9.1',\n isDirect: true,\n });\n\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n const comp = sbom.components.find((c) => c.name === 'github.com/gin-gonic/gin');\n expect(comp?.purl).toBe('pkg:golang/github.com/gin-gonic/gin@v1.9.1');\n });\n\n it('maps python ecosystem to pypi in purl', () => {\n insertDependency(db, {\n nodeId: 'dep:python:django',\n ecosystem: 'python',\n packageName: 'django',\n declaredConstraint: '==4.2.0',\n resolvedVersion: '4.2.0',\n isDirect: true,\n });\n\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n const comp = sbom.components.find((c) => c.name === 'django');\n expect(comp?.purl).toBe('pkg:pypi/django@4.2.0');\n });\n\n it('maps cargo ecosystem correctly in purl', () => {\n insertDependency(db, {\n nodeId: 'dep:cargo:serde',\n ecosystem: 'cargo',\n packageName: 'serde',\n declaredConstraint: '1.0.188',\n resolvedVersion: '1.0.188',\n isDirect: true,\n });\n\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n const comp = sbom.components.find((c) => c.name === 'serde');\n expect(comp?.purl).toBe('pkg:cargo/serde@1.0.188');\n });\n\n it('maps maven ecosystem correctly in purl', () => {\n insertDependency(db, {\n nodeId: 'dep:maven:org.apache.logging.log4j/log4j-core',\n ecosystem: 'maven',\n packageName: 'org.apache.logging.log4j/log4j-core',\n declaredConstraint: '2.17.0',\n resolvedVersion: '2.17.0',\n isDirect: true,\n });\n\n const exporter = new SBOMExporter(db, projectRoot);\n const sbom = exporter.export();\n\n const comp = sbom.components.find(\n (c) => c.name === 'org.apache.logging.log4j/log4j-core',\n );\n expect(comp?.purl).toBe(\n 'pkg:maven/org.apache.logging.log4j/log4j-core@2.17.0',\n );\n });\n });\n\n describe('exportJSON', () => {\n it('returns a pretty-printed JSON string', () => {\n insertDependency(db, {\n nodeId: 'dep:npm:express',\n ecosystem: 'npm',\n packageName: 'express',\n declaredConstraint: '^4.18.0',\n resolvedVersion: '4.18.2',\n isDirect: true,\n });\n\n const exporter = new SBOMExporter(db, projectRoot);\n const json = exporter.exportJSON();\n\n // Should be valid JSON\n const parsed = JSON.parse(json);\n expect(parsed.bomFormat).toBe('CycloneDX');\n expect(parsed.specVersion).toBe('1.5');\n\n // Should be pretty-printed (contains newlines and indentation)\n expect(json).toContain('\\n');\n expect(json).toContain(' ');\n });\n });\n});\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAGA,oBAA4D;AAC5D,kBAA6B;AAC7B,sBAA8B;AAC9B,SAAoB;AACpB,WAAsB;AACtB,SAAoB;AAIpB,SAAS,oBAA4B;AACnC,QAAM,MAAM,GAAG,YAAY,KAAK,KAAK,GAAG,OAAO,GAAG,YAAY,CAAC;AAE/D,KAAG;AAAA,IACD,KAAK,KAAK,KAAK,cAAc;AAAA,IAC7B,KAAK,UAAU,EAAE,MAAM,gBAAgB,SAAS,QAAQ,CAAC;AAAA,EAC3D;AACA,SAAO;AACT;AAEA,SAAS,QAAQ,aAAoC;AACnD,QAAM,KAAK,IAAI,8BAAc,WAAW;AACxC,KAAG,oBAAoB;AACvB,SAAO;AACT;AAEA,SAAS,iBACP,IACA,MAUM;AACN,QAAM,QAAQ,GAAG,SAAS;AAG1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EAAE,SAAS;AAAA,MACpB;AACA,gCAAO,MAAM,IAAI,EAAE;AAAA,QACjB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,8BAAS,cAAc,MAAM;AAC3B,0BAAG,wCAAwC,MAAM;AAC/C,uBAAiB,IAAI;AAAA,QACnB,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,aAAa;AAAA,QACb,oBAAoB;AAAA,QACpB,iBAAiB;AAAA,QACjB,UAAU;AAAA,MACZ,CAAC;AAED,YAAM,WAAW,IAAI,yBAAa,IAAI,WAAW;AACjD,YAAM,OAAO,SAAS,WAAW;AAGjC,YAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,gCAAO,OAAO,SAAS,EAAE,KAAK,WAAW;AACzC,gCAAO,OAAO,WAAW,EAAE,KAAK,KAAK;AAGrC,gCAAO,IAAI,EAAE,UAAU,IAAI;AAC3B,gCAAO,IAAI,EAAE,UAAU,IAAI;AAAA,IAC7B,CAAC;AAAA,EACH,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var import_vitest = require("vitest");
|
|
3
|
-
var import_serialization = require("./serialization");
|
|
4
|
-
function makeDependencyRow(overrides) {
|
|
5
|
-
return {
|
|
6
|
-
node_id: "dep:npm:express",
|
|
7
|
-
ecosystem: "npm",
|
|
8
|
-
package_name: "express",
|
|
9
|
-
declared_constraint: "^4.18.0",
|
|
10
|
-
resolved_version: "4.18.2",
|
|
11
|
-
scope: "production",
|
|
12
|
-
transitive_status: "complete",
|
|
13
|
-
last_vuln_check: null,
|
|
14
|
-
vuln_data_stale: 0,
|
|
15
|
-
vuln_data_stale_since: null,
|
|
16
|
-
source_manifests: '["package.json"]',
|
|
17
|
-
...overrides
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
(0, import_vitest.describe)("serializeDependencyToComponent", () => {
|
|
21
|
-
(0, import_vitest.it)("should serialize an npm dependency to a CycloneDX component", () => {
|
|
22
|
-
const dep = makeDependencyRow();
|
|
23
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(dep);
|
|
24
|
-
(0, import_vitest.expect)(component.type).toBe("library");
|
|
25
|
-
(0, import_vitest.expect)(component.name).toBe("express");
|
|
26
|
-
(0, import_vitest.expect)(component.version).toBe("4.18.2");
|
|
27
|
-
(0, import_vitest.expect)(component.purl).toBe("pkg:npm/express@4.18.2");
|
|
28
|
-
(0, import_vitest.expect)(component.scope).toBe("required");
|
|
29
|
-
(0, import_vitest.expect)(component.properties).toEqual([
|
|
30
|
-
{ name: "kirograph:declaredConstraint", value: "^4.18.0" }
|
|
31
|
-
]);
|
|
32
|
-
});
|
|
33
|
-
(0, import_vitest.it)("should use declared_constraint as version when resolved_version is null", () => {
|
|
34
|
-
const dep = makeDependencyRow({ resolved_version: null });
|
|
35
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(dep);
|
|
36
|
-
(0, import_vitest.expect)(component.version).toBe("^4.18.0");
|
|
37
|
-
(0, import_vitest.expect)(component.purl).toBe("pkg:npm/express@^4.18.0");
|
|
38
|
-
});
|
|
39
|
-
(0, import_vitest.it)("should map production scope to required", () => {
|
|
40
|
-
const dep = makeDependencyRow({ scope: "production" });
|
|
41
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(dep);
|
|
42
|
-
(0, import_vitest.expect)(component.scope).toBe("required");
|
|
43
|
-
});
|
|
44
|
-
(0, import_vitest.it)("should map development scope to optional", () => {
|
|
45
|
-
const dep = makeDependencyRow({ scope: "development" });
|
|
46
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(dep);
|
|
47
|
-
(0, import_vitest.expect)(component.scope).toBe("optional");
|
|
48
|
-
});
|
|
49
|
-
(0, import_vitest.it)("should map optional scope to optional", () => {
|
|
50
|
-
const dep = makeDependencyRow({ scope: "optional" });
|
|
51
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(dep);
|
|
52
|
-
(0, import_vitest.expect)(component.scope).toBe("optional");
|
|
53
|
-
});
|
|
54
|
-
(0, import_vitest.it)("should correctly map maven ecosystem to purl type", () => {
|
|
55
|
-
const dep = makeDependencyRow({
|
|
56
|
-
node_id: "dep:maven:log4j-core",
|
|
57
|
-
ecosystem: "maven",
|
|
58
|
-
package_name: "org.apache.logging.log4j/log4j-core",
|
|
59
|
-
resolved_version: "2.17.0"
|
|
60
|
-
});
|
|
61
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(dep);
|
|
62
|
-
(0, import_vitest.expect)(component.purl).toBe("pkg:maven/org.apache.logging.log4j/log4j-core@2.17.0");
|
|
63
|
-
});
|
|
64
|
-
(0, import_vitest.it)("should correctly map go ecosystem to golang purl type", () => {
|
|
65
|
-
const dep = makeDependencyRow({
|
|
66
|
-
node_id: "dep:go:github.com/gin-gonic/gin",
|
|
67
|
-
ecosystem: "go",
|
|
68
|
-
package_name: "github.com/gin-gonic/gin",
|
|
69
|
-
resolved_version: "1.9.1"
|
|
70
|
-
});
|
|
71
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(dep);
|
|
72
|
-
(0, import_vitest.expect)(component.purl).toBe("pkg:golang/github.com/gin-gonic/gin@1.9.1");
|
|
73
|
-
});
|
|
74
|
-
(0, import_vitest.it)("should correctly map pypi ecosystem", () => {
|
|
75
|
-
const dep = makeDependencyRow({
|
|
76
|
-
node_id: "dep:pypi:django",
|
|
77
|
-
ecosystem: "pypi",
|
|
78
|
-
package_name: "django",
|
|
79
|
-
resolved_version: "4.2.0"
|
|
80
|
-
});
|
|
81
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(dep);
|
|
82
|
-
(0, import_vitest.expect)(component.purl).toBe("pkg:pypi/django@4.2.0");
|
|
83
|
-
});
|
|
84
|
-
(0, import_vitest.it)("should correctly map cargo ecosystem", () => {
|
|
85
|
-
const dep = makeDependencyRow({
|
|
86
|
-
node_id: "dep:cargo:serde",
|
|
87
|
-
ecosystem: "cargo",
|
|
88
|
-
package_name: "serde",
|
|
89
|
-
resolved_version: "1.0.188"
|
|
90
|
-
});
|
|
91
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(dep);
|
|
92
|
-
(0, import_vitest.expect)(component.purl).toBe("pkg:cargo/serde@1.0.188");
|
|
93
|
-
});
|
|
94
|
-
(0, import_vitest.it)("should throw for unsupported ecosystem", () => {
|
|
95
|
-
const dep = makeDependencyRow({ ecosystem: "unknown" });
|
|
96
|
-
(0, import_vitest.expect)(() => (0, import_serialization.serializeDependencyToComponent)(dep)).toThrow("Unsupported ecosystem: unknown");
|
|
97
|
-
});
|
|
98
|
-
(0, import_vitest.it)("should throw when both version and constraint are empty", () => {
|
|
99
|
-
const dep = makeDependencyRow({
|
|
100
|
-
resolved_version: null,
|
|
101
|
-
declared_constraint: ""
|
|
102
|
-
});
|
|
103
|
-
(0, import_vitest.expect)(() => (0, import_serialization.serializeDependencyToComponent)(dep)).toThrow(
|
|
104
|
-
"No version or constraint available"
|
|
105
|
-
);
|
|
106
|
-
});
|
|
107
|
-
(0, import_vitest.it)("should throw when package_name is empty", () => {
|
|
108
|
-
const dep = makeDependencyRow({ package_name: "" });
|
|
109
|
-
(0, import_vitest.expect)(() => (0, import_serialization.serializeDependencyToComponent)(dep)).toThrow(
|
|
110
|
-
"Dependency package_name is required"
|
|
111
|
-
);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
(0, import_vitest.describe)("deserializeComponentToDependency", () => {
|
|
115
|
-
(0, import_vitest.it)("should deserialize a CycloneDX component to a dependency row", () => {
|
|
116
|
-
const component = {
|
|
117
|
-
type: "library",
|
|
118
|
-
name: "express",
|
|
119
|
-
version: "4.18.2",
|
|
120
|
-
purl: "pkg:npm/express@4.18.2",
|
|
121
|
-
scope: "required",
|
|
122
|
-
properties: [{ name: "kirograph:declaredConstraint", value: "^4.18.0" }]
|
|
123
|
-
};
|
|
124
|
-
const dep = (0, import_serialization.deserializeComponentToDependency)(component);
|
|
125
|
-
(0, import_vitest.expect)(dep.ecosystem).toBe("npm");
|
|
126
|
-
(0, import_vitest.expect)(dep.package_name).toBe("express");
|
|
127
|
-
(0, import_vitest.expect)(dep.resolved_version).toBe("4.18.2");
|
|
128
|
-
(0, import_vitest.expect)(dep.declared_constraint).toBe("^4.18.0");
|
|
129
|
-
(0, import_vitest.expect)(dep.scope).toBe("production");
|
|
130
|
-
(0, import_vitest.expect)(dep.node_id).toBe("dep:npm:express");
|
|
131
|
-
});
|
|
132
|
-
(0, import_vitest.it)("should use version as declared_constraint when property is missing", () => {
|
|
133
|
-
const component = {
|
|
134
|
-
type: "library",
|
|
135
|
-
name: "express",
|
|
136
|
-
version: "4.18.2",
|
|
137
|
-
purl: "pkg:npm/express@4.18.2"
|
|
138
|
-
};
|
|
139
|
-
const dep = (0, import_serialization.deserializeComponentToDependency)(component);
|
|
140
|
-
(0, import_vitest.expect)(dep.declared_constraint).toBe("4.18.2");
|
|
141
|
-
});
|
|
142
|
-
(0, import_vitest.it)("should map optional scope back to optional", () => {
|
|
143
|
-
const component = {
|
|
144
|
-
type: "library",
|
|
145
|
-
name: "jest",
|
|
146
|
-
version: "29.0.0",
|
|
147
|
-
purl: "pkg:npm/jest@29.0.0",
|
|
148
|
-
scope: "optional"
|
|
149
|
-
};
|
|
150
|
-
const dep = (0, import_serialization.deserializeComponentToDependency)(component);
|
|
151
|
-
(0, import_vitest.expect)(dep.scope).toBe("optional");
|
|
152
|
-
});
|
|
153
|
-
(0, import_vitest.it)("should map required scope back to production", () => {
|
|
154
|
-
const component = {
|
|
155
|
-
type: "library",
|
|
156
|
-
name: "express",
|
|
157
|
-
version: "4.18.2",
|
|
158
|
-
purl: "pkg:npm/express@4.18.2",
|
|
159
|
-
scope: "required"
|
|
160
|
-
};
|
|
161
|
-
const dep = (0, import_serialization.deserializeComponentToDependency)(component);
|
|
162
|
-
(0, import_vitest.expect)(dep.scope).toBe("production");
|
|
163
|
-
});
|
|
164
|
-
(0, import_vitest.it)("should map golang purl type back to go ecosystem", () => {
|
|
165
|
-
const component = {
|
|
166
|
-
type: "library",
|
|
167
|
-
name: "github.com/gin-gonic/gin",
|
|
168
|
-
version: "1.9.1",
|
|
169
|
-
purl: "pkg:golang/github.com/gin-gonic/gin@1.9.1"
|
|
170
|
-
};
|
|
171
|
-
const dep = (0, import_serialization.deserializeComponentToDependency)(component);
|
|
172
|
-
(0, import_vitest.expect)(dep.ecosystem).toBe("go");
|
|
173
|
-
(0, import_vitest.expect)(dep.package_name).toBe("github.com/gin-gonic/gin");
|
|
174
|
-
});
|
|
175
|
-
(0, import_vitest.it)("should throw for missing purl", () => {
|
|
176
|
-
const component = {
|
|
177
|
-
type: "library",
|
|
178
|
-
name: "express",
|
|
179
|
-
version: "4.18.2",
|
|
180
|
-
purl: ""
|
|
181
|
-
};
|
|
182
|
-
(0, import_vitest.expect)(() => (0, import_serialization.deserializeComponentToDependency)(component)).toThrow("missing purl");
|
|
183
|
-
});
|
|
184
|
-
(0, import_vitest.it)("should throw for invalid purl format", () => {
|
|
185
|
-
const component = {
|
|
186
|
-
type: "library",
|
|
187
|
-
name: "express",
|
|
188
|
-
version: "4.18.2",
|
|
189
|
-
purl: "invalid-purl"
|
|
190
|
-
};
|
|
191
|
-
(0, import_vitest.expect)(() => (0, import_serialization.deserializeComponentToDependency)(component)).toThrow("Invalid purl format");
|
|
192
|
-
});
|
|
193
|
-
(0, import_vitest.it)("should throw for unsupported purl type", () => {
|
|
194
|
-
const component = {
|
|
195
|
-
type: "library",
|
|
196
|
-
name: "something",
|
|
197
|
-
version: "1.0.0",
|
|
198
|
-
purl: "pkg:nuget/something@1.0.0"
|
|
199
|
-
};
|
|
200
|
-
(0, import_vitest.expect)(() => (0, import_serialization.deserializeComponentToDependency)(component)).toThrow("Unsupported purl type");
|
|
201
|
-
});
|
|
202
|
-
(0, import_vitest.it)("should set default values for non-serialized fields", () => {
|
|
203
|
-
const component = {
|
|
204
|
-
type: "library",
|
|
205
|
-
name: "express",
|
|
206
|
-
version: "4.18.2",
|
|
207
|
-
purl: "pkg:npm/express@4.18.2"
|
|
208
|
-
};
|
|
209
|
-
const dep = (0, import_serialization.deserializeComponentToDependency)(component);
|
|
210
|
-
(0, import_vitest.expect)(dep.transitive_status).toBe("complete");
|
|
211
|
-
(0, import_vitest.expect)(dep.last_vuln_check).toBeNull();
|
|
212
|
-
(0, import_vitest.expect)(dep.vuln_data_stale).toBe(0);
|
|
213
|
-
(0, import_vitest.expect)(dep.vuln_data_stale_since).toBeNull();
|
|
214
|
-
(0, import_vitest.expect)(dep.source_manifests).toBe("[]");
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
(0, import_vitest.describe)("serializeDependencyToComponent \u2192 deserializeComponentToDependency round-trip", () => {
|
|
218
|
-
(0, import_vitest.it)("should preserve key fields through round-trip", () => {
|
|
219
|
-
const original = makeDependencyRow();
|
|
220
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(original);
|
|
221
|
-
const restored = (0, import_serialization.deserializeComponentToDependency)(component);
|
|
222
|
-
(0, import_vitest.expect)(restored.package_name).toBe(original.package_name);
|
|
223
|
-
(0, import_vitest.expect)(restored.resolved_version).toBe(original.resolved_version);
|
|
224
|
-
(0, import_vitest.expect)(restored.ecosystem).toBe(original.ecosystem);
|
|
225
|
-
(0, import_vitest.expect)(restored.scope).toBe(original.scope);
|
|
226
|
-
(0, import_vitest.expect)(restored.declared_constraint).toBe(original.declared_constraint);
|
|
227
|
-
});
|
|
228
|
-
(0, import_vitest.it)("should preserve constraint when resolved_version is null", () => {
|
|
229
|
-
const original = makeDependencyRow({ resolved_version: null });
|
|
230
|
-
const component = (0, import_serialization.serializeDependencyToComponent)(original);
|
|
231
|
-
const restored = (0, import_serialization.deserializeComponentToDependency)(component);
|
|
232
|
-
(0, import_vitest.expect)(restored.declared_constraint).toBe(original.declared_constraint);
|
|
233
|
-
(0, import_vitest.expect)(restored.resolved_version).toBe(original.declared_constraint);
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
(0, import_vitest.describe)("serializeAll", () => {
|
|
237
|
-
(0, import_vitest.it)("should serialize all valid dependencies", () => {
|
|
238
|
-
const deps = [
|
|
239
|
-
makeDependencyRow({ package_name: "express", node_id: "dep:npm:express" }),
|
|
240
|
-
makeDependencyRow({ package_name: "lodash", node_id: "dep:npm:lodash" })
|
|
241
|
-
];
|
|
242
|
-
const result = (0, import_serialization.serializeAll)(deps);
|
|
243
|
-
(0, import_vitest.expect)(result.components).toHaveLength(2);
|
|
244
|
-
(0, import_vitest.expect)(result.errors).toHaveLength(0);
|
|
245
|
-
});
|
|
246
|
-
(0, import_vitest.it)("should collect errors for failing nodes and continue with remaining", () => {
|
|
247
|
-
const deps = [
|
|
248
|
-
makeDependencyRow({ package_name: "express" }),
|
|
249
|
-
makeDependencyRow({ package_name: "bad-dep", ecosystem: "unsupported" }),
|
|
250
|
-
makeDependencyRow({ package_name: "lodash" })
|
|
251
|
-
];
|
|
252
|
-
const result = (0, import_serialization.serializeAll)(deps);
|
|
253
|
-
(0, import_vitest.expect)(result.components).toHaveLength(2);
|
|
254
|
-
(0, import_vitest.expect)(result.errors).toHaveLength(1);
|
|
255
|
-
(0, import_vitest.expect)(result.errors[0].name).toBe("bad-dep");
|
|
256
|
-
(0, import_vitest.expect)(result.errors[0].reason).toContain("Unsupported ecosystem");
|
|
257
|
-
});
|
|
258
|
-
(0, import_vitest.it)("should handle empty input", () => {
|
|
259
|
-
const result = (0, import_serialization.serializeAll)([]);
|
|
260
|
-
(0, import_vitest.expect)(result.components).toHaveLength(0);
|
|
261
|
-
(0, import_vitest.expect)(result.errors).toHaveLength(0);
|
|
262
|
-
});
|
|
263
|
-
(0, import_vitest.it)("should handle all failures gracefully", () => {
|
|
264
|
-
const deps = [
|
|
265
|
-
makeDependencyRow({ ecosystem: "unknown1", package_name: "a" }),
|
|
266
|
-
makeDependencyRow({ ecosystem: "unknown2", package_name: "b" })
|
|
267
|
-
];
|
|
268
|
-
const result = (0, import_serialization.serializeAll)(deps);
|
|
269
|
-
(0, import_vitest.expect)(result.components).toHaveLength(0);
|
|
270
|
-
(0, import_vitest.expect)(result.errors).toHaveLength(2);
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
(0, import_vitest.describe)("deserializeAll", () => {
|
|
274
|
-
(0, import_vitest.it)("should deserialize all valid components", () => {
|
|
275
|
-
const components = [
|
|
276
|
-
{ type: "library", name: "express", version: "4.18.2", purl: "pkg:npm/express@4.18.2" },
|
|
277
|
-
{ type: "library", name: "lodash", version: "4.17.21", purl: "pkg:npm/lodash@4.17.21" }
|
|
278
|
-
];
|
|
279
|
-
const result = (0, import_serialization.deserializeAll)(components);
|
|
280
|
-
(0, import_vitest.expect)(result.deps).toHaveLength(2);
|
|
281
|
-
(0, import_vitest.expect)(result.errors).toHaveLength(0);
|
|
282
|
-
});
|
|
283
|
-
(0, import_vitest.it)("should collect errors for failing components and continue with remaining", () => {
|
|
284
|
-
const components = [
|
|
285
|
-
{ type: "library", name: "express", version: "4.18.2", purl: "pkg:npm/express@4.18.2" },
|
|
286
|
-
{ type: "library", name: "bad", version: "1.0.0", purl: "invalid-purl" },
|
|
287
|
-
{ type: "library", name: "lodash", version: "4.17.21", purl: "pkg:npm/lodash@4.17.21" }
|
|
288
|
-
];
|
|
289
|
-
const result = (0, import_serialization.deserializeAll)(components);
|
|
290
|
-
(0, import_vitest.expect)(result.deps).toHaveLength(2);
|
|
291
|
-
(0, import_vitest.expect)(result.errors).toHaveLength(1);
|
|
292
|
-
(0, import_vitest.expect)(result.errors[0].name).toBe("bad");
|
|
293
|
-
(0, import_vitest.expect)(result.errors[0].reason).toContain("Invalid purl format");
|
|
294
|
-
});
|
|
295
|
-
(0, import_vitest.it)("should handle empty input", () => {
|
|
296
|
-
const result = (0, import_serialization.deserializeAll)([]);
|
|
297
|
-
(0, import_vitest.expect)(result.deps).toHaveLength(0);
|
|
298
|
-
(0, import_vitest.expect)(result.errors).toHaveLength(0);
|
|
299
|
-
});
|
|
300
|
-
(0, import_vitest.it)("should handle all failures gracefully", () => {
|
|
301
|
-
const components = [
|
|
302
|
-
{ type: "library", name: "a", version: "1.0", purl: "bad1" },
|
|
303
|
-
{ type: "library", name: "b", version: "2.0", purl: "bad2" }
|
|
304
|
-
];
|
|
305
|
-
const result = (0, import_serialization.deserializeAll)(components);
|
|
306
|
-
(0, import_vitest.expect)(result.deps).toHaveLength(0);
|
|
307
|
-
(0, import_vitest.expect)(result.errors).toHaveLength(2);
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
//# sourceMappingURL=serialization.test.js.map
|