Skip to content

feat(sdk): add configure({ token }) and align the hosted default - #5

Merged
dimitrisx26 merged 1 commit into
mainfrom
feat/sdk-configure-token
Sep 23, 2026
Merged

dimitrisx26 merged 1 commit into
mainfrom
feat/sdk-configure-token

Conversation

@dimitrisx26

Copy link
Copy Markdown
Collaborator

What

  • configure({ token }) sets the X-Statless-Token value. It takes precedence over STATLESS_TELEMETRY_TOKEN, which is still read at call time as the fallback; an empty string clears the override.
  • DEFAULT_HOSTED_ENDPOINT now points at https://in.statless.dev/v1/telemetry/ping (the SaaS ingestion host) instead of telemetry.statless.dev.
  • Version 0.1.1 → 0.1.2.

Why

The SaaS package embed snippet needs to bake an entity key into a published CLI. The SDK only allowed the token via an env var, which an end user would have to set. configure({ token }) lets the CLI author pass it in code. The hosted default now matches the host the SaaS actually serves.

How verified

  • npm run lint (tsc) clean; npm test 15 passing (including two new token tests); npm run build and npm run size OK (994 B gzipped, budget 2048).
  • Docs updated (SDK README, root README env table).

No collector changes. Consumed by statless/statless-app#17.

The SDK could only read its collector token from STATLESS_TELEMETRY_TOKEN, so a
published CLI could not bake the token in through code. configure() now accepts
token; it wins over the env var, which is still read at call time as the
fallback (an empty string clears the override).

Also point DEFAULT_HOSTED_ENDPOINT at https://in.statless.dev/v1/telemetry/ping,
the SaaS ingestion host, matching the collector contract the SaaS now serves.

Bumps the package to 0.1.2.

Signed-off-by: dimitrisx26 <dxynos@outlook.com>
@dimitrisx26
dimitrisx26 merged commit e64678a into main Sep 23, 2026
5 checks passed
@dimitrisx26
dimitrisx26 deleted the feat/sdk-configure-token branch September 23, 2026 19:57
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