Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Bug report
description: Report a problem with the DATALYR Node SDK.
labels: [bug]
body:
- type: textarea
id: what-happened
attributes:
label: What happened
description: Describe the problem. Include the error message if there is one.
validations:
required: true
- type: textarea
id: expected
attributes:
label: What you expected
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
description: Give the smallest code sample that shows the problem. Remove API keys and personal data.
render: javascript
validations:
required: true
- type: input
id: sdk-version
attributes:
label: SDK version
placeholder: "1.3.4"
validations:
required: true
- type: input
id: environment
attributes:
label: Environment
description: Node version, operating system and hosting platform.
placeholder: "Node 22, Linux, AWS Lambda"
validations:
required: true
- type: textarea
id: logs
attributes:
label: Debug logs
description: Set `debug: true` and paste the output. Remove API keys and personal data.
render: text
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Documentation
url: https://docs.datalyr.com/sdk-reference/node
about: Read the Node SDK reference.
- name: DATALYR
url: https://datalyr.com
about: Ask other questions about DATALYR.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Feature request
description: Suggest a change to the DATALYR Node SDK.
labels: [enhancement]
body:
- type: textarea
id: problem
attributes:
label: Problem
description: Describe what you want to do and what stops you now.
validations:
required: true
- type: textarea
id: proposal
attributes:
label: Proposed solution
description: Describe the change you want.
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives
description: Describe any workarounds you use now.
Binary file added .github/assets/banner-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/banner-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## What changed

<!-- Describe the change and why it is necessary. -->

## How you tested it

<!-- List the commands you ran and the result. -->

## Checklist

- [ ] `npm run build` and `npm test` pass.
- [ ] Public API changes are in `CHANGELOG.md` under `[Unreleased]`.
- [ ] No API keys, customer data or personal data are in the change.
20 changes: 10 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ All notable changes to this project will be documented in this file.
## [1.3.3] - 2026-09-03

### Added
- `externalIds` on `track()` options (person contract §6): `{ namespace: id }` declared identities, e.g. `{ stripe: 'cus_123' }`, sent top-level on the envelope. Ingest classifies them as declared namespaces so they join the customer journey; undeclared namespaces are reported as unjoined rather than minting a person.
- `externalIds` on `track()` options: `{ namespace: id }` declared identities, e.g. `{ stripe: 'cus_123' }`, sent top-level on the envelope. Ingest classifies them as declared namespaces so they join the customer journey; undeclared namespaces are reported as unjoined rather than minting a person.

### Fixed
- The `SDK_VERSION` sent in `context.library.version` and the `User-Agent` was stuck at `1.3.1` through the 1.3.2 release; it now matches the package version.

## [1.3.2] - 2026-07-25

### Changed
- **NODE-01: `engines.node` raised to `>=18.0.0`.** The SDK calls global `fetch` and
- **`engines.node` raised to `>=18.0.0`.** The SDK calls global `fetch` and
`AbortController`; Node 16 and earlier provide neither and the SDK fails at the first
send. `engines` nonetheless declared `>=14.17.0`, so npm installed it silently on
runtimes that cannot run it and the failure surfaced at the first event instead of at
Expand All @@ -49,9 +49,9 @@ All notable changes to this project will be documented in this file.
## [1.3.1] - 2026-07-12

### Added
- **A3-25: `schema_version` envelope stamp.** Every event's context now carries
- **`schema_version` envelope stamp.** Every event's context now carries
`schema_version: 1`, the first canonical envelope version shared across the SDK fleet,
so the ingest contract layer can key on one version marker.
so the server can key on one version marker.
- **`eventId` on `TrackOptions` (webhook idempotency).** The ingest server de-duplicates
on the event id (6h window), but `track()` always minted a fresh UUID — so at-least-once
webhook redeliveries (Stripe, Shopify, …) were counted as new events, double-counting
Expand All @@ -72,26 +72,26 @@ All notable changes to this project will be documented in this file.
exceptions are swallowed and can never crash the SDK.

### Fixed
- **`close()` hung the process up to `closeTimeout` (~30s) after resolving (TR-09).** The
- **`close()` hung the process up to `closeTimeout` (~30s) after resolving.** The
drain loop's `Promise.race` budget/pause timers were never cleared, so a won race left a
live timer pinning the event loop — reintroducing the exact exit-hang the 1.3.0 unref work
fixed. Timers are now canceled when their race settles (proven: process exits ~4ms after
`close()` instead of ~8s).
- **`await flush()` did not guarantee a drain (TR-25).** If a flush was already in flight it
- **`await flush()` did not guarantee a drain.** If a flush was already in flight it
returned that promise, which had snapshotted the queue **before** later events — so the
serverless `track(); track(); await flush()` pattern stranded the second event. `flush()`
now loops until the queue empties (or a pass delivers nothing against a down endpoint).
- **Invalid args threw out of a fire-and-forget promise (9.D.4).** `track({event:''})`,
- **Invalid args threw out of a fire-and-forget promise.** `track({event:''})`,
`identify()`/`alias()`/`group()` with a missing required id used to `throw`, which — for an
un-awaited call — surfaced as an `ERR_UNHANDLED_REJECTION` and crashed the host (exit 1).
They now warn-and-drop (`onDrop('validation_error')`) and resolve.
- **A wrong API key black-holed everything silently (9.D.8).** A permanent 4xx (≠ 408/429)
- **A wrong API key black-holed everything silently.** A permanent 4xx (≠ 408/429)
was re-queued and retried ~10 flush cycles per event before a generic drop. It is now
dropped immediately (no retry/requeue), and `401`/`403` logs a one-time authentication
failure. `408`/`429` are now correctly treated as **transient** (retried), not permanent.
- **`track()` after `close()` was silently dropped (9.D.3).** It now logs one loud error and
- **`track()` after `close()` was silently dropped.** It now logs one loud error and
fires `onDrop('closed')`; `close()` is idempotent under repeat/concurrent calls.
- **Over-long `eventId` (B-4).** A pathological caller id became a pathological server Redis
- **Over-long `eventId`.** A pathological caller id became a pathological server-side
key; ids over 256 chars are now collapsed to a deterministic hash (redeliveries of the same
id still dedup).
- **`page(userId, name)` left `page_url` blank server-side** — the pageview now falls back to
Expand Down
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributing

Thank you for helping to improve the DATALYR Node SDK.

## Run the checks

The CI workflow runs these commands on Node 22 and 24. Run them before you open a pull request.

```bash
npm ci
npm run build
npm test
```

## Pull requests

- Keep each pull request to one change.
- Add or update tests for a change in behavior.
- Add an entry to `CHANGELOG.md` under `[Unreleased]` for a change that users can see.
- Do not change the version number. The maintainers do this at release.
- Remove API keys, customer data and personal data from code, tests and logs.

## Report a problem

Use the [issue templates](https://github.com/datalyr/api/issues/new/choose). For a security problem, see [SECURITY.md](SECURITY.md).
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Datalyr
Copyright (c) 2024-2026 DATALYR Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading