@atproto/lex 0.4.7 → 0.5.0

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +15 -0
  3. package/package.json +6 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atproto/lex
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#5917](https://github.com/bluesky-social/atproto/pull/5917) [`b5dfe0b`](https://github.com/bluesky-social/atproto/commit/b5dfe0b80ac4f14f56b3c9b797e0e50d2e194a3b) Thanks [@matthieusieben](https://github.com/matthieusieben)! - **Breaking:** the response payload of methods without a declared output encoding is no longer parsed as JSON. It is returned as binary data (a `Uint8Array`, or a `ReadableStream` with `xrpcStream()`), or `undefined` when there is none, and callers that expect JSON must parse it themselves (e.g. `lexParse(new TextDecoder().decode(body))`). Only `application/json` outputs, and outputs with a schema, are parsed.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#5917](https://github.com/bluesky-social/atproto/pull/5917) [`b5dfe0b`](https://github.com/bluesky-social/atproto/commit/b5dfe0b80ac4f14f56b3c9b797e0e50d2e194a3b) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add `xrpcStream()` / `xrpcStreamSafe()` (and `Client.xrpcStream()`, `Client.xrpcStreamSafe()`, `Client.getBlobStream()`), returning binary response payloads as an unread `ReadableStream` through a disposable `XrpcStreamResponse`. Response bodies are now always released (cancelled) when response processing fails, as configured by the new `onCancellationError` response option (defaults to `"propagate"`).
12
+ - Updated dependencies [[`b5dfe0b`](https://github.com/bluesky-social/atproto/commit/b5dfe0b80ac4f14f56b3c9b797e0e50d2e194a3b), [`b5dfe0b`](https://github.com/bluesky-social/atproto/commit/b5dfe0b80ac4f14f56b3c9b797e0e50d2e194a3b)]:
13
+ - @atproto/lex-client@0.5.0
14
+ - @atproto/lex-installer@0.2.9
15
+
16
+ ## 0.4.8
17
+
18
+ ### Patch Changes
19
+
20
+ - [#5855](https://github.com/bluesky-social/atproto/pull/5855) [`ac78dcf`](https://github.com/bluesky-social/atproto/commit/ac78dcf2cba6505f822b6db093a14d489eee1c49) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Fix CBOR option declarations so strict NodeNext consumers can import Lex without checking cborg's incompatible declarations. Add a packed-consumer regression check for both entrypoints.
21
+ - Updated dependencies [[`ac78dcf`](https://github.com/bluesky-social/atproto/commit/ac78dcf2cba6505f822b6db093a14d489eee1c49)]:
22
+ - @atproto/lex-cbor@0.1.10
23
+ - @atproto/lex-installer@0.2.8
24
+
3
25
  ## 0.4.7
4
26
 
5
27
  ### Patch Changes
@@ -83,6 +105,12 @@
83
105
  - @atproto/lex-client@0.4.0
84
106
  - @atproto/lex-schema@0.2.9
85
107
 
108
+ ## 0.3.15
109
+
110
+ ### Patch Changes
111
+
112
+ - [`631ac94`](https://github.com/bluesky-social/atproto/commit/631ac946b2a2ec45c8f49921966f6a557f1666c6) Fix conflicting `walk` exports when resolving newer `@atproto/lex-schema` releases. Explicitly re-export the original Lex 0.3 implementation to preserve its API and traversal behavior.
113
+
86
114
  ## 0.3.14
87
115
 
88
116
  ### Patch Changes
package/README.md CHANGED
@@ -1131,6 +1131,21 @@ const response = await client.xrpc(app.bsky.feed.getTimeline, {
1131
1131
  })
1132
1132
  ```
1133
1133
 
1134
+ #### Streaming binary responses
1135
+
1136
+ Binary (non JSON) response payloads are read into a `Uint8Array` by default. Use `client.xrpcStream()`, `client.xrpcStreamSafe()` or `client.getBlobStream()` to get the unread `ReadableStream` instead, as an `XrpcStreamResponse`. These only accept methods declaring a binary output (a non-JSON encoding, without schema) or no output encoding at all, and error responses are always buffered. The payload of methods without an output encoding is never parsed: it is returned as binary data (if any), in both modes.
1137
+
1138
+ ```typescript
1139
+ // Disposing of the response cancels the stream if it was not fully consumed
1140
+ await using response = await client.getBlobStream(did, cid)
1141
+
1142
+ for await (const chunk of response.body) {
1143
+ // ...
1144
+ }
1145
+ ```
1146
+
1147
+ The caller owns the returned stream and must either consume or cancel it, through `response.cancel()` or by disposing of the response (`await using`, which follows the `onCancellationError` option). The results of `xrpcStreamSafe()`, including failures, are disposable without narrowing. Fetch implementations that do not expose response bodies as streams (e.g. React Native's built-in `fetch`) cause an `XrpcInternalError`.
1148
+
1134
1149
  ## Utilities
1135
1150
 
1136
1151
  Various utilities for working with CIDs, datetime strings, string lengths, language tags, and low-level JSON encoding are exported from the package:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/lex",
3
- "version": "0.4.7",
3
+ "version": "0.5.0",
4
4
  "license": "MIT",
5
5
  "description": "Lexicon tooling for AT",
6
6
  "keywords": [
@@ -37,11 +37,11 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@atproto/lex-builder": "^0.1.20",
40
- "@atproto/lex-cbor": "^0.1.9",
41
- "@atproto/lex-client": "^0.4.2",
40
+ "@atproto/lex-cbor": "^0.1.10",
41
+ "@atproto/lex-client": "^0.5.0",
42
42
  "@atproto/lex-data": "^0.1.10",
43
43
  "@atproto/lex-json": "^0.1.9",
44
- "@atproto/lex-installer": "^0.2.7",
44
+ "@atproto/lex-installer": "^0.2.9",
45
45
  "@atproto/lex-schema": "^0.2.11",
46
46
  "tslib": "^2.8.1",
47
47
  "yargs": "^18.2.0"
@@ -54,6 +54,7 @@
54
54
  "codegen:lex": "./bin/lex build --override --indexFile --lexicons ./lexicons --out ./tests/lexicons --lib @atproto/lex-schema",
55
55
  "prebuild": "pnpm run '/^(codegen:.+)$/'",
56
56
  "build": "tsc --build tsconfig.build.json",
57
- "test": "vitest run"
57
+ "test": "vitest run",
58
+ "verify:declarations": "node ./verify-declarations.mjs"
58
59
  }
59
60
  }