Skip to content

TypeScript/JavaScript SDK #11

@sunilp

Description

@sunilp

Summary

LDP needs a TypeScript/JavaScript SDK for the web and Node.js ecosystem. This is the second most important SDK after Python.

What to do

  1. Create sdk/typescript/ with a proper npm package structure
  2. Implement TypeScript types for all protocol types (matching Python SDK 1:1):
    • LdpIdentityCard, LdpCapability, QualityMetrics
    • PayloadMode, TrustDomain, Provenance
    • LdpEnvelope, LdpMessageBody
    • SessionConfig, LdpSession
  3. Implement LdpClient with fetch-based HTTP client
  4. Implement LdpRouter with quality/cost/latency/balanced strategies
  5. Add tests with vitest or jest

Package structure

sdk/typescript/
├── package.json
├── tsconfig.json
├── src/
│   ├── index.ts
│   ├── types/
│   │   ├── identity.ts
│   │   ├── capability.ts
│   │   ├── messages.ts
│   │   ├── payload.ts
│   │   ├── provenance.ts
│   │   ├── session.ts
│   │   └── trust.ts
│   ├── client.ts
│   └── router.ts
└── tests/

Why this matters

The web/Node.js ecosystem is huge. A TypeScript SDK unlocks: browser-based LDP clients, Next.js/Express server delegates, Cloudflare Worker delegates, and Deno/Bun compatibility.

References

Acceptance criteria

  • Types match the Python SDK 1:1
  • LdpClient with discover, session management, submit_task
  • LdpRouter with 4 routing strategies
  • Published to npm as ldp-protocol
  • Tests passing

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsdkSDK implementations (Python, TypeScript, Go)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions