@atproto/api 0.2.1 → 0.2.2

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 (30) hide show
  1. package/dist/client/lexicons.d.ts +0 -7
  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/strongRef.d.ts +8 -0
  12. package/dist/client/types/com/atproto/sync/getCheckout.d.ts +15 -0
  13. package/dist/client/types/com/atproto/sync/getCommitPath.d.ts +20 -0
  14. package/dist/client/types/com/atproto/sync/getHead.d.ts +18 -0
  15. package/dist/client/types/com/atproto/sync/getRecord.d.ts +17 -0
  16. package/dist/client/types/com/atproto/sync/getRoot.d.ts +18 -0
  17. package/dist/client/types/com/atproto/sync/updateRepo.d.ts +15 -0
  18. package/dist/client/util.d.ts +2 -0
  19. package/dist/helpers/bsky.d.ts +20 -0
  20. package/dist/index.js +12 -16
  21. package/dist/index.js.map +2 -2
  22. package/dist/mixins/bsky.d.ts +23 -0
  23. package/dist/rich-text/sanitize.d.ts +4 -0
  24. package/package.json +1 -1
  25. package/src/client/lexicons.ts +10 -14
  26. package/src/client/types/com/atproto/server/getSession.ts +1 -0
  27. package/tests/agent.test.ts +5 -1
  28. package/tsconfig.build.tsbuildinfo +1 -1
  29. package/dist/client/types/app/bsky/embed/complexRecord.d.ts +0 -24
  30. package/dist/client/types/app/bsky/embed/post.d.ts +0 -33
@@ -2334,7 +2334,6 @@ export declare const schemaDict: {
2334
2334
  };
2335
2335
  displayName: {
2336
2336
  type: string;
2337
- maxGraphemes: number;
2338
2337
  maxLength: number;
2339
2338
  };
2340
2339
  avatar: {
@@ -2360,12 +2359,10 @@ export declare const schemaDict: {
2360
2359
  };
2361
2360
  displayName: {
2362
2361
  type: string;
2363
- maxGraphemes: number;
2364
2362
  maxLength: number;
2365
2363
  };
2366
2364
  description: {
2367
2365
  type: string;
2368
- maxGraphemes: number;
2369
2366
  maxLength: number;
2370
2367
  };
2371
2368
  avatar: {
@@ -2395,12 +2392,10 @@ export declare const schemaDict: {
2395
2392
  };
2396
2393
  displayName: {
2397
2394
  type: string;
2398
- maxGraphemes: number;
2399
2395
  maxLength: number;
2400
2396
  };
2401
2397
  description: {
2402
2398
  type: string;
2403
- maxGraphemes: number;
2404
2399
  maxLength: number;
2405
2400
  };
2406
2401
  avatar: {
@@ -2566,12 +2561,10 @@ export declare const schemaDict: {
2566
2561
  properties: {
2567
2562
  displayName: {
2568
2563
  type: string;
2569
- maxGraphemes: number;
2570
2564
  maxLength: number;
2571
2565
  };
2572
2566
  description: {
2573
2567
  type: string;
2574
- maxGraphemes: number;
2575
2568
  maxLength: number;
2576
2569
  };
2577
2570
  avatar: {
@@ -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";
@@ -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;
@@ -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
@@ -6866,8 +6866,11 @@ function getMethodSchemaHTTPMethod(schema2) {
6866
6866
  return "get";
6867
6867
  }
6868
6868
  function constructMethodCallUri(nsid2, schema2, serviceUri, params2) {
6869
- const uri2 = new URL(serviceUri);
6870
- uri2.pathname = `/xrpc/${nsid2}`;
6869
+ let origin = serviceUri.toString();
6870
+ if (!origin.endsWith("/")) {
6871
+ origin += "/";
6872
+ }
6873
+ const uri2 = new URL(`${origin}xrpc/${nsid2}`);
6871
6874
  if (params2) {
6872
6875
  for (const [key, value] of Object.entries(params2)) {
6873
6876
  const paramSchema = schema2.parameters?.properties?.[key];
@@ -9594,8 +9597,7 @@ var schemaDict = {
9594
9597
  },
9595
9598
  displayName: {
9596
9599
  type: "string",
9597
- maxGraphemes: 64,
9598
- maxLength: 640
9600
+ maxLength: 64
9599
9601
  },
9600
9602
  avatar: {
9601
9603
  type: "string"
@@ -9620,13 +9622,11 @@ var schemaDict = {
9620
9622
  },
9621
9623
  displayName: {
9622
9624
  type: "string",
9623
- maxGraphemes: 64,
9624
- maxLength: 640
9625
+ maxLength: 64
9625
9626
  },
9626
9627
  description: {
9627
9628
  type: "string",
9628
- maxGraphemes: 256,
9629
- maxLength: 2560
9629
+ maxLength: 256
9630
9630
  },
9631
9631
  avatar: {
9632
9632
  type: "string"
@@ -9655,13 +9655,11 @@ var schemaDict = {
9655
9655
  },
9656
9656
  displayName: {
9657
9657
  type: "string",
9658
- maxGraphemes: 64,
9659
- maxLength: 640
9658
+ maxLength: 64
9660
9659
  },
9661
9660
  description: {
9662
9661
  type: "string",
9663
- maxGraphemes: 256,
9664
- maxLength: 2560
9662
+ maxLength: 256
9665
9663
  },
9666
9664
  avatar: {
9667
9665
  type: "string"
@@ -9826,13 +9824,11 @@ var schemaDict = {
9826
9824
  properties: {
9827
9825
  displayName: {
9828
9826
  type: "string",
9829
- maxGraphemes: 64,
9830
- maxLength: 640
9827
+ maxLength: 64
9831
9828
  },
9832
9829
  description: {
9833
9830
  type: "string",
9834
- maxGraphemes: 256,
9835
- maxLength: 2560
9831
+ maxLength: 256
9836
9832
  },
9837
9833
  avatar: {
9838
9834
  type: "blob",