@atproto/api 0.0.8 → 0.1.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.
@@ -218,6 +218,78 @@ export const schemaDict = {
218
218
  },
219
219
  },
220
220
  },
221
+ ComAtprotoAdminBlob: {
222
+ lexicon: 1,
223
+ id: 'com.atproto.admin.blob',
224
+ defs: {
225
+ view: {
226
+ type: 'object',
227
+ required: ['cid', 'mimeType', 'size', 'createdAt'],
228
+ properties: {
229
+ cid: {
230
+ type: 'string',
231
+ },
232
+ mimeType: {
233
+ type: 'string',
234
+ },
235
+ size: {
236
+ type: 'integer',
237
+ },
238
+ createdAt: {
239
+ type: 'datetime',
240
+ },
241
+ details: {
242
+ type: 'union',
243
+ refs: [
244
+ 'lex:com.atproto.admin.blob#imageDetails',
245
+ 'lex:com.atproto.admin.blob#videoDetails',
246
+ ],
247
+ },
248
+ moderation: {
249
+ type: 'ref',
250
+ ref: 'lex:com.atproto.admin.blob#moderation',
251
+ },
252
+ },
253
+ },
254
+ imageDetails: {
255
+ type: 'object',
256
+ required: ['width', 'height'],
257
+ properties: {
258
+ width: {
259
+ type: 'integer',
260
+ },
261
+ height: {
262
+ type: 'integer',
263
+ },
264
+ },
265
+ },
266
+ videoDetails: {
267
+ type: 'object',
268
+ required: ['width', 'height', 'length'],
269
+ properties: {
270
+ width: {
271
+ type: 'integer',
272
+ },
273
+ height: {
274
+ type: 'integer',
275
+ },
276
+ length: {
277
+ type: 'integer',
278
+ },
279
+ },
280
+ },
281
+ moderation: {
282
+ type: 'object',
283
+ required: [],
284
+ properties: {
285
+ currentAction: {
286
+ type: 'ref',
287
+ ref: 'lex:com.atproto.admin.moderationAction#viewCurrent',
288
+ },
289
+ },
290
+ },
291
+ },
292
+ },
221
293
  ComAtprotoAdminGetModerationAction: {
222
294
  lexicon: 1,
223
295
  id: 'com.atproto.admin.getModerationAction',
@@ -430,6 +502,7 @@ export const schemaDict = {
430
502
  'id',
431
503
  'action',
432
504
  'subject',
505
+ 'subjectBlobCids',
433
506
  'reason',
434
507
  'createdBy',
435
508
  'createdAt',
@@ -440,12 +513,8 @@ export const schemaDict = {
440
513
  type: 'integer',
441
514
  },
442
515
  action: {
443
- type: 'string',
444
- knownValues: [
445
- 'com.atproto.admin.moderationAction#takedown',
446
- 'com.atproto.admin.moderationAction#flag',
447
- 'com.atproto.admin.moderationAction#acknowledge',
448
- ],
516
+ type: 'ref',
517
+ ref: 'lex:com.atproto.admin.moderationAction#actionType',
449
518
  },
450
519
  subject: {
451
520
  type: 'union',
@@ -454,6 +523,12 @@ export const schemaDict = {
454
523
  'lex:com.atproto.repo.strongRef',
455
524
  ],
456
525
  },
526
+ subjectBlobCids: {
527
+ type: 'array',
528
+ items: {
529
+ type: 'string',
530
+ },
531
+ },
457
532
  reason: {
458
533
  type: 'string',
459
534
  },
@@ -481,6 +556,7 @@ export const schemaDict = {
481
556
  'id',
482
557
  'action',
483
558
  'subject',
559
+ 'subjectBlobs',
484
560
  'reason',
485
561
  'createdBy',
486
562
  'createdAt',
@@ -491,12 +567,8 @@ export const schemaDict = {
491
567
  type: 'integer',
492
568
  },
493
569
  action: {
494
- type: 'string',
495
- knownValues: [
496
- 'com.atproto.admin.moderationAction#takedown',
497
- 'com.atproto.admin.moderationAction#flag',
498
- 'com.atproto.admin.moderationAction#acknowledge',
499
- ],
570
+ type: 'ref',
571
+ ref: 'lex:com.atproto.admin.moderationAction#actionType',
500
572
  },
501
573
  subject: {
502
574
  type: 'union',
@@ -505,6 +577,13 @@ export const schemaDict = {
505
577
  'lex:com.atproto.admin.record#view',
506
578
  ],
507
579
  },
580
+ subjectBlobs: {
581
+ type: 'array',
582
+ items: {
583
+ type: 'ref',
584
+ ref: 'lex:com.atproto.admin.blob#view',
585
+ },
586
+ },
508
587
  reason: {
509
588
  type: 'string',
510
589
  },
@@ -527,6 +606,19 @@ export const schemaDict = {
527
606
  },
528
607
  },
529
608
  },
609
+ viewCurrent: {
610
+ type: 'object',
611
+ required: ['id', 'action'],
612
+ properties: {
613
+ id: {
614
+ type: 'integer',
615
+ },
616
+ action: {
617
+ type: 'ref',
618
+ ref: 'lex:com.atproto.admin.moderationAction#actionType',
619
+ },
620
+ },
621
+ },
530
622
  reversal: {
531
623
  type: 'object',
532
624
  required: ['reason', 'createdBy', 'createdAt'],
@@ -542,6 +634,14 @@ export const schemaDict = {
542
634
  },
543
635
  },
544
636
  },
637
+ actionType: {
638
+ type: 'string',
639
+ knownValues: [
640
+ 'com.atproto.admin.moderationAction#takedown',
641
+ 'com.atproto.admin.moderationAction#flag',
642
+ 'com.atproto.admin.moderationAction#acknowledge',
643
+ ],
644
+ },
545
645
  takedown: {
546
646
  type: 'token',
547
647
  description:
@@ -656,7 +756,15 @@ export const schemaDict = {
656
756
  defs: {
657
757
  view: {
658
758
  type: 'object',
659
- required: ['uri', 'cid', 'value', 'indexedAt', 'moderation', 'repo'],
759
+ required: [
760
+ 'uri',
761
+ 'cid',
762
+ 'value',
763
+ 'blobCids',
764
+ 'indexedAt',
765
+ 'moderation',
766
+ 'repo',
767
+ ],
660
768
  properties: {
661
769
  uri: {
662
770
  type: 'string',
@@ -667,6 +775,12 @@ export const schemaDict = {
667
775
  value: {
668
776
  type: 'unknown',
669
777
  },
778
+ blobCids: {
779
+ type: 'array',
780
+ items: {
781
+ type: 'string',
782
+ },
783
+ },
670
784
  indexedAt: {
671
785
  type: 'string',
672
786
  },
@@ -682,7 +796,15 @@ export const schemaDict = {
682
796
  },
683
797
  viewDetail: {
684
798
  type: 'object',
685
- required: ['uri', 'cid', 'value', 'indexedAt', 'moderation', 'repo'],
799
+ required: [
800
+ 'uri',
801
+ 'cid',
802
+ 'value',
803
+ 'blobs',
804
+ 'indexedAt',
805
+ 'moderation',
806
+ 'repo',
807
+ ],
686
808
  properties: {
687
809
  uri: {
688
810
  type: 'string',
@@ -693,6 +815,13 @@ export const schemaDict = {
693
815
  value: {
694
816
  type: 'unknown',
695
817
  },
818
+ blobs: {
819
+ type: 'array',
820
+ items: {
821
+ type: 'ref',
822
+ ref: 'lex:com.atproto.admin.blob#view',
823
+ },
824
+ },
696
825
  indexedAt: {
697
826
  type: 'string',
698
827
  },
@@ -710,8 +839,9 @@ export const schemaDict = {
710
839
  type: 'object',
711
840
  required: [],
712
841
  properties: {
713
- takedownId: {
714
- type: 'integer',
842
+ currentAction: {
843
+ type: 'ref',
844
+ ref: 'lex:com.atproto.admin.moderationAction#viewCurrent',
715
845
  },
716
846
  },
717
847
  },
@@ -719,6 +849,10 @@ export const schemaDict = {
719
849
  type: 'object',
720
850
  required: ['actions', 'reports'],
721
851
  properties: {
852
+ currentAction: {
853
+ type: 'ref',
854
+ ref: 'lex:com.atproto.admin.moderationAction#viewCurrent',
855
+ },
722
856
  actions: {
723
857
  type: 'array',
724
858
  items: {
@@ -733,9 +867,6 @@ export const schemaDict = {
733
867
  ref: 'lex:com.atproto.admin.moderationReport#view',
734
868
  },
735
869
  },
736
- takedownId: {
737
- type: 'integer',
738
- },
739
870
  },
740
871
  },
741
872
  },
@@ -827,8 +958,9 @@ export const schemaDict = {
827
958
  type: 'object',
828
959
  required: [],
829
960
  properties: {
830
- takedownId: {
831
- type: 'integer',
961
+ currentAction: {
962
+ type: 'ref',
963
+ ref: 'lex:com.atproto.admin.moderationAction#viewCurrent',
832
964
  },
833
965
  },
834
966
  },
@@ -836,6 +968,10 @@ export const schemaDict = {
836
968
  type: 'object',
837
969
  required: ['actions', 'reports'],
838
970
  properties: {
971
+ currentAction: {
972
+ type: 'ref',
973
+ ref: 'lex:com.atproto.admin.moderationAction#viewCurrent',
974
+ },
839
975
  actions: {
840
976
  type: 'array',
841
977
  items: {
@@ -850,9 +986,6 @@ export const schemaDict = {
850
986
  ref: 'lex:com.atproto.admin.moderationReport#view',
851
987
  },
852
988
  },
853
- takedownId: {
854
- type: 'integer',
855
- },
856
989
  },
857
990
  },
858
991
  },
@@ -1004,6 +1137,12 @@ export const schemaDict = {
1004
1137
  'lex:com.atproto.repo.recordRef',
1005
1138
  ],
1006
1139
  },
1140
+ subjectBlobCids: {
1141
+ type: 'array',
1142
+ items: {
1143
+ type: 'string',
1144
+ },
1145
+ },
1007
1146
  reason: {
1008
1147
  type: 'string',
1009
1148
  },
@@ -1020,6 +1159,11 @@ export const schemaDict = {
1020
1159
  ref: 'lex:com.atproto.admin.moderationAction#view',
1021
1160
  },
1022
1161
  },
1162
+ errors: [
1163
+ {
1164
+ name: 'SubjectHasAction',
1165
+ },
1166
+ ],
1023
1167
  },
1024
1168
  },
1025
1169
  },
@@ -2178,18 +2322,6 @@ export const schemaDict = {
2178
2322
  indexedAt: {
2179
2323
  type: 'datetime',
2180
2324
  },
2181
- myState: {
2182
- type: 'ref',
2183
- ref: 'lex:app.bsky.actor.getSuggestions#myState',
2184
- },
2185
- },
2186
- },
2187
- myState: {
2188
- type: 'object',
2189
- properties: {
2190
- follow: {
2191
- type: 'string',
2192
- },
2193
2325
  },
2194
2326
  },
2195
2327
  },
@@ -3836,6 +3968,7 @@ export const ids = {
3836
3968
  ComAtprotoAccountRequestPasswordReset:
3837
3969
  'com.atproto.account.requestPasswordReset',
3838
3970
  ComAtprotoAccountResetPassword: 'com.atproto.account.resetPassword',
3971
+ ComAtprotoAdminBlob: 'com.atproto.admin.blob',
3839
3972
  ComAtprotoAdminGetModerationAction: 'com.atproto.admin.getModerationAction',
3840
3973
  ComAtprotoAdminGetModerationActions: 'com.atproto.admin.getModerationActions',
3841
3974
  ComAtprotoAdminGetModerationReport: 'com.atproto.admin.getModerationReport',
@@ -44,7 +44,6 @@ export interface Actor {
44
44
  description?: string
45
45
  avatar?: string
46
46
  indexedAt?: string
47
- myState?: MyState
48
47
  [k: string]: unknown
49
48
  }
50
49
 
@@ -59,20 +58,3 @@ export function isActor(v: unknown): v is Actor {
59
58
  export function validateActor(v: unknown): ValidationResult {
60
59
  return lexicons.validate('app.bsky.actor.getSuggestions#actor', v)
61
60
  }
62
-
63
- export interface MyState {
64
- follow?: string
65
- [k: string]: unknown
66
- }
67
-
68
- export function isMyState(v: unknown): v is MyState {
69
- return (
70
- isObj(v) &&
71
- hasProp(v, '$type') &&
72
- v.$type === 'app.bsky.actor.getSuggestions#myState'
73
- )
74
- }
75
-
76
- export function validateMyState(v: unknown): ValidationResult {
77
- return lexicons.validate('app.bsky.actor.getSuggestions#myState', v)
78
- }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { ValidationResult } from '@atproto/lexicon'
5
+ import { isObj, hasProp } from '../../../../util'
6
+ import { lexicons } from '../../../../lexicons'
7
+ import * as ComAtprotoAdminModerationAction from './moderationAction'
8
+
9
+ export interface View {
10
+ cid: string
11
+ mimeType: string
12
+ size: number
13
+ createdAt: string
14
+ details?:
15
+ | ImageDetails
16
+ | VideoDetails
17
+ | { $type: string; [k: string]: unknown }
18
+ moderation?: Moderation
19
+ [k: string]: unknown
20
+ }
21
+
22
+ export function isView(v: unknown): v is View {
23
+ return (
24
+ isObj(v) && hasProp(v, '$type') && v.$type === 'com.atproto.admin.blob#view'
25
+ )
26
+ }
27
+
28
+ export function validateView(v: unknown): ValidationResult {
29
+ return lexicons.validate('com.atproto.admin.blob#view', v)
30
+ }
31
+
32
+ export interface ImageDetails {
33
+ width: number
34
+ height: number
35
+ [k: string]: unknown
36
+ }
37
+
38
+ export function isImageDetails(v: unknown): v is ImageDetails {
39
+ return (
40
+ isObj(v) &&
41
+ hasProp(v, '$type') &&
42
+ v.$type === 'com.atproto.admin.blob#imageDetails'
43
+ )
44
+ }
45
+
46
+ export function validateImageDetails(v: unknown): ValidationResult {
47
+ return lexicons.validate('com.atproto.admin.blob#imageDetails', v)
48
+ }
49
+
50
+ export interface VideoDetails {
51
+ width: number
52
+ height: number
53
+ length: number
54
+ [k: string]: unknown
55
+ }
56
+
57
+ export function isVideoDetails(v: unknown): v is VideoDetails {
58
+ return (
59
+ isObj(v) &&
60
+ hasProp(v, '$type') &&
61
+ v.$type === 'com.atproto.admin.blob#videoDetails'
62
+ )
63
+ }
64
+
65
+ export function validateVideoDetails(v: unknown): ValidationResult {
66
+ return lexicons.validate('com.atproto.admin.blob#videoDetails', v)
67
+ }
68
+
69
+ export interface Moderation {
70
+ currentAction?: ComAtprotoAdminModerationAction.ViewCurrent
71
+ [k: string]: unknown
72
+ }
73
+
74
+ export function isModeration(v: unknown): v is Moderation {
75
+ return (
76
+ isObj(v) &&
77
+ hasProp(v, '$type') &&
78
+ v.$type === 'com.atproto.admin.blob#moderation'
79
+ )
80
+ }
81
+
82
+ export function validateModeration(v: unknown): ValidationResult {
83
+ return lexicons.validate('com.atproto.admin.blob#moderation', v)
84
+ }
@@ -8,19 +8,17 @@ import * as ComAtprotoRepoRepoRef from '../repo/repoRef'
8
8
  import * as ComAtprotoRepoStrongRef from '../repo/strongRef'
9
9
  import * as ComAtprotoAdminRepo from './repo'
10
10
  import * as ComAtprotoAdminRecord from './record'
11
+ import * as ComAtprotoAdminBlob from './blob'
11
12
  import * as ComAtprotoAdminModerationReport from './moderationReport'
12
13
 
13
14
  export interface View {
14
15
  id: number
15
- action:
16
- | 'com.atproto.admin.moderationAction#takedown'
17
- | 'com.atproto.admin.moderationAction#flag'
18
- | 'com.atproto.admin.moderationAction#acknowledge'
19
- | (string & {})
16
+ action: ActionType
20
17
  subject:
21
18
  | ComAtprotoRepoRepoRef.Main
22
19
  | ComAtprotoRepoStrongRef.Main
23
20
  | { $type: string; [k: string]: unknown }
21
+ subjectBlobCids: string[]
24
22
  reason: string
25
23
  createdBy: string
26
24
  createdAt: string
@@ -43,15 +41,12 @@ export function validateView(v: unknown): ValidationResult {
43
41
 
44
42
  export interface ViewDetail {
45
43
  id: number
46
- action:
47
- | 'com.atproto.admin.moderationAction#takedown'
48
- | 'com.atproto.admin.moderationAction#flag'
49
- | 'com.atproto.admin.moderationAction#acknowledge'
50
- | (string & {})
44
+ action: ActionType
51
45
  subject:
52
46
  | ComAtprotoAdminRepo.View
53
47
  | ComAtprotoAdminRecord.View
54
48
  | { $type: string; [k: string]: unknown }
49
+ subjectBlobs: ComAtprotoAdminBlob.View[]
55
50
  reason: string
56
51
  createdBy: string
57
52
  createdAt: string
@@ -72,6 +67,24 @@ export function validateViewDetail(v: unknown): ValidationResult {
72
67
  return lexicons.validate('com.atproto.admin.moderationAction#viewDetail', v)
73
68
  }
74
69
 
70
+ export interface ViewCurrent {
71
+ id: number
72
+ action: ActionType
73
+ [k: string]: unknown
74
+ }
75
+
76
+ export function isViewCurrent(v: unknown): v is ViewCurrent {
77
+ return (
78
+ isObj(v) &&
79
+ hasProp(v, '$type') &&
80
+ v.$type === 'com.atproto.admin.moderationAction#viewCurrent'
81
+ )
82
+ }
83
+
84
+ export function validateViewCurrent(v: unknown): ValidationResult {
85
+ return lexicons.validate('com.atproto.admin.moderationAction#viewCurrent', v)
86
+ }
87
+
75
88
  export interface Reversal {
76
89
  reason: string
77
90
  createdBy: string
@@ -91,6 +104,12 @@ export function validateReversal(v: unknown): ValidationResult {
91
104
  return lexicons.validate('com.atproto.admin.moderationAction#reversal', v)
92
105
  }
93
106
 
107
+ export type ActionType =
108
+ | 'com.atproto.admin.moderationAction#takedown'
109
+ | 'com.atproto.admin.moderationAction#flag'
110
+ | 'com.atproto.admin.moderationAction#acknowledge'
111
+ | (string & {})
112
+
94
113
  /** Moderation action type: Takedown. Indicates that content should not be served by the PDS. */
95
114
  export const TAKEDOWN = 'com.atproto.admin.moderationAction#takedown'
96
115
  /** Moderation action type: Flag. Indicates that the content was reviewed and considered to violate PDS rules, but may still be served. */
@@ -5,6 +5,7 @@ import { ValidationResult } from '@atproto/lexicon'
5
5
  import { isObj, hasProp } from '../../../../util'
6
6
  import { lexicons } from '../../../../lexicons'
7
7
  import * as ComAtprotoAdminRepo from './repo'
8
+ import * as ComAtprotoAdminBlob from './blob'
8
9
  import * as ComAtprotoAdminModerationAction from './moderationAction'
9
10
  import * as ComAtprotoAdminModerationReport from './moderationReport'
10
11
 
@@ -12,6 +13,7 @@ export interface View {
12
13
  uri: string
13
14
  cid: string
14
15
  value: {}
16
+ blobCids: string[]
15
17
  indexedAt: string
16
18
  moderation: Moderation
17
19
  repo: ComAtprotoAdminRepo.View
@@ -34,6 +36,7 @@ export interface ViewDetail {
34
36
  uri: string
35
37
  cid: string
36
38
  value: {}
39
+ blobs: ComAtprotoAdminBlob.View[]
37
40
  indexedAt: string
38
41
  moderation: ModerationDetail
39
42
  repo: ComAtprotoAdminRepo.View
@@ -53,7 +56,7 @@ export function validateViewDetail(v: unknown): ValidationResult {
53
56
  }
54
57
 
55
58
  export interface Moderation {
56
- takedownId?: number
59
+ currentAction?: ComAtprotoAdminModerationAction.ViewCurrent
57
60
  [k: string]: unknown
58
61
  }
59
62
 
@@ -70,9 +73,9 @@ export function validateModeration(v: unknown): ValidationResult {
70
73
  }
71
74
 
72
75
  export interface ModerationDetail {
76
+ currentAction?: ComAtprotoAdminModerationAction.ViewCurrent
73
77
  actions: ComAtprotoAdminModerationAction.View[]
74
78
  reports: ComAtprotoAdminModerationReport.View[]
75
- takedownId?: number
76
79
  [k: string]: unknown
77
80
  }
78
81
 
@@ -67,7 +67,7 @@ export function validateAccount(v: unknown): ValidationResult {
67
67
  }
68
68
 
69
69
  export interface Moderation {
70
- takedownId?: number
70
+ currentAction?: ComAtprotoAdminModerationAction.ViewCurrent
71
71
  [k: string]: unknown
72
72
  }
73
73
 
@@ -84,9 +84,9 @@ export function validateModeration(v: unknown): ValidationResult {
84
84
  }
85
85
 
86
86
  export interface ModerationDetail {
87
+ currentAction?: ComAtprotoAdminModerationAction.ViewCurrent
87
88
  actions: ComAtprotoAdminModerationAction.View[]
88
89
  reports: ComAtprotoAdminModerationReport.View[]
89
- takedownId?: number
90
90
  [k: string]: unknown
91
91
  }
92
92
 
@@ -21,6 +21,7 @@ export interface InputSchema {
21
21
  | ComAtprotoRepoRepoRef.Main
22
22
  | ComAtprotoRepoRecordRef.Main
23
23
  | { $type: string; [k: string]: unknown }
24
+ subjectBlobCids?: string[]
24
25
  reason: string
25
26
  createdBy: string
26
27
  [k: string]: unknown
@@ -40,8 +41,15 @@ export interface Response {
40
41
  data: OutputSchema
41
42
  }
42
43
 
44
+ export class SubjectHasActionError extends XRPCError {
45
+ constructor(src: XRPCError) {
46
+ super(src.status, src.error, src.message)
47
+ }
48
+ }
49
+
43
50
  export function toKnownErr(e: any) {
44
51
  if (e instanceof XRPCError) {
52
+ if (e.error === 'SubjectHasAction') return new SubjectHasActionError(e)
45
53
  }
46
54
  return e
47
55
  }
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
+ export * from './types'
1
2
  export * from './client'
2
- export { default } from './client'
3
- export * from './session'
4
- export { default as sessionClient } from './session'
3
+ export * from './agent'
4
+ export { AtpAgent as default } from './agent'