@atproto/pds 0.4.136 → 0.4.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.
@@ -2,12 +2,14 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import express from 'express';
5
+ import { type ValidationResult } from '@atproto/lexicon';
5
6
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
6
7
  export interface QueryParams {
7
8
  }
8
9
  export type InputSchema = undefined;
9
10
  export interface OutputSchema {
10
11
  checkEmailConfirmed?: boolean;
12
+ liveNow?: LiveNowConfig[];
11
13
  }
12
14
  export type HandlerInput = undefined;
13
15
  export interface HandlerSuccess {
@@ -31,4 +33,11 @@ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
31
33
  resetRouteRateLimits: () => Promise<void>;
32
34
  };
33
35
  export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
36
+ export interface LiveNowConfig {
37
+ $type?: 'app.bsky.unspecced.getConfig#liveNowConfig';
38
+ did: string;
39
+ domains: string[];
40
+ }
41
+ export declare function isLiveNowConfig<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.unspecced.getConfig", "liveNowConfig">;
42
+ export declare function validateLiveNowConfig<V>(v: V): ValidationResult<LiveNowConfig & V>;
34
43
  //# sourceMappingURL=getConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getConfig.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getConfig.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;CAAG;AAE/B,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,mBAAmB,CAAC,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}
@@ -1,7 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isLiveNowConfig = isLiveNowConfig;
4
+ exports.validateLiveNowConfig = validateLiveNowConfig;
3
5
  const lexicons_1 = require("../../../../lexicons");
4
6
  const util_1 = require("../../../../util");
5
7
  const is$typed = util_1.is$typed, validate = lexicons_1.validate;
6
8
  const id = 'app.bsky.unspecced.getConfig';
9
+ const hashLiveNowConfig = 'liveNowConfig';
10
+ function isLiveNowConfig(v) {
11
+ return is$typed(v, id, hashLiveNowConfig);
12
+ }
13
+ function validateLiveNowConfig(v) {
14
+ return validate(v, id, hashLiveNowConfig);
15
+ }
7
16
  //# sourceMappingURL=getConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getConfig.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getConfig.ts"],"names":[],"mappings":";;AAMA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,8BAA8B,CAAA"}
1
+ {"version":3,"file":"getConfig.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getConfig.ts"],"names":[],"mappings":";;AA6DA,0CAEC;AAED,sDAEC;AA7DD,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,8BAA8B,CAAA;AA2CzC,MAAM,iBAAiB,GAAG,eAAe,CAAA;AAEzC,SAAgB,eAAe,CAAI,CAAI;IACrC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAC3C,CAAC;AAED,SAAgB,qBAAqB,CAAI,CAAI;IAC3C,OAAO,QAAQ,CAAoB,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAC9D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/pds",
3
- "version": "0.4.136",
3
+ "version": "0.4.137",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of atproto Personal Data Server (PDS)",
6
6
  "keywords": [
@@ -49,7 +49,7 @@
49
49
  "zod": "^3.23.8",
50
50
  "@atproto-labs/fetch-node": "0.1.8",
51
51
  "@atproto-labs/xrpc-utils": "0.0.14",
52
- "@atproto/api": "^0.15.6",
52
+ "@atproto/api": "^0.15.7",
53
53
  "@atproto/aws": "^0.2.21",
54
54
  "@atproto/common": "^0.4.11",
55
55
  "@atproto/crypto": "^0.4.4",
@@ -77,9 +77,9 @@
77
77
  "ts-node": "^10.8.2",
78
78
  "typescript": "^5.6.3",
79
79
  "ws": "^8.12.0",
80
- "@atproto/api": "^0.15.6",
81
- "@atproto/bsky": "^0.0.148",
82
- "@atproto/dev-env": "^0.3.130",
80
+ "@atproto/api": "^0.15.7",
81
+ "@atproto/bsky": "^0.0.149",
82
+ "@atproto/dev-env": "^0.3.131",
83
83
  "@atproto/lex-cli": "^0.8.1",
84
84
  "@atproto/oauth-client-browser-example": "0.0.3"
85
85
  },
package/src/index.ts CHANGED
@@ -122,7 +122,14 @@ export class PDS {
122
122
  server = API(server, ctx)
123
123
 
124
124
  const app = express()
125
- app.set('trust proxy', ['loopback', 'linklocal', 'uniquelocal'])
125
+ app.set('trust proxy', [
126
+ // e.g. load balancer
127
+ 'loopback',
128
+ 'linklocal',
129
+ 'uniquelocal',
130
+ // e.g. trust x-forwarded-for via entryway ip
131
+ ...getTrustedIps(cfg),
132
+ ])
126
133
  app.use(loggerMiddleware)
127
134
  app.use(compression())
128
135
  app.use(authRoutes.createRouter(ctx)) // Before CORS
@@ -161,3 +168,8 @@ export class PDS {
161
168
  }
162
169
 
163
170
  export default PDS
171
+
172
+ const getTrustedIps = (cfg: ServerConfig) => {
173
+ if (!cfg.rateLimits.enabled) return []
174
+ return cfg.rateLimits.bypassIps ?? []
175
+ }
@@ -108,8 +108,8 @@ import * as AppBskyFeedGetFeedGenerators from './types/app/bsky/feed/getFeedGene
108
108
  import * as AppBskyFeedGetFeedSkeleton from './types/app/bsky/feed/getFeedSkeleton.js'
109
109
  import * as AppBskyFeedGetLikes from './types/app/bsky/feed/getLikes.js'
110
110
  import * as AppBskyFeedGetListFeed from './types/app/bsky/feed/getListFeed.js'
111
- import * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread.js'
112
111
  import * as AppBskyFeedGetPosts from './types/app/bsky/feed/getPosts.js'
112
+ import * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread.js'
113
113
  import * as AppBskyFeedGetQuotes from './types/app/bsky/feed/getQuotes.js'
114
114
  import * as AppBskyFeedGetRepostedBy from './types/app/bsky/feed/getRepostedBy.js'
115
115
  import * as AppBskyFeedGetSuggestedFeeds from './types/app/bsky/feed/getSuggestedFeeds.js'
@@ -1547,25 +1547,25 @@ export class AppBskyFeedNS {
1547
1547
  return this._server.xrpc.method(nsid, cfg)
1548
1548
  }
1549
1549
 
1550
- getPostThread<AV extends AuthVerifier>(
1550
+ getPosts<AV extends AuthVerifier>(
1551
1551
  cfg: ConfigOf<
1552
1552
  AV,
1553
- AppBskyFeedGetPostThread.Handler<ExtractAuth<AV>>,
1554
- AppBskyFeedGetPostThread.HandlerReqCtx<ExtractAuth<AV>>
1553
+ AppBskyFeedGetPosts.Handler<ExtractAuth<AV>>,
1554
+ AppBskyFeedGetPosts.HandlerReqCtx<ExtractAuth<AV>>
1555
1555
  >,
1556
1556
  ) {
1557
- const nsid = 'app.bsky.feed.getPostThread' // @ts-ignore
1557
+ const nsid = 'app.bsky.feed.getPosts' // @ts-ignore
1558
1558
  return this._server.xrpc.method(nsid, cfg)
1559
1559
  }
1560
1560
 
1561
- getPosts<AV extends AuthVerifier>(
1561
+ getPostThread<AV extends AuthVerifier>(
1562
1562
  cfg: ConfigOf<
1563
1563
  AV,
1564
- AppBskyFeedGetPosts.Handler<ExtractAuth<AV>>,
1565
- AppBskyFeedGetPosts.HandlerReqCtx<ExtractAuth<AV>>
1564
+ AppBskyFeedGetPostThread.Handler<ExtractAuth<AV>>,
1565
+ AppBskyFeedGetPostThread.HandlerReqCtx<ExtractAuth<AV>>
1566
1566
  >,
1567
1567
  ) {
1568
- const nsid = 'app.bsky.feed.getPosts' // @ts-ignore
1568
+ const nsid = 'app.bsky.feed.getPostThread' // @ts-ignore
1569
1569
  return this._server.xrpc.method(nsid, cfg)
1570
1570
  }
1571
1571
 
@@ -7213,6 +7213,48 @@ export const schemaDict = {
7213
7213
  },
7214
7214
  },
7215
7215
  },
7216
+ AppBskyFeedGetPosts: {
7217
+ lexicon: 1,
7218
+ id: 'app.bsky.feed.getPosts',
7219
+ defs: {
7220
+ main: {
7221
+ type: 'query',
7222
+ description:
7223
+ "Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
7224
+ parameters: {
7225
+ type: 'params',
7226
+ required: ['uris'],
7227
+ properties: {
7228
+ uris: {
7229
+ type: 'array',
7230
+ description: 'List of post AT-URIs to return hydrated views for.',
7231
+ items: {
7232
+ type: 'string',
7233
+ format: 'at-uri',
7234
+ },
7235
+ maxLength: 25,
7236
+ },
7237
+ },
7238
+ },
7239
+ output: {
7240
+ encoding: 'application/json',
7241
+ schema: {
7242
+ type: 'object',
7243
+ required: ['posts'],
7244
+ properties: {
7245
+ posts: {
7246
+ type: 'array',
7247
+ items: {
7248
+ type: 'ref',
7249
+ ref: 'lex:app.bsky.feed.defs#postView',
7250
+ },
7251
+ },
7252
+ },
7253
+ },
7254
+ },
7255
+ },
7256
+ },
7257
+ },
7216
7258
  AppBskyFeedGetPostThread: {
7217
7259
  lexicon: 1,
7218
7260
  id: 'app.bsky.feed.getPostThread',
@@ -7277,48 +7319,6 @@ export const schemaDict = {
7277
7319
  },
7278
7320
  },
7279
7321
  },
7280
- AppBskyFeedGetPosts: {
7281
- lexicon: 1,
7282
- id: 'app.bsky.feed.getPosts',
7283
- defs: {
7284
- main: {
7285
- type: 'query',
7286
- description:
7287
- "Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
7288
- parameters: {
7289
- type: 'params',
7290
- required: ['uris'],
7291
- properties: {
7292
- uris: {
7293
- type: 'array',
7294
- description: 'List of post AT-URIs to return hydrated views for.',
7295
- items: {
7296
- type: 'string',
7297
- format: 'at-uri',
7298
- },
7299
- maxLength: 25,
7300
- },
7301
- },
7302
- },
7303
- output: {
7304
- encoding: 'application/json',
7305
- schema: {
7306
- type: 'object',
7307
- required: ['posts'],
7308
- properties: {
7309
- posts: {
7310
- type: 'array',
7311
- items: {
7312
- type: 'ref',
7313
- ref: 'lex:app.bsky.feed.defs#postView',
7314
- },
7315
- },
7316
- },
7317
- },
7318
- },
7319
- },
7320
- },
7321
- },
7322
7322
  AppBskyFeedGetQuotes: {
7323
7323
  lexicon: 1,
7324
7324
  id: 'app.bsky.feed.getQuotes',
@@ -10183,6 +10183,29 @@ export const schemaDict = {
10183
10183
  checkEmailConfirmed: {
10184
10184
  type: 'boolean',
10185
10185
  },
10186
+ liveNow: {
10187
+ type: 'array',
10188
+ items: {
10189
+ type: 'ref',
10190
+ ref: 'lex:app.bsky.unspecced.getConfig#liveNowConfig',
10191
+ },
10192
+ },
10193
+ },
10194
+ },
10195
+ },
10196
+ },
10197
+ liveNowConfig: {
10198
+ type: 'object',
10199
+ required: ['did', 'domains'],
10200
+ properties: {
10201
+ did: {
10202
+ type: 'string',
10203
+ format: 'did',
10204
+ },
10205
+ domains: {
10206
+ type: 'array',
10207
+ items: {
10208
+ type: 'string',
10186
10209
  },
10187
10210
  },
10188
10211
  },
@@ -16216,8 +16239,8 @@ export const ids = {
16216
16239
  AppBskyFeedGetFeedSkeleton: 'app.bsky.feed.getFeedSkeleton',
16217
16240
  AppBskyFeedGetLikes: 'app.bsky.feed.getLikes',
16218
16241
  AppBskyFeedGetListFeed: 'app.bsky.feed.getListFeed',
16219
- AppBskyFeedGetPostThread: 'app.bsky.feed.getPostThread',
16220
16242
  AppBskyFeedGetPosts: 'app.bsky.feed.getPosts',
16243
+ AppBskyFeedGetPostThread: 'app.bsky.feed.getPostThread',
16221
16244
  AppBskyFeedGetQuotes: 'app.bsky.feed.getQuotes',
16222
16245
  AppBskyFeedGetRepostedBy: 'app.bsky.feed.getRepostedBy',
16223
16246
  AppBskyFeedGetSuggestedFeeds: 'app.bsky.feed.getSuggestedFeeds',
@@ -22,6 +22,7 @@ export type InputSchema = undefined
22
22
 
23
23
  export interface OutputSchema {
24
24
  checkEmailConfirmed?: boolean
25
+ liveNow?: LiveNowConfig[]
25
26
  }
26
27
 
27
28
  export type HandlerInput = undefined
@@ -49,3 +50,19 @@ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
49
50
  export type Handler<HA extends HandlerAuth = never> = (
50
51
  ctx: HandlerReqCtx<HA>,
51
52
  ) => Promise<HandlerOutput> | HandlerOutput
53
+
54
+ export interface LiveNowConfig {
55
+ $type?: 'app.bsky.unspecced.getConfig#liveNowConfig'
56
+ did: string
57
+ domains: string[]
58
+ }
59
+
60
+ const hashLiveNowConfig = 'liveNowConfig'
61
+
62
+ export function isLiveNowConfig<V>(v: V) {
63
+ return is$typed(v, id, hashLiveNowConfig)
64
+ }
65
+
66
+ export function validateLiveNowConfig<V>(v: V) {
67
+ return validate<LiveNowConfig & V>(v, id, hashLiveNowConfig)
68
+ }