@atproto/lex 0.1.0-next.0 → 0.1.1

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 +31 -12
  2. package/README.md +51 -8
  3. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,28 +1,47 @@
1
1
  # @atproto/lex
2
2
 
3
- ## 0.1.0-next.0
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4895](https://github.com/bluesky-social/atproto/pull/4895) [`25e0233`](https://github.com/bluesky-social/atproto/commit/25e02339a383740e762c9a9633a701d2fb0cab86) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add `applyWrites()` method to Lex SDK client class
8
+
9
+ Thank you [@TrySound](https://github.com/TrySound) for the suggestion
10
+
11
+ - Updated dependencies [[`e6c6343`](https://github.com/bluesky-social/atproto/commit/e6c6343bd3727455bd0da12300bb4929a944e4f1), [`e6c6343`](https://github.com/bluesky-social/atproto/commit/e6c6343bd3727455bd0da12300bb4929a944e4f1), [`fb1b403`](https://github.com/bluesky-social/atproto/commit/fb1b40350d46f3c49e512b7e24b071b03902e3b8), [`25e0233`](https://github.com/bluesky-social/atproto/commit/25e02339a383740e762c9a9633a701d2fb0cab86)]:
12
+ - @atproto/lex-client@0.1.1
13
+ - @atproto/lex-data@0.1.1
14
+ - @atproto/lex-builder@0.1.1
15
+
16
+ ## 0.1.0
4
17
 
5
18
  ### Minor Changes
6
19
 
7
- - [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`bb7491c`](https://github.com/bluesky-social/atproto/commit/bb7491c29e06181e1d2f8cf6eb454f9bb8ab961b) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Drop support for Node.js 18 and 20. Node.js 22 is now the minimum supported version. Docker images now use Node.js 24.
20
+ - [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Drop support for Node.js 18 and 20. Node.js 22 is now the minimum supported version. Docker images now use Node.js 24.
8
21
 
9
- - [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`07ae5d4`](https://github.com/bluesky-social/atproto/commit/07ae5d4452df51e045e0239da7a04cf0bc154028) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Convert to pure ESM. All packages now ship `"type": "module"` with ES module output and Node16 module resolution.
22
+ - [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Convert to pure ESM. All packages now ship `"type": "module"` with ES module output and Node16 module resolution.
10
23
 
11
24
  Node.js 22's `require()` compatibility layer can still load these packages in CommonJS code.
12
25
 
13
- - [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`042df15`](https://github.com/bluesky-social/atproto/commit/042df15087c0e62cd1e715fcbf58852fab875af9) Thanks [@devinivy](https://github.com/devinivy)! - Build with TypeScript 6.0. Emitted `.d.ts` files now use TypeScript 6's stricter `Uint8Array<ArrayBuffer>` typing in places where Web/Node APIs require buffer-backed (not shared-memory) byte arrays. Consumers compiling against these types on older TypeScript should see no runtime impact, but may need to widen or cast in spots that previously relied on `Uint8Array` defaulting to `<ArrayBufferLike>`.
26
+ - [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705) Thanks [@devinivy](https://github.com/devinivy)! - Build with TypeScript 6.0.
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [[`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c), [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9), [`affb50c`](https://github.com/bluesky-social/atproto/commit/affb50c040b497a12631df99a6310f8e78cab557), [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705)]:
31
+ - @atproto/lex-builder@0.1.0
32
+ - @atproto/lex-client@0.1.0
33
+ - @atproto/lex-data@0.1.0
34
+ - @atproto/lex-installer@0.1.0
35
+ - @atproto/lex-json@0.1.0
36
+ - @atproto/lex-schema@0.1.0
14
37
 
15
- Internal: tsconfig `moduleResolution: "node"` is silenced via `ignoreDeprecations: "6.0"` for now; the proper migration to `node16`/`bundler` resolution is deferred.
38
+ ## 0.0.27
16
39
 
17
40
  ### Patch Changes
18
41
 
19
- - Updated dependencies [[`bb7491c`](https://github.com/bluesky-social/atproto/commit/bb7491c29e06181e1d2f8cf6eb454f9bb8ab961b), [`07ae5d4`](https://github.com/bluesky-social/atproto/commit/07ae5d4452df51e045e0239da7a04cf0bc154028), [`042df15`](https://github.com/bluesky-social/atproto/commit/042df15087c0e62cd1e715fcbf58852fab875af9)]:
20
- - @atproto/lex-builder@0.1.0-next.0
21
- - @atproto/lex-client@0.1.0-next.0
22
- - @atproto/lex-data@0.1.0-next.0
23
- - @atproto/lex-installer@0.1.0-next.0
24
- - @atproto/lex-json@0.1.0-next.0
25
- - @atproto/lex-schema@0.1.0-next.0
42
+ - Updated dependencies [[`d8b2374`](https://github.com/bluesky-social/atproto/commit/d8b2374e1592d1dec65a33439791bc141f02397a)]:
43
+ - @atproto/lex-client@0.0.22
44
+ - @atproto/lex-installer@0.0.27
26
45
 
27
46
  ## 0.0.26
28
47
 
package/README.md CHANGED
@@ -231,7 +231,7 @@ import * as app from './lexicons/app.js'
231
231
  const post = app.bsky.feed.post.$build({
232
232
  // No need to specify $type when using $build
233
233
  text: 'Hello, world!',
234
- createdAt: l.toDatetimeString(new Date()),
234
+ createdAt: l.currentDatetimeString(),
235
235
  })
236
236
 
237
237
  // For runtime validation, use $parse()/$validate() instead
@@ -275,7 +275,7 @@ import * as app from './lexicons/app.js'
275
275
  const data = {
276
276
  $type: 'app.bsky.feed.post',
277
277
  text: 'Hello!',
278
- createdAt: l.toDatetimeString(new Date()),
278
+ createdAt: l.currentDatetimeString(),
279
279
  }
280
280
 
281
281
  if (app.bsky.feed.post.$check(data)) {
@@ -296,7 +296,7 @@ try {
296
296
  const post = app.bsky.feed.post.$main.$parse({
297
297
  $type: 'app.bsky.feed.post',
298
298
  text: 'Hello!',
299
- createdAt: l.toDatetimeString(new Date()),
299
+ createdAt: l.currentDatetimeString(),
300
300
  })
301
301
  // post is now typed and validated
302
302
  console.log(post.text)
@@ -320,7 +320,7 @@ import * as app from './lexicons/app.js'
320
320
  const value = {
321
321
  $type: 'app.bsky.feed.post',
322
322
  text: 'Hello!',
323
- createdAt: l.toDatetimeString(new Date()),
323
+ createdAt: l.currentDatetimeString(),
324
324
  }
325
325
 
326
326
  // Throws if no valid
@@ -340,7 +340,7 @@ import * as app from './lexicons/app.js'
340
340
  const result = app.bsky.feed.post.$safeParse({
341
341
  $type: 'app.bsky.feed.post',
342
342
  text: 'Hello!',
343
- createdAt: l.toDatetimeString(new Date()),
343
+ createdAt: l.currentDatetimeString(),
344
344
  })
345
345
 
346
346
  if (result.success) {
@@ -374,7 +374,7 @@ const like = app.bsky.feed.like.$build({
374
374
  uri: 'at://did:plc:abc/app.bsky.feed.post/123',
375
375
  cid: 'bafyrei...',
376
376
  },
377
- createdAt: l.toDatetimeString(new Date()),
377
+ createdAt: l.currentDatetimeString(),
378
378
  })
379
379
  ```
380
380
 
@@ -655,7 +655,7 @@ import * as app from './lexicons/app.js'
655
655
 
656
656
  const result = await client.create(app.bsky.feed.post, {
657
657
  text: 'Hello, world!',
658
- createdAt: l.toDatetimeString(new Date()),
658
+ createdAt: l.currentDatetimeString(),
659
659
  })
660
660
 
661
661
  console.log(result.uri) // at://did:plc:...
@@ -749,6 +749,49 @@ if (result.cursor) {
749
749
  }
750
750
  ```
751
751
 
752
+ #### `client.applyWrites()`
753
+
754
+ Perform an atomic batch of create, update, and delete operations in a single request.
755
+
756
+ ```typescript
757
+ import { l } from '@atproto/lex'
758
+ import * as app from './lexicons/app.js'
759
+
760
+ const response = await client.applyWrites((op) => [
761
+ // Create a new post
762
+ op.create(app.bsky.feed.post, {
763
+ text: 'Hello, world!',
764
+ createdAt: l.currentDatetimeString(),
765
+ }),
766
+
767
+ // Update profile
768
+ op.update(app.bsky.actor.profile, {
769
+ displayName: 'Alice',
770
+ description: 'Updated bio',
771
+ }),
772
+
773
+ // Delete an existing post by rkey
774
+ op.delete(app.bsky.feed.post, {
775
+ rkey: '3jxf7z2k3q2',
776
+ }),
777
+ ])
778
+
779
+ // Check results
780
+ for (const result of response.body.results) {
781
+ console.log(result.uri, result.cid)
782
+ }
783
+ ```
784
+
785
+ Options:
786
+
787
+ - `repo` - Repository identifier (defaults to authenticated user's DID)
788
+ - `validate` - Asks the PDS to validate records against schema
789
+ - `swapCommit` - CID for optimistic concurrency control
790
+
791
+ > [!NOTE]
792
+ >
793
+ > All operations in an `applyWrites()` call are atomic - they either all succeed or all fail together. This is useful for maintaining consistency when making multiple related changes.
794
+
752
795
  ### Error Handling
753
796
 
754
797
  By default, all client methods throw errors when requests fail. For more ergonomic error handling, the client provides "Safe" variants that return errors instead of throwing them.
@@ -1174,7 +1217,7 @@ export const likePost: Action<
1174
1217
  app.bsky.feed.like,
1175
1218
  {
1176
1219
  subject: { uri, cid },
1177
- createdAt: l.toDatetimeString(new Date()),
1220
+ createdAt: l.currentDatetimeString(),
1178
1221
  },
1179
1222
  options,
1180
1223
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/lex",
3
- "version": "0.1.0-next.0",
3
+ "version": "0.1.1",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },
@@ -37,12 +37,12 @@
37
37
  "dependencies": {
38
38
  "tslib": "^2.8.1",
39
39
  "yargs": "^17.0.0",
40
- "@atproto/lex-installer": "^0.1.0-next.0",
41
- "@atproto/lex-json": "^0.1.0-next.0",
42
- "@atproto/lex-schema": "^0.1.0-next.0",
43
- "@atproto/lex-builder": "^0.1.0-next.0",
44
- "@atproto/lex-data": "^0.1.0-next.0",
45
- "@atproto/lex-client": "^0.1.0-next.0"
40
+ "@atproto/lex-builder": "^0.1.1",
41
+ "@atproto/lex-client": "^0.1.1",
42
+ "@atproto/lex-data": "^0.1.1",
43
+ "@atproto/lex-json": "^0.1.0",
44
+ "@atproto/lex-installer": "^0.1.0",
45
+ "@atproto/lex-schema": "^0.1.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/yargs": "^17.0.33",