@atproto/api 0.12.13 → 0.12.14

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 (58) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/client/index.d.ts +3 -0
  3. package/dist/client/index.d.ts.map +1 -1
  4. package/dist/client/index.js +13 -4
  5. package/dist/client/index.js.map +1 -1
  6. package/dist/client/lexicons.d.ts +105 -0
  7. package/dist/client/lexicons.d.ts.map +1 -1
  8. package/dist/client/lexicons.js +185 -4
  9. package/dist/client/lexicons.js.map +1 -1
  10. package/dist/client/types/chat/bsky/convo/defs.d.ts +1 -1
  11. package/dist/client/types/com/atproto/sync/getBlob.d.ts +16 -1
  12. package/dist/client/types/com/atproto/sync/getBlob.d.ts.map +1 -1
  13. package/dist/client/types/com/atproto/sync/getBlob.js +41 -1
  14. package/dist/client/types/com/atproto/sync/getBlob.js.map +1 -1
  15. package/dist/client/types/com/atproto/sync/getBlocks.d.ts +16 -1
  16. package/dist/client/types/com/atproto/sync/getBlocks.d.ts.map +1 -1
  17. package/dist/client/types/com/atproto/sync/getBlocks.js +41 -1
  18. package/dist/client/types/com/atproto/sync/getBlocks.js.map +1 -1
  19. package/dist/client/types/com/atproto/sync/getLatestCommit.d.ts +9 -0
  20. package/dist/client/types/com/atproto/sync/getLatestCommit.d.ts.map +1 -1
  21. package/dist/client/types/com/atproto/sync/getLatestCommit.js +25 -1
  22. package/dist/client/types/com/atproto/sync/getLatestCommit.js.map +1 -1
  23. package/dist/client/types/com/atproto/sync/getRecord.d.ts +16 -1
  24. package/dist/client/types/com/atproto/sync/getRecord.d.ts.map +1 -1
  25. package/dist/client/types/com/atproto/sync/getRecord.js +41 -1
  26. package/dist/client/types/com/atproto/sync/getRecord.js.map +1 -1
  27. package/dist/client/types/com/atproto/sync/getRepo.d.ts +13 -1
  28. package/dist/client/types/com/atproto/sync/getRepo.d.ts.map +1 -1
  29. package/dist/client/types/com/atproto/sync/getRepo.js +33 -1
  30. package/dist/client/types/com/atproto/sync/getRepo.js.map +1 -1
  31. package/dist/client/types/com/atproto/sync/getRepoStatus.d.ts +31 -0
  32. package/dist/client/types/com/atproto/sync/getRepoStatus.d.ts.map +1 -0
  33. package/dist/client/types/com/atproto/sync/getRepoStatus.js +22 -0
  34. package/dist/client/types/com/atproto/sync/getRepoStatus.js.map +1 -0
  35. package/dist/client/types/com/atproto/sync/listBlobs.d.ts +13 -1
  36. package/dist/client/types/com/atproto/sync/listBlobs.d.ts.map +1 -1
  37. package/dist/client/types/com/atproto/sync/listBlobs.js +33 -1
  38. package/dist/client/types/com/atproto/sync/listBlobs.js.map +1 -1
  39. package/dist/client/types/com/atproto/sync/listRepos.d.ts +3 -0
  40. package/dist/client/types/com/atproto/sync/listRepos.d.ts.map +1 -1
  41. package/dist/client/types/com/atproto/sync/listRepos.js.map +1 -1
  42. package/dist/client/types/com/atproto/sync/subscribeRepos.d.ts +18 -3
  43. package/dist/client/types/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
  44. package/dist/client/types/com/atproto/sync/subscribeRepos.js +11 -1
  45. package/dist/client/types/com/atproto/sync/subscribeRepos.js.map +1 -1
  46. package/package.json +1 -1
  47. package/src/client/index.ts +13 -0
  48. package/src/client/lexicons.ts +193 -7
  49. package/src/client/types/chat/bsky/convo/defs.ts +1 -1
  50. package/src/client/types/com/atproto/sync/getBlob.ts +35 -0
  51. package/src/client/types/com/atproto/sync/getBlocks.ts +35 -0
  52. package/src/client/types/com/atproto/sync/getLatestCommit.ts +21 -0
  53. package/src/client/types/com/atproto/sync/getRecord.ts +35 -0
  54. package/src/client/types/com/atproto/sync/getRepo.ts +28 -0
  55. package/src/client/types/com/atproto/sync/getRepoStatus.ts +48 -0
  56. package/src/client/types/com/atproto/sync/listBlobs.ts +28 -0
  57. package/src/client/types/com/atproto/sync/listRepos.ts +3 -0
  58. package/src/client/types/com/atproto/sync/subscribeRepos.ts +29 -3
@@ -0,0 +1,48 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
9
+
10
+ export interface QueryParams {
11
+ /** The DID of the repo. */
12
+ did: string
13
+ }
14
+
15
+ export type InputSchema = undefined
16
+
17
+ export interface OutputSchema {
18
+ did: string
19
+ active: boolean
20
+ /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */
21
+ status?: 'takendown' | 'suspended' | 'deactivated' | (string & {})
22
+ /** Optional field, the current rev of the repo, if active=true */
23
+ rev?: string
24
+ [k: string]: unknown
25
+ }
26
+
27
+ export interface CallOptions {
28
+ headers?: Headers
29
+ }
30
+
31
+ export interface Response {
32
+ success: boolean
33
+ headers: Headers
34
+ data: OutputSchema
35
+ }
36
+
37
+ export class RepoNotFoundError extends XRPCError {
38
+ constructor(src: XRPCError) {
39
+ super(src.status, src.error, src.message, src.headers)
40
+ }
41
+ }
42
+
43
+ export function toKnownErr(e: any) {
44
+ if (e instanceof XRPCError) {
45
+ if (e.error === 'RepoNotFound') return new RepoNotFoundError(e)
46
+ }
47
+ return e
48
+ }
@@ -34,8 +34,36 @@ export interface Response {
34
34
  data: OutputSchema
35
35
  }
36
36
 
37
+ export class RepoNotFoundError extends XRPCError {
38
+ constructor(src: XRPCError) {
39
+ super(src.status, src.error, src.message, src.headers)
40
+ }
41
+ }
42
+
43
+ export class RepoTakendownError extends XRPCError {
44
+ constructor(src: XRPCError) {
45
+ super(src.status, src.error, src.message, src.headers)
46
+ }
47
+ }
48
+
49
+ export class RepoSuspendedError extends XRPCError {
50
+ constructor(src: XRPCError) {
51
+ super(src.status, src.error, src.message, src.headers)
52
+ }
53
+ }
54
+
55
+ export class RepoDeactivatedError extends XRPCError {
56
+ constructor(src: XRPCError) {
57
+ super(src.status, src.error, src.message, src.headers)
58
+ }
59
+ }
60
+
37
61
  export function toKnownErr(e: any) {
38
62
  if (e instanceof XRPCError) {
63
+ if (e.error === 'RepoNotFound') return new RepoNotFoundError(e)
64
+ if (e.error === 'RepoTakendown') return new RepoTakendownError(e)
65
+ if (e.error === 'RepoSuspended') return new RepoSuspendedError(e)
66
+ if (e.error === 'RepoDeactivated') return new RepoDeactivatedError(e)
39
67
  }
40
68
  return e
41
69
  }
@@ -41,6 +41,9 @@ export interface Repo {
41
41
  /** Current repo commit CID */
42
42
  head: string
43
43
  rev: string
44
+ active?: boolean
45
+ /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */
46
+ status?: 'takendown' | 'suspended' | 'deactivated' | (string & {})
44
47
  [k: string]: unknown
45
48
  }
46
49
 
@@ -51,6 +51,8 @@ export interface Identity {
51
51
  seq: number
52
52
  did: string
53
53
  time: string
54
+ /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */
55
+ handle?: string
54
56
  [k: string]: unknown
55
57
  }
56
58
 
@@ -66,7 +68,31 @@ export function validateIdentity(v: unknown): ValidationResult {
66
68
  return lexicons.validate('com.atproto.sync.subscribeRepos#identity', v)
67
69
  }
68
70
 
69
- /** Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity. */
71
+ /** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */
72
+ export interface Account {
73
+ seq: number
74
+ did: string
75
+ time: string
76
+ /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */
77
+ active: boolean
78
+ /** If active=false, this optional field indicates a reason for why the account is not active. */
79
+ status?: 'takendown' | 'suspended' | 'deleted' | 'deactivated' | (string & {})
80
+ [k: string]: unknown
81
+ }
82
+
83
+ export function isAccount(v: unknown): v is Account {
84
+ return (
85
+ isObj(v) &&
86
+ hasProp(v, '$type') &&
87
+ v.$type === 'com.atproto.sync.subscribeRepos#account'
88
+ )
89
+ }
90
+
91
+ export function validateAccount(v: unknown): ValidationResult {
92
+ return lexicons.validate('com.atproto.sync.subscribeRepos#account', v)
93
+ }
94
+
95
+ /** DEPRECATED -- Use #identity event instead */
70
96
  export interface Handle {
71
97
  seq: number
72
98
  did: string
@@ -87,7 +113,7 @@ export function validateHandle(v: unknown): ValidationResult {
87
113
  return lexicons.validate('com.atproto.sync.subscribeRepos#handle', v)
88
114
  }
89
115
 
90
- /** Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead */
116
+ /** DEPRECATED -- Use #account event instead */
91
117
  export interface Migrate {
92
118
  seq: number
93
119
  did: string
@@ -108,7 +134,7 @@ export function validateMigrate(v: unknown): ValidationResult {
108
134
  return lexicons.validate('com.atproto.sync.subscribeRepos#migrate', v)
109
135
  }
110
136
 
111
- /** Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event */
137
+ /** DEPRECATED -- Use #account event instead */
112
138
  export interface Tombstone {
113
139
  seq: number
114
140
  did: string