@atproto/bsky 0.0.136 → 0.0.137
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 +9 -0
- package/dist/api/app/bsky/unspecced/getSuggestedStarterPacks.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedStarterPacks.js +2 -2
- package/dist/api/app/bsky/unspecced/getSuggestedStarterPacks.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedUsers.d.ts +4 -0
- package/dist/api/app/bsky/unspecced/getSuggestedUsers.d.ts.map +1 -0
- package/dist/api/app/bsky/unspecced/getSuggestedUsers.js +84 -0
- package/dist/api/app/bsky/unspecced/getSuggestedUsers.js.map +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -2
- package/dist/api/index.js.map +1 -1
- package/dist/lexicon/index.d.ts +4 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +8 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +174 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +89 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.d.ts +38 -0
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.js +7 -0
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.js.map +1 -0
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.d.ts +39 -0
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.js +7 -0
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.js.map +1 -0
- package/package.json +4 -4
- package/src/api/app/bsky/unspecced/getSuggestedStarterPacks.ts +7 -2
- package/src/api/app/bsky/unspecced/getSuggestedUsers.ts +137 -0
- package/src/api/index.ts +2 -2
- package/src/lexicon/index.ts +24 -0
- package/src/lexicon/lexicons.ts +92 -0
- package/src/lexicon/types/app/bsky/unspecced/getSuggestedUsers.ts +56 -0
- package/src/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.ts +57 -0
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express';
|
|
5
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
6
|
+
import type * as AppBskyActorDefs from '../actor/defs.js';
|
|
7
|
+
export interface QueryParams {
|
|
8
|
+
/** Category of users to get suggestions for. */
|
|
9
|
+
category?: string;
|
|
10
|
+
limit: number;
|
|
11
|
+
}
|
|
12
|
+
export type InputSchema = undefined;
|
|
13
|
+
export interface OutputSchema {
|
|
14
|
+
actors: AppBskyActorDefs.ProfileViewBasic[];
|
|
15
|
+
}
|
|
16
|
+
export type HandlerInput = undefined;
|
|
17
|
+
export interface HandlerSuccess {
|
|
18
|
+
encoding: 'application/json';
|
|
19
|
+
body: OutputSchema;
|
|
20
|
+
headers?: {
|
|
21
|
+
[key: string]: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface HandlerError {
|
|
25
|
+
status: number;
|
|
26
|
+
message?: string;
|
|
27
|
+
}
|
|
28
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
|
|
29
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
30
|
+
auth: HA;
|
|
31
|
+
params: QueryParams;
|
|
32
|
+
input: HandlerInput;
|
|
33
|
+
req: express.Request;
|
|
34
|
+
res: express.Response;
|
|
35
|
+
resetRouteRateLimits: () => Promise<void>;
|
|
36
|
+
};
|
|
37
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
38
|
+
//# sourceMappingURL=getSuggestedUsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSuggestedUsers.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestedUsers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAS7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,KAAK,gBAAgB,MAAM,kBAAkB,CAAA;AAMzD,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,CAAA;CAC5C;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,kBAAkB,CAAA;AAC9E,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI;IAC1D,IAAI,EAAE,EAAE,CAAA;IACR,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,GAAG,EAAE,OAAO,CAAC,OAAO,CAAA;IACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAA;IACrB,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1C,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lexicons_1 = require("../../../../lexicons");
|
|
4
|
+
const util_1 = require("../../../../util");
|
|
5
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
6
|
+
const id = 'app.bsky.unspecced.getSuggestedUsers';
|
|
7
|
+
//# sourceMappingURL=getSuggestedUsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSuggestedUsers.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestedUsers.ts"],"names":[],"mappings":";;AAMA,mDAA4D;AAC5D,2CAIyB;AAIzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,sCAAsC,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express';
|
|
5
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
6
|
+
export interface QueryParams {
|
|
7
|
+
/** DID of the account making the request (not included for public/unauthenticated queries). */
|
|
8
|
+
viewer?: string;
|
|
9
|
+
/** Category of users to get suggestions for. */
|
|
10
|
+
category?: string;
|
|
11
|
+
limit: number;
|
|
12
|
+
}
|
|
13
|
+
export type InputSchema = undefined;
|
|
14
|
+
export interface OutputSchema {
|
|
15
|
+
dids: string[];
|
|
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
|
+
}
|
|
29
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
|
|
30
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
31
|
+
auth: HA;
|
|
32
|
+
params: QueryParams;
|
|
33
|
+
input: HandlerInput;
|
|
34
|
+
req: express.Request;
|
|
35
|
+
res: express.Response;
|
|
36
|
+
resetRouteRateLimits: () => Promise<void>;
|
|
37
|
+
};
|
|
38
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
39
|
+
//# sourceMappingURL=getSuggestedUsersSkeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSuggestedUsersSkeleton.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAS7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAMtE,MAAM,WAAW,WAAW;IAC1B,+FAA+F;IAC/F,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,kBAAkB,CAAA;AAC9E,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI;IAC1D,IAAI,EAAE,EAAE,CAAA;IACR,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,GAAG,EAAE,OAAO,CAAC,OAAO,CAAA;IACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAA;IACrB,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1C,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lexicons_1 = require("../../../../lexicons");
|
|
4
|
+
const util_1 = require("../../../../util");
|
|
5
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
6
|
+
const id = 'app.bsky.unspecced.getSuggestedUsersSkeleton';
|
|
7
|
+
//# sourceMappingURL=getSuggestedUsersSkeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSuggestedUsersSkeleton.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.ts"],"names":[],"mappings":";;AAMA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,8CAA8C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/bsky",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.137",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Reference implementation of app.bsky App View (Bluesky API)",
|
|
6
6
|
"keywords": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"undici": "^6.19.8",
|
|
51
51
|
"@atproto-labs/fetch-node": "0.1.8",
|
|
52
52
|
"@atproto-labs/xrpc-utils": "0.0.11",
|
|
53
|
-
"@atproto/api": "^0.14.
|
|
53
|
+
"@atproto/api": "^0.14.20",
|
|
54
54
|
"@atproto/common": "^0.4.10",
|
|
55
55
|
"@atproto/crypto": "^0.4.4",
|
|
56
56
|
"@atproto/did": "^0.1.5",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"jest": "^28.1.2",
|
|
75
75
|
"ts-node": "^10.8.2",
|
|
76
76
|
"typescript": "^5.6.3",
|
|
77
|
-
"@atproto/api": "^0.14.
|
|
77
|
+
"@atproto/api": "^0.14.20",
|
|
78
78
|
"@atproto/lex-cli": "^0.7.2",
|
|
79
|
-
"@atproto/pds": "^0.4.
|
|
79
|
+
"@atproto/pds": "^0.4.121",
|
|
80
80
|
"@atproto/xrpc": "^0.6.12"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
@@ -19,7 +19,12 @@ import {
|
|
|
19
19
|
import { Views } from '../../../../views'
|
|
20
20
|
|
|
21
21
|
export default function (server: Server, ctx: AppContext) {
|
|
22
|
-
const
|
|
22
|
+
const getSuggestedStarterPacks = createPipeline(
|
|
23
|
+
skeleton,
|
|
24
|
+
hydration,
|
|
25
|
+
noBlocks,
|
|
26
|
+
presentation,
|
|
27
|
+
)
|
|
23
28
|
server.app.bsky.unspecced.getSuggestedStarterPacks({
|
|
24
29
|
auth: ctx.authVerifier.standardOptional,
|
|
25
30
|
handler: async ({ auth, params, req }) => {
|
|
@@ -32,7 +37,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
32
37
|
? req.headers['x-bsky-topics'].join(',')
|
|
33
38
|
: req.headers['x-bsky-topics'],
|
|
34
39
|
})
|
|
35
|
-
const { ...result } = await
|
|
40
|
+
const { ...result } = await getSuggestedStarterPacks(
|
|
36
41
|
{
|
|
37
42
|
...params,
|
|
38
43
|
viewer: viewer ?? undefined,
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import AtpAgent from '@atproto/api'
|
|
2
|
+
import { dedupeStrs, mapDefined, noUndefinedVals } from '@atproto/common'
|
|
3
|
+
import { InternalServerError } from '@atproto/xrpc-server'
|
|
4
|
+
import { AppContext } from '../../../../context'
|
|
5
|
+
import {
|
|
6
|
+
HydrateCtx,
|
|
7
|
+
Hydrator,
|
|
8
|
+
mergeManyStates,
|
|
9
|
+
} from '../../../../hydration/hydrator'
|
|
10
|
+
import { Server } from '../../../../lexicon'
|
|
11
|
+
import { QueryParams } from '../../../../lexicon/types/app/bsky/unspecced/getTrendingTopics'
|
|
12
|
+
import {
|
|
13
|
+
HydrationFnInput,
|
|
14
|
+
PresentationFnInput,
|
|
15
|
+
RulesFnInput,
|
|
16
|
+
SkeletonFnInput,
|
|
17
|
+
createPipeline,
|
|
18
|
+
} from '../../../../pipeline'
|
|
19
|
+
import { Views } from '../../../../views'
|
|
20
|
+
|
|
21
|
+
export default function (server: Server, ctx: AppContext) {
|
|
22
|
+
const getSuggestedUsers = createPipeline(
|
|
23
|
+
skeleton,
|
|
24
|
+
hydration,
|
|
25
|
+
noBlocksOrFollows,
|
|
26
|
+
presentation,
|
|
27
|
+
)
|
|
28
|
+
server.app.bsky.unspecced.getSuggestedUsers({
|
|
29
|
+
auth: ctx.authVerifier.standardOptional,
|
|
30
|
+
handler: async ({ auth, params, req }) => {
|
|
31
|
+
const viewer = auth.credentials.iss
|
|
32
|
+
const labelers = ctx.reqLabelers(req)
|
|
33
|
+
const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
|
|
34
|
+
const headers = noUndefinedVals({
|
|
35
|
+
'accept-language': req.headers['accept-language'],
|
|
36
|
+
'x-bsky-topics': Array.isArray(req.headers['x-bsky-topics'])
|
|
37
|
+
? req.headers['x-bsky-topics'].join(',')
|
|
38
|
+
: req.headers['x-bsky-topics'],
|
|
39
|
+
})
|
|
40
|
+
const { ...result } = await getSuggestedUsers(
|
|
41
|
+
{
|
|
42
|
+
...params,
|
|
43
|
+
viewer: viewer ?? undefined,
|
|
44
|
+
hydrateCtx: hydrateCtx.copy({ viewer }),
|
|
45
|
+
headers,
|
|
46
|
+
},
|
|
47
|
+
ctx,
|
|
48
|
+
)
|
|
49
|
+
return {
|
|
50
|
+
encoding: 'application/json',
|
|
51
|
+
body: result,
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const skeleton = async (input: SkeletonFnInput<Context, Params>) => {
|
|
58
|
+
const { params, ctx } = input
|
|
59
|
+
if (ctx.topicsAgent) {
|
|
60
|
+
const res =
|
|
61
|
+
await ctx.topicsAgent.app.bsky.unspecced.getSuggestedUsersSkeleton(
|
|
62
|
+
{
|
|
63
|
+
limit: params.limit,
|
|
64
|
+
viewer: params.viewer,
|
|
65
|
+
category: params.category,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
headers: params.headers,
|
|
69
|
+
},
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
return res.data
|
|
73
|
+
} else {
|
|
74
|
+
throw new InternalServerError('Topics agent not available')
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const hydration = async (
|
|
79
|
+
input: HydrationFnInput<Context, Params, SkeletonState>,
|
|
80
|
+
) => {
|
|
81
|
+
const { ctx, params, skeleton } = input
|
|
82
|
+
const dids = dedupeStrs(skeleton.dids)
|
|
83
|
+
const pairs: Map<string, string[]> = new Map()
|
|
84
|
+
if (params.viewer) {
|
|
85
|
+
pairs.set(params.viewer, dids)
|
|
86
|
+
}
|
|
87
|
+
const [profileBasicState, bidirectionalBlocks] = await Promise.all([
|
|
88
|
+
ctx.hydrator.hydrateProfilesBasic(dids, params.hydrateCtx),
|
|
89
|
+
ctx.hydrator.hydrateBidirectionalBlocks(pairs),
|
|
90
|
+
])
|
|
91
|
+
|
|
92
|
+
return mergeManyStates(profileBasicState, { bidirectionalBlocks })
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const noBlocksOrFollows = (
|
|
96
|
+
input: RulesFnInput<Context, Params, SkeletonState>,
|
|
97
|
+
) => {
|
|
98
|
+
const { ctx, skeleton, params, hydration } = input
|
|
99
|
+
if (!params.viewer) {
|
|
100
|
+
return skeleton
|
|
101
|
+
}
|
|
102
|
+
const blocks = hydration.bidirectionalBlocks?.get(params.viewer)
|
|
103
|
+
return {
|
|
104
|
+
...skeleton,
|
|
105
|
+
dids: skeleton.dids.filter((did) => {
|
|
106
|
+
const viewer = ctx.views.profileViewer(did, hydration)
|
|
107
|
+
return !blocks?.get(did) && !viewer?.following
|
|
108
|
+
}),
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const presentation = (
|
|
113
|
+
input: PresentationFnInput<Context, Params, SkeletonState>,
|
|
114
|
+
) => {
|
|
115
|
+
const { ctx, skeleton, hydration } = input
|
|
116
|
+
return {
|
|
117
|
+
actors: mapDefined(skeleton.dids, (did) =>
|
|
118
|
+
ctx.views.profileBasic(did, hydration),
|
|
119
|
+
),
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
type Context = {
|
|
124
|
+
hydrator: Hydrator
|
|
125
|
+
views: Views
|
|
126
|
+
topicsAgent: AtpAgent | undefined
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
type Params = QueryParams & {
|
|
130
|
+
hydrateCtx: HydrateCtx & { viewer: string | null }
|
|
131
|
+
headers: Record<string, string>
|
|
132
|
+
category?: string
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
type SkeletonState = {
|
|
136
|
+
dids: string[]
|
|
137
|
+
}
|
package/src/api/index.ts
CHANGED
|
@@ -51,6 +51,7 @@ import getConfig from './app/bsky/unspecced/getConfig'
|
|
|
51
51
|
import getPopularFeedGenerators from './app/bsky/unspecced/getPopularFeedGenerators'
|
|
52
52
|
import getUnspeccedSuggestedFeeds from './app/bsky/unspecced/getSuggestedFeeds'
|
|
53
53
|
import getSuggestedStarterPacks from './app/bsky/unspecced/getSuggestedStarterPacks'
|
|
54
|
+
import getSuggestedUsers from './app/bsky/unspecced/getSuggestedUsers'
|
|
54
55
|
import getTaggedSuggestions from './app/bsky/unspecced/getTaggedSuggestions'
|
|
55
56
|
import getTrendingTopics from './app/bsky/unspecced/getTrendingTopics'
|
|
56
57
|
import getTrends from './app/bsky/unspecced/getTrends'
|
|
@@ -111,9 +112,8 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
111
112
|
getTrendingTopics(server, ctx)
|
|
112
113
|
getTrends(server, ctx)
|
|
113
114
|
getSuggestedStarterPacks(server, ctx)
|
|
115
|
+
getSuggestedUsers(server, ctx)
|
|
114
116
|
getUnspeccedSuggestedFeeds(server, ctx)
|
|
115
|
-
getTrends(server, ctx)
|
|
116
|
-
getSuggestedStarterPacks(server, ctx)
|
|
117
117
|
getLabelerServices(server, ctx)
|
|
118
118
|
searchActors(server, ctx)
|
|
119
119
|
searchActorsTypeahead(server, ctx)
|
package/src/lexicon/index.ts
CHANGED
|
@@ -147,6 +147,8 @@ import * as AppBskyUnspeccedGetSuggestedFeeds from './types/app/bsky/unspecced/g
|
|
|
147
147
|
import * as AppBskyUnspeccedGetSuggestedFeedsSkeleton from './types/app/bsky/unspecced/getSuggestedFeedsSkeleton.js'
|
|
148
148
|
import * as AppBskyUnspeccedGetSuggestedStarterPacks from './types/app/bsky/unspecced/getSuggestedStarterPacks.js'
|
|
149
149
|
import * as AppBskyUnspeccedGetSuggestedStarterPacksSkeleton from './types/app/bsky/unspecced/getSuggestedStarterPacksSkeleton.js'
|
|
150
|
+
import * as AppBskyUnspeccedGetSuggestedUsers from './types/app/bsky/unspecced/getSuggestedUsers.js'
|
|
151
|
+
import * as AppBskyUnspeccedGetSuggestedUsersSkeleton from './types/app/bsky/unspecced/getSuggestedUsersSkeleton.js'
|
|
150
152
|
import * as AppBskyUnspeccedGetSuggestionsSkeleton from './types/app/bsky/unspecced/getSuggestionsSkeleton.js'
|
|
151
153
|
import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions.js'
|
|
152
154
|
import * as AppBskyUnspeccedGetTrendingTopics from './types/app/bsky/unspecced/getTrendingTopics.js'
|
|
@@ -1961,6 +1963,28 @@ export class AppBskyUnspeccedNS {
|
|
|
1961
1963
|
return this._server.xrpc.method(nsid, cfg)
|
|
1962
1964
|
}
|
|
1963
1965
|
|
|
1966
|
+
getSuggestedUsers<AV extends AuthVerifier>(
|
|
1967
|
+
cfg: ConfigOf<
|
|
1968
|
+
AV,
|
|
1969
|
+
AppBskyUnspeccedGetSuggestedUsers.Handler<ExtractAuth<AV>>,
|
|
1970
|
+
AppBskyUnspeccedGetSuggestedUsers.HandlerReqCtx<ExtractAuth<AV>>
|
|
1971
|
+
>,
|
|
1972
|
+
) {
|
|
1973
|
+
const nsid = 'app.bsky.unspecced.getSuggestedUsers' // @ts-ignore
|
|
1974
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
getSuggestedUsersSkeleton<AV extends AuthVerifier>(
|
|
1978
|
+
cfg: ConfigOf<
|
|
1979
|
+
AV,
|
|
1980
|
+
AppBskyUnspeccedGetSuggestedUsersSkeleton.Handler<ExtractAuth<AV>>,
|
|
1981
|
+
AppBskyUnspeccedGetSuggestedUsersSkeleton.HandlerReqCtx<ExtractAuth<AV>>
|
|
1982
|
+
>,
|
|
1983
|
+
) {
|
|
1984
|
+
const nsid = 'app.bsky.unspecced.getSuggestedUsersSkeleton' // @ts-ignore
|
|
1985
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1964
1988
|
getSuggestionsSkeleton<AV extends AuthVerifier>(
|
|
1965
1989
|
cfg: ConfigOf<
|
|
1966
1990
|
AV,
|
package/src/lexicon/lexicons.ts
CHANGED
|
@@ -10046,6 +10046,95 @@ export const schemaDict = {
|
|
|
10046
10046
|
},
|
|
10047
10047
|
},
|
|
10048
10048
|
},
|
|
10049
|
+
AppBskyUnspeccedGetSuggestedUsers: {
|
|
10050
|
+
lexicon: 1,
|
|
10051
|
+
id: 'app.bsky.unspecced.getSuggestedUsers',
|
|
10052
|
+
defs: {
|
|
10053
|
+
main: {
|
|
10054
|
+
type: 'query',
|
|
10055
|
+
description: 'Get a list of suggested users',
|
|
10056
|
+
parameters: {
|
|
10057
|
+
type: 'params',
|
|
10058
|
+
properties: {
|
|
10059
|
+
category: {
|
|
10060
|
+
type: 'string',
|
|
10061
|
+
description: 'Category of users to get suggestions for.',
|
|
10062
|
+
},
|
|
10063
|
+
limit: {
|
|
10064
|
+
type: 'integer',
|
|
10065
|
+
minimum: 1,
|
|
10066
|
+
maximum: 50,
|
|
10067
|
+
default: 25,
|
|
10068
|
+
},
|
|
10069
|
+
},
|
|
10070
|
+
},
|
|
10071
|
+
output: {
|
|
10072
|
+
encoding: 'application/json',
|
|
10073
|
+
schema: {
|
|
10074
|
+
type: 'object',
|
|
10075
|
+
required: ['actors'],
|
|
10076
|
+
properties: {
|
|
10077
|
+
actors: {
|
|
10078
|
+
type: 'array',
|
|
10079
|
+
items: {
|
|
10080
|
+
type: 'ref',
|
|
10081
|
+
ref: 'lex:app.bsky.actor.defs#profileViewBasic',
|
|
10082
|
+
},
|
|
10083
|
+
},
|
|
10084
|
+
},
|
|
10085
|
+
},
|
|
10086
|
+
},
|
|
10087
|
+
},
|
|
10088
|
+
},
|
|
10089
|
+
},
|
|
10090
|
+
AppBskyUnspeccedGetSuggestedUsersSkeleton: {
|
|
10091
|
+
lexicon: 1,
|
|
10092
|
+
id: 'app.bsky.unspecced.getSuggestedUsersSkeleton',
|
|
10093
|
+
defs: {
|
|
10094
|
+
main: {
|
|
10095
|
+
type: 'query',
|
|
10096
|
+
description:
|
|
10097
|
+
'Get a skeleton of suggested users. Intended to be called and hydrated by app.bsky.unspecced.getSuggestedUsers',
|
|
10098
|
+
parameters: {
|
|
10099
|
+
type: 'params',
|
|
10100
|
+
properties: {
|
|
10101
|
+
viewer: {
|
|
10102
|
+
type: 'string',
|
|
10103
|
+
format: 'did',
|
|
10104
|
+
description:
|
|
10105
|
+
'DID of the account making the request (not included for public/unauthenticated queries).',
|
|
10106
|
+
},
|
|
10107
|
+
category: {
|
|
10108
|
+
type: 'string',
|
|
10109
|
+
description: 'Category of users to get suggestions for.',
|
|
10110
|
+
},
|
|
10111
|
+
limit: {
|
|
10112
|
+
type: 'integer',
|
|
10113
|
+
minimum: 1,
|
|
10114
|
+
maximum: 50,
|
|
10115
|
+
default: 25,
|
|
10116
|
+
},
|
|
10117
|
+
},
|
|
10118
|
+
},
|
|
10119
|
+
output: {
|
|
10120
|
+
encoding: 'application/json',
|
|
10121
|
+
schema: {
|
|
10122
|
+
type: 'object',
|
|
10123
|
+
required: ['dids'],
|
|
10124
|
+
properties: {
|
|
10125
|
+
dids: {
|
|
10126
|
+
type: 'array',
|
|
10127
|
+
items: {
|
|
10128
|
+
type: 'string',
|
|
10129
|
+
format: 'did',
|
|
10130
|
+
},
|
|
10131
|
+
},
|
|
10132
|
+
},
|
|
10133
|
+
},
|
|
10134
|
+
},
|
|
10135
|
+
},
|
|
10136
|
+
},
|
|
10137
|
+
},
|
|
10049
10138
|
AppBskyUnspeccedGetSuggestionsSkeleton: {
|
|
10050
10139
|
lexicon: 1,
|
|
10051
10140
|
id: 'app.bsky.unspecced.getSuggestionsSkeleton',
|
|
@@ -12215,6 +12304,9 @@ export const ids = {
|
|
|
12215
12304
|
'app.bsky.unspecced.getSuggestedStarterPacks',
|
|
12216
12305
|
AppBskyUnspeccedGetSuggestedStarterPacksSkeleton:
|
|
12217
12306
|
'app.bsky.unspecced.getSuggestedStarterPacksSkeleton',
|
|
12307
|
+
AppBskyUnspeccedGetSuggestedUsers: 'app.bsky.unspecced.getSuggestedUsers',
|
|
12308
|
+
AppBskyUnspeccedGetSuggestedUsersSkeleton:
|
|
12309
|
+
'app.bsky.unspecced.getSuggestedUsersSkeleton',
|
|
12218
12310
|
AppBskyUnspeccedGetSuggestionsSkeleton:
|
|
12219
12311
|
'app.bsky.unspecced.getSuggestionsSkeleton',
|
|
12220
12312
|
AppBskyUnspeccedGetTaggedSuggestions:
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { CID } from 'multiformats/cid'
|
|
7
|
+
import { validate as _validate } from '../../../../lexicons'
|
|
8
|
+
import {
|
|
9
|
+
type $Typed,
|
|
10
|
+
is$typed as _is$typed,
|
|
11
|
+
type OmitKey,
|
|
12
|
+
} from '../../../../util'
|
|
13
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
14
|
+
import type * as AppBskyActorDefs from '../actor/defs.js'
|
|
15
|
+
|
|
16
|
+
const is$typed = _is$typed,
|
|
17
|
+
validate = _validate
|
|
18
|
+
const id = 'app.bsky.unspecced.getSuggestedUsers'
|
|
19
|
+
|
|
20
|
+
export interface QueryParams {
|
|
21
|
+
/** Category of users to get suggestions for. */
|
|
22
|
+
category?: string
|
|
23
|
+
limit: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type InputSchema = undefined
|
|
27
|
+
|
|
28
|
+
export interface OutputSchema {
|
|
29
|
+
actors: AppBskyActorDefs.ProfileViewBasic[]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type HandlerInput = undefined
|
|
33
|
+
|
|
34
|
+
export interface HandlerSuccess {
|
|
35
|
+
encoding: 'application/json'
|
|
36
|
+
body: OutputSchema
|
|
37
|
+
headers?: { [key: string]: string }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface HandlerError {
|
|
41
|
+
status: number
|
|
42
|
+
message?: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
|
46
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
47
|
+
auth: HA
|
|
48
|
+
params: QueryParams
|
|
49
|
+
input: HandlerInput
|
|
50
|
+
req: express.Request
|
|
51
|
+
res: express.Response
|
|
52
|
+
resetRouteRateLimits: () => Promise<void>
|
|
53
|
+
}
|
|
54
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
55
|
+
ctx: HandlerReqCtx<HA>,
|
|
56
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { CID } from 'multiformats/cid'
|
|
7
|
+
import { validate as _validate } from '../../../../lexicons'
|
|
8
|
+
import {
|
|
9
|
+
type $Typed,
|
|
10
|
+
is$typed as _is$typed,
|
|
11
|
+
type OmitKey,
|
|
12
|
+
} from '../../../../util'
|
|
13
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
14
|
+
|
|
15
|
+
const is$typed = _is$typed,
|
|
16
|
+
validate = _validate
|
|
17
|
+
const id = 'app.bsky.unspecced.getSuggestedUsersSkeleton'
|
|
18
|
+
|
|
19
|
+
export interface QueryParams {
|
|
20
|
+
/** DID of the account making the request (not included for public/unauthenticated queries). */
|
|
21
|
+
viewer?: string
|
|
22
|
+
/** Category of users to get suggestions for. */
|
|
23
|
+
category?: string
|
|
24
|
+
limit: number
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type InputSchema = undefined
|
|
28
|
+
|
|
29
|
+
export interface OutputSchema {
|
|
30
|
+
dids: string[]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type HandlerInput = undefined
|
|
34
|
+
|
|
35
|
+
export interface HandlerSuccess {
|
|
36
|
+
encoding: 'application/json'
|
|
37
|
+
body: OutputSchema
|
|
38
|
+
headers?: { [key: string]: string }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface HandlerError {
|
|
42
|
+
status: number
|
|
43
|
+
message?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
|
47
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
48
|
+
auth: HA
|
|
49
|
+
params: QueryParams
|
|
50
|
+
input: HandlerInput
|
|
51
|
+
req: express.Request
|
|
52
|
+
res: express.Response
|
|
53
|
+
resetRouteRateLimits: () => Promise<void>
|
|
54
|
+
}
|
|
55
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
56
|
+
ctx: HandlerReqCtx<HA>,
|
|
57
|
+
) => Promise<HandlerOutput> | HandlerOutput
|