@atproto/pds 0.3.13 → 0.3.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -114,6 +114,7 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica
114
114
  import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush';
115
115
  import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen';
116
116
  import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators';
117
+ import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions';
117
118
  import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton';
118
119
  import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton';
119
120
  import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton';
@@ -349,6 +350,7 @@ export declare class AppBskyUnspeccedNS {
349
350
  _server: Server;
350
351
  constructor(server: Server);
351
352
  getPopularFeedGenerators<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedGetPopularFeedGenerators.Handler<ExtractAuth<AV>>, AppBskyUnspeccedGetPopularFeedGenerators.HandlerReqCtx<ExtractAuth<AV>>>): void;
353
+ getTaggedSuggestions<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedGetTaggedSuggestions.Handler<ExtractAuth<AV>>, AppBskyUnspeccedGetTaggedSuggestions.HandlerReqCtx<ExtractAuth<AV>>>): void;
352
354
  getTimelineSkeleton<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedGetTimelineSkeleton.Handler<ExtractAuth<AV>>, AppBskyUnspeccedGetTimelineSkeleton.HandlerReqCtx<ExtractAuth<AV>>>): void;
353
355
  searchActorsSkeleton<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedSearchActorsSkeleton.Handler<ExtractAuth<AV>>, AppBskyUnspeccedSearchActorsSkeleton.HandlerReqCtx<ExtractAuth<AV>>>): void;
354
356
  searchPostsSkeleton<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedSearchPostsSkeleton.Handler<ExtractAuth<AV>>, AppBskyUnspeccedSearchPostsSkeleton.HandlerReqCtx<ExtractAuth<AV>>>): void;
@@ -7423,6 +7423,53 @@ export declare const schemaDict: {
7423
7423
  };
7424
7424
  };
7425
7425
  };
7426
+ AppBskyUnspeccedGetTaggedSuggestions: {
7427
+ lexicon: number;
7428
+ id: string;
7429
+ defs: {
7430
+ main: {
7431
+ type: string;
7432
+ description: string;
7433
+ parameters: {
7434
+ type: string;
7435
+ properties: {};
7436
+ };
7437
+ output: {
7438
+ encoding: string;
7439
+ schema: {
7440
+ type: string;
7441
+ required: string[];
7442
+ properties: {
7443
+ suggestions: {
7444
+ type: string;
7445
+ items: {
7446
+ type: string;
7447
+ ref: string;
7448
+ };
7449
+ };
7450
+ };
7451
+ };
7452
+ };
7453
+ };
7454
+ suggestion: {
7455
+ type: string;
7456
+ required: string[];
7457
+ properties: {
7458
+ tag: {
7459
+ type: string;
7460
+ };
7461
+ subjectType: {
7462
+ type: string;
7463
+ knownValues: string[];
7464
+ };
7465
+ subject: {
7466
+ type: string;
7467
+ format: string;
7468
+ };
7469
+ };
7470
+ };
7471
+ };
7472
+ };
7426
7473
  AppBskyUnspeccedGetTimelineSkeleton: {
7427
7474
  lexicon: number;
7428
7475
  id: string;
@@ -7729,6 +7776,7 @@ export declare const ids: {
7729
7776
  AppBskyRichtextFacet: string;
7730
7777
  AppBskyUnspeccedDefs: string;
7731
7778
  AppBskyUnspeccedGetPopularFeedGenerators: string;
7779
+ AppBskyUnspeccedGetTaggedSuggestions: string;
7732
7780
  AppBskyUnspeccedGetTimelineSkeleton: string;
7733
7781
  AppBskyUnspeccedSearchActorsSkeleton: string;
7734
7782
  AppBskyUnspeccedSearchPostsSkeleton: string;
@@ -0,0 +1,39 @@
1
+ import express from 'express';
2
+ import { ValidationResult } from '@atproto/lexicon';
3
+ import { HandlerAuth } from '@atproto/xrpc-server';
4
+ export interface QueryParams {
5
+ }
6
+ export type InputSchema = undefined;
7
+ export interface OutputSchema {
8
+ suggestions: Suggestion[];
9
+ [k: string]: unknown;
10
+ }
11
+ export type HandlerInput = undefined;
12
+ export interface HandlerSuccess {
13
+ encoding: 'application/json';
14
+ body: OutputSchema;
15
+ headers?: {
16
+ [key: string]: string;
17
+ };
18
+ }
19
+ export interface HandlerError {
20
+ status: number;
21
+ message?: string;
22
+ }
23
+ export type HandlerOutput = HandlerError | HandlerSuccess;
24
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
25
+ auth: HA;
26
+ params: QueryParams;
27
+ input: HandlerInput;
28
+ req: express.Request;
29
+ res: express.Response;
30
+ };
31
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
32
+ export interface Suggestion {
33
+ tag: string;
34
+ subjectType: 'actor' | 'feed' | (string & {});
35
+ subject: string;
36
+ [k: string]: unknown;
37
+ }
38
+ export declare function isSuggestion(v: unknown): v is Suggestion;
39
+ export declare function validateSuggestion(v: unknown): ValidationResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/pds",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
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.2",
47
+ "@atproto/api": "^0.9.3",
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.2",
72
- "@atproto/bsky": "^0.0.25",
73
- "@atproto/dev-env": "^0.2.25",
71
+ "@atproto/api": "^0.9.3",
72
+ "@atproto/bsky": "^0.0.26",
73
+ "@atproto/dev-env": "^0.2.26",
74
74
  "@atproto/lex-cli": "^0.3.0"
75
75
  },
76
76
  "scripts": {
@@ -0,0 +1,21 @@
1
+ import { Server } from '../../../../lexicon'
2
+ import AppContext from '../../../../context'
3
+
4
+ // THIS IS A TEMPORARY UNSPECCED ROUTE
5
+ export default function (server: Server, ctx: AppContext) {
6
+ server.app.bsky.unspecced.getTaggedSuggestions({
7
+ auth: ctx.authVerifier.access,
8
+ handler: async ({ auth, params }) => {
9
+ const requester = auth.credentials.did
10
+ const res =
11
+ await ctx.appViewAgent.api.app.bsky.unspecced.getTaggedSuggestions(
12
+ params,
13
+ await ctx.appviewAuthHeaders(requester),
14
+ )
15
+ return {
16
+ encoding: 'application/json',
17
+ body: res.data,
18
+ }
19
+ },
20
+ })
21
+ }
@@ -1,8 +1,10 @@
1
1
  import { Server } from '../../../../lexicon'
2
2
  import AppContext from '../../../../context'
3
3
  import getPopularFeedGenerators from './getPopularFeedGenerators'
4
+ import getTaggedSuggestions from './getTaggedSuggestions'
4
5
 
5
6
  // THIS IS A TEMPORARY UNSPECCED ROUTE
6
7
  export default function (server: Server, ctx: AppContext) {
7
8
  getPopularFeedGenerators(server, ctx)
9
+ getTaggedSuggestions(server, ctx)
8
10
  }
@@ -124,6 +124,7 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica
124
124
  import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush'
125
125
  import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
126
126
  import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
127
+ import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
127
128
  import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton'
128
129
  import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
129
130
  import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
@@ -1613,6 +1614,17 @@ export class AppBskyUnspeccedNS {
1613
1614
  return this._server.xrpc.method(nsid, cfg)
1614
1615
  }
1615
1616
 
1617
+ getTaggedSuggestions<AV extends AuthVerifier>(
1618
+ cfg: ConfigOf<
1619
+ AV,
1620
+ AppBskyUnspeccedGetTaggedSuggestions.Handler<ExtractAuth<AV>>,
1621
+ AppBskyUnspeccedGetTaggedSuggestions.HandlerReqCtx<ExtractAuth<AV>>
1622
+ >,
1623
+ ) {
1624
+ const nsid = 'app.bsky.unspecced.getTaggedSuggestions' // @ts-ignore
1625
+ return this._server.xrpc.method(nsid, cfg)
1626
+ }
1627
+
1616
1628
  getTimelineSkeleton<AV extends AuthVerifier>(
1617
1629
  cfg: ConfigOf<
1618
1630
  AV,
@@ -7908,6 +7908,54 @@ export const schemaDict = {
7908
7908
  },
7909
7909
  },
7910
7910
  },
7911
+ AppBskyUnspeccedGetTaggedSuggestions: {
7912
+ lexicon: 1,
7913
+ id: 'app.bsky.unspecced.getTaggedSuggestions',
7914
+ defs: {
7915
+ main: {
7916
+ type: 'query',
7917
+ description:
7918
+ 'Get a list of suggestions (feeds and users) tagged with categories',
7919
+ parameters: {
7920
+ type: 'params',
7921
+ properties: {},
7922
+ },
7923
+ output: {
7924
+ encoding: 'application/json',
7925
+ schema: {
7926
+ type: 'object',
7927
+ required: ['suggestions'],
7928
+ properties: {
7929
+ suggestions: {
7930
+ type: 'array',
7931
+ items: {
7932
+ type: 'ref',
7933
+ ref: 'lex:app.bsky.unspecced.getTaggedSuggestions#suggestion',
7934
+ },
7935
+ },
7936
+ },
7937
+ },
7938
+ },
7939
+ },
7940
+ suggestion: {
7941
+ type: 'object',
7942
+ required: ['tag', 'subjectType', 'subject'],
7943
+ properties: {
7944
+ tag: {
7945
+ type: 'string',
7946
+ },
7947
+ subjectType: {
7948
+ type: 'string',
7949
+ knownValues: ['actor', 'feed'],
7950
+ },
7951
+ subject: {
7952
+ type: 'string',
7953
+ format: 'uri',
7954
+ },
7955
+ },
7956
+ },
7957
+ },
7958
+ },
7911
7959
  AppBskyUnspeccedGetTimelineSkeleton: {
7912
7960
  lexicon: 1,
7913
7961
  id: 'app.bsky.unspecced.getTimelineSkeleton',
@@ -8242,6 +8290,8 @@ export const ids = {
8242
8290
  AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs',
8243
8291
  AppBskyUnspeccedGetPopularFeedGenerators:
8244
8292
  'app.bsky.unspecced.getPopularFeedGenerators',
8293
+ AppBskyUnspeccedGetTaggedSuggestions:
8294
+ 'app.bsky.unspecced.getTaggedSuggestions',
8245
8295
  AppBskyUnspeccedGetTimelineSkeleton: 'app.bsky.unspecced.getTimelineSkeleton',
8246
8296
  AppBskyUnspeccedSearchActorsSkeleton:
8247
8297
  'app.bsky.unspecced.searchActorsSkeleton',
@@ -0,0 +1,65 @@
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
+
11
+ export interface QueryParams {}
12
+
13
+ export type InputSchema = undefined
14
+
15
+ export interface OutputSchema {
16
+ suggestions: Suggestion[]
17
+ [k: string]: unknown
18
+ }
19
+
20
+ export type HandlerInput = undefined
21
+
22
+ export interface HandlerSuccess {
23
+ encoding: 'application/json'
24
+ body: OutputSchema
25
+ headers?: { [key: string]: string }
26
+ }
27
+
28
+ export interface HandlerError {
29
+ status: number
30
+ message?: string
31
+ }
32
+
33
+ export type HandlerOutput = HandlerError | HandlerSuccess
34
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
35
+ auth: HA
36
+ params: QueryParams
37
+ input: HandlerInput
38
+ req: express.Request
39
+ res: express.Response
40
+ }
41
+ export type Handler<HA extends HandlerAuth = never> = (
42
+ ctx: HandlerReqCtx<HA>,
43
+ ) => Promise<HandlerOutput> | HandlerOutput
44
+
45
+ export interface Suggestion {
46
+ tag: string
47
+ subjectType: 'actor' | 'feed' | (string & {})
48
+ subject: string
49
+ [k: string]: unknown
50
+ }
51
+
52
+ export function isSuggestion(v: unknown): v is Suggestion {
53
+ return (
54
+ isObj(v) &&
55
+ hasProp(v, '$type') &&
56
+ v.$type === 'app.bsky.unspecced.getTaggedSuggestions#suggestion'
57
+ )
58
+ }
59
+
60
+ export function validateSuggestion(v: unknown): ValidationResult {
61
+ return lexicons.validate(
62
+ 'app.bsky.unspecced.getTaggedSuggestions#suggestion',
63
+ v,
64
+ )
65
+ }