@atproto/lex-client 0.3.6 → 0.4.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 (135) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +4 -3
  3. package/dist/client.d.ts +4 -11
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +6 -12
  6. package/dist/client.js.map +1 -1
  7. package/dist/index.d.ts +2 -5
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +2 -5
  10. package/dist/index.js.map +1 -1
  11. package/dist/lexicons/com/atproto/repo/applyWrites.d.ts +2 -2
  12. package/dist/lexicons/com/atproto/repo/applyWrites.d.ts.map +1 -1
  13. package/dist/lexicons/com/atproto/repo/applyWrites.defs.d.ts +23 -23
  14. package/dist/lexicons/com/atproto/repo/applyWrites.defs.d.ts.map +1 -1
  15. package/dist/lexicons/com/atproto/repo/applyWrites.defs.js +13 -64
  16. package/dist/lexicons/com/atproto/repo/applyWrites.defs.js.map +1 -1
  17. package/dist/lexicons/com/atproto/repo/applyWrites.js +2 -2
  18. package/dist/lexicons/com/atproto/repo/applyWrites.js.map +1 -1
  19. package/dist/lexicons/com/atproto/repo/createRecord.d.ts +2 -2
  20. package/dist/lexicons/com/atproto/repo/createRecord.d.ts.map +1 -1
  21. package/dist/lexicons/com/atproto/repo/createRecord.defs.d.ts +2 -2
  22. package/dist/lexicons/com/atproto/repo/createRecord.defs.d.ts.map +1 -1
  23. package/dist/lexicons/com/atproto/repo/createRecord.defs.js +6 -24
  24. package/dist/lexicons/com/atproto/repo/createRecord.defs.js.map +1 -1
  25. package/dist/lexicons/com/atproto/repo/createRecord.js +2 -2
  26. package/dist/lexicons/com/atproto/repo/createRecord.js.map +1 -1
  27. package/dist/lexicons/com/atproto/repo/defs.d.ts +1 -1
  28. package/dist/lexicons/com/atproto/repo/defs.d.ts.map +1 -1
  29. package/dist/lexicons/com/atproto/repo/defs.defs.d.ts +4 -4
  30. package/dist/lexicons/com/atproto/repo/defs.defs.d.ts.map +1 -1
  31. package/dist/lexicons/com/atproto/repo/defs.defs.js +3 -7
  32. package/dist/lexicons/com/atproto/repo/defs.defs.js.map +1 -1
  33. package/dist/lexicons/com/atproto/repo/defs.js +1 -1
  34. package/dist/lexicons/com/atproto/repo/defs.js.map +1 -1
  35. package/dist/lexicons/com/atproto/repo/deleteRecord.d.ts +2 -2
  36. package/dist/lexicons/com/atproto/repo/deleteRecord.d.ts.map +1 -1
  37. package/dist/lexicons/com/atproto/repo/deleteRecord.defs.d.ts +2 -2
  38. package/dist/lexicons/com/atproto/repo/deleteRecord.defs.d.ts.map +1 -1
  39. package/dist/lexicons/com/atproto/repo/deleteRecord.defs.js +6 -19
  40. package/dist/lexicons/com/atproto/repo/deleteRecord.defs.js.map +1 -1
  41. package/dist/lexicons/com/atproto/repo/deleteRecord.js +2 -2
  42. package/dist/lexicons/com/atproto/repo/deleteRecord.js.map +1 -1
  43. package/dist/lexicons/com/atproto/repo/getRecord.d.ts +2 -2
  44. package/dist/lexicons/com/atproto/repo/getRecord.d.ts.map +1 -1
  45. package/dist/lexicons/com/atproto/repo/getRecord.defs.d.ts +1 -1
  46. package/dist/lexicons/com/atproto/repo/getRecord.defs.d.ts.map +1 -1
  47. package/dist/lexicons/com/atproto/repo/getRecord.defs.js +5 -14
  48. package/dist/lexicons/com/atproto/repo/getRecord.defs.js.map +1 -1
  49. package/dist/lexicons/com/atproto/repo/getRecord.js +2 -2
  50. package/dist/lexicons/com/atproto/repo/getRecord.js.map +1 -1
  51. package/dist/lexicons/com/atproto/repo/listRecords.d.ts +2 -2
  52. package/dist/lexicons/com/atproto/repo/listRecords.d.ts.map +1 -1
  53. package/dist/lexicons/com/atproto/repo/listRecords.defs.d.ts +5 -5
  54. package/dist/lexicons/com/atproto/repo/listRecords.defs.d.ts.map +1 -1
  55. package/dist/lexicons/com/atproto/repo/listRecords.defs.js +5 -22
  56. package/dist/lexicons/com/atproto/repo/listRecords.defs.js.map +1 -1
  57. package/dist/lexicons/com/atproto/repo/listRecords.js +2 -2
  58. package/dist/lexicons/com/atproto/repo/listRecords.js.map +1 -1
  59. package/dist/lexicons/com/atproto/repo/putRecord.d.ts +2 -2
  60. package/dist/lexicons/com/atproto/repo/putRecord.d.ts.map +1 -1
  61. package/dist/lexicons/com/atproto/repo/putRecord.defs.d.ts +2 -2
  62. package/dist/lexicons/com/atproto/repo/putRecord.defs.d.ts.map +1 -1
  63. package/dist/lexicons/com/atproto/repo/putRecord.defs.js +6 -25
  64. package/dist/lexicons/com/atproto/repo/putRecord.defs.js.map +1 -1
  65. package/dist/lexicons/com/atproto/repo/putRecord.js +2 -2
  66. package/dist/lexicons/com/atproto/repo/putRecord.js.map +1 -1
  67. package/dist/lexicons/com/atproto/repo/uploadBlob.d.ts +2 -2
  68. package/dist/lexicons/com/atproto/repo/uploadBlob.d.ts.map +1 -1
  69. package/dist/lexicons/com/atproto/repo/uploadBlob.defs.d.ts +1 -1
  70. package/dist/lexicons/com/atproto/repo/uploadBlob.defs.d.ts.map +1 -1
  71. package/dist/lexicons/com/atproto/repo/uploadBlob.defs.js +4 -6
  72. package/dist/lexicons/com/atproto/repo/uploadBlob.defs.js.map +1 -1
  73. package/dist/lexicons/com/atproto/repo/uploadBlob.js +2 -2
  74. package/dist/lexicons/com/atproto/repo/uploadBlob.js.map +1 -1
  75. package/dist/lexicons/com/atproto/repo.d.ts +8 -8
  76. package/dist/lexicons/com/atproto/repo.d.ts.map +1 -1
  77. package/dist/lexicons/com/atproto/repo.js +8 -8
  78. package/dist/lexicons/com/atproto/repo.js.map +1 -1
  79. package/dist/lexicons/com/atproto/sync/getBlob.d.ts +2 -2
  80. package/dist/lexicons/com/atproto/sync/getBlob.d.ts.map +1 -1
  81. package/dist/lexicons/com/atproto/sync/getBlob.defs.d.ts +1 -1
  82. package/dist/lexicons/com/atproto/sync/getBlob.defs.d.ts.map +1 -1
  83. package/dist/lexicons/com/atproto/sync/getBlob.defs.js +5 -14
  84. package/dist/lexicons/com/atproto/sync/getBlob.defs.js.map +1 -1
  85. package/dist/lexicons/com/atproto/sync/getBlob.js +2 -2
  86. package/dist/lexicons/com/atproto/sync/getBlob.js.map +1 -1
  87. package/dist/lexicons/com/atproto/sync.d.ts +1 -1
  88. package/dist/lexicons/com/atproto/sync.d.ts.map +1 -1
  89. package/dist/lexicons/com/atproto/sync.js +1 -1
  90. package/dist/lexicons/com/atproto/sync.js.map +1 -1
  91. package/dist/lexicons/com/atproto.d.ts +2 -2
  92. package/dist/lexicons/com/atproto.d.ts.map +1 -1
  93. package/dist/lexicons/com/atproto.js +2 -2
  94. package/dist/lexicons/com/atproto.js.map +1 -1
  95. package/dist/lexicons/com.d.ts +1 -1
  96. package/dist/lexicons/com.d.ts.map +1 -1
  97. package/dist/lexicons/com.js +1 -1
  98. package/dist/lexicons/com.js.map +1 -1
  99. package/dist/lexicons/index.d.ts +1 -1
  100. package/dist/lexicons/index.d.ts.map +1 -1
  101. package/dist/lexicons/index.js +1 -1
  102. package/dist/lexicons/index.js.map +1 -1
  103. package/dist/write-operation-builder.d.ts +1 -1
  104. package/dist/write-operation-builder.d.ts.map +1 -1
  105. package/dist/write-operation-builder.js +4 -4
  106. package/dist/write-operation-builder.js.map +1 -1
  107. package/package.json +14 -7
  108. package/dist/agent.d.ts +0 -127
  109. package/dist/agent.d.ts.map +0 -1
  110. package/dist/agent.js +0 -41
  111. package/dist/agent.js.map +0 -1
  112. package/dist/errors.d.ts +0 -277
  113. package/dist/errors.d.ts.map +0 -1
  114. package/dist/errors.js +0 -388
  115. package/dist/errors.js.map +0 -1
  116. package/dist/response.d.ts +0 -124
  117. package/dist/response.d.ts.map +0 -1
  118. package/dist/response.js +0 -178
  119. package/dist/response.js.map +0 -1
  120. package/dist/types.d.ts +0 -54
  121. package/dist/types.d.ts.map +0 -1
  122. package/dist/types.js +0 -16
  123. package/dist/types.js.map +0 -1
  124. package/dist/util.d.ts +0 -90
  125. package/dist/util.d.ts.map +0 -1
  126. package/dist/util.js +0 -210
  127. package/dist/util.js.map +0 -1
  128. package/dist/www-authenticate.d.ts +0 -35
  129. package/dist/www-authenticate.d.ts.map +0 -1
  130. package/dist/www-authenticate.js +0 -54
  131. package/dist/www-authenticate.js.map +0 -1
  132. package/dist/xrpc.d.ts +0 -194
  133. package/dist/xrpc.d.ts.map +0 -1
  134. package/dist/xrpc.js +0 -235
  135. package/dist/xrpc.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atproto/lex-client
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#5591](https://github.com/bluesky-social/atproto/pull/5591) [`f98b78a`](https://github.com/bluesky-social/atproto/commit/f98b78adbc8963e49823117b007422211f6d3ff2) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Refactor around a new, lower-level, `@atproto/lex-rpc` package for making XRPC requests. `@atproto/lex-client` re-exports everything from `@atproto/lex-rpc`, allowing it to stay backwards compatible, and contains logic related to making XRPC requests in the context of manipulating an AT Protocol repository with an authenticated session. This refactor also allows `@atproto/lex-client` to depend on `@atproto/lex-installer`, while also allowing `@atproto/lex-installer` to make XRPC requests (using the lower level `@atproto/lex-rpc`).
8
+
9
+ ### Patch Changes
10
+
11
+ - [#5591](https://github.com/bluesky-social/atproto/pull/5591) [`f98b78a`](https://github.com/bluesky-social/atproto/commit/f98b78adbc8963e49823117b007422211f6d3ff2) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Build lexicon schemas using the `lex-builder` cli instead of a custom script
12
+
13
+ - [#5591](https://github.com/bluesky-social/atproto/pull/5591) [`f98b78a`](https://github.com/bluesky-social/atproto/commit/f98b78adbc8963e49823117b007422211f6d3ff2) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Source Lexicons through each package's own `lexicons.json` manifest instead of compiling the repo-root `lexicons` directory directly. Canonical `com.atproto.*` / `tools.ozone.*` schemas are symlinked from the root, `app.bsky.*` / `chat.bsky.*` are fetched from the `bluesky-social/bsky` Github repo, other external namespaces resolve from the network, and locally diverging documents are kept under a tracked `lexicons-overrides` directory. The root `lexicons` directory now only holds the canonical `com.atproto` and `tools.ozone` namespaces. No change to generated output or published API.
14
+
15
+ - [#5591](https://github.com/bluesky-social/atproto/pull/5591) [`f98b78a`](https://github.com/bluesky-social/atproto/commit/f98b78adbc8963e49823117b007422211f6d3ff2) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Validate `rkey` when calling record operations methods
16
+
17
+ - [#5591](https://github.com/bluesky-social/atproto/pull/5591) [`f98b78a`](https://github.com/bluesky-social/atproto/commit/f98b78adbc8963e49823117b007422211f6d3ff2) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Expose `rkeyFor` and `rkeyForCreate` utilities
18
+ - Updated dependencies [[`f98b78a`](https://github.com/bluesky-social/atproto/commit/f98b78adbc8963e49823117b007422211f6d3ff2), [`f98b78a`](https://github.com/bluesky-social/atproto/commit/f98b78adbc8963e49823117b007422211f6d3ff2)]:
19
+ - @atproto/lex-schema@0.2.9
20
+ - @atproto/lex-rpc@0.0.1
21
+
22
+ ## 0.3.7
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [[`e8b89ff`](https://github.com/bluesky-social/atproto/commit/e8b89ff4c211a10519b54bd83eb64950035942c3)]:
27
+ - @atproto/lex-data@0.1.8
28
+ - @atproto/lex-json@0.1.7
29
+ - @atproto/lex-schema@0.2.8
30
+
3
31
  ## 0.3.6
4
32
 
5
33
  ### Patch Changes
package/README.md CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  - [Changelog](./CHANGELOG.md)
4
4
  - [`@atproto/lex` documentation](https://github.com/bluesky-social/atproto/blob/main/packages/lex/lex/README.md)
5
+ - [`@atproto/lex-rpc` low-level XRPC utilities](https://github.com/bluesky-social/atproto/blob/main/packages/lex/lex-rpc/README.md)
5
6
 
6
- Type-safe HTTP ([XRPC](https://atproto.com/specs/xrpc)) client for Lexicon-defined APIs: the `Client` class for working with records in the context of an authenticated session, and the lower-level `xrpc()` / `xrpcSafe()` functions.
7
+ Type-safe HTTP ([XRPC](https://atproto.com/specs/xrpc)) client for Lexicon-defined APIs: the `Client` class for working with a user's PDS (records) in the context of an authenticated session.
7
8
 
8
- Requests are validated against schemas generated by `lex build`. Authentication is supplied through an `Agent`, implemented by [`@atproto/oauth-client`](https://github.com/bluesky-social/atproto/tree/main/packages/oauth/oauth-client) or, for scripts and bots, [`@atproto/lex-password-session`](https://github.com/bluesky-social/atproto/tree/main/packages/lex/lex-password-session).
9
+ Authentication is supplied through an `Agent`, implemented by [`@atproto/oauth-client`](https://github.com/bluesky-social/atproto/tree/main/packages/oauth/oauth-client) or, for scripts and bots, [`@atproto/lex-password-session`](https://github.com/bluesky-social/atproto/tree/main/packages/lex/lex-password-session).
9
10
 
10
- This is a building block of [`@atproto/lex`](https://github.com/bluesky-social/atproto/tree/main/packages/lex/lex), which re-exports it — prefer depending on that package.
11
+ This is a building block of [`@atproto/lex`](https://github.com/bluesky-social/atproto/tree/main/packages/lex/lex), which re-exports it -- prefer depending on that package.
11
12
 
12
13
  ## License
13
14
 
package/dist/client.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- import type { LexMap, LexValue, TypedLexMap } from '@atproto/lex-data';
2
- import type { AtIdentifierString, AtUriString, CidString, DidString, Infer, InferMethodInputBody, InferMethodOutputBody, InferRecordKey, LexiconRecordKey, Main, NsidString, Params, Restricted } from '@atproto/lex-schema';
3
- import { Procedure, Query, RecordSchema } from '@atproto/lex-schema';
4
- import type { Agent, AgentOptions } from './agent.js';
5
- import type { XrpcFailure } from './errors.js';
1
+ import type { LexMap, TypedLexMap } from '@atproto/lex-data';
2
+ import { type Agent, type AgentOptions, type BinaryBodyInit, type RecordKeyOptions, type Service, type XrpcFailure, type XrpcOptions, type XrpcRequestHeadersOptions, type XrpcRequestParams, type XrpcRequestProcessingOptions, type XrpcResponse, type XrpcResponseBody, type XrpcResponseOptions } from '@atproto/lex-rpc';
3
+ import { type AtIdentifierString, type AtUriString, type CidString, type DidString, type Infer, type InferMethodInputBody, type InferMethodOutputBody, type Main, type NsidString, Procedure, Query, type RecordSchema, type Restricted } from '@atproto/lex-schema';
6
4
  import applyWrites from './lexicons/com/atproto/repo/applyWrites.js';
7
5
  import createRecord from './lexicons/com/atproto/repo/createRecord.js';
8
6
  import deleteRecord from './lexicons/com/atproto/repo/deleteRecord.js';
@@ -11,12 +9,7 @@ import listRecords from './lexicons/com/atproto/repo/listRecords.js';
11
9
  import putRecord from './lexicons/com/atproto/repo/putRecord.js';
12
10
  import uploadBlob from './lexicons/com/atproto/repo/uploadBlob.js';
13
11
  import getBlob from './lexicons/com/atproto/sync/getBlob.js';
14
- import type { XrpcResponse, XrpcResponseBody, XrpcResponseOptions } from './response.js';
15
- import { type BinaryBodyInit, type Service } from './types.js';
16
- import { type RecordKeyOptions, type XrpcRequestHeadersOptions } from './util.js';
17
- import { type WriteOperation, type WriteOperationCreateOptions, type WriteOperationDeleteOptions, WriteOperationHelper, type WriteOperationUpdateOptions, type WriteOperationsFactory } from './write-operation-builder.js';
18
- import { type XrpcOptions, type XrpcRequestParams, type XrpcRequestProcessingOptions } from './xrpc.js';
19
- export { type AtIdentifierString, type CidString, type DidString, type Infer, type InferMethodInputBody, type InferMethodOutputBody, type InferRecordKey, type LexMap, type LexValue, type LexiconRecordKey, type Main, type NsidString, type Params, Procedure, Query, RecordSchema, type Restricted, type TypedLexMap, type WriteOperation, type WriteOperationCreateOptions, type WriteOperationDeleteOptions, WriteOperationHelper, type WriteOperationUpdateOptions, type WriteOperationsFactory, };
12
+ import { type WriteOperationsFactory } from './write-operation-builder.js';
20
13
  /**
21
14
  * Configuration options for creating a {@link Client}.
22
15
  *
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,KAAK,EACV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K,CAAC,CAAC,SAAS,YAAY,EACrC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EACX,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAKxB;IAED;;;;;;;;;;OAUG;IACI,OAAO,CAAC,KAAK,CAAC,CAAC,SAAS,YAAY,EACzC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EACX,EAAE,UAAc,EAAE,GAAG,OAAO,EAAE,GAAE,WAAgB,GAC/C,cAAc,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAyBzD;CACF"}
package/dist/client.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Procedure, Query, RecordSchema, getMain } from '@atproto/lex-schema';
2
- import { buildAgent } from './agent.js';
1
+ import { applyDefaults, buildAgent, isService, mergeHeaders, rkeyFor, rkeyForCreate, throwIfAborted, xrpc, xrpcSafe, } from '@atproto/lex-rpc';
2
+ import { Procedure, Query, getMain, } from '@atproto/lex-schema';
3
3
  // @NOTE We could use import { com } from "./lexicons/index.js" here, but some
4
4
  // consumers might not know how to properly tree-shake that, so we import only
5
5
  // the needed lexicon schemas directly.
@@ -11,11 +11,7 @@ import listRecords, {} from './lexicons/com/atproto/repo/listRecords.js';
11
11
  import putRecord from './lexicons/com/atproto/repo/putRecord.js';
12
12
  import uploadBlob from './lexicons/com/atproto/repo/uploadBlob.js';
13
13
  import getBlob from './lexicons/com/atproto/sync/getBlob.js';
14
- import { isService } from './types.js';
15
- import { applyDefaults, getDefaultRecordKey, getLiteralRecordKey, mergeHeaders, throwIfAborted, } from './util.js';
16
14
  import { WriteOperationHelper, } from './write-operation-builder.js';
17
- import { xrpc, xrpcSafe, } from './xrpc.js';
18
- export { Procedure, Query, RecordSchema, WriteOperationHelper, };
19
15
  /**
20
16
  * The Client class is the primary interface for interacting with AT Protocol
21
17
  * services. It provides type-safe methods for XRPC calls, record operations,
@@ -411,21 +407,19 @@ export class Client {
411
407
  const record = schema.build(input);
412
408
  if (options?.validateRequest)
413
409
  schema.validate(record);
414
- const rkey = options.rkey ?? getDefaultRecordKey(schema);
415
- if (rkey !== undefined)
416
- schema.keySchema.assert(rkey);
410
+ const rkey = rkeyForCreate(schema, options?.rkey);
417
411
  const response = await this.createRecord(record, rkey, options);
418
412
  return response.body;
419
413
  }
420
414
  async delete(ns, options = {}) {
421
415
  const schema = getMain(ns);
422
- const rkey = schema.keySchema.parse(options.rkey ?? getLiteralRecordKey(schema));
416
+ const rkey = rkeyFor(schema, options.rkey);
423
417
  const response = await this.deleteRecord(schema.$type, rkey, options);
424
418
  return response.body;
425
419
  }
426
420
  async get(ns, options = {}) {
427
421
  const schema = getMain(ns);
428
- const rkey = schema.keySchema.parse(options.rkey ?? getLiteralRecordKey(schema));
422
+ const rkey = rkeyFor(schema, options.rkey);
429
423
  const response = await this.getRecord(schema.$type, rkey, options);
430
424
  const value = schema.validate(response.body.value);
431
425
  return { ...response.body, value };
@@ -435,7 +429,7 @@ export class Client {
435
429
  const record = schema.build(input);
436
430
  if (options?.validateRequest)
437
431
  schema.validate(record);
438
- const rkey = options.rkey ?? getLiteralRecordKey(schema);
432
+ const rkey = rkeyFor(schema, options.rkey);
439
433
  const response = await this.putRecord(record, rkey, options);
440
434
  return response.body;
441
435
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,8EAA8E;AAC9E,8EAA8E;AAC9E,uCAAuC;AACvC,OAAO,WAAW,MAAM,4CAA4C,CAAA;AACpE,OAAO,YAAY,MAAM,6CAA6C,CAAA;AACtE,OAAO,YAAY,MAAM,6CAA6C,CAAA;AACtE,OAAO,SAAS,M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,MAAM,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,CAAA;QAE1B,GAAG,CAAC;YACF,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YAE9B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE;gBACpD,GAAG,OAAO;gBACV,UAAU;aACX,CAAC,CAAA;YAEF,yEAAyE;YACzE,0EAA0E;YAC1E,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClC,MAAM,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;YAC9C,CAAC;YAED,mEAAmE;YACnE,aAAa;YACb,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;gBAClD,OAAM;YACR,CAAC;YAED,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAC9B,CAAC,QAAQ,OAAO,CAAC,MAAM,EAAC;IAC1B,CAAC;CACF;AAED,SAAS,iBAAiB,CAExB,MAAyB;IAEzB,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC9C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAA;IACxD,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACpC,CAAC;AACH,CAAC","sourcesContent":["import type { LexMap, LexValue, TypedLexMap } from '@atproto/lex-data'\nimport type {\n AtIdentifierString,\n AtUriString,\n CidString,\n DidString,\n Infer,\n InferMethodInputBody,\n InferMethodOutputBody,\n InferRecordKey,\n LexiconRecordKey,\n Main,\n NsidString,\n Params,\n Restricted,\n} from '@atproto/lex-schema'\nimport { Procedure, Query, RecordSchema, getMain } from '@atproto/lex-schema'\nimport type { Agent, AgentOptions } from './agent.js'\nimport { buildAgent } from './agent.js'\nimport type { XrpcFailure } from './errors.js'\n// @NOTE We could use import { com } from \"./lexicons/index.js\" here, but some\n// consumers might not know how to properly tree-shake that, so we import only\n// the needed lexicon schemas directly.\nimport applyWrites from './lexicons/com/atproto/repo/applyWrites.js'\nimport createRecord from './lexicons/com/atproto/repo/createRecord.js'\nimport deleteRecord from './lexicons/com/atproto/repo/deleteRecord.js'\nimport getRecord from './lexicons/com/atproto/repo/getRecord.js'\nimport listRecords, {\n type Record as ListRecordsRecord,\n} from './lexicons/com/atproto/repo/listRecords.js'\nimport putRecord from './lexicons/com/atproto/repo/putRecord.js'\nimport uploadBlob from './lexicons/com/atproto/repo/uploadBlob.js'\nimport getBlob from './lexicons/com/atproto/sync/getBlob.js'\nimport type {\n XrpcResponse,\n XrpcResponseBody,\n XrpcResponseOptions,\n} from './response.js'\nimport { type BinaryBodyInit, type Service, isService } from './types.js'\nimport {\n type RecordKeyOptions,\n type XrpcRequestHeadersOptions,\n applyDefaults,\n getDefaultRecordKey,\n getLiteralRecordKey,\n mergeHeaders,\n throwIfAborted,\n} from './util.js'\nimport {\n type WriteOperation,\n type WriteOperationCreateOptions,\n type WriteOperationDeleteOptions,\n WriteOperationHelper,\n type WriteOperationUpdateOptions,\n type WriteOperationsFactory,\n} from './write-operation-builder.js'\nimport {\n type XrpcOptions,\n type XrpcRequestParams,\n type XrpcRequestProcessingOptions,\n xrpc,\n xrpcSafe,\n} from './xrpc.js'\n\nexport {\n type AtIdentifierString,\n type CidString,\n type DidString,\n type Infer,\n type InferMethodInputBody,\n type InferMethodOutputBody,\n type InferRecordKey,\n type LexMap,\n type LexValue,\n type LexiconRecordKey,\n type Main,\n type NsidString,\n type Params,\n Procedure,\n Query,\n RecordSchema,\n type Restricted,\n type TypedLexMap,\n type WriteOperation,\n type WriteOperationCreateOptions,\n type WriteOperationDeleteOptions,\n WriteOperationHelper,\n type WriteOperationUpdateOptions,\n type WriteOperationsFactory,\n}\n\n/**\n * Configuration options for creating a {@link Client}.\n *\n * @property {@link ClientOptions.labelers} - An iterable of labeler DIDs to include in requests. These will be combined with any global app labelers configured via {@link Client.configure}.\n * @property {@link ClientOptions.service} - An optional service identifier (DID or URL) for routing requests with service proxying.\n * @property {@link ClientOptions.headers} - Custom headers to include in all requests made by this client instance.\n * @property {@link ClientOptions.validateRequest} - If true, validates request bodies against their lexicon schemas before sending. Defaults to false for performance.\n * @property {@link ClientOptions.validateResponse} - If false, skips validation of response bodies against their lexicon schemas. Defaults to true to catch errors, but can be disabled for performance if you trust the server responses. Note that defaults will not be applied if validation is disabled, which can cause typing inconsistencies, so use with caution.\n * @property {@link ClientOptions.strictResponseProcessing} - If false, relaxes certain validation rules during response processing (e.g., allowing floats, deeper nesting, etc.). Defaults to true for strict compliance with {@link https://atproto.com/specs/data-model lexicon data model}, but can be disabled to handle non-compliant responses.\n *\n * @see {@link XrpcRequestHeadersOptions}\n * @see {@link XrpcRequestProcessingOptions}\n * @see {@link XrpcResponseOptions}\n *\n * @example\n * ```typescript\n * const options: ClientOptions = {\n * labelers: ['did:plc:labeler1'],\n * service: 'did:web:api.bsky.app#bsky_appview',\n * headers: { 'X-Custom-Header': 'value' },\n * validateRequest: false,\n * validateResponse: true,\n * strictResponseProcessing: false,\n * }\n * ```\n */\nexport type ClientOptions = XrpcRequestHeadersOptions &\n Pick<XrpcRequestProcessingOptions, 'validateRequest'> &\n XrpcResponseOptions\n\nexport type ActionOptions = {\n /** AbortSignal to cancel the request. */\n signal?: AbortSignal\n}\n\n/**\n * A composable action that can be invoked via {@link Client.call}.\n *\n * Actions provide a way to define custom operations that integrate with the\n * Client's call interface, enabling type-safe, reusable business logic.\n *\n * @typeParam I - The input type for the action\n * @typeParam O - The output type for the action\n *\n * @example\n * ```typescript\n * const myAction: Action<{ userId: string }, { profile: Profile }> = async (client, input, options) => {\n * const response = await client.xrpc(someMethod, { params: { actor: input.userId }, ...options })\n * return { profile: response.body }\n * }\n * ```\n */\nexport type Action<I = any, O = any> = (\n client: Client,\n input: I,\n options: ActionOptions,\n) => O | Promise<O>\n\n/**\n * Extracts the input type from an {@link Action}.\n * @typeParam A - The Action type to extract from\n */\nexport type InferActionInput<A extends Action> =\n A extends Action<infer I, any> ? I : never\n\n/**\n * Extracts the output type from an {@link Action}.\n * @typeParam A - The Action type to extract from\n */\nexport type InferActionOutput<A extends Action> =\n A extends Action<any, infer O> ? O : never\n\n/**\n * Options for creating a record in an AT Protocol repository.\n *\n * @see {@link Client.createRecord}\n */\nexport type CreateRecordOptions = Omit<\n XrpcOptions<typeof createRecord>,\n 'body'\n> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n /** Compare-and-swap on the repo commit. If specified, must match current commit. */\n swapCommit?: string\n /**\n * Whether the PDS should validate the record against its lexicon schema.\n * When `true`, the PDS is asked to explicitly validate the record. When\n * `false`, the PDS is asked to explicitly skip validation. When `undefined`\n * (default), the PDS decides -- typically validating only collections whose\n * schemas it knows. This is server-side validation; for client-side\n * validation before sending, use {@link XrpcRequestProcessingOptions.validateRequest}.\n */\n validate?: boolean\n}\n\n/**\n * Options for deleting a record from an AT Protocol repository.\n *\n * @see {@link Client.deleteRecord}\n */\nexport type DeleteRecordOptions = Omit<\n XrpcOptions<typeof deleteRecord>,\n 'body'\n> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n /** Compare-and-swap on the repo commit. If specified, must match current commit. */\n swapCommit?: string\n /** Compare-and-swap on the record CID. If specified, must match current record. */\n swapRecord?: string\n}\n\n/**\n * Options for retrieving a record from an AT Protocol repository.\n *\n * @see {@link Client.getRecord}\n */\nexport type GetRecordOptions = Omit<XrpcOptions<typeof getRecord>, 'params'> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n}\n\n/**\n * Options for creating or updating a record in an AT Protocol repository.\n *\n * @see {@link Client.putRecord}\n */\nexport type PutRecordOptions = Omit<XrpcOptions<typeof putRecord>, 'body'> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n /** Compare-and-swap on the repo commit. If specified, must match current commit. */\n swapCommit?: string\n /** Compare-and-swap on the record CID. If specified, must match current record. */\n swapRecord?: string\n /**\n * Whether the PDS should validate the record against its lexicon schema.\n * When `true`, the PDS is asked to explicitly validate the record. When\n * `false`, the PDS is asked to explicitly skip validation. When `undefined`\n * (default), the PDS decides — typically validating only collections whose\n * schemas it knows. This is server-side validation; for client-side\n * validation before sending, use {@link XrpcRequestProcessingOptions.validateRequest}.\n */\n validate?: boolean\n}\n\n/**\n * Options for listing records in an AT Protocol repository collection.\n *\n * @see {@link Client.listRecords}\n */\nexport type ListRecordsOptions = Omit<\n XrpcOptions<typeof listRecords>,\n 'params'\n> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n /** Maximum number of records to return. */\n limit?: number\n /** Pagination cursor from a previous response. */\n cursor?: string\n /** If true, returns records in reverse chronological order. */\n reverse?: boolean\n}\n\n/**\n * Options for applying a batch of writes (create/update/delete) to an AT Protocol repository.\n *\n * @see {@link Client.applyWrites}\n */\nexport type ApplyWritesOptions = Omit<\n XrpcOptions<typeof applyWrites>,\n 'body'\n> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n /**\n * Whether the PDS should validate the records against their lexicon schemas.\n * When `true`, the PDS is asked to explicitly validate every record. When\n * `false`, the PDS is asked to explicitly skip validation. When `undefined`\n * (default), the PDS decides — typically validating only collections whose\n * schemas it knows.\n */\n validate?: boolean\n /** Compare-and-swap on the repo commit. If specified, must match current commit. */\n swapCommit?: CidString\n}\n\nexport type UploadBlobOptions = Omit<XrpcOptions<typeof uploadBlob>, 'body'>\n\nexport type GetBlobOptions = Omit<XrpcOptions<typeof getBlob>, 'params'>\n\n/**\n * Type-safe options for {@link Client.create}, combining record options with key requirements.\n * @typeParam T - The record schema type\n * @see {@link CreateRecordOptions}\n */\nexport type CreateOptions<T extends RecordSchema> = CreateRecordOptions &\n RecordKeyOptions<T, 'tid' | 'any'>\n\n/**\n * Output type for record creation operations.\n * Contains the URI and CID of the newly created record.\n */\nexport type CreateOutput = InferMethodOutputBody<\n typeof createRecord,\n Uint8Array\n>\n\n/**\n * Type-safe options for {@link Client.delete}, combining delete options with key requirements.\n * @typeParam T - The record schema type\n */\nexport type DeleteOptions<T extends RecordSchema> = DeleteRecordOptions &\n RecordKeyOptions<T>\n\n/**\n * Output type for record deletion operations.\n */\nexport type DeleteOutput = InferMethodOutputBody<\n typeof deleteRecord,\n Uint8Array\n>\n\n/**\n * Type-safe options for {@link Client.get}, combining get options with key requirements.\n * @typeParam T - The record schema type\n */\nexport type GetOptions<T extends RecordSchema> = GetRecordOptions &\n RecordKeyOptions<T>\n\n/**\n * Output type for record retrieval operations.\n * Contains the record value validated against the schema type.\n * @typeParam T - The record schema type\n */\nexport type GetOutput<T extends RecordSchema> = Omit<\n InferMethodOutputBody<typeof getRecord, Uint8Array>,\n 'value'\n> & { value: Infer<T> }\n\n/**\n * Type-safe options for {@link Client.put}, combining put options with key requirements.\n * @typeParam T - The record schema type\n */\nexport type PutOptions<T extends RecordSchema> = PutRecordOptions &\n RecordKeyOptions<T>\n\n/**\n * Output type for record put (create/update) operations.\n * Contains the URI and CID of the record.\n */\nexport type PutOutput = InferMethodOutputBody<typeof putRecord, Uint8Array>\n\n/**\n * Options for {@link Client.list} operations.\n */\nexport type ListOptions = ListRecordsOptions\n\n/**\n * Output type for record listing operations.\n * Contains validated records and any invalid records that failed schema validation.\n * @typeParam T - The record schema type\n */\nexport type ListOutput<T extends RecordSchema> = Omit<\n InferMethodOutputBody<typeof listRecords>,\n 'records'\n> & {\n /** Records that successfully validated against the schema. */\n records: ListRecordItem<Infer<T>>[]\n}\n\n/**\n * A discriminated union type representing the result of a record listing\n * operation.\n */\nexport type ListRecordItem<Value extends LexMap> =\n | { uri: AtUriString; cid: CidString; valid: true; value: Value }\n | { uri: AtUriString; cid: CidString; valid: false; value: LexMap }\n\n/**\n * The Client class is the primary interface for interacting with AT Protocol\n * services. It provides type-safe methods for XRPC calls, record operations,\n * and blob handling.\n *\n * @example\n * ```typescript\n * import { Client } from '@atproto/lex'\n * import { app } from '#/lexicons\n *\n * const client = new Client(oauthSession)\n *\n * const response = await client.xrpc(app.bsky.feed.getTimeline, {\n * params: { limit: 50 }\n * })\n * ```\n */\nexport class Client {\n static appLabelers: readonly DidString[] = []\n\n /**\n * Configures the Client (or its sub classes) globally.\n */\n static configure(opts: { appLabelers?: Iterable<DidString> }): void {\n if (opts.appLabelers) this.appLabelers = [...opts.appLabelers]\n }\n\n /** The underlying agent used for making requests. */\n public readonly agent: Agent\n\n /** Default header values to include in all requests made by this client instance. */\n public readonly headers: Headers\n\n /** Default {@link XrpcOptions} for this client instance. */\n public readonly xrpcDefaults: Readonly<{\n service: Service | null\n labelers: Set<DidString>\n appLabelers?: null | Iterable<DidString>\n validateRequest: boolean\n validateResponse: boolean\n strictResponseProcessing: boolean\n }>\n\n constructor(agent: Agent | AgentOptions, options: ClientOptions = {}) {\n this.agent = buildAgent(agent)\n this.headers = new Headers(options.headers)\n\n // @NOTE An \"atproto-proxy\" header provided through the `headers` option\n // acts as fallback for the `service` option.\n const service = this.headers.get('atproto-proxy')?.trim()\n\n this.xrpcDefaults = Object.freeze({\n service:\n options.service === undefined && service != null && isService(service)\n ? service\n : (options.service ?? null),\n labelers: new Set(options.labelers),\n // @NOTE when provided (including `null`), will override the class wide\n // Client.appLabelers\n appLabelers:\n options.appLabelers != null\n ? new Set(options.appLabelers)\n : options.appLabelers,\n validateRequest: options.validateRequest ?? false,\n validateResponse: options.validateResponse ?? true,\n strictResponseProcessing: options.strictResponseProcessing ?? true,\n })\n }\n\n /**\n * The DID of the authenticated user, or `undefined` if not authenticated.\n */\n get did(): DidString | undefined {\n return this.agent.did\n }\n\n /**\n * The DID of the authenticated user.\n * @throws {Error} if not authenticated\n */\n get assertDid(): DidString {\n this.assertAuthenticated()\n return this.did\n }\n\n get service(): Service | null {\n return this.xrpcDefaults.service\n }\n\n get labelers(): Set<DidString> {\n return this.xrpcDefaults.labelers\n }\n\n /**\n * Asserts that the client is authenticated.\n * Use as a type guard when you need to ensure authentication.\n *\n * @throws {Error} if not authenticated\n *\n * @example\n * ```typescript\n * client.assertAuthenticated()\n * // TypeScript now knows client.did is defined\n * console.log(client.did)\n * ```\n */\n public assertAuthenticated(): asserts this is { did: DidString } {\n if (!this.did) throw new Error('Client is not authenticated')\n }\n\n /**\n * Replaces all labelers with the given set.\n * @param labelers - Iterable of labeler DIDs\n */\n public setLabelers(labelers: Iterable<DidString> = []): void {\n this.clearLabelers()\n this.addLabelers(labelers)\n }\n\n /**\n * Adds labelers to the current set.\n * @param labelers - Iterable of labeler DIDs to add\n */\n public addLabelers(labelers: Iterable<DidString>): void {\n for (const labeler of labelers) this.xrpcDefaults.labelers.add(labeler)\n }\n\n /**\n * Removes all labelers from this client instance.\n */\n public clearLabelers(): void {\n this.xrpcDefaults.labelers.clear()\n }\n\n /**\n * Makes an XRPC request. Throws on failure.\n *\n * @param ns - The lexicon method definition (e.g., `app.bsky.feed.getTimeline`)\n * @param options - Request options including params and body\n * @returns The successful XRPC response\n * @throws {XrpcFailure} when the request fails or returns an error\n *\n * @example Query with parameters\n * ```typescript\n * const response = await client.xrpc(app.bsky.feed.getTimeline, {\n * params: { limit: 50, cursor: 'abc123' }\n * })\n * console.log(response.body.feed)\n * ```\n *\n * @example Procedure with body\n * ```typescript\n * const response = await client.xrpc(com.atproto.repo.createRecord, {\n * body: {\n * repo: client.assertDid,\n * collection: 'app.bsky.feed.post',\n * record: { text: 'Hello!', createdAt: new Date().toISOString() }\n * }\n * })\n * ```\n *\n * @see {@link xrpcSafe} for a non-throwing variant\n */\n async xrpc<const M extends Query | Procedure>(\n ns: NonNullable<unknown> extends XrpcOptions<M>\n ? Main<M>\n : Restricted<'This XRPC method requires an \"options\" argument'>,\n ): Promise<XrpcResponse<M>>\n async xrpc<const M extends Query | Procedure>(\n ns: Main<M>,\n options: XrpcOptions<M>,\n ): Promise<XrpcResponse<M>>\n async xrpc<const M extends Query | Procedure>(\n ns: Main<M>,\n options: XrpcOptions<M> = {} as XrpcOptions<M>,\n ): Promise<XrpcResponse<M>> {\n return xrpc(this.agent, ns, this.buildXrpcOptions(options))\n }\n\n /**\n * Makes an XRPC request without throwing on failure.\n * Returns either a successful response or a failure object.\n *\n * @param ns - The lexicon method definition\n * @param options - Request options\n * @returns Either an XrpcResponse on success or XrpcFailure on failure\n *\n * @example\n * ```typescript\n * const result = await client.xrpcSafe(app.bsky.actor.getProfile, {\n * params: { actor: 'alice.bsky.social' }\n * })\n *\n * if (result.success) {\n * console.log(result.body.displayName)\n * } else {\n * console.error('Failed:', result.error)\n * }\n * ```\n *\n * @see {@link xrpc} for a throwing variant\n */\n async xrpcSafe<const M extends Query | Procedure>(\n ns: NonNullable<unknown> extends XrpcOptions<M>\n ? Main<M>\n : Restricted<'This XRPC method requires an \"options\" argument'>,\n ): Promise<XrpcResponse<M> | XrpcFailure<M>>\n async xrpcSafe<const M extends Query | Procedure>(\n ns: Main<M>,\n options: XrpcOptions<M>,\n ): Promise<XrpcResponse<M> | XrpcFailure<M>>\n async xrpcSafe<const M extends Query | Procedure>(\n ns: Main<M>,\n options: XrpcOptions<M> = {} as XrpcOptions<M>,\n ): Promise<XrpcResponse<M> | XrpcFailure<M>> {\n return xrpcSafe(this.agent, ns, this.buildXrpcOptions(options))\n }\n\n protected buildXrpcOptions<M extends Query | Procedure>(\n options: XrpcOptions<M>,\n ): XrpcOptions<M> {\n // Apply the instance-wide defaults for service, labelers, and validation\n // options.\n const combined = applyDefaults(options, this.xrpcDefaults)\n\n // Dynamically apply the class-wide appLabelers if they are not already set\n // in the combined options.\n if (combined.appLabelers === undefined) {\n combined.appLabelers = (this.constructor as typeof Client).appLabelers\n }\n\n const optionsHeaders =\n options.headers != null ? new Headers(options.headers) : null\n\n // @NOTE we allow the \"service\" options to fallback to the \"atproto-proxy\"\n // header if it is present in the request-specific headers.\n if (options.service === undefined && optionsHeaders?.has('atproto-proxy')) {\n const serviceHeader = optionsHeaders.get('atproto-proxy')?.trim()\n if (serviceHeader != null && isService(serviceHeader)) {\n combined.service = serviceHeader\n }\n }\n\n // Merge the instance-wide headers with the request-specific headers.\n // Request-specific headers take precedence. This cannot be done in the\n // applyDefaults step above because headers require special merging logic.\n combined.headers = optionsHeaders\n ? mergeHeaders(this.headers, optionsHeaders)\n : new Headers(this.headers)\n\n // @NOTE Since the combined options here always contain a defined\n // \"service\" (even if null), any \"atproto-proxy\" header in either the\n // instance-wide or request-specific headers will be overridden by the\n // \"service\" value. Note that an \"atproto-proxy\" header provided through\n // the constructor's `headers` option is used as fallback for the\n // constructor's `service` option (see constructor), making the two\n // equivalent.\n return combined\n }\n\n /**\n * Creates a new record in an AT Protocol repository.\n *\n * @param record - The record to create, must include an {@link NsidString} `$type`\n * @param rkey - Optional record key; if omitted, server generates a TID\n * @param options - Create options including repo, swapCommit, validate\n * @returns The XRPC response containing the created record's URI and CID\n *\n * @example\n * ```typescript\n * const response = await client.createRecord(\n * { $type: 'app.bsky.feed.post', text: 'Hello!', createdAt: new Date().toISOString() },\n * undefined, // Let server generate rkey\n * { validate: true }\n * )\n * console.log(response.body.uri)\n * ```\n *\n * @see {@link create} for a higher-level typed alternative\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n public async createRecord(\n record: TypedLexMap<NsidString>,\n rkey?: string,\n { service = null, labelers = null, ...options }: CreateRecordOptions = {},\n ): Promise<XrpcResponse<typeof createRecord>> {\n return this.xrpc(createRecord, {\n ...options,\n service,\n labelers,\n body: {\n repo: options?.repo ?? this.assertDid,\n collection: record.$type,\n record,\n rkey,\n validate: options?.validate,\n swapCommit: options?.swapCommit,\n },\n })\n }\n\n /**\n * Deletes a record from an AT Protocol repository.\n *\n * @param collection - The collection NSID\n * @param rkey - The record key\n * @param options - Delete options including repo, swapCommit, swapRecord\n *\n * @see {@link delete} for a higher-level typed alternative\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async deleteRecord(\n collection: NsidString,\n rkey: string,\n { service = null, labelers = null, ...options }: DeleteRecordOptions = {},\n ): Promise<XrpcResponse<typeof deleteRecord>> {\n return this.xrpc(deleteRecord, {\n ...options,\n service,\n labelers,\n body: {\n repo: options?.repo ?? this.assertDid,\n collection,\n rkey,\n swapCommit: options?.swapCommit,\n swapRecord: options?.swapRecord,\n },\n })\n }\n\n /**\n * Retrieves a record from an AT Protocol repository.\n *\n * @param collection - The collection NSID\n * @param rkey - The record key\n * @param options - Get options including repo\n *\n * @see {@link get} for a higher-level typed alternative\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n public async getRecord(\n collection: NsidString,\n rkey: string,\n { service = null, labelers = null, ...options }: GetRecordOptions = {},\n ): Promise<XrpcResponse<typeof getRecord>> {\n return this.xrpc(getRecord, {\n ...options,\n service,\n labelers,\n params: {\n repo: options?.repo ?? this.assertDid,\n collection,\n rkey,\n },\n })\n }\n\n /**\n * Creates or updates a record in a repository.\n *\n * @param record - The record to put, must include an {@link NsidString} `$type`\n * @param rkey - The record key\n * @param options - Put options including repo, swapCommit, swapRecord, validate\n *\n * @see {@link put} for a higher-level typed alternative\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async putRecord(\n record: TypedLexMap<NsidString>,\n rkey: string,\n { service = null, labelers = null, ...options }: PutRecordOptions = {},\n ): Promise<XrpcResponse<typeof putRecord>> {\n return this.xrpc(putRecord, {\n ...options,\n service,\n labelers,\n body: {\n repo: options?.repo ?? this.assertDid,\n collection: record.$type,\n rkey,\n record,\n validate: options?.validate,\n swapCommit: options?.swapCommit,\n swapRecord: options?.swapRecord,\n },\n })\n }\n\n /**\n * Lists records in a collection.\n *\n * @param nsid - The collection NSID\n * @param options - List options including repo, limit, cursor, reverse\n *\n * @see {@link list} for a higher-level typed alternative\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async listRecords(\n nsid: NsidString,\n { service = null, labelers = null, ...options }: ListRecordsOptions = {},\n ): Promise<XrpcResponse<typeof listRecords>> {\n return this.xrpc(listRecords, {\n ...options,\n service,\n labelers,\n params: {\n repo: options?.repo ?? this.assertDid,\n collection: nsid,\n cursor: options?.cursor,\n limit: options?.limit,\n reverse: options?.reverse,\n },\n })\n }\n\n /**\n * Performs an atomic batch of create, update, and delete operations on records in a repository.\n *\n * @param builder - A function that receives an {@link ApplyWritesOperations} instance to build the operations\n * @param options - ApplyWrites options including repo, validate, swapCommit\n * @returns The XRPC response from the applyWrites call\n *\n * @example\n * ```typescript\n * const response = await client.applyWrites((op) => [\n * op.create(app.bsky.feed.post, { text: 'Hello!' }),\n * op.update(app.bsky.feed.post, { text: 'Updated text' }, { rkey: 'post123' }),\n * op.delete(app.bsky.feed.post, 'post456'),\n * op.update(app.bsky.actor.profile, { displayName: 'Alice' }),\n * ], {\n * validate: true,\n * })\n *\n * for (const result of response.body.results) {\n * console.log(result.uri)\n * }\n * ```\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async applyWrites(\n factory: WriteOperationsFactory,\n { service = null, labelers = null, ...options }: ApplyWritesOptions = {},\n ): Promise<XrpcResponse<typeof applyWrites>> {\n return this.xrpc(applyWrites, {\n ...options,\n service,\n labelers,\n body: {\n repo: options?.repo ?? this.assertDid,\n writes: WriteOperationHelper.build(factory),\n validate: options?.validate,\n swapCommit: options?.swapCommit,\n },\n })\n }\n\n /**\n * Uploads a blob to an AT Protocol repository.\n *\n * @param body - The blob data (Uint8Array, ReadableStream, Blob, etc.)\n * @param options - Upload options including encoding hint\n * @returns Response containing the blob reference\n *\n * @example\n * ```typescript\n * const imageData = await fetch('image.png').then(r => r.arrayBuffer())\n * const response = await client.uploadBlob(new Uint8Array(imageData), {\n * encoding: 'image/png'\n * })\n * console.log(response.body.blob) // Use this ref in records\n * ```\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async uploadBlob(\n body: BinaryBodyInit,\n { service = null, labelers = null, ...options }: UploadBlobOptions = {},\n ): Promise<XrpcResponse<typeof uploadBlob>> {\n return this.xrpc(uploadBlob, { ...options, service, labelers, body })\n }\n\n /**\n * Retrieves a blob by DID and CID.\n *\n * @param did - The DID of the repository containing the blob\n * @param cid - The CID of the blob\n * @param options - Call options\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async getBlob(\n did: DidString,\n cid: CidString,\n { service = null, labelers = null, ...options }: GetBlobOptions = {},\n ): Promise<XrpcResponse<typeof getBlob>> {\n return this.xrpc(getBlob, {\n ...options,\n service,\n labelers,\n params: { did, cid },\n })\n }\n\n /**\n * Universal call method for queries, procedures, and custom actions.\n * Automatically determines the call type based on the lexicon definition.\n *\n * @param ns - The lexicon method or action definition\n * @param arg - The input argument (params for queries, body for procedures, input for actions)\n * @param options - Call options\n * @returns The method response body or action output\n * @see {@link xrpc} if you need access to the full response object\n *\n * @example Query\n * ```typescript\n * const profile = await client.call(app.bsky.actor.getProfile, {\n * actor: 'alice.bsky.social'\n * })\n * ```\n *\n * @example Procedure\n * ```typescript\n * const result = await client.call(com.atproto.repo.createRecord, {\n * repo: did,\n * collection: 'app.bsky.feed.post',\n * record: { text: 'Hello!' }\n * })\n * ```\n *\n * @example Action\n * ```typescript\n * const result = await client.call(updateProfile, (profile) => {\n * profile.displayName = 'Alice'\n * })\n * ```\n */\n public async call<const T extends Query>(\n ns: NonNullable<unknown> extends XrpcRequestParams<T>\n ? Main<T>\n : Restricted<'This query type requires a \"params\" argument'>,\n ): Promise<XrpcResponseBody<T>>\n public async call<const T extends Procedure>(\n ns: undefined extends InferMethodInputBody<T, Uint8Array>\n ? Main<T>\n : Restricted<'This procedure type requires an \"input\" argument'>,\n ): Promise<XrpcResponseBody<T>>\n public async call<const T extends Action>(\n ns: void extends InferActionInput<T>\n ? Main<T>\n : Restricted<'This action type requires an \"input\" argument'>,\n ): Promise<InferActionOutput<T>>\n public async call<const T extends Action | Procedure | Query>(\n ns: Main<T>,\n arg: T extends Action\n ? InferActionInput<T>\n : T extends Procedure\n ? InferMethodInputBody<T, Uint8Array>\n : T extends Query\n ? XrpcRequestParams<T>\n : never,\n options?: T extends Action\n ? ActionOptions\n : T extends Procedure\n ? Omit<XrpcOptions<T>, 'body'>\n : T extends Query\n ? Omit<XrpcOptions<T>, 'params'>\n : never,\n ): Promise<\n T extends Action\n ? InferActionOutput<T>\n : T extends Procedure\n ? XrpcResponseBody<T>\n : T extends Query\n ? XrpcResponseBody<T>\n : never\n >\n public async call(\n ns: Main<Action> | Main<Procedure> | Main<Query>,\n arg?: LexValue | Params,\n options: ActionOptions = {},\n ): Promise<unknown> {\n const method = getMain(ns)\n\n if (typeof method === 'function') {\n return method(this, arg, options)\n }\n\n if (method instanceof Procedure) {\n const result = await this.xrpc(method, { ...options, body: arg as any })\n return result.body\n } else if (method instanceof Query) {\n const result = await this.xrpc(method, { ...options, params: arg as any })\n return result.body\n } else {\n throw new TypeError('Invalid lexicon')\n }\n }\n\n /**\n * Creates a new record with full type safety based on the schema.\n *\n * @param ns - The record schema definition\n * @param input - The record data (without `$type`, which is added automatically)\n * @param options - Create options including rkey (required for some record types)\n * @returns The create output including URI and CID\n *\n * @example Creating a post\n * ```typescript\n * const result = await client.create(app.bsky.feed.post, {\n * text: 'Hello, world!',\n * createdAt: new Date().toISOString()\n * })\n * console.log(result.uri)\n * ```\n *\n * @example Creating a record with explicit rkey\n * ```typescript\n * const result = await client.create(app.bsky.actor.profile, {\n * displayName: 'Alice'\n * }, { rkey: 'self' })\n * ```\n *\n * @see {@link createRecord} for a lower-level method that returns the raw response without schema validation\n */\n public async create<const T extends RecordSchema>(\n ns: NonNullable<unknown> extends CreateOptions<T>\n ? Main<T>\n : Restricted<'This record type requires an \"options\" argument'>,\n input: Omit<Infer<T>, '$type'>,\n ): Promise<CreateOutput>\n public async create<const T extends RecordSchema>(\n ns: Main<T>,\n input: Omit<Infer<T>, '$type'>,\n options: CreateOptions<T>,\n ): Promise<CreateOutput>\n public async create<const T extends RecordSchema>(\n ns: Main<T>,\n input: Omit<Infer<T>, '$type'>,\n options: CreateOptions<T> = {} as CreateOptions<T>,\n ): Promise<CreateOutput> {\n const schema: T = getMain(ns)\n const record = schema.build(input) as TypedLexMap<NsidString>\n if (options?.validateRequest) schema.validate(record)\n const rkey = options.rkey ?? getDefaultRecordKey(schema)\n if (rkey !== undefined) schema.keySchema.assert(rkey)\n const response = await this.createRecord(record, rkey, options)\n return response.body\n }\n\n /**\n * Deletes a record with type-safe options.\n *\n * @param ns - The record schema definition\n * @param options - Delete options (rkey required for non-literal keys)\n * @returns The delete output\n *\n * @see {@link deleteRecord} for a lower-level method that returns the raw response without schema validation\n */\n public async delete<const T extends RecordSchema>(\n ns: NonNullable<unknown> extends DeleteOptions<T>\n ? Main<T>\n : Restricted<'This record type requires an \"options\" argument'>,\n ): Promise<DeleteOutput>\n public async delete<const T extends RecordSchema>(\n ns: Main<T>,\n options?: DeleteOptions<T>,\n ): Promise<DeleteOutput>\n public async delete<const T extends RecordSchema>(\n ns: Main<T>,\n options: DeleteOptions<T> = {} as DeleteOptions<T>,\n ): Promise<DeleteOutput> {\n const schema = getMain(ns)\n const rkey = schema.keySchema.parse(\n options.rkey ?? getLiteralRecordKey(schema),\n )\n const response = await this.deleteRecord(schema.$type, rkey, options)\n return response.body\n }\n\n /**\n * Retrieves a record with type-safe validation.\n *\n * @param ns - The record schema definition\n * @param options - Get options (rkey required for non-literal keys)\n * @returns The record data validated against the schema\n *\n * @example\n * ```typescript\n * const profile = await client.get(app.bsky.actor.profile)\n * // profile.value is typed as app.bsky.actor.profile.Record\n * console.log(profile.value.displayName)\n * ```\n *\n * @see {@link getRecord} for a lower-level method that returns the raw record without schema validation\n */\n public async get<const T extends RecordSchema>(\n ns: T['key'] extends `literal:${string}`\n ? Main<T>\n : Restricted<'This record type requires an \"options\" argument'>,\n ): Promise<GetOutput<T>>\n public async get<const T extends RecordSchema>(\n ns: Main<T>,\n options: GetOptions<T>,\n ): Promise<GetOutput<T>>\n public async get<const T extends RecordSchema>(\n ns: Main<T>,\n options: GetOptions<T> = {} as GetOptions<T>,\n ): Promise<GetOutput<T>> {\n const schema = getMain(ns)\n const rkey = schema.keySchema.parse(\n options.rkey ?? getLiteralRecordKey(schema),\n )\n const response = await this.getRecord(schema.$type, rkey, options)\n const value = schema.validate(response.body.value)\n return { ...response.body, value }\n }\n\n /**\n * Creates or updates a record with full type safety.\n *\n * @param ns - The record schema definition\n * @param input - The record data\n * @param options - Put options (rkey required for non-literal keys)\n * @returns The put output including URI and CID\n *\n * @example Creating a new record\n * ```typescript\n * const result = await client.put(app.bsky.feed.post, {\n * text: 'Hello, world!',\n * createdAt: new Date().toISOString()\n * })\n * console.log(result.uri)\n * ```\n *\n * @example Updating an existing record with explicit rkey\n * ```typescript\n * const result = await client.put(app.bsky.actor.profile, {\n * displayName: 'Alice'\n * }, { rkey: 'self' })\n * ```\n *\n * @see {@link putRecord} for a lower-level method that returns the raw record without schema validation\n */\n public async put<const T extends RecordSchema>(\n ns: NonNullable<unknown> extends PutOptions<T>\n ? Main<T>\n : Restricted<'This record type requires an \"options\" argument'>,\n input: Omit<Infer<T>, '$type'>,\n ): Promise<PutOutput>\n public async put<const T extends RecordSchema>(\n ns: Main<T>,\n input: Omit<Infer<T>, '$type'>,\n options: PutOptions<T>,\n ): Promise<PutOutput>\n public async put<const T extends RecordSchema>(\n ns: Main<T>,\n input: Omit<Infer<T>, '$type'>,\n options: PutOptions<T> = {} as PutOptions<T>,\n ): Promise<PutOutput> {\n const schema: T = getMain(ns)\n const record = schema.build(input) as TypedLexMap<NsidString>\n if (options?.validateRequest) schema.validate(record)\n const rkey = options.rkey ?? getLiteralRecordKey(schema)\n const response = await this.putRecord(record, rkey, options)\n return response.body\n }\n\n /**\n * Lists records with type-safe validation and separation of valid/invalid records.\n *\n * @param ns - The record schema definition\n * @param options - List options\n * @returns Records validated against the schema, with invalid records included as LexMap\n *\n * @example\n * ```typescript\n * const result = await client.list(app.bsky.feed.post, { limit: 100 })\n * for (const record of result.records) {\n * if (record.valid) {\n * record.value // Fully typed\n * } else {\n * record.value // Invalid record, typed as LexMap\n * }\n * }\n * ```\n *\n * @see {@link listRecords} for a lower-level method that returns the raw records without schema validation\n */\n async list<const T extends RecordSchema>(\n ns: Main<T>,\n options?: ListOptions,\n ): Promise<ListOutput<T>> {\n const schema = getMain(ns)\n const { body } = await this.listRecords(schema.$type, options)\n const records = body.records.map(processListRecord, schema)\n return { ...body, records }\n }\n\n /**\n * Asynchronously iterates over all records in a collection, handling\n * pagination automatically.\n *\n * @param ns - The record schema definition\n * @param options - List options including limit and cursor\n * @returns An async generator yielding each record validated against the schema\n *\n * @see {@link list} for a method that returns a single page of records\n * @see {@link listRecords} for a lower-level method that returns raw records without schema validation\n */\n async *listAll<const T extends RecordSchema>(\n ns: Main<T>,\n { maxRetries = 3, ...options }: ListOptions = {},\n ): AsyncGenerator<ListRecordItem<Infer<T>>, void, unknown> {\n const schema = getMain(ns)\n\n do {\n throwIfAborted(options.signal)\n\n const { body } = await this.listRecords(schema.$type, {\n ...options,\n maxRetries,\n })\n\n // We don't use this.list() here so that we can lazily process records as\n // they come in, rather than mapping and yielding the entire page at once.\n for (const record of body.records) {\n yield processListRecord.call(schema, record)\n }\n\n // If the server returns the same cursor, we may be in a loop. Stop\n // iteration.\n if (body.cursor && body.cursor === options.cursor) {\n return\n }\n\n options.cursor = body.cursor\n } while (options.cursor)\n }\n}\n\nfunction processListRecord<T extends RecordSchema>(\n this: T,\n record: ListRecordsRecord,\n): ListRecordItem<Infer<T>> {\n const result = this.safeValidate(record.value)\n if (result.success) {\n return { ...record, valid: true, value: result.value }\n } else {\n return { ...record, valid: false }\n }\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAcL,aAAa,EACb,UAAU,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,aAAa,EACb,cAAc,EACd,IAAI,EACJ,QAAQ,GACT,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAWL,SAAS,EACT,KAAK,EAGL,OAAO,GACR,MAAM,qBAAqB,CAAA;AAC5B,8EAA8E;AAC9E,8EAA8E;AAC9E,uCAAuC;AACvC,OAAO,WAAW,MAAM,4CAA4C,CAAA;AACpE,OAAO,YAAY,MAAM,6CAA6C,CAAA;AACtE,OAAO,YAAY,MAAM,6CAA6C,CAAA;AACtE,OAAO,SAAS,MAAM,0CAA0C,CAAA;AAChE,OAAO,WAAW,EAAE,EAEnB,MAAM,4CAA4C,CAAA;AACnD,OAAO,SAAS,MAAM,0CAA0C,CAAA;AAChE,OAAO,UAAU,MAAM,2CAA2C,CAAA;AAClE,OAAO,OAAO,MAAM,wCAAwC,CAAA;AAC5D,OAAO,EACL,oBAAoB,GAErB,MAAM,8BAA8B,CAAA;AA0RrC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,MAAM;aACV,gBAAW,GAAyB,EAAE,CAAA;IAE7C;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,IAA2C;QAC1D,IAAI,IAAI,CAAC,WAAW;YAAE,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAA;IAChE,CAAC;IAkBD,YAAY,KAA2B,EAAE,OAAO,GAAkB,EAAE;QAClE,IAAI,CAAC,KAAK,GAAG,U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CAAC;AACH,CAAC","sourcesContent":["import type { LexMap, LexValue, TypedLexMap } from '@atproto/lex-data'\nimport {\n type Agent,\n type AgentOptions,\n type BinaryBodyInit,\n type RecordKeyOptions,\n type Service,\n type XrpcFailure,\n type XrpcOptions,\n type XrpcRequestHeadersOptions,\n type XrpcRequestParams,\n type XrpcRequestProcessingOptions,\n type XrpcResponse,\n type XrpcResponseBody,\n type XrpcResponseOptions,\n applyDefaults,\n buildAgent,\n isService,\n mergeHeaders,\n rkeyFor,\n rkeyForCreate,\n throwIfAborted,\n xrpc,\n xrpcSafe,\n} from '@atproto/lex-rpc'\nimport {\n type AtIdentifierString,\n type AtUriString,\n type CidString,\n type DidString,\n type Infer,\n type InferMethodInputBody,\n type InferMethodOutputBody,\n type Main,\n type NsidString,\n type Params,\n Procedure,\n Query,\n type RecordSchema,\n type Restricted,\n getMain,\n} from '@atproto/lex-schema'\n// @NOTE We could use import { com } from \"./lexicons/index.js\" here, but some\n// consumers might not know how to properly tree-shake that, so we import only\n// the needed lexicon schemas directly.\nimport applyWrites from './lexicons/com/atproto/repo/applyWrites.js'\nimport createRecord from './lexicons/com/atproto/repo/createRecord.js'\nimport deleteRecord from './lexicons/com/atproto/repo/deleteRecord.js'\nimport getRecord from './lexicons/com/atproto/repo/getRecord.js'\nimport listRecords, {\n type Record as ListRecordsRecord,\n} from './lexicons/com/atproto/repo/listRecords.js'\nimport putRecord from './lexicons/com/atproto/repo/putRecord.js'\nimport uploadBlob from './lexicons/com/atproto/repo/uploadBlob.js'\nimport getBlob from './lexicons/com/atproto/sync/getBlob.js'\nimport {\n WriteOperationHelper,\n type WriteOperationsFactory,\n} from './write-operation-builder.js'\n\n/**\n * Configuration options for creating a {@link Client}.\n *\n * @property {@link ClientOptions.labelers} - An iterable of labeler DIDs to include in requests. These will be combined with any global app labelers configured via {@link Client.configure}.\n * @property {@link ClientOptions.service} - An optional service identifier (DID or URL) for routing requests with service proxying.\n * @property {@link ClientOptions.headers} - Custom headers to include in all requests made by this client instance.\n * @property {@link ClientOptions.validateRequest} - If true, validates request bodies against their lexicon schemas before sending. Defaults to false for performance.\n * @property {@link ClientOptions.validateResponse} - If false, skips validation of response bodies against their lexicon schemas. Defaults to true to catch errors, but can be disabled for performance if you trust the server responses. Note that defaults will not be applied if validation is disabled, which can cause typing inconsistencies, so use with caution.\n * @property {@link ClientOptions.strictResponseProcessing} - If false, relaxes certain validation rules during response processing (e.g., allowing floats, deeper nesting, etc.). Defaults to true for strict compliance with {@link https://atproto.com/specs/data-model lexicon data model}, but can be disabled to handle non-compliant responses.\n *\n * @see {@link XrpcRequestHeadersOptions}\n * @see {@link XrpcRequestProcessingOptions}\n * @see {@link XrpcResponseOptions}\n *\n * @example\n * ```typescript\n * const options: ClientOptions = {\n * labelers: ['did:plc:labeler1'],\n * service: 'did:web:api.bsky.app#bsky_appview',\n * headers: { 'X-Custom-Header': 'value' },\n * validateRequest: false,\n * validateResponse: true,\n * strictResponseProcessing: false,\n * }\n * ```\n */\nexport type ClientOptions = XrpcRequestHeadersOptions &\n Pick<XrpcRequestProcessingOptions, 'validateRequest'> &\n XrpcResponseOptions\n\nexport type ActionOptions = {\n /** AbortSignal to cancel the request. */\n signal?: AbortSignal\n}\n\n/**\n * A composable action that can be invoked via {@link Client.call}.\n *\n * Actions provide a way to define custom operations that integrate with the\n * Client's call interface, enabling type-safe, reusable business logic.\n *\n * @typeParam I - The input type for the action\n * @typeParam O - The output type for the action\n *\n * @example\n * ```typescript\n * const myAction: Action<{ userId: string }, { profile: Profile }> = async (client, input, options) => {\n * const response = await client.xrpc(someMethod, { params: { actor: input.userId }, ...options })\n * return { profile: response.body }\n * }\n * ```\n */\nexport type Action<I = any, O = any> = (\n client: Client,\n input: I,\n options: ActionOptions,\n) => O | Promise<O>\n\n/**\n * Extracts the input type from an {@link Action}.\n * @typeParam A - The Action type to extract from\n */\nexport type InferActionInput<A extends Action> =\n A extends Action<infer I, any> ? I : never\n\n/**\n * Extracts the output type from an {@link Action}.\n * @typeParam A - The Action type to extract from\n */\nexport type InferActionOutput<A extends Action> =\n A extends Action<any, infer O> ? O : never\n\n/**\n * Options for creating a record in an AT Protocol repository.\n *\n * @see {@link Client.createRecord}\n */\nexport type CreateRecordOptions = Omit<\n XrpcOptions<typeof createRecord>,\n 'body'\n> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n /** Compare-and-swap on the repo commit. If specified, must match current commit. */\n swapCommit?: string\n /**\n * Whether the PDS should validate the record against its lexicon schema.\n * When `true`, the PDS is asked to explicitly validate the record. When\n * `false`, the PDS is asked to explicitly skip validation. When `undefined`\n * (default), the PDS decides -- typically validating only collections whose\n * schemas it knows. This is server-side validation; for client-side\n * validation before sending, use {@link XrpcRequestProcessingOptions.validateRequest}.\n */\n validate?: boolean\n}\n\n/**\n * Options for deleting a record from an AT Protocol repository.\n *\n * @see {@link Client.deleteRecord}\n */\nexport type DeleteRecordOptions = Omit<\n XrpcOptions<typeof deleteRecord>,\n 'body'\n> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n /** Compare-and-swap on the repo commit. If specified, must match current commit. */\n swapCommit?: string\n /** Compare-and-swap on the record CID. If specified, must match current record. */\n swapRecord?: string\n}\n\n/**\n * Options for retrieving a record from an AT Protocol repository.\n *\n * @see {@link Client.getRecord}\n */\nexport type GetRecordOptions = Omit<XrpcOptions<typeof getRecord>, 'params'> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n}\n\n/**\n * Options for creating or updating a record in an AT Protocol repository.\n *\n * @see {@link Client.putRecord}\n */\nexport type PutRecordOptions = Omit<XrpcOptions<typeof putRecord>, 'body'> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n /** Compare-and-swap on the repo commit. If specified, must match current commit. */\n swapCommit?: string\n /** Compare-and-swap on the record CID. If specified, must match current record. */\n swapRecord?: string\n /**\n * Whether the PDS should validate the record against its lexicon schema.\n * When `true`, the PDS is asked to explicitly validate the record. When\n * `false`, the PDS is asked to explicitly skip validation. When `undefined`\n * (default), the PDS decides — typically validating only collections whose\n * schemas it knows. This is server-side validation; for client-side\n * validation before sending, use {@link XrpcRequestProcessingOptions.validateRequest}.\n */\n validate?: boolean\n}\n\n/**\n * Options for listing records in an AT Protocol repository collection.\n *\n * @see {@link Client.listRecords}\n */\nexport type ListRecordsOptions = Omit<\n XrpcOptions<typeof listRecords>,\n 'params'\n> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n /** Maximum number of records to return. */\n limit?: number\n /** Pagination cursor from a previous response. */\n cursor?: string\n /** If true, returns records in reverse chronological order. */\n reverse?: boolean\n}\n\n/**\n * Options for applying a batch of writes (create/update/delete) to an AT Protocol repository.\n *\n * @see {@link Client.applyWrites}\n */\nexport type ApplyWritesOptions = Omit<\n XrpcOptions<typeof applyWrites>,\n 'body'\n> & {\n /** Repository identifier (DID or handle). Defaults to authenticated user's DID. */\n repo?: AtIdentifierString\n /**\n * Whether the PDS should validate the records against their lexicon schemas.\n * When `true`, the PDS is asked to explicitly validate every record. When\n * `false`, the PDS is asked to explicitly skip validation. When `undefined`\n * (default), the PDS decides — typically validating only collections whose\n * schemas it knows.\n */\n validate?: boolean\n /** Compare-and-swap on the repo commit. If specified, must match current commit. */\n swapCommit?: CidString\n}\n\nexport type UploadBlobOptions = Omit<XrpcOptions<typeof uploadBlob>, 'body'>\n\nexport type GetBlobOptions = Omit<XrpcOptions<typeof getBlob>, 'params'>\n\n/**\n * Type-safe options for {@link Client.create}, combining record options with key requirements.\n * @typeParam T - The record schema type\n * @see {@link CreateRecordOptions}\n */\nexport type CreateOptions<T extends RecordSchema> = CreateRecordOptions &\n RecordKeyOptions<T, 'tid' | 'any'>\n\n/**\n * Output type for record creation operations.\n * Contains the URI and CID of the newly created record.\n */\nexport type CreateOutput = InferMethodOutputBody<\n typeof createRecord,\n Uint8Array\n>\n\n/**\n * Type-safe options for {@link Client.delete}, combining delete options with key requirements.\n * @typeParam T - The record schema type\n */\nexport type DeleteOptions<T extends RecordSchema> = DeleteRecordOptions &\n RecordKeyOptions<T>\n\n/**\n * Output type for record deletion operations.\n */\nexport type DeleteOutput = InferMethodOutputBody<\n typeof deleteRecord,\n Uint8Array\n>\n\n/**\n * Type-safe options for {@link Client.get}, combining get options with key requirements.\n * @typeParam T - The record schema type\n */\nexport type GetOptions<T extends RecordSchema> = GetRecordOptions &\n RecordKeyOptions<T>\n\n/**\n * Output type for record retrieval operations.\n * Contains the record value validated against the schema type.\n * @typeParam T - The record schema type\n */\nexport type GetOutput<T extends RecordSchema> = Omit<\n InferMethodOutputBody<typeof getRecord, Uint8Array>,\n 'value'\n> & { value: Infer<T> }\n\n/**\n * Type-safe options for {@link Client.put}, combining put options with key requirements.\n * @typeParam T - The record schema type\n */\nexport type PutOptions<T extends RecordSchema> = PutRecordOptions &\n RecordKeyOptions<T>\n\n/**\n * Output type for record put (create/update) operations.\n * Contains the URI and CID of the record.\n */\nexport type PutOutput = InferMethodOutputBody<typeof putRecord, Uint8Array>\n\n/**\n * Options for {@link Client.list} operations.\n */\nexport type ListOptions = ListRecordsOptions\n\n/**\n * Output type for record listing operations.\n * Contains validated records and any invalid records that failed schema validation.\n * @typeParam T - The record schema type\n */\nexport type ListOutput<T extends RecordSchema> = Omit<\n InferMethodOutputBody<typeof listRecords>,\n 'records'\n> & {\n /** Records that successfully validated against the schema. */\n records: ListRecordItem<Infer<T>>[]\n}\n\n/**\n * A discriminated union type representing the result of a record listing\n * operation.\n */\nexport type ListRecordItem<Value extends LexMap> =\n | { uri: AtUriString; cid: CidString; valid: true; value: Value }\n | { uri: AtUriString; cid: CidString; valid: false; value: LexMap }\n\n/**\n * The Client class is the primary interface for interacting with AT Protocol\n * services. It provides type-safe methods for XRPC calls, record operations,\n * and blob handling.\n *\n * @example\n * ```typescript\n * import { Client } from '@atproto/lex'\n * import { app } from '#/lexicons\n *\n * const client = new Client(oauthSession)\n *\n * const response = await client.xrpc(app.bsky.feed.getTimeline, {\n * params: { limit: 50 }\n * })\n * ```\n */\nexport class Client {\n static appLabelers: readonly DidString[] = []\n\n /**\n * Configures the Client (or its sub classes) globally.\n */\n static configure(opts: { appLabelers?: Iterable<DidString> }): void {\n if (opts.appLabelers) this.appLabelers = [...opts.appLabelers]\n }\n\n /** The underlying agent used for making requests. */\n public readonly agent: Agent\n\n /** Default header values to include in all requests made by this client instance. */\n public readonly headers: Headers\n\n /** Default {@link XrpcOptions} for this client instance. */\n public readonly xrpcDefaults: Readonly<{\n service: Service | null\n labelers: Set<DidString>\n appLabelers?: null | Iterable<DidString>\n validateRequest: boolean\n validateResponse: boolean\n strictResponseProcessing: boolean\n }>\n\n constructor(agent: Agent | AgentOptions, options: ClientOptions = {}) {\n this.agent = buildAgent(agent)\n this.headers = new Headers(options.headers)\n\n // @NOTE An \"atproto-proxy\" header provided through the `headers` option\n // acts as fallback for the `service` option.\n const service = this.headers.get('atproto-proxy')?.trim()\n\n this.xrpcDefaults = Object.freeze({\n service:\n options.service === undefined && service != null && isService(service)\n ? service\n : (options.service ?? null),\n labelers: new Set(options.labelers),\n // @NOTE when provided (including `null`), will override the class wide\n // Client.appLabelers\n appLabelers:\n options.appLabelers != null\n ? new Set(options.appLabelers)\n : options.appLabelers,\n validateRequest: options.validateRequest ?? false,\n validateResponse: options.validateResponse ?? true,\n strictResponseProcessing: options.strictResponseProcessing ?? true,\n })\n }\n\n /**\n * The DID of the authenticated user, or `undefined` if not authenticated.\n */\n get did(): DidString | undefined {\n return this.agent.did\n }\n\n /**\n * The DID of the authenticated user.\n * @throws {Error} if not authenticated\n */\n get assertDid(): DidString {\n this.assertAuthenticated()\n return this.did\n }\n\n get service(): Service | null {\n return this.xrpcDefaults.service\n }\n\n get labelers(): Set<DidString> {\n return this.xrpcDefaults.labelers\n }\n\n /**\n * Asserts that the client is authenticated.\n * Use as a type guard when you need to ensure authentication.\n *\n * @throws {Error} if not authenticated\n *\n * @example\n * ```typescript\n * client.assertAuthenticated()\n * // TypeScript now knows client.did is defined\n * console.log(client.did)\n * ```\n */\n public assertAuthenticated(): asserts this is { did: DidString } {\n if (!this.did) throw new Error('Client is not authenticated')\n }\n\n /**\n * Replaces all labelers with the given set.\n * @param labelers - Iterable of labeler DIDs\n */\n public setLabelers(labelers: Iterable<DidString> = []): void {\n this.clearLabelers()\n this.addLabelers(labelers)\n }\n\n /**\n * Adds labelers to the current set.\n * @param labelers - Iterable of labeler DIDs to add\n */\n public addLabelers(labelers: Iterable<DidString>): void {\n for (const labeler of labelers) this.xrpcDefaults.labelers.add(labeler)\n }\n\n /**\n * Removes all labelers from this client instance.\n */\n public clearLabelers(): void {\n this.xrpcDefaults.labelers.clear()\n }\n\n /**\n * Makes an XRPC request. Throws on failure.\n *\n * @param ns - The lexicon method definition (e.g., `app.bsky.feed.getTimeline`)\n * @param options - Request options including params and body\n * @returns The successful XRPC response\n * @throws {XrpcFailure} when the request fails or returns an error\n *\n * @example Query with parameters\n * ```typescript\n * const response = await client.xrpc(app.bsky.feed.getTimeline, {\n * params: { limit: 50, cursor: 'abc123' }\n * })\n * console.log(response.body.feed)\n * ```\n *\n * @example Procedure with body\n * ```typescript\n * const response = await client.xrpc(com.atproto.repo.createRecord, {\n * body: {\n * repo: client.assertDid,\n * collection: 'app.bsky.feed.post',\n * record: { text: 'Hello!', createdAt: new Date().toISOString() }\n * }\n * })\n * ```\n *\n * @see {@link xrpcSafe} for a non-throwing variant\n */\n async xrpc<const M extends Query | Procedure>(\n ns: NonNullable<unknown> extends XrpcOptions<M>\n ? Main<M>\n : Restricted<'This XRPC method requires an \"options\" argument'>,\n ): Promise<XrpcResponse<M>>\n async xrpc<const M extends Query | Procedure>(\n ns: Main<M>,\n options: XrpcOptions<M>,\n ): Promise<XrpcResponse<M>>\n async xrpc<const M extends Query | Procedure>(\n ns: Main<M>,\n options: XrpcOptions<M> = {} as XrpcOptions<M>,\n ): Promise<XrpcResponse<M>> {\n return xrpc(this.agent, ns, this.buildXrpcOptions(options))\n }\n\n /**\n * Makes an XRPC request without throwing on failure.\n * Returns either a successful response or a failure object.\n *\n * @param ns - The lexicon method definition\n * @param options - Request options\n * @returns Either an XrpcResponse on success or XrpcFailure on failure\n *\n * @example\n * ```typescript\n * const result = await client.xrpcSafe(app.bsky.actor.getProfile, {\n * params: { actor: 'alice.bsky.social' }\n * })\n *\n * if (result.success) {\n * console.log(result.body.displayName)\n * } else {\n * console.error('Failed:', result.error)\n * }\n * ```\n *\n * @see {@link xrpc} for a throwing variant\n */\n async xrpcSafe<const M extends Query | Procedure>(\n ns: NonNullable<unknown> extends XrpcOptions<M>\n ? Main<M>\n : Restricted<'This XRPC method requires an \"options\" argument'>,\n ): Promise<XrpcResponse<M> | XrpcFailure<M>>\n async xrpcSafe<const M extends Query | Procedure>(\n ns: Main<M>,\n options: XrpcOptions<M>,\n ): Promise<XrpcResponse<M> | XrpcFailure<M>>\n async xrpcSafe<const M extends Query | Procedure>(\n ns: Main<M>,\n options: XrpcOptions<M> = {} as XrpcOptions<M>,\n ): Promise<XrpcResponse<M> | XrpcFailure<M>> {\n return xrpcSafe(this.agent, ns, this.buildXrpcOptions(options))\n }\n\n protected buildXrpcOptions<M extends Query | Procedure>(\n options: XrpcOptions<M>,\n ): XrpcOptions<M> {\n // Apply the instance-wide defaults for service, labelers, and validation\n // options.\n const combined = applyDefaults(options, this.xrpcDefaults)\n\n // Dynamically apply the class-wide appLabelers if they are not already set\n // in the combined options.\n if (combined.appLabelers === undefined) {\n combined.appLabelers = (this.constructor as typeof Client).appLabelers\n }\n\n const optionsHeaders =\n options.headers != null ? new Headers(options.headers) : null\n\n // @NOTE we allow the \"service\" options to fallback to the \"atproto-proxy\"\n // header if it is present in the request-specific headers.\n if (options.service === undefined && optionsHeaders?.has('atproto-proxy')) {\n const serviceHeader = optionsHeaders.get('atproto-proxy')?.trim()\n if (serviceHeader != null && isService(serviceHeader)) {\n combined.service = serviceHeader\n }\n }\n\n // Merge the instance-wide headers with the request-specific headers.\n // Request-specific headers take precedence. This cannot be done in the\n // applyDefaults step above because headers require special merging logic.\n combined.headers = optionsHeaders\n ? mergeHeaders(this.headers, optionsHeaders)\n : new Headers(this.headers)\n\n // @NOTE Since the combined options here always contain a defined\n // \"service\" (even if null), any \"atproto-proxy\" header in either the\n // instance-wide or request-specific headers will be overridden by the\n // \"service\" value. Note that an \"atproto-proxy\" header provided through\n // the constructor's `headers` option is used as fallback for the\n // constructor's `service` option (see constructor), making the two\n // equivalent.\n return combined\n }\n\n /**\n * Creates a new record in an AT Protocol repository.\n *\n * @param record - The record to create, must include an {@link NsidString} `$type`\n * @param rkey - Optional record key; if omitted, server generates a TID\n * @param options - Create options including repo, swapCommit, validate\n * @returns The XRPC response containing the created record's URI and CID\n *\n * @example\n * ```typescript\n * const response = await client.createRecord(\n * { $type: 'app.bsky.feed.post', text: 'Hello!', createdAt: new Date().toISOString() },\n * undefined, // Let server generate rkey\n * { validate: true }\n * )\n * console.log(response.body.uri)\n * ```\n *\n * @see {@link create} for a higher-level typed alternative\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n public async createRecord(\n record: TypedLexMap<NsidString>,\n rkey?: string,\n { service = null, labelers = null, ...options }: CreateRecordOptions = {},\n ): Promise<XrpcResponse<typeof createRecord>> {\n return this.xrpc(createRecord, {\n ...options,\n service,\n labelers,\n body: {\n repo: options?.repo ?? this.assertDid,\n collection: record.$type,\n record,\n rkey,\n validate: options?.validate,\n swapCommit: options?.swapCommit,\n },\n })\n }\n\n /**\n * Deletes a record from an AT Protocol repository.\n *\n * @param collection - The collection NSID\n * @param rkey - The record key\n * @param options - Delete options including repo, swapCommit, swapRecord\n *\n * @see {@link delete} for a higher-level typed alternative\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async deleteRecord(\n collection: NsidString,\n rkey: string,\n { service = null, labelers = null, ...options }: DeleteRecordOptions = {},\n ): Promise<XrpcResponse<typeof deleteRecord>> {\n return this.xrpc(deleteRecord, {\n ...options,\n service,\n labelers,\n body: {\n repo: options?.repo ?? this.assertDid,\n collection,\n rkey,\n swapCommit: options?.swapCommit,\n swapRecord: options?.swapRecord,\n },\n })\n }\n\n /**\n * Retrieves a record from an AT Protocol repository.\n *\n * @param collection - The collection NSID\n * @param rkey - The record key\n * @param options - Get options including repo\n *\n * @see {@link get} for a higher-level typed alternative\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n public async getRecord(\n collection: NsidString,\n rkey: string,\n { service = null, labelers = null, ...options }: GetRecordOptions = {},\n ): Promise<XrpcResponse<typeof getRecord>> {\n return this.xrpc(getRecord, {\n ...options,\n service,\n labelers,\n params: {\n repo: options?.repo ?? this.assertDid,\n collection,\n rkey,\n },\n })\n }\n\n /**\n * Creates or updates a record in a repository.\n *\n * @param record - The record to put, must include an {@link NsidString} `$type`\n * @param rkey - The record key\n * @param options - Put options including repo, swapCommit, swapRecord, validate\n *\n * @see {@link put} for a higher-level typed alternative\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async putRecord(\n record: TypedLexMap<NsidString>,\n rkey: string,\n { service = null, labelers = null, ...options }: PutRecordOptions = {},\n ): Promise<XrpcResponse<typeof putRecord>> {\n return this.xrpc(putRecord, {\n ...options,\n service,\n labelers,\n body: {\n repo: options?.repo ?? this.assertDid,\n collection: record.$type,\n rkey,\n record,\n validate: options?.validate,\n swapCommit: options?.swapCommit,\n swapRecord: options?.swapRecord,\n },\n })\n }\n\n /**\n * Lists records in a collection.\n *\n * @param nsid - The collection NSID\n * @param options - List options including repo, limit, cursor, reverse\n *\n * @see {@link list} for a higher-level typed alternative\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async listRecords(\n nsid: NsidString,\n { service = null, labelers = null, ...options }: ListRecordsOptions = {},\n ): Promise<XrpcResponse<typeof listRecords>> {\n return this.xrpc(listRecords, {\n ...options,\n service,\n labelers,\n params: {\n repo: options?.repo ?? this.assertDid,\n collection: nsid,\n cursor: options?.cursor,\n limit: options?.limit,\n reverse: options?.reverse,\n },\n })\n }\n\n /**\n * Performs an atomic batch of create, update, and delete operations on records in a repository.\n *\n * @param builder - A function that receives an {@link ApplyWritesOperations} instance to build the operations\n * @param options - ApplyWrites options including repo, validate, swapCommit\n * @returns The XRPC response from the applyWrites call\n *\n * @example\n * ```typescript\n * const response = await client.applyWrites((op) => [\n * op.create(app.bsky.feed.post, { text: 'Hello!' }),\n * op.update(app.bsky.feed.post, { text: 'Updated text' }, { rkey: 'post123' }),\n * op.delete(app.bsky.feed.post, 'post456'),\n * op.update(app.bsky.actor.profile, { displayName: 'Alice' }),\n * ], {\n * validate: true,\n * })\n *\n * for (const result of response.body.results) {\n * console.log(result.uri)\n * }\n * ```\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async applyWrites(\n factory: WriteOperationsFactory,\n { service = null, labelers = null, ...options }: ApplyWritesOptions = {},\n ): Promise<XrpcResponse<typeof applyWrites>> {\n return this.xrpc(applyWrites, {\n ...options,\n service,\n labelers,\n body: {\n repo: options?.repo ?? this.assertDid,\n writes: WriteOperationHelper.build(factory),\n validate: options?.validate,\n swapCommit: options?.swapCommit,\n },\n })\n }\n\n /**\n * Uploads a blob to an AT Protocol repository.\n *\n * @param body - The blob data (Uint8Array, ReadableStream, Blob, etc.)\n * @param options - Upload options including encoding hint\n * @returns Response containing the blob reference\n *\n * @example\n * ```typescript\n * const imageData = await fetch('image.png').then(r => r.arrayBuffer())\n * const response = await client.uploadBlob(new Uint8Array(imageData), {\n * encoding: 'image/png'\n * })\n * console.log(response.body.blob) // Use this ref in records\n * ```\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async uploadBlob(\n body: BinaryBodyInit,\n { service = null, labelers = null, ...options }: UploadBlobOptions = {},\n ): Promise<XrpcResponse<typeof uploadBlob>> {\n return this.xrpc(uploadBlob, { ...options, service, labelers, body })\n }\n\n /**\n * Retrieves a blob by DID and CID.\n *\n * @param did - The DID of the repository containing the blob\n * @param cid - The CID of the blob\n * @param options - Call options\n *\n * @note This method will ignore the `service` and `labelers` instance wide\n * defaults, and will always use `null` unless explicitly overridden in the\n * options.\n */\n async getBlob(\n did: DidString,\n cid: CidString,\n { service = null, labelers = null, ...options }: GetBlobOptions = {},\n ): Promise<XrpcResponse<typeof getBlob>> {\n return this.xrpc(getBlob, {\n ...options,\n service,\n labelers,\n params: { did, cid },\n })\n }\n\n /**\n * Universal call method for queries, procedures, and custom actions.\n * Automatically determines the call type based on the lexicon definition.\n *\n * @param ns - The lexicon method or action definition\n * @param arg - The input argument (params for queries, body for procedures, input for actions)\n * @param options - Call options\n * @returns The method response body or action output\n * @see {@link xrpc} if you need access to the full response object\n *\n * @example Query\n * ```typescript\n * const profile = await client.call(app.bsky.actor.getProfile, {\n * actor: 'alice.bsky.social'\n * })\n * ```\n *\n * @example Procedure\n * ```typescript\n * const result = await client.call(com.atproto.repo.createRecord, {\n * repo: did,\n * collection: 'app.bsky.feed.post',\n * record: { text: 'Hello!' }\n * })\n * ```\n *\n * @example Action\n * ```typescript\n * const result = await client.call(updateProfile, (profile) => {\n * profile.displayName = 'Alice'\n * })\n * ```\n */\n public async call<const T extends Query>(\n ns: NonNullable<unknown> extends XrpcRequestParams<T>\n ? Main<T>\n : Restricted<'This query type requires a \"params\" argument'>,\n ): Promise<XrpcResponseBody<T>>\n public async call<const T extends Procedure>(\n ns: undefined extends InferMethodInputBody<T, Uint8Array>\n ? Main<T>\n : Restricted<'This procedure type requires an \"input\" argument'>,\n ): Promise<XrpcResponseBody<T>>\n public async call<const T extends Action>(\n ns: void extends InferActionInput<T>\n ? Main<T>\n : Restricted<'This action type requires an \"input\" argument'>,\n ): Promise<InferActionOutput<T>>\n public async call<const T extends Action | Procedure | Query>(\n ns: Main<T>,\n arg: T extends Action\n ? InferActionInput<T>\n : T extends Procedure\n ? InferMethodInputBody<T, Uint8Array>\n : T extends Query\n ? XrpcRequestParams<T>\n : never,\n options?: T extends Action\n ? ActionOptions\n : T extends Procedure\n ? Omit<XrpcOptions<T>, 'body'>\n : T extends Query\n ? Omit<XrpcOptions<T>, 'params'>\n : never,\n ): Promise<\n T extends Action\n ? InferActionOutput<T>\n : T extends Procedure\n ? XrpcResponseBody<T>\n : T extends Query\n ? XrpcResponseBody<T>\n : never\n >\n public async call(\n ns: Main<Action> | Main<Procedure> | Main<Query>,\n arg?: LexValue | Params,\n options: ActionOptions = {},\n ): Promise<unknown> {\n const method = getMain(ns)\n\n if (typeof method === 'function') {\n return method(this, arg, options)\n }\n\n if (method instanceof Procedure) {\n const result = await this.xrpc(method, { ...options, body: arg as any })\n return result.body\n } else if (method instanceof Query) {\n const result = await this.xrpc(method, { ...options, params: arg as any })\n return result.body\n } else {\n throw new TypeError('Invalid lexicon')\n }\n }\n\n /**\n * Creates a new record with full type safety based on the schema.\n *\n * @param ns - The record schema definition\n * @param input - The record data (without `$type`, which is added automatically)\n * @param options - Create options including rkey (required for some record types)\n * @returns The create output including URI and CID\n *\n * @example Creating a post\n * ```typescript\n * const result = await client.create(app.bsky.feed.post, {\n * text: 'Hello, world!',\n * createdAt: new Date().toISOString()\n * })\n * console.log(result.uri)\n * ```\n *\n * @example Creating a record with explicit rkey\n * ```typescript\n * const result = await client.create(app.bsky.actor.profile, {\n * displayName: 'Alice'\n * }, { rkey: 'self' })\n * ```\n *\n * @see {@link createRecord} for a lower-level method that returns the raw response without schema validation\n */\n public async create<const T extends RecordSchema>(\n ns: NonNullable<unknown> extends CreateOptions<T>\n ? Main<T>\n : Restricted<'This record type requires an \"options\" argument'>,\n input: Omit<Infer<T>, '$type'>,\n ): Promise<CreateOutput>\n public async create<const T extends RecordSchema>(\n ns: Main<T>,\n input: Omit<Infer<T>, '$type'>,\n options: CreateOptions<T>,\n ): Promise<CreateOutput>\n public async create<const T extends RecordSchema>(\n ns: Main<T>,\n input: Omit<Infer<T>, '$type'>,\n options: CreateOptions<T> = {} as CreateOptions<T>,\n ): Promise<CreateOutput> {\n const schema: T = getMain(ns)\n const record = schema.build(input) as TypedLexMap<NsidString>\n if (options?.validateRequest) schema.validate(record)\n const rkey = rkeyForCreate(schema, options?.rkey)\n const response = await this.createRecord(record, rkey, options)\n return response.body\n }\n\n /**\n * Deletes a record with type-safe options.\n *\n * @param ns - The record schema definition\n * @param options - Delete options (rkey required for non-literal keys)\n * @returns The delete output\n *\n * @see {@link deleteRecord} for a lower-level method that returns the raw response without schema validation\n */\n public async delete<const T extends RecordSchema>(\n ns: NonNullable<unknown> extends DeleteOptions<T>\n ? Main<T>\n : Restricted<'This record type requires an \"options\" argument'>,\n ): Promise<DeleteOutput>\n public async delete<const T extends RecordSchema>(\n ns: Main<T>,\n options?: DeleteOptions<T>,\n ): Promise<DeleteOutput>\n public async delete<const T extends RecordSchema>(\n ns: Main<T>,\n options: DeleteOptions<T> = {} as DeleteOptions<T>,\n ): Promise<DeleteOutput> {\n const schema = getMain(ns)\n const rkey = rkeyFor(schema, options.rkey)\n const response = await this.deleteRecord(schema.$type, rkey, options)\n return response.body\n }\n\n /**\n * Retrieves a record with type-safe validation.\n *\n * @param ns - The record schema definition\n * @param options - Get options (rkey required for non-literal keys)\n * @returns The record data validated against the schema\n *\n * @example\n * ```typescript\n * const profile = await client.get(app.bsky.actor.profile)\n * // profile.value is typed as app.bsky.actor.profile.Record\n * console.log(profile.value.displayName)\n * ```\n *\n * @see {@link getRecord} for a lower-level method that returns the raw record without schema validation\n */\n public async get<const T extends RecordSchema>(\n ns: T['key'] extends `literal:${string}`\n ? Main<T>\n : Restricted<'This record type requires an \"options\" argument'>,\n ): Promise<GetOutput<T>>\n public async get<const T extends RecordSchema>(\n ns: Main<T>,\n options: GetOptions<T>,\n ): Promise<GetOutput<T>>\n public async get<const T extends RecordSchema>(\n ns: Main<T>,\n options: GetOptions<T> = {} as GetOptions<T>,\n ): Promise<GetOutput<T>> {\n const schema = getMain(ns)\n const rkey = rkeyFor(schema, options.rkey)\n const response = await this.getRecord(schema.$type, rkey, options)\n const value = schema.validate(response.body.value)\n return { ...response.body, value }\n }\n\n /**\n * Creates or updates a record with full type safety.\n *\n * @param ns - The record schema definition\n * @param input - The record data\n * @param options - Put options (rkey required for non-literal keys)\n * @returns The put output including URI and CID\n *\n * @example Creating a new record\n * ```typescript\n * const result = await client.put(app.bsky.feed.post, {\n * text: 'Hello, world!',\n * createdAt: new Date().toISOString()\n * })\n * console.log(result.uri)\n * ```\n *\n * @example Updating an existing record with explicit rkey\n * ```typescript\n * const result = await client.put(app.bsky.actor.profile, {\n * displayName: 'Alice'\n * }, { rkey: 'self' })\n * ```\n *\n * @see {@link putRecord} for a lower-level method that returns the raw record without schema validation\n */\n public async put<const T extends RecordSchema>(\n ns: NonNullable<unknown> extends PutOptions<T>\n ? Main<T>\n : Restricted<'This record type requires an \"options\" argument'>,\n input: Omit<Infer<T>, '$type'>,\n ): Promise<PutOutput>\n public async put<const T extends RecordSchema>(\n ns: Main<T>,\n input: Omit<Infer<T>, '$type'>,\n options: PutOptions<T>,\n ): Promise<PutOutput>\n public async put<const T extends RecordSchema>(\n ns: Main<T>,\n input: Omit<Infer<T>, '$type'>,\n options: PutOptions<T> = {} as PutOptions<T>,\n ): Promise<PutOutput> {\n const schema: T = getMain(ns)\n const record = schema.build(input) as TypedLexMap<NsidString>\n if (options?.validateRequest) schema.validate(record)\n const rkey = rkeyFor(schema, options.rkey)\n const response = await this.putRecord(record, rkey, options)\n return response.body\n }\n\n /**\n * Lists records with type-safe validation and separation of valid/invalid records.\n *\n * @param ns - The record schema definition\n * @param options - List options\n * @returns Records validated against the schema, with invalid records included as LexMap\n *\n * @example\n * ```typescript\n * const result = await client.list(app.bsky.feed.post, { limit: 100 })\n * for (const record of result.records) {\n * if (record.valid) {\n * record.value // Fully typed\n * } else {\n * record.value // Invalid record, typed as LexMap\n * }\n * }\n * ```\n *\n * @see {@link listRecords} for a lower-level method that returns the raw records without schema validation\n */\n async list<const T extends RecordSchema>(\n ns: Main<T>,\n options?: ListOptions,\n ): Promise<ListOutput<T>> {\n const schema = getMain(ns)\n const { body } = await this.listRecords(schema.$type, options)\n const records = body.records.map(processListRecord, schema)\n return { ...body, records }\n }\n\n /**\n * Asynchronously iterates over all records in a collection, handling\n * pagination automatically.\n *\n * @param ns - The record schema definition\n * @param options - List options including limit and cursor\n * @returns An async generator yielding each record validated against the schema\n *\n * @see {@link list} for a method that returns a single page of records\n * @see {@link listRecords} for a lower-level method that returns raw records without schema validation\n */\n async *listAll<const T extends RecordSchema>(\n ns: Main<T>,\n { maxRetries = 3, ...options }: ListOptions = {},\n ): AsyncGenerator<ListRecordItem<Infer<T>>, void, unknown> {\n const schema = getMain(ns)\n\n do {\n throwIfAborted(options.signal)\n\n const { body } = await this.listRecords(schema.$type, {\n ...options,\n maxRetries,\n })\n\n // We don't use this.list() here so that we can lazily process records as\n // they come in, rather than mapping and yielding the entire page at once.\n for (const record of body.records) {\n yield processListRecord.call(schema, record)\n }\n\n // If the server returns the same cursor, we may be in a loop. Stop\n // iteration.\n if (body.cursor && body.cursor === options.cursor) {\n return\n }\n\n options.cursor = body.cursor\n } while (options.cursor)\n }\n}\n\nfunction processListRecord<T extends RecordSchema>(\n this: T,\n record: ListRecordsRecord,\n): ListRecordItem<Infer<T>> {\n const result = this.safeValidate(record.value)\n if (result.success) {\n return { ...record, valid: true, value: result.value }\n } else {\n return { ...record, valid: false }\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,4 @@
1
- export * from './agent.js';
1
+ export * from '@atproto/lex-rpc';
2
2
  export * from './client.js';
3
- export * from './errors.js';
4
- export * from './response.js';
5
- export * from './types.js';
6
- export * from './xrpc.js';
3
+ export * from './write-operation-builder.js';
7
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAEhC,cAAc,aAAa,CAAA;AAC3B,cAAc,8BAA8B,CAAA"}
package/dist/index.js CHANGED
@@ -1,7 +1,4 @@
1
- export * from './agent.js';
1
+ export * from '@atproto/lex-rpc';
2
2
  export * from './client.js';
3
- export * from './errors.js';
4
- export * from './response.js';
5
- export * from './types.js';
6
- export * from './xrpc.js';
3
+ export * from './write-operation-builder.js';
7
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA","sourcesContent":["export * from './agent.js'\nexport * from './client.js'\nexport * from './errors.js'\nexport * from './response.js'\nexport * from './types.js'\nexport * from './xrpc.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAEhC,cAAc,aAAa,CAAA;AAC3B,cAAc,8BAA8B,CAAA","sourcesContent":["export * from '@atproto/lex-rpc'\n\nexport * from './client.js'\nexport * from './write-operation-builder.js'\n"]}
@@ -1,3 +1,3 @@
1
- export * from './applyWrites.defs.js';
2
- export { main as default } from './applyWrites.defs.js';
1
+ export * from "./applyWrites.defs.js";
2
+ export { main as default } from "./applyWrites.defs.js";
3
3
  //# sourceMappingURL=applyWrites.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"applyWrites.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/applyWrites.ts"],"names":[],"mappings":"AAIA,cAAc,uBAAuB,CAAA;AACrC,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAA"}
1
+ {"version":3,"file":"applyWrites.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/applyWrites.ts"],"names":[],"mappings":"AAIA,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { l } from '@atproto/lex-schema';
2
- import * as RepoDefs from './defs.defs.js';
1
+ import { l } from "@atproto/lex-schema";
2
+ import * as RepoDefs from "./defs.defs.js";
3
3
  declare const $nsid = "com.atproto.repo.applyWrites";
4
4
  type $nsid = typeof $nsid;
5
5
  export { $nsid };
@@ -43,13 +43,13 @@ type $lxm = typeof $lxm;
43
43
  export { $lxm };
44
44
  /** Operation which creates a new record. */
45
45
  type Create = {
46
- $type?: 'com.atproto.repo.applyWrites#create';
47
- collection: l.NsidString;
46
+ $type?: "com.atproto.repo.applyWrites#create";
47
+ "collection": l.NsidString;
48
48
  /**
49
49
  * NOTE: maxLength is redundant with record-key format. Keeping it temporarily to ensure backwards compatibility.
50
50
  */
51
- rkey?: l.RecordKeyString;
52
- value: l.LexMap;
51
+ "rkey"?: l.RecordKeyString;
52
+ "value": l.LexMap;
53
53
  };
54
54
  export type { Create };
55
55
  /** Operation which creates a new record. */
@@ -57,10 +57,10 @@ declare const create: l.TypedObjectSchema<"com.atproto.repo.applyWrites#create",
57
57
  export { create };
58
58
  /** Operation which updates an existing record. */
59
59
  type Update = {
60
- $type?: 'com.atproto.repo.applyWrites#update';
61
- collection: l.NsidString;
62
- rkey: l.RecordKeyString;
63
- value: l.LexMap;
60
+ $type?: "com.atproto.repo.applyWrites#update";
61
+ "collection": l.NsidString;
62
+ "rkey": l.RecordKeyString;
63
+ "value": l.LexMap;
64
64
  };
65
65
  export type { Update };
66
66
  /** Operation which updates an existing record. */
@@ -68,34 +68,34 @@ declare const update: l.TypedObjectSchema<"com.atproto.repo.applyWrites#update",
68
68
  export { update };
69
69
  /** Operation which deletes an existing record. */
70
70
  type Delete$0 = {
71
- $type?: 'com.atproto.repo.applyWrites#delete';
72
- collection: l.NsidString;
73
- rkey: l.RecordKeyString;
71
+ $type?: "com.atproto.repo.applyWrites#delete";
72
+ "collection": l.NsidString;
73
+ "rkey": l.RecordKeyString;
74
74
  };
75
75
  export type { Delete$0 as Delete };
76
76
  /** Operation which deletes an existing record. */
77
77
  declare const delete$0: l.TypedObjectSchema<"com.atproto.repo.applyWrites#delete", l.Validator<Delete$0, Delete$0>>;
78
- export { delete$0 as 'delete' };
78
+ export { delete$0 as "delete" };
79
79
  type CreateResult = {
80
- $type?: 'com.atproto.repo.applyWrites#createResult';
81
- uri: l.AtUriString;
82
- cid: l.CidString;
83
- validationStatus?: 'valid' | 'unknown' | l.UnknownString;
80
+ $type?: "com.atproto.repo.applyWrites#createResult";
81
+ "uri": l.AtUriString;
82
+ "cid": l.CidString;
83
+ "validationStatus"?: "valid" | "unknown" | l.UnknownString;
84
84
  };
85
85
  export type { CreateResult };
86
86
  declare const createResult: l.TypedObjectSchema<"com.atproto.repo.applyWrites#createResult", l.Validator<CreateResult, CreateResult>>;
87
87
  export { createResult };
88
88
  type UpdateResult = {
89
- $type?: 'com.atproto.repo.applyWrites#updateResult';
90
- uri: l.AtUriString;
91
- cid: l.CidString;
92
- validationStatus?: 'valid' | 'unknown' | l.UnknownString;
89
+ $type?: "com.atproto.repo.applyWrites#updateResult";
90
+ "uri": l.AtUriString;
91
+ "cid": l.CidString;
92
+ "validationStatus"?: "valid" | "unknown" | l.UnknownString;
93
93
  };
94
94
  export type { UpdateResult };
95
95
  declare const updateResult: l.TypedObjectSchema<"com.atproto.repo.applyWrites#updateResult", l.Validator<UpdateResult, UpdateResult>>;
96
96
  export { updateResult };
97
97
  type DeleteResult = {
98
- $type?: 'com.atproto.repo.applyWrites#deleteResult';
98
+ $type?: "com.atproto.repo.applyWrites#deleteResult";
99
99
  };
100
100
  export type { DeleteResult };
101
101
  declare const deleteResult: l.TypedObjectSchema<"com.atproto.repo.applyWrites#deleteResult", l.Validator<DeleteResult, DeleteResult>>;