@atproto/lexicon-resolver 0.2.5 → 0.3.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 (82) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE.txt +1 -1
  3. package/dist/lexicon.d.ts +13 -13
  4. package/dist/lexicon.d.ts.map +1 -1
  5. package/dist/lexicon.js +46 -20
  6. package/dist/lexicon.js.map +1 -1
  7. package/dist/lexicons/com/atproto/lexicon/schema.d.ts +3 -0
  8. package/dist/lexicons/com/atproto/lexicon/schema.d.ts.map +1 -0
  9. package/dist/lexicons/com/atproto/lexicon/schema.defs.d.ts +50 -0
  10. package/dist/lexicons/com/atproto/lexicon/schema.defs.d.ts.map +1 -0
  11. package/dist/lexicons/com/atproto/lexicon/schema.defs.js +15 -0
  12. package/dist/lexicons/com/atproto/lexicon/schema.defs.js.map +1 -0
  13. package/dist/lexicons/com/atproto/lexicon/schema.js +45 -0
  14. package/dist/lexicons/com/atproto/lexicon/schema.js.map +1 -0
  15. package/dist/lexicons/com/atproto/lexicon.d.ts +2 -0
  16. package/dist/lexicons/com/atproto/lexicon.d.ts.map +1 -0
  17. package/dist/lexicons/com/atproto/lexicon.js +41 -0
  18. package/dist/lexicons/com/atproto/lexicon.js.map +1 -0
  19. package/dist/lexicons/com/atproto/sync/getRecord.d.ts +3 -0
  20. package/dist/lexicons/com/atproto/sync/getRecord.d.ts.map +1 -0
  21. package/dist/lexicons/com/atproto/sync/getRecord.defs.d.ts +31 -0
  22. package/dist/lexicons/com/atproto/sync/getRecord.defs.d.ts.map +1 -0
  23. package/dist/lexicons/com/atproto/sync/getRecord.defs.js +24 -0
  24. package/dist/lexicons/com/atproto/sync/getRecord.defs.js.map +1 -0
  25. package/dist/lexicons/com/atproto/sync/getRecord.js +45 -0
  26. package/dist/lexicons/com/atproto/sync/getRecord.js.map +1 -0
  27. package/dist/lexicons/com/atproto/sync.d.ts +2 -0
  28. package/dist/lexicons/com/atproto/sync.d.ts.map +1 -0
  29. package/dist/lexicons/com/atproto/sync.js +41 -0
  30. package/dist/lexicons/com/atproto/sync.js.map +1 -0
  31. package/dist/lexicons/com/atproto.d.ts +3 -0
  32. package/dist/lexicons/com/atproto.d.ts.map +1 -0
  33. package/dist/lexicons/com/atproto.js +42 -0
  34. package/dist/lexicons/com/atproto.js.map +1 -0
  35. package/dist/lexicons/com.d.ts +2 -0
  36. package/dist/lexicons/com.d.ts.map +1 -0
  37. package/dist/lexicons/com.js +41 -0
  38. package/dist/lexicons/com.js.map +1 -0
  39. package/dist/lexicons/index.d.ts +2 -0
  40. package/dist/lexicons/index.d.ts.map +1 -0
  41. package/dist/lexicons/index.js +41 -0
  42. package/dist/lexicons/index.js.map +1 -0
  43. package/dist/record.d.ts +9 -10
  44. package/dist/record.d.ts.map +1 -1
  45. package/dist/record.js +21 -18
  46. package/dist/record.js.map +1 -1
  47. package/package.json +7 -9
  48. package/src/lexicon.ts +29 -37
  49. package/src/lexicons/com/atproto/lexicon/schema.defs.ts +43 -0
  50. package/src/lexicons/com/atproto/lexicon/schema.ts +6 -0
  51. package/src/lexicons/com/atproto/lexicon.ts +5 -0
  52. package/src/lexicons/com/atproto/sync/getRecord.defs.ts +39 -0
  53. package/src/lexicons/com/atproto/sync/getRecord.ts +6 -0
  54. package/src/lexicons/com/atproto/sync.ts +5 -0
  55. package/src/lexicons/com/atproto.ts +6 -0
  56. package/src/lexicons/com.ts +5 -0
  57. package/src/lexicons/index.ts +5 -0
  58. package/src/record.ts +58 -32
  59. package/tests/lexicon.test.ts +4 -3
  60. package/tests/record.test.ts +99 -6
  61. package/tsconfig.build.tsbuildinfo +1 -1
  62. package/dist/client/index.d.ts +0 -28
  63. package/dist/client/index.d.ts.map +0 -1
  64. package/dist/client/index.js +0 -118
  65. package/dist/client/index.js.map +0 -1
  66. package/dist/client/lexicons.d.ts +0 -105
  67. package/dist/client/lexicons.d.ts.map +0 -1
  68. package/dist/client/lexicons.js +0 -75
  69. package/dist/client/lexicons.js.map +0 -1
  70. package/dist/client/types/com/atproto/sync/getRecord.d.ts +0 -38
  71. package/dist/client/types/com/atproto/sync/getRecord.d.ts.map +0 -1
  72. package/dist/client/types/com/atproto/sync/getRecord.js +0 -58
  73. package/dist/client/types/com/atproto/sync/getRecord.js.map +0 -1
  74. package/dist/client/util.d.ts +0 -37
  75. package/dist/client/util.d.ts.map +0 -1
  76. package/dist/client/util.js +0 -38
  77. package/dist/client/util.js.map +0 -1
  78. package/src/client/index.ts +0 -67
  79. package/src/client/lexicons.ts +0 -98
  80. package/src/client/types/com/atproto/sync/getRecord.ts +0 -78
  81. package/src/client/util.ts +0 -82
  82. package/tsconfig.tests.tsbuildinfo +0 -1
@@ -0,0 +1,39 @@
1
+ /*
2
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
3
+ */
4
+
5
+ import { l } from '@atproto/lex'
6
+
7
+ const $nsid = 'com.atproto.sync.getRecord'
8
+
9
+ export { $nsid }
10
+
11
+ /** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */
12
+ const main = l.query(
13
+ $nsid,
14
+ l.params({
15
+ did: l.string({ format: 'did' }),
16
+ collection: l.string({ format: 'nsid' }),
17
+ rkey: l.string({ format: 'record-key' }),
18
+ }),
19
+ l.payload('application/vnd.ipld.car'),
20
+ [
21
+ 'RecordNotFound',
22
+ 'RepoNotFound',
23
+ 'RepoTakendown',
24
+ 'RepoSuspended',
25
+ 'RepoDeactivated',
26
+ ],
27
+ )
28
+ export { main }
29
+
30
+ export type $Params = l.InferMethodParams<typeof main>
31
+ export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>
32
+ export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<
33
+ typeof main,
34
+ B
35
+ >
36
+
37
+ export const $lxm = main.nsid,
38
+ $params = main.parameters,
39
+ $output = main.output
@@ -0,0 +1,6 @@
1
+ /*
2
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
3
+ */
4
+
5
+ export * from './getRecord.defs.js'
6
+ export * as $defs from './getRecord.defs.js'
@@ -0,0 +1,5 @@
1
+ /*
2
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
3
+ */
4
+
5
+ export * as getRecord from './sync/getRecord.js'
@@ -0,0 +1,6 @@
1
+ /*
2
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
3
+ */
4
+
5
+ export * as lexicon from './atproto/lexicon.js'
6
+ export * as sync from './atproto/sync.js'
@@ -0,0 +1,5 @@
1
+ /*
2
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
3
+ */
4
+
5
+ export * as atproto from './com/atproto.js'
@@ -0,0 +1,5 @@
1
+ /*
2
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
3
+ */
4
+
5
+ export * as com from './com.js'
package/src/record.ts CHANGED
@@ -1,8 +1,13 @@
1
- /* eslint-disable import/no-deprecated */
2
-
3
- import { CID } from 'multiformats/cid'
4
- import { IdResolver } from '@atproto/identity'
5
- import { RepoRecord } from '@atproto/lexicon'
1
+ import { IdResolver, parseToAtprotoDocument } from '@atproto/identity'
2
+ import {
3
+ AgentConfig,
4
+ Cid,
5
+ Client,
6
+ DidString,
7
+ FetchHandler,
8
+ LexMap,
9
+ l,
10
+ } from '@atproto/lex'
6
11
  import {
7
12
  Commit,
8
13
  MST,
@@ -11,28 +16,39 @@ import {
11
16
  readCarWithRoot,
12
17
  verifyCommitSig,
13
18
  } from '@atproto/repo'
14
- import { AtUri, ensureValidDid } from '@atproto/syntax'
15
- import { BuildFetchHandlerOptions, FetchHandler } from '@atproto/xrpc'
19
+ import { AtUri, AtUriString } from '@atproto/syntax'
16
20
  import { safeFetchWrap } from '@atproto-labs/fetch-node'
17
- import { AtpBaseClient as Client } from './client/index.js'
18
- import { isValidDid } from './util.js'
21
+ import { com } from './lexicons/index.js'
22
+
23
+ export { AtUri, IdResolver }
24
+ export type {
25
+ AgentConfig,
26
+ AtUriString,
27
+ Cid,
28
+ Commit,
29
+ DidString,
30
+ FetchHandler,
31
+ LexMap,
32
+ }
19
33
 
20
34
  /**
21
35
  * Resolve a record from the network.
22
36
  */
23
- export type RecordResolver = (uri: AtUri | string) => Promise<RecordResolution>
37
+ export type RecordResolver = (
38
+ uri: AtUri | AtUriString,
39
+ ) => Promise<RecordResolution>
24
40
 
25
41
  /**
26
42
  * Resolve a record from the network, verifying its authenticity.
27
43
  */
28
44
  export type AtprotoRecordResolver = (
29
- uri: AtUri | string,
45
+ uri: AtUri | AtUriString,
30
46
  options?: ResolveRecordOptions,
31
47
  ) => Promise<RecordResolution>
32
48
 
33
49
  export type BuildRecordResolverOptions = {
34
50
  idResolver?: IdResolver
35
- rpc?: Partial<BuildFetchHandlerOptions> | FetchHandler
51
+ rpc?: Partial<AgentConfig> | FetchHandler
36
52
  }
37
53
 
38
54
  export type ResolveRecordOptions = {
@@ -42,12 +58,10 @@ export type ResolveRecordOptions = {
42
58
  export type RecordResolution = {
43
59
  commit: Commit
44
60
  uri: AtUri
45
- cid: CID
46
- record: RepoRecord
61
+ cid: Cid
62
+ record: LexMap
47
63
  }
48
64
 
49
- export { AtUri, CID, type Commit, IdResolver, type RepoRecord }
50
-
51
65
  /**
52
66
  * Build a record resolver function.
53
67
  */
@@ -56,32 +70,43 @@ export function buildRecordResolver(
56
70
  ): AtprotoRecordResolver {
57
71
  const { idResolver = new IdResolver(), rpc } = options
58
72
  return async function resolveRecord(
59
- uriStr: AtUri | string,
73
+ uriStr: AtUri | AtUriString,
60
74
  opts: ResolveRecordOptions = {},
61
75
  ): Promise<RecordResolution> {
62
76
  const uri = typeof uriStr === 'string' ? new AtUri(uriStr) : uriStr
63
77
  const did = await getDidFromUri(uri, { idResolver })
64
- const identity = await idResolver.did
65
- .resolveAtprotoData(did, opts.forceRefresh)
78
+ const identityDoc = await idResolver.did
79
+ .ensureResolve(did, opts.forceRefresh)
66
80
  .catch((err) => {
67
81
  throw new RecordResolutionError('Could not resolve DID identity data', {
68
82
  cause: err,
69
83
  })
70
84
  })
85
+ const { pds, signingKey } = parseToAtprotoDocument(identityDoc)
86
+ if (!pds) {
87
+ throw new RecordResolutionError(
88
+ 'Incomplete DID identity data: missing pds',
89
+ )
90
+ }
91
+ if (!signingKey) {
92
+ throw new RecordResolutionError(
93
+ 'Incomplete DID identity data: missing signing key',
94
+ )
95
+ }
71
96
  const client = new Client(
72
97
  typeof rpc === 'function'
73
- ? rpc
98
+ ? { fetchHandler: rpc }
74
99
  : {
75
100
  ...rpc,
76
- service: rpc?.service ?? identity.pds,
101
+ service: rpc?.service ?? pds,
77
102
  fetch: rpc?.fetch ?? safeFetch,
78
103
  },
79
104
  )
80
- const { data: proofBytes } = await client.com.atproto.sync
81
- .getRecord({
105
+ const proofBytes = await client
106
+ .call(com.atproto.sync.getRecord, {
82
107
  did,
83
- collection: uri.collection,
84
- rkey: uri.rkey,
108
+ collection: uri.collection as l.NsidString,
109
+ rkey: uri.rkey as l.RecordKeyString,
85
110
  })
86
111
  .catch((err) => {
87
112
  throw new RecordResolutionError('Could not fetch record proof', {
@@ -90,7 +115,7 @@ export function buildRecordResolver(
90
115
  })
91
116
  const verified = await verifyRecordProof(proofBytes, {
92
117
  uri: AtUri.make(did, uri.collection, uri.rkey),
93
- signingKey: identity.signingKey,
118
+ signingKey,
94
119
  })
95
120
  return verified
96
121
  }
@@ -114,22 +139,23 @@ export class RecordResolutionError extends Error {
114
139
  async function getDidFromUri(
115
140
  uri: AtUri,
116
141
  { idResolver }: { idResolver: IdResolver },
117
- ) {
118
- if (uri.host.startsWith('did:')) {
119
- ensureValidDid(uri.host)
142
+ ): Promise<DidString> {
143
+ if (l.isDidString(uri.host)) {
120
144
  return uri.host
121
145
  }
146
+
122
147
  const resolved = await idResolver.handle.resolve(uri.host)
123
- if (!resolved || !isValidDid(resolved)) {
148
+ if (!resolved || !l.isDidString(resolved)) {
124
149
  throw new RecordResolutionError('Could not resolve handle found in AT-URI')
125
150
  }
151
+
126
152
  return resolved
127
153
  }
128
154
 
129
155
  async function verifyRecordProof(
130
156
  proofBytes: Uint8Array,
131
157
  { uri, signingKey }: { uri: AtUri; signingKey: string },
132
- ) {
158
+ ): Promise<RecordResolution> {
133
159
  const { root, blocks } = await readCarWithRoot(proofBytes).catch((err) => {
134
160
  throw new RecordResolutionError('Malformed record proof', { cause: err })
135
161
  })
@@ -153,6 +179,6 @@ async function verifyRecordProof(
153
179
  if (!cid) {
154
180
  throw new RecordResolutionError('Record not found in proof')
155
181
  }
156
- const record = await blockstore.readRecord(cid)
182
+ const record = (await blockstore.readRecord(cid)) as LexMap
157
183
  return { commit, uri, cid, record }
158
184
  }
@@ -1,5 +1,5 @@
1
1
  import { SeedClient, TestNetworkNoAppView, usersSeed } from '@atproto/dev-env'
2
- import { NSID } from '@atproto/syntax'
2
+ import { DidString, NSID } from '@atproto/syntax'
3
3
  import {
4
4
  AtprotoLexiconResolver,
5
5
  buildLexiconResolver,
@@ -157,7 +157,7 @@ describe('Lexicon resolution', () => {
157
157
  name: 'LexiconResolutionError',
158
158
  message: 'Invalid Lexicon document (example.alice.baddoc)',
159
159
  cause: expect.objectContaining({
160
- name: 'ZodError',
160
+ name: 'LexValidationError',
161
161
  }),
162
162
  }),
163
163
  )
@@ -184,7 +184,7 @@ describe('Lexicon resolution', () => {
184
184
  sc.getHeaders(sc.dids.carol),
185
185
  )
186
186
  const result = await resolveLexicon('example.alice.override', {
187
- didAuthority: sc.dids.carol,
187
+ didAuthority: sc.dids.carol as DidString,
188
188
  forceRefresh: true,
189
189
  })
190
190
  expect(result.commit.did).toEqual(sc.dids.carol)
@@ -248,6 +248,7 @@ describe('Lexicon resolution', () => {
248
248
  })
249
249
 
250
250
  it('fails on invalid NSID', async () => {
251
+ // @ts-expect-error testing invalid input
251
252
  await expect(resolveLexiconDidAuthority('not an nsid')).rejects.toThrow(
252
253
  'Disallowed characters in NSID',
253
254
  )
@@ -1,7 +1,7 @@
1
- /* eslint-disable import/no-deprecated */
2
-
3
- import { dataToCborBlock } from '@atproto/common'
1
+ import assert from 'node:assert'
4
2
  import { SeedClient, TestNetworkNoAppView, usersSeed } from '@atproto/dev-env'
3
+ import { AtUriString, l } from '@atproto/lex'
4
+ import { encode } from '@atproto/lex-cbor'
5
5
  import { AtprotoRecordResolver, buildRecordResolver } from '../src/index.js'
6
6
 
7
7
  describe('Record resolution', () => {
@@ -38,6 +38,7 @@ describe('Record resolution', () => {
38
38
 
39
39
  it('resolves record by AT-URI string.', async () => {
40
40
  const post = await sc.post(sc.dids.alice, 'post2')
41
+ assert(l.isAtUriString(post.ref.uriStr))
41
42
  const result = await resolveRecord(post.ref.uriStr, {
42
43
  forceRefresh: true,
43
44
  })
@@ -80,13 +81,13 @@ describe('Record resolution', () => {
80
81
 
81
82
  it('does not resolve record with corrupted CAR block.', async () => {
82
83
  const post = await sc.post(sc.dids.alice, 'post4')
83
- const badBlock = await dataToCborBlock({})
84
+ const badCbor = encode({})
84
85
  await network.pds.ctx.actorStore.transact(sc.dids.alice, (txn) =>
85
86
  txn.repo.db.db
86
87
  .updateTable('repo_block')
87
88
  .set({
88
- content: badBlock.bytes,
89
- size: badBlock.bytes.byteLength,
89
+ content: badCbor,
90
+ size: badCbor.byteLength,
90
91
  })
91
92
  .where('cid', '=', post.ref.cidStr)
92
93
  .execute(),
@@ -97,4 +98,96 @@ describe('Record resolution', () => {
97
98
  }),
98
99
  ).rejects.toThrow('Malformed record proof')
99
100
  })
101
+
102
+ it('does not resolve record with missing signing key.', async () => {
103
+ const post = await sc.post(sc.dids.alice, 'post5')
104
+ await network.pds.ctx.plcClient.updateData(
105
+ sc.dids.alice,
106
+ network.pds.ctx.plcRotationKey,
107
+ (doc) => {
108
+ doc.verificationMethods = {
109
+ not_atproto: doc.verificationMethods.atproto,
110
+ }
111
+ return doc
112
+ },
113
+ )
114
+ await expect(
115
+ resolveRecord(post.ref.uri, {
116
+ forceRefresh: true,
117
+ }),
118
+ ).rejects.toThrow('Incomplete DID identity data: missing signing key')
119
+ // reset alice's key
120
+ await network.pds.ctx.plcClient.updateData(
121
+ sc.dids.alice,
122
+ network.pds.ctx.plcRotationKey,
123
+ (doc) => {
124
+ doc.verificationMethods = {
125
+ atproto: doc.verificationMethods.not_atproto,
126
+ }
127
+ return doc
128
+ },
129
+ )
130
+ })
131
+
132
+ it('does not resolve record with missing pds.', async () => {
133
+ const post = await sc.post(sc.dids.alice, 'post6')
134
+ await network.pds.ctx.plcClient.updateData(
135
+ sc.dids.alice,
136
+ network.pds.ctx.plcRotationKey,
137
+ (doc) => {
138
+ doc.services = {
139
+ not_atproto_pds: doc.services.atproto_pds,
140
+ }
141
+ return doc
142
+ },
143
+ )
144
+ await expect(
145
+ resolveRecord(post.ref.uri, {
146
+ forceRefresh: true,
147
+ }),
148
+ ).rejects.toThrow('Incomplete DID identity data: missing pds')
149
+ // reset alice's pds
150
+ await network.pds.ctx.plcClient.updateData(
151
+ sc.dids.alice,
152
+ network.pds.ctx.plcRotationKey,
153
+ (doc) => {
154
+ doc.services = {
155
+ atproto_pds: doc.services.not_atproto_pds,
156
+ }
157
+ return doc
158
+ },
159
+ )
160
+ })
161
+
162
+ it('resolves record despite missing at:// handle.', async () => {
163
+ const post = await sc.post(sc.dids.alice, 'post7')
164
+ await network.pds.ctx.plcClient.updateData(
165
+ sc.dids.alice,
166
+ network.pds.ctx.plcRotationKey,
167
+ (doc) => {
168
+ doc.alsoKnownAs = doc.alsoKnownAs.map((aka) =>
169
+ aka.replace('at://', 'notat://'),
170
+ )
171
+ return doc
172
+ },
173
+ )
174
+ const result = await resolveRecord(post.ref.uriStr as AtUriString, {
175
+ forceRefresh: true,
176
+ })
177
+ expect(result.commit.did).toEqual(sc.dids.alice)
178
+ expect(result.cid.toString()).toEqual(post.ref.cidStr)
179
+ expect(result.uri.toString()).toEqual(post.ref.uriStr)
180
+ expect(result.record.text).toEqual('post7')
181
+ // reset alice's handle
182
+ await network.pds.ctx.plcClient.updateData(
183
+ sc.dids.alice,
184
+ network.pds.ctx.plcRotationKey,
185
+ (doc) => {
186
+ doc.alsoKnownAs = doc.alsoKnownAs.map((aka) =>
187
+ aka.replace('notat://', 'at://'),
188
+ )
189
+ return doc
190
+ },
191
+ )
192
+ })
100
193
  })
@@ -1 +1 @@
1
- {"root":["./src/index.ts","./src/lexicon.ts","./src/record.ts","./src/util.ts","./src/client/index.ts","./src/client/lexicons.ts","./src/client/util.ts","./src/client/types/com/atproto/sync/getRecord.ts"],"version":"5.8.3"}
1
+ {"root":["./src/index.ts","./src/lexicon.ts","./src/record.ts","./src/util.ts","./src/lexicons/com.ts","./src/lexicons/index.ts","./src/lexicons/com/atproto.ts","./src/lexicons/com/atproto/lexicon.ts","./src/lexicons/com/atproto/sync.ts","./src/lexicons/com/atproto/lexicon/schema.defs.ts","./src/lexicons/com/atproto/lexicon/schema.ts","./src/lexicons/com/atproto/sync/getRecord.defs.ts","./src/lexicons/com/atproto/sync/getRecord.ts"],"version":"5.8.3"}
@@ -1,28 +0,0 @@
1
- /**
2
- * GENERATED CODE - DO NOT MODIFY
3
- */
4
- import { XrpcClient, type FetchHandler, type FetchHandlerOptions } from '@atproto/xrpc';
5
- import * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord.js';
6
- export * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord.js';
7
- export declare class AtpBaseClient extends XrpcClient {
8
- com: ComNS;
9
- constructor(options: FetchHandler | FetchHandlerOptions);
10
- /** @deprecated use `this` instead */
11
- get xrpc(): XrpcClient;
12
- }
13
- export declare class ComNS {
14
- _client: XrpcClient;
15
- atproto: ComAtprotoNS;
16
- constructor(client: XrpcClient);
17
- }
18
- export declare class ComAtprotoNS {
19
- _client: XrpcClient;
20
- sync: ComAtprotoSyncNS;
21
- constructor(client: XrpcClient);
22
- }
23
- export declare class ComAtprotoSyncNS {
24
- _client: XrpcClient;
25
- constructor(client: XrpcClient);
26
- getRecord(params?: ComAtprotoSyncGetRecord.QueryParams, opts?: ComAtprotoSyncGetRecord.CallOptions): Promise<ComAtprotoSyncGetRecord.Response>;
27
- }
28
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAA;AAItB,OAAO,KAAK,uBAAuB,MAAM,uCAAuC,CAAA;AAEhF,OAAO,KAAK,uBAAuB,MAAM,uCAAuC,CAAA;AAEhF,qBAAa,aAAc,SAAQ,UAAU;IAC3C,GAAG,EAAE,KAAK,CAAA;gBAEE,OAAO,EAAE,YAAY,GAAG,mBAAmB;IAKvD,qCAAqC;IACrC,IAAI,IAAI,IAAI,UAAU,CAErB;CACF;AAED,qBAAa,KAAK;IAChB,OAAO,EAAE,UAAU,CAAA;IACnB,OAAO,EAAE,YAAY,CAAA;gBAET,MAAM,EAAE,UAAU;CAI/B;AAED,qBAAa,YAAY;IACvB,OAAO,EAAE,UAAU,CAAA;IACnB,IAAI,EAAE,gBAAgB,CAAA;gBAEV,MAAM,EAAE,UAAU;CAI/B;AAED,qBAAa,gBAAgB;IAC3B,OAAO,EAAE,UAAU,CAAA;gBAEP,MAAM,EAAE,UAAU;IAI9B,SAAS,CACP,MAAM,CAAC,EAAE,uBAAuB,CAAC,WAAW,EAC5C,IAAI,CAAC,EAAE,uBAAuB,CAAC,WAAW,GACzC,OAAO,CAAC,uBAAuB,CAAC,QAAQ,CAAC;CAO7C"}
@@ -1,118 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ComAtprotoSyncNS = exports.ComAtprotoNS = exports.ComNS = exports.AtpBaseClient = exports.ComAtprotoSyncGetRecord = void 0;
37
- /**
38
- * GENERATED CODE - DO NOT MODIFY
39
- */
40
- const xrpc_1 = require("@atproto/xrpc");
41
- const lexicons_js_1 = require("./lexicons.js");
42
- const ComAtprotoSyncGetRecord = __importStar(require("./types/com/atproto/sync/getRecord.js"));
43
- exports.ComAtprotoSyncGetRecord = __importStar(require("./types/com/atproto/sync/getRecord.js"));
44
- class AtpBaseClient extends xrpc_1.XrpcClient {
45
- constructor(options) {
46
- super(options, lexicons_js_1.schemas);
47
- Object.defineProperty(this, "com", {
48
- enumerable: true,
49
- configurable: true,
50
- writable: true,
51
- value: void 0
52
- });
53
- this.com = new ComNS(this);
54
- }
55
- /** @deprecated use `this` instead */
56
- get xrpc() {
57
- return this;
58
- }
59
- }
60
- exports.AtpBaseClient = AtpBaseClient;
61
- class ComNS {
62
- constructor(client) {
63
- Object.defineProperty(this, "_client", {
64
- enumerable: true,
65
- configurable: true,
66
- writable: true,
67
- value: void 0
68
- });
69
- Object.defineProperty(this, "atproto", {
70
- enumerable: true,
71
- configurable: true,
72
- writable: true,
73
- value: void 0
74
- });
75
- this._client = client;
76
- this.atproto = new ComAtprotoNS(client);
77
- }
78
- }
79
- exports.ComNS = ComNS;
80
- class ComAtprotoNS {
81
- constructor(client) {
82
- Object.defineProperty(this, "_client", {
83
- enumerable: true,
84
- configurable: true,
85
- writable: true,
86
- value: void 0
87
- });
88
- Object.defineProperty(this, "sync", {
89
- enumerable: true,
90
- configurable: true,
91
- writable: true,
92
- value: void 0
93
- });
94
- this._client = client;
95
- this.sync = new ComAtprotoSyncNS(client);
96
- }
97
- }
98
- exports.ComAtprotoNS = ComAtprotoNS;
99
- class ComAtprotoSyncNS {
100
- constructor(client) {
101
- Object.defineProperty(this, "_client", {
102
- enumerable: true,
103
- configurable: true,
104
- writable: true,
105
- value: void 0
106
- });
107
- this._client = client;
108
- }
109
- getRecord(params, opts) {
110
- return this._client
111
- .call('com.atproto.sync.getRecord', params, undefined, opts)
112
- .catch((e) => {
113
- throw ComAtprotoSyncGetRecord.toKnownErr(e);
114
- });
115
- }
116
- }
117
- exports.ComAtprotoSyncNS = ComAtprotoSyncNS;
118
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,wCAIsB;AACtB,+CAAuC;AAGvC,+FAAgF;AAEhF,iGAAgF;AAEhF,MAAa,aAAc,SAAQ,iBAAU;IAG3C,YAAY,OAA2C;QACrD,KAAK,CAAC,OAAO,EAAE,qBAAO,CAAC,CAAA;QAHzB;;;;;WAAU;QAIR,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;IAED,qCAAqC;IACrC,IAAI,IAAI;QACN,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAZD,sCAYC;AAED,MAAa,KAAK;IAIhB,YAAY,MAAkB;QAH9B;;;;;WAAmB;QACnB;;;;;WAAqB;QAGnB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAA;IACzC,CAAC;CACF;AARD,sBAQC;AAED,MAAa,YAAY;IAIvB,YAAY,MAAkB;QAH9B;;;;;WAAmB;QACnB;;;;;WAAsB;QAGpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC1C,CAAC;CACF;AARD,oCAQC;AAED,MAAa,gBAAgB;IAG3B,YAAY,MAAkB;QAF9B;;;;;WAAmB;QAGjB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAED,SAAS,CACP,MAA4C,EAC5C,IAA0C;QAE1C,OAAO,IAAI,CAAC,OAAO;aAChB,IAAI,CAAC,4BAA4B,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC;aAC3D,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACX,MAAM,uBAAuB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QAC7C,CAAC,CAAC,CAAA;IACN,CAAC;CACF;AAjBD,4CAiBC","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\nimport {\n XrpcClient,\n type FetchHandler,\n type FetchHandlerOptions,\n} from '@atproto/xrpc'\nimport { schemas } from './lexicons.js'\nimport { CID } from 'multiformats/cid'\nimport { type OmitKey, type Un$Typed } from './util.js'\nimport * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord.js'\n\nexport * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord.js'\n\nexport class AtpBaseClient extends XrpcClient {\n com: ComNS\n\n constructor(options: FetchHandler | FetchHandlerOptions) {\n super(options, schemas)\n this.com = new ComNS(this)\n }\n\n /** @deprecated use `this` instead */\n get xrpc(): XrpcClient {\n return this\n }\n}\n\nexport class ComNS {\n _client: XrpcClient\n atproto: ComAtprotoNS\n\n constructor(client: XrpcClient) {\n this._client = client\n this.atproto = new ComAtprotoNS(client)\n }\n}\n\nexport class ComAtprotoNS {\n _client: XrpcClient\n sync: ComAtprotoSyncNS\n\n constructor(client: XrpcClient) {\n this._client = client\n this.sync = new ComAtprotoSyncNS(client)\n }\n}\n\nexport class ComAtprotoSyncNS {\n _client: XrpcClient\n\n constructor(client: XrpcClient) {\n this._client = client\n }\n\n getRecord(\n params?: ComAtprotoSyncGetRecord.QueryParams,\n opts?: ComAtprotoSyncGetRecord.CallOptions,\n ): Promise<ComAtprotoSyncGetRecord.Response> {\n return this._client\n .call('com.atproto.sync.getRecord', params, undefined, opts)\n .catch((e) => {\n throw ComAtprotoSyncGetRecord.toKnownErr(e)\n })\n }\n}\n"]}