@stream-io/node-sdk 0.8.12 → 0.8.13

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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.13](https://github.com/GetStream/stream-node/compare/v0.8.12...v0.8.13) (2026-10-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * add viewer_location to GetOrCreateFeedRequest ([#372](https://github.com/GetStream/stream-node/issues/372)) ([5983bdc](https://github.com/GetStream/stream-node/commit/5983bdcb143fde71ae70d5857b08b4c7677bf8c6))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * 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))
14
+
3
15
  ## [0.8.12](https://github.com/GetStream/stream-node/compare/v0.8.11...v0.8.12) (2026-10-09)
4
16
 
5
17
 
@@ -0,0 +1,87 @@
1
+ # Docs snippet tests
2
+
3
+ Typed tests that run the server-side Node.js snippets of the chat docs (the pages of the Node sidebar,
4
+ `getstream.io/content/docs/_sidebars/[chat][node].json`) and of the platform docs (the pages of
5
+ `getstream.io/content/docs/_sidebars/[platform][default].json`) against a real Stream app.
6
+ Only fences labelled `Node.js` are in scope (docs fences must always have a label): they are fixed when they are
7
+ wrong. `JavaScript`, `React` and `React Native` fences (client-side code) and `Node.js` fences inside a `<disclosure label="... (no SDK)">` block (reference
8
+ implementations without the SDK) are out of scope and are neither tested nor changed.
9
+
10
+ ```sh
11
+ # credentials: STREAM_API_KEY / STREAM_SECRET in the repo root .env (the node SDK test app, see .env-example)
12
+ yarn test:docs # all docs tests
13
+ yarn test:docs pages/chat/node/01-quick_start/01-backend_quickstart.test.ts # one file
14
+ yarn types:docs # typecheck the docs tests
15
+ yarn test:docs:sync # test regions == docs fences (no network)
16
+ 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)
17
+ yarn eslint __tests__/docs-snippets && npx prettier --check __tests__/docs-snippets # lint
18
+ ```
19
+
20
+ These tests hit the network and are not part of `yarn test` (which runs `__tests__/integration`). Don't run them
21
+ at the same time as `yarn test`: both use the same app, and the drift check would see the other suite's changes.
22
+
23
+ ## How to add tests?
24
+
25
+ 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.
26
+
27
+ ## Push credentials (optional)
28
+
29
+ `DOCS_PUSH_FIREBASE_CREDENTIALS` in the repo root `.env`: a Firebase service account JSON, on one line. Snippets
30
+ that need real push credentials run in `describe.skipIf(!hasFirebaseCredentials)` (`helpers/push.ts`), so the
31
+ suite passes without it (those tests are reported as skipped). `sampleFirebaseCredentials` (`helpers/push.ts`) is
32
+ the sample service account JSON from the platform push providers page, for snippets with a credentials
33
+ placeholder; when the API rejects it, the snippet needs real credentials and is skipped. Push and webhook tests only call the API and
34
+ check the response, or read the setting back (`getApp`, `listPushProviders`, push preferences, ...). They don't
35
+ check that notifications or webhook events arrive.
36
+
37
+ ## Layout
38
+
39
+ ```
40
+ pages/chat/<docs section>/<page>.test.ts # chat Node.js snippets, run with the server client
41
+ pages/platform/<docs section>/<page>.test.ts # platform Node.js snippets
42
+ helpers/ # server client, unique ids, cleanup registry, server-side helpers,
43
+ # waits, leak check, app snapshot, push credentials
44
+ env.ts # .env loading (fails without STREAM_API_KEY / STREAM_SECRET)
45
+ setup.ts # per-file leak check and app-settings drift check
46
+ global-setup.ts # end-of-run sweep: removes leftovers of files that failed while loading
47
+ sync/ # `yarn test:docs:sync` (docs fence <-> test region check)
48
+ maintenance/ # `yarn test:docs:sweep`
49
+ docs-snippets-todo.md # open API spec / generator and node SDK issues
50
+ AGENTS.md # test conventions and API quirks, read before working on a page
51
+ ```
52
+
53
+ The path mirrors the docs path (relative to `content/docs`) without `/_default`, e.g.
54
+ `chat/_default/04-messages/01-send_message.md` maps to `pages/chat/04-messages/01-send_message.test.ts`,
55
+ `chat/node/01-quick_start/...` to `pages/chat/node/01-quick_start/...` and
56
+ `platform/02-identity-and-access/02-users.md` to `pages/platform/02-identity-and-access/02-users.test.ts`.
57
+
58
+ ## Conventions
59
+
60
+ The test conventions and the API quirks found so far are in [`AGENTS.md`](AGENTS.md). Read it before working on a page.
61
+
62
+ ## Snippet markers and docs sync
63
+
64
+ 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:
65
+
66
+ ```ts
67
+ // #region snippet docs="chat/node/01-quick_start/01-backend_quickstart.md" heading="Syncing channels" tab="Node.js" index=1
68
+ // COPY: channelId="kung-fu", creatorId="4645"
69
+ const channel = client.chat.channel("messaging", channelId);
70
+
71
+ // create the channel and set created_by to user id 4645
72
+ await channel.getOrCreate({ data: { created_by_id: creatorId } });
73
+ // #endregion snippet
74
+ ```
75
+
76
+ - **Fence key**:
77
+ - `docs` is the page path relative to `getstream.io/content/docs/` (`chat/...` or `platform/...`).
78
+ - `heading` is the text of the nearest heading above the fence.
79
+ - `tab` is the fence `label` (or `unlabelled`).
80
+ - `index` is 1-based among fences with the same heading text and tab (default 1).
81
+ - **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.
82
+ - **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.
83
+ - **Coverage** (checked first): every `Node.js` fence (`js`/`javascript`/`ts`/`typescript`) on the pages of the chat Node sidebar and the platform sidebar (`content/docs/_sidebars/[chat][node].json`, `[platform][default].json`), whether or not the page has tests yet, must have a region (inside `it.skip` if it can't run). `JavaScript` / `React` / `React Native` fences and comment-only fences are ignored.
84
+ - **Labels**: every JS fence on those pages must be labelled `JavaScript`, `React`, `React Native` or `Node.js`; unlabelled or otherwise labelled JS fences fail.
85
+ - **Excluded pages**: `EXCLUDED_PAGES` in `sync/parse.ts` lists sidebar pages that are deliberately not validated, with a reason. Both checks skip them.
86
+ - **`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.
87
+ - **`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.
package/dist/index.cjs.js CHANGED
@@ -12523,7 +12523,7 @@ var ApiClient = class {
12523
12523
  const headers = {
12524
12524
  Authorization: this.apiConfig.token,
12525
12525
  "stream-auth-type": "jwt",
12526
- "X-Stream-Client": "stream-node-0.8.12",
12526
+ "X-Stream-Client": "stream-node-0.8.13",
12527
12527
  "Accept-Encoding": "gzip",
12528
12528
  "x-client-request-id": clientRequestId
12529
12529
  };
@@ -12564,8 +12564,8 @@ var ApiClient = class {
12564
12564
  clientRequestId,
12565
12565
  responseCode: error.status
12566
12566
  };
12567
- if (error.name === "AbortError" || error.name === "TimeoutError") throw new StreamError(`The request was aborted due to to the ${this.apiConfig.timeout}ms timeout, you can set the timeout in the StreamClient constructor`, metadata, void 0, error);
12568
- else throw new StreamError(`The request failed due to an unexpected error`, metadata, error);
12567
+ if (error.name === "AbortError" || error.name === "TimeoutError") throw new StreamError(`The request was aborted due to to the ${this.apiConfig.timeout}ms timeout, you can set the timeout in the StreamClient constructor`, metadata, void 0, { cause: error });
12568
+ else throw new StreamError(`The request failed due to an unexpected error`, metadata, void 0, { cause: error });
12569
12569
  }
12570
12570
  };
12571
12571
  multipartBodyStringify = (body) => {
@@ -13374,7 +13374,8 @@ var FeedsApi = class {
13374
13374
  friend_reactions_options: request?.friend_reactions_options,
13375
13375
  interest_weights: request?.interest_weights,
13376
13376
  member_pagination: request?.member_pagination,
13377
- user: request?.user
13377
+ user: request?.user,
13378
+ viewer_location: request?.viewer_location
13378
13379
  };
13379
13380
  const response = await this.apiClient.sendRequest("POST", "/api/v2/feeds/feed_groups/{feed_group_id}/feeds/{feed_id}", pathParams, queryParams, body);
13380
13381
  decoders["GetOrCreateFeedResponse"]?.(response);
@@ -14498,8 +14499,10 @@ exports.StreamCall = StreamCall;
14498
14499
  exports.StreamChannel = StreamChannel;
14499
14500
  exports.StreamChatClient = StreamChatClient;
14500
14501
  exports.StreamClient = StreamClient;
14502
+ exports.StreamError = StreamError;
14501
14503
  exports.StreamFeed = StreamFeed;
14502
14504
  exports.StreamFeedsClient = StreamFeedsClient;
14503
14505
  exports.StreamVideoClient = StreamVideoClient;
14506
+ exports.verifyAndParseWebhook = verifyAndParseWebhook;
14504
14507
 
14505
14508
  //# sourceMappingURL=index.cjs.js.map