@stream-io/node-sdk 0.8.12 → 0.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.14](https://github.com/GetStream/stream-node/compare/v0.8.13...v0.8.14) (2026-10-22)
4
+
5
+
6
+ ### Features
7
+
8
+ * add comments, reactions and collections to QueryFeedsUsageStatsResponse ([#379](https://github.com/GetStream/stream-node/issues/379)) ([4572577](https://github.com/GetStream/stream-node/commit/457257701f3aed84c4a0ce17ff7d9f67ed4a552c))
9
+
10
+ ## [0.8.13](https://github.com/GetStream/stream-node/compare/v0.8.12...v0.8.13) (2026-10-16)
11
+
12
+
13
+ ### Features
14
+
15
+ * add viewer_location to GetOrCreateFeedRequest ([#372](https://github.com/GetStream/stream-node/issues/372)) ([5983bdc](https://github.com/GetStream/stream-node/commit/5983bdcb143fde71ae70d5857b08b4c7677bf8c6))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * SDK issues from running chat docs snippets; chat docs snippet runner ([#373](https://github.com/GetStream/stream-node/issues/373)) ([bd78f75](https://github.com/GetStream/stream-node/commit/bd78f7595d7d4514f08575e8af63378fa3bc6677))
21
+
3
22
  ## [0.8.12](https://github.com/GetStream/stream-node/compare/v0.8.11...v0.8.12) (2026-10-09)
4
23
 
5
24
 
@@ -0,0 +1,98 @@
1
+ # Docs snippet tests
2
+
3
+ Typed tests that run the server-side Node.js snippets of the Stream docs against a real Stream app: the pages of
4
+ these sidebars in `getstream.io/content/docs/_sidebars/` (`SIDEBAR_FILES` in `sync/parse.ts`):
5
+
6
+ - chat: `[chat][node].json`
7
+ - activity feeds (v3): `[activity-feeds][node][v3].json`
8
+ - moderation: `[moderation][node].json`
9
+ - video: `[video][api].json` (the server-side API docs)
10
+ - platform: `[platform][default].json`
11
+
12
+ Only fences labelled `Node.js` are in scope (a fence label, or the `label` of the enclosing `<tabs-item>` on the video pages) (docs fences must always have a label): they are fixed when they are
13
+ wrong. `JavaScript`, `React` and `React Native` fences (client-side code), the stream-chat-js@9 fences (`JavaScript (stream-chat-js@9)`,
14
+ `Node.js (stream-chat-js@9)`) and `Node.js` fences inside a `<disclosure label="... (no SDK)">` block (reference
15
+ implementations without the SDK) are out of scope and are neither tested nor changed.
16
+
17
+ ```sh
18
+ # credentials: STREAM_API_KEY / STREAM_SECRET in the repo root .env (the node SDK test app, see .env-example)
19
+ yarn test:docs # all docs tests
20
+ yarn test:docs pages/chat/node/01-quick_start/01-backend_quickstart.test.ts # one file
21
+ yarn types:docs # typecheck the docs tests
22
+ yarn test:docs:sync # test regions == docs fences (no network)
23
+ yarn test:docs:sweep # remove docs-test leftovers older than 30 min, incl. channels, and turns off retention policies (DOCS_SWEEP_DRY_RUN=1 to list only, DOCS_SWEEP_MIN_AGE=0 for all)
24
+ yarn eslint __tests__/docs-snippets && npx prettier --check __tests__/docs-snippets # lint
25
+ ```
26
+
27
+ These tests hit the network and are not part of `yarn test` (which runs `__tests__/integration`). Don't run them
28
+ at the same time as `yarn test`: both use the same app, and the drift check would see the other suite's changes.
29
+
30
+ ## How to add tests?
31
+
32
+ Run the `docs-sync` Claude Code skill (`.claude/skills/docs-sync/SKILL.md`): `/docs-sync [path to the getstream.io checkout]`. It runs `yarn test:docs:sync` against that checkout, adds tests for new `Node.js` snippets, updates existing tests to docs changes (the docs win), and writes fixes for snippets that don't work back to the docs.
33
+
34
+ ## Push credentials (optional)
35
+
36
+ `DOCS_PUSH_FIREBASE_CREDENTIALS` in the repo root `.env`: a Firebase service account JSON, on one line. Snippets
37
+ that need real push credentials run in `describe.skipIf(!hasFirebaseCredentials)` (`helpers/push.ts`), so the
38
+ suite passes without it (those tests are reported as skipped). `sampleFirebaseCredentials` (`helpers/push.ts`) is
39
+ the sample service account JSON from the platform push providers page, for snippets with a credentials
40
+ placeholder; when the API rejects it, the snippet needs real credentials and is skipped. Push and webhook tests only call the API and
41
+ check the response, or read the setting back (`getApp`, `listPushProviders`, push preferences, ...). They don't
42
+ check that notifications or webhook events arrive.
43
+
44
+ ## Layout
45
+
46
+ ```
47
+ pages/chat/<docs section>/<page>.test.ts # chat Node.js snippets, run with the server client
48
+ pages/activity-feeds/v3-latest/<docs section>/<page>.test.ts # feeds v3 Node.js snippets
49
+ pages/moderation/<docs section>/<page>.test.ts # moderation Node.js snippets
50
+ pages/video/api/<docs section>/<page>.test.ts # video API Node.js snippets
51
+ pages/platform/<docs section>/<page>.test.ts # platform Node.js snippets
52
+ helpers/ # server client, unique ids, cleanup registry, server-side helpers,
53
+ # waits, leak check, app snapshot, push credentials
54
+ env.ts # .env loading (fails without STREAM_API_KEY / STREAM_SECRET)
55
+ setup.ts # per-file leak check and app-settings drift check
56
+ global-setup.ts # end-of-run sweep: removes leftovers of files that failed while loading
57
+ sync/ # `yarn test:docs:sync` (docs fence <-> test region check)
58
+ maintenance/ # `yarn test:docs:sweep`
59
+ AGENTS.md # test conventions and API quirks, read before working on a page
60
+ ```
61
+
62
+ The path mirrors the docs path (relative to `content/docs`) without `/_default`, e.g.
63
+ `chat/_default/04-messages/01-send_message.md` maps to `pages/chat/04-messages/01-send_message.test.ts`,
64
+ `chat/node/01-quick_start/...` to `pages/chat/node/01-quick_start/...`,
65
+ `activity-feeds/v3-latest/_default/05-activities/01-activities.md` to `pages/activity-feeds/v3-latest/05-activities/01-activities.test.ts`,
66
+ `video/api/01-basics/03-calls.md` to `pages/video/api/01-basics/03-calls.test.ts` and
67
+ `platform/02-identity-and-access/02-users.md` to `pages/platform/02-identity-and-access/02-users.test.ts`.
68
+
69
+ ## Conventions
70
+
71
+ The test conventions and the API quirks found so far are in [`AGENTS.md`](AGENTS.md). Read it before working on a page.
72
+
73
+ ## Snippet markers and docs sync
74
+
75
+ Each docs fence has exactly one marked region in a test. `yarn test:docs:sync` (no network) compares them, so later edits on either side fail until they agree again:
76
+
77
+ ```ts
78
+ // #region snippet docs="chat/node/01-quick_start/01-backend_quickstart.md" heading="Syncing channels" tab="Node.js" index=1
79
+ // COPY: channelId="kung-fu", creatorId="4645"
80
+ const channel = client.chat.channel("messaging", channelId);
81
+
82
+ // create the channel and set created_by to user id 4645
83
+ await channel.getOrCreate({ data: { created_by_id: creatorId } });
84
+ // #endregion snippet
85
+ ```
86
+
87
+ - **Fence key**:
88
+ - `docs` is the page path relative to `getstream.io/content/docs/` (`chat/...`, `activity-feeds/...`, `moderation/...`, `video/...` or `platform/...`).
89
+ - `heading` is the text of the nearest heading above the fence.
90
+ - `tab` is the fence `label`, else the `label` of the enclosing `<tabs-item>` (or `unlabelled`).
91
+ - `index` is 1-based among fences with the same heading text and tab (default 1).
92
+ - **COPY**: `name="literal"` pairs, applied to the region before comparing (identifier `name` becomes the docs literal). Don't use COPY variables as object keys or shorthand properties.
93
+ - **Comparison**: both sides are formatted with the same prettier options, so quote style and line wrapping don't matter, but any code or comment change does.
94
+ - **Coverage** (checked first): every `Node.js` fence (`js`/`javascript`/`ts`/`typescript`) on the pages of the tested sidebars (see the top of this file; `$fragment` entries are resolved from `_sidebars/fragments/`), whether or not the page has tests yet, must have a region (inside `it.skip` if it can't run). `JavaScript` / `React` / `React Native` / stream-chat-js@9 fences and comment-only fences are ignored.
95
+ - **Labels**: every JS fence on those pages must be labelled `JavaScript`, `React`, `React Native`, `Node.js`, `JavaScript (stream-chat-js@9)` or `Node.js (stream-chat-js@9)`; unlabelled or otherwise labelled JS fences fail.
96
+ - **Excluded pages and fences**: `EXCLUDED_PAGES` in `sync/parse.ts` lists sidebar pages that are deliberately not validated, with a reason. Both checks skip them. `EXCLUDED_FENCES` does the same for single `Node.js` fences (keyed by fence id) that hold another SDK's code, e.g. Feeds v2 `getstream` client code on the moderation Feeds v2 quick start: not ours to test or update.
97
+ - **`DOCS_SYNC_WRITE=<page path> yarn test:docs:sync`** writes the regions of that page into the docs fences (docs prettier style). Use it to apply a fix to the docs. `DOCS_SYNC_WRITE=1` writes all pages.
98
+ - **`DOCS_DIR`** points at another docs checkout (default: `../getstream.io/content/docs` next to this repo). The check is skipped if the directory doesn't exist.