@atproto/api 0.2.1 → 0.2.3

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 (38) hide show
  1. package/dist/client/lexicons.d.ts +9 -0
  2. package/dist/client/types/app/bsky/actor/createScene.d.ts +32 -0
  3. package/dist/client/types/app/bsky/actor/updateProfile.d.ts +3 -10
  4. package/dist/client/types/app/bsky/feed/repost.d.ts +9 -0
  5. package/dist/client/types/app/bsky/feed/trend.d.ts +9 -0
  6. package/dist/client/types/app/bsky/graph/getAssertions.d.ts +48 -0
  7. package/dist/client/types/app/bsky/graph/getMembers.d.ts +36 -0
  8. package/dist/client/types/app/bsky/graph/getMemberships.d.ts +36 -0
  9. package/dist/client/types/app/bsky/notification/updateSeen.d.ts +17 -0
  10. package/dist/client/types/app/bsky/system/actorScene.d.ts +1 -0
  11. package/dist/client/types/com/atproto/repo/listRecords.d.ts +1 -0
  12. package/dist/client/types/com/atproto/repo/strongRef.d.ts +8 -0
  13. package/dist/client/types/com/atproto/server/createSession.d.ts +1 -0
  14. package/dist/client/types/com/atproto/server/getSession.d.ts +1 -0
  15. package/dist/client/types/com/atproto/sync/getCheckout.d.ts +15 -0
  16. package/dist/client/types/com/atproto/sync/getCommitPath.d.ts +20 -0
  17. package/dist/client/types/com/atproto/sync/getHead.d.ts +18 -0
  18. package/dist/client/types/com/atproto/sync/getRecord.d.ts +17 -0
  19. package/dist/client/types/com/atproto/sync/getRoot.d.ts +18 -0
  20. package/dist/client/types/com/atproto/sync/updateRepo.d.ts +15 -0
  21. package/dist/client/util.d.ts +2 -0
  22. package/dist/helpers/bsky.d.ts +20 -0
  23. package/dist/index.js +15 -2
  24. package/dist/index.js.map +2 -2
  25. package/dist/mixins/bsky.d.ts +23 -0
  26. package/dist/rich-text/sanitize.d.ts +4 -0
  27. package/dist/types.d.ts +1 -0
  28. package/package.json +1 -1
  29. package/src/agent.ts +4 -0
  30. package/src/client/lexicons.ts +9 -0
  31. package/src/client/types/com/atproto/repo/listRecords.ts +1 -0
  32. package/src/client/types/com/atproto/server/createSession.ts +1 -0
  33. package/src/client/types/com/atproto/server/getSession.ts +1 -0
  34. package/src/types.ts +1 -0
  35. package/tests/agent.test.ts +7 -1
  36. package/tsconfig.build.tsbuildinfo +1 -1
  37. package/dist/client/types/app/bsky/embed/complexRecord.d.ts +0 -24
  38. package/dist/client/types/app/bsky/embed/post.d.ts +0 -33
@@ -1295,6 +1295,9 @@ export declare const schemaDict: {
1295
1295
  default: number;
1296
1296
  description: string;
1297
1297
  };
1298
+ cursor: {
1299
+ type: string;
1300
+ };
1298
1301
  rkeyStart: {
1299
1302
  type: string;
1300
1303
  description: string;
@@ -1605,6 +1608,9 @@ export declare const schemaDict: {
1605
1608
  type: string;
1606
1609
  format: string;
1607
1610
  };
1611
+ email: {
1612
+ type: string;
1613
+ };
1608
1614
  };
1609
1615
  };
1610
1616
  };
@@ -1720,6 +1726,9 @@ export declare const schemaDict: {
1720
1726
  type: string;
1721
1727
  format: string;
1722
1728
  };
1729
+ email: {
1730
+ type: string;
1731
+ };
1723
1732
  };
1724
1733
  };
1725
1734
  };
@@ -0,0 +1,32 @@
1
+ import { Headers, XRPCError } from '@atproto/xrpc';
2
+ import * as AppBskySystemDeclRef from '../system/declRef';
3
+ export interface QueryParams {
4
+ }
5
+ export interface InputSchema {
6
+ handle: string;
7
+ recoveryKey?: string;
8
+ [k: string]: unknown;
9
+ }
10
+ export interface OutputSchema {
11
+ handle: string;
12
+ did: string;
13
+ declaration: AppBskySystemDeclRef.Main;
14
+ [k: string]: unknown;
15
+ }
16
+ export interface CallOptions {
17
+ headers?: Headers;
18
+ qp?: QueryParams;
19
+ encoding: 'application/json';
20
+ }
21
+ export interface Response {
22
+ success: boolean;
23
+ headers: Headers;
24
+ data: OutputSchema;
25
+ }
26
+ export declare class InvalidHandleError extends XRPCError {
27
+ constructor(src: XRPCError);
28
+ }
29
+ export declare class HandleNotAvailableError extends XRPCError {
30
+ constructor(src: XRPCError);
31
+ }
32
+ export declare function toKnownErr(e: any): any;
@@ -1,19 +1,12 @@
1
1
  import { Headers, XRPCError } from '@atproto/xrpc';
2
+ import { BlobRef } from '@atproto/lexicon';
2
3
  export interface QueryParams {
3
4
  }
4
5
  export interface InputSchema {
5
6
  displayName?: string;
6
7
  description?: string | null;
7
- avatar?: {
8
- cid: string;
9
- mimeType: string;
10
- [k: string]: unknown;
11
- } | null;
12
- banner?: {
13
- cid: string;
14
- mimeType: string;
15
- [k: string]: unknown;
16
- } | null;
8
+ avatar?: BlobRef | null;
9
+ banner?: BlobRef | null;
17
10
  [k: string]: unknown;
18
11
  }
19
12
  export interface OutputSchema {
@@ -0,0 +1,9 @@
1
+ import { ValidationResult } from '@atproto/lexicon';
2
+ import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef';
3
+ export interface Record {
4
+ subject: ComAtprotoRepoStrongRef.Main;
5
+ createdAt: string;
6
+ [k: string]: unknown;
7
+ }
8
+ export declare function isRecord(v: unknown): v is Record;
9
+ export declare function validateRecord(v: unknown): ValidationResult;
@@ -0,0 +1,9 @@
1
+ import { ValidationResult } from '@atproto/lexicon';
2
+ import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef';
3
+ export interface Record {
4
+ subject: ComAtprotoRepoStrongRef.Main;
5
+ createdAt: string;
6
+ [k: string]: unknown;
7
+ }
8
+ export declare function isRecord(v: unknown): v is Record;
9
+ export declare function validateRecord(v: unknown): ValidationResult;
@@ -0,0 +1,48 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ import { ValidationResult } from '@atproto/lexicon';
3
+ import * as AppBskyActorRef from '../actor/ref';
4
+ export interface QueryParams {
5
+ author?: string;
6
+ subject?: string;
7
+ assertion?: string;
8
+ confirmed?: boolean;
9
+ limit?: number;
10
+ before?: string;
11
+ }
12
+ export declare type InputSchema = undefined;
13
+ export interface OutputSchema {
14
+ cursor?: string;
15
+ assertions: Assertion[];
16
+ [k: string]: unknown;
17
+ }
18
+ export interface CallOptions {
19
+ headers?: Headers;
20
+ }
21
+ export interface Response {
22
+ success: boolean;
23
+ headers: Headers;
24
+ data: OutputSchema;
25
+ }
26
+ export declare function toKnownErr(e: any): any;
27
+ export interface Assertion {
28
+ uri: string;
29
+ cid: string;
30
+ assertion: string;
31
+ confirmation?: Confirmation;
32
+ author: AppBskyActorRef.WithInfo;
33
+ subject: AppBskyActorRef.WithInfo;
34
+ indexedAt: string;
35
+ createdAt: string;
36
+ [k: string]: unknown;
37
+ }
38
+ export declare function isAssertion(v: unknown): v is Assertion;
39
+ export declare function validateAssertion(v: unknown): ValidationResult;
40
+ export interface Confirmation {
41
+ uri: string;
42
+ cid: string;
43
+ indexedAt: string;
44
+ createdAt: string;
45
+ [k: string]: unknown;
46
+ }
47
+ export declare function isConfirmation(v: unknown): v is Confirmation;
48
+ export declare function validateConfirmation(v: unknown): ValidationResult;
@@ -0,0 +1,36 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ import { ValidationResult } from '@atproto/lexicon';
3
+ import * as AppBskyActorRef from '../actor/ref';
4
+ import * as AppBskySystemDeclRef from '../system/declRef';
5
+ export interface QueryParams {
6
+ actor: string;
7
+ limit?: number;
8
+ before?: string;
9
+ }
10
+ export declare type InputSchema = undefined;
11
+ export interface OutputSchema {
12
+ subject: AppBskyActorRef.WithInfo;
13
+ cursor?: string;
14
+ members: Member[];
15
+ [k: string]: unknown;
16
+ }
17
+ export interface CallOptions {
18
+ headers?: Headers;
19
+ }
20
+ export interface Response {
21
+ success: boolean;
22
+ headers: Headers;
23
+ data: OutputSchema;
24
+ }
25
+ export declare function toKnownErr(e: any): any;
26
+ export interface Member {
27
+ did: string;
28
+ declaration: AppBskySystemDeclRef.Main;
29
+ handle: string;
30
+ displayName?: string;
31
+ createdAt?: string;
32
+ indexedAt: string;
33
+ [k: string]: unknown;
34
+ }
35
+ export declare function isMember(v: unknown): v is Member;
36
+ export declare function validateMember(v: unknown): ValidationResult;
@@ -0,0 +1,36 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ import { ValidationResult } from '@atproto/lexicon';
3
+ import * as AppBskyActorRef from '../actor/ref';
4
+ import * as AppBskySystemDeclRef from '../system/declRef';
5
+ export interface QueryParams {
6
+ actor: string;
7
+ limit?: number;
8
+ before?: string;
9
+ }
10
+ export declare type InputSchema = undefined;
11
+ export interface OutputSchema {
12
+ subject: AppBskyActorRef.WithInfo;
13
+ cursor?: string;
14
+ memberships: Membership[];
15
+ [k: string]: unknown;
16
+ }
17
+ export interface CallOptions {
18
+ headers?: Headers;
19
+ }
20
+ export interface Response {
21
+ success: boolean;
22
+ headers: Headers;
23
+ data: OutputSchema;
24
+ }
25
+ export declare function toKnownErr(e: any): any;
26
+ export interface Membership {
27
+ did: string;
28
+ declaration: AppBskySystemDeclRef.Main;
29
+ handle: string;
30
+ displayName?: string;
31
+ createdAt?: string;
32
+ indexedAt: string;
33
+ [k: string]: unknown;
34
+ }
35
+ export declare function isMembership(v: unknown): v is Membership;
36
+ export declare function validateMembership(v: unknown): ValidationResult;
@@ -0,0 +1,17 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ export interface QueryParams {
3
+ }
4
+ export interface InputSchema {
5
+ seenAt: string;
6
+ [k: string]: unknown;
7
+ }
8
+ export interface CallOptions {
9
+ headers?: Headers;
10
+ qp?: QueryParams;
11
+ encoding: 'application/json';
12
+ }
13
+ export interface Response {
14
+ success: boolean;
15
+ headers: Headers;
16
+ }
17
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1 @@
1
+ export declare const MAIN = "app.bsky.system.actorScene#main";
@@ -4,6 +4,7 @@ export interface QueryParams {
4
4
  repo: string;
5
5
  collection: string;
6
6
  limit?: number;
7
+ cursor?: string;
7
8
  rkeyStart?: string;
8
9
  rkeyEnd?: string;
9
10
  reverse?: boolean;
@@ -0,0 +1,8 @@
1
+ import { ValidationResult } from '@atproto/lexicon';
2
+ export interface Main {
3
+ uri: string;
4
+ cid: string;
5
+ [k: string]: unknown;
6
+ }
7
+ export declare function isMain(v: unknown): v is Main;
8
+ export declare function validateMain(v: unknown): ValidationResult;
@@ -11,6 +11,7 @@ export interface OutputSchema {
11
11
  refreshJwt: string;
12
12
  handle: string;
13
13
  did: string;
14
+ email?: string;
14
15
  [k: string]: unknown;
15
16
  }
16
17
  export interface CallOptions {
@@ -5,6 +5,7 @@ export declare type InputSchema = undefined;
5
5
  export interface OutputSchema {
6
6
  handle: string;
7
7
  did: string;
8
+ email?: string;
8
9
  [k: string]: unknown;
9
10
  }
10
11
  export interface CallOptions {
@@ -0,0 +1,15 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ export interface QueryParams {
3
+ did: string;
4
+ commit?: string;
5
+ }
6
+ export declare type InputSchema = undefined;
7
+ export interface CallOptions {
8
+ headers?: Headers;
9
+ }
10
+ export interface Response {
11
+ success: boolean;
12
+ headers: Headers;
13
+ data: Uint8Array;
14
+ }
15
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,20 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ export interface QueryParams {
3
+ did: string;
4
+ latest?: string;
5
+ earliest?: string;
6
+ }
7
+ export declare type InputSchema = undefined;
8
+ export interface OutputSchema {
9
+ commits: string[];
10
+ [k: string]: unknown;
11
+ }
12
+ export interface CallOptions {
13
+ headers?: Headers;
14
+ }
15
+ export interface Response {
16
+ success: boolean;
17
+ headers: Headers;
18
+ data: OutputSchema;
19
+ }
20
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,18 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ export interface QueryParams {
3
+ did: string;
4
+ }
5
+ export declare type InputSchema = undefined;
6
+ export interface OutputSchema {
7
+ root: string;
8
+ [k: string]: unknown;
9
+ }
10
+ export interface CallOptions {
11
+ headers?: Headers;
12
+ }
13
+ export interface Response {
14
+ success: boolean;
15
+ headers: Headers;
16
+ data: OutputSchema;
17
+ }
18
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,17 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ export interface QueryParams {
3
+ did: string;
4
+ collection: string;
5
+ rkey: string;
6
+ commit?: string;
7
+ }
8
+ export declare type InputSchema = undefined;
9
+ export interface CallOptions {
10
+ headers?: Headers;
11
+ }
12
+ export interface Response {
13
+ success: boolean;
14
+ headers: Headers;
15
+ data: Uint8Array;
16
+ }
17
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,18 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ export interface QueryParams {
3
+ did: string;
4
+ }
5
+ export declare type InputSchema = undefined;
6
+ export interface OutputSchema {
7
+ root: string;
8
+ [k: string]: unknown;
9
+ }
10
+ export interface CallOptions {
11
+ headers?: Headers;
12
+ }
13
+ export interface Response {
14
+ success: boolean;
15
+ headers: Headers;
16
+ data: OutputSchema;
17
+ }
18
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,15 @@
1
+ import { Headers } from '@atproto/xrpc';
2
+ export interface QueryParams {
3
+ did: string;
4
+ }
5
+ export declare type InputSchema = string | Uint8Array;
6
+ export interface CallOptions {
7
+ headers?: Headers;
8
+ qp?: QueryParams;
9
+ encoding: 'application/cbor';
10
+ }
11
+ export interface Response {
12
+ success: boolean;
13
+ headers: Headers;
14
+ }
15
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,2 @@
1
+ export declare function isObj(v: unknown): v is Record<string, unknown>;
2
+ export declare function hasProp<K extends PropertyKey>(data: object, prop: K): data is Record<K, unknown>;
@@ -0,0 +1,20 @@
1
+ import { AtpAgent } from '../agent';
2
+ export declare class Bsky {
3
+ private agent;
4
+ constructor(agent: AtpAgent);
5
+ like(uri: string, cid: string): Promise<{
6
+ uri: string;
7
+ cid: string;
8
+ }>;
9
+ unlike(likeUri: string): Promise<void>;
10
+ repost(uri: string, cid: string): Promise<{
11
+ uri: string;
12
+ cid: string;
13
+ }>;
14
+ unrepost(repostUri: string): Promise<void>;
15
+ follow(subjectDid: string): Promise<{
16
+ uri: string;
17
+ cid: string;
18
+ }>;
19
+ unfollow(followUri: string): Promise<void>;
20
+ }
package/dist/index.js CHANGED
@@ -8506,6 +8506,9 @@ var schemaDict = {
8506
8506
  default: 50,
8507
8507
  description: "The number of records to return."
8508
8508
  },
8509
+ cursor: {
8510
+ type: "string"
8511
+ },
8509
8512
  rkeyStart: {
8510
8513
  type: "string",
8511
8514
  description: "The lowest sort-ordered rkey to start from (exclusive)"
@@ -8831,6 +8834,9 @@ var schemaDict = {
8831
8834
  did: {
8832
8835
  type: "string",
8833
8836
  format: "did"
8837
+ },
8838
+ email: {
8839
+ type: "string"
8834
8840
  }
8835
8841
  }
8836
8842
  }
@@ -8953,6 +8959,9 @@ var schemaDict = {
8953
8959
  did: {
8954
8960
  type: "string",
8955
8961
  format: "did"
8962
+ },
8963
+ email: {
8964
+ type: "string"
8956
8965
  }
8957
8966
  }
8958
8967
  }
@@ -13331,7 +13340,8 @@ var _AtpAgent = class {
13331
13340
  accessJwt: res.data.accessJwt,
13332
13341
  refreshJwt: res.data.refreshJwt,
13333
13342
  handle: res.data.handle,
13334
- did: res.data.did
13343
+ did: res.data.did,
13344
+ email: opts.email
13335
13345
  };
13336
13346
  return res;
13337
13347
  } catch (e) {
@@ -13355,7 +13365,8 @@ var _AtpAgent = class {
13355
13365
  accessJwt: res.data.accessJwt,
13356
13366
  refreshJwt: res.data.refreshJwt,
13357
13367
  handle: res.data.handle,
13358
- did: res.data.did
13368
+ did: res.data.did,
13369
+ email: res.data.email
13359
13370
  };
13360
13371
  return res;
13361
13372
  } catch (e) {
@@ -13376,6 +13387,8 @@ var _AtpAgent = class {
13376
13387
  if (!res.success || res.data.did !== this.session.did) {
13377
13388
  throw new Error("Invalid session");
13378
13389
  }
13390
+ this.session.email = res.data.email;
13391
+ this.session.handle = res.data.handle;
13379
13392
  return res;
13380
13393
  } catch (e) {
13381
13394
  this.session = void 0;