Skip to content

docs: the SDK, and an SDK tab on every reference page - #96

Merged
joaopcm merged 2 commits into
mainfrom
docs/sdk
Aug 8, 2026
Merged

docs: the SDK, and an SDK tab on every reference page#96
joaopcm merged 2 commits into
mainfrom
docs/sdk

Conversation

@joaopcm

@joaopcm joaopcm commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Documentation for @propgate/sdk, and the third tab everywhere the docs already showed a call two ways.

A new SDK section

Six pages, mirroring how the CLI section is split:

/sdk Install, construct, the { data, error, meta } envelope, configuration, the keyless calls, types, and what is covered
/sdk/errors The PropgateErrorCode table, what gets retried and what deliberately does not, and the rate limits you have to schedule around
/sdk/profiles Versions, requiredPerDomain, typed requirements
/sdk/domains The lifecycle, listAll, and a reconciliation loop worth copying
/sdk/webhooks Endpoints, secret rotation, the delivery ledger, and verifying signatures with @propgate/webhooks rather than this package
/sdk/accounts Keys and members, and why signup is not here

An SDK tab beside cURL and CLI

All 21 endpoint pages, plus the quickstart, /authentication and the landing page. Thirteen of those pages showed a bare cURL block; those became tabs. The two signup pages keep the pair they had — the flow ends in a mailbox and a server-side client is on the wrong side of it, which both pages already say.

What is guarded, and what is not

Prose stays a person's job. src/lib/sdk.spec.ts takes the rest, in the shape cli.spec.ts established:

  • No invented methods. Every propgate.x.y( across the SDK and API pages is checked against a real client, found by reflection rather than a hand-kept list. Verified it bites by renaming one.
  • No undocumented methods. Every method the client exposes has to appear somewhere under /sdk.
  • No page left behind. Every endpoint page that has an SDK equivalent must show an SDK tab, and the exclusion list is itself checked against the pages that exist, so a stale exclusion cannot quietly drop a page.
  • No unexplained error code. The table on /sdk/errors is asserted to name every member of the union.

That last one needed the union to exist at runtime, so PROPGATE_ERROR_CODES is now exported and PropgateErrorCode derives from it — the same shape CHECK_KINDS and WEBHOOK_EVENTS already use here. Changeset included; it is additive.

coverage.spec.ts also learned the new sidebar section, which is what keeps an empty one from silently vanishing.

Checks

pnpm lint, pnpm check, pnpm test (202 docs specs) and next build all pass — 132 static pages, the six new ones included. Spot-checked the built HTML: three tabs on /api/domains/register, Shiki highlighting on the TypeScript panels.

Greptile Summary

The PR adds comprehensive @propgate/sdk documentation and SDK examples throughout the API reference.

  • Adds six SDK guide pages covering construction, errors, profiles, domains, webhooks, and accounts.
  • Adds SDK tabs to endpoint, authentication, quickstart, and landing-page examples.
  • Exports runtime error-code and retry-wait constants and adds documentation coverage checks.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/docs/src/app/(docs)/sdk/webhooks/_snippets.ts The webhook example now rejects requests outside the exported 300-second tolerance before verifying their signature, resolving the prior replay-window finding.
apps/docs/src/app/(docs)/sdk/errors/page.mdx The retry documentation now correctly states the conservative 100-second default upper bound and explains the 90.75-second practical ceiling.
apps/docs/src/lib/sdk.spec.ts Adds automated checks for documented SDK methods, endpoint-tab coverage, error-code coverage, webhook freshness guidance, and retry-duration values.
packages/sdk/src/error.ts Introduces a runtime error-code tuple and derives the public error-code union from it.
packages/sdk/src/http.ts Exports the retry-wait ceiling and aligns its duration commentary with the actual three-attempt retry loop.

Reviews (2): Last reviewed commit: "fix(docs): check the timestamp in the we..." | Re-trigger Greptile

A six-page SDK section — overview, errors and retries, profiles, domains,
webhooks, keys and members — plus an SDK example beside the cURL and CLI ones
on all 21 endpoint pages, the quickstart, authentication and the landing page.

The prose is a person's job; the rest is guarded. `sdk.spec.ts` builds a client
and finds its methods by reflection, so an example naming a method that does
not exist fails, every method has to appear somewhere under /sdk, and every
endpoint page that has an SDK equivalent has to show it. Signup and confirm are
the two written-down exceptions, and the list of them is checked against the
pages that exist.

The error table needed a runtime list to be checkable at all, so
`PROPGATE_ERROR_CODES` is now exported and the union derives from it — the same
shape CHECK_KINDS and WEBHOOK_EVENTS already use.
Comment thread apps/docs/src/app/(docs)/sdk/webhooks/_snippets.ts Outdated
Comment thread apps/docs/src/app/(docs)/sdk/errors/page.mdx
…real worst case

Two from review, both real.

The verification handler called `verifyPayload` and stopped there. That
validates the HMAC and nothing else — freshness is deliberately the receiver's
job, which is why `TOLERANCE_SECONDS` is exported — so the example published a
handler a captured request replays forever. `/webhooks` already got this right;
this one now quotes the same constant, and a spec asserts every example that
verifies a signature performs the comparison.

The worst case for one call was written as 65 seconds. The defaults it is
computed from give 100: three attempts at 30 seconds plus two waits at the
five-second ceiling. A reader sizing an enclosing deadline from 65 would have
had it fire before the retries finished. `MAX_RETRY_WAIT_MS` is now exported so
the page computes the number instead of stating it, and the source comment that
carried the same arithmetic is fixed too.
@joaopcm
joaopcm merged commit a80bbf7 into main Aug 8, 2026
14 checks passed
@joaopcm
joaopcm deleted the docs/sdk branch August 8, 2026 00:42
@github-actions github-actions Bot mentioned this pull request Aug 8, 2026
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