@atproto/bsky 0.0.30 → 0.0.32

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 (49) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/db/index.js.map +2 -2
  3. package/dist/index.js +1315 -587
  4. package/dist/index.js.map +3 -3
  5. package/dist/indexer/subscription.d.ts +1 -0
  6. package/dist/lexicon/index.d.ts +20 -6
  7. package/dist/lexicon/lexicons.d.ts +449 -110
  8. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +20 -0
  9. package/dist/lexicon/types/com/atproto/admin/defs.d.ts +9 -0
  10. package/dist/lexicon/types/com/atproto/admin/emitModerationEvent.d.ts +1 -1
  11. package/dist/lexicon/types/com/atproto/admin/queryModerationEvents.d.ts +2 -0
  12. package/dist/lexicon/types/com/atproto/admin/queryModerationStatuses.d.ts +2 -0
  13. package/dist/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.d.ts +33 -0
  14. package/dist/lexicon/types/com/atproto/identity/requestPlcOperationSignature.d.ts +19 -0
  15. package/dist/lexicon/types/com/atproto/{temp/transferAccount.d.ts → identity/signPlcOperation.d.ts} +6 -8
  16. package/dist/lexicon/types/com/atproto/identity/submitPlcOperation.d.ts +25 -0
  17. package/dist/lexicon/types/com/atproto/{temp/pushBlob.d.ts → repo/importRepo.d.ts} +1 -2
  18. package/dist/lexicon/types/com/atproto/repo/listMissingBlobs.d.ts +41 -0
  19. package/dist/lexicon/types/com/atproto/server/activateAccount.d.ts +19 -0
  20. package/dist/lexicon/types/com/atproto/server/checkAccountStatus.d.ts +38 -0
  21. package/dist/lexicon/types/com/atproto/server/deactivateAccount.d.ts +25 -0
  22. package/dist/lexicon/types/com/atproto/server/describeServer.d.ts +1 -0
  23. package/dist/lexicon/types/com/atproto/{temp/importRepo.d.ts → server/getServiceAuth.d.ts} +8 -9
  24. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts +9 -1
  25. package/dist/subscription/util.d.ts +1 -1
  26. package/package.json +5 -5
  27. package/src/indexer/subscription.ts +6 -0
  28. package/src/ingester/subscription.ts +2 -0
  29. package/src/lexicon/index.ts +124 -36
  30. package/src/lexicon/lexicons.ts +491 -138
  31. package/src/lexicon/types/app/bsky/actor/defs.ts +59 -0
  32. package/src/lexicon/types/app/bsky/feed/post.ts +1 -1
  33. package/src/lexicon/types/com/atproto/admin/defs.ts +24 -0
  34. package/src/lexicon/types/com/atproto/admin/emitModerationEvent.ts +1 -0
  35. package/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts +4 -0
  36. package/src/lexicon/types/com/atproto/admin/queryModerationStatuses.ts +2 -0
  37. package/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts +47 -0
  38. package/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts +31 -0
  39. package/src/lexicon/types/com/atproto/{temp/transferAccount.ts → identity/signPlcOperation.ts} +8 -15
  40. package/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts +38 -0
  41. package/src/lexicon/types/com/atproto/{temp/pushBlob.ts → repo/importRepo.ts} +2 -5
  42. package/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts +65 -0
  43. package/src/lexicon/types/com/atproto/server/activateAccount.ts +31 -0
  44. package/src/lexicon/types/com/atproto/server/checkAccountStatus.ts +51 -0
  45. package/src/lexicon/types/com/atproto/server/deactivateAccount.ts +39 -0
  46. package/src/lexicon/types/com/atproto/server/describeServer.ts +1 -0
  47. package/src/lexicon/types/com/atproto/{temp/importRepo.ts → server/getServiceAuth.ts} +10 -9
  48. package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +24 -3
  49. package/tests/auto-moderator/labeler.test.ts +4 -1
@@ -82,6 +82,7 @@ export interface SubjectStatusView {
82
82
  takendown?: boolean;
83
83
  appealed?: boolean;
84
84
  suspendUntil?: string;
85
+ tags?: string[];
85
86
  [k: string]: unknown;
86
87
  }
87
88
  export declare function isSubjectStatusView(v: unknown): v is SubjectStatusView;
@@ -317,6 +318,14 @@ export interface ModEventEmail {
317
318
  }
318
319
  export declare function isModEventEmail(v: unknown): v is ModEventEmail;
319
320
  export declare function validateModEventEmail(v: unknown): ValidationResult;
321
+ export interface ModEventTag {
322
+ add: string[];
323
+ remove: string[];
324
+ comment?: string;
325
+ [k: string]: unknown;
326
+ }
327
+ export declare function isModEventTag(v: unknown): v is ModEventTag;
328
+ export declare function validateModEventTag(v: unknown): ValidationResult;
320
329
  export interface CommunicationTemplateView {
321
330
  id: string;
322
331
  name: string;
@@ -5,7 +5,7 @@ import * as ComAtprotoRepoStrongRef from '../repo/strongRef';
5
5
  export interface QueryParams {
6
6
  }
7
7
  export interface InputSchema {
8
- event: ComAtprotoAdminDefs.ModEventTakedown | ComAtprotoAdminDefs.ModEventAcknowledge | ComAtprotoAdminDefs.ModEventEscalate | ComAtprotoAdminDefs.ModEventComment | ComAtprotoAdminDefs.ModEventLabel | ComAtprotoAdminDefs.ModEventReport | ComAtprotoAdminDefs.ModEventMute | ComAtprotoAdminDefs.ModEventReverseTakedown | ComAtprotoAdminDefs.ModEventUnmute | ComAtprotoAdminDefs.ModEventEmail | {
8
+ event: ComAtprotoAdminDefs.ModEventTakedown | ComAtprotoAdminDefs.ModEventAcknowledge | ComAtprotoAdminDefs.ModEventEscalate | ComAtprotoAdminDefs.ModEventComment | ComAtprotoAdminDefs.ModEventLabel | ComAtprotoAdminDefs.ModEventReport | ComAtprotoAdminDefs.ModEventMute | ComAtprotoAdminDefs.ModEventReverseTakedown | ComAtprotoAdminDefs.ModEventUnmute | ComAtprotoAdminDefs.ModEventEmail | ComAtprotoAdminDefs.ModEventTag | {
9
9
  $type: string;
10
10
  [k: string]: unknown;
11
11
  };
@@ -14,6 +14,8 @@ export interface QueryParams {
14
14
  comment?: string;
15
15
  addedLabels?: string[];
16
16
  removedLabels?: string[];
17
+ addedTags?: string[];
18
+ removedTags?: string[];
17
19
  reportTypes?: string[];
18
20
  cursor?: string;
19
21
  }
@@ -17,6 +17,8 @@ export interface QueryParams {
17
17
  takendown?: boolean;
18
18
  appealed?: boolean;
19
19
  limit: number;
20
+ tags?: string[];
21
+ excludeTags?: string[];
20
22
  cursor?: string;
21
23
  }
22
24
  export type InputSchema = undefined;
@@ -0,0 +1,33 @@
1
+ import express from 'express';
2
+ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
3
+ export interface QueryParams {
4
+ }
5
+ export type InputSchema = undefined;
6
+ export interface OutputSchema {
7
+ rotationKeys?: string[];
8
+ alsoKnownAs?: string[];
9
+ verificationMethods?: {};
10
+ services?: {};
11
+ [k: string]: unknown;
12
+ }
13
+ export type HandlerInput = undefined;
14
+ export interface HandlerSuccess {
15
+ encoding: 'application/json';
16
+ body: OutputSchema;
17
+ headers?: {
18
+ [key: string]: string;
19
+ };
20
+ }
21
+ export interface HandlerError {
22
+ status: number;
23
+ message?: string;
24
+ }
25
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
26
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
27
+ auth: HA;
28
+ params: QueryParams;
29
+ input: HandlerInput;
30
+ req: express.Request;
31
+ res: express.Response;
32
+ };
33
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
@@ -0,0 +1,19 @@
1
+ import express from 'express';
2
+ import { HandlerAuth } from '@atproto/xrpc-server';
3
+ export interface QueryParams {
4
+ }
5
+ export type InputSchema = undefined;
6
+ export type HandlerInput = undefined;
7
+ export interface HandlerError {
8
+ status: number;
9
+ message?: string;
10
+ }
11
+ export type HandlerOutput = HandlerError | void;
12
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
13
+ auth: HA;
14
+ params: QueryParams;
15
+ input: HandlerInput;
16
+ req: express.Request;
17
+ res: express.Response;
18
+ };
19
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
@@ -3,16 +3,15 @@ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
3
3
  export interface QueryParams {
4
4
  }
5
5
  export interface InputSchema {
6
- handle: string;
7
- did: string;
8
- plcOp: {};
6
+ token?: string;
7
+ rotationKeys?: string[];
8
+ alsoKnownAs?: string[];
9
+ verificationMethods?: {};
10
+ services?: {};
9
11
  [k: string]: unknown;
10
12
  }
11
13
  export interface OutputSchema {
12
- accessJwt: string;
13
- refreshJwt: string;
14
- handle: string;
15
- did: string;
14
+ operation: {};
16
15
  [k: string]: unknown;
17
16
  }
18
17
  export interface HandlerInput {
@@ -29,7 +28,6 @@ export interface HandlerSuccess {
29
28
  export interface HandlerError {
30
29
  status: number;
31
30
  message?: string;
32
- error?: 'InvalidHandle' | 'InvalidPassword' | 'InvalidInviteCode' | 'HandleNotAvailable' | 'UnsupportedDomain' | 'UnresolvableDid' | 'IncompatibleDidDoc';
33
31
  }
34
32
  export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
35
33
  export type HandlerReqCtx<HA extends HandlerAuth = never> = {
@@ -0,0 +1,25 @@
1
+ import express from 'express';
2
+ import { HandlerAuth } from '@atproto/xrpc-server';
3
+ export interface QueryParams {
4
+ }
5
+ export interface InputSchema {
6
+ operation: {};
7
+ [k: string]: unknown;
8
+ }
9
+ export interface HandlerInput {
10
+ encoding: 'application/json';
11
+ body: InputSchema;
12
+ }
13
+ export interface HandlerError {
14
+ status: number;
15
+ message?: string;
16
+ }
17
+ export type HandlerOutput = HandlerError | void;
18
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
19
+ auth: HA;
20
+ params: QueryParams;
21
+ input: HandlerInput;
22
+ req: express.Request;
23
+ res: express.Response;
24
+ };
25
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
@@ -3,11 +3,10 @@ import express from 'express';
3
3
  import stream from 'stream';
4
4
  import { HandlerAuth } from '@atproto/xrpc-server';
5
5
  export interface QueryParams {
6
- did: string;
7
6
  }
8
7
  export type InputSchema = string | Uint8Array;
9
8
  export interface HandlerInput {
10
- encoding: '*/*';
9
+ encoding: 'application/vnd.ipld.car';
11
10
  body: stream.Readable;
12
11
  }
13
12
  export interface HandlerError {
@@ -0,0 +1,41 @@
1
+ import express from 'express';
2
+ import { ValidationResult } from '@atproto/lexicon';
3
+ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
4
+ export interface QueryParams {
5
+ limit: number;
6
+ cursor?: string;
7
+ }
8
+ export type InputSchema = undefined;
9
+ export interface OutputSchema {
10
+ cursor?: string;
11
+ blobs: RecordBlob[];
12
+ [k: string]: unknown;
13
+ }
14
+ export type HandlerInput = undefined;
15
+ export interface HandlerSuccess {
16
+ encoding: 'application/json';
17
+ body: OutputSchema;
18
+ headers?: {
19
+ [key: string]: string;
20
+ };
21
+ }
22
+ export interface HandlerError {
23
+ status: number;
24
+ message?: string;
25
+ }
26
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
27
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
28
+ auth: HA;
29
+ params: QueryParams;
30
+ input: HandlerInput;
31
+ req: express.Request;
32
+ res: express.Response;
33
+ };
34
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
35
+ export interface RecordBlob {
36
+ cid: string;
37
+ recordUri: string;
38
+ [k: string]: unknown;
39
+ }
40
+ export declare function isRecordBlob(v: unknown): v is RecordBlob;
41
+ export declare function validateRecordBlob(v: unknown): ValidationResult;
@@ -0,0 +1,19 @@
1
+ import express from 'express';
2
+ import { HandlerAuth } from '@atproto/xrpc-server';
3
+ export interface QueryParams {
4
+ }
5
+ export type InputSchema = undefined;
6
+ export type HandlerInput = undefined;
7
+ export interface HandlerError {
8
+ status: number;
9
+ message?: string;
10
+ }
11
+ export type HandlerOutput = HandlerError | void;
12
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
13
+ auth: HA;
14
+ params: QueryParams;
15
+ input: HandlerInput;
16
+ req: express.Request;
17
+ res: express.Response;
18
+ };
19
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
@@ -0,0 +1,38 @@
1
+ import express from 'express';
2
+ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
3
+ export interface QueryParams {
4
+ }
5
+ export type InputSchema = undefined;
6
+ export interface OutputSchema {
7
+ activated: boolean;
8
+ validDid: boolean;
9
+ repoCommit: string;
10
+ repoRev: string;
11
+ repoBlocks: number;
12
+ indexedRecords: number;
13
+ privateStateValues: number;
14
+ expectedBlobs: number;
15
+ importedBlobs: number;
16
+ [k: string]: unknown;
17
+ }
18
+ export type HandlerInput = undefined;
19
+ export interface HandlerSuccess {
20
+ encoding: 'application/json';
21
+ body: OutputSchema;
22
+ headers?: {
23
+ [key: string]: string;
24
+ };
25
+ }
26
+ export interface HandlerError {
27
+ status: number;
28
+ message?: string;
29
+ }
30
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
31
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
32
+ auth: HA;
33
+ params: QueryParams;
34
+ input: HandlerInput;
35
+ req: express.Request;
36
+ res: express.Response;
37
+ };
38
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
@@ -0,0 +1,25 @@
1
+ import express from 'express';
2
+ import { HandlerAuth } from '@atproto/xrpc-server';
3
+ export interface QueryParams {
4
+ }
5
+ export interface InputSchema {
6
+ deleteAfter?: string;
7
+ [k: string]: unknown;
8
+ }
9
+ export interface HandlerInput {
10
+ encoding: 'application/json';
11
+ body: InputSchema;
12
+ }
13
+ export interface HandlerError {
14
+ status: number;
15
+ message?: string;
16
+ }
17
+ export type HandlerOutput = HandlerError | void;
18
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
19
+ auth: HA;
20
+ params: QueryParams;
21
+ input: HandlerInput;
22
+ req: express.Request;
23
+ res: express.Response;
24
+ };
25
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
@@ -9,6 +9,7 @@ export interface OutputSchema {
9
9
  phoneVerificationRequired?: boolean;
10
10
  availableUserDomains: string[];
11
11
  links?: Links;
12
+ did: string;
12
13
  [k: string]: unknown;
13
14
  }
14
15
  export type HandlerInput = undefined;
@@ -1,18 +1,17 @@
1
- /// <reference types="node" />
2
1
  import express from 'express';
3
- import stream from 'stream';
4
2
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
5
3
  export interface QueryParams {
6
- did: string;
4
+ aud: string;
7
5
  }
8
- export type InputSchema = string | Uint8Array;
9
- export interface HandlerInput {
10
- encoding: 'application/vnd.ipld.car';
11
- body: stream.Readable;
6
+ export type InputSchema = undefined;
7
+ export interface OutputSchema {
8
+ token: string;
9
+ [k: string]: unknown;
12
10
  }
11
+ export type HandlerInput = undefined;
13
12
  export interface HandlerSuccess {
14
- encoding: 'text/plain';
15
- body: Uint8Array | stream.Readable;
13
+ encoding: 'application/json';
14
+ body: OutputSchema;
16
15
  headers?: {
17
16
  [key: string]: string;
18
17
  };
@@ -7,7 +7,7 @@ import { IncomingMessage } from 'http';
7
7
  export interface QueryParams {
8
8
  cursor?: number;
9
9
  }
10
- export type OutputSchema = Commit | Handle | Migrate | Tombstone | Info | {
10
+ export type OutputSchema = Commit | Identity | Handle | Migrate | Tombstone | Info | {
11
11
  $type: string;
12
12
  [k: string]: unknown;
13
13
  };
@@ -37,6 +37,14 @@ export interface Commit {
37
37
  }
38
38
  export declare function isCommit(v: unknown): v is Commit;
39
39
  export declare function validateCommit(v: unknown): ValidationResult;
40
+ export interface Identity {
41
+ seq: number;
42
+ did: string;
43
+ time: string;
44
+ [k: string]: unknown;
45
+ }
46
+ export declare function isIdentity(v: unknown): v is Identity;
47
+ export declare function validateIdentity(v: unknown): ValidationResult;
40
48
  export interface Handle {
41
49
  seq: number;
42
50
  did: string;
@@ -32,7 +32,7 @@ export declare class PerfectMap<K, V> extends Map<K, V> {
32
32
  get(key: K): V;
33
33
  }
34
34
  export type ProcessableMessage = message.Commit | message.Handle | message.Migrate | message.Tombstone;
35
- export declare function loggableMessage(msg: RepoMessage): message.Tombstone | message.Info | {
35
+ export declare function loggableMessage(msg: RepoMessage): message.Identity | message.Info | {
36
36
  [k: string]: unknown;
37
37
  $type: string;
38
38
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/bsky",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of app.bsky App View (Bluesky API)",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  "sharp": "^0.32.6",
41
41
  "typed-emitter": "^2.1.0",
42
42
  "uint8arrays": "3.0.0",
43
- "@atproto/api": "^0.9.7",
43
+ "@atproto/api": "^0.10.0",
44
44
  "@atproto/common": "^0.3.3",
45
45
  "@atproto/crypto": "^0.3.0",
46
46
  "@atproto/identity": "^0.3.2",
@@ -60,10 +60,10 @@
60
60
  "@types/pg": "^8.6.6",
61
61
  "@types/qs": "^6.9.7",
62
62
  "axios": "^0.27.2",
63
- "@atproto/api": "^0.9.7",
64
- "@atproto/dev-env": "^0.2.30",
63
+ "@atproto/api": "^0.10.0",
64
+ "@atproto/dev-env": "^0.2.32",
65
65
  "@atproto/lex-cli": "^0.3.0",
66
- "@atproto/pds": "^0.3.18",
66
+ "@atproto/pds": "^0.4.0",
67
67
  "@atproto/xrpc": "^0.4.1"
68
68
  },
69
69
  "scripts": {
@@ -145,6 +145,8 @@ export class IndexerSubscription {
145
145
  await this.handleCommit(msg)
146
146
  } else if (message.isHandle(msg)) {
147
147
  await this.handleUpdateHandle(msg)
148
+ } else if (message.isIdentity(msg)) {
149
+ await this.handleIdentityEvt(msg)
148
150
  } else if (message.isTombstone(msg)) {
149
151
  await this.handleTombstone(msg)
150
152
  } else if (message.isMigrate(msg)) {
@@ -244,6 +246,10 @@ export class IndexerSubscription {
244
246
  await this.indexingSvc.indexHandle(msg.did, msg.time, true)
245
247
  }
246
248
 
249
+ private async handleIdentityEvt(msg: message.Identity) {
250
+ await this.indexingSvc.indexHandle(msg.did, msg.time, true)
251
+ }
252
+
247
253
  private async handleTombstone(msg: message.Tombstone) {
248
254
  await this.indexingSvc.tombstoneActor(msg.did)
249
255
  }
@@ -156,6 +156,8 @@ function getMessageDetails(msg: Message):
156
156
  return { seq: msg.seq, repo: msg.repo, message: msg }
157
157
  } else if (message.isHandle(msg)) {
158
158
  return { seq: msg.seq, repo: msg.did, message: msg }
159
+ } else if (message.isIdentity(msg)) {
160
+ return { seq: msg.seq, repo: msg.did, message: msg }
159
161
  } else if (message.isMigrate(msg)) {
160
162
  return { seq: msg.seq, repo: msg.did, message: msg }
161
163
  } else if (message.isTombstone(msg)) {