@atproto/pds 0.4.58 → 0.4.60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/actor-store/repo/sql-repo-reader.d.ts.map +1 -1
  3. package/dist/actor-store/repo/sql-repo-reader.js +2 -5
  4. package/dist/actor-store/repo/sql-repo-reader.js.map +1 -1
  5. package/dist/api/app/bsky/actor/getProfile.d.ts.map +1 -1
  6. package/dist/api/app/bsky/actor/getProfile.js +2 -9
  7. package/dist/api/app/bsky/actor/getProfile.js.map +1 -1
  8. package/dist/api/app/bsky/actor/getProfiles.d.ts.map +1 -1
  9. package/dist/api/app/bsky/actor/getProfiles.js +2 -6
  10. package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
  11. package/dist/api/app/bsky/feed/getActorLikes.d.ts.map +1 -1
  12. package/dist/api/app/bsky/feed/getActorLikes.js +2 -9
  13. package/dist/api/app/bsky/feed/getActorLikes.js.map +1 -1
  14. package/dist/api/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
  15. package/dist/api/app/bsky/feed/getAuthorFeed.js +2 -9
  16. package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
  17. package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
  18. package/dist/api/app/bsky/feed/getFeed.js +2 -1
  19. package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
  20. package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
  21. package/dist/api/app/bsky/feed/getPostThread.js +12 -14
  22. package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
  23. package/dist/api/app/bsky/feed/getTimeline.d.ts.map +1 -1
  24. package/dist/api/app/bsky/feed/getTimeline.js +2 -6
  25. package/dist/api/app/bsky/feed/getTimeline.js.map +1 -1
  26. package/dist/api/com/atproto/repo/getRecord.js +1 -1
  27. package/dist/api/com/atproto/repo/getRecord.js.map +1 -1
  28. package/dist/api/com/atproto/server/requestPasswordReset.js +1 -1
  29. package/dist/api/com/atproto/server/requestPasswordReset.js.map +1 -1
  30. package/dist/config/config.d.ts +9 -0
  31. package/dist/config/config.d.ts.map +1 -1
  32. package/dist/config/config.js +10 -1
  33. package/dist/config/config.js.map +1 -1
  34. package/dist/config/env.d.ts +6 -1
  35. package/dist/config/env.d.ts.map +1 -1
  36. package/dist/config/env.js +8 -1
  37. package/dist/config/env.js.map +1 -1
  38. package/dist/context.d.ts +6 -2
  39. package/dist/context.d.ts.map +1 -1
  40. package/dist/context.js +55 -11
  41. package/dist/context.js.map +1 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +1 -0
  44. package/dist/index.js.map +1 -1
  45. package/dist/lexicon/lexicons.d.ts +77 -0
  46. package/dist/lexicon/lexicons.d.ts.map +1 -1
  47. package/dist/lexicon/lexicons.js +86 -3
  48. package/dist/lexicon/lexicons.js.map +1 -1
  49. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +16 -0
  50. package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
  51. package/dist/lexicon/types/app/bsky/actor/defs.js +9 -1
  52. package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
  53. package/dist/lexicon/types/app/bsky/actor/profile.d.ts +1 -0
  54. package/dist/lexicon/types/app/bsky/actor/profile.d.ts.map +1 -1
  55. package/dist/lexicon/types/app/bsky/actor/profile.js.map +1 -1
  56. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +13 -2
  57. package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
  58. package/dist/lexicon/types/app/bsky/feed/defs.js +21 -1
  59. package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
  60. package/dist/lexicon/types/app/bsky/feed/getAuthorFeed.d.ts +1 -0
  61. package/dist/lexicon/types/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
  62. package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +2 -0
  63. package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +1 -1
  64. package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts +2 -0
  65. package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts.map +1 -1
  66. package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts +2 -0
  67. package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts.map +1 -1
  68. package/dist/lexicon/types/tools/ozone/moderation/defs.js.map +1 -1
  69. package/dist/lexicon/types/tools/ozone/moderation/queryStatuses.d.ts +3 -0
  70. package/dist/lexicon/types/tools/ozone/moderation/queryStatuses.d.ts.map +1 -1
  71. package/dist/mailer/index.d.ts +1 -1
  72. package/dist/mailer/index.d.ts.map +1 -1
  73. package/dist/mailer/index.js.map +1 -1
  74. package/dist/mailer/templates/confirm-email.js +1 -1
  75. package/dist/mailer/templates/confirm-email.js.map +2 -2
  76. package/dist/mailer/templates/delete-account.js +1 -1
  77. package/dist/mailer/templates/delete-account.js.map +2 -2
  78. package/dist/mailer/templates/plc-operation.js +1 -1
  79. package/dist/mailer/templates/plc-operation.js.map +2 -2
  80. package/dist/mailer/templates/reset-password.js +1 -1
  81. package/dist/mailer/templates/reset-password.js.map +2 -2
  82. package/dist/mailer/templates/update-email.js +1 -1
  83. package/dist/mailer/templates/update-email.js.map +2 -2
  84. package/dist/pipethrough.d.ts +26 -26
  85. package/dist/pipethrough.d.ts.map +1 -1
  86. package/dist/pipethrough.js +328 -228
  87. package/dist/pipethrough.js.map +1 -1
  88. package/dist/read-after-write/util.d.ts +13 -5
  89. package/dist/read-after-write/util.d.ts.map +1 -1
  90. package/dist/read-after-write/util.js +37 -22
  91. package/dist/read-after-write/util.js.map +1 -1
  92. package/package.json +16 -15
  93. package/src/actor-store/repo/sql-repo-reader.ts +3 -6
  94. package/src/api/app/bsky/actor/getProfile.ts +3 -17
  95. package/src/api/app/bsky/actor/getProfiles.ts +3 -15
  96. package/src/api/app/bsky/feed/getActorLikes.ts +3 -19
  97. package/src/api/app/bsky/feed/getAuthorFeed.ts +3 -17
  98. package/src/api/app/bsky/feed/getFeed.ts +3 -1
  99. package/src/api/app/bsky/feed/getPostThread.ts +16 -23
  100. package/src/api/app/bsky/feed/getTimeline.ts +3 -14
  101. package/src/api/com/atproto/repo/getRecord.ts +1 -1
  102. package/src/api/com/atproto/server/requestPasswordReset.ts +1 -1
  103. package/src/config/config.ts +21 -1
  104. package/src/config/env.ts +20 -2
  105. package/src/context.ts +62 -17
  106. package/src/index.ts +1 -0
  107. package/src/lexicon/lexicons.ts +92 -3
  108. package/src/lexicon/types/app/bsky/actor/defs.ts +25 -0
  109. package/src/lexicon/types/app/bsky/actor/profile.ts +1 -0
  110. package/src/lexicon/types/app/bsky/feed/defs.ts +38 -2
  111. package/src/lexicon/types/app/bsky/feed/getAuthorFeed.ts +1 -0
  112. package/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts +2 -0
  113. package/src/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.ts +2 -0
  114. package/src/lexicon/types/tools/ozone/moderation/defs.ts +2 -0
  115. package/src/lexicon/types/tools/ozone/moderation/queryStatuses.ts +3 -0
  116. package/src/mailer/index.ts +1 -1
  117. package/src/mailer/templates/confirm-email.hbs +106 -336
  118. package/src/mailer/templates/delete-account.hbs +110 -346
  119. package/src/mailer/templates/plc-operation.hbs +107 -338
  120. package/src/mailer/templates/reset-password.d.ts +1 -1
  121. package/src/mailer/templates/reset-password.hbs +108 -344
  122. package/src/mailer/templates/update-email.hbs +107 -337
  123. package/src/pipethrough.ts +489 -233
  124. package/src/read-after-write/util.ts +58 -32
  125. package/tests/account-deletion.test.ts +1 -1
  126. package/tests/account.test.ts +2 -2
  127. package/tests/email-confirmation.test.ts +2 -2
  128. package/tests/plc-operations.test.ts +1 -1
  129. package/tests/proxied/proxy-catchall.test.ts +255 -0
  130. package/tests/proxied/proxy-header.test.ts +31 -1
package/src/context.ts CHANGED
@@ -1,23 +1,28 @@
1
1
  import assert from 'node:assert'
2
+ import * as undici from 'undici'
2
3
  import * as nodemailer from 'nodemailer'
3
4
  import { Redis } from 'ioredis'
4
5
  import * as plc from '@did-plc/lib'
6
+ import {
7
+ Fetch,
8
+ isUnicastIp,
9
+ loggedFetch,
10
+ safeFetchWrap,
11
+ unicastLookup,
12
+ } from '@atproto-labs/fetch-node'
5
13
  import * as crypto from '@atproto/crypto'
6
14
  import { IdResolver } from '@atproto/identity'
7
15
  import { AtpAgent } from '@atproto/api'
8
16
  import { KmsKeypair, S3BlobStore } from '@atproto/aws'
17
+ import { JoseKey, OAuthVerifier } from '@atproto/oauth-provider'
18
+ import { BlobStore } from '@atproto/repo'
9
19
  import {
10
20
  RateLimiter,
11
21
  RateLimiterCreator,
12
22
  RateLimiterOpts,
13
23
  createServiceAuthHeaders,
24
+ createServiceJwt,
14
25
  } from '@atproto/xrpc-server'
15
- import {
16
- JoseKey,
17
- Fetch,
18
- safeFetchWrap,
19
- OAuthVerifier,
20
- } from '@atproto/oauth-provider'
21
26
 
22
27
  import { ServerConfig, ServerSecrets } from './config'
23
28
  import { PdsOAuthProvider } from './oauth/provider'
@@ -29,7 +34,6 @@ import {
29
34
  import { fetchLogger } from './logger'
30
35
  import { ServerMailer } from './mailer'
31
36
  import { ModerationMailer } from './mailer/moderation'
32
- import { BlobStore } from '@atproto/repo'
33
37
  import { AccountManager } from './account-manager'
34
38
  import { Sequencer } from './sequencer'
35
39
  import { BackgroundQueue } from './background'
@@ -59,6 +63,7 @@ export type AppContextOptions = {
59
63
  moderationAgent?: AtpAgent
60
64
  reportingAgent?: AtpAgent
61
65
  entrywayAgent?: AtpAgent
66
+ proxyAgent: undici.Agent
62
67
  safeFetch: Fetch
63
68
  authProvider?: PdsOAuthProvider
64
69
  authVerifier: AuthVerifier
@@ -85,6 +90,7 @@ export class AppContext {
85
90
  public moderationAgent: AtpAgent | undefined
86
91
  public reportingAgent: AtpAgent | undefined
87
92
  public entrywayAgent: AtpAgent | undefined
93
+ public proxyAgent: undici.Agent
88
94
  public safeFetch: Fetch
89
95
  public authVerifier: AuthVerifier
90
96
  public authProvider?: PdsOAuthProvider
@@ -110,6 +116,7 @@ export class AppContext {
110
116
  this.moderationAgent = opts.moderationAgent
111
117
  this.reportingAgent = opts.reportingAgent
112
118
  this.entrywayAgent = opts.entrywayAgent
119
+ this.proxyAgent = opts.proxyAgent
113
120
  this.safeFetch = opts.safeFetch
114
121
  this.authVerifier = opts.authVerifier
115
122
  this.authProvider = opts.authProvider
@@ -256,20 +263,47 @@ export class AppContext {
256
263
  appviewCdnUrlPattern: cfg.bskyAppView?.cdnUrlPattern,
257
264
  })
258
265
 
266
+ // An agent for performing HTTP requests based on user provided URLs.
267
+ const proxyAgent = new undici.Agent({
268
+ allowH2: cfg.proxy.allowHTTP2, // This is experimental
269
+ headersTimeout: cfg.proxy.headersTimeout,
270
+ maxResponseSize: cfg.proxy.maxResponseSize,
271
+ bodyTimeout: cfg.proxy.bodyTimeout,
272
+ factory: cfg.proxy.disableSsrfProtection
273
+ ? undefined
274
+ : (origin, opts) => {
275
+ const { protocol, hostname } =
276
+ origin instanceof URL ? origin : new URL(origin)
277
+ if (protocol !== 'https:') {
278
+ throw new Error(`Forbidden protocol "${protocol}"`)
279
+ }
280
+ if (isUnicastIp(hostname) === false) {
281
+ throw new Error('Hostname resolved to non-unicast address')
282
+ }
283
+ return new undici.Pool(origin, opts)
284
+ },
285
+ connect: {
286
+ lookup: cfg.proxy.disableSsrfProtection ? undefined : unicastLookup,
287
+ },
288
+ })
289
+
259
290
  // A fetch() function that protects against SSRF attacks, large responses &
260
291
  // known bad domains. This function can safely be used to fetch user
261
292
  // provided URLs (unless "disableSsrfProtection" is true, of course).
262
- const safeFetch = safeFetchWrap({
263
- allowHttp: cfg.fetch.disableSsrfProtection,
264
- responseMaxSize: 512 * 1024, // 512kB
265
- ssrfProtection: !cfg.fetch.disableSsrfProtection,
266
- fetch: async (input, init) => {
267
- const request = input instanceof Request ? input : null
268
- const method = init?.method ?? request?.method ?? 'GET'
269
- const uri = request?.url ?? String(input)
270
- fetchLogger.debug({ method, uri }, 'fetch')
271
- return globalThis.fetch(input, init)
293
+ const safeFetch = loggedFetch({
294
+ fetch: safeFetchWrap({
295
+ // Using globalThis.fetch allows safeFetchWrap to use keep-alive. See
296
+ // unicastFetchWrap().
297
+ fetch: globalThis.fetch,
298
+ allowIpHost: false,
299
+ responseMaxSize: cfg.fetch.maxResponseSize,
300
+ ssrfProtection: !cfg.fetch.disableSsrfProtection,
301
+ }),
302
+ logRequest: ({ method, url }) => {
303
+ fetchLogger.debug({ method, uri: url }, 'fetch')
272
304
  },
305
+ logResponse: false,
306
+ logError: false,
273
307
  })
274
308
 
275
309
  const authProvider = cfg.oauth.provider
@@ -333,6 +367,7 @@ export class AppContext {
333
367
  moderationAgent,
334
368
  reportingAgent,
335
369
  entrywayAgent,
370
+ proxyAgent,
336
371
  safeFetch,
337
372
  authVerifier,
338
373
  authProvider,
@@ -356,6 +391,16 @@ export class AppContext {
356
391
  keypair,
357
392
  })
358
393
  }
394
+
395
+ async serviceAuthJwt(did: string, aud: string, lxm: string) {
396
+ const keypair = await this.actorStore.keypair(did)
397
+ return createServiceJwt({
398
+ iss: did,
399
+ aud,
400
+ lxm,
401
+ keypair,
402
+ })
403
+ }
359
404
  }
360
405
 
361
406
  export default AppContext
package/src/index.ts CHANGED
@@ -127,6 +127,7 @@ export class PDS {
127
127
  await this.ctx.backgroundQueue.destroy()
128
128
  await this.ctx.accountManager.close()
129
129
  await this.ctx.redisScratch?.quit()
130
+ await this.ctx.proxyAgent.destroy()
130
131
  clearInterval(this.dbStatsInterval)
131
132
  clearInterval(this.sequencerStatsInterval)
132
133
  }
@@ -4190,6 +4190,10 @@ export const schemaDict = {
4190
4190
  ref: 'lex:com.atproto.label.defs#label',
4191
4191
  },
4192
4192
  },
4193
+ pinnedPost: {
4194
+ type: 'ref',
4195
+ ref: 'lex:com.atproto.repo.strongRef',
4196
+ },
4193
4197
  },
4194
4198
  },
4195
4199
  profileAssociated: {
@@ -4572,6 +4576,15 @@ export const schemaDict = {
4572
4576
  maxLength: 100,
4573
4577
  },
4574
4578
  },
4579
+ nuxs: {
4580
+ description: 'Storage for NUXs the user has encountered.',
4581
+ type: 'array',
4582
+ maxLength: 100,
4583
+ items: {
4584
+ type: 'ref',
4585
+ ref: 'lex:app.bsky.actor.defs#nux',
4586
+ },
4587
+ },
4575
4588
  },
4576
4589
  },
4577
4590
  bskyAppProgressGuide: {
@@ -4586,6 +4599,34 @@ export const schemaDict = {
4586
4599
  },
4587
4600
  },
4588
4601
  },
4602
+ nux: {
4603
+ type: 'object',
4604
+ description: 'A new user experiences (NUX) storage object',
4605
+ required: ['id', 'completed'],
4606
+ properties: {
4607
+ id: {
4608
+ type: 'string',
4609
+ maxLength: 100,
4610
+ },
4611
+ completed: {
4612
+ type: 'boolean',
4613
+ default: false,
4614
+ },
4615
+ data: {
4616
+ description:
4617
+ 'Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters.',
4618
+ type: 'string',
4619
+ maxLength: 3000,
4620
+ maxGraphemes: 300,
4621
+ },
4622
+ expiresAt: {
4623
+ type: 'string',
4624
+ format: 'datetime',
4625
+ description:
4626
+ 'The date and time at which the NUX will expire and should be considered completed.',
4627
+ },
4628
+ },
4629
+ },
4589
4630
  },
4590
4631
  },
4591
4632
  AppBskyActorGetPreferences: {
@@ -4775,6 +4816,10 @@ export const schemaDict = {
4775
4816
  type: 'ref',
4776
4817
  ref: 'lex:com.atproto.repo.strongRef',
4777
4818
  },
4819
+ pinnedPost: {
4820
+ type: 'ref',
4821
+ ref: 'lex:com.atproto.repo.strongRef',
4822
+ },
4778
4823
  createdAt: {
4779
4824
  type: 'string',
4780
4825
  format: 'datetime',
@@ -5431,6 +5476,9 @@ export const schemaDict = {
5431
5476
  embeddingDisabled: {
5432
5477
  type: 'boolean',
5433
5478
  },
5479
+ pinned: {
5480
+ type: 'boolean',
5481
+ },
5434
5482
  },
5435
5483
  },
5436
5484
  feedViewPost: {
@@ -5447,7 +5495,10 @@ export const schemaDict = {
5447
5495
  },
5448
5496
  reason: {
5449
5497
  type: 'union',
5450
- refs: ['lex:app.bsky.feed.defs#reasonRepost'],
5498
+ refs: [
5499
+ 'lex:app.bsky.feed.defs#reasonRepost',
5500
+ 'lex:app.bsky.feed.defs#reasonPin',
5501
+ ],
5451
5502
  },
5452
5503
  feedContext: {
5453
5504
  type: 'string',
@@ -5499,6 +5550,10 @@ export const schemaDict = {
5499
5550
  },
5500
5551
  },
5501
5552
  },
5553
+ reasonPin: {
5554
+ type: 'object',
5555
+ properties: {},
5556
+ },
5502
5557
  threadViewPost: {
5503
5558
  type: 'object',
5504
5559
  required: ['post'],
@@ -5656,7 +5711,10 @@ export const schemaDict = {
5656
5711
  },
5657
5712
  reason: {
5658
5713
  type: 'union',
5659
- refs: ['lex:app.bsky.feed.defs#skeletonReasonRepost'],
5714
+ refs: [
5715
+ 'lex:app.bsky.feed.defs#skeletonReasonRepost',
5716
+ 'lex:app.bsky.feed.defs#skeletonReasonPin',
5717
+ ],
5660
5718
  },
5661
5719
  feedContext: {
5662
5720
  type: 'string',
@@ -5676,6 +5734,10 @@ export const schemaDict = {
5676
5734
  },
5677
5735
  },
5678
5736
  },
5737
+ skeletonReasonPin: {
5738
+ type: 'object',
5739
+ properties: {},
5740
+ },
5679
5741
  threadgateView: {
5680
5742
  type: 'object',
5681
5743
  properties: {
@@ -6041,6 +6103,10 @@ export const schemaDict = {
6041
6103
  ],
6042
6104
  default: 'posts_with_replies',
6043
6105
  },
6106
+ includePins: {
6107
+ type: 'boolean',
6108
+ default: false,
6109
+ },
6044
6110
  },
6045
6111
  },
6046
6112
  output: {
@@ -7125,7 +7191,7 @@ export const schemaDict = {
7125
7191
  type: 'record',
7126
7192
  key: 'tid',
7127
7193
  description:
7128
- "Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository..",
7194
+ "Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository.",
7129
7195
  record: {
7130
7196
  type: 'object',
7131
7197
  required: ['post', 'createdAt'],
@@ -8199,6 +8265,12 @@ export const schemaDict = {
8199
8265
  ref: 'lex:app.bsky.actor.defs#profileView',
8200
8266
  },
8201
8267
  },
8268
+ isFallback: {
8269
+ type: 'boolean',
8270
+ description:
8271
+ 'If true, response has fallen-back to generic results, and is not scoped using relativeToDid',
8272
+ default: false,
8273
+ },
8202
8274
  },
8203
8275
  },
8204
8276
  },
@@ -9155,6 +9227,12 @@ export const schemaDict = {
9155
9227
  ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor',
9156
9228
  },
9157
9229
  },
9230
+ relativeToDid: {
9231
+ type: 'string',
9232
+ format: 'did',
9233
+ description:
9234
+ 'DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer.',
9235
+ },
9158
9236
  },
9159
9237
  },
9160
9238
  },
@@ -10920,6 +10998,11 @@ export const schemaDict = {
10920
10998
  description:
10921
10999
  'Indicates how long the takedown should be in effect before automatically expiring.',
10922
11000
  },
11001
+ acknowledgeAccountSubjects: {
11002
+ type: 'boolean',
11003
+ description:
11004
+ 'If true, all other reports on content authored by this account will be resolved (acknowledged).',
11005
+ },
10923
11006
  },
10924
11007
  },
10925
11008
  modEventReverseTakedown: {
@@ -11731,9 +11814,15 @@ export const schemaDict = {
11731
11814
  parameters: {
11732
11815
  type: 'params',
11733
11816
  properties: {
11817
+ includeAllUserRecords: {
11818
+ type: 'boolean',
11819
+ description:
11820
+ "All subjects belonging to the account specified in the 'subject' param will be returned.",
11821
+ },
11734
11822
  subject: {
11735
11823
  type: 'string',
11736
11824
  format: 'uri',
11825
+ description: 'The subject to get the status for.',
11737
11826
  },
11738
11827
  comment: {
11739
11828
  type: 'string',
@@ -7,6 +7,7 @@ import { isObj, hasProp } from '../../../../util'
7
7
  import { CID } from 'multiformats/cid'
8
8
  import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
9
9
  import * as AppBskyGraphDefs from '../graph/defs'
10
+ import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef'
10
11
 
11
12
  export interface ProfileViewBasic {
12
13
  did: string
@@ -74,6 +75,7 @@ export interface ProfileViewDetailed {
74
75
  createdAt?: string
75
76
  viewer?: ViewerState
76
77
  labels?: ComAtprotoLabelDefs.Label[]
78
+ pinnedPost?: ComAtprotoRepoStrongRef.Main
77
79
  [k: string]: unknown
78
80
  }
79
81
 
@@ -469,6 +471,8 @@ export interface BskyAppStatePref {
469
471
  activeProgressGuide?: BskyAppProgressGuide
470
472
  /** An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. */
471
473
  queuedNudges?: string[]
474
+ /** Storage for NUXs the user has encountered. */
475
+ nuxs?: Nux[]
472
476
  [k: string]: unknown
473
477
  }
474
478
 
@@ -501,3 +505,24 @@ export function isBskyAppProgressGuide(v: unknown): v is BskyAppProgressGuide {
501
505
  export function validateBskyAppProgressGuide(v: unknown): ValidationResult {
502
506
  return lexicons.validate('app.bsky.actor.defs#bskyAppProgressGuide', v)
503
507
  }
508
+
509
+ /** A new user experiences (NUX) storage object */
510
+ export interface Nux {
511
+ id: string
512
+ completed: boolean
513
+ /** Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. */
514
+ data?: string
515
+ /** The date and time at which the NUX will expire and should be considered completed. */
516
+ expiresAt?: string
517
+ [k: string]: unknown
518
+ }
519
+
520
+ export function isNux(v: unknown): v is Nux {
521
+ return (
522
+ isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.actor.defs#nux'
523
+ )
524
+ }
525
+
526
+ export function validateNux(v: unknown): ValidationResult {
527
+ return lexicons.validate('app.bsky.actor.defs#nux', v)
528
+ }
@@ -20,6 +20,7 @@ export interface Record {
20
20
  | ComAtprotoLabelDefs.SelfLabels
21
21
  | { $type: string; [k: string]: unknown }
22
22
  joinedViaStarterPack?: ComAtprotoRepoStrongRef.Main
23
+ pinnedPost?: ComAtprotoRepoStrongRef.Main
23
24
  createdAt?: string
24
25
  [k: string]: unknown
25
26
  }
@@ -55,6 +55,7 @@ export interface ViewerState {
55
55
  threadMuted?: boolean
56
56
  replyDisabled?: boolean
57
57
  embeddingDisabled?: boolean
58
+ pinned?: boolean
58
59
  [k: string]: unknown
59
60
  }
60
61
 
@@ -73,7 +74,7 @@ export function validateViewerState(v: unknown): ValidationResult {
73
74
  export interface FeedViewPost {
74
75
  post: PostView
75
76
  reply?: ReplyRef
76
- reason?: ReasonRepost | { $type: string; [k: string]: unknown }
77
+ reason?: ReasonRepost | ReasonPin | { $type: string; [k: string]: unknown }
77
78
  /** Context provided by feed generator that may be passed back alongside interactions. */
78
79
  feedContext?: string
79
80
  [k: string]: unknown
@@ -134,6 +135,22 @@ export function validateReasonRepost(v: unknown): ValidationResult {
134
135
  return lexicons.validate('app.bsky.feed.defs#reasonRepost', v)
135
136
  }
136
137
 
138
+ export interface ReasonPin {
139
+ [k: string]: unknown
140
+ }
141
+
142
+ export function isReasonPin(v: unknown): v is ReasonPin {
143
+ return (
144
+ isObj(v) &&
145
+ hasProp(v, '$type') &&
146
+ v.$type === 'app.bsky.feed.defs#reasonPin'
147
+ )
148
+ }
149
+
150
+ export function validateReasonPin(v: unknown): ValidationResult {
151
+ return lexicons.validate('app.bsky.feed.defs#reasonPin', v)
152
+ }
153
+
137
154
  export interface ThreadViewPost {
138
155
  post: PostView
139
156
  parent?:
@@ -265,7 +282,10 @@ export function validateGeneratorViewerState(v: unknown): ValidationResult {
265
282
 
266
283
  export interface SkeletonFeedPost {
267
284
  post: string
268
- reason?: SkeletonReasonRepost | { $type: string; [k: string]: unknown }
285
+ reason?:
286
+ | SkeletonReasonRepost
287
+ | SkeletonReasonPin
288
+ | { $type: string; [k: string]: unknown }
269
289
  /** Context that will be passed through to client and may be passed to feed generator back alongside interactions. */
270
290
  feedContext?: string
271
291
  [k: string]: unknown
@@ -300,6 +320,22 @@ export function validateSkeletonReasonRepost(v: unknown): ValidationResult {
300
320
  return lexicons.validate('app.bsky.feed.defs#skeletonReasonRepost', v)
301
321
  }
302
322
 
323
+ export interface SkeletonReasonPin {
324
+ [k: string]: unknown
325
+ }
326
+
327
+ export function isSkeletonReasonPin(v: unknown): v is SkeletonReasonPin {
328
+ return (
329
+ isObj(v) &&
330
+ hasProp(v, '$type') &&
331
+ v.$type === 'app.bsky.feed.defs#skeletonReasonPin'
332
+ )
333
+ }
334
+
335
+ export function validateSkeletonReasonPin(v: unknown): ValidationResult {
336
+ return lexicons.validate('app.bsky.feed.defs#skeletonReasonPin', v)
337
+ }
338
+
303
339
  export interface ThreadgateView {
304
340
  uri?: string
305
341
  cid?: string
@@ -20,6 +20,7 @@ export interface QueryParams {
20
20
  | 'posts_with_media'
21
21
  | 'posts_and_author_threads'
22
22
  | (string & {})
23
+ includePins: boolean
23
24
  }
24
25
 
25
26
  export type InputSchema = undefined
@@ -17,6 +17,8 @@ export type InputSchema = undefined
17
17
 
18
18
  export interface OutputSchema {
19
19
  suggestions: AppBskyActorDefs.ProfileView[]
20
+ /** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */
21
+ isFallback?: boolean
20
22
  [k: string]: unknown
21
23
  }
22
24
 
@@ -23,6 +23,8 @@ export type InputSchema = undefined
23
23
  export interface OutputSchema {
24
24
  cursor?: string
25
25
  actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]
26
+ /** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */
27
+ relativeToDid?: string
26
28
  [k: string]: unknown
27
29
  }
28
30
 
@@ -162,6 +162,8 @@ export interface ModEventTakedown {
162
162
  comment?: string
163
163
  /** Indicates how long the takedown should be in effect before automatically expiring. */
164
164
  durationInHours?: number
165
+ /** If true, all other reports on content authored by this account will be resolved (acknowledged). */
166
+ acknowledgeAccountSubjects?: boolean
165
167
  [k: string]: unknown
166
168
  }
167
169
 
@@ -10,6 +10,9 @@ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
10
  import * as ToolsOzoneModerationDefs from './defs'
11
11
 
12
12
  export interface QueryParams {
13
+ /** All subjects belonging to the account specified in the 'subject' param will be returned. */
14
+ includeAllUserRecords?: boolean
15
+ /** The subject to get the status for. */
13
16
  subject?: string
14
17
  /** Search subjects by keyword from comments */
15
18
  comment?: string
@@ -21,7 +21,7 @@ export class ServerMailer {
21
21
  }
22
22
 
23
23
  async sendResetPassword(
24
- params: { identifier: string; token: string },
24
+ params: { handle: string; token: string },
25
25
  mailOpts: Mail.Options,
26
26
  ) {
27
27
  return this.sendTemplate('resetPassword', params, {