Skip to content

[PoC] use official @linqapp/sdk for types and additional features#278

Open
jflayhart wants to merge 4 commits intovercel:linqfrom
jflayhart:linq-sdk
Open

[PoC] use official @linqapp/sdk for types and additional features#278
jflayhart wants to merge 4 commits intovercel:linqfrom
jflayhart:linq-sdk

Conversation

@jflayhart
Copy link

@jflayhart jflayhart commented Mar 21, 2026

Summary

Replaces the openapi-fetch HTTP client and OpenAPI-generated types with the official @linqapp/sdk, removing ~12,000 lines of generated code that can become stale.

What changed

  • HTTP client: openapi-fetch@linqapp/sdk (typed SDK methods like client.chats.messages.send())
  • Types: import type from @linqapp/sdk instead of components["schemas"]["X"] from generated schema.ts
  • Error handling: Catches SDK exceptions (APIError subclasses) instead of checking { data, error, response }
  • Dependency model: @linqapp/sdk as a regular dependency, matching how other adapters handle platform SDKs (Slack → @slack/web-api, Discord → discord.js, Teams → botbuilder, etc.)
  • Removed: schema.ts (~6,100 lines), lib/linq/linq-api-v3.yaml (~5,800 lines), openapi-fetch and openapi-typescript deps, generate-types script
  • Tests: Adapted 3 tests for SDK fetch calling conventions (SDK passes (url, init) to fetch, not a Request object) and empty-string cursor handling
  • Docs: Updated README install instructions

Bundle size

Before (openapi-fetch) After (@linqapp/sdk)
Adapter JS bundle 23.35 KB 22.53 KB (-3.5%)
Adapter source map 45.75 KB 43.93 KB
node_modules impact openapi-fetch: 244 KB @linqapp/sdk: 2.7 MB

The adapter bundle is smaller because all SDK type imports are erased at compile time. Only 6 runtime values are imported from the SDK: the client class and 5 error classes. The SDK has zero transitive dependencies.

The node_modules footprint increases ~2.5 MB, comparable to other platform SDKs in this repo (discord.js, botbuilder, @googleapis/chat, etc.). This is a server-side adapter — presuming none of this ships to the browser.

Why replace openapi-fetch with the official SDK?

  • Eliminates maintaining a bundled OpenAPI spec and generated schema
  • SDK types stay in sync automatically when upgrading @linqapp/sdk
  • SDK handles auth headers, base URL, request construction internally
  • Zero runtime dependencies

@vercel
Copy link
Contributor

vercel bot commented Mar 21, 2026

@jflayhart is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

- Replace openapi-fetch HTTP client with the official @linqapp/sdk
- Import types directly from SDK instead of generating from OpenAPI spec
- Remove generated schema.ts (~6100 lines) and OpenAPI YAML (~5800 lines)
- Remove openapi-fetch and openapi-typescript dependencies
- Error handling now catches SDK exceptions instead of checking { data, error }
- Disable SDK retries (maxRetries: 0) since adapter handles its own retry logic
@jflayhart jflayhart changed the title refactor: replace openapi-fetch with @linqapp/sdk RFC: use official @linqapp/sdk for types and additional features Mar 21, 2026
@jflayhart jflayhart changed the title RFC: use official @linqapp/sdk for types and additional features [PoC] use official @linqapp/sdk for types and additional features Mar 21, 2026
@socket-security
Copy link

socket-security bot commented Mar 21, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​linqapp/​sdk@​0.12.27210010095100

View full report

@bensabic bensabic self-requested a review March 22, 2026 02:50
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.

1 participant