@atproto/pds 0.4.151 → 0.4.152

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/auth-routes.d.ts +1 -1
  3. package/dist/auth-routes.d.ts.map +1 -1
  4. package/dist/auth-routes.js +13 -3
  5. package/dist/auth-routes.js.map +1 -1
  6. package/dist/lexicon/index.d.ts +6 -2
  7. package/dist/lexicon/index.d.ts.map +1 -1
  8. package/dist/lexicon/index.js +12 -4
  9. package/dist/lexicon/index.js.map +1 -1
  10. package/dist/lexicon/lexicons.d.ts +390 -82
  11. package/dist/lexicon/lexicons.d.ts.map +1 -1
  12. package/dist/lexicon/lexicons.js +199 -42
  13. package/dist/lexicon/lexicons.js.map +1 -1
  14. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +9 -0
  15. package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
  16. package/dist/lexicon/types/app/bsky/actor/defs.js +9 -0
  17. package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
  18. package/dist/lexicon/types/app/bsky/notification/declaration.d.ts +13 -0
  19. package/dist/lexicon/types/app/bsky/notification/declaration.d.ts.map +1 -0
  20. package/dist/lexicon/types/app/bsky/notification/declaration.js +16 -0
  21. package/dist/lexicon/types/app/bsky/notification/declaration.js.map +1 -0
  22. package/dist/lexicon/types/app/bsky/notification/defs.d.ts +15 -0
  23. package/dist/lexicon/types/app/bsky/notification/defs.d.ts.map +1 -1
  24. package/dist/lexicon/types/app/bsky/notification/defs.js +18 -0
  25. package/dist/lexicon/types/app/bsky/notification/defs.js.map +1 -1
  26. package/dist/lexicon/types/app/bsky/notification/listActivitySubscriptions.d.ts +38 -0
  27. package/dist/lexicon/types/app/bsky/notification/listActivitySubscriptions.d.ts.map +1 -0
  28. package/dist/lexicon/types/app/bsky/notification/listActivitySubscriptions.js +7 -0
  29. package/dist/lexicon/types/app/bsky/notification/listActivitySubscriptions.js.map +1 -0
  30. package/dist/lexicon/types/app/bsky/notification/putActivitySubscription.d.ts +42 -0
  31. package/dist/lexicon/types/app/bsky/notification/putActivitySubscription.d.ts.map +1 -0
  32. package/dist/lexicon/types/app/bsky/notification/putActivitySubscription.js +7 -0
  33. package/dist/lexicon/types/app/bsky/notification/putActivitySubscription.js.map +1 -0
  34. package/dist/logger.d.ts +11 -0
  35. package/dist/logger.d.ts.map +1 -1
  36. package/dist/logger.js +7 -5
  37. package/dist/logger.js.map +1 -1
  38. package/package.json +9 -9
  39. package/src/auth-routes.ts +22 -4
  40. package/src/lexicon/index.ts +35 -9
  41. package/src/lexicon/lexicons.ts +207 -43
  42. package/src/lexicon/types/app/bsky/actor/defs.ts +23 -0
  43. package/src/lexicon/types/app/bsky/notification/declaration.ts +32 -0
  44. package/src/lexicon/types/app/bsky/notification/defs.ts +37 -0
  45. package/src/lexicon/types/app/bsky/notification/listActivitySubscriptions.ts +56 -0
  46. package/src/lexicon/types/app/bsky/notification/putActivitySubscription.ts +59 -0
  47. package/src/logger.ts +7 -5
  48. package/tests/oauth.test.ts +16 -19
  49. package/tsconfig.build.tsbuildinfo +1 -1
@@ -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 AppBskyFeedGetPosts from './types/app/bsky/feed/getPosts.js'
112
111
  import * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread.js'
112
+ import * as AppBskyFeedGetPosts from './types/app/bsky/feed/getPosts.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'
@@ -140,7 +140,9 @@ import * as AppBskyGraphUnmuteThread from './types/app/bsky/graph/unmuteThread.j
140
140
  import * as AppBskyLabelerGetServices from './types/app/bsky/labeler/getServices.js'
141
141
  import * as AppBskyNotificationGetPreferences from './types/app/bsky/notification/getPreferences.js'
142
142
  import * as AppBskyNotificationGetUnreadCount from './types/app/bsky/notification/getUnreadCount.js'
143
+ import * as AppBskyNotificationListActivitySubscriptions from './types/app/bsky/notification/listActivitySubscriptions.js'
143
144
  import * as AppBskyNotificationListNotifications from './types/app/bsky/notification/listNotifications.js'
145
+ import * as AppBskyNotificationPutActivitySubscription from './types/app/bsky/notification/putActivitySubscription.js'
144
146
  import * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences.js'
145
147
  import * as AppBskyNotificationPutPreferencesV2 from './types/app/bsky/notification/putPreferencesV2.js'
146
148
  import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush.js'
@@ -1551,25 +1553,25 @@ export class AppBskyFeedNS {
1551
1553
  return this._server.xrpc.method(nsid, cfg)
1552
1554
  }
1553
1555
 
1554
- getPosts<AV extends AuthVerifier>(
1556
+ getPostThread<AV extends AuthVerifier>(
1555
1557
  cfg: ConfigOf<
1556
1558
  AV,
1557
- AppBskyFeedGetPosts.Handler<ExtractAuth<AV>>,
1558
- AppBskyFeedGetPosts.HandlerReqCtx<ExtractAuth<AV>>
1559
+ AppBskyFeedGetPostThread.Handler<ExtractAuth<AV>>,
1560
+ AppBskyFeedGetPostThread.HandlerReqCtx<ExtractAuth<AV>>
1559
1561
  >,
1560
1562
  ) {
1561
- const nsid = 'app.bsky.feed.getPosts' // @ts-ignore
1563
+ const nsid = 'app.bsky.feed.getPostThread' // @ts-ignore
1562
1564
  return this._server.xrpc.method(nsid, cfg)
1563
1565
  }
1564
1566
 
1565
- getPostThread<AV extends AuthVerifier>(
1567
+ getPosts<AV extends AuthVerifier>(
1566
1568
  cfg: ConfigOf<
1567
1569
  AV,
1568
- AppBskyFeedGetPostThread.Handler<ExtractAuth<AV>>,
1569
- AppBskyFeedGetPostThread.HandlerReqCtx<ExtractAuth<AV>>
1570
+ AppBskyFeedGetPosts.Handler<ExtractAuth<AV>>,
1571
+ AppBskyFeedGetPosts.HandlerReqCtx<ExtractAuth<AV>>
1570
1572
  >,
1571
1573
  ) {
1572
- const nsid = 'app.bsky.feed.getPostThread' // @ts-ignore
1574
+ const nsid = 'app.bsky.feed.getPosts' // @ts-ignore
1573
1575
  return this._server.xrpc.method(nsid, cfg)
1574
1576
  }
1575
1577
 
@@ -1927,6 +1929,19 @@ export class AppBskyNotificationNS {
1927
1929
  return this._server.xrpc.method(nsid, cfg)
1928
1930
  }
1929
1931
 
1932
+ listActivitySubscriptions<AV extends AuthVerifier>(
1933
+ cfg: ConfigOf<
1934
+ AV,
1935
+ AppBskyNotificationListActivitySubscriptions.Handler<ExtractAuth<AV>>,
1936
+ AppBskyNotificationListActivitySubscriptions.HandlerReqCtx<
1937
+ ExtractAuth<AV>
1938
+ >
1939
+ >,
1940
+ ) {
1941
+ const nsid = 'app.bsky.notification.listActivitySubscriptions' // @ts-ignore
1942
+ return this._server.xrpc.method(nsid, cfg)
1943
+ }
1944
+
1930
1945
  listNotifications<AV extends AuthVerifier>(
1931
1946
  cfg: ConfigOf<
1932
1947
  AV,
@@ -1938,6 +1953,17 @@ export class AppBskyNotificationNS {
1938
1953
  return this._server.xrpc.method(nsid, cfg)
1939
1954
  }
1940
1955
 
1956
+ putActivitySubscription<AV extends AuthVerifier>(
1957
+ cfg: ConfigOf<
1958
+ AV,
1959
+ AppBskyNotificationPutActivitySubscription.Handler<ExtractAuth<AV>>,
1960
+ AppBskyNotificationPutActivitySubscription.HandlerReqCtx<ExtractAuth<AV>>
1961
+ >,
1962
+ ) {
1963
+ const nsid = 'app.bsky.notification.putActivitySubscription' // @ts-ignore
1964
+ return this._server.xrpc.method(nsid, cfg)
1965
+ }
1966
+
1941
1967
  putPreferences<AV extends AuthVerifier>(
1942
1968
  cfg: ConfigOf<
1943
1969
  AV,
@@ -4732,6 +4732,10 @@ export const schemaDict = {
4732
4732
  type: 'ref',
4733
4733
  ref: 'lex:app.bsky.actor.defs#profileAssociatedChat',
4734
4734
  },
4735
+ activitySubscription: {
4736
+ type: 'ref',
4737
+ ref: 'lex:app.bsky.actor.defs#profileAssociatedActivitySubscription',
4738
+ },
4735
4739
  },
4736
4740
  },
4737
4741
  profileAssociatedChat: {
@@ -4744,6 +4748,16 @@ export const schemaDict = {
4744
4748
  },
4745
4749
  },
4746
4750
  },
4751
+ profileAssociatedActivitySubscription: {
4752
+ type: 'object',
4753
+ required: ['allowSubscriptions'],
4754
+ properties: {
4755
+ allowSubscriptions: {
4756
+ type: 'string',
4757
+ knownValues: ['followers', 'mutuals', 'none'],
4758
+ },
4759
+ },
4760
+ },
4747
4761
  viewerState: {
4748
4762
  type: 'object',
4749
4763
  description:
@@ -4779,6 +4793,10 @@ export const schemaDict = {
4779
4793
  type: 'ref',
4780
4794
  ref: 'lex:app.bsky.actor.defs#knownFollowers',
4781
4795
  },
4796
+ activitySubscription: {
4797
+ type: 'ref',
4798
+ ref: 'lex:app.bsky.notification.defs#activitySubscription',
4799
+ },
4782
4800
  },
4783
4801
  },
4784
4802
  knownFollowers: {
@@ -7239,48 +7257,6 @@ export const schemaDict = {
7239
7257
  },
7240
7258
  },
7241
7259
  },
7242
- AppBskyFeedGetPosts: {
7243
- lexicon: 1,
7244
- id: 'app.bsky.feed.getPosts',
7245
- defs: {
7246
- main: {
7247
- type: 'query',
7248
- description:
7249
- "Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
7250
- parameters: {
7251
- type: 'params',
7252
- required: ['uris'],
7253
- properties: {
7254
- uris: {
7255
- type: 'array',
7256
- description: 'List of post AT-URIs to return hydrated views for.',
7257
- items: {
7258
- type: 'string',
7259
- format: 'at-uri',
7260
- },
7261
- maxLength: 25,
7262
- },
7263
- },
7264
- },
7265
- output: {
7266
- encoding: 'application/json',
7267
- schema: {
7268
- type: 'object',
7269
- required: ['posts'],
7270
- properties: {
7271
- posts: {
7272
- type: 'array',
7273
- items: {
7274
- type: 'ref',
7275
- ref: 'lex:app.bsky.feed.defs#postView',
7276
- },
7277
- },
7278
- },
7279
- },
7280
- },
7281
- },
7282
- },
7283
- },
7284
7260
  AppBskyFeedGetPostThread: {
7285
7261
  lexicon: 1,
7286
7262
  id: 'app.bsky.feed.getPostThread',
@@ -7345,6 +7321,48 @@ export const schemaDict = {
7345
7321
  },
7346
7322
  },
7347
7323
  },
7324
+ AppBskyFeedGetPosts: {
7325
+ lexicon: 1,
7326
+ id: 'app.bsky.feed.getPosts',
7327
+ defs: {
7328
+ main: {
7329
+ type: 'query',
7330
+ description:
7331
+ "Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
7332
+ parameters: {
7333
+ type: 'params',
7334
+ required: ['uris'],
7335
+ properties: {
7336
+ uris: {
7337
+ type: 'array',
7338
+ description: 'List of post AT-URIs to return hydrated views for.',
7339
+ items: {
7340
+ type: 'string',
7341
+ format: 'at-uri',
7342
+ },
7343
+ maxLength: 25,
7344
+ },
7345
+ },
7346
+ },
7347
+ output: {
7348
+ encoding: 'application/json',
7349
+ schema: {
7350
+ type: 'object',
7351
+ required: ['posts'],
7352
+ properties: {
7353
+ posts: {
7354
+ type: 'array',
7355
+ items: {
7356
+ type: 'ref',
7357
+ ref: 'lex:app.bsky.feed.defs#postView',
7358
+ },
7359
+ },
7360
+ },
7361
+ },
7362
+ },
7363
+ },
7364
+ },
7365
+ },
7348
7366
  AppBskyFeedGetQuotes: {
7349
7367
  lexicon: 1,
7350
7368
  id: 'app.bsky.feed.getQuotes',
@@ -9724,6 +9742,30 @@ export const schemaDict = {
9724
9742
  },
9725
9743
  },
9726
9744
  },
9745
+ AppBskyNotificationDeclaration: {
9746
+ lexicon: 1,
9747
+ id: 'app.bsky.notification.declaration',
9748
+ defs: {
9749
+ main: {
9750
+ type: 'record',
9751
+ description:
9752
+ "A declaration of the user's choices related to notifications that can be produced by them.",
9753
+ key: 'literal:self',
9754
+ record: {
9755
+ type: 'object',
9756
+ required: ['allowSubscriptions'],
9757
+ properties: {
9758
+ allowSubscriptions: {
9759
+ type: 'string',
9760
+ description:
9761
+ "A declaration of the user's preference for allowing activity subscriptions from other users. Absence of a record implies 'followers'.",
9762
+ knownValues: ['followers', 'mutuals', 'none'],
9763
+ },
9764
+ },
9765
+ },
9766
+ },
9767
+ },
9768
+ },
9727
9769
  AppBskyNotificationDefs: {
9728
9770
  lexicon: 1,
9729
9771
  id: 'app.bsky.notification.defs',
@@ -9845,6 +9887,34 @@ export const schemaDict = {
9845
9887
  },
9846
9888
  },
9847
9889
  },
9890
+ activitySubscription: {
9891
+ type: 'object',
9892
+ required: ['post', 'reply'],
9893
+ properties: {
9894
+ post: {
9895
+ type: 'boolean',
9896
+ },
9897
+ reply: {
9898
+ type: 'boolean',
9899
+ },
9900
+ },
9901
+ },
9902
+ subjectActivitySubscription: {
9903
+ description:
9904
+ 'Object used to store activity subscription data in stash.',
9905
+ type: 'object',
9906
+ required: ['subject', 'activitySubscription'],
9907
+ properties: {
9908
+ subject: {
9909
+ type: 'string',
9910
+ format: 'did',
9911
+ },
9912
+ activitySubscription: {
9913
+ type: 'ref',
9914
+ ref: 'lex:app.bsky.notification.defs#activitySubscription',
9915
+ },
9916
+ },
9917
+ },
9848
9918
  },
9849
9919
  },
9850
9920
  AppBskyNotificationGetPreferences: {
@@ -9910,6 +9980,50 @@ export const schemaDict = {
9910
9980
  },
9911
9981
  },
9912
9982
  },
9983
+ AppBskyNotificationListActivitySubscriptions: {
9984
+ lexicon: 1,
9985
+ id: 'app.bsky.notification.listActivitySubscriptions',
9986
+ defs: {
9987
+ main: {
9988
+ type: 'query',
9989
+ description:
9990
+ 'Enumerate all accounts to which the requesting account is subscribed to receive notifications for. Requires auth.',
9991
+ parameters: {
9992
+ type: 'params',
9993
+ properties: {
9994
+ limit: {
9995
+ type: 'integer',
9996
+ minimum: 1,
9997
+ maximum: 100,
9998
+ default: 50,
9999
+ },
10000
+ cursor: {
10001
+ type: 'string',
10002
+ },
10003
+ },
10004
+ },
10005
+ output: {
10006
+ encoding: 'application/json',
10007
+ schema: {
10008
+ type: 'object',
10009
+ required: ['subscriptions'],
10010
+ properties: {
10011
+ cursor: {
10012
+ type: 'string',
10013
+ },
10014
+ subscriptions: {
10015
+ type: 'array',
10016
+ items: {
10017
+ type: 'ref',
10018
+ ref: 'lex:app.bsky.actor.defs#profileView',
10019
+ },
10020
+ },
10021
+ },
10022
+ },
10023
+ },
10024
+ },
10025
+ },
10026
+ },
9913
10027
  AppBskyNotificationListNotifications: {
9914
10028
  lexicon: 1,
9915
10029
  id: 'app.bsky.notification.listNotifications',
@@ -10042,6 +10156,51 @@ export const schemaDict = {
10042
10156
  },
10043
10157
  },
10044
10158
  },
10159
+ AppBskyNotificationPutActivitySubscription: {
10160
+ lexicon: 1,
10161
+ id: 'app.bsky.notification.putActivitySubscription',
10162
+ defs: {
10163
+ main: {
10164
+ type: 'procedure',
10165
+ description:
10166
+ 'Puts an activity subscription entry. The key should be omitted for creation and provided for updates. Requires auth.',
10167
+ input: {
10168
+ encoding: 'application/json',
10169
+ schema: {
10170
+ type: 'object',
10171
+ required: ['subject', 'activitySubscription'],
10172
+ properties: {
10173
+ subject: {
10174
+ type: 'string',
10175
+ format: 'did',
10176
+ },
10177
+ activitySubscription: {
10178
+ type: 'ref',
10179
+ ref: 'lex:app.bsky.notification.defs#activitySubscription',
10180
+ },
10181
+ },
10182
+ },
10183
+ },
10184
+ output: {
10185
+ encoding: 'application/json',
10186
+ schema: {
10187
+ type: 'object',
10188
+ required: ['subject'],
10189
+ properties: {
10190
+ subject: {
10191
+ type: 'string',
10192
+ format: 'did',
10193
+ },
10194
+ activitySubscription: {
10195
+ type: 'ref',
10196
+ ref: 'lex:app.bsky.notification.defs#activitySubscription',
10197
+ },
10198
+ },
10199
+ },
10200
+ },
10201
+ },
10202
+ },
10203
+ },
10045
10204
  AppBskyNotificationPutPreferences: {
10046
10205
  lexicon: 1,
10047
10206
  id: 'app.bsky.notification.putPreferences',
@@ -16735,8 +16894,8 @@ export const ids = {
16735
16894
  AppBskyFeedGetFeedSkeleton: 'app.bsky.feed.getFeedSkeleton',
16736
16895
  AppBskyFeedGetLikes: 'app.bsky.feed.getLikes',
16737
16896
  AppBskyFeedGetListFeed: 'app.bsky.feed.getListFeed',
16738
- AppBskyFeedGetPosts: 'app.bsky.feed.getPosts',
16739
16897
  AppBskyFeedGetPostThread: 'app.bsky.feed.getPostThread',
16898
+ AppBskyFeedGetPosts: 'app.bsky.feed.getPosts',
16740
16899
  AppBskyFeedGetQuotes: 'app.bsky.feed.getQuotes',
16741
16900
  AppBskyFeedGetRepostedBy: 'app.bsky.feed.getRepostedBy',
16742
16901
  AppBskyFeedGetSuggestedFeeds: 'app.bsky.feed.getSuggestedFeeds',
@@ -16781,11 +16940,16 @@ export const ids = {
16781
16940
  AppBskyLabelerDefs: 'app.bsky.labeler.defs',
16782
16941
  AppBskyLabelerGetServices: 'app.bsky.labeler.getServices',
16783
16942
  AppBskyLabelerService: 'app.bsky.labeler.service',
16943
+ AppBskyNotificationDeclaration: 'app.bsky.notification.declaration',
16784
16944
  AppBskyNotificationDefs: 'app.bsky.notification.defs',
16785
16945
  AppBskyNotificationGetPreferences: 'app.bsky.notification.getPreferences',
16786
16946
  AppBskyNotificationGetUnreadCount: 'app.bsky.notification.getUnreadCount',
16947
+ AppBskyNotificationListActivitySubscriptions:
16948
+ 'app.bsky.notification.listActivitySubscriptions',
16787
16949
  AppBskyNotificationListNotifications:
16788
16950
  'app.bsky.notification.listNotifications',
16951
+ AppBskyNotificationPutActivitySubscription:
16952
+ 'app.bsky.notification.putActivitySubscription',
16789
16953
  AppBskyNotificationPutPreferences: 'app.bsky.notification.putPreferences',
16790
16954
  AppBskyNotificationPutPreferencesV2: 'app.bsky.notification.putPreferencesV2',
16791
16955
  AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush',
@@ -12,6 +12,7 @@ import {
12
12
  import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js'
13
13
  import type * as AppBskyGraphDefs from '../graph/defs.js'
14
14
  import type * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef.js'
15
+ import type * as AppBskyNotificationDefs from '../notification/defs.js'
15
16
  import type * as AppBskyFeedThreadgate from '../feed/threadgate.js'
16
17
  import type * as AppBskyFeedPostgate from '../feed/postgate.js'
17
18
  import type * as AppBskyEmbedExternal from '../embed/external.js'
@@ -109,6 +110,7 @@ export interface ProfileAssociated {
109
110
  starterPacks?: number
110
111
  labeler?: boolean
111
112
  chat?: ProfileAssociatedChat
113
+ activitySubscription?: ProfileAssociatedActivitySubscription
112
114
  }
113
115
 
114
116
  const hashProfileAssociated = 'profileAssociated'
@@ -136,6 +138,26 @@ export function validateProfileAssociatedChat<V>(v: V) {
136
138
  return validate<ProfileAssociatedChat & V>(v, id, hashProfileAssociatedChat)
137
139
  }
138
140
 
141
+ export interface ProfileAssociatedActivitySubscription {
142
+ $type?: 'app.bsky.actor.defs#profileAssociatedActivitySubscription'
143
+ allowSubscriptions: 'followers' | 'mutuals' | 'none' | (string & {})
144
+ }
145
+
146
+ const hashProfileAssociatedActivitySubscription =
147
+ 'profileAssociatedActivitySubscription'
148
+
149
+ export function isProfileAssociatedActivitySubscription<V>(v: V) {
150
+ return is$typed(v, id, hashProfileAssociatedActivitySubscription)
151
+ }
152
+
153
+ export function validateProfileAssociatedActivitySubscription<V>(v: V) {
154
+ return validate<ProfileAssociatedActivitySubscription & V>(
155
+ v,
156
+ id,
157
+ hashProfileAssociatedActivitySubscription,
158
+ )
159
+ }
160
+
139
161
  /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */
140
162
  export interface ViewerState {
141
163
  $type?: 'app.bsky.actor.defs#viewerState'
@@ -147,6 +169,7 @@ export interface ViewerState {
147
169
  following?: string
148
170
  followedBy?: string
149
171
  knownFollowers?: KnownFollowers
172
+ activitySubscription?: AppBskyNotificationDefs.ActivitySubscription
150
173
  }
151
174
 
152
175
  const hashViewerState = 'viewerState'
@@ -0,0 +1,32 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { CID } from 'multiformats/cid'
6
+ import { validate as _validate } from '../../../../lexicons'
7
+ import {
8
+ type $Typed,
9
+ is$typed as _is$typed,
10
+ type OmitKey,
11
+ } from '../../../../util'
12
+
13
+ const is$typed = _is$typed,
14
+ validate = _validate
15
+ const id = 'app.bsky.notification.declaration'
16
+
17
+ export interface Record {
18
+ $type: 'app.bsky.notification.declaration'
19
+ /** A declaration of the user's preference for allowing activity subscriptions from other users. Absence of a record implies 'followers'. */
20
+ allowSubscriptions: 'followers' | 'mutuals' | 'none' | (string & {})
21
+ [k: string]: unknown
22
+ }
23
+
24
+ const hashRecord = 'main'
25
+
26
+ export function isRecord<V>(v: V) {
27
+ return is$typed(v, id, hashRecord)
28
+ }
29
+
30
+ export function validateRecord<V>(v: V) {
31
+ return validate<Record & V>(v, id, hashRecord, true)
32
+ }
@@ -103,3 +103,40 @@ export function isPreferences<V>(v: V) {
103
103
  export function validatePreferences<V>(v: V) {
104
104
  return validate<Preferences & V>(v, id, hashPreferences)
105
105
  }
106
+
107
+ export interface ActivitySubscription {
108
+ $type?: 'app.bsky.notification.defs#activitySubscription'
109
+ post: boolean
110
+ reply: boolean
111
+ }
112
+
113
+ const hashActivitySubscription = 'activitySubscription'
114
+
115
+ export function isActivitySubscription<V>(v: V) {
116
+ return is$typed(v, id, hashActivitySubscription)
117
+ }
118
+
119
+ export function validateActivitySubscription<V>(v: V) {
120
+ return validate<ActivitySubscription & V>(v, id, hashActivitySubscription)
121
+ }
122
+
123
+ /** Object used to store activity subscription data in stash. */
124
+ export interface SubjectActivitySubscription {
125
+ $type?: 'app.bsky.notification.defs#subjectActivitySubscription'
126
+ subject: string
127
+ activitySubscription: ActivitySubscription
128
+ }
129
+
130
+ const hashSubjectActivitySubscription = 'subjectActivitySubscription'
131
+
132
+ export function isSubjectActivitySubscription<V>(v: V) {
133
+ return is$typed(v, id, hashSubjectActivitySubscription)
134
+ }
135
+
136
+ export function validateSubjectActivitySubscription<V>(v: V) {
137
+ return validate<SubjectActivitySubscription & V>(
138
+ v,
139
+ id,
140
+ hashSubjectActivitySubscription,
141
+ )
142
+ }
@@ -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.notification.listActivitySubscriptions'
19
+
20
+ export interface QueryParams {
21
+ limit: number
22
+ cursor?: string
23
+ }
24
+
25
+ export type InputSchema = undefined
26
+
27
+ export interface OutputSchema {
28
+ cursor?: string
29
+ subscriptions: AppBskyActorDefs.ProfileView[]
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,59 @@
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 AppBskyNotificationDefs from './defs.js'
15
+
16
+ const is$typed = _is$typed,
17
+ validate = _validate
18
+ const id = 'app.bsky.notification.putActivitySubscription'
19
+
20
+ export interface QueryParams {}
21
+
22
+ export interface InputSchema {
23
+ subject: string
24
+ activitySubscription: AppBskyNotificationDefs.ActivitySubscription
25
+ }
26
+
27
+ export interface OutputSchema {
28
+ subject: string
29
+ activitySubscription?: AppBskyNotificationDefs.ActivitySubscription
30
+ }
31
+
32
+ export interface HandlerInput {
33
+ encoding: 'application/json'
34
+ body: InputSchema
35
+ }
36
+
37
+ export interface HandlerSuccess {
38
+ encoding: 'application/json'
39
+ body: OutputSchema
40
+ headers?: { [key: string]: string }
41
+ }
42
+
43
+ export interface HandlerError {
44
+ status: number
45
+ message?: string
46
+ }
47
+
48
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
49
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
50
+ auth: HA
51
+ params: QueryParams
52
+ input: HandlerInput
53
+ req: express.Request
54
+ res: express.Response
55
+ resetRouteRateLimits: () => Promise<void>
56
+ }
57
+ export type Handler<HA extends HandlerAuth = never> = (
58
+ ctx: HandlerReqCtx<HA>,
59
+ ) => Promise<HandlerOutput> | HandlerOutput
package/src/logger.ts CHANGED
@@ -18,14 +18,16 @@ export const oauthLogger = subsystemLogger('pds:oauth')
18
18
  export const loggerMiddleware = pinoHttp({
19
19
  logger: httpLogger,
20
20
  serializers: {
21
+ req: reqSerializer,
21
22
  err: (err: unknown) => ({
22
23
  code: err?.['code'],
23
24
  message: err?.['message'],
24
25
  }),
25
- req: (req: IncomingMessage) => {
26
- const serialized = stdSerializers.req(req)
27
- const headers = obfuscateHeaders(serialized.headers)
28
- return { ...serialized, headers }
29
- },
30
26
  },
31
27
  })
28
+
29
+ export function reqSerializer(req: IncomingMessage) {
30
+ const serialized = stdSerializers.req(req)
31
+ const headers = obfuscateHeaders(serialized.headers)
32
+ return { ...serialized, headers }
33
+ }