@atproto/pds 0.4.60 → 0.4.62

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/account-manager/helpers/account.d.ts +1 -0
  3. package/dist/account-manager/helpers/account.d.ts.map +1 -1
  4. package/dist/account-manager/helpers/account.js +15 -1
  5. package/dist/account-manager/helpers/account.js.map +1 -1
  6. package/dist/account-manager/helpers/invite.d.ts +1 -1
  7. package/dist/account-manager/helpers/invite.d.ts.map +1 -1
  8. package/dist/account-manager/helpers/invite.js +20 -9
  9. package/dist/account-manager/helpers/invite.js.map +1 -1
  10. package/dist/account-manager/helpers/token.d.ts +16 -16
  11. package/dist/account-manager/index.d.ts +2 -0
  12. package/dist/account-manager/index.d.ts.map +1 -1
  13. package/dist/account-manager/index.js +8 -1
  14. package/dist/account-manager/index.js.map +1 -1
  15. package/dist/api/com/atproto/admin/getAccountInfo.d.ts.map +1 -1
  16. package/dist/api/com/atproto/admin/getAccountInfo.js +6 -14
  17. package/dist/api/com/atproto/admin/getAccountInfo.js.map +1 -1
  18. package/dist/api/com/atproto/admin/getAccountInfos.d.ts +4 -0
  19. package/dist/api/com/atproto/admin/getAccountInfos.d.ts.map +1 -0
  20. package/dist/api/com/atproto/admin/getAccountInfos.js +32 -0
  21. package/dist/api/com/atproto/admin/getAccountInfos.js.map +1 -0
  22. package/dist/api/com/atproto/admin/index.d.ts.map +1 -1
  23. package/dist/api/com/atproto/admin/index.js +2 -0
  24. package/dist/api/com/atproto/admin/index.js.map +1 -1
  25. package/dist/api/com/atproto/admin/util.d.ts +17 -0
  26. package/dist/api/com/atproto/admin/util.d.ts.map +1 -1
  27. package/dist/api/com/atproto/admin/util.js +27 -1
  28. package/dist/api/com/atproto/admin/util.js.map +1 -1
  29. package/dist/api/com/atproto/repo/getRecord.d.ts.map +1 -1
  30. package/dist/api/com/atproto/repo/getRecord.js +1 -1
  31. package/dist/api/com/atproto/repo/getRecord.js.map +1 -1
  32. package/dist/config/config.d.ts +8 -0
  33. package/dist/config/config.d.ts.map +1 -1
  34. package/dist/config/config.js +1 -0
  35. package/dist/config/config.js.map +1 -1
  36. package/dist/config/env.d.ts +1 -0
  37. package/dist/config/env.d.ts.map +1 -1
  38. package/dist/config/env.js +1 -0
  39. package/dist/config/env.js.map +1 -1
  40. package/dist/lexicon/index.d.ts +15 -0
  41. package/dist/lexicon/index.d.ts.map +1 -1
  42. package/dist/lexicon/index.js +40 -1
  43. package/dist/lexicon/index.js.map +1 -1
  44. package/dist/lexicon/lexicons.d.ts +261 -0
  45. package/dist/lexicon/lexicons.d.ts.map +1 -1
  46. package/dist/lexicon/lexicons.js +269 -0
  47. package/dist/lexicon/lexicons.js.map +1 -1
  48. package/dist/lexicon/types/com/atproto/repo/getRecord.d.ts +1 -0
  49. package/dist/lexicon/types/com/atproto/repo/getRecord.d.ts.map +1 -1
  50. package/dist/lexicon/types/tools/ozone/moderation/getRecords.d.ts +39 -0
  51. package/dist/lexicon/types/tools/ozone/moderation/getRecords.d.ts.map +1 -0
  52. package/dist/lexicon/types/tools/ozone/moderation/getRecords.js +3 -0
  53. package/dist/lexicon/types/tools/ozone/moderation/getRecords.js.map +1 -0
  54. package/dist/lexicon/types/tools/ozone/moderation/getRepos.d.ts +39 -0
  55. package/dist/lexicon/types/tools/ozone/moderation/getRepos.d.ts.map +1 -0
  56. package/dist/lexicon/types/tools/ozone/moderation/getRepos.js +3 -0
  57. package/dist/lexicon/types/tools/ozone/moderation/getRepos.js.map +1 -0
  58. package/dist/lexicon/types/tools/ozone/signature/defs.d.ts +12 -0
  59. package/dist/lexicon/types/tools/ozone/signature/defs.d.ts.map +1 -0
  60. package/dist/lexicon/types/tools/ozone/signature/defs.js +16 -0
  61. package/dist/lexicon/types/tools/ozone/signature/defs.js.map +1 -0
  62. package/dist/lexicon/types/tools/ozone/signature/findCorrelation.d.ts +36 -0
  63. package/dist/lexicon/types/tools/ozone/signature/findCorrelation.d.ts.map +1 -0
  64. package/dist/lexicon/types/tools/ozone/signature/findCorrelation.js +3 -0
  65. package/dist/lexicon/types/tools/ozone/signature/findCorrelation.js.map +1 -0
  66. package/dist/lexicon/types/tools/ozone/signature/findRelatedAccounts.d.ts +48 -0
  67. package/dist/lexicon/types/tools/ozone/signature/findRelatedAccounts.d.ts.map +1 -0
  68. package/dist/lexicon/types/tools/ozone/signature/findRelatedAccounts.js +16 -0
  69. package/dist/lexicon/types/tools/ozone/signature/findRelatedAccounts.js.map +1 -0
  70. package/dist/lexicon/types/tools/ozone/signature/searchAccounts.d.ts +39 -0
  71. package/dist/lexicon/types/tools/ozone/signature/searchAccounts.d.ts.map +1 -0
  72. package/dist/lexicon/types/tools/ozone/signature/searchAccounts.js +3 -0
  73. package/dist/lexicon/types/tools/ozone/signature/searchAccounts.js.map +1 -0
  74. package/dist/mailer/templates/confirm-email.js +1 -1
  75. package/dist/mailer/templates/confirm-email.js.map +1 -1
  76. package/dist/mailer/templates/delete-account.js +1 -1
  77. package/dist/mailer/templates/delete-account.js.map +1 -1
  78. package/dist/mailer/templates/plc-operation.js +1 -1
  79. package/dist/mailer/templates/plc-operation.js.map +1 -1
  80. package/dist/mailer/templates/reset-password.js +1 -1
  81. package/dist/mailer/templates/reset-password.js.map +1 -1
  82. package/dist/mailer/templates/update-email.js +1 -1
  83. package/dist/mailer/templates/update-email.js.map +1 -1
  84. package/dist/pipethrough.d.ts +1 -1
  85. package/dist/pipethrough.d.ts.map +1 -1
  86. package/dist/pipethrough.js +105 -73
  87. package/dist/pipethrough.js.map +1 -1
  88. package/package.json +11 -11
  89. package/src/account-manager/helpers/account.ts +22 -0
  90. package/src/account-manager/helpers/invite.ts +19 -9
  91. package/src/account-manager/index.ts +13 -1
  92. package/src/api/com/atproto/admin/getAccountInfo.ts +6 -13
  93. package/src/api/com/atproto/admin/getAccountInfos.ts +33 -0
  94. package/src/api/com/atproto/admin/index.ts +2 -0
  95. package/src/api/com/atproto/admin/util.ts +38 -0
  96. package/src/api/com/atproto/repo/getRecord.ts +4 -1
  97. package/src/config/config.ts +10 -0
  98. package/src/config/env.ts +2 -0
  99. package/src/lexicon/index.ts +70 -0
  100. package/src/lexicon/lexicons.ts +273 -0
  101. package/src/lexicon/types/com/atproto/repo/getRecord.ts +1 -0
  102. package/src/lexicon/types/tools/ozone/moderation/getRecords.ts +50 -0
  103. package/src/lexicon/types/tools/ozone/moderation/getRepos.ts +50 -0
  104. package/src/lexicon/types/tools/ozone/signature/defs.ts +25 -0
  105. package/src/lexicon/types/tools/ozone/signature/findCorrelation.ts +46 -0
  106. package/src/lexicon/types/tools/ozone/signature/findRelatedAccounts.ts +71 -0
  107. package/src/lexicon/types/tools/ozone/signature/searchAccounts.ts +49 -0
  108. package/src/mailer/templates/confirm-email.hbs +1 -1
  109. package/src/mailer/templates/delete-account.hbs +1 -1
  110. package/src/mailer/templates/plc-operation.hbs +1 -1
  111. package/src/mailer/templates/reset-password.hbs +1 -1
  112. package/src/mailer/templates/update-email.hbs +1 -1
  113. package/src/pipethrough.ts +131 -92
  114. package/tests/proxied/read-after-write.test.ts +77 -0
@@ -32,7 +32,7 @@ const proxyHandler = (ctx) => {
32
32
  }
33
33
  const { url: origin, did: aud } = await parseProxyInfo(ctx, req, lxm);
34
34
  const headers = {
35
- 'accept-encoding': req.headers['accept-encoding'],
35
+ 'accept-encoding': req.headers['accept-encoding'] || 'identity',
36
36
  'accept-language': req.headers['accept-language'],
37
37
  'atproto-accept-labelers': req.headers['atproto-accept-labelers'],
38
38
  'x-bsky-topics': req.headers['x-bsky-topics'],
@@ -68,17 +68,17 @@ const proxyHandler = (ctx) => {
68
68
  };
69
69
  };
70
70
  exports.proxyHandler = proxyHandler;
71
- // List of content encodings that are supported by the PDS. Because proxying
72
- // occurs between data centers, where connectivity is supposedly stable & good,
73
- // and because payloads are small, we prefer encoding that are fast (gzip,
74
- // deflate, identity) over heavier encodings (Brotli). Upstream servers should
75
- // be configured to prefer any encoding over identity in case of big,
76
- // uncompressed payloads.
77
- const SUPPORTED_ENCODINGS = [
78
- ['gzip', { q: '1.0' }],
79
- ['deflate', { q: '0.9' }],
80
- ['identity', { q: '0.3' }],
81
- ['br', { q: '0.1' }],
71
+ const ACCEPT_ENCODING_COMPRESSED = [
72
+ ['gzip', { q: 1.0 }],
73
+ ['deflate', { q: 0.9 }],
74
+ ['br', { q: 0.8 }],
75
+ ['identity', { q: 0.1 }],
76
+ ];
77
+ const ACCEPT_ENCODING_UNCOMPRESSED = [
78
+ ['identity', { q: 1.0 }],
79
+ ['gzip', { q: 0.3 }],
80
+ ['deflate', { q: 0.2 }],
81
+ ['br', { q: 0.1 }],
82
82
  ];
83
83
  async function pipethrough(ctx, req, options) {
84
84
  if (req.method !== 'GET' && req.method !== 'HEAD') {
@@ -92,35 +92,36 @@ async function pipethrough(ctx, req, options) {
92
92
  }
93
93
  const lxm = (0, xrpc_server_1.parseReqNsid)(req);
94
94
  const { url: origin, did: aud } = await parseProxyInfo(ctx, req, lxm);
95
- // Because we sometimes need to interpret the response (e.g. during
96
- // read-after-write, through asPipeThroughBuffer()), we need to ask the
97
- // upstream server for an encoding that both the requester and the PDS can
98
- // understand.
99
- const acceptEncoding = negotiateAccept(req.headers['accept-encoding'], SUPPORTED_ENCODINGS);
100
- const headers = {
101
- 'accept-language': req.headers['accept-language'],
102
- 'atproto-accept-labelers': req.headers['atproto-accept-labelers'],
103
- 'x-bsky-topics': req.headers['x-bsky-topics'],
104
- 'accept-encoding': `${formatAccepted(acceptEncoding)}, *;q=0`, // Reject anything else (q=0)
105
- authorization: options?.iss
106
- ? `Bearer ${await ctx.serviceAuthJwt(options.iss, options.aud ?? aud, options.lxm ?? lxm)}`
107
- : undefined,
108
- };
109
95
  const dispatchOptions = {
110
96
  origin,
111
97
  method: req.method,
112
98
  path: req.originalUrl,
113
- headers,
99
+ headers: {
100
+ 'accept-language': req.headers['accept-language'],
101
+ 'atproto-accept-labelers': req.headers['atproto-accept-labelers'],
102
+ 'x-bsky-topics': req.headers['x-bsky-topics'],
103
+ // Because we sometimes need to interpret the response (e.g. during
104
+ // read-after-write, through asPipeThroughBuffer()), we need to ask the
105
+ // upstream server for an encoding that both the requester and the PDS can
106
+ // understand. Since we might have to do the decoding ourselves, we will
107
+ // use our own preferences (and weight) to negotiate the encoding.
108
+ 'accept-encoding': negotiateContentEncoding(req.headers['accept-encoding'], ctx.cfg.proxy.preferCompressed
109
+ ? ACCEPT_ENCODING_COMPRESSED
110
+ : ACCEPT_ENCODING_UNCOMPRESSED),
111
+ authorization: options?.iss
112
+ ? `Bearer ${await ctx.serviceAuthJwt(options.iss, options.aud ?? aud, options.lxm ?? lxm)}`
113
+ : undefined,
114
+ },
114
115
  // Use a high water mark to buffer more data while performing async
115
116
  // operations before this stream is consumed. This is especially useful
116
117
  // while processing read-after-write operations.
117
118
  highWaterMark: 2 * 65536, // twice the default (64KiB)
118
119
  };
119
- const upstream = await pipethroughRequest(ctx, dispatchOptions);
120
+ const { headers, body } = await pipethroughRequest(ctx, dispatchOptions);
120
121
  return {
121
- stream: upstream.body,
122
- headers: Object.fromEntries(responseHeaders(upstream.headers)),
123
- encoding: safeString(upstream.headers['content-type']) ?? 'application/json',
122
+ encoding: safeString(headers['content-type']) ?? 'application/json',
123
+ headers: Object.fromEntries(responseHeaders(headers)),
124
+ stream: body,
124
125
  };
125
126
  }
126
127
  exports.pipethrough = pipethrough;
@@ -233,59 +234,90 @@ function handleUpstreamRequestError(err, message = 'pipethrough network error')
233
234
  cause: err,
234
235
  });
235
236
  }
236
- function negotiateAccept(acceptHeader, supported) {
237
- // Optimization: if no accept-encoding header is present, skip negotiation
238
- if (!acceptHeader?.length) {
239
- return supported;
237
+ // accept-encoding defaults to "identity with lowest priority"
238
+ const ACCEPT_ENC_DEFAULT = ['identity', { q: 0.001 }];
239
+ const ACCEPT_FORBID_STAR = ['*', { q: 0 }];
240
+ function negotiateContentEncoding(acceptHeader, preferences) {
241
+ const acceptMap = Object.fromEntries(parseAcceptEncoding(acceptHeader));
242
+ // Make sure the default (identity) is covered by the preferences
243
+ if (!preferences.some(coversIdentityAccept)) {
244
+ preferences = [...preferences, ACCEPT_ENC_DEFAULT];
245
+ }
246
+ const common = preferences.filter(([name]) => {
247
+ const acceptQ = (acceptMap[name] ?? acceptMap['*'])?.q;
248
+ // Per HTTP/1.1, "identity" is always acceptable unless explicitly rejected
249
+ if (name === 'identity') {
250
+ return acceptQ == null || acceptQ > 0;
251
+ }
252
+ else {
253
+ return acceptQ != null && acceptQ > 0;
254
+ }
255
+ });
256
+ // Since "identity" was present in the preferences, a missing "identity" in
257
+ // the common array means that the client explicitly rejected it. Let's reflect
258
+ // this by adding it to the common array.
259
+ if (!common.some(coversIdentityAccept)) {
260
+ common.push(ACCEPT_FORBID_STAR);
240
261
  }
241
- const acceptNames = extractAcceptedNames(acceptHeader);
242
- const common = acceptNames.includes('*')
243
- ? supported
244
- : supported.filter(nameIncludedIn, acceptNames);
245
- // There must be at least one common encoding with a non-zero q value
246
- if (!common.some(isNotRejected)) {
262
+ // If no common encodings are acceptable, throw a 406 Not Acceptable error
263
+ if (!common.some(isAllowedAccept)) {
247
264
  throw new xrpc_server_1.XRPCError(xrpc_1.ResponseType.NotAcceptable, 'this service does not support any of the requested encodings');
248
265
  }
249
- return common;
250
- }
251
- function formatAccepted(accept) {
252
- return accept.map(formatEncodingDev).join(', ');
253
- }
254
- function formatEncodingDev([enc, flags]) {
255
- let ret = enc;
256
- for (const name in flags)
257
- ret += `;${name}=${flags[name]}`;
258
- return ret;
266
+ return formatAcceptHeader(common);
259
267
  }
260
- function nameIncludedIn(accept) {
261
- return this.includes(accept[0]);
268
+ function coversIdentityAccept([name]) {
269
+ return name === 'identity' || name === '*';
262
270
  }
263
- function isNotRejected(accept) {
264
- return accept[1]['q'] !== '0';
271
+ function isAllowedAccept([, flags]) {
272
+ return flags.q > 0;
265
273
  }
266
- function extractAcceptedNames(acceptHeader) {
267
- if (!acceptHeader?.length) {
268
- return ['*'];
269
- }
270
- return Array.isArray(acceptHeader)
271
- ? acceptHeader.flatMap(extractAcceptedNames)
272
- : acceptHeader.split(',').map(extractAcceptedName).filter(isNonNullable);
274
+ /**
275
+ * @see {@link https://developer.mozilla.org/en-US/docs/Glossary/Quality_values}
276
+ */
277
+ function formatAcceptHeader(accept) {
278
+ return accept.map(formatAcceptPart).join(',');
273
279
  }
274
- function extractAcceptedName(def) {
275
- // No need to fully parse since we only care about allowed values
276
- const parts = def.split(';');
277
- if (parts.some(isQzero))
278
- return undefined;
279
- return parts[0].trim();
280
+ function formatAcceptPart([name, flags]) {
281
+ return `${name};q=${flags.q}`;
280
282
  }
281
- function isQzero(def) {
282
- return def.trim() === 'q=0';
283
+ function parseAcceptEncoding(acceptEncodings) {
284
+ if (!acceptEncodings?.length)
285
+ return [];
286
+ return Array.isArray(acceptEncodings)
287
+ ? acceptEncodings.flatMap(parseAcceptEncoding)
288
+ : acceptEncodings.split(',').map(parseAcceptEncodingDefinition);
283
289
  }
284
- function isNonNullable(val) {
285
- return val != null;
290
+ function parseAcceptEncodingDefinition(def) {
291
+ const { length, 0: encoding, 1: params } = def.trim().split(';', 3);
292
+ if (length > 2) {
293
+ throw new xrpc_server_1.InvalidRequestError(`Invalid accept-encoding: "${def}"`);
294
+ }
295
+ if (!encoding || encoding.includes('=')) {
296
+ throw new xrpc_server_1.InvalidRequestError(`Invalid accept-encoding: "${def}"`);
297
+ }
298
+ const flags = { q: 1 };
299
+ if (length === 2) {
300
+ const { length, 0: key, 1: value } = params.split('=', 3);
301
+ if (length !== 2) {
302
+ throw new xrpc_server_1.InvalidRequestError(`Invalid accept-encoding: "${def}"`);
303
+ }
304
+ if (key === 'q' || key === 'Q') {
305
+ const q = parseFloat(value);
306
+ if (q === 0 || (Number.isFinite(q) && q <= 1 && q >= 0.001)) {
307
+ flags.q = q;
308
+ }
309
+ else {
310
+ throw new xrpc_server_1.InvalidRequestError(`Invalid accept-encoding: "${def}"`);
311
+ }
312
+ }
313
+ else {
314
+ throw new xrpc_server_1.InvalidRequestError(`Invalid accept-encoding: "${def}"`);
315
+ }
316
+ }
317
+ return [encoding.toLowerCase(), flags];
286
318
  }
287
319
  function isJsonContentType(contentType) {
288
- if (contentType == null)
320
+ if (!contentType)
289
321
  return undefined;
290
322
  return /application\/(?:\w+\+)?json/i.test(contentType);
291
323
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pipethrough.js","sourceRoot":"","sources":["../src/pipethrough.ts"],"names":[],"mappings":";;;AAEA,6CAAmD;AAGnD,4CAKwB;AACxB,wCAA0E;AAC1E,sDAQ6B;AAG7B,iDAAwC;AACxC,qCAAqC;AAE9B,MAAM,YAAY,GAAG,CAAC,GAAe,EAAmB,EAAE;IAC/D,MAAM,cAAc,GAAG,GAAG,CAAC,YAAY,CAAC,cAAc,EAAE,CAAA;IACxD,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC9B,eAAe;QAEf,IAAI,CAAC;YACH,IACE,GAAG,CAAC,MAAM,KAAK,KAAK;gBACpB,GAAG,CAAC,MAAM,KAAK,MAAM;gBACrB,GAAG,CAAC,MAAM,KAAK,MAAM,EACrB,CAAC;gBACD,MAAM,IAAI,uBAAe,CACvB,mBAAY,CAAC,cAAc,EAC3B,0CAA0C,CAC3C,CAAA;YACH,CAAC;YAED,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAA;YACpD,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACnC,qDAAqD;gBACrD,MAAM,IAAI,iCAAmB,CAAC,8BAA8B,CAAC,CAAA;YAC/D,CAAC;YAED,MAAM,GAAG,GAAG,IAAA,0BAAY,EAAC,GAAG,CAAC,CAAA;YAC7B,IAAI,yBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,iCAAmB,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAA;YACnE,CAAC;Y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ClD,CAAC,CAAA;AAED,SAAS,gBAAgB,CAAuB,GAAY;IAC1D,mBAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,oCAAoC,CAAC,CAAA;AAChE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/pds",
3
- "version": "0.4.60",
3
+ "version": "0.4.62",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of atproto Personal Data Server (PDS)",
6
6
  "keywords": [
@@ -44,18 +44,18 @@
44
44
  "uint8arrays": "3.0.0",
45
45
  "undici": "^6.19.8",
46
46
  "zod": "^3.23.8",
47
- "@atproto/api": "^0.13.8",
48
- "@atproto/aws": "^0.2.6",
49
- "@atproto/common": "^0.4.3",
47
+ "@atproto-labs/fetch-node": "0.1.2",
48
+ "@atproto/api": "^0.13.10",
49
+ "@atproto/aws": "^0.2.7",
50
+ "@atproto/common": "^0.4.4",
50
51
  "@atproto/crypto": "^0.4.1",
51
52
  "@atproto/identity": "^0.4.2",
52
- "@atproto-labs/fetch-node": "0.1.1",
53
53
  "@atproto/lexicon": "^0.4.2",
54
- "@atproto/oauth-provider": "^0.2.2",
55
- "@atproto/repo": "^0.5.2",
54
+ "@atproto/oauth-provider": "^0.2.4",
55
+ "@atproto/repo": "^0.5.3",
56
+ "@atproto/syntax": "^0.3.0",
56
57
  "@atproto/xrpc": "^0.6.3",
57
- "@atproto/xrpc-server": "^0.7.0",
58
- "@atproto/syntax": "^0.3.0"
58
+ "@atproto/xrpc-server": "^0.7.1"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@atproto/pds-entryway": "npm:@atproto/pds@0.3.0-entryway.3",
@@ -73,8 +73,8 @@
73
73
  "jest": "^28.1.2",
74
74
  "ts-node": "^10.8.2",
75
75
  "ws": "^8.12.0",
76
- "@atproto/api": "^0.13.8",
77
- "@atproto/bsky": "^0.0.84",
76
+ "@atproto/api": "^0.13.10",
77
+ "@atproto/bsky": "^0.0.86",
78
78
  "@atproto/lex-cli": "^0.5.1"
79
79
  },
80
80
  "scripts": {
@@ -64,6 +64,28 @@ export const getAccount = async (
64
64
  return found || null
65
65
  }
66
66
 
67
+ export const getAccounts = async (
68
+ db: AccountDb,
69
+ dids: string[],
70
+ flags?: AvailabilityFlags,
71
+ ): Promise<Map<string, ActorAccount>> => {
72
+ const results = new Map<string, ActorAccount>()
73
+
74
+ if (!dids.length) {
75
+ return results
76
+ }
77
+
78
+ const accounts = await selectAccountQB(db, flags)
79
+ .where('actor.did', 'in', dids)
80
+ .execute()
81
+
82
+ accounts.forEach((account) => {
83
+ results.set(account.did, account)
84
+ })
85
+
86
+ return results
87
+ }
88
+
67
89
  export const getAccountByEmail = async (
68
90
  db: AccountDb,
69
91
  email: string,
@@ -139,20 +139,30 @@ export const selectInviteCodesQb = (db: AccountDb) => {
139
139
  return db.db.selectFrom(builder.as('codes')).selectAll()
140
140
  }
141
141
 
142
- export const getAccountInviteCodes = async (
142
+ export const getAccountsInviteCodes = async (
143
143
  db: AccountDb,
144
- did: string,
145
- ): Promise<CodeDetail[]> => {
144
+ dids: string[],
145
+ ): Promise<Map<string, CodeDetail[]>> => {
146
+ const results = new Map<string, CodeDetail[]>()
147
+ // We don't want to pass an empty array to kysely and let's avoid running a query entirely if there is nothing to match for
148
+ if (!dids.length) return results
146
149
  const res = await selectInviteCodesQb(db)
147
- .where('forAccount', '=', did)
150
+ .where('forAccount', 'in', dids)
148
151
  .execute()
149
152
  const codes = res.map((row) => row.code)
150
153
  const uses = await getInviteCodesUses(db, codes)
151
- return res.map((row) => ({
152
- ...row,
153
- uses: uses[row.code] ?? [],
154
- disabled: row.disabled === 1,
155
- }))
154
+ res.forEach((row) => {
155
+ const existing = results.get(row.forAccount) ?? []
156
+ results.set(row.forAccount, [
157
+ ...existing,
158
+ {
159
+ ...row,
160
+ uses: uses[row.code] ?? [],
161
+ disabled: row.disabled === 1,
162
+ },
163
+ ])
164
+ })
165
+ return results
156
166
  }
157
167
 
158
168
  export const getInviteCodesUses = async (
@@ -78,6 +78,13 @@ export class AccountManager
78
78
  return account.getAccount(this.db, handleOrDid, flags)
79
79
  }
80
80
 
81
+ async getAccounts(
82
+ dids: string[],
83
+ flags?: account.AvailabilityFlags,
84
+ ): Promise<Map<string, ActorAccount>> {
85
+ return account.getAccounts(this.db, dids, flags)
86
+ }
87
+
81
88
  async getAccountByEmail(
82
89
  email: string,
83
90
  flags?: account.AvailabilityFlags,
@@ -397,7 +404,12 @@ export class AccountManager
397
404
  }
398
405
 
399
406
  async getAccountInvitesCodes(did: string) {
400
- return invite.getAccountInviteCodes(this.db, did)
407
+ const inviteCodes = await invite.getAccountsInviteCodes(this.db, [did])
408
+ return inviteCodes.get(did) ?? []
409
+ }
410
+
411
+ async getAccountsInvitesCodes(dids: string[]) {
412
+ return invite.getAccountsInviteCodes(this.db, dids)
401
413
  }
402
414
 
403
415
  async getInvitedByForAccounts(dids: string[]) {
@@ -2,6 +2,7 @@ import { Server } from '../../../../lexicon'
2
2
  import AppContext from '../../../../context'
3
3
  import { InvalidRequestError } from '@atproto/xrpc-server'
4
4
  import { INVALID_HANDLE } from '@atproto/syntax'
5
+ import { formatAccountInfo } from './util'
5
6
 
6
7
  export default function (server: Server, ctx: AppContext) {
7
8
  server.com.atproto.admin.getAccountInfo({
@@ -21,19 +22,11 @@ export default function (server: Server, ctx: AppContext) {
21
22
  const managesOwnInvites = !ctx.cfg.entryway
22
23
  return {
23
24
  encoding: 'application/json',
24
- body: {
25
- did: account.did,
26
- handle: account.handle ?? INVALID_HANDLE,
27
- email: account.email ?? undefined,
28
- indexedAt: account.createdAt,
29
- emailConfirmedAt: account.emailConfirmedAt ?? undefined,
30
- invitedBy: managesOwnInvites ? invitedBy[params.did] : undefined,
31
- invites: managesOwnInvites ? invites : undefined,
32
- invitesDisabled: managesOwnInvites
33
- ? account.invitesDisabled === 1
34
- : undefined,
35
- deactivatedAt: account.deactivatedAt ?? undefined,
36
- },
25
+ body: formatAccountInfo(account, {
26
+ managesOwnInvites,
27
+ invitedBy,
28
+ invites,
29
+ }),
37
30
  }
38
31
  },
39
32
  })
@@ -0,0 +1,33 @@
1
+ import { Server } from '../../../../lexicon'
2
+ import AppContext from '../../../../context'
3
+ import { formatAccountInfo } from './util'
4
+
5
+ export default function (server: Server, ctx: AppContext) {
6
+ server.com.atproto.admin.getAccountInfos({
7
+ auth: ctx.authVerifier.moderator,
8
+ handler: async ({ params }) => {
9
+ const [accounts, invites, invitedBy] = await Promise.all([
10
+ ctx.accountManager.getAccounts(params.dids, {
11
+ includeDeactivated: true,
12
+ includeTakenDown: true,
13
+ }),
14
+ ctx.accountManager.getAccountsInvitesCodes(params.dids),
15
+ ctx.accountManager.getInvitedByForAccounts(params.dids),
16
+ ])
17
+
18
+ const managesOwnInvites = !ctx.cfg.entryway
19
+ const infos = Array.from(accounts.values()).map((account) => {
20
+ return formatAccountInfo(account, {
21
+ managesOwnInvites,
22
+ invitedBy,
23
+ invites,
24
+ })
25
+ })
26
+
27
+ return {
28
+ encoding: 'application/json',
29
+ body: { infos },
30
+ }
31
+ },
32
+ })
33
+ }
@@ -12,11 +12,13 @@ import updateAccountEmail from './updateAccountEmail'
12
12
  import updateAccountPassword from './updateAccountPassword'
13
13
  import sendEmail from './sendEmail'
14
14
  import deleteAccount from './deleteAccount'
15
+ import getAccountInfos from './getAccountInfos'
15
16
 
16
17
  export default function (server: Server, ctx: AppContext) {
17
18
  updateSubjectStatus(server, ctx)
18
19
  getSubjectStatus(server, ctx)
19
20
  getAccountInfo(server, ctx)
21
+ getAccountInfos(server, ctx)
20
22
  enableAccountInvites(server, ctx)
21
23
  disableAccountInvites(server, ctx)
22
24
  disableInviteCodes(server, ctx)
@@ -1,4 +1,7 @@
1
1
  import express from 'express'
2
+ import { ActorAccount } from '../../../../account-manager/helpers/account'
3
+ import { INVALID_HANDLE } from '@atproto/syntax'
4
+ import { CodeDetail } from '../../../../account-manager/helpers/invite'
2
5
 
3
6
  // Output designed to passed as second arg to AtpAgent methods.
4
7
  // The encoding field here is a quirk of the AtpAgent.
@@ -22,3 +25,38 @@ export function authPassthru(req: express.Request, withEncoding?: boolean) {
22
25
  }
23
26
  }
24
27
  }
28
+
29
+ export function formatAccountInfo(
30
+ account: ActorAccount,
31
+ {
32
+ managesOwnInvites,
33
+ invitedBy,
34
+ invites,
35
+ }: {
36
+ managesOwnInvites: boolean
37
+ invites: Map<string, CodeDetail[]> | CodeDetail[]
38
+ invitedBy: Record<string, CodeDetail>
39
+ },
40
+ ) {
41
+ let invitesResults: CodeDetail[] | undefined
42
+ if (managesOwnInvites) {
43
+ if (Array.isArray(invites)) {
44
+ invitesResults = invites
45
+ } else {
46
+ invitesResults = invites.get(account.did) || []
47
+ }
48
+ }
49
+ return {
50
+ did: account.did,
51
+ handle: account.handle ?? INVALID_HANDLE,
52
+ email: account.email ?? undefined,
53
+ indexedAt: account.createdAt,
54
+ emailConfirmedAt: account.emailConfirmedAt ?? undefined,
55
+ invitedBy: managesOwnInvites ? invitedBy[account.did] : undefined,
56
+ invites: invitesResults,
57
+ invitesDisabled: managesOwnInvites
58
+ ? account.invitesDisabled === 1
59
+ : undefined,
60
+ deactivatedAt: account.deactivatedAt ?? undefined,
61
+ }
62
+ }
@@ -16,7 +16,10 @@ export default function (server: Server, ctx: AppContext) {
16
16
  store.record.getRecord(uri, cid ?? null),
17
17
  )
18
18
  if (!record || record.takedownRef !== null) {
19
- throw new InvalidRequestError(`Could not locate record: ${uri}`)
19
+ throw new InvalidRequestError(
20
+ `Could not locate record: ${uri}`,
21
+ 'RecordNotFound',
22
+ )
20
23
  }
21
24
  return {
22
25
  encoding: 'application/json',
@@ -246,6 +246,7 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
246
246
  headersTimeout: env.proxyHeadersTimeout ?? 10e3,
247
247
  bodyTimeout: env.proxyBodyTimeout ?? 30e3,
248
248
  maxResponseSize: env.proxyMaxResponseSize ?? 10 * 1024 * 1024, // 10mb
249
+ preferCompressed: env.proxyPreferCompressed ?? false,
249
250
  }
250
251
 
251
252
  const oauthCfg: ServerConfig['oauth'] = entrywayCfg
@@ -413,6 +414,15 @@ export type ProxyConfig = {
413
414
  headersTimeout: number
414
415
  bodyTimeout: number
415
416
  maxResponseSize: number
417
+
418
+ /**
419
+ * When proxying requests that might get intercepted (for read-after-write) we
420
+ * negotiate the encoding based on the client's preferences. We will however
421
+ * use or own weights in order to be able to better control if the PDS will
422
+ * need to perform content decoding. This settings allows to prefer compressed
423
+ * content over uncompressed one.
424
+ */
425
+ preferCompressed: boolean
416
426
  }
417
427
 
418
428
  export type OAuthConfig = {
package/src/config/env.ts CHANGED
@@ -128,6 +128,7 @@ export const readEnv = (): ServerEnvironment => {
128
128
  proxyHeadersTimeout: envInt('PDS_PROXY_HEADERS_TIMEOUT'),
129
129
  proxyBodyTimeout: envInt('PDS_PROXY_BODY_TIMEOUT'),
130
130
  proxyMaxResponseSize: envInt('PDS_PROXY_MAX_RESPONSE_SIZE'),
131
+ proxyPreferCompressed: envBool('PDS_PROXY_PREFER_COMPRESSED'),
131
132
  }
132
133
  }
133
134
 
@@ -253,4 +254,5 @@ export type ServerEnvironment = {
253
254
  proxyHeadersTimeout?: number
254
255
  proxyBodyTimeout?: number
255
256
  proxyMaxResponseSize?: number
257
+ proxyPreferCompressed?: boolean
256
258
  }