CDP-6025: add TSDoc to public API + TypeDoc reference site#195
CDP-6025: add TSDoc to public API + TypeDoc reference site#195jcpsimmons wants to merge 2 commits into
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Every public method on TrackClient and APIClient, every send-request builder class, the Region exports, the IdentifierType/Filter types, and the error classes now carry TSDoc with @param/@returns/@throws and short usage examples where helpful. IDE hover and autocomplete pick these up automatically. Adds typedoc as a devDependency with a typedoc.json config and an npm run docs script that emits a static reference site to docs/ (gitignored). Setting up GitHub Pages publishing is out of scope for this PR.
Adds type re-exports from index.ts for the de-facto public types that were referenced by method signatures but not formally part of the SDK exports: RequestData, PushRequestData, the Send*RequestOptions unions, and the *Message types. Users can now import these to type their own variables (e.g. function args that wrap the SDK). Also lists the remaining internal helper types (APIDefaults, TrackDefaults, Recipients, the With/Without union components, etc.) in typedoc.intentionallyNotExported so the doc generator runs warning-free. TypeDoc now reports 0 warnings, 0 errors. All tests still pass at 100% coverage.
7e6d7cc to
e928f2d
Compare
mike-engel
left a comment
There was a problem hiding this comment.
Now that the pipelines client has been merged, that also needs to be covered here as well
| export * from './lib/types'; | ||
| export { CustomerIORequestError } from './lib/utils'; | ||
| export { CustomerIORequestError, MissingParamError } from './lib/utils'; | ||
| export type { RequestData, PushRequestData, BasicAuth, BearerAuth, RequestAuth } from './lib/request'; |
There was a problem hiding this comment.
I'm not sure they need to be exported
| * | ||
| * @param filters Filter expression (segment / attribute / and / or / not). | ||
| * @returns The parsed JSON response body, including the new export's id. | ||
| * @throws {MissingParamError} If `filters` is empty. |
There was a problem hiding this comment.
| * @throws {MissingParamError} If `filters` is empty. | |
| * @throws {MissingParamError} If `filters` is `null` or `undefined`. |
| * send email messages; `created_at` is required for time-based segmentation. | ||
| * @returns The parsed JSON response body. | ||
| * @throws {MissingParamError} If `customerId` is empty. | ||
| * @throws {CustomerIORequestError} On non-2xx API responses. |
There was a problem hiding this comment.
This should be documented on all methods, or none (probably none, and documented at a more general/global level)
Summary
Every public method on `TrackClient` and `APIClient`, every `Send*Request` builder, the `Region` exports, the `IdentifierType` / `Filter` types, and the error classes now carry TSDoc with `@param` / `@returns` / `@throws` and short usage examples where helpful. IDE hover and autocomplete pick these up automatically — no more empty hover tooltips.
Also wires up TypeDoc so the same comments power a static API reference site:
```sh
npm run docs # generates docs/ from index.ts
```
`docs/` is gitignored. Wiring this up to GitHub Pages on release is intentionally out of scope for this PR — covered separately if we want it.
What changed
Test plan
Known follow-ups (not in this PR)
Note
Low Risk
Comment-only API docs plus dev tooling and export-list updates; no production logic changes.
Overview
Adds TSDoc across the public SDK surface—
TrackClient,APIClient, allSend*Requestbuilders, regions, filter/identifier types, and error helpers—with@param/@returns/@throwsand examples where useful so IDE hovers are populated.Wires TypeDoc via
typedocdevDependency,npm run docs, andtypedoc.json(entryindex.ts, outputdocs/, internal types hidden from nav). Generateddocs/is gitignored.index.tsnow re-exportsMissingParamErrorand additional request/auth/message types for consumers and the reference site. No intended runtime behavior changes.Reviewed by Cursor Bugbot for commit e928f2d. Bugbot is set up for automated code reviews on this repo. Configure here.