@atproto/pds 0.3.14 → 0.3.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -104,6 +104,7 @@ import * as AppBskyGraphGetListBlocks from './types/app/bsky/graph/getListBlocks
104
104
  import * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes';
105
105
  import * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists';
106
106
  import * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes';
107
+ import * as AppBskyGraphGetRelationships from './types/app/bsky/graph/getRelationships';
107
108
  import * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/getSuggestedFollowsByActor';
108
109
  import * as AppBskyGraphMuteActor from './types/app/bsky/graph/muteActor';
109
110
  import * as AppBskyGraphMuteActorList from './types/app/bsky/graph/muteActorList';
@@ -328,6 +329,7 @@ export declare class AppBskyGraphNS {
328
329
  getListMutes<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphGetListMutes.Handler<ExtractAuth<AV>>, AppBskyGraphGetListMutes.HandlerReqCtx<ExtractAuth<AV>>>): void;
329
330
  getLists<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphGetLists.Handler<ExtractAuth<AV>>, AppBskyGraphGetLists.HandlerReqCtx<ExtractAuth<AV>>>): void;
330
331
  getMutes<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphGetMutes.Handler<ExtractAuth<AV>>, AppBskyGraphGetMutes.HandlerReqCtx<ExtractAuth<AV>>>): void;
332
+ getRelationships<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphGetRelationships.Handler<ExtractAuth<AV>>, AppBskyGraphGetRelationships.HandlerReqCtx<ExtractAuth<AV>>>): void;
331
333
  getSuggestedFollowsByActor<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphGetSuggestedFollowsByActor.Handler<ExtractAuth<AV>>, AppBskyGraphGetSuggestedFollowsByActor.HandlerReqCtx<ExtractAuth<AV>>>): void;
332
334
  muteActor<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphMuteActor.Handler<ExtractAuth<AV>>, AppBskyGraphMuteActor.HandlerReqCtx<ExtractAuth<AV>>>): void;
333
335
  muteActorList<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphMuteActorList.Handler<ExtractAuth<AV>>, AppBskyGraphMuteActorList.HandlerReqCtx<ExtractAuth<AV>>>): void;
@@ -4344,6 +4344,22 @@ export declare const schemaDict: {
4344
4344
  };
4345
4345
  };
4346
4346
  };
4347
+ interestsPref: {
4348
+ type: string;
4349
+ required: string[];
4350
+ properties: {
4351
+ tags: {
4352
+ type: string;
4353
+ maxLength: number;
4354
+ items: {
4355
+ type: string;
4356
+ maxLength: number;
4357
+ maxGraphemes: number;
4358
+ };
4359
+ description: string;
4360
+ };
4361
+ };
4362
+ };
4347
4363
  };
4348
4364
  };
4349
4365
  AppBskyActorGetPreferences: {
@@ -6461,6 +6477,42 @@ export declare const schemaDict: {
6461
6477
  };
6462
6478
  };
6463
6479
  };
6480
+ notFoundActor: {
6481
+ type: string;
6482
+ description: string;
6483
+ required: string[];
6484
+ properties: {
6485
+ actor: {
6486
+ type: string;
6487
+ format: string;
6488
+ };
6489
+ notFound: {
6490
+ type: string;
6491
+ const: boolean;
6492
+ };
6493
+ };
6494
+ };
6495
+ relationship: {
6496
+ type: string;
6497
+ description: string;
6498
+ required: string[];
6499
+ properties: {
6500
+ did: {
6501
+ type: string;
6502
+ format: string;
6503
+ };
6504
+ following: {
6505
+ type: string;
6506
+ format: string;
6507
+ description: string;
6508
+ };
6509
+ followedBy: {
6510
+ type: string;
6511
+ format: string;
6512
+ description: string;
6513
+ };
6514
+ };
6515
+ };
6464
6516
  };
6465
6517
  };
6466
6518
  AppBskyGraphFollow: {
@@ -6864,6 +6916,58 @@ export declare const schemaDict: {
6864
6916
  };
6865
6917
  };
6866
6918
  };
6919
+ AppBskyGraphGetRelationships: {
6920
+ lexicon: number;
6921
+ id: string;
6922
+ defs: {
6923
+ main: {
6924
+ type: string;
6925
+ description: string;
6926
+ parameters: {
6927
+ type: string;
6928
+ required: string[];
6929
+ properties: {
6930
+ actor: {
6931
+ type: string;
6932
+ format: string;
6933
+ };
6934
+ others: {
6935
+ type: string;
6936
+ maxLength: number;
6937
+ items: {
6938
+ type: string;
6939
+ format: string;
6940
+ };
6941
+ };
6942
+ };
6943
+ };
6944
+ output: {
6945
+ encoding: string;
6946
+ schema: {
6947
+ type: string;
6948
+ required: string[];
6949
+ properties: {
6950
+ actor: {
6951
+ type: string;
6952
+ format: string;
6953
+ };
6954
+ relationships: {
6955
+ type: string;
6956
+ items: {
6957
+ type: string;
6958
+ refs: string[];
6959
+ };
6960
+ };
6961
+ };
6962
+ };
6963
+ };
6964
+ errors: {
6965
+ name: string;
6966
+ description: string;
6967
+ }[];
6968
+ };
6969
+ };
6970
+ };
6867
6971
  AppBskyGraphGetSuggestedFollowsByActor: {
6868
6972
  lexicon: number;
6869
6973
  id: string;
@@ -7761,6 +7865,7 @@ export declare const ids: {
7761
7865
  AppBskyGraphGetListMutes: string;
7762
7866
  AppBskyGraphGetLists: string;
7763
7867
  AppBskyGraphGetMutes: string;
7868
+ AppBskyGraphGetRelationships: string;
7764
7869
  AppBskyGraphGetSuggestedFollowsByActor: string;
7765
7870
  AppBskyGraphList: string;
7766
7871
  AppBskyGraphListblock: string;
@@ -54,7 +54,7 @@ export interface ViewerState {
54
54
  }
55
55
  export declare function isViewerState(v: unknown): v is ViewerState;
56
56
  export declare function validateViewerState(v: unknown): ValidationResult;
57
- export type Preferences = (AdultContentPref | ContentLabelPref | SavedFeedsPref | PersonalDetailsPref | FeedViewPref | ThreadViewPref | {
57
+ export type Preferences = (AdultContentPref | ContentLabelPref | SavedFeedsPref | PersonalDetailsPref | FeedViewPref | ThreadViewPref | InterestsPref | {
58
58
  $type: string;
59
59
  [k: string]: unknown;
60
60
  })[];
@@ -102,3 +102,9 @@ export interface ThreadViewPref {
102
102
  }
103
103
  export declare function isThreadViewPref(v: unknown): v is ThreadViewPref;
104
104
  export declare function validateThreadViewPref(v: unknown): ValidationResult;
105
+ export interface InterestsPref {
106
+ tags: string[];
107
+ [k: string]: unknown;
108
+ }
109
+ export declare function isInterestsPref(v: unknown): v is InterestsPref;
110
+ export declare function validateInterestsPref(v: unknown): ValidationResult;
@@ -45,3 +45,18 @@ export interface ListViewerState {
45
45
  }
46
46
  export declare function isListViewerState(v: unknown): v is ListViewerState;
47
47
  export declare function validateListViewerState(v: unknown): ValidationResult;
48
+ export interface NotFoundActor {
49
+ actor: string;
50
+ notFound: true;
51
+ [k: string]: unknown;
52
+ }
53
+ export declare function isNotFoundActor(v: unknown): v is NotFoundActor;
54
+ export declare function validateNotFoundActor(v: unknown): ValidationResult;
55
+ export interface Relationship {
56
+ did: string;
57
+ following?: string;
58
+ followedBy?: string;
59
+ [k: string]: unknown;
60
+ }
61
+ export declare function isRelationship(v: unknown): v is Relationship;
62
+ export declare function validateRelationship(v: unknown): ValidationResult;
@@ -0,0 +1,38 @@
1
+ import express from 'express';
2
+ import { HandlerAuth } from '@atproto/xrpc-server';
3
+ import * as AppBskyGraphDefs from './defs';
4
+ export interface QueryParams {
5
+ actor: string;
6
+ others?: string[];
7
+ }
8
+ export type InputSchema = undefined;
9
+ export interface OutputSchema {
10
+ actor?: string;
11
+ relationships: (AppBskyGraphDefs.Relationship | AppBskyGraphDefs.NotFoundActor | {
12
+ $type: string;
13
+ [k: string]: unknown;
14
+ })[];
15
+ [k: string]: unknown;
16
+ }
17
+ export type HandlerInput = undefined;
18
+ export interface HandlerSuccess {
19
+ encoding: 'application/json';
20
+ body: OutputSchema;
21
+ headers?: {
22
+ [key: string]: string;
23
+ };
24
+ }
25
+ export interface HandlerError {
26
+ status: number;
27
+ message?: string;
28
+ error?: 'ActorNotFound';
29
+ }
30
+ export type HandlerOutput = HandlerError | HandlerSuccess;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/pds",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of atproto Personal Data Server (PDS)",
6
6
  "keywords": [
@@ -44,7 +44,7 @@
44
44
  "typed-emitter": "^2.1.0",
45
45
  "uint8arrays": "3.0.0",
46
46
  "zod": "^3.21.4",
47
- "@atproto/api": "^0.9.3",
47
+ "@atproto/api": "^0.9.4",
48
48
  "@atproto/aws": "^0.1.6",
49
49
  "@atproto/common": "^0.3.3",
50
50
  "@atproto/crypto": "^0.3.0",
@@ -68,9 +68,9 @@
68
68
  "axios": "^0.27.2",
69
69
  "get-port": "^6.1.2",
70
70
  "ws": "^8.12.0",
71
- "@atproto/api": "^0.9.3",
72
- "@atproto/bsky": "^0.0.26",
73
- "@atproto/dev-env": "^0.2.26",
71
+ "@atproto/api": "^0.9.4",
72
+ "@atproto/bsky": "^0.0.27",
73
+ "@atproto/dev-env": "^0.2.27",
74
74
  "@atproto/lex-cli": "^0.3.0"
75
75
  },
76
76
  "scripts": {
@@ -114,6 +114,7 @@ import * as AppBskyGraphGetListBlocks from './types/app/bsky/graph/getListBlocks
114
114
  import * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes'
115
115
  import * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists'
116
116
  import * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes'
117
+ import * as AppBskyGraphGetRelationships from './types/app/bsky/graph/getRelationships'
117
118
  import * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/getSuggestedFollowsByActor'
118
119
  import * as AppBskyGraphMuteActor from './types/app/bsky/graph/muteActor'
119
120
  import * as AppBskyGraphMuteActorList from './types/app/bsky/graph/muteActorList'
@@ -1480,6 +1481,17 @@ export class AppBskyGraphNS {
1480
1481
  return this._server.xrpc.method(nsid, cfg)
1481
1482
  }
1482
1483
 
1484
+ getRelationships<AV extends AuthVerifier>(
1485
+ cfg: ConfigOf<
1486
+ AV,
1487
+ AppBskyGraphGetRelationships.Handler<ExtractAuth<AV>>,
1488
+ AppBskyGraphGetRelationships.HandlerReqCtx<ExtractAuth<AV>>
1489
+ >,
1490
+ ) {
1491
+ const nsid = 'app.bsky.graph.getRelationships' // @ts-ignore
1492
+ return this._server.xrpc.method(nsid, cfg)
1493
+ }
1494
+
1483
1495
  getSuggestedFollowsByActor<AV extends AuthVerifier>(
1484
1496
  cfg: ConfigOf<
1485
1497
  AV,
@@ -4615,6 +4615,7 @@ export const schemaDict = {
4615
4615
  'lex:app.bsky.actor.defs#personalDetailsPref',
4616
4616
  'lex:app.bsky.actor.defs#feedViewPref',
4617
4617
  'lex:app.bsky.actor.defs#threadViewPref',
4618
+ 'lex:app.bsky.actor.defs#interestsPref',
4618
4619
  ],
4619
4620
  },
4620
4621
  },
@@ -4718,6 +4719,23 @@ export const schemaDict = {
4718
4719
  },
4719
4720
  },
4720
4721
  },
4722
+ interestsPref: {
4723
+ type: 'object',
4724
+ required: ['tags'],
4725
+ properties: {
4726
+ tags: {
4727
+ type: 'array',
4728
+ maxLength: 100,
4729
+ items: {
4730
+ type: 'string',
4731
+ maxLength: 640,
4732
+ maxGraphemes: 64,
4733
+ },
4734
+ description:
4735
+ "A list of tags which describe the account owner's interests gathered during onboarding.",
4736
+ },
4737
+ },
4738
+ },
4721
4739
  },
4722
4740
  },
4723
4741
  AppBskyActorGetPreferences: {
@@ -6925,6 +6943,45 @@ export const schemaDict = {
6925
6943
  },
6926
6944
  },
6927
6945
  },
6946
+ notFoundActor: {
6947
+ type: 'object',
6948
+ description: 'indicates that a handle or DID could not be resolved',
6949
+ required: ['actor', 'notFound'],
6950
+ properties: {
6951
+ actor: {
6952
+ type: 'string',
6953
+ format: 'at-identifier',
6954
+ },
6955
+ notFound: {
6956
+ type: 'boolean',
6957
+ const: true,
6958
+ },
6959
+ },
6960
+ },
6961
+ relationship: {
6962
+ type: 'object',
6963
+ description:
6964
+ 'lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object)',
6965
+ required: ['did'],
6966
+ properties: {
6967
+ did: {
6968
+ type: 'string',
6969
+ format: 'did',
6970
+ },
6971
+ following: {
6972
+ type: 'string',
6973
+ format: 'at-uri',
6974
+ description:
6975
+ 'if the actor follows this DID, this is the AT-URI of the follow record',
6976
+ },
6977
+ followedBy: {
6978
+ type: 'string',
6979
+ format: 'at-uri',
6980
+ description:
6981
+ 'if the actor is followed by this DID, contains the AT-URI of the follow record',
6982
+ },
6983
+ },
6984
+ },
6928
6985
  },
6929
6986
  },
6930
6987
  AppBskyGraphFollow: {
@@ -7328,6 +7385,65 @@ export const schemaDict = {
7328
7385
  },
7329
7386
  },
7330
7387
  },
7388
+ AppBskyGraphGetRelationships: {
7389
+ lexicon: 1,
7390
+ id: 'app.bsky.graph.getRelationships',
7391
+ defs: {
7392
+ main: {
7393
+ type: 'query',
7394
+ description:
7395
+ 'Enumerates public relationships between one account, and a list of other accounts',
7396
+ parameters: {
7397
+ type: 'params',
7398
+ required: ['actor'],
7399
+ properties: {
7400
+ actor: {
7401
+ type: 'string',
7402
+ format: 'at-identifier',
7403
+ },
7404
+ others: {
7405
+ type: 'array',
7406
+ maxLength: 30,
7407
+ items: {
7408
+ type: 'string',
7409
+ format: 'at-identifier',
7410
+ },
7411
+ },
7412
+ },
7413
+ },
7414
+ output: {
7415
+ encoding: 'application/json',
7416
+ schema: {
7417
+ type: 'object',
7418
+ required: ['relationships'],
7419
+ properties: {
7420
+ actor: {
7421
+ type: 'string',
7422
+ format: 'did',
7423
+ },
7424
+ relationships: {
7425
+ type: 'array',
7426
+ items: {
7427
+ type: 'union',
7428
+ refs: [
7429
+ 'lex:app.bsky.graph.defs#relationship',
7430
+ 'lex:app.bsky.graph.defs#notFoundActor',
7431
+ ],
7432
+ },
7433
+ },
7434
+ },
7435
+ },
7436
+ },
7437
+ errors: [
7438
+ {
7439
+ name: 'ActorNotFound',
7440
+ description:
7441
+ 'the primary actor at-identifier could not be resolved',
7442
+ },
7443
+ ],
7444
+ },
7445
+ },
7446
+ },
7331
7447
  AppBskyGraphGetSuggestedFollowsByActor: {
7332
7448
  lexicon: 1,
7333
7449
  id: 'app.bsky.graph.getSuggestedFollowsByActor',
@@ -8272,6 +8388,7 @@ export const ids = {
8272
8388
  AppBskyGraphGetListMutes: 'app.bsky.graph.getListMutes',
8273
8389
  AppBskyGraphGetLists: 'app.bsky.graph.getLists',
8274
8390
  AppBskyGraphGetMutes: 'app.bsky.graph.getMutes',
8391
+ AppBskyGraphGetRelationships: 'app.bsky.graph.getRelationships',
8275
8392
  AppBskyGraphGetSuggestedFollowsByActor:
8276
8393
  'app.bsky.graph.getSuggestedFollowsByActor',
8277
8394
  AppBskyGraphList: 'app.bsky.graph.list',
@@ -112,6 +112,7 @@ export type Preferences = (
112
112
  | PersonalDetailsPref
113
113
  | FeedViewPref
114
114
  | ThreadViewPref
115
+ | InterestsPref
115
116
  | { $type: string; [k: string]: unknown }
116
117
  )[]
117
118
 
@@ -233,3 +234,21 @@ export function isThreadViewPref(v: unknown): v is ThreadViewPref {
233
234
  export function validateThreadViewPref(v: unknown): ValidationResult {
234
235
  return lexicons.validate('app.bsky.actor.defs#threadViewPref', v)
235
236
  }
237
+
238
+ export interface InterestsPref {
239
+ /** A list of tags which describe the account owner's interests gathered during onboarding. */
240
+ tags: string[]
241
+ [k: string]: unknown
242
+ }
243
+
244
+ export function isInterestsPref(v: unknown): v is InterestsPref {
245
+ return (
246
+ isObj(v) &&
247
+ hasProp(v, '$type') &&
248
+ v.$type === 'app.bsky.actor.defs#interestsPref'
249
+ )
250
+ }
251
+
252
+ export function validateInterestsPref(v: unknown): ValidationResult {
253
+ return lexicons.validate('app.bsky.actor.defs#interestsPref', v)
254
+ }
@@ -102,3 +102,44 @@ export function isListViewerState(v: unknown): v is ListViewerState {
102
102
  export function validateListViewerState(v: unknown): ValidationResult {
103
103
  return lexicons.validate('app.bsky.graph.defs#listViewerState', v)
104
104
  }
105
+
106
+ /** indicates that a handle or DID could not be resolved */
107
+ export interface NotFoundActor {
108
+ actor: string
109
+ notFound: true
110
+ [k: string]: unknown
111
+ }
112
+
113
+ export function isNotFoundActor(v: unknown): v is NotFoundActor {
114
+ return (
115
+ isObj(v) &&
116
+ hasProp(v, '$type') &&
117
+ v.$type === 'app.bsky.graph.defs#notFoundActor'
118
+ )
119
+ }
120
+
121
+ export function validateNotFoundActor(v: unknown): ValidationResult {
122
+ return lexicons.validate('app.bsky.graph.defs#notFoundActor', v)
123
+ }
124
+
125
+ /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */
126
+ export interface Relationship {
127
+ did: string
128
+ /** if the actor follows this DID, this is the AT-URI of the follow record */
129
+ following?: string
130
+ /** if the actor is followed by this DID, contains the AT-URI of the follow record */
131
+ followedBy?: string
132
+ [k: string]: unknown
133
+ }
134
+
135
+ export function isRelationship(v: unknown): v is Relationship {
136
+ return (
137
+ isObj(v) &&
138
+ hasProp(v, '$type') &&
139
+ v.$type === 'app.bsky.graph.defs#relationship'
140
+ )
141
+ }
142
+
143
+ export function validateRelationship(v: unknown): ValidationResult {
144
+ return lexicons.validate('app.bsky.graph.defs#relationship', v)
145
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import express from 'express'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
+ import { lexicons } from '../../../../lexicons'
7
+ import { isObj, hasProp } from '../../../../util'
8
+ import { CID } from 'multiformats/cid'
9
+ import { HandlerAuth } from '@atproto/xrpc-server'
10
+ import * as AppBskyGraphDefs from './defs'
11
+
12
+ export interface QueryParams {
13
+ actor: string
14
+ others?: string[]
15
+ }
16
+
17
+ export type InputSchema = undefined
18
+
19
+ export interface OutputSchema {
20
+ actor?: string
21
+ relationships: (
22
+ | AppBskyGraphDefs.Relationship
23
+ | AppBskyGraphDefs.NotFoundActor
24
+ | { $type: string; [k: string]: unknown }
25
+ )[]
26
+ [k: string]: unknown
27
+ }
28
+
29
+ export type HandlerInput = undefined
30
+
31
+ export interface HandlerSuccess {
32
+ encoding: 'application/json'
33
+ body: OutputSchema
34
+ headers?: { [key: string]: string }
35
+ }
36
+
37
+ export interface HandlerError {
38
+ status: number
39
+ message?: string
40
+ error?: 'ActorNotFound'
41
+ }
42
+
43
+ export type HandlerOutput = HandlerError | HandlerSuccess
44
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
45
+ auth: HA
46
+ params: QueryParams
47
+ input: HandlerInput
48
+ req: express.Request
49
+ res: express.Response
50
+ }
51
+ export type Handler<HA extends HandlerAuth = never> = (
52
+ ctx: HandlerReqCtx<HA>,
53
+ ) => Promise<HandlerOutput> | HandlerOutput