@atproto/bsky 0.0.26 → 0.0.28
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.
- package/CHANGELOG.md +14 -0
- package/dist/api/app/bsky/graph/getRelationships.d.ts +3 -0
- package/dist/index.js +503 -135
- package/dist/index.js.map +3 -3
- package/dist/lexicon/index.d.ts +4 -0
- package/dist/lexicon/lexicons.d.ts +134 -0
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +7 -1
- package/dist/lexicon/types/app/bsky/graph/defs.d.ts +15 -0
- package/dist/lexicon/types/app/bsky/graph/getRelationships.d.ts +38 -0
- package/dist/lexicon/types/com/atproto/temp/checkSignupQueue.d.ts +32 -0
- package/package.json +6 -6
- package/src/api/app/bsky/graph/getRelationships.ts +71 -0
- package/src/api/index.ts +2 -0
- package/src/lexicon/index.ts +24 -0
- package/src/lexicon/lexicons.ts +146 -0
- package/src/lexicon/types/app/bsky/actor/defs.ts +19 -0
- package/src/lexicon/types/app/bsky/graph/defs.ts +41 -0
- package/src/lexicon/types/app/bsky/graph/getRelationships.ts +53 -0
- package/src/lexicon/types/com/atproto/temp/checkSignupQueue.ts +45 -0
- package/tests/views/__snapshots__/follows.test.ts.snap +28 -0
- package/tests/views/follows.test.ts +10 -0
package/dist/lexicon/index.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos';
|
|
|
68
68
|
import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate';
|
|
69
69
|
import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl';
|
|
70
70
|
import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos';
|
|
71
|
+
import * as ComAtprotoTempCheckSignupQueue from './types/com/atproto/temp/checkSignupQueue';
|
|
71
72
|
import * as ComAtprotoTempFetchLabels from './types/com/atproto/temp/fetchLabels';
|
|
72
73
|
import * as ComAtprotoTempImportRepo from './types/com/atproto/temp/importRepo';
|
|
73
74
|
import * as ComAtprotoTempPushBlob from './types/com/atproto/temp/pushBlob';
|
|
@@ -104,6 +105,7 @@ import * as AppBskyGraphGetListBlocks from './types/app/bsky/graph/getListBlocks
|
|
|
104
105
|
import * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes';
|
|
105
106
|
import * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists';
|
|
106
107
|
import * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes';
|
|
108
|
+
import * as AppBskyGraphGetRelationships from './types/app/bsky/graph/getRelationships';
|
|
107
109
|
import * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/getSuggestedFollowsByActor';
|
|
108
110
|
import * as AppBskyGraphMuteActor from './types/app/bsky/graph/muteActor';
|
|
109
111
|
import * as AppBskyGraphMuteActorList from './types/app/bsky/graph/muteActorList';
|
|
@@ -260,6 +262,7 @@ export declare class ComAtprotoSyncNS {
|
|
|
260
262
|
export declare class ComAtprotoTempNS {
|
|
261
263
|
_server: Server;
|
|
262
264
|
constructor(server: Server);
|
|
265
|
+
checkSignupQueue<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoTempCheckSignupQueue.Handler<ExtractAuth<AV>>, ComAtprotoTempCheckSignupQueue.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
263
266
|
fetchLabels<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoTempFetchLabels.Handler<ExtractAuth<AV>>, ComAtprotoTempFetchLabels.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
264
267
|
importRepo<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoTempImportRepo.Handler<ExtractAuth<AV>>, ComAtprotoTempImportRepo.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
265
268
|
pushBlob<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoTempPushBlob.Handler<ExtractAuth<AV>>, ComAtprotoTempPushBlob.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
@@ -328,6 +331,7 @@ export declare class AppBskyGraphNS {
|
|
|
328
331
|
getListMutes<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphGetListMutes.Handler<ExtractAuth<AV>>, AppBskyGraphGetListMutes.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
329
332
|
getLists<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphGetLists.Handler<ExtractAuth<AV>>, AppBskyGraphGetLists.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
330
333
|
getMutes<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphGetMutes.Handler<ExtractAuth<AV>>, AppBskyGraphGetMutes.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
334
|
+
getRelationships<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphGetRelationships.Handler<ExtractAuth<AV>>, AppBskyGraphGetRelationships.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
331
335
|
getSuggestedFollowsByActor<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphGetSuggestedFollowsByActor.Handler<ExtractAuth<AV>>, AppBskyGraphGetSuggestedFollowsByActor.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
332
336
|
muteActor<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphMuteActor.Handler<ExtractAuth<AV>>, AppBskyGraphMuteActor.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
333
337
|
muteActorList<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyGraphMuteActorList.Handler<ExtractAuth<AV>>, AppBskyGraphMuteActorList.HandlerReqCtx<ExtractAuth<AV>>>): void;
|
|
@@ -3906,6 +3906,34 @@ export declare const schemaDict: {
|
|
|
3906
3906
|
};
|
|
3907
3907
|
};
|
|
3908
3908
|
};
|
|
3909
|
+
ComAtprotoTempCheckSignupQueue: {
|
|
3910
|
+
lexicon: number;
|
|
3911
|
+
id: string;
|
|
3912
|
+
defs: {
|
|
3913
|
+
main: {
|
|
3914
|
+
type: string;
|
|
3915
|
+
description: string;
|
|
3916
|
+
output: {
|
|
3917
|
+
encoding: string;
|
|
3918
|
+
schema: {
|
|
3919
|
+
type: string;
|
|
3920
|
+
required: string[];
|
|
3921
|
+
properties: {
|
|
3922
|
+
activated: {
|
|
3923
|
+
type: string;
|
|
3924
|
+
};
|
|
3925
|
+
placeInQueue: {
|
|
3926
|
+
type: string;
|
|
3927
|
+
};
|
|
3928
|
+
estimatedTimeMs: {
|
|
3929
|
+
type: string;
|
|
3930
|
+
};
|
|
3931
|
+
};
|
|
3932
|
+
};
|
|
3933
|
+
};
|
|
3934
|
+
};
|
|
3935
|
+
};
|
|
3936
|
+
};
|
|
3909
3937
|
ComAtprotoTempFetchLabels: {
|
|
3910
3938
|
lexicon: number;
|
|
3911
3939
|
id: string;
|
|
@@ -4344,6 +4372,22 @@ export declare const schemaDict: {
|
|
|
4344
4372
|
};
|
|
4345
4373
|
};
|
|
4346
4374
|
};
|
|
4375
|
+
interestsPref: {
|
|
4376
|
+
type: string;
|
|
4377
|
+
required: string[];
|
|
4378
|
+
properties: {
|
|
4379
|
+
tags: {
|
|
4380
|
+
type: string;
|
|
4381
|
+
maxLength: number;
|
|
4382
|
+
items: {
|
|
4383
|
+
type: string;
|
|
4384
|
+
maxLength: number;
|
|
4385
|
+
maxGraphemes: number;
|
|
4386
|
+
};
|
|
4387
|
+
description: string;
|
|
4388
|
+
};
|
|
4389
|
+
};
|
|
4390
|
+
};
|
|
4347
4391
|
};
|
|
4348
4392
|
};
|
|
4349
4393
|
AppBskyActorGetPreferences: {
|
|
@@ -6461,6 +6505,42 @@ export declare const schemaDict: {
|
|
|
6461
6505
|
};
|
|
6462
6506
|
};
|
|
6463
6507
|
};
|
|
6508
|
+
notFoundActor: {
|
|
6509
|
+
type: string;
|
|
6510
|
+
description: string;
|
|
6511
|
+
required: string[];
|
|
6512
|
+
properties: {
|
|
6513
|
+
actor: {
|
|
6514
|
+
type: string;
|
|
6515
|
+
format: string;
|
|
6516
|
+
};
|
|
6517
|
+
notFound: {
|
|
6518
|
+
type: string;
|
|
6519
|
+
const: boolean;
|
|
6520
|
+
};
|
|
6521
|
+
};
|
|
6522
|
+
};
|
|
6523
|
+
relationship: {
|
|
6524
|
+
type: string;
|
|
6525
|
+
description: string;
|
|
6526
|
+
required: string[];
|
|
6527
|
+
properties: {
|
|
6528
|
+
did: {
|
|
6529
|
+
type: string;
|
|
6530
|
+
format: string;
|
|
6531
|
+
};
|
|
6532
|
+
following: {
|
|
6533
|
+
type: string;
|
|
6534
|
+
format: string;
|
|
6535
|
+
description: string;
|
|
6536
|
+
};
|
|
6537
|
+
followedBy: {
|
|
6538
|
+
type: string;
|
|
6539
|
+
format: string;
|
|
6540
|
+
description: string;
|
|
6541
|
+
};
|
|
6542
|
+
};
|
|
6543
|
+
};
|
|
6464
6544
|
};
|
|
6465
6545
|
};
|
|
6466
6546
|
AppBskyGraphFollow: {
|
|
@@ -6864,6 +6944,58 @@ export declare const schemaDict: {
|
|
|
6864
6944
|
};
|
|
6865
6945
|
};
|
|
6866
6946
|
};
|
|
6947
|
+
AppBskyGraphGetRelationships: {
|
|
6948
|
+
lexicon: number;
|
|
6949
|
+
id: string;
|
|
6950
|
+
defs: {
|
|
6951
|
+
main: {
|
|
6952
|
+
type: string;
|
|
6953
|
+
description: string;
|
|
6954
|
+
parameters: {
|
|
6955
|
+
type: string;
|
|
6956
|
+
required: string[];
|
|
6957
|
+
properties: {
|
|
6958
|
+
actor: {
|
|
6959
|
+
type: string;
|
|
6960
|
+
format: string;
|
|
6961
|
+
};
|
|
6962
|
+
others: {
|
|
6963
|
+
type: string;
|
|
6964
|
+
maxLength: number;
|
|
6965
|
+
items: {
|
|
6966
|
+
type: string;
|
|
6967
|
+
format: string;
|
|
6968
|
+
};
|
|
6969
|
+
};
|
|
6970
|
+
};
|
|
6971
|
+
};
|
|
6972
|
+
output: {
|
|
6973
|
+
encoding: string;
|
|
6974
|
+
schema: {
|
|
6975
|
+
type: string;
|
|
6976
|
+
required: string[];
|
|
6977
|
+
properties: {
|
|
6978
|
+
actor: {
|
|
6979
|
+
type: string;
|
|
6980
|
+
format: string;
|
|
6981
|
+
};
|
|
6982
|
+
relationships: {
|
|
6983
|
+
type: string;
|
|
6984
|
+
items: {
|
|
6985
|
+
type: string;
|
|
6986
|
+
refs: string[];
|
|
6987
|
+
};
|
|
6988
|
+
};
|
|
6989
|
+
};
|
|
6990
|
+
};
|
|
6991
|
+
};
|
|
6992
|
+
errors: {
|
|
6993
|
+
name: string;
|
|
6994
|
+
description: string;
|
|
6995
|
+
}[];
|
|
6996
|
+
};
|
|
6997
|
+
};
|
|
6998
|
+
};
|
|
6867
6999
|
AppBskyGraphGetSuggestedFollowsByActor: {
|
|
6868
7000
|
lexicon: number;
|
|
6869
7001
|
id: string;
|
|
@@ -7710,6 +7842,7 @@ export declare const ids: {
|
|
|
7710
7842
|
ComAtprotoSyncNotifyOfUpdate: string;
|
|
7711
7843
|
ComAtprotoSyncRequestCrawl: string;
|
|
7712
7844
|
ComAtprotoSyncSubscribeRepos: string;
|
|
7845
|
+
ComAtprotoTempCheckSignupQueue: string;
|
|
7713
7846
|
ComAtprotoTempFetchLabels: string;
|
|
7714
7847
|
ComAtprotoTempImportRepo: string;
|
|
7715
7848
|
ComAtprotoTempPushBlob: string;
|
|
@@ -7761,6 +7894,7 @@ export declare const ids: {
|
|
|
7761
7894
|
AppBskyGraphGetListMutes: string;
|
|
7762
7895
|
AppBskyGraphGetLists: string;
|
|
7763
7896
|
AppBskyGraphGetMutes: string;
|
|
7897
|
+
AppBskyGraphGetRelationships: string;
|
|
7764
7898
|
AppBskyGraphGetSuggestedFollowsByActor: string;
|
|
7765
7899
|
AppBskyGraphList: string;
|
|
7766
7900
|
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;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
3
|
+
export interface QueryParams {
|
|
4
|
+
}
|
|
5
|
+
export type InputSchema = undefined;
|
|
6
|
+
export interface OutputSchema {
|
|
7
|
+
activated: boolean;
|
|
8
|
+
placeInQueue?: number;
|
|
9
|
+
estimatedTimeMs?: number;
|
|
10
|
+
[k: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
export type HandlerInput = undefined;
|
|
13
|
+
export interface HandlerSuccess {
|
|
14
|
+
encoding: 'application/json';
|
|
15
|
+
body: OutputSchema;
|
|
16
|
+
headers?: {
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface HandlerError {
|
|
21
|
+
status: number;
|
|
22
|
+
message?: string;
|
|
23
|
+
}
|
|
24
|
+
export type HandlerOutput = HandlerError | HandlerSuccess;
|
|
25
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
26
|
+
auth: HA;
|
|
27
|
+
params: QueryParams;
|
|
28
|
+
input: HandlerInput;
|
|
29
|
+
req: express.Request;
|
|
30
|
+
res: express.Response;
|
|
31
|
+
};
|
|
32
|
+
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/bsky",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Reference implementation of app.bsky App View (Bluesky API)",
|
|
6
6
|
"keywords": [
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"sharp": "^0.32.6",
|
|
40
40
|
"typed-emitter": "^2.1.0",
|
|
41
41
|
"uint8arrays": "3.0.0",
|
|
42
|
-
"@atproto/api": "^0.9.
|
|
42
|
+
"@atproto/api": "^0.9.5",
|
|
43
43
|
"@atproto/common": "^0.3.3",
|
|
44
44
|
"@atproto/crypto": "^0.3.0",
|
|
45
|
-
"@atproto/identity": "^0.3.2",
|
|
46
45
|
"@atproto/lexicon": "^0.3.1",
|
|
46
|
+
"@atproto/identity": "^0.3.2",
|
|
47
47
|
"@atproto/repo": "^0.3.6",
|
|
48
48
|
"@atproto/syntax": "^0.1.5",
|
|
49
49
|
"@atproto/xrpc-server": "^0.4.2"
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"@types/pg": "^8.6.6",
|
|
60
60
|
"@types/qs": "^6.9.7",
|
|
61
61
|
"axios": "^0.27.2",
|
|
62
|
-
"@atproto/api": "^0.9.
|
|
63
|
-
"@atproto/dev-env": "^0.2.
|
|
62
|
+
"@atproto/api": "^0.9.5",
|
|
63
|
+
"@atproto/dev-env": "^0.2.28",
|
|
64
64
|
"@atproto/lex-cli": "^0.3.0",
|
|
65
|
-
"@atproto/pds": "^0.3.
|
|
65
|
+
"@atproto/pds": "^0.3.16",
|
|
66
66
|
"@atproto/xrpc": "^0.4.1"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Server } from '../../../../lexicon'
|
|
2
|
+
import AppContext from '../../../../context'
|
|
3
|
+
import { Relationship } from '../../../../lexicon/types/app/bsky/graph/defs'
|
|
4
|
+
|
|
5
|
+
export default function (server: Server, ctx: AppContext) {
|
|
6
|
+
server.app.bsky.graph.getRelationships({
|
|
7
|
+
handler: async ({ params }) => {
|
|
8
|
+
const { actor, others = [] } = params
|
|
9
|
+
if (others.length < 1) {
|
|
10
|
+
return {
|
|
11
|
+
encoding: 'application/json',
|
|
12
|
+
body: {
|
|
13
|
+
actor,
|
|
14
|
+
relationships: [],
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const db = ctx.db.getPrimary()
|
|
19
|
+
const { ref } = db.db.dynamic
|
|
20
|
+
const res = await db.db
|
|
21
|
+
.selectFrom('actor')
|
|
22
|
+
.select([
|
|
23
|
+
'actor.did',
|
|
24
|
+
db.db
|
|
25
|
+
.selectFrom('follow')
|
|
26
|
+
.where('creator', '=', actor)
|
|
27
|
+
.whereRef('subjectDid', '=', ref('actor.did'))
|
|
28
|
+
.select('uri')
|
|
29
|
+
.as('following'),
|
|
30
|
+
db.db
|
|
31
|
+
.selectFrom('follow')
|
|
32
|
+
.whereRef('creator', '=', ref('actor.did'))
|
|
33
|
+
.where('subjectDid', '=', actor)
|
|
34
|
+
.select('uri')
|
|
35
|
+
.as('followedBy'),
|
|
36
|
+
])
|
|
37
|
+
.where('actor.did', 'in', others)
|
|
38
|
+
.execute()
|
|
39
|
+
|
|
40
|
+
const relationshipsMap = res.reduce((acc, cur) => {
|
|
41
|
+
return acc.set(cur.did, {
|
|
42
|
+
did: cur.did,
|
|
43
|
+
following: cur.following ?? undefined,
|
|
44
|
+
followedBy: cur.followedBy ?? undefined,
|
|
45
|
+
})
|
|
46
|
+
}, new Map<string, Relationship>())
|
|
47
|
+
|
|
48
|
+
const relationships = others.map((did) => {
|
|
49
|
+
const relationship = relationshipsMap.get(did)
|
|
50
|
+
return relationship
|
|
51
|
+
? {
|
|
52
|
+
$type: 'app.bsky.graph.defs#relationship',
|
|
53
|
+
...relationship,
|
|
54
|
+
}
|
|
55
|
+
: {
|
|
56
|
+
$type: 'app.bsky.graph.defs#notFoundActor',
|
|
57
|
+
actor: did,
|
|
58
|
+
notFound: true,
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
encoding: 'application/json',
|
|
64
|
+
body: {
|
|
65
|
+
actor,
|
|
66
|
+
relationships,
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
}
|
package/src/api/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ import getList from './app/bsky/graph/getList'
|
|
|
26
26
|
import getLists from './app/bsky/graph/getLists'
|
|
27
27
|
import getListMutes from './app/bsky/graph/getListMutes'
|
|
28
28
|
import getMutes from './app/bsky/graph/getMutes'
|
|
29
|
+
import getRelationships from './app/bsky/graph/getRelationships'
|
|
29
30
|
import muteActor from './app/bsky/graph/muteActor'
|
|
30
31
|
import unmuteActor from './app/bsky/graph/unmuteActor'
|
|
31
32
|
import muteActorList from './app/bsky/graph/muteActorList'
|
|
@@ -82,6 +83,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
82
83
|
getLists(server, ctx)
|
|
83
84
|
getListMutes(server, ctx)
|
|
84
85
|
getMutes(server, ctx)
|
|
86
|
+
getRelationships(server, ctx)
|
|
85
87
|
muteActor(server, ctx)
|
|
86
88
|
unmuteActor(server, ctx)
|
|
87
89
|
muteActorList(server, ctx)
|
package/src/lexicon/index.ts
CHANGED
|
@@ -78,6 +78,7 @@ import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos'
|
|
|
78
78
|
import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate'
|
|
79
79
|
import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl'
|
|
80
80
|
import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos'
|
|
81
|
+
import * as ComAtprotoTempCheckSignupQueue from './types/com/atproto/temp/checkSignupQueue'
|
|
81
82
|
import * as ComAtprotoTempFetchLabels from './types/com/atproto/temp/fetchLabels'
|
|
82
83
|
import * as ComAtprotoTempImportRepo from './types/com/atproto/temp/importRepo'
|
|
83
84
|
import * as ComAtprotoTempPushBlob from './types/com/atproto/temp/pushBlob'
|
|
@@ -114,6 +115,7 @@ import * as AppBskyGraphGetListBlocks from './types/app/bsky/graph/getListBlocks
|
|
|
114
115
|
import * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes'
|
|
115
116
|
import * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists'
|
|
116
117
|
import * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes'
|
|
118
|
+
import * as AppBskyGraphGetRelationships from './types/app/bsky/graph/getRelationships'
|
|
117
119
|
import * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/getSuggestedFollowsByActor'
|
|
118
120
|
import * as AppBskyGraphMuteActor from './types/app/bsky/graph/muteActor'
|
|
119
121
|
import * as AppBskyGraphMuteActorList from './types/app/bsky/graph/muteActorList'
|
|
@@ -1020,6 +1022,17 @@ export class ComAtprotoTempNS {
|
|
|
1020
1022
|
this._server = server
|
|
1021
1023
|
}
|
|
1022
1024
|
|
|
1025
|
+
checkSignupQueue<AV extends AuthVerifier>(
|
|
1026
|
+
cfg: ConfigOf<
|
|
1027
|
+
AV,
|
|
1028
|
+
ComAtprotoTempCheckSignupQueue.Handler<ExtractAuth<AV>>,
|
|
1029
|
+
ComAtprotoTempCheckSignupQueue.HandlerReqCtx<ExtractAuth<AV>>
|
|
1030
|
+
>,
|
|
1031
|
+
) {
|
|
1032
|
+
const nsid = 'com.atproto.temp.checkSignupQueue' // @ts-ignore
|
|
1033
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1023
1036
|
fetchLabels<AV extends AuthVerifier>(
|
|
1024
1037
|
cfg: ConfigOf<
|
|
1025
1038
|
AV,
|
|
@@ -1480,6 +1493,17 @@ export class AppBskyGraphNS {
|
|
|
1480
1493
|
return this._server.xrpc.method(nsid, cfg)
|
|
1481
1494
|
}
|
|
1482
1495
|
|
|
1496
|
+
getRelationships<AV extends AuthVerifier>(
|
|
1497
|
+
cfg: ConfigOf<
|
|
1498
|
+
AV,
|
|
1499
|
+
AppBskyGraphGetRelationships.Handler<ExtractAuth<AV>>,
|
|
1500
|
+
AppBskyGraphGetRelationships.HandlerReqCtx<ExtractAuth<AV>>
|
|
1501
|
+
>,
|
|
1502
|
+
) {
|
|
1503
|
+
const nsid = 'app.bsky.graph.getRelationships' // @ts-ignore
|
|
1504
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1483
1507
|
getSuggestedFollowsByActor<AV extends AuthVerifier>(
|
|
1484
1508
|
cfg: ConfigOf<
|
|
1485
1509
|
AV,
|
package/src/lexicon/lexicons.ts
CHANGED
|
@@ -4246,6 +4246,34 @@ export const schemaDict = {
|
|
|
4246
4246
|
},
|
|
4247
4247
|
},
|
|
4248
4248
|
},
|
|
4249
|
+
ComAtprotoTempCheckSignupQueue: {
|
|
4250
|
+
lexicon: 1,
|
|
4251
|
+
id: 'com.atproto.temp.checkSignupQueue',
|
|
4252
|
+
defs: {
|
|
4253
|
+
main: {
|
|
4254
|
+
type: 'query',
|
|
4255
|
+
description: 'Check accounts location in signup queue.',
|
|
4256
|
+
output: {
|
|
4257
|
+
encoding: 'application/json',
|
|
4258
|
+
schema: {
|
|
4259
|
+
type: 'object',
|
|
4260
|
+
required: ['activated'],
|
|
4261
|
+
properties: {
|
|
4262
|
+
activated: {
|
|
4263
|
+
type: 'boolean',
|
|
4264
|
+
},
|
|
4265
|
+
placeInQueue: {
|
|
4266
|
+
type: 'integer',
|
|
4267
|
+
},
|
|
4268
|
+
estimatedTimeMs: {
|
|
4269
|
+
type: 'integer',
|
|
4270
|
+
},
|
|
4271
|
+
},
|
|
4272
|
+
},
|
|
4273
|
+
},
|
|
4274
|
+
},
|
|
4275
|
+
},
|
|
4276
|
+
},
|
|
4249
4277
|
ComAtprotoTempFetchLabels: {
|
|
4250
4278
|
lexicon: 1,
|
|
4251
4279
|
id: 'com.atproto.temp.fetchLabels',
|
|
@@ -4615,6 +4643,7 @@ export const schemaDict = {
|
|
|
4615
4643
|
'lex:app.bsky.actor.defs#personalDetailsPref',
|
|
4616
4644
|
'lex:app.bsky.actor.defs#feedViewPref',
|
|
4617
4645
|
'lex:app.bsky.actor.defs#threadViewPref',
|
|
4646
|
+
'lex:app.bsky.actor.defs#interestsPref',
|
|
4618
4647
|
],
|
|
4619
4648
|
},
|
|
4620
4649
|
},
|
|
@@ -4718,6 +4747,23 @@ export const schemaDict = {
|
|
|
4718
4747
|
},
|
|
4719
4748
|
},
|
|
4720
4749
|
},
|
|
4750
|
+
interestsPref: {
|
|
4751
|
+
type: 'object',
|
|
4752
|
+
required: ['tags'],
|
|
4753
|
+
properties: {
|
|
4754
|
+
tags: {
|
|
4755
|
+
type: 'array',
|
|
4756
|
+
maxLength: 100,
|
|
4757
|
+
items: {
|
|
4758
|
+
type: 'string',
|
|
4759
|
+
maxLength: 640,
|
|
4760
|
+
maxGraphemes: 64,
|
|
4761
|
+
},
|
|
4762
|
+
description:
|
|
4763
|
+
"A list of tags which describe the account owner's interests gathered during onboarding.",
|
|
4764
|
+
},
|
|
4765
|
+
},
|
|
4766
|
+
},
|
|
4721
4767
|
},
|
|
4722
4768
|
},
|
|
4723
4769
|
AppBskyActorGetPreferences: {
|
|
@@ -6925,6 +6971,45 @@ export const schemaDict = {
|
|
|
6925
6971
|
},
|
|
6926
6972
|
},
|
|
6927
6973
|
},
|
|
6974
|
+
notFoundActor: {
|
|
6975
|
+
type: 'object',
|
|
6976
|
+
description: 'indicates that a handle or DID could not be resolved',
|
|
6977
|
+
required: ['actor', 'notFound'],
|
|
6978
|
+
properties: {
|
|
6979
|
+
actor: {
|
|
6980
|
+
type: 'string',
|
|
6981
|
+
format: 'at-identifier',
|
|
6982
|
+
},
|
|
6983
|
+
notFound: {
|
|
6984
|
+
type: 'boolean',
|
|
6985
|
+
const: true,
|
|
6986
|
+
},
|
|
6987
|
+
},
|
|
6988
|
+
},
|
|
6989
|
+
relationship: {
|
|
6990
|
+
type: 'object',
|
|
6991
|
+
description:
|
|
6992
|
+
'lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object)',
|
|
6993
|
+
required: ['did'],
|
|
6994
|
+
properties: {
|
|
6995
|
+
did: {
|
|
6996
|
+
type: 'string',
|
|
6997
|
+
format: 'did',
|
|
6998
|
+
},
|
|
6999
|
+
following: {
|
|
7000
|
+
type: 'string',
|
|
7001
|
+
format: 'at-uri',
|
|
7002
|
+
description:
|
|
7003
|
+
'if the actor follows this DID, this is the AT-URI of the follow record',
|
|
7004
|
+
},
|
|
7005
|
+
followedBy: {
|
|
7006
|
+
type: 'string',
|
|
7007
|
+
format: 'at-uri',
|
|
7008
|
+
description:
|
|
7009
|
+
'if the actor is followed by this DID, contains the AT-URI of the follow record',
|
|
7010
|
+
},
|
|
7011
|
+
},
|
|
7012
|
+
},
|
|
6928
7013
|
},
|
|
6929
7014
|
},
|
|
6930
7015
|
AppBskyGraphFollow: {
|
|
@@ -7328,6 +7413,65 @@ export const schemaDict = {
|
|
|
7328
7413
|
},
|
|
7329
7414
|
},
|
|
7330
7415
|
},
|
|
7416
|
+
AppBskyGraphGetRelationships: {
|
|
7417
|
+
lexicon: 1,
|
|
7418
|
+
id: 'app.bsky.graph.getRelationships',
|
|
7419
|
+
defs: {
|
|
7420
|
+
main: {
|
|
7421
|
+
type: 'query',
|
|
7422
|
+
description:
|
|
7423
|
+
'Enumerates public relationships between one account, and a list of other accounts',
|
|
7424
|
+
parameters: {
|
|
7425
|
+
type: 'params',
|
|
7426
|
+
required: ['actor'],
|
|
7427
|
+
properties: {
|
|
7428
|
+
actor: {
|
|
7429
|
+
type: 'string',
|
|
7430
|
+
format: 'at-identifier',
|
|
7431
|
+
},
|
|
7432
|
+
others: {
|
|
7433
|
+
type: 'array',
|
|
7434
|
+
maxLength: 30,
|
|
7435
|
+
items: {
|
|
7436
|
+
type: 'string',
|
|
7437
|
+
format: 'at-identifier',
|
|
7438
|
+
},
|
|
7439
|
+
},
|
|
7440
|
+
},
|
|
7441
|
+
},
|
|
7442
|
+
output: {
|
|
7443
|
+
encoding: 'application/json',
|
|
7444
|
+
schema: {
|
|
7445
|
+
type: 'object',
|
|
7446
|
+
required: ['relationships'],
|
|
7447
|
+
properties: {
|
|
7448
|
+
actor: {
|
|
7449
|
+
type: 'string',
|
|
7450
|
+
format: 'did',
|
|
7451
|
+
},
|
|
7452
|
+
relationships: {
|
|
7453
|
+
type: 'array',
|
|
7454
|
+
items: {
|
|
7455
|
+
type: 'union',
|
|
7456
|
+
refs: [
|
|
7457
|
+
'lex:app.bsky.graph.defs#relationship',
|
|
7458
|
+
'lex:app.bsky.graph.defs#notFoundActor',
|
|
7459
|
+
],
|
|
7460
|
+
},
|
|
7461
|
+
},
|
|
7462
|
+
},
|
|
7463
|
+
},
|
|
7464
|
+
},
|
|
7465
|
+
errors: [
|
|
7466
|
+
{
|
|
7467
|
+
name: 'ActorNotFound',
|
|
7468
|
+
description:
|
|
7469
|
+
'the primary actor at-identifier could not be resolved',
|
|
7470
|
+
},
|
|
7471
|
+
],
|
|
7472
|
+
},
|
|
7473
|
+
},
|
|
7474
|
+
},
|
|
7331
7475
|
AppBskyGraphGetSuggestedFollowsByActor: {
|
|
7332
7476
|
lexicon: 1,
|
|
7333
7477
|
id: 'app.bsky.graph.getSuggestedFollowsByActor',
|
|
@@ -8220,6 +8364,7 @@ export const ids = {
|
|
|
8220
8364
|
ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate',
|
|
8221
8365
|
ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl',
|
|
8222
8366
|
ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos',
|
|
8367
|
+
ComAtprotoTempCheckSignupQueue: 'com.atproto.temp.checkSignupQueue',
|
|
8223
8368
|
ComAtprotoTempFetchLabels: 'com.atproto.temp.fetchLabels',
|
|
8224
8369
|
ComAtprotoTempImportRepo: 'com.atproto.temp.importRepo',
|
|
8225
8370
|
ComAtprotoTempPushBlob: 'com.atproto.temp.pushBlob',
|
|
@@ -8272,6 +8417,7 @@ export const ids = {
|
|
|
8272
8417
|
AppBskyGraphGetListMutes: 'app.bsky.graph.getListMutes',
|
|
8273
8418
|
AppBskyGraphGetLists: 'app.bsky.graph.getLists',
|
|
8274
8419
|
AppBskyGraphGetMutes: 'app.bsky.graph.getMutes',
|
|
8420
|
+
AppBskyGraphGetRelationships: 'app.bsky.graph.getRelationships',
|
|
8275
8421
|
AppBskyGraphGetSuggestedFollowsByActor:
|
|
8276
8422
|
'app.bsky.graph.getSuggestedFollowsByActor',
|
|
8277
8423
|
AppBskyGraphList: 'app.bsky.graph.list',
|