Skip to content

feat(dependencies): build snippet dependency metadata service and API endpoints (#216) - #226

Closed
jeffrey-graham wants to merge 1 commit into
SudiptaPaul-31:mainfrom
jeffrey-graham:feat/snippet-dependency-metadata-service-216
Closed

jeffrey-graham wants to merge 1 commit into
SudiptaPaul-31:mainfrom
jeffrey-graham:feat/snippet-dependency-metadata-service-216

Conversation

@jeffrey-graham

Copy link
Copy Markdown

Summary

Implements the backend snippet dependency metadata service and Next.js API routes for creating, listing, updating, and deleting snippet dependencies.

Key Changes

  • Dependency Metadata Service (lib/snippet-dependency-service.ts):
    • Validates dependency names (non-empty, trimmed, package naming convention, path traversal/control character checks, max length).
    • Validates dependency versions (semver and version range formats, max length).
    • Validates supported package ecosystems (npm, pip, Cargo, Maven, NuGet, Composer, Other).
    • Validates optional configuration JSON payloads (strictly allowed keys, type checks, URL protocol checks, and max payload size limit).
    • Enforces snippet existence, owner/editor authorization, duplicate dependency prevention (CONFLICT), snippet retrieval enrichment (attachDependenciesToSnippet), and cascading cleanup on snippet deletion (deleteSnippetWithCascade).
  • API Endpoints:
    • POST /api/snippets/[id]/dependencies and GET /api/snippets/[id]/dependencies
    • PUT /api/dependencies/[dependencyId] and DELETE /api/dependencies/[dependencyId]
  • Automated Tests (lib/snippet-dependency-service.test.ts):
    • Covers CRUD operations, validation rules, authorization, referential integrity, cascading deletes, and route handlers.

Closes #216

@vercel

vercel Bot commented Nov 10, 2026

Copy link
Copy Markdown

@jeffrey-graham is attempting to deploy a commit to the Sudipta 's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build Snippet Dependency Metadata Service

1 participant