@atproto/api 0.19.18 → 0.19.19

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 (34) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/client/lexicons.d.ts +1022 -104
  3. package/dist/client/lexicons.d.ts.map +1 -1
  4. package/dist/client/lexicons.js +581 -7
  5. package/dist/client/lexicons.js.map +1 -1
  6. package/dist/client/types/app/bsky/embed/external.d.ts +2 -1
  7. package/dist/client/types/app/bsky/embed/external.d.ts.map +1 -1
  8. package/dist/client/types/app/bsky/embed/external.js.map +1 -1
  9. package/dist/client/types/chat/bsky/convo/defs.d.ts +1 -1
  10. package/dist/client/types/chat/bsky/convo/defs.d.ts.map +1 -1
  11. package/dist/client/types/chat/bsky/convo/defs.js.map +1 -1
  12. package/dist/client/types/chat/bsky/group/addMembers.d.ts +1 -1
  13. package/dist/client/types/chat/bsky/group/addMembers.d.ts.map +1 -1
  14. package/dist/client/types/chat/bsky/group/addMembers.js +5 -5
  15. package/dist/client/types/chat/bsky/group/addMembers.js.map +1 -1
  16. package/dist/client/types/chat/bsky/group/createGroup.d.ts +1 -1
  17. package/dist/client/types/chat/bsky/group/createGroup.d.ts.map +1 -1
  18. package/dist/client/types/chat/bsky/group/createGroup.js +5 -5
  19. package/dist/client/types/chat/bsky/group/createGroup.js.map +1 -1
  20. package/dist/client/types/chat/bsky/moderation/getMessageContext.d.ts +5 -1
  21. package/dist/client/types/chat/bsky/moderation/getMessageContext.d.ts.map +1 -1
  22. package/dist/client/types/chat/bsky/moderation/getMessageContext.js.map +1 -1
  23. package/dist/client/types/chat/bsky/moderation/subscribeModEvents.d.ts +206 -0
  24. package/dist/client/types/chat/bsky/moderation/subscribeModEvents.d.ts.map +1 -1
  25. package/dist/client/types/chat/bsky/moderation/subscribeModEvents.js +81 -0
  26. package/dist/client/types/chat/bsky/moderation/subscribeModEvents.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/client/lexicons.ts +606 -7
  29. package/src/client/types/app/bsky/embed/external.ts +2 -1
  30. package/src/client/types/chat/bsky/convo/defs.ts +1 -1
  31. package/src/client/types/chat/bsky/group/addMembers.ts +2 -3
  32. package/src/client/types/chat/bsky/group/createGroup.ts +2 -3
  33. package/src/client/types/chat/bsky/moderation/getMessageContext.ts +4 -1
  34. package/src/client/types/chat/bsky/moderation/subscribeModEvents.ts +328 -0
@@ -54,7 +54,7 @@ export class BlockedActorError extends XRPCError {
54
54
  }
55
55
  }
56
56
 
57
- export class GroupInvitesDisabledError extends XRPCError {
57
+ export class UserForbidsGroupsError extends XRPCError {
58
58
  constructor(src: XRPCError) {
59
59
  super(src.status, src.error, src.message, src.headers, { cause: src })
60
60
  }
@@ -100,8 +100,7 @@ export function toKnownErr(e: any) {
100
100
  if (e instanceof XRPCError) {
101
101
  if (e.error === 'AccountSuspended') return new AccountSuspendedError(e)
102
102
  if (e.error === 'BlockedActor') return new BlockedActorError(e)
103
- if (e.error === 'GroupInvitesDisabled')
104
- return new GroupInvitesDisabledError(e)
103
+ if (e.error === 'UserForbidsGroups') return new UserForbidsGroupsError(e)
105
104
  if (e.error === 'ConvoLocked') return new ConvoLockedError(e)
106
105
  if (e.error === 'InsufficientRole') return new InsufficientRoleError(e)
107
106
  if (e.error === 'InvalidConvo') return new InvalidConvoError(e)
@@ -52,7 +52,7 @@ export class BlockedActorError extends XRPCError {
52
52
  }
53
53
  }
54
54
 
55
- export class GroupInvitesDisabledError extends XRPCError {
55
+ export class UserForbidsGroupsError extends XRPCError {
56
56
  constructor(src: XRPCError) {
57
57
  super(src.status, src.error, src.message, src.headers, { cause: src })
58
58
  }
@@ -74,8 +74,7 @@ export function toKnownErr(e: any) {
74
74
  if (e instanceof XRPCError) {
75
75
  if (e.error === 'AccountSuspended') return new AccountSuspendedError(e)
76
76
  if (e.error === 'BlockedActor') return new BlockedActorError(e)
77
- if (e.error === 'GroupInvitesDisabled')
78
- return new GroupInvitesDisabledError(e)
77
+ if (e.error === 'UserForbidsGroups') return new UserForbidsGroupsError(e)
79
78
  if (e.error === 'NotFollowedBySender')
80
79
  return new NotFollowedBySenderError(e)
81
80
  if (e.error === 'RecipientNotFound') return new RecipientNotFoundError(e)
@@ -20,15 +20,18 @@ export type QueryParams = {
20
20
  /** Conversation that the message is from. NOTE: this field will eventually be required. */
21
21
  convoId?: string
22
22
  messageId: string
23
+ /** Number of user messages before the target to include. System messages between the earliest returned user message and the target are also included, capped per gap by `maxInterleavedSystemMessages`. If there are no user messages before the target, up to `maxInterleavedSystemMessages` system messages immediately preceding the target are returned instead. */
23
24
  before?: number
25
+ /** Number of user messages after the target to include. System messages between the target and the latest returned user message are also included, capped per gap by `maxInterleavedSystemMessages`. If there are no user messages after the target, up to `maxInterleavedSystemMessages` system messages immediately following the target are returned instead. */
24
26
  after?: number
27
+ /** Maximum number of system messages to include per gap between consecutive returned messages (and per side when there are no user messages on that side). Within a gap, the system messages closest to the earlier message are kept. */
28
+ maxInterleavedSystemMessages?: number
25
29
  }
26
30
  export type InputSchema = undefined
27
31
 
28
32
  export interface OutputSchema {
29
33
  messages: (
30
34
  | $Typed<ChatBskyConvoDefs.MessageView>
31
- | $Typed<ChatBskyConvoDefs.DeletedMessageView>
32
35
  | $Typed<ChatBskyConvoDefs.SystemMessageView>
33
36
  | { $type: string }
34
37
  )[]
@@ -15,6 +15,7 @@ const is$typed = _is$typed,
15
15
  validate = _validate
16
16
  const id = 'chat.bsky.moderation.subscribeModEvents'
17
17
 
18
+ /** Fired when the first message was sent on a convo. */
18
19
  export interface EventConvoFirstMessage {
19
20
  $type?: 'chat.bsky.moderation.subscribeModEvents#eventConvoFirstMessage'
20
21
  convoId: string
@@ -36,3 +37,330 @@ export function isEventConvoFirstMessage<V>(v: V) {
36
37
  export function validateEventConvoFirstMessage<V>(v: V) {
37
38
  return validate<EventConvoFirstMessage & V>(v, id, hashEventConvoFirstMessage)
38
39
  }
40
+
41
+ /** Fire when a group chat is created. */
42
+ export interface EventGroupChatCreated {
43
+ $type?: 'chat.bsky.moderation.subscribeModEvents#eventGroupChatCreated'
44
+ /** The DID of the actor performing the action. For this event, same as ownerDid. */
45
+ actorDid: string
46
+ /** When the group was originally created. */
47
+ convoCreatedAt: string
48
+ convoId: string
49
+ createdAt: string
50
+ /** Current member count at the time of the event. */
51
+ groupMemberCount: number
52
+ /** The name set at creation time. */
53
+ groupName: string
54
+ /** DIDs of everyone added at creation time. */
55
+ initialMemberDids: string[]
56
+ /** The DID of the group chat owner. */
57
+ ownerDid: string
58
+ rev: string
59
+ }
60
+
61
+ const hashEventGroupChatCreated = 'eventGroupChatCreated'
62
+
63
+ export function isEventGroupChatCreated<V>(v: V) {
64
+ return is$typed(v, id, hashEventGroupChatCreated)
65
+ }
66
+
67
+ export function validateEventGroupChatCreated<V>(v: V) {
68
+ return validate<EventGroupChatCreated & V>(v, id, hashEventGroupChatCreated)
69
+ }
70
+
71
+ /** Fired when a member is added to a group chat. Note that members are added in the 'request' state. */
72
+ export interface EventGroupChatMemberAdded {
73
+ $type?: 'chat.bsky.moderation.subscribeModEvents#eventGroupChatMemberAdded'
74
+ /** The DID of the actor performing the action. For this event, same as ownerDid. */
75
+ actorDid: string
76
+ /** When the group was originally created. */
77
+ convoCreatedAt: string
78
+ convoId: string
79
+ createdAt: string
80
+ /** Current member count at the time of the event. */
81
+ groupMemberCount: number
82
+ groupName: string
83
+ /** The DID of the group chat owner. */
84
+ ownerDid: string
85
+ /** The number of members who have not yet accepted the convo. */
86
+ requestMembersCount: number
87
+ rev: string
88
+ /** The DID of the member who was added. */
89
+ subjectDid: string
90
+ /** Whether the added member follows the group owner. */
91
+ subjectFollowsOwner: boolean
92
+ }
93
+
94
+ const hashEventGroupChatMemberAdded = 'eventGroupChatMemberAdded'
95
+
96
+ export function isEventGroupChatMemberAdded<V>(v: V) {
97
+ return is$typed(v, id, hashEventGroupChatMemberAdded)
98
+ }
99
+
100
+ export function validateEventGroupChatMemberAdded<V>(v: V) {
101
+ return validate<EventGroupChatMemberAdded & V>(
102
+ v,
103
+ id,
104
+ hashEventGroupChatMemberAdded,
105
+ )
106
+ }
107
+
108
+ /** Fired when a member joins a group chat via an join link that does not require approval. */
109
+ export interface EventGroupChatMemberJoined {
110
+ $type?: 'chat.bsky.moderation.subscribeModEvents#eventGroupChatMemberJoined'
111
+ /** The DID of the person joining. */
112
+ actorDid: string
113
+ /** When the group was originally created. */
114
+ convoCreatedAt: string
115
+ convoId: string
116
+ createdAt: string
117
+ /** Current member count at the time of the event. */
118
+ groupMemberCount: number
119
+ groupName: string
120
+ /** The code of the join link used to join. */
121
+ joinLinkCode: string
122
+ /** The DID of the group chat owner. */
123
+ ownerDid: string
124
+ rev: string
125
+ /** Whether the joining member follows the group owner. */
126
+ subjectFollowsOwner: boolean
127
+ }
128
+
129
+ const hashEventGroupChatMemberJoined = 'eventGroupChatMemberJoined'
130
+
131
+ export function isEventGroupChatMemberJoined<V>(v: V) {
132
+ return is$typed(v, id, hashEventGroupChatMemberJoined)
133
+ }
134
+
135
+ export function validateEventGroupChatMemberJoined<V>(v: V) {
136
+ return validate<EventGroupChatMemberJoined & V>(
137
+ v,
138
+ id,
139
+ hashEventGroupChatMemberJoined,
140
+ )
141
+ }
142
+
143
+ /** Fired when a user requests to join a group chat via an join link that requires approval. */
144
+ export interface EventGroupChatJoinRequest {
145
+ $type?: 'chat.bsky.moderation.subscribeModEvents#eventGroupChatJoinRequest'
146
+ /** The DID of the person requesting to join. */
147
+ actorDid: string
148
+ /** When the group was originally created. */
149
+ convoCreatedAt: string
150
+ convoId: string
151
+ createdAt: string
152
+ /** Current member count at the time of the event. */
153
+ groupMemberCount: number
154
+ groupName: string
155
+ /** The code of the join link used to request joining. */
156
+ joinLinkCode: string
157
+ /** The DID of the group chat owner. */
158
+ ownerDid: string
159
+ rev: string
160
+ /** Whether the requesting member follows the group owner. */
161
+ subjectFollowsOwner: boolean
162
+ }
163
+
164
+ const hashEventGroupChatJoinRequest = 'eventGroupChatJoinRequest'
165
+
166
+ export function isEventGroupChatJoinRequest<V>(v: V) {
167
+ return is$typed(v, id, hashEventGroupChatJoinRequest)
168
+ }
169
+
170
+ export function validateEventGroupChatJoinRequest<V>(v: V) {
171
+ return validate<EventGroupChatJoinRequest & V>(
172
+ v,
173
+ id,
174
+ hashEventGroupChatJoinRequest,
175
+ )
176
+ }
177
+
178
+ /** Fired when a join request is approved by the group owner. */
179
+ export interface EventGroupChatJoinRequestApproved {
180
+ $type?: 'chat.bsky.moderation.subscribeModEvents#eventGroupChatJoinRequestApproved'
181
+ /** The DID of the owner approving the request. */
182
+ actorDid: string
183
+ /** When the group was originally created. */
184
+ convoCreatedAt: string
185
+ convoId: string
186
+ createdAt: string
187
+ /** Current member count at the time of the event. */
188
+ groupMemberCount: number
189
+ groupName: string
190
+ /** The DID of the group chat owner. */
191
+ ownerDid: string
192
+ rev: string
193
+ /** The DID of the member whose request was approved. */
194
+ subjectDid: string
195
+ }
196
+
197
+ const hashEventGroupChatJoinRequestApproved =
198
+ 'eventGroupChatJoinRequestApproved'
199
+
200
+ export function isEventGroupChatJoinRequestApproved<V>(v: V) {
201
+ return is$typed(v, id, hashEventGroupChatJoinRequestApproved)
202
+ }
203
+
204
+ export function validateEventGroupChatJoinRequestApproved<V>(v: V) {
205
+ return validate<EventGroupChatJoinRequestApproved & V>(
206
+ v,
207
+ id,
208
+ hashEventGroupChatJoinRequestApproved,
209
+ )
210
+ }
211
+
212
+ /** Fired when a join request is rejected by the group owner. */
213
+ export interface EventGroupChatJoinRequestRejected {
214
+ $type?: 'chat.bsky.moderation.subscribeModEvents#eventGroupChatJoinRequestRejected'
215
+ /** The DID of the owner rejecting the request. */
216
+ actorDid: string
217
+ /** When the group was originally created. */
218
+ convoCreatedAt: string
219
+ convoId: string
220
+ createdAt: string
221
+ /** Current member count at the time of the event. */
222
+ groupMemberCount: number
223
+ groupName: string
224
+ /** The DID of the group chat owner. */
225
+ ownerDid: string
226
+ rev: string
227
+ /** The DID of the member whose request was rejected. */
228
+ subjectDid: string
229
+ }
230
+
231
+ const hashEventGroupChatJoinRequestRejected =
232
+ 'eventGroupChatJoinRequestRejected'
233
+
234
+ export function isEventGroupChatJoinRequestRejected<V>(v: V) {
235
+ return is$typed(v, id, hashEventGroupChatJoinRequestRejected)
236
+ }
237
+
238
+ export function validateEventGroupChatJoinRequestRejected<V>(v: V) {
239
+ return validate<EventGroupChatJoinRequestRejected & V>(
240
+ v,
241
+ id,
242
+ hashEventGroupChatJoinRequestRejected,
243
+ )
244
+ }
245
+
246
+ /** Fired when a user accepts a chat convo, either explicitly or by sending a message. */
247
+ export interface EventChatAccepted {
248
+ $type?: 'chat.bsky.moderation.subscribeModEvents#eventChatAccepted'
249
+ /** The DID of the person accepting the convo. */
250
+ actorDid: string
251
+ /** When the convo was originally created. */
252
+ convoCreatedAt: string
253
+ convoId: string
254
+ createdAt: string
255
+ /** Current member count at the time of the event. Only present for group convos. */
256
+ groupMemberCount?: number
257
+ /** The name of the group chat. Only present for group convos. */
258
+ groupName?: string
259
+ /** How the convo was accepted. */
260
+ method: 'explicit' | 'message' | (string & {})
261
+ /** The DID of the group chat owner. Only present for group convos. */
262
+ ownerDid?: string
263
+ rev: string
264
+ }
265
+
266
+ const hashEventChatAccepted = 'eventChatAccepted'
267
+
268
+ export function isEventChatAccepted<V>(v: V) {
269
+ return is$typed(v, id, hashEventChatAccepted)
270
+ }
271
+
272
+ export function validateEventChatAccepted<V>(v: V) {
273
+ return validate<EventChatAccepted & V>(v, id, hashEventChatAccepted)
274
+ }
275
+
276
+ /** Fired when a member leaves or is removed from a group chat. */
277
+ export interface EventGroupChatMemberLeft {
278
+ $type?: 'chat.bsky.moderation.subscribeModEvents#eventGroupChatMemberLeft'
279
+ /** The DID of the actor. For voluntary: the person leaving. For kicked: the owner. */
280
+ actorDid: string
281
+ /** When the group was originally created. */
282
+ convoCreatedAt: string
283
+ convoId: string
284
+ createdAt: string
285
+ /** Current member count at the time of the event. */
286
+ groupMemberCount: number
287
+ groupName: string
288
+ /** How the member left. */
289
+ leaveMethod: 'voluntary' | 'kicked' | (string & {})
290
+ /** The DID of the group chat owner. */
291
+ ownerDid: string
292
+ rev: string
293
+ /** The DID of the member who left or was removed. */
294
+ subjectDid: string
295
+ }
296
+
297
+ const hashEventGroupChatMemberLeft = 'eventGroupChatMemberLeft'
298
+
299
+ export function isEventGroupChatMemberLeft<V>(v: V) {
300
+ return is$typed(v, id, hashEventGroupChatMemberLeft)
301
+ }
302
+
303
+ export function validateEventGroupChatMemberLeft<V>(v: V) {
304
+ return validate<EventGroupChatMemberLeft & V>(
305
+ v,
306
+ id,
307
+ hashEventGroupChatMemberLeft,
308
+ )
309
+ }
310
+
311
+ /** Fired when a group chat's metadata or status changes. */
312
+ export interface EventGroupChatUpdated {
313
+ $type?: 'chat.bsky.moderation.subscribeModEvents#eventGroupChatUpdated'
314
+ /** The DID of the actor performing the action (the owner). */
315
+ actorDid: string
316
+ /** When the group was originally created. */
317
+ convoCreatedAt: string
318
+ convoId: string
319
+ createdAt: string
320
+ /** Current member count at the time of the event. */
321
+ groupMemberCount: number
322
+ /** Current group name. */
323
+ groupName: string
324
+ /** The code of the join link. Only present when updateType is join-link-related. */
325
+ joinLinkCode?: string
326
+ /** Whether the join link is restricted to followers of the owner. Only present when updateType is join-link-related. */
327
+ joinLinkFollowersOnly?: boolean
328
+ /** Whether the join link requires owner approval to join. Only present when updateType is join-link-related. */
329
+ joinLinkRequiresApproval?: boolean
330
+ /** Why the group was locked. Only present when updateType is 'locked'. */
331
+ lockReason?:
332
+ | 'owner_action'
333
+ | 'owner_left'
334
+ | 'owner_deactivated'
335
+ | 'owner_deleted'
336
+ | 'owner_taken_down'
337
+ | 'label_applied'
338
+ | (string & {})
339
+ /** The new group name. Only present when updateType is 'name_changed'. */
340
+ newName?: string
341
+ /** The previous group name. Only present when updateType is 'name_changed'. */
342
+ oldName?: string
343
+ /** The DID of the group chat owner. */
344
+ ownerDid: string
345
+ rev: string
346
+ /** What changed. */
347
+ updateType:
348
+ | 'name_changed'
349
+ | 'locked'
350
+ | 'locked_permanently'
351
+ | 'unlocked'
352
+ | 'join_link_created'
353
+ | 'join_link_disabled'
354
+ | 'join_link_settings_changed'
355
+ | (string & {})
356
+ }
357
+
358
+ const hashEventGroupChatUpdated = 'eventGroupChatUpdated'
359
+
360
+ export function isEventGroupChatUpdated<V>(v: V) {
361
+ return is$typed(v, id, hashEventGroupChatUpdated)
362
+ }
363
+
364
+ export function validateEventGroupChatUpdated<V>(v: V) {
365
+ return validate<EventGroupChatUpdated & V>(v, id, hashEventGroupChatUpdated)
366
+ }