Repository navigation
Conversation
sendlit-client.ts called SendLit's API by hand with its own response types, and those had drifted from SendLit's contract. It now uses the sendlit SDK, whose types come from that contract, and keeps only what CourseLit adds: config, SendLitApiError and a little normalisation. - errors map from the SDK's SendLitError in one place; the quota and plan-limit checks use SendLit's error code instead of message text - no automatic retries (the outbox retries) and the same 15s timeout - removed getOverview and updateSubscriber, which nothing called - test fakes now return SendLit's real response shapes
clbotdev
marked this pull request as ready for review
November 15, 2026 15:44
…quence type
- A template created without content sent { content: { html: "" } },
which SendLit rejects. It now starts from SendLit's own system:blank
starter.
- Listing broadcasts or sequences without a type reached SendLit, which
requires one, and failed with its 400. The type is now required in the
API contract and checked before calling SendLit.
…sendlit-sdk # Conflicts: # apps/api/src/sendlit-client.ts
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #881 (
feat/plan-limits). Usessendlit0.5.0, which includes codelitdev/sendlit#203 (the tags, general settings, overview and test-send methods CourseLit needs).Why
apps/api/src/sendlit-client.tscalled SendLit's API by hand, with its own response types. Those had drifted from SendLit's contract, and the test fakes drifted with them. The official SDK's types come from SendLit's contract, so they can't drift.What changes
sendlit-client.tsgoes from 1,367 to 701 lines. Every exported function keeps its signature, so callers don't change.SendLitErroris mapped toSendLitApiErrorin one place, which gains acodefield. The quota-exhausted andplan_limit_exceededchecks use that code instead of matching message text.fetcherbecomes the SDK'sfetch.getOverview/getSendLitOverviewandupdateSubscriber: nothing called them, and the overview type didn't match SendLit's.id/namealiases the client added to sequences and templates. CourseLit's contract declares these responses as passthrough, so OpenAPI is unchanged, and every admin read falls back tosequenceId/templateId/title.nameon template create,purposeon template update.sendlit-test-support.tshas builders). Fake org keys aresl_org_live_….seq 1becameseq_1in two tests, since the SDK validates ids.Also fixed
{ content: { html: "" } }, which SendLit rejects. It now starts from SendLit's ownsystem:blankstarter (fetched from SendLit, not copied into CourseLit).typereached SendLit and failed with its 400.typeis now required in CourseLit's contract (GET /v1/school/mails/sequences, and the generated MCP tool), and the route answers 400validation_faileditself. The admin always passes it.Tests
tscis clean andcheck:driftpasses. All 23 test files that touch SendLit, plus the MCP and OpenAPI tests, pass (170 tests), run against the publishedsendlit0.5.0.