@atproto/api 0.6.20 → 0.6.21

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 (37) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +4 -0
  3. package/definitions/moderation-behaviors.d.ts +1 -0
  4. package/definitions/profile-moderation-behaviors.json +25 -0
  5. package/dist/agent.d.ts +2 -0
  6. package/dist/bsky-agent.d.ts +7 -0
  7. package/dist/client/index.d.ts +3 -0
  8. package/dist/client/lexicons.d.ts +43 -0
  9. package/dist/client/types/app/bsky/actor/defs.d.ts +1 -0
  10. package/dist/client/types/com/atproto/server/createAccount.d.ts +2 -0
  11. package/dist/client/types/com/atproto/server/createSession.d.ts +1 -0
  12. package/dist/client/types/com/atproto/server/refreshSession.d.ts +1 -0
  13. package/dist/client/types/com/atproto/server/reserveSigningKey.d.ts +18 -0
  14. package/dist/client/types/com/atproto/sync/listRepos.d.ts +1 -0
  15. package/dist/index.js +456 -265
  16. package/dist/index.js.map +3 -3
  17. package/dist/moderation/accumulator.d.ts +1 -0
  18. package/docs/moderation-behaviors/profiles.md +17 -0
  19. package/package.json +8 -7
  20. package/src/agent.ts +28 -1
  21. package/src/bsky-agent.ts +43 -0
  22. package/src/client/index.ts +13 -0
  23. package/src/client/lexicons.ts +44 -1
  24. package/src/client/types/app/bsky/actor/defs.ts +1 -0
  25. package/src/client/types/com/atproto/server/createAccount.ts +2 -0
  26. package/src/client/types/com/atproto/server/createSession.ts +1 -0
  27. package/src/client/types/com/atproto/server/refreshSession.ts +1 -0
  28. package/src/client/types/com/atproto/server/reserveSigningKey.ts +35 -0
  29. package/src/client/types/com/atproto/sync/listRepos.ts +1 -0
  30. package/src/moderation/accumulator.ts +13 -0
  31. package/src/moderation/subjects/account.ts +7 -1
  32. package/tests/agent.test.ts +18 -21
  33. package/tests/bsky-agent.test.ts +19 -25
  34. package/tests/errors.test.ts +5 -11
  35. package/tests/rich-text-detection.test.ts +3 -3
  36. package/tests/util/index.ts +3 -0
  37. package/tests/util/moderation-behavior.ts +10 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atproto/api
2
2
 
3
+ ## 0.6.21
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1779](https://github.com/bluesky-social/atproto/pull/1779) [`9c98a5ba`](https://github.com/bluesky-social/atproto/commit/9c98a5baaf503b02238a6afe4f6e2b79c5181693) Thanks [@pfrazee](https://github.com/pfrazee)! - modlist helpers added to bsky-agent, add blockingByList to viewer state lexicon
8
+
9
+ - [`35d108ce`](https://github.com/bluesky-social/atproto/commit/35d108ce94866ce1b3d147cd0620a0ba1c4ebcd7) Thanks [@devinivy](https://github.com/devinivy)! - Allow pds to serve did doc with credentials, API client to respect PDS listed in the did doc.
10
+
11
+ - Updated dependencies [[`35d108ce`](https://github.com/bluesky-social/atproto/commit/35d108ce94866ce1b3d147cd0620a0ba1c4ebcd7)]:
12
+ - @atproto/common-web@0.2.2
13
+ - @atproto/lexicon@0.2.3
14
+ - @atproto/syntax@0.1.3
15
+ - @atproto/xrpc@0.3.3
16
+
3
17
  ## 0.6.20
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -91,6 +91,10 @@ await agent.searchActors(params, opts)
91
91
  await agent.searchActorsTypeahead(params, opts)
92
92
  await agent.mute(did)
93
93
  await agent.unmute(did)
94
+ await agent.muteModList(listUri)
95
+ await agent.unmuteModList(listUri)
96
+ await agent.blockModList(listUri)
97
+ await agent.unblockModList(listUri)
94
98
 
95
99
  // Notifications
96
100
  await agent.listNotifications(params, opts)
@@ -32,6 +32,7 @@ export interface ModerationBehaviors {
32
32
  string,
33
33
  {
34
34
  blocking: boolean
35
+ blockingByList: boolean
35
36
  blockedBy: boolean
36
37
  muted: boolean
37
38
  mutedByList: boolean
@@ -2,45 +2,59 @@
2
2
  "users": {
3
3
  "self": {
4
4
  "blocking": false,
5
+ "blockingByList": false,
5
6
  "blockedBy": false,
6
7
  "muted": false,
7
8
  "mutedByList": false
8
9
  },
9
10
  "alice": {
10
11
  "blocking": false,
12
+ "blockingByList": false,
11
13
  "blockedBy": false,
12
14
  "muted": false,
13
15
  "mutedByList": false
14
16
  },
15
17
  "bob": {
16
18
  "blocking": true,
19
+ "blockingByList": false,
17
20
  "blockedBy": false,
18
21
  "muted": false,
19
22
  "mutedByList": false
20
23
  },
21
24
  "carla": {
22
25
  "blocking": false,
26
+ "blockingByList": false,
23
27
  "blockedBy": true,
24
28
  "muted": false,
25
29
  "mutedByList": false
26
30
  },
27
31
  "dan": {
28
32
  "blocking": false,
33
+ "blockingByList": false,
29
34
  "blockedBy": false,
30
35
  "muted": true,
31
36
  "mutedByList": false
32
37
  },
33
38
  "elise": {
34
39
  "blocking": false,
40
+ "blockingByList": false,
35
41
  "blockedBy": false,
36
42
  "muted": false,
37
43
  "mutedByList": true
38
44
  },
39
45
  "fern": {
40
46
  "blocking": true,
47
+ "blockingByList": false,
41
48
  "blockedBy": true,
42
49
  "muted": false,
43
50
  "mutedByList": false
51
+ },
52
+ "georgia": {
53
+ "blocking": false,
54
+ "blockingByList": true,
55
+ "blockedBy": false,
56
+ "muted": false,
57
+ "mutedByList": false
44
58
  }
45
59
  },
46
60
  "configurations": {
@@ -377,6 +391,17 @@
377
391
  }
378
392
  },
379
393
 
394
+ "Mute/block: Blocking-by-list user": {
395
+ "cfg": "none",
396
+ "subject": "profile",
397
+ "author": "georgia",
398
+ "labels": {},
399
+ "behaviors": {
400
+ "account": { "cause": "blocking-by-list", "filter": true },
401
+ "avatar": { "blur": true, "noOverride": true }
402
+ }
403
+ },
404
+
380
405
  "Mute/block: Blocked by user": {
381
406
  "cfg": "none",
382
407
  "subject": "profile",
package/dist/agent.d.ts CHANGED
@@ -4,6 +4,7 @@ export declare class AtpAgent {
4
4
  service: URL;
5
5
  api: AtpServiceClient;
6
6
  session?: AtpSessionData;
7
+ pdsUrl: URL | undefined;
7
8
  private _baseClient;
8
9
  private _persistSession?;
9
10
  private _refreshSessionPromise;
@@ -24,4 +25,5 @@ export declare class AtpAgent {
24
25
  resolveHandle: typeof this.api.com.atproto.identity.resolveHandle;
25
26
  updateHandle: typeof this.api.com.atproto.identity.updateHandle;
26
27
  createModerationReport: typeof this.api.com.atproto.moderation.createReport;
28
+ private _updateApiEndpoint;
27
29
  }
@@ -48,6 +48,13 @@ export declare class BskyAgent extends AtpAgent {
48
48
  upsertProfile(updateFn: (existing: AppBskyActorProfile.Record | undefined) => AppBskyActorProfile.Record | Promise<AppBskyActorProfile.Record>): Promise<void>;
49
49
  mute(actor: string): Promise<import("./client/types/app/bsky/graph/muteActor").Response>;
50
50
  unmute(actor: string): Promise<import("./client/types/app/bsky/graph/unmuteActor").Response>;
51
+ muteModList(uri: string): Promise<import("./client/types/app/bsky/graph/muteActorList").Response>;
52
+ unmuteModList(uri: string): Promise<import("./client/types/app/bsky/graph/unmuteActorList").Response>;
53
+ blockModList(uri: string): Promise<{
54
+ uri: string;
55
+ cid: string;
56
+ }>;
57
+ unblockModList(uri: string): Promise<void>;
51
58
  updateSeenNotifications(seenAt?: string): Promise<import("./client/types/app/bsky/notification/updateSeen").Response>;
52
59
  getPreferences(): Promise<BskyPreferences>;
53
60
  setSavedFeeds(saved: string[], pinned: string[]): Promise<{
@@ -45,6 +45,7 @@ import * as ComAtprotoServerRequestAccountDelete from './types/com/atproto/serve
45
45
  import * as ComAtprotoServerRequestEmailConfirmation from './types/com/atproto/server/requestEmailConfirmation';
46
46
  import * as ComAtprotoServerRequestEmailUpdate from './types/com/atproto/server/requestEmailUpdate';
47
47
  import * as ComAtprotoServerRequestPasswordReset from './types/com/atproto/server/requestPasswordReset';
48
+ import * as ComAtprotoServerReserveSigningKey from './types/com/atproto/server/reserveSigningKey';
48
49
  import * as ComAtprotoServerResetPassword from './types/com/atproto/server/resetPassword';
49
50
  import * as ComAtprotoServerRevokeAppPassword from './types/com/atproto/server/revokeAppPassword';
50
51
  import * as ComAtprotoServerUpdateEmail from './types/com/atproto/server/updateEmail';
@@ -167,6 +168,7 @@ export * as ComAtprotoServerRequestAccountDelete from './types/com/atproto/serve
167
168
  export * as ComAtprotoServerRequestEmailConfirmation from './types/com/atproto/server/requestEmailConfirmation';
168
169
  export * as ComAtprotoServerRequestEmailUpdate from './types/com/atproto/server/requestEmailUpdate';
169
170
  export * as ComAtprotoServerRequestPasswordReset from './types/com/atproto/server/requestPasswordReset';
171
+ export * as ComAtprotoServerReserveSigningKey from './types/com/atproto/server/reserveSigningKey';
170
172
  export * as ComAtprotoServerResetPassword from './types/com/atproto/server/resetPassword';
171
173
  export * as ComAtprotoServerRevokeAppPassword from './types/com/atproto/server/revokeAppPassword';
172
174
  export * as ComAtprotoServerUpdateEmail from './types/com/atproto/server/updateEmail';
@@ -363,6 +365,7 @@ export declare class ServerNS {
363
365
  requestEmailConfirmation(data?: ComAtprotoServerRequestEmailConfirmation.InputSchema, opts?: ComAtprotoServerRequestEmailConfirmation.CallOptions): Promise<ComAtprotoServerRequestEmailConfirmation.Response>;
364
366
  requestEmailUpdate(data?: ComAtprotoServerRequestEmailUpdate.InputSchema, opts?: ComAtprotoServerRequestEmailUpdate.CallOptions): Promise<ComAtprotoServerRequestEmailUpdate.Response>;
365
367
  requestPasswordReset(data?: ComAtprotoServerRequestPasswordReset.InputSchema, opts?: ComAtprotoServerRequestPasswordReset.CallOptions): Promise<ComAtprotoServerRequestPasswordReset.Response>;
368
+ reserveSigningKey(data?: ComAtprotoServerReserveSigningKey.InputSchema, opts?: ComAtprotoServerReserveSigningKey.CallOptions): Promise<ComAtprotoServerReserveSigningKey.Response>;
366
369
  resetPassword(data?: ComAtprotoServerResetPassword.InputSchema, opts?: ComAtprotoServerResetPassword.CallOptions): Promise<ComAtprotoServerResetPassword.Response>;
367
370
  revokeAppPassword(data?: ComAtprotoServerRevokeAppPassword.InputSchema, opts?: ComAtprotoServerRevokeAppPassword.CallOptions): Promise<ComAtprotoServerRevokeAppPassword.Response>;
368
371
  updateEmail(data?: ComAtprotoServerUpdateEmail.InputSchema, opts?: ComAtprotoServerUpdateEmail.CallOptions): Promise<ComAtprotoServerUpdateEmail.Response>;
@@ -2121,6 +2121,9 @@ export declare const schemaDict: {
2121
2121
  recoveryKey: {
2122
2122
  type: string;
2123
2123
  };
2124
+ plcOp: {
2125
+ type: string;
2126
+ };
2124
2127
  };
2125
2128
  };
2126
2129
  };
@@ -2144,6 +2147,9 @@ export declare const schemaDict: {
2144
2147
  type: string;
2145
2148
  format: string;
2146
2149
  };
2150
+ didDoc: {
2151
+ type: string;
2152
+ };
2147
2153
  };
2148
2154
  };
2149
2155
  };
@@ -2346,6 +2352,9 @@ export declare const schemaDict: {
2346
2352
  type: string;
2347
2353
  format: string;
2348
2354
  };
2355
+ didDoc: {
2356
+ type: string;
2357
+ };
2349
2358
  email: {
2350
2359
  type: string;
2351
2360
  };
@@ -2642,6 +2651,9 @@ export declare const schemaDict: {
2642
2651
  type: string;
2643
2652
  format: string;
2644
2653
  };
2654
+ didDoc: {
2655
+ type: string;
2656
+ };
2645
2657
  };
2646
2658
  };
2647
2659
  };
@@ -2715,6 +2727,29 @@ export declare const schemaDict: {
2715
2727
  };
2716
2728
  };
2717
2729
  };
2730
+ ComAtprotoServerReserveSigningKey: {
2731
+ lexicon: number;
2732
+ id: string;
2733
+ defs: {
2734
+ main: {
2735
+ type: string;
2736
+ description: string;
2737
+ output: {
2738
+ encoding: string;
2739
+ schema: {
2740
+ type: string;
2741
+ required: string[];
2742
+ properties: {
2743
+ signingKey: {
2744
+ type: string;
2745
+ description: string;
2746
+ };
2747
+ };
2748
+ };
2749
+ };
2750
+ };
2751
+ };
2752
+ };
2718
2753
  ComAtprotoServerResetPassword: {
2719
2754
  lexicon: number;
2720
2755
  id: string;
@@ -3125,6 +3160,9 @@ export declare const schemaDict: {
3125
3160
  type: string;
3126
3161
  format: string;
3127
3162
  };
3163
+ rev: {
3164
+ type: string;
3165
+ };
3128
3166
  };
3129
3167
  };
3130
3168
  };
@@ -3501,6 +3539,10 @@ export declare const schemaDict: {
3501
3539
  type: string;
3502
3540
  format: string;
3503
3541
  };
3542
+ blockingByList: {
3543
+ type: string;
3544
+ ref: string;
3545
+ };
3504
3546
  following: {
3505
3547
  type: string;
3506
3548
  format: string;
@@ -6949,6 +6991,7 @@ export declare const ids: {
6949
6991
  ComAtprotoServerRequestEmailConfirmation: string;
6950
6992
  ComAtprotoServerRequestEmailUpdate: string;
6951
6993
  ComAtprotoServerRequestPasswordReset: string;
6994
+ ComAtprotoServerReserveSigningKey: string;
6952
6995
  ComAtprotoServerResetPassword: string;
6953
6996
  ComAtprotoServerRevokeAppPassword: string;
6954
6997
  ComAtprotoServerUpdateEmail: string;
@@ -47,6 +47,7 @@ export interface ViewerState {
47
47
  mutedByList?: AppBskyGraphDefs.ListViewBasic;
48
48
  blockedBy?: boolean;
49
49
  blocking?: string;
50
+ blockingByList?: AppBskyGraphDefs.ListViewBasic;
50
51
  following?: string;
51
52
  followedBy?: string;
52
53
  [k: string]: unknown;
@@ -8,6 +8,7 @@ export interface InputSchema {
8
8
  inviteCode?: string;
9
9
  password: string;
10
10
  recoveryKey?: string;
11
+ plcOp?: Uint8Array;
11
12
  [k: string]: unknown;
12
13
  }
13
14
  export interface OutputSchema {
@@ -15,6 +16,7 @@ export interface OutputSchema {
15
16
  refreshJwt: string;
16
17
  handle: string;
17
18
  did: string;
19
+ didDoc?: {};
18
20
  [k: string]: unknown;
19
21
  }
20
22
  export interface CallOptions {
@@ -11,6 +11,7 @@ export interface OutputSchema {
11
11
  refreshJwt: string;
12
12
  handle: string;
13
13
  did: string;
14
+ didDoc?: {};
14
15
  email?: string;
15
16
  emailConfirmed?: boolean;
16
17
  [k: string]: unknown;
@@ -7,6 +7,7 @@ export interface OutputSchema {
7
7
  refreshJwt: string;
8
8
  handle: string;
9
9
  did: string;
10
+ didDoc?: {};
10
11
  [k: string]: unknown;
11
12
  }
12
13
  export interface CallOptions {
@@ -0,0 +1,18 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ export interface QueryParams {
3
+ }
4
+ export declare type InputSchema = undefined;
5
+ export interface OutputSchema {
6
+ signingKey: string;
7
+ [k: string]: unknown;
8
+ }
9
+ export interface CallOptions {
10
+ headers?: Headers;
11
+ qp?: QueryParams;
12
+ }
13
+ export interface Response {
14
+ success: boolean;
15
+ headers: Headers;
16
+ data: OutputSchema;
17
+ }
18
+ export declare function toKnownErr(e: any): any;
@@ -22,6 +22,7 @@ export declare function toKnownErr(e: any): any;
22
22
  export interface Repo {
23
23
  did: string;
24
24
  head: string;
25
+ rev: string;
25
26
  [k: string]: unknown;
26
27
  }
27
28
  export declare function isRepo(v: unknown): v is Repo;