@atproto/pds 0.4.212 → 0.4.214

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 (44) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
  3. package/dist/api/app/bsky/feed/getPostThread.js +3 -3
  4. package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
  5. package/dist/api/com/atproto/admin/getInviteCodes.d.ts +1 -1
  6. package/dist/api/com/atproto/sync/listRepos.d.ts +1 -1
  7. package/dist/auth-verifier.d.ts +1 -1
  8. package/dist/db/pagination.d.ts +1 -1
  9. package/dist/lexicon/lexicons.d.ts +48 -0
  10. package/dist/lexicon/lexicons.d.ts.map +1 -1
  11. package/dist/lexicon/lexicons.js +24 -0
  12. package/dist/lexicon/lexicons.js.map +1 -1
  13. package/dist/lexicon/types/app/bsky/actor/getSuggestions.d.ts +3 -1
  14. package/dist/lexicon/types/app/bsky/actor/getSuggestions.d.ts.map +1 -1
  15. package/dist/lexicon/types/app/bsky/actor/getSuggestions.js.map +1 -1
  16. package/dist/lexicon/types/app/bsky/feed/sendInteractions.d.ts +1 -0
  17. package/dist/lexicon/types/app/bsky/feed/sendInteractions.d.ts.map +1 -1
  18. package/dist/lexicon/types/app/bsky/feed/sendInteractions.js.map +1 -1
  19. package/dist/lexicon/types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.d.ts +3 -1
  20. package/dist/lexicon/types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.d.ts.map +1 -1
  21. package/dist/lexicon/types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.js.map +1 -1
  22. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedOnboardingUsers.d.ts +3 -1
  23. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedOnboardingUsers.d.ts.map +1 -1
  24. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedOnboardingUsers.js.map +1 -1
  25. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.d.ts +3 -1
  26. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.d.ts.map +1 -1
  27. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.js.map +1 -1
  28. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.d.ts +3 -1
  29. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.d.ts.map +1 -1
  30. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.js.map +1 -1
  31. package/dist/pipethrough.d.ts +17 -1
  32. package/dist/pipethrough.d.ts.map +1 -1
  33. package/dist/pipethrough.js +31 -14
  34. package/dist/pipethrough.js.map +1 -1
  35. package/package.json +13 -13
  36. package/src/api/app/bsky/feed/getPostThread.ts +9 -4
  37. package/src/lexicon/lexicons.ts +24 -0
  38. package/src/lexicon/types/app/bsky/actor/getSuggestions.ts +3 -1
  39. package/src/lexicon/types/app/bsky/feed/sendInteractions.ts +1 -0
  40. package/src/lexicon/types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.ts +3 -1
  41. package/src/lexicon/types/app/bsky/unspecced/getSuggestedOnboardingUsers.ts +3 -1
  42. package/src/lexicon/types/app/bsky/unspecced/getSuggestedUsers.ts +3 -1
  43. package/src/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.ts +3 -1
  44. package/src/pipethrough.ts +33 -22
@@ -1028,6 +1028,10 @@ export const schemaDict = {
1028
1028
  },
1029
1029
  recId: {
1030
1030
  type: 'integer',
1031
+ description: 'DEPRECATED: use recIdStr instead.',
1032
+ },
1033
+ recIdStr: {
1034
+ type: 'string',
1031
1035
  description:
1032
1036
  'Snowflake for this recommendation, use when submitting recommendation events.',
1033
1037
  },
@@ -4947,6 +4951,10 @@ export const schemaDict = {
4947
4951
  type: 'object',
4948
4952
  required: ['interactions'],
4949
4953
  properties: {
4954
+ feed: {
4955
+ type: 'string',
4956
+ format: 'at-uri',
4957
+ },
4950
4958
  interactions: {
4951
4959
  type: 'array',
4952
4960
  items: {
@@ -8103,6 +8111,10 @@ export const schemaDict = {
8103
8111
  },
8104
8112
  },
8105
8113
  recId: {
8114
+ type: 'string',
8115
+ description: 'DEPRECATED: use recIdStr instead.',
8116
+ },
8117
+ recIdStr: {
8106
8118
  type: 'string',
8107
8119
  description:
8108
8120
  'Snowflake for this recommendation, use when submitting recommendation events.',
@@ -8437,6 +8449,10 @@ export const schemaDict = {
8437
8449
  },
8438
8450
  },
8439
8451
  recId: {
8452
+ type: 'string',
8453
+ description: 'DEPRECATED: use recIdStr instead.',
8454
+ },
8455
+ recIdStr: {
8440
8456
  type: 'string',
8441
8457
  description:
8442
8458
  'Snowflake for this recommendation, use when submitting recommendation events.',
@@ -8564,6 +8580,10 @@ export const schemaDict = {
8564
8580
  },
8565
8581
  },
8566
8582
  recId: {
8583
+ type: 'string',
8584
+ description: 'DEPRECATED: use recIdStr instead.',
8585
+ },
8586
+ recIdStr: {
8567
8587
  type: 'string',
8568
8588
  description:
8569
8589
  'Snowflake for this recommendation, use when submitting recommendation events.',
@@ -8617,6 +8637,10 @@ export const schemaDict = {
8617
8637
  },
8618
8638
  },
8619
8639
  recId: {
8640
+ type: 'string',
8641
+ description: 'DEPRECATED: use recIdStr instead.',
8642
+ },
8643
+ recIdStr: {
8620
8644
  type: 'string',
8621
8645
  description:
8622
8646
  'Snowflake for this recommendation, use when submitting recommendation events.',
@@ -24,8 +24,10 @@ export type InputSchema = undefined
24
24
  export interface OutputSchema {
25
25
  cursor?: string
26
26
  actors: AppBskyActorDefs.ProfileView[]
27
- /** Snowflake for this recommendation, use when submitting recommendation events. */
27
+ /** DEPRECATED: use recIdStr instead. */
28
28
  recId?: number
29
+ /** Snowflake for this recommendation, use when submitting recommendation events. */
30
+ recIdStr?: string
29
31
  }
30
32
 
31
33
  export type HandlerInput = void
@@ -18,6 +18,7 @@ const id = 'app.bsky.feed.sendInteractions'
18
18
  export type QueryParams = {}
19
19
 
20
20
  export interface InputSchema {
21
+ feed?: string
21
22
  interactions: AppBskyFeedDefs.Interaction[]
22
23
  }
23
24
 
@@ -25,8 +25,10 @@ export type InputSchema = undefined
25
25
 
26
26
  export interface OutputSchema {
27
27
  dids: string[]
28
- /** Snowflake for this recommendation, use when submitting recommendation events. */
28
+ /** DEPRECATED: use recIdStr instead. */
29
29
  recId?: string
30
+ /** Snowflake for this recommendation, use when submitting recommendation events. */
31
+ recIdStr?: string
30
32
  }
31
33
 
32
34
  export type HandlerInput = void
@@ -24,8 +24,10 @@ export type InputSchema = undefined
24
24
 
25
25
  export interface OutputSchema {
26
26
  actors: AppBskyActorDefs.ProfileView[]
27
- /** Snowflake for this recommendation, use when submitting recommendation events. */
27
+ /** DEPRECATED: use recIdStr instead. */
28
28
  recId?: string
29
+ /** Snowflake for this recommendation, use when submitting recommendation events. */
30
+ recIdStr?: string
29
31
  }
30
32
 
31
33
  export type HandlerInput = void
@@ -24,8 +24,10 @@ export type InputSchema = undefined
24
24
 
25
25
  export interface OutputSchema {
26
26
  actors: AppBskyActorDefs.ProfileView[]
27
- /** Snowflake for this recommendation, use when submitting recommendation events. */
27
+ /** DEPRECATED: use recIdStr instead. */
28
28
  recId?: string
29
+ /** Snowflake for this recommendation, use when submitting recommendation events. */
30
+ recIdStr?: string
29
31
  }
30
32
 
31
33
  export type HandlerInput = void
@@ -25,8 +25,10 @@ export type InputSchema = undefined
25
25
 
26
26
  export interface OutputSchema {
27
27
  dids: string[]
28
- /** Snowflake for this recommendation, use when submitting recommendation events. */
28
+ /** DEPRECATED: use recIdStr instead. */
29
29
  recId?: string
30
+ /** Snowflake for this recommendation, use when submitting recommendation events. */
31
+ recIdStr?: string
30
32
  }
31
33
 
32
34
  export type HandlerInput = void
@@ -9,13 +9,13 @@ import {
9
9
  streamToNodeBuffer,
10
10
  } from '@atproto/common'
11
11
  import { RpcPermissionMatch } from '@atproto/oauth-scopes'
12
- import { ResponseType, XRPCError as XRPCClientError } from '@atproto/xrpc'
13
12
  import {
14
13
  CatchallHandler,
15
14
  HandlerPipeThroughBuffer,
16
15
  HandlerPipeThroughStream,
17
16
  InternalServerError,
18
17
  InvalidRequestError,
18
+ ResponseType,
19
19
  XRPCError as XRPCServerError,
20
20
  excludeErrorResult,
21
21
  parseReqNsid,
@@ -301,15 +301,9 @@ async function pipethroughStream(
301
301
  const passThrough = new PassThrough()
302
302
 
303
303
  void tryParsingError(upstream.headers, passThrough).then((parsed) => {
304
- const xrpcError = new XRPCClientError(
305
- upstream.statusCode === 500
306
- ? ResponseType.UpstreamFailure
307
- : upstream.statusCode,
308
- parsed.error,
309
- parsed.message,
310
- Object.fromEntries(responseHeaders(upstream.headers, false)),
311
- { cause: dispatchOptions },
312
- )
304
+ const xrpcError = new PipethroughUpstreamError(upstream, parsed, {
305
+ cause: dispatchOptions,
306
+ })
313
307
 
314
308
  reject(xrpcError)
315
309
  }, reject)
@@ -356,18 +350,9 @@ async function pipethroughRequest(
356
350
  if (upstream.statusCode >= 400) {
357
351
  const parsed = await tryParsingError(upstream.headers, upstream.body)
358
352
 
359
- // Note "XRPCClientError" is used instead of "XRPCServerError" in order to
360
- // allow users of this function to capture & handle these errors (namely in
361
- // "app.bsky.feed.getPostThread").
362
- throw new XRPCClientError(
363
- upstream.statusCode === 500
364
- ? ResponseType.UpstreamFailure
365
- : upstream.statusCode,
366
- parsed.error,
367
- parsed.message,
368
- Object.fromEntries(responseHeaders(upstream.headers, false)),
369
- { cause: dispatchOptions },
370
- )
353
+ throw new PipethroughUpstreamError(upstream, parsed, {
354
+ cause: dispatchOptions,
355
+ })
371
356
  }
372
357
 
373
358
  return upstream
@@ -635,3 +620,29 @@ const safeString = (str: unknown): string | undefined => {
635
620
  function logResponseError(this: ServerResponse, err: unknown): void {
636
621
  httpLogger.warn({ err }, 'error forwarding upstream response')
637
622
  }
623
+
624
+ export class PipethroughUpstreamError extends XRPCServerError {
625
+ constructor(
626
+ readonly upstream: {
627
+ statusCode: number
628
+ headers: IncomingHttpHeaders
629
+ },
630
+ payload: { message?: string; error?: string },
631
+ options?: ErrorOptions,
632
+ ) {
633
+ const status =
634
+ upstream.statusCode === 500
635
+ ? ResponseType.UpstreamFailure
636
+ : upstream.statusCode
637
+
638
+ super(status, payload.message, payload.error, options)
639
+ }
640
+
641
+ get headers(): Record<string, string> {
642
+ return Object.fromEntries(responseHeaders(this.upstream.headers, false))
643
+ }
644
+
645
+ get error() {
646
+ return this.customErrorName ?? this.typeName
647
+ }
648
+ }