@atproto/bsky 0.0.10 → 0.0.12

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 (173) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/api/com/atproto/admin/util.d.ts +5 -0
  3. package/dist/config.d.ts +2 -0
  4. package/dist/context.d.ts +8 -0
  5. package/dist/db/index.js +51 -2
  6. package/dist/db/index.js.map +3 -3
  7. package/dist/db/migrations/20230929T192920807Z-record-cursor-indexes.d.ts +3 -0
  8. package/dist/db/migrations/index.d.ts +1 -0
  9. package/dist/did-cache.d.ts +2 -2
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.js +1818 -580
  12. package/dist/index.js.map +3 -3
  13. package/dist/lexicon/index.d.ts +16 -0
  14. package/dist/lexicon/lexicons.d.ts +330 -3
  15. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +1 -0
  16. package/dist/lexicon/types/com/atproto/admin/defs.d.ts +28 -0
  17. package/dist/lexicon/types/com/atproto/admin/getAccountInfo.d.ts +29 -0
  18. package/dist/lexicon/types/com/atproto/admin/getSubjectStatus.d.ts +39 -0
  19. package/dist/lexicon/types/com/atproto/admin/searchRepos.d.ts +0 -1
  20. package/dist/lexicon/types/com/atproto/admin/updateSubjectStatus.d.ts +46 -0
  21. package/dist/lexicon/types/com/atproto/server/confirmEmail.d.ts +27 -0
  22. package/dist/lexicon/types/com/atproto/server/createAccount.d.ts +2 -0
  23. package/dist/lexicon/types/com/atproto/server/createSession.d.ts +2 -0
  24. package/dist/lexicon/types/com/atproto/server/getSession.d.ts +1 -0
  25. package/dist/lexicon/types/com/atproto/server/refreshSession.d.ts +1 -0
  26. package/dist/lexicon/types/com/atproto/server/requestEmailConfirmation.d.ts +19 -0
  27. package/dist/lexicon/types/com/atproto/server/requestEmailUpdate.d.ts +30 -0
  28. package/dist/lexicon/types/com/atproto/server/reserveSigningKey.d.ts +30 -0
  29. package/dist/lexicon/types/com/atproto/server/updateEmail.d.ts +27 -0
  30. package/dist/lexicon/types/com/atproto/sync/listRepos.d.ts +1 -0
  31. package/dist/services/actor/index.d.ts +2 -2
  32. package/dist/services/actor/types.d.ts +1 -0
  33. package/dist/services/graph/index.d.ts +2 -0
  34. package/dist/services/moderation/index.d.ts +13 -3
  35. package/dist/services/util/search.d.ts +3 -3
  36. package/package.json +13 -14
  37. package/src/api/app/bsky/actor/searchActors.ts +36 -22
  38. package/src/api/app/bsky/actor/searchActorsTypeahead.ts +24 -17
  39. package/src/api/app/bsky/feed/getAuthorFeed.ts +2 -2
  40. package/src/api/app/bsky/feed/getPostThread.ts +2 -2
  41. package/src/api/app/bsky/graph/getSuggestedFollowsByActor.ts +1 -0
  42. package/src/api/app/bsky/notification/listNotifications.ts +33 -22
  43. package/src/api/com/atproto/admin/getModerationAction.ts +28 -2
  44. package/src/api/com/atproto/admin/getModerationReport.ts +27 -2
  45. package/src/api/com/atproto/admin/getRecord.ts +14 -2
  46. package/src/api/com/atproto/admin/getRepo.ts +13 -2
  47. package/src/api/com/atproto/admin/reverseModerationAction.ts +31 -5
  48. package/src/api/com/atproto/admin/searchRepos.ts +6 -12
  49. package/src/api/com/atproto/admin/takeModerationAction.ts +41 -7
  50. package/src/api/com/atproto/admin/util.ts +50 -0
  51. package/src/api/well-known.ts +8 -0
  52. package/src/auth.ts +12 -5
  53. package/src/auto-moderator/index.ts +1 -0
  54. package/src/config.ts +7 -0
  55. package/src/context.ts +30 -0
  56. package/src/db/migrations/20230929T192920807Z-record-cursor-indexes.ts +40 -0
  57. package/src/db/migrations/index.ts +1 -0
  58. package/src/did-cache.ts +29 -14
  59. package/src/feed-gen/with-friends.ts +2 -2
  60. package/src/index.ts +9 -1
  61. package/src/indexer/subscription.ts +1 -21
  62. package/src/lexicon/index.ts +96 -0
  63. package/src/lexicon/lexicons.ts +368 -4
  64. package/src/lexicon/types/app/bsky/actor/defs.ts +1 -0
  65. package/src/lexicon/types/com/atproto/admin/defs.ts +61 -0
  66. package/src/lexicon/types/com/atproto/admin/getAccountInfo.ts +41 -0
  67. package/src/lexicon/types/com/atproto/admin/getSubjectStatus.ts +54 -0
  68. package/src/lexicon/types/com/atproto/admin/searchRepos.ts +0 -1
  69. package/src/lexicon/types/com/atproto/admin/updateSubjectStatus.ts +61 -0
  70. package/src/lexicon/types/com/atproto/server/confirmEmail.ts +40 -0
  71. package/src/lexicon/types/com/atproto/server/createAccount.ts +2 -0
  72. package/src/lexicon/types/com/atproto/server/createSession.ts +2 -0
  73. package/src/lexicon/types/com/atproto/server/getSession.ts +1 -0
  74. package/src/lexicon/types/com/atproto/server/refreshSession.ts +1 -0
  75. package/src/lexicon/types/com/atproto/server/requestEmailConfirmation.ts +31 -0
  76. package/src/lexicon/types/com/atproto/server/requestEmailUpdate.ts +43 -0
  77. package/src/lexicon/types/com/atproto/server/reserveSigningKey.ts +44 -0
  78. package/src/lexicon/types/com/atproto/server/updateEmail.ts +41 -0
  79. package/src/lexicon/types/com/atproto/sync/listRepos.ts +1 -0
  80. package/src/logger.ts +8 -0
  81. package/src/services/actor/index.ts +16 -10
  82. package/src/services/actor/types.ts +1 -0
  83. package/src/services/actor/views.ts +26 -8
  84. package/src/services/graph/index.ts +26 -7
  85. package/src/services/indexing/index.ts +15 -17
  86. package/src/services/moderation/index.ts +94 -14
  87. package/src/services/moderation/views.ts +1 -0
  88. package/src/services/util/search.ts +24 -23
  89. package/tests/__snapshots__/feed-generation.test.ts.snap +12 -12
  90. package/tests/__snapshots__/indexing.test.ts.snap +4 -4
  91. package/tests/admin/__snapshots__/get-moderation-action.test.ts.snap +172 -0
  92. package/tests/admin/__snapshots__/get-moderation-actions.test.ts.snap +178 -0
  93. package/tests/admin/__snapshots__/get-moderation-report.test.ts.snap +177 -0
  94. package/tests/admin/__snapshots__/get-moderation-reports.test.ts.snap +307 -0
  95. package/tests/admin/__snapshots__/get-record.test.ts.snap +275 -0
  96. package/tests/admin/__snapshots__/get-repo.test.ts.snap +103 -0
  97. package/tests/admin/get-moderation-action.test.ts +100 -0
  98. package/tests/admin/get-moderation-actions.test.ts +164 -0
  99. package/tests/admin/get-moderation-report.test.ts +100 -0
  100. package/tests/admin/get-moderation-reports.test.ts +332 -0
  101. package/tests/admin/get-record.test.ts +115 -0
  102. package/tests/admin/get-repo.test.ts +101 -0
  103. package/tests/{moderation.test.ts → admin/moderation.test.ts} +107 -9
  104. package/tests/admin/repo-search.test.ts +124 -0
  105. package/tests/algos/hot-classic.test.ts +3 -5
  106. package/tests/algos/whats-hot.test.ts +3 -5
  107. package/tests/algos/with-friends.test.ts +2 -4
  108. package/tests/auth.test.ts +64 -0
  109. package/tests/auto-moderator/fuzzy-matcher.test.ts +2 -3
  110. package/tests/auto-moderator/labeler.test.ts +5 -7
  111. package/tests/auto-moderator/takedowns.test.ts +11 -12
  112. package/tests/blob-resolver.test.ts +1 -3
  113. package/tests/did-cache.test.ts +2 -5
  114. package/tests/feed-generation.test.ts +8 -6
  115. package/tests/handle-invalidation.test.ts +2 -3
  116. package/tests/image/server.test.ts +1 -4
  117. package/tests/image/sharp.test.ts +1 -1
  118. package/tests/indexing.test.ts +4 -4
  119. package/tests/notification-server.test.ts +2 -3
  120. package/tests/pipeline/backpressure.test.ts +2 -3
  121. package/tests/pipeline/reingest.test.ts +7 -4
  122. package/tests/pipeline/repartition.test.ts +2 -3
  123. package/tests/reprocessing.test.ts +2 -6
  124. package/tests/seeds/basic.ts +4 -4
  125. package/tests/seeds/follows.ts +1 -1
  126. package/tests/seeds/likes.ts +1 -1
  127. package/tests/seeds/reposts.ts +1 -1
  128. package/tests/seeds/users-bulk.ts +1 -1
  129. package/tests/seeds/users.ts +1 -1
  130. package/tests/server.test.ts +1 -3
  131. package/tests/subscription/repo.test.ts +2 -4
  132. package/tests/views/__snapshots__/author-feed.test.ts.snap +24 -24
  133. package/tests/views/__snapshots__/block-lists.test.ts.snap +42 -7
  134. package/tests/views/__snapshots__/blocks.test.ts.snap +2 -2
  135. package/tests/views/__snapshots__/list-feed.test.ts.snap +6 -6
  136. package/tests/views/__snapshots__/mute-lists.test.ts.snap +15 -4
  137. package/tests/views/__snapshots__/mutes.test.ts.snap +2 -2
  138. package/tests/views/__snapshots__/notifications.test.ts.snap +2 -2
  139. package/tests/views/__snapshots__/posts.test.ts.snap +8 -8
  140. package/tests/views/__snapshots__/thread.test.ts.snap +10 -10
  141. package/tests/views/__snapshots__/timeline.test.ts.snap +58 -58
  142. package/tests/views/actor-likes.test.ts +2 -3
  143. package/tests/views/actor-search.test.ts +5 -5
  144. package/tests/views/admin/repo-search.test.ts +2 -4
  145. package/tests/views/author-feed.test.ts +2 -4
  146. package/tests/views/block-lists.test.ts +34 -7
  147. package/tests/views/blocks.test.ts +6 -3
  148. package/tests/views/follows.test.ts +2 -4
  149. package/tests/views/likes.test.ts +2 -5
  150. package/tests/views/list-feed.test.ts +2 -4
  151. package/tests/views/mute-lists.test.ts +23 -5
  152. package/tests/views/mutes.test.ts +2 -5
  153. package/tests/views/notifications.test.ts +2 -4
  154. package/tests/views/posts.test.ts +2 -5
  155. package/tests/views/profile.test.ts +4 -5
  156. package/tests/views/reposts.test.ts +2 -4
  157. package/tests/views/suggested-follows.test.ts +2 -3
  158. package/tests/views/suggestions.test.ts +2 -4
  159. package/tests/views/thread.test.ts +2 -4
  160. package/tests/views/threadgating.test.ts +2 -3
  161. package/tests/views/timeline.test.ts +2 -4
  162. package/dist/env.d.ts +0 -1
  163. package/example.dev.env +0 -5
  164. package/src/env.ts +0 -9
  165. package/tests/seeds/client.ts +0 -466
  166. /package/tests/{__snapshots__ → admin/__snapshots__}/moderation.test.ts.snap +0 -0
  167. /package/tests/{image/fixtures → sample-img}/at.png +0 -0
  168. /package/tests/{image/fixtures → sample-img}/hd-key.jpg +0 -0
  169. /package/tests/{image/fixtures → sample-img}/key-alt.jpg +0 -0
  170. /package/tests/{image/fixtures → sample-img}/key-landscape-large.jpg +0 -0
  171. /package/tests/{image/fixtures → sample-img}/key-landscape-small.jpg +0 -0
  172. /package/tests/{image/fixtures → sample-img}/key-portrait-large.jpg +0 -0
  173. /package/tests/{image/fixtures → sample-img}/key-portrait-small.jpg +0 -0
package/dist/index.js CHANGED
@@ -27864,16 +27864,16 @@ var require_validate = __commonJS({
27864
27864
  const matches = RELATIVE_JSON_POINTER.exec($data);
27865
27865
  if (!matches)
27866
27866
  throw new Error(`Invalid JSON-pointer: ${$data}`);
27867
- const up28 = +matches[1];
27867
+ const up29 = +matches[1];
27868
27868
  jsonPointer = matches[2];
27869
27869
  if (jsonPointer === "#") {
27870
- if (up28 >= dataLevel)
27871
- throw new Error(errorMsg("property/index", up28));
27872
- return dataPathArr[dataLevel - up28];
27870
+ if (up29 >= dataLevel)
27871
+ throw new Error(errorMsg("property/index", up29));
27872
+ return dataPathArr[dataLevel - up29];
27873
27873
  }
27874
- if (up28 > dataLevel)
27875
- throw new Error(errorMsg("data", up28));
27876
- data = dataNames[dataLevel - up28];
27874
+ if (up29 > dataLevel)
27875
+ throw new Error(errorMsg("data", up29));
27876
+ data = dataNames[dataLevel - up29];
27877
27877
  if (!jsonPointer)
27878
27878
  return data;
27879
27879
  }
@@ -27886,8 +27886,8 @@ var require_validate = __commonJS({
27886
27886
  }
27887
27887
  }
27888
27888
  return expr;
27889
- function errorMsg(pointerType, up28) {
27890
- return `Cannot access ${pointerType} ${up28} levels up, current level is ${dataLevel}`;
27889
+ function errorMsg(pointerType, up29) {
27890
+ return `Cannot access ${pointerType} ${up29} levels up, current level is ${dataLevel}`;
27891
27891
  }
27892
27892
  }
27893
27893
  exports.getData = getData;
@@ -99623,16 +99623,18 @@ var decompressPubkey2 = (compressed) => {
99623
99623
  };
99624
99624
 
99625
99625
  // ../crypto/src/p256/operations.ts
99626
- var verifyDidSig = async (did2, data, sig) => {
99626
+ var verifyDidSig = async (did2, data, sig, opts) => {
99627
99627
  const { jwtAlg, keyBytes } = parseDidKey(did2);
99628
99628
  if (jwtAlg !== P256_JWT_ALG) {
99629
99629
  throw new Error(`Not a P-256 did:key: ${did2}`);
99630
99630
  }
99631
- return verifySig(keyBytes, data, sig);
99631
+ return verifySig(keyBytes, data, sig, opts);
99632
99632
  };
99633
- var verifySig = async (publicKey, data, sig) => {
99633
+ var verifySig = async (publicKey, data, sig, opts) => {
99634
99634
  const msgHash = await sha2562(data);
99635
- return p256.verify(sig, msgHash, publicKey, { lowS: true });
99635
+ return p256.verify(sig, msgHash, publicKey, {
99636
+ lowS: opts?.lowS ?? true
99637
+ });
99636
99638
  };
99637
99639
 
99638
99640
  // ../crypto/src/p256/plugin.ts
@@ -99644,16 +99646,18 @@ var p256Plugin = {
99644
99646
  var plugin_default = p256Plugin;
99645
99647
 
99646
99648
  // ../crypto/src/secp256k1/operations.ts
99647
- var verifyDidSig2 = async (did2, data, sig) => {
99649
+ var verifyDidSig2 = async (did2, data, sig, opts) => {
99648
99650
  const { jwtAlg, keyBytes } = parseDidKey(did2);
99649
99651
  if (jwtAlg !== SECP256K1_JWT_ALG) {
99650
99652
  throw new Error(`Not a secp256k1 did:key: ${did2}`);
99651
99653
  }
99652
- return verifySig2(keyBytes, data, sig);
99654
+ return verifySig2(keyBytes, data, sig, opts);
99653
99655
  };
99654
- var verifySig2 = async (publicKey, data, sig) => {
99656
+ var verifySig2 = async (publicKey, data, sig, opts) => {
99655
99657
  const msgHash = await sha2562(data);
99656
- return secp256k1.verify(sig, msgHash, publicKey, { lowS: true });
99658
+ return secp256k1.verify(sig, msgHash, publicKey, {
99659
+ lowS: opts?.lowS ?? true
99660
+ });
99657
99661
  };
99658
99662
 
99659
99663
  // ../crypto/src/secp256k1/plugin.ts
@@ -99757,13 +99761,13 @@ var randomIntFromSeed = async (seed, high, low = 0) => {
99757
99761
  };
99758
99762
 
99759
99763
  // ../crypto/src/verify.ts
99760
- var verifySignature = (didKey, data, sig) => {
99764
+ var verifySignature = (didKey, data, sig, opts) => {
99761
99765
  const parsed = parseDidKey(didKey);
99762
99766
  const plugin = plugins_default.find((p) => p.jwtAlg === parsed.jwtAlg);
99763
99767
  if (!plugin) {
99764
- throw new Error(`Unsupported signature alg: :${parsed.jwtAlg}`);
99768
+ throw new Error(`Unsupported signature alg: ${parsed.jwtAlg}`);
99765
99769
  }
99766
- return plugin.verifySignature(didKey, data, sig);
99770
+ return plugin.verifySignature(didKey, data, sig, opts);
99767
99771
  };
99768
99772
 
99769
99773
  // ../common-web/src/check.ts
@@ -99848,6 +99852,19 @@ var createDeferrable = () => {
99848
99852
  });
99849
99853
  return { resolve, complete: promise };
99850
99854
  };
99855
+ var handleAllSettledErrors = (results) => {
99856
+ const errors = results.filter(isRejected).map((res) => res.reason);
99857
+ if (errors.length === 0) {
99858
+ return;
99859
+ }
99860
+ if (errors.length === 1) {
99861
+ throw errors[0];
99862
+ }
99863
+ throw new AggregateError(errors, "Multiple errors: " + errors.map((err) => err?.message).join("\n"));
99864
+ };
99865
+ var isRejected = (result) => {
99866
+ return result.status === "rejected";
99867
+ };
99851
99868
 
99852
99869
  // ../common-web/src/tid.ts
99853
99870
  var TID_LEN = 13;
@@ -103609,6 +103626,9 @@ var graphemeLen = (str) => {
103609
103626
  const splitter = new import_graphemer.default();
103610
103627
  return splitter.countGraphemes(str);
103611
103628
  };
103629
+ var utf8ToB64Url = (utf8) => {
103630
+ return toString2(fromString2(utf8, "utf8"), "base64url");
103631
+ };
103612
103632
  var b64UrlToUtf8 = (b64) => {
103613
103633
  return toString2(fromString2(b64, "base64url"), "utf8");
103614
103634
  };
@@ -103617,26 +103637,10 @@ var validateLanguage = (langTag) => {
103617
103637
  };
103618
103638
  var bcp47Regexp = /^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUseA>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUseB>x(-[A-Za-z0-9]{1,8})+))$/;
103619
103639
 
103620
- // ../identity/src/types.ts
103621
- var verificationMethod = objectType({
103622
- id: stringType(),
103623
- type: stringType(),
103624
- controller: stringType(),
103625
- publicKeyMultibase: stringType().optional()
103626
- });
103627
- var service = objectType({
103628
- id: stringType(),
103629
- type: stringType(),
103630
- serviceEndpoint: unionType([stringType(), recordType(unknownType())])
103631
- });
103632
- var didDocument = objectType({
103633
- id: stringType(),
103634
- alsoKnownAs: arrayType(stringType()).optional(),
103635
- verificationMethod: arrayType(verificationMethod).optional(),
103636
- service: arrayType(service).optional()
103637
- });
103638
-
103639
- // ../identity/src/did/atproto-data.ts
103640
+ // ../common-web/src/did-doc.ts
103641
+ var isValidDidDoc = (doc) => {
103642
+ return didDocument.safeParse(doc).success;
103643
+ };
103640
103644
  var getDid = (doc) => {
103641
103645
  const id = doc.id;
103642
103646
  if (typeof id !== "string") {
@@ -103644,7 +103648,16 @@ var getDid = (doc) => {
103644
103648
  }
103645
103649
  return id;
103646
103650
  };
103647
- var getKey = (doc) => {
103651
+ var getHandle = (doc) => {
103652
+ const aka = doc.alsoKnownAs;
103653
+ if (!aka)
103654
+ return void 0;
103655
+ const found = aka.find((name3) => name3.startsWith("at://"));
103656
+ if (!found)
103657
+ return void 0;
103658
+ return found.slice(5);
103659
+ };
103660
+ var getSigningKey = (doc) => {
103648
103661
  const did2 = getDid(doc);
103649
103662
  let keys = doc.verificationMethod;
103650
103663
  if (!keys)
@@ -103655,50 +103668,103 @@ var getKey = (doc) => {
103655
103668
  keys = [keys];
103656
103669
  }
103657
103670
  const found = keys.find((key) => key.id === "#atproto" || key.id === `${did2}#atproto`);
103658
- if (!found)
103671
+ if (!found?.publicKeyMultibase)
103659
103672
  return void 0;
103660
- if (!found.publicKeyMultibase)
103661
- return void 0;
103662
- const keyBytes = multibaseToBytes(found.publicKeyMultibase);
103663
- let didKey = void 0;
103664
- if (found.type === "EcdsaSecp256r1VerificationKey2019") {
103665
- didKey = formatDidKey(P256_JWT_ALG, keyBytes);
103666
- } else if (found.type === "EcdsaSecp256k1VerificationKey2019") {
103667
- didKey = formatDidKey(SECP256K1_JWT_ALG, keyBytes);
103668
- } else if (found.type === "Multikey") {
103669
- const parsed = parseMultikey(found.publicKeyMultibase);
103670
- didKey = formatDidKey(parsed.jwtAlg, parsed.keyBytes);
103671
- }
103672
- return didKey;
103673
- };
103674
- var getHandle = (doc) => {
103675
- const aka = doc.alsoKnownAs;
103676
- if (!aka)
103677
- return void 0;
103678
- const found = aka.find((name3) => name3.startsWith("at://"));
103679
- if (!found)
103680
- return void 0;
103681
- return found.slice(5);
103673
+ return {
103674
+ type: found.type,
103675
+ publicKeyMultibase: found.publicKeyMultibase
103676
+ };
103682
103677
  };
103683
- var getPds = (doc) => {
103678
+ var getPdsEndpoint = (doc) => {
103684
103679
  return getServiceEndpoint(doc, {
103685
103680
  id: "#atproto_pds",
103686
103681
  type: "AtprotoPersonalDataServer"
103687
103682
  });
103688
103683
  };
103689
- var getFeedGen = (doc) => {
103684
+ var getFeedGenEndpoint = (doc) => {
103690
103685
  return getServiceEndpoint(doc, {
103691
103686
  id: "#bsky_fg",
103692
103687
  type: "BskyFeedGenerator"
103693
103688
  });
103694
103689
  };
103690
+ var getServiceEndpoint = (doc, opts) => {
103691
+ const did2 = getDid(doc);
103692
+ let services = doc.service;
103693
+ if (!services)
103694
+ return void 0;
103695
+ if (typeof services !== "object")
103696
+ return void 0;
103697
+ if (!Array.isArray(services)) {
103698
+ services = [services];
103699
+ }
103700
+ const found = services.find((service2) => service2.id === opts.id || service2.id === `${did2}${opts.id}`);
103701
+ if (!found)
103702
+ return void 0;
103703
+ if (found.type !== opts.type) {
103704
+ return void 0;
103705
+ }
103706
+ if (typeof found.serviceEndpoint !== "string") {
103707
+ return void 0;
103708
+ }
103709
+ return validateUrl(found.serviceEndpoint);
103710
+ };
103711
+ var validateUrl = (urlStr) => {
103712
+ let url;
103713
+ try {
103714
+ url = new URL(urlStr);
103715
+ } catch {
103716
+ return void 0;
103717
+ }
103718
+ if (!["http:", "https:"].includes(url.protocol)) {
103719
+ return void 0;
103720
+ } else if (!url.hostname) {
103721
+ return void 0;
103722
+ } else {
103723
+ return urlStr;
103724
+ }
103725
+ };
103726
+ var verificationMethod = z.object({
103727
+ id: z.string(),
103728
+ type: z.string(),
103729
+ controller: z.string(),
103730
+ publicKeyMultibase: z.string().optional()
103731
+ });
103732
+ var service = z.object({
103733
+ id: z.string(),
103734
+ type: z.string(),
103735
+ serviceEndpoint: z.union([z.string(), z.record(z.unknown())])
103736
+ });
103737
+ var didDocument = z.object({
103738
+ id: z.string(),
103739
+ alsoKnownAs: z.array(z.string()).optional(),
103740
+ verificationMethod: z.array(verificationMethod).optional(),
103741
+ service: z.array(service).optional()
103742
+ });
103743
+
103744
+ // ../identity/src/did/atproto-data.ts
103745
+ var getKey = (doc) => {
103746
+ const key = getSigningKey(doc);
103747
+ if (!key)
103748
+ return void 0;
103749
+ const keyBytes = multibaseToBytes(key.publicKeyMultibase);
103750
+ let didKey = void 0;
103751
+ if (key.type === "EcdsaSecp256r1VerificationKey2019") {
103752
+ didKey = formatDidKey(P256_JWT_ALG, keyBytes);
103753
+ } else if (key.type === "EcdsaSecp256k1VerificationKey2019") {
103754
+ didKey = formatDidKey(SECP256K1_JWT_ALG, keyBytes);
103755
+ } else if (key.type === "Multikey") {
103756
+ const parsed = parseMultikey(key.publicKeyMultibase);
103757
+ didKey = formatDidKey(parsed.jwtAlg, parsed.keyBytes);
103758
+ }
103759
+ return didKey;
103760
+ };
103695
103761
  var parseToAtprotoDocument = (doc) => {
103696
103762
  const did2 = getDid(doc);
103697
103763
  return {
103698
103764
  did: did2,
103699
103765
  signingKey: getKey(doc),
103700
103766
  handle: getHandle(doc),
103701
- pds: getPds(doc)
103767
+ pds: getPdsEndpoint(doc)
103702
103768
  };
103703
103769
  };
103704
103770
  var ensureAtpDocument = (doc) => {
@@ -103717,36 +103783,12 @@ var ensureAtpDocument = (doc) => {
103717
103783
  }
103718
103784
  return { did: did2, signingKey, handle: handle2, pds };
103719
103785
  };
103720
- var validateUrl = (url) => {
103721
- const { hostname, protocol } = new URL(url);
103722
- if (!["http:", "https:"].includes(protocol)) {
103723
- throw new Error("Invalid pds protocol");
103724
- }
103725
- if (!hostname) {
103726
- throw new Error("Invalid pds hostname");
103727
- }
103728
- };
103729
- var getServiceEndpoint = (doc, opts) => {
103730
- const did2 = getDid(doc);
103731
- let services = doc.service;
103732
- if (!services)
103733
- return void 0;
103734
- if (typeof services !== "object")
103735
- return void 0;
103736
- if (!Array.isArray(services)) {
103737
- services = [services];
103738
- }
103739
- const found = services.find((service2) => service2.id === opts.id || service2.id === `${did2}${opts.id}`);
103740
- if (!found)
103741
- return void 0;
103742
- if (found.type !== opts.type) {
103743
- return void 0;
103744
- }
103745
- if (typeof found.serviceEndpoint !== "string") {
103746
- return void 0;
103786
+ var ensureAtprotoKey = (doc) => {
103787
+ const { signingKey } = parseToAtprotoDocument(doc);
103788
+ if (!signingKey) {
103789
+ throw new Error(`Could not parse signingKey from doc: ${doc}`);
103747
103790
  }
103748
- validateUrl(found.serviceEndpoint);
103749
- return found.serviceEndpoint;
103791
+ return signingKey;
103750
103792
  };
103751
103793
 
103752
103794
  // ../identity/src/errors.ts
@@ -103802,16 +103844,17 @@ var BaseResolver = class {
103802
103844
  return null;
103803
103845
  return this.validateDidDoc(did2, got);
103804
103846
  }
103805
- async refreshCache(did2) {
103806
- await this.cache?.refreshCache(did2, () => this.resolveNoCache(did2));
103847
+ async refreshCache(did2, prevResult) {
103848
+ await this.cache?.refreshCache(did2, () => this.resolveNoCache(did2), prevResult);
103807
103849
  }
103808
103850
  async resolve(did2, forceRefresh = false) {
103851
+ let fromCache = null;
103809
103852
  if (this.cache && !forceRefresh) {
103810
- const fromCache = await this.cache.checkCache(did2);
103811
- if (fromCache?.stale) {
103812
- await this.refreshCache(did2);
103813
- }
103814
- if (fromCache) {
103853
+ fromCache = await this.cache.checkCache(did2);
103854
+ if (fromCache && !fromCache.expired) {
103855
+ if (fromCache?.stale) {
103856
+ await this.refreshCache(did2, fromCache);
103857
+ }
103815
103858
  return fromCache.doc;
103816
103859
  }
103817
103860
  }
@@ -103820,7 +103863,7 @@ var BaseResolver = class {
103820
103863
  await this.cache?.clearEntry(did2);
103821
103864
  return null;
103822
103865
  }
103823
- await this.cache?.cacheDid(did2, got);
103866
+ await this.cache?.cacheDid(did2, got, fromCache ?? void 0);
103824
103867
  return got;
103825
103868
  }
103826
103869
  async ensureResolve(did2, forceRefresh = false) {
@@ -103838,8 +103881,8 @@ var BaseResolver = class {
103838
103881
  if (did2.startsWith("did:key:")) {
103839
103882
  return did2;
103840
103883
  } else {
103841
- const data = await this.resolveAtprotoData(did2, forceRefresh);
103842
- return data.signingKey;
103884
+ const didDocument2 = await this.ensureResolve(did2, forceRefresh);
103885
+ return ensureAtprotoKey(didDocument2);
103843
103886
  }
103844
103887
  }
103845
103888
  async verifySignature(did2, data, sig, forceRefresh = false) {
@@ -103972,7 +104015,7 @@ var HandleResolver = class {
103972
104015
  const url = new URL("/.well-known/atproto-did", `https://${handle2}`);
103973
104016
  try {
103974
104017
  const res = await fetch(url, { signal });
103975
- const did2 = await res.text();
104018
+ const did2 = (await res.text()).split("\n")[0].trim();
103976
104019
  if (typeof did2 === "string" && did2.startsWith("did:")) {
103977
104020
  return did2;
103978
104021
  }
@@ -105260,15 +105303,6 @@ var discriminatedObject = z.object({ $type: z.string() });
105260
105303
  function isDiscriminatedObject(value) {
105261
105304
  return discriminatedObject.safeParse(value).success;
105262
105305
  }
105263
- var LexiconDocMalformedError = class extends Error {
105264
- constructor(message, schemaDef, issues) {
105265
- super(message);
105266
- this.schemaDef = schemaDef;
105267
- this.issues = issues;
105268
- this.schemaDef = schemaDef;
105269
- this.issues = issues;
105270
- }
105271
- };
105272
105306
  var ValidationError = class extends Error {
105273
105307
  };
105274
105308
  var InvalidLexiconError = class extends Error {
@@ -105349,23 +105383,13 @@ var Lexicons = class {
105349
105383
  }
105350
105384
  }
105351
105385
  add(doc) {
105352
- try {
105353
- lexiconDoc.parse(doc);
105354
- } catch (e) {
105355
- if (e instanceof ZodError) {
105356
- throw new LexiconDocMalformedError(`Failed to parse schema definition ${doc.id}`, doc, e.issues);
105357
- } else {
105358
- throw e;
105359
- }
105360
- }
105361
- const validatedDoc = doc;
105362
- const uri2 = toLexUri(validatedDoc.id);
105386
+ const uri2 = toLexUri(doc.id);
105363
105387
  if (this.docs.has(uri2)) {
105364
105388
  throw new Error(`${uri2} has already been registered`);
105365
105389
  }
105366
- resolveRefUris(validatedDoc, uri2);
105367
- this.docs.set(uri2, validatedDoc);
105368
- for (const [defUri, def3] of iterDefs(validatedDoc)) {
105390
+ resolveRefUris(doc, uri2);
105391
+ this.docs.set(uri2, doc);
105392
+ for (const [defUri, def3] of iterDefs(doc)) {
105369
105393
  this.defs.set(defUri, def3);
105370
105394
  }
105371
105395
  }
@@ -109920,7 +109944,27 @@ function ui8ToBuffer(bytes3) {
109920
109944
  }
109921
109945
 
109922
109946
  // ../xrpc-server/src/auth.ts
109923
- var verifyJwt = async (jwtStr, ownDid, getSigningKey) => {
109947
+ var createServiceJwt = async (params2) => {
109948
+ const { iss, aud, keypair } = params2;
109949
+ const exp = params2.exp ?? Math.floor((Date.now() + MINUTE) / 1e3);
109950
+ const header = {
109951
+ typ: "JWT",
109952
+ alg: keypair.jwtAlg
109953
+ };
109954
+ const payload = {
109955
+ iss,
109956
+ aud,
109957
+ exp
109958
+ };
109959
+ const toSignStr = `${jsonToB64Url(header)}.${jsonToB64Url(payload)}`;
109960
+ const toSign = fromString2(toSignStr, "utf8");
109961
+ const sig = await keypair.sign(toSign);
109962
+ return `${toSignStr}.${toString2(sig, "base64url")}`;
109963
+ };
109964
+ var jsonToB64Url = (json) => {
109965
+ return utf8ToB64Url(JSON.stringify(json));
109966
+ };
109967
+ var verifyJwt = async (jwtStr, ownDid, getSigningKey2) => {
109924
109968
  const parts = jwtStr.split(".");
109925
109969
  if (parts.length !== 3) {
109926
109970
  throw new AuthRequiredError("poorly formatted jwt", "BadJwt");
@@ -109935,17 +109979,30 @@ var verifyJwt = async (jwtStr, ownDid, getSigningKey) => {
109935
109979
  }
109936
109980
  const msgBytes = fromString2(parts.slice(0, 2).join("."), "utf8");
109937
109981
  const sigBytes = fromString2(sig, "base64url");
109938
- const signingKey = await getSigningKey(payload.iss);
109982
+ const verifySignatureWithKey = (key) => {
109983
+ return verifySignature(key, msgBytes, sigBytes, {
109984
+ lowS: false
109985
+ });
109986
+ };
109987
+ const signingKey = await getSigningKey2(payload.iss, false);
109939
109988
  let validSig;
109940
109989
  try {
109941
- validSig = await verifySignature(signingKey, msgBytes, sigBytes);
109990
+ validSig = await verifySignatureWithKey(signingKey);
109942
109991
  } catch (err) {
109943
109992
  throw new AuthRequiredError("could not verify jwt signature", "BadJwtSignature");
109944
109993
  }
109994
+ if (!validSig) {
109995
+ const freshSigningKey = await getSigningKey2(payload.iss, true);
109996
+ try {
109997
+ validSig = freshSigningKey !== signingKey ? await verifySignatureWithKey(freshSigningKey) : false;
109998
+ } catch (err) {
109999
+ throw new AuthRequiredError("could not verify jwt signature", "BadJwtSignature");
110000
+ }
110001
+ }
109945
110002
  if (!validSig) {
109946
110003
  throw new AuthRequiredError("jwt signature does not match jwt issuer", "BadJwtSignature");
109947
110004
  }
109948
- return payload.iss;
110005
+ return payload;
109949
110006
  };
109950
110007
  var parseB64UrlToJson = (b64) => {
109951
110008
  return JSON.parse(b64UrlToUtf8(b64));
@@ -118755,7 +118812,7 @@ var skeleton2 = async (params2, ctx) => {
118755
118812
  }
118756
118813
  let feedItemsQb = feedService.selectFeedItemQb().where("originatorDid", "=", actorDid);
118757
118814
  if (filter === "posts_with_media") {
118758
- feedItemsQb = feedItemsQb.where("post.creator", "=", actorDid).whereExists((qb) => qb.selectFrom("post_embed_image").select("post_embed_image.postUri").whereRef("post_embed_image.postUri", "=", "feed_item.postUri"));
118815
+ feedItemsQb = feedItemsQb.where("type", "=", "post").whereExists((qb) => qb.selectFrom("post_embed_image").select("post_embed_image.postUri").whereRef("post_embed_image.postUri", "=", "feed_item.postUri"));
118759
118816
  } else if (filter === "posts_no_replies") {
118760
118817
  feedItemsQb = feedItemsQb.where((qb) => qb.where("post.replyParent", "is", null).orWhere("type", "=", "repost"));
118761
118818
  }
@@ -118806,6 +118863,18 @@ var schemaDict = {
118806
118863
  lexicon: 1,
118807
118864
  id: "com.atproto.admin.defs",
118808
118865
  defs: {
118866
+ statusAttr: {
118867
+ type: "object",
118868
+ required: ["applied"],
118869
+ properties: {
118870
+ applied: {
118871
+ type: "boolean"
118872
+ },
118873
+ ref: {
118874
+ type: "string"
118875
+ }
118876
+ }
118877
+ },
118809
118878
  actionView: {
118810
118879
  type: "object",
118811
118880
  required: [
@@ -119215,6 +119284,44 @@ var schemaDict = {
119215
119284
  }
119216
119285
  }
119217
119286
  },
119287
+ accountView: {
119288
+ type: "object",
119289
+ required: ["did", "handle", "indexedAt"],
119290
+ properties: {
119291
+ did: {
119292
+ type: "string",
119293
+ format: "did"
119294
+ },
119295
+ handle: {
119296
+ type: "string",
119297
+ format: "handle"
119298
+ },
119299
+ email: {
119300
+ type: "string"
119301
+ },
119302
+ indexedAt: {
119303
+ type: "string",
119304
+ format: "datetime"
119305
+ },
119306
+ invitedBy: {
119307
+ type: "ref",
119308
+ ref: "lex:com.atproto.server.defs#inviteCode"
119309
+ },
119310
+ invites: {
119311
+ type: "array",
119312
+ items: {
119313
+ type: "ref",
119314
+ ref: "lex:com.atproto.server.defs#inviteCode"
119315
+ }
119316
+ },
119317
+ invitesDisabled: {
119318
+ type: "boolean"
119319
+ },
119320
+ inviteNote: {
119321
+ type: "string"
119322
+ }
119323
+ }
119324
+ },
119218
119325
  repoViewNotFound: {
119219
119326
  type: "object",
119220
119327
  required: ["did"],
@@ -119235,6 +119342,24 @@ var schemaDict = {
119235
119342
  }
119236
119343
  }
119237
119344
  },
119345
+ repoBlobRef: {
119346
+ type: "object",
119347
+ required: ["did", "cid"],
119348
+ properties: {
119349
+ did: {
119350
+ type: "string",
119351
+ format: "did"
119352
+ },
119353
+ cid: {
119354
+ type: "string",
119355
+ format: "cid"
119356
+ },
119357
+ recordUri: {
119358
+ type: "string",
119359
+ format: "at-uri"
119360
+ }
119361
+ }
119362
+ },
119238
119363
  recordView: {
119239
119364
  type: "object",
119240
119365
  required: [
@@ -119517,6 +119642,33 @@ var schemaDict = {
119517
119642
  }
119518
119643
  }
119519
119644
  },
119645
+ ComAtprotoAdminGetAccountInfo: {
119646
+ lexicon: 1,
119647
+ id: "com.atproto.admin.getAccountInfo",
119648
+ defs: {
119649
+ main: {
119650
+ type: "query",
119651
+ description: "View details about an account.",
119652
+ parameters: {
119653
+ type: "params",
119654
+ required: ["did"],
119655
+ properties: {
119656
+ did: {
119657
+ type: "string",
119658
+ format: "did"
119659
+ }
119660
+ }
119661
+ },
119662
+ output: {
119663
+ encoding: "application/json",
119664
+ schema: {
119665
+ type: "ref",
119666
+ ref: "lex:com.atproto.admin.defs#accountView"
119667
+ }
119668
+ }
119669
+ }
119670
+ }
119671
+ },
119520
119672
  ComAtprotoAdminGetInviteCodes: {
119521
119673
  lexicon: 1,
119522
119674
  id: "com.atproto.admin.getInviteCodes",
@@ -119811,6 +119963,54 @@ var schemaDict = {
119811
119963
  }
119812
119964
  }
119813
119965
  },
119966
+ ComAtprotoAdminGetSubjectStatus: {
119967
+ lexicon: 1,
119968
+ id: "com.atproto.admin.getSubjectStatus",
119969
+ defs: {
119970
+ main: {
119971
+ type: "query",
119972
+ description: "Fetch the service-specific the admin status of a subject (account, record, or blob)",
119973
+ parameters: {
119974
+ type: "params",
119975
+ properties: {
119976
+ did: {
119977
+ type: "string",
119978
+ format: "did"
119979
+ },
119980
+ uri: {
119981
+ type: "string",
119982
+ format: "at-uri"
119983
+ },
119984
+ blob: {
119985
+ type: "string",
119986
+ format: "cid"
119987
+ }
119988
+ }
119989
+ },
119990
+ output: {
119991
+ encoding: "application/json",
119992
+ schema: {
119993
+ type: "object",
119994
+ required: ["subject"],
119995
+ properties: {
119996
+ subject: {
119997
+ type: "union",
119998
+ refs: [
119999
+ "lex:com.atproto.admin.defs#repoRef",
120000
+ "lex:com.atproto.repo.strongRef",
120001
+ "lex:com.atproto.admin.defs#repoBlobRef"
120002
+ ]
120003
+ },
120004
+ takedown: {
120005
+ type: "ref",
120006
+ ref: "lex:com.atproto.admin.defs#statusAttr"
120007
+ }
120008
+ }
120009
+ }
120010
+ }
120011
+ }
120012
+ }
120013
+ },
119814
120014
  ComAtprotoAdminResolveModerationReports: {
119815
120015
  lexicon: 1,
119816
120016
  id: "com.atproto.admin.resolveModerationReports",
@@ -119903,9 +120103,6 @@ var schemaDict = {
119903
120103
  q: {
119904
120104
  type: "string"
119905
120105
  },
119906
- invitedBy: {
119907
- type: "string"
119908
- },
119909
120106
  limit: {
119910
120107
  type: "integer",
119911
120108
  minimum: 1,
@@ -120110,6 +120307,58 @@ var schemaDict = {
120110
120307
  }
120111
120308
  }
120112
120309
  },
120310
+ ComAtprotoAdminUpdateSubjectStatus: {
120311
+ lexicon: 1,
120312
+ id: "com.atproto.admin.updateSubjectStatus",
120313
+ defs: {
120314
+ main: {
120315
+ type: "procedure",
120316
+ description: "Update the service-specific admin status of a subject (account, record, or blob)",
120317
+ input: {
120318
+ encoding: "application/json",
120319
+ schema: {
120320
+ type: "object",
120321
+ required: ["subject"],
120322
+ properties: {
120323
+ subject: {
120324
+ type: "union",
120325
+ refs: [
120326
+ "lex:com.atproto.admin.defs#repoRef",
120327
+ "lex:com.atproto.repo.strongRef",
120328
+ "lex:com.atproto.admin.defs#repoBlobRef"
120329
+ ]
120330
+ },
120331
+ takedown: {
120332
+ type: "ref",
120333
+ ref: "lex:com.atproto.admin.defs#statusAttr"
120334
+ }
120335
+ }
120336
+ }
120337
+ },
120338
+ output: {
120339
+ encoding: "application/json",
120340
+ schema: {
120341
+ type: "object",
120342
+ required: ["subject"],
120343
+ properties: {
120344
+ subject: {
120345
+ type: "union",
120346
+ refs: [
120347
+ "lex:com.atproto.admin.defs#repoRef",
120348
+ "lex:com.atproto.repo.strongRef",
120349
+ "lex:com.atproto.admin.defs#repoBlobRef"
120350
+ ]
120351
+ },
120352
+ takedown: {
120353
+ type: "ref",
120354
+ ref: "lex:com.atproto.admin.defs#statusAttr"
120355
+ }
120356
+ }
120357
+ }
120358
+ }
120359
+ }
120360
+ }
120361
+ },
120113
120362
  ComAtprotoIdentityResolveHandle: {
120114
120363
  lexicon: 1,
120115
120364
  id: "com.atproto.identity.resolveHandle",
@@ -120407,7 +120656,9 @@ var schemaDict = {
120407
120656
  ref: "lex:com.atproto.moderation.defs#reasonType"
120408
120657
  },
120409
120658
  reason: {
120410
- type: "string"
120659
+ type: "string",
120660
+ maxGraphemes: 2e3,
120661
+ maxLength: 2e4
120411
120662
  },
120412
120663
  subject: {
120413
120664
  type: "union",
@@ -121006,6 +121257,45 @@ var schemaDict = {
121006
121257
  }
121007
121258
  }
121008
121259
  },
121260
+ ComAtprotoServerConfirmEmail: {
121261
+ lexicon: 1,
121262
+ id: "com.atproto.server.confirmEmail",
121263
+ defs: {
121264
+ main: {
121265
+ type: "procedure",
121266
+ description: "Confirm an email using a token from com.atproto.server.requestEmailConfirmation.",
121267
+ input: {
121268
+ encoding: "application/json",
121269
+ schema: {
121270
+ type: "object",
121271
+ required: ["email", "token"],
121272
+ properties: {
121273
+ email: {
121274
+ type: "string"
121275
+ },
121276
+ token: {
121277
+ type: "string"
121278
+ }
121279
+ }
121280
+ }
121281
+ },
121282
+ errors: [
121283
+ {
121284
+ name: "AccountNotFound"
121285
+ },
121286
+ {
121287
+ name: "ExpiredToken"
121288
+ },
121289
+ {
121290
+ name: "InvalidToken"
121291
+ },
121292
+ {
121293
+ name: "InvalidEmail"
121294
+ }
121295
+ ]
121296
+ }
121297
+ }
121298
+ },
121009
121299
  ComAtprotoServerCreateAccount: {
121010
121300
  lexicon: 1,
121011
121301
  id: "com.atproto.server.createAccount",
@@ -121038,6 +121328,9 @@ var schemaDict = {
121038
121328
  },
121039
121329
  recoveryKey: {
121040
121330
  type: "string"
121331
+ },
121332
+ plcOp: {
121333
+ type: "bytes"
121041
121334
  }
121042
121335
  }
121043
121336
  }
@@ -121061,6 +121354,9 @@ var schemaDict = {
121061
121354
  did: {
121062
121355
  type: "string",
121063
121356
  format: "did"
121357
+ },
121358
+ didDoc: {
121359
+ type: "unknown"
121064
121360
  }
121065
121361
  }
121066
121362
  }
@@ -121286,8 +121582,14 @@ var schemaDict = {
121286
121582
  type: "string",
121287
121583
  format: "did"
121288
121584
  },
121585
+ didDoc: {
121586
+ type: "unknown"
121587
+ },
121289
121588
  email: {
121290
121589
  type: "string"
121590
+ },
121591
+ emailConfirmed: {
121592
+ type: "boolean"
121291
121593
  }
121292
121594
  }
121293
121595
  }
@@ -121517,6 +121819,9 @@ var schemaDict = {
121517
121819
  },
121518
121820
  email: {
121519
121821
  type: "string"
121822
+ },
121823
+ emailConfirmed: {
121824
+ type: "boolean"
121520
121825
  }
121521
121826
  }
121522
121827
  }
@@ -121594,6 +121899,9 @@ var schemaDict = {
121594
121899
  did: {
121595
121900
  type: "string",
121596
121901
  format: "did"
121902
+ },
121903
+ didDoc: {
121904
+ type: "unknown"
121597
121905
  }
121598
121906
  }
121599
121907
  }
@@ -121616,6 +121924,38 @@ var schemaDict = {
121616
121924
  }
121617
121925
  }
121618
121926
  },
121927
+ ComAtprotoServerRequestEmailConfirmation: {
121928
+ lexicon: 1,
121929
+ id: "com.atproto.server.requestEmailConfirmation",
121930
+ defs: {
121931
+ main: {
121932
+ type: "procedure",
121933
+ description: "Request an email with a code to confirm ownership of email"
121934
+ }
121935
+ }
121936
+ },
121937
+ ComAtprotoServerRequestEmailUpdate: {
121938
+ lexicon: 1,
121939
+ id: "com.atproto.server.requestEmailUpdate",
121940
+ defs: {
121941
+ main: {
121942
+ type: "procedure",
121943
+ description: "Request a token in order to update email.",
121944
+ output: {
121945
+ encoding: "application/json",
121946
+ schema: {
121947
+ type: "object",
121948
+ required: ["tokenRequired"],
121949
+ properties: {
121950
+ tokenRequired: {
121951
+ type: "boolean"
121952
+ }
121953
+ }
121954
+ }
121955
+ }
121956
+ }
121957
+ }
121958
+ },
121619
121959
  ComAtprotoServerRequestPasswordReset: {
121620
121960
  lexicon: 1,
121621
121961
  id: "com.atproto.server.requestPasswordReset",
@@ -121638,6 +121978,29 @@ var schemaDict = {
121638
121978
  }
121639
121979
  }
121640
121980
  },
121981
+ ComAtprotoServerReserveSigningKey: {
121982
+ lexicon: 1,
121983
+ id: "com.atproto.server.reserveSigningKey",
121984
+ defs: {
121985
+ main: {
121986
+ type: "procedure",
121987
+ description: "Reserve a repo signing key for account creation.",
121988
+ output: {
121989
+ encoding: "application/json",
121990
+ schema: {
121991
+ type: "object",
121992
+ required: ["signingKey"],
121993
+ properties: {
121994
+ signingKey: {
121995
+ type: "string",
121996
+ description: "Public signing key in the form of a did:key."
121997
+ }
121998
+ }
121999
+ }
122000
+ }
122001
+ }
122002
+ }
122003
+ },
121641
122004
  ComAtprotoServerResetPassword: {
121642
122005
  lexicon: 1,
121643
122006
  id: "com.atproto.server.resetPassword",
@@ -121693,6 +122056,43 @@ var schemaDict = {
121693
122056
  }
121694
122057
  }
121695
122058
  },
122059
+ ComAtprotoServerUpdateEmail: {
122060
+ lexicon: 1,
122061
+ id: "com.atproto.server.updateEmail",
122062
+ defs: {
122063
+ main: {
122064
+ type: "procedure",
122065
+ description: "Update an account's email.",
122066
+ input: {
122067
+ encoding: "application/json",
122068
+ schema: {
122069
+ type: "object",
122070
+ required: ["email"],
122071
+ properties: {
122072
+ email: {
122073
+ type: "string"
122074
+ },
122075
+ token: {
122076
+ type: "string",
122077
+ description: "Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed."
122078
+ }
122079
+ }
122080
+ }
122081
+ },
122082
+ errors: [
122083
+ {
122084
+ name: "ExpiredToken"
122085
+ },
122086
+ {
122087
+ name: "InvalidToken"
122088
+ },
122089
+ {
122090
+ name: "TokenRequired"
122091
+ }
122092
+ ]
122093
+ }
122094
+ }
122095
+ },
121696
122096
  ComAtprotoSyncGetBlob: {
121697
122097
  lexicon: 1,
121698
122098
  id: "com.atproto.sync.getBlob",
@@ -122018,7 +122418,7 @@ var schemaDict = {
122018
122418
  },
122019
122419
  repo: {
122020
122420
  type: "object",
122021
- required: ["did", "head"],
122421
+ required: ["did", "head", "rev"],
122022
122422
  properties: {
122023
122423
  did: {
122024
122424
  type: "string",
@@ -122027,6 +122427,9 @@ var schemaDict = {
122027
122427
  head: {
122028
122428
  type: "string",
122029
122429
  format: "cid"
122430
+ },
122431
+ rev: {
122432
+ type: "string"
122030
122433
  }
122031
122434
  }
122032
122435
  }
@@ -122427,6 +122830,10 @@ var schemaDict = {
122427
122830
  type: "string",
122428
122831
  format: "at-uri"
122429
122832
  },
122833
+ blockingByList: {
122834
+ type: "ref",
122835
+ ref: "lex:app.bsky.graph.defs#listViewBasic"
122836
+ },
122430
122837
  following: {
122431
122838
  type: "string",
122432
122839
  format: "at-uri"
@@ -125951,48 +126358,55 @@ function toKnownErr3(e) {
125951
126358
  return e;
125952
126359
  }
125953
126360
 
125954
- // ../api/src/client/types/com/atproto/admin/getInviteCodes.ts
126361
+ // ../api/src/client/types/com/atproto/admin/getAccountInfo.ts
125955
126362
  function toKnownErr4(e) {
125956
126363
  if (e instanceof XRPCError) {
125957
126364
  }
125958
126365
  return e;
125959
126366
  }
125960
126367
 
125961
- // ../api/src/client/types/com/atproto/admin/getModerationAction.ts
126368
+ // ../api/src/client/types/com/atproto/admin/getInviteCodes.ts
125962
126369
  function toKnownErr5(e) {
125963
126370
  if (e instanceof XRPCError) {
125964
126371
  }
125965
126372
  return e;
125966
126373
  }
125967
126374
 
125968
- // ../api/src/client/types/com/atproto/admin/getModerationActions.ts
126375
+ // ../api/src/client/types/com/atproto/admin/getModerationAction.ts
125969
126376
  function toKnownErr6(e) {
125970
126377
  if (e instanceof XRPCError) {
125971
126378
  }
125972
126379
  return e;
125973
126380
  }
125974
126381
 
125975
- // ../api/src/client/types/com/atproto/admin/getModerationReport.ts
126382
+ // ../api/src/client/types/com/atproto/admin/getModerationActions.ts
125976
126383
  function toKnownErr7(e) {
125977
126384
  if (e instanceof XRPCError) {
125978
126385
  }
125979
126386
  return e;
125980
126387
  }
125981
126388
 
125982
- // ../api/src/client/types/com/atproto/admin/getModerationReports.ts
126389
+ // ../api/src/client/types/com/atproto/admin/getModerationReport.ts
125983
126390
  function toKnownErr8(e) {
125984
126391
  if (e instanceof XRPCError) {
125985
126392
  }
125986
126393
  return e;
125987
126394
  }
125988
126395
 
126396
+ // ../api/src/client/types/com/atproto/admin/getModerationReports.ts
126397
+ function toKnownErr9(e) {
126398
+ if (e instanceof XRPCError) {
126399
+ }
126400
+ return e;
126401
+ }
126402
+
125989
126403
  // ../api/src/client/types/com/atproto/admin/getRecord.ts
125990
126404
  var RecordNotFoundError = class extends XRPCError {
125991
126405
  constructor(src3) {
125992
126406
  super(src3.status, src3.error, src3.message, src3.headers);
125993
126407
  }
125994
126408
  };
125995
- function toKnownErr9(e) {
126409
+ function toKnownErr10(e) {
125996
126410
  if (e instanceof XRPCError) {
125997
126411
  if (e.error === "RecordNotFound")
125998
126412
  return new RecordNotFoundError(e);
@@ -126006,7 +126420,7 @@ var RepoNotFoundError = class extends XRPCError {
126006
126420
  super(src3.status, src3.error, src3.message, src3.headers);
126007
126421
  }
126008
126422
  };
126009
- function toKnownErr10(e) {
126423
+ function toKnownErr11(e) {
126010
126424
  if (e instanceof XRPCError) {
126011
126425
  if (e.error === "RepoNotFound")
126012
126426
  return new RepoNotFoundError(e);
@@ -126014,29 +126428,36 @@ function toKnownErr10(e) {
126014
126428
  return e;
126015
126429
  }
126016
126430
 
126431
+ // ../api/src/client/types/com/atproto/admin/getSubjectStatus.ts
126432
+ function toKnownErr12(e) {
126433
+ if (e instanceof XRPCError) {
126434
+ }
126435
+ return e;
126436
+ }
126437
+
126017
126438
  // ../api/src/client/types/com/atproto/admin/resolveModerationReports.ts
126018
- function toKnownErr11(e) {
126439
+ function toKnownErr13(e) {
126019
126440
  if (e instanceof XRPCError) {
126020
126441
  }
126021
126442
  return e;
126022
126443
  }
126023
126444
 
126024
126445
  // ../api/src/client/types/com/atproto/admin/reverseModerationAction.ts
126025
- function toKnownErr12(e) {
126446
+ function toKnownErr14(e) {
126026
126447
  if (e instanceof XRPCError) {
126027
126448
  }
126028
126449
  return e;
126029
126450
  }
126030
126451
 
126031
126452
  // ../api/src/client/types/com/atproto/admin/searchRepos.ts
126032
- function toKnownErr13(e) {
126453
+ function toKnownErr15(e) {
126033
126454
  if (e instanceof XRPCError) {
126034
126455
  }
126035
126456
  return e;
126036
126457
  }
126037
126458
 
126038
126459
  // ../api/src/client/types/com/atproto/admin/sendEmail.ts
126039
- function toKnownErr14(e) {
126460
+ function toKnownErr16(e) {
126040
126461
  if (e instanceof XRPCError) {
126041
126462
  }
126042
126463
  return e;
@@ -126048,7 +126469,7 @@ var SubjectHasActionError = class extends XRPCError {
126048
126469
  super(src3.status, src3.error, src3.message, src3.headers);
126049
126470
  }
126050
126471
  };
126051
- function toKnownErr15(e) {
126472
+ function toKnownErr17(e) {
126052
126473
  if (e instanceof XRPCError) {
126053
126474
  if (e.error === "SubjectHasAction")
126054
126475
  return new SubjectHasActionError(e);
@@ -126057,42 +126478,49 @@ function toKnownErr15(e) {
126057
126478
  }
126058
126479
 
126059
126480
  // ../api/src/client/types/com/atproto/admin/updateAccountEmail.ts
126060
- function toKnownErr16(e) {
126481
+ function toKnownErr18(e) {
126061
126482
  if (e instanceof XRPCError) {
126062
126483
  }
126063
126484
  return e;
126064
126485
  }
126065
126486
 
126066
126487
  // ../api/src/client/types/com/atproto/admin/updateAccountHandle.ts
126067
- function toKnownErr17(e) {
126488
+ function toKnownErr19(e) {
126489
+ if (e instanceof XRPCError) {
126490
+ }
126491
+ return e;
126492
+ }
126493
+
126494
+ // ../api/src/client/types/com/atproto/admin/updateSubjectStatus.ts
126495
+ function toKnownErr20(e) {
126068
126496
  if (e instanceof XRPCError) {
126069
126497
  }
126070
126498
  return e;
126071
126499
  }
126072
126500
 
126073
126501
  // ../api/src/client/types/com/atproto/identity/resolveHandle.ts
126074
- function toKnownErr18(e) {
126502
+ function toKnownErr21(e) {
126075
126503
  if (e instanceof XRPCError) {
126076
126504
  }
126077
126505
  return e;
126078
126506
  }
126079
126507
 
126080
126508
  // ../api/src/client/types/com/atproto/identity/updateHandle.ts
126081
- function toKnownErr19(e) {
126509
+ function toKnownErr22(e) {
126082
126510
  if (e instanceof XRPCError) {
126083
126511
  }
126084
126512
  return e;
126085
126513
  }
126086
126514
 
126087
126515
  // ../api/src/client/types/com/atproto/label/queryLabels.ts
126088
- function toKnownErr20(e) {
126516
+ function toKnownErr23(e) {
126089
126517
  if (e instanceof XRPCError) {
126090
126518
  }
126091
126519
  return e;
126092
126520
  }
126093
126521
 
126094
126522
  // ../api/src/client/types/com/atproto/moderation/createReport.ts
126095
- function toKnownErr21(e) {
126523
+ function toKnownErr24(e) {
126096
126524
  if (e instanceof XRPCError) {
126097
126525
  }
126098
126526
  return e;
@@ -126104,7 +126532,7 @@ var InvalidSwapError = class extends XRPCError {
126104
126532
  super(src3.status, src3.error, src3.message, src3.headers);
126105
126533
  }
126106
126534
  };
126107
- function toKnownErr22(e) {
126535
+ function toKnownErr25(e) {
126108
126536
  if (e instanceof XRPCError) {
126109
126537
  if (e.error === "InvalidSwap")
126110
126538
  return new InvalidSwapError(e);
@@ -126118,7 +126546,7 @@ var InvalidSwapError2 = class extends XRPCError {
126118
126546
  super(src3.status, src3.error, src3.message, src3.headers);
126119
126547
  }
126120
126548
  };
126121
- function toKnownErr23(e) {
126549
+ function toKnownErr26(e) {
126122
126550
  if (e instanceof XRPCError) {
126123
126551
  if (e.error === "InvalidSwap")
126124
126552
  return new InvalidSwapError2(e);
@@ -126132,7 +126560,7 @@ var InvalidSwapError3 = class extends XRPCError {
126132
126560
  super(src3.status, src3.error, src3.message, src3.headers);
126133
126561
  }
126134
126562
  };
126135
- function toKnownErr24(e) {
126563
+ function toKnownErr27(e) {
126136
126564
  if (e instanceof XRPCError) {
126137
126565
  if (e.error === "InvalidSwap")
126138
126566
  return new InvalidSwapError3(e);
@@ -126141,21 +126569,21 @@ function toKnownErr24(e) {
126141
126569
  }
126142
126570
 
126143
126571
  // ../api/src/client/types/com/atproto/repo/describeRepo.ts
126144
- function toKnownErr25(e) {
126572
+ function toKnownErr28(e) {
126145
126573
  if (e instanceof XRPCError) {
126146
126574
  }
126147
126575
  return e;
126148
126576
  }
126149
126577
 
126150
126578
  // ../api/src/client/types/com/atproto/repo/getRecord.ts
126151
- function toKnownErr26(e) {
126579
+ function toKnownErr29(e) {
126152
126580
  if (e instanceof XRPCError) {
126153
126581
  }
126154
126582
  return e;
126155
126583
  }
126156
126584
 
126157
126585
  // ../api/src/client/types/com/atproto/repo/listRecords.ts
126158
- function toKnownErr27(e) {
126586
+ function toKnownErr30(e) {
126159
126587
  if (e instanceof XRPCError) {
126160
126588
  }
126161
126589
  return e;
@@ -126167,7 +126595,7 @@ var InvalidSwapError4 = class extends XRPCError {
126167
126595
  super(src3.status, src3.error, src3.message, src3.headers);
126168
126596
  }
126169
126597
  };
126170
- function toKnownErr28(e) {
126598
+ function toKnownErr31(e) {
126171
126599
  if (e instanceof XRPCError) {
126172
126600
  if (e.error === "InvalidSwap")
126173
126601
  return new InvalidSwapError4(e);
@@ -126176,12 +126604,47 @@ function toKnownErr28(e) {
126176
126604
  }
126177
126605
 
126178
126606
  // ../api/src/client/types/com/atproto/repo/uploadBlob.ts
126179
- function toKnownErr29(e) {
126607
+ function toKnownErr32(e) {
126180
126608
  if (e instanceof XRPCError) {
126181
126609
  }
126182
126610
  return e;
126183
126611
  }
126184
126612
 
126613
+ // ../api/src/client/types/com/atproto/server/confirmEmail.ts
126614
+ var AccountNotFoundError = class extends XRPCError {
126615
+ constructor(src3) {
126616
+ super(src3.status, src3.error, src3.message, src3.headers);
126617
+ }
126618
+ };
126619
+ var ExpiredTokenError = class extends XRPCError {
126620
+ constructor(src3) {
126621
+ super(src3.status, src3.error, src3.message, src3.headers);
126622
+ }
126623
+ };
126624
+ var InvalidTokenError = class extends XRPCError {
126625
+ constructor(src3) {
126626
+ super(src3.status, src3.error, src3.message, src3.headers);
126627
+ }
126628
+ };
126629
+ var InvalidEmailError = class extends XRPCError {
126630
+ constructor(src3) {
126631
+ super(src3.status, src3.error, src3.message, src3.headers);
126632
+ }
126633
+ };
126634
+ function toKnownErr33(e) {
126635
+ if (e instanceof XRPCError) {
126636
+ if (e.error === "AccountNotFound")
126637
+ return new AccountNotFoundError(e);
126638
+ if (e.error === "ExpiredToken")
126639
+ return new ExpiredTokenError(e);
126640
+ if (e.error === "InvalidToken")
126641
+ return new InvalidTokenError(e);
126642
+ if (e.error === "InvalidEmail")
126643
+ return new InvalidEmailError(e);
126644
+ }
126645
+ return e;
126646
+ }
126647
+
126185
126648
  // ../api/src/client/types/com/atproto/server/createAccount.ts
126186
126649
  var InvalidHandleError2 = class extends XRPCError {
126187
126650
  constructor(src3) {
@@ -126218,7 +126681,7 @@ var IncompatibleDidDocError = class extends XRPCError {
126218
126681
  super(src3.status, src3.error, src3.message, src3.headers);
126219
126682
  }
126220
126683
  };
126221
- function toKnownErr30(e) {
126684
+ function toKnownErr34(e) {
126222
126685
  if (e instanceof XRPCError) {
126223
126686
  if (e.error === "InvalidHandle")
126224
126687
  return new InvalidHandleError2(e);
@@ -126244,7 +126707,7 @@ var AccountTakedownError = class extends XRPCError {
126244
126707
  super(src3.status, src3.error, src3.message, src3.headers);
126245
126708
  }
126246
126709
  };
126247
- function toKnownErr31(e) {
126710
+ function toKnownErr35(e) {
126248
126711
  if (e instanceof XRPCError) {
126249
126712
  if (e.error === "AccountTakedown")
126250
126713
  return new AccountTakedownError(e);
@@ -126253,14 +126716,14 @@ function toKnownErr31(e) {
126253
126716
  }
126254
126717
 
126255
126718
  // ../api/src/client/types/com/atproto/server/createInviteCode.ts
126256
- function toKnownErr32(e) {
126719
+ function toKnownErr36(e) {
126257
126720
  if (e instanceof XRPCError) {
126258
126721
  }
126259
126722
  return e;
126260
126723
  }
126261
126724
 
126262
126725
  // ../api/src/client/types/com/atproto/server/createInviteCodes.ts
126263
- function toKnownErr33(e) {
126726
+ function toKnownErr37(e) {
126264
126727
  if (e instanceof XRPCError) {
126265
126728
  }
126266
126729
  return e;
@@ -126272,7 +126735,7 @@ var AccountTakedownError2 = class extends XRPCError {
126272
126735
  super(src3.status, src3.error, src3.message, src3.headers);
126273
126736
  }
126274
126737
  };
126275
- function toKnownErr34(e) {
126738
+ function toKnownErr38(e) {
126276
126739
  if (e instanceof XRPCError) {
126277
126740
  if (e.error === "AccountTakedown")
126278
126741
  return new AccountTakedownError2(e);
@@ -126281,35 +126744,35 @@ function toKnownErr34(e) {
126281
126744
  }
126282
126745
 
126283
126746
  // ../api/src/client/types/com/atproto/server/deleteAccount.ts
126284
- var ExpiredTokenError = class extends XRPCError {
126747
+ var ExpiredTokenError2 = class extends XRPCError {
126285
126748
  constructor(src3) {
126286
126749
  super(src3.status, src3.error, src3.message, src3.headers);
126287
126750
  }
126288
126751
  };
126289
- var InvalidTokenError = class extends XRPCError {
126752
+ var InvalidTokenError2 = class extends XRPCError {
126290
126753
  constructor(src3) {
126291
126754
  super(src3.status, src3.error, src3.message, src3.headers);
126292
126755
  }
126293
126756
  };
126294
- function toKnownErr35(e) {
126757
+ function toKnownErr39(e) {
126295
126758
  if (e instanceof XRPCError) {
126296
126759
  if (e.error === "ExpiredToken")
126297
- return new ExpiredTokenError(e);
126760
+ return new ExpiredTokenError2(e);
126298
126761
  if (e.error === "InvalidToken")
126299
- return new InvalidTokenError(e);
126762
+ return new InvalidTokenError2(e);
126300
126763
  }
126301
126764
  return e;
126302
126765
  }
126303
126766
 
126304
126767
  // ../api/src/client/types/com/atproto/server/deleteSession.ts
126305
- function toKnownErr36(e) {
126768
+ function toKnownErr40(e) {
126306
126769
  if (e instanceof XRPCError) {
126307
126770
  }
126308
126771
  return e;
126309
126772
  }
126310
126773
 
126311
126774
  // ../api/src/client/types/com/atproto/server/describeServer.ts
126312
- function toKnownErr37(e) {
126775
+ function toKnownErr41(e) {
126313
126776
  if (e instanceof XRPCError) {
126314
126777
  }
126315
126778
  return e;
@@ -126321,7 +126784,7 @@ var DuplicateCreateError = class extends XRPCError {
126321
126784
  super(src3.status, src3.error, src3.message, src3.headers);
126322
126785
  }
126323
126786
  };
126324
- function toKnownErr38(e) {
126787
+ function toKnownErr42(e) {
126325
126788
  if (e instanceof XRPCError) {
126326
126789
  if (e.error === "DuplicateCreate")
126327
126790
  return new DuplicateCreateError(e);
@@ -126330,7 +126793,7 @@ function toKnownErr38(e) {
126330
126793
  }
126331
126794
 
126332
126795
  // ../api/src/client/types/com/atproto/server/getSession.ts
126333
- function toKnownErr39(e) {
126796
+ function toKnownErr43(e) {
126334
126797
  if (e instanceof XRPCError) {
126335
126798
  }
126336
126799
  return e;
@@ -126342,7 +126805,7 @@ var AccountTakedownError3 = class extends XRPCError {
126342
126805
  super(src3.status, src3.error, src3.message, src3.headers);
126343
126806
  }
126344
126807
  };
126345
- function toKnownErr40(e) {
126808
+ function toKnownErr44(e) {
126346
126809
  if (e instanceof XRPCError) {
126347
126810
  if (e.error === "AccountTakedown")
126348
126811
  return new AccountTakedownError3(e);
@@ -126356,7 +126819,7 @@ var AccountTakedownError4 = class extends XRPCError {
126356
126819
  super(src3.status, src3.error, src3.message, src3.headers);
126357
126820
  }
126358
126821
  };
126359
- function toKnownErr41(e) {
126822
+ function toKnownErr45(e) {
126360
126823
  if (e instanceof XRPCError) {
126361
126824
  if (e.error === "AccountTakedown")
126362
126825
  return new AccountTakedownError4(e);
@@ -126365,63 +126828,112 @@ function toKnownErr41(e) {
126365
126828
  }
126366
126829
 
126367
126830
  // ../api/src/client/types/com/atproto/server/requestAccountDelete.ts
126368
- function toKnownErr42(e) {
126831
+ function toKnownErr46(e) {
126832
+ if (e instanceof XRPCError) {
126833
+ }
126834
+ return e;
126835
+ }
126836
+
126837
+ // ../api/src/client/types/com/atproto/server/requestEmailConfirmation.ts
126838
+ function toKnownErr47(e) {
126839
+ if (e instanceof XRPCError) {
126840
+ }
126841
+ return e;
126842
+ }
126843
+
126844
+ // ../api/src/client/types/com/atproto/server/requestEmailUpdate.ts
126845
+ function toKnownErr48(e) {
126369
126846
  if (e instanceof XRPCError) {
126370
126847
  }
126371
126848
  return e;
126372
126849
  }
126373
126850
 
126374
126851
  // ../api/src/client/types/com/atproto/server/requestPasswordReset.ts
126375
- function toKnownErr43(e) {
126852
+ function toKnownErr49(e) {
126853
+ if (e instanceof XRPCError) {
126854
+ }
126855
+ return e;
126856
+ }
126857
+
126858
+ // ../api/src/client/types/com/atproto/server/reserveSigningKey.ts
126859
+ function toKnownErr50(e) {
126376
126860
  if (e instanceof XRPCError) {
126377
126861
  }
126378
126862
  return e;
126379
126863
  }
126380
126864
 
126381
126865
  // ../api/src/client/types/com/atproto/server/resetPassword.ts
126382
- var ExpiredTokenError2 = class extends XRPCError {
126866
+ var ExpiredTokenError3 = class extends XRPCError {
126383
126867
  constructor(src3) {
126384
126868
  super(src3.status, src3.error, src3.message, src3.headers);
126385
126869
  }
126386
126870
  };
126387
- var InvalidTokenError2 = class extends XRPCError {
126871
+ var InvalidTokenError3 = class extends XRPCError {
126388
126872
  constructor(src3) {
126389
126873
  super(src3.status, src3.error, src3.message, src3.headers);
126390
126874
  }
126391
126875
  };
126392
- function toKnownErr44(e) {
126876
+ function toKnownErr51(e) {
126393
126877
  if (e instanceof XRPCError) {
126394
126878
  if (e.error === "ExpiredToken")
126395
- return new ExpiredTokenError2(e);
126879
+ return new ExpiredTokenError3(e);
126396
126880
  if (e.error === "InvalidToken")
126397
- return new InvalidTokenError2(e);
126881
+ return new InvalidTokenError3(e);
126398
126882
  }
126399
126883
  return e;
126400
126884
  }
126401
126885
 
126402
126886
  // ../api/src/client/types/com/atproto/server/revokeAppPassword.ts
126403
- function toKnownErr45(e) {
126887
+ function toKnownErr52(e) {
126404
126888
  if (e instanceof XRPCError) {
126405
126889
  }
126406
126890
  return e;
126407
126891
  }
126408
126892
 
126893
+ // ../api/src/client/types/com/atproto/server/updateEmail.ts
126894
+ var ExpiredTokenError4 = class extends XRPCError {
126895
+ constructor(src3) {
126896
+ super(src3.status, src3.error, src3.message, src3.headers);
126897
+ }
126898
+ };
126899
+ var InvalidTokenError4 = class extends XRPCError {
126900
+ constructor(src3) {
126901
+ super(src3.status, src3.error, src3.message, src3.headers);
126902
+ }
126903
+ };
126904
+ var TokenRequiredError = class extends XRPCError {
126905
+ constructor(src3) {
126906
+ super(src3.status, src3.error, src3.message, src3.headers);
126907
+ }
126908
+ };
126909
+ function toKnownErr53(e) {
126910
+ if (e instanceof XRPCError) {
126911
+ if (e.error === "ExpiredToken")
126912
+ return new ExpiredTokenError4(e);
126913
+ if (e.error === "InvalidToken")
126914
+ return new InvalidTokenError4(e);
126915
+ if (e.error === "TokenRequired")
126916
+ return new TokenRequiredError(e);
126917
+ }
126918
+ return e;
126919
+ }
126920
+
126409
126921
  // ../api/src/client/types/com/atproto/sync/getBlob.ts
126410
- function toKnownErr46(e) {
126922
+ function toKnownErr54(e) {
126411
126923
  if (e instanceof XRPCError) {
126412
126924
  }
126413
126925
  return e;
126414
126926
  }
126415
126927
 
126416
126928
  // ../api/src/client/types/com/atproto/sync/getBlocks.ts
126417
- function toKnownErr47(e) {
126929
+ function toKnownErr55(e) {
126418
126930
  if (e instanceof XRPCError) {
126419
126931
  }
126420
126932
  return e;
126421
126933
  }
126422
126934
 
126423
126935
  // ../api/src/client/types/com/atproto/sync/getCheckout.ts
126424
- function toKnownErr48(e) {
126936
+ function toKnownErr56(e) {
126425
126937
  if (e instanceof XRPCError) {
126426
126938
  }
126427
126939
  return e;
@@ -126433,7 +126945,7 @@ var HeadNotFoundError = class extends XRPCError {
126433
126945
  super(src3.status, src3.error, src3.message, src3.headers);
126434
126946
  }
126435
126947
  };
126436
- function toKnownErr49(e) {
126948
+ function toKnownErr57(e) {
126437
126949
  if (e instanceof XRPCError) {
126438
126950
  if (e.error === "HeadNotFound")
126439
126951
  return new HeadNotFoundError(e);
@@ -126445,14 +126957,14 @@ function toKnownErr49(e) {
126445
126957
  var getLatestCommit_exports = {};
126446
126958
  __export(getLatestCommit_exports, {
126447
126959
  RepoNotFoundError: () => RepoNotFoundError2,
126448
- toKnownErr: () => toKnownErr50
126960
+ toKnownErr: () => toKnownErr58
126449
126961
  });
126450
126962
  var RepoNotFoundError2 = class extends XRPCError {
126451
126963
  constructor(src3) {
126452
126964
  super(src3.status, src3.error, src3.message, src3.headers);
126453
126965
  }
126454
126966
  };
126455
- function toKnownErr50(e) {
126967
+ function toKnownErr58(e) {
126456
126968
  if (e instanceof XRPCError) {
126457
126969
  if (e.error === "RepoNotFound")
126458
126970
  return new RepoNotFoundError2(e);
@@ -126461,105 +126973,105 @@ function toKnownErr50(e) {
126461
126973
  }
126462
126974
 
126463
126975
  // ../api/src/client/types/com/atproto/sync/getRecord.ts
126464
- function toKnownErr51(e) {
126976
+ function toKnownErr59(e) {
126465
126977
  if (e instanceof XRPCError) {
126466
126978
  }
126467
126979
  return e;
126468
126980
  }
126469
126981
 
126470
126982
  // ../api/src/client/types/com/atproto/sync/getRepo.ts
126471
- function toKnownErr52(e) {
126983
+ function toKnownErr60(e) {
126472
126984
  if (e instanceof XRPCError) {
126473
126985
  }
126474
126986
  return e;
126475
126987
  }
126476
126988
 
126477
126989
  // ../api/src/client/types/com/atproto/sync/listBlobs.ts
126478
- function toKnownErr53(e) {
126990
+ function toKnownErr61(e) {
126479
126991
  if (e instanceof XRPCError) {
126480
126992
  }
126481
126993
  return e;
126482
126994
  }
126483
126995
 
126484
126996
  // ../api/src/client/types/com/atproto/sync/listRepos.ts
126485
- function toKnownErr54(e) {
126997
+ function toKnownErr62(e) {
126486
126998
  if (e instanceof XRPCError) {
126487
126999
  }
126488
127000
  return e;
126489
127001
  }
126490
127002
 
126491
127003
  // ../api/src/client/types/com/atproto/sync/notifyOfUpdate.ts
126492
- function toKnownErr55(e) {
127004
+ function toKnownErr63(e) {
126493
127005
  if (e instanceof XRPCError) {
126494
127006
  }
126495
127007
  return e;
126496
127008
  }
126497
127009
 
126498
127010
  // ../api/src/client/types/com/atproto/sync/requestCrawl.ts
126499
- function toKnownErr56(e) {
127011
+ function toKnownErr64(e) {
126500
127012
  if (e instanceof XRPCError) {
126501
127013
  }
126502
127014
  return e;
126503
127015
  }
126504
127016
 
126505
127017
  // ../api/src/client/types/app/bsky/actor/getPreferences.ts
126506
- function toKnownErr57(e) {
127018
+ function toKnownErr65(e) {
126507
127019
  if (e instanceof XRPCError) {
126508
127020
  }
126509
127021
  return e;
126510
127022
  }
126511
127023
 
126512
127024
  // ../api/src/client/types/app/bsky/actor/getProfile.ts
126513
- function toKnownErr58(e) {
127025
+ function toKnownErr66(e) {
126514
127026
  if (e instanceof XRPCError) {
126515
127027
  }
126516
127028
  return e;
126517
127029
  }
126518
127030
 
126519
127031
  // ../api/src/client/types/app/bsky/actor/getProfiles.ts
126520
- function toKnownErr59(e) {
127032
+ function toKnownErr67(e) {
126521
127033
  if (e instanceof XRPCError) {
126522
127034
  }
126523
127035
  return e;
126524
127036
  }
126525
127037
 
126526
127038
  // ../api/src/client/types/app/bsky/actor/getSuggestions.ts
126527
- function toKnownErr60(e) {
127039
+ function toKnownErr68(e) {
126528
127040
  if (e instanceof XRPCError) {
126529
127041
  }
126530
127042
  return e;
126531
127043
  }
126532
127044
 
126533
127045
  // ../api/src/client/types/app/bsky/actor/putPreferences.ts
126534
- function toKnownErr61(e) {
127046
+ function toKnownErr69(e) {
126535
127047
  if (e instanceof XRPCError) {
126536
127048
  }
126537
127049
  return e;
126538
127050
  }
126539
127051
 
126540
127052
  // ../api/src/client/types/app/bsky/actor/searchActors.ts
126541
- function toKnownErr62(e) {
127053
+ function toKnownErr70(e) {
126542
127054
  if (e instanceof XRPCError) {
126543
127055
  }
126544
127056
  return e;
126545
127057
  }
126546
127058
 
126547
127059
  // ../api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts
126548
- function toKnownErr63(e) {
127060
+ function toKnownErr71(e) {
126549
127061
  if (e instanceof XRPCError) {
126550
127062
  }
126551
127063
  return e;
126552
127064
  }
126553
127065
 
126554
127066
  // ../api/src/client/types/app/bsky/feed/describeFeedGenerator.ts
126555
- function toKnownErr64(e) {
127067
+ function toKnownErr72(e) {
126556
127068
  if (e instanceof XRPCError) {
126557
127069
  }
126558
127070
  return e;
126559
127071
  }
126560
127072
 
126561
127073
  // ../api/src/client/types/app/bsky/feed/getActorFeeds.ts
126562
- function toKnownErr65(e) {
127074
+ function toKnownErr73(e) {
126563
127075
  if (e instanceof XRPCError) {
126564
127076
  }
126565
127077
  return e;
@@ -126576,7 +127088,7 @@ var BlockedByActorError = class extends XRPCError {
126576
127088
  super(src3.status, src3.error, src3.message, src3.headers);
126577
127089
  }
126578
127090
  };
126579
- function toKnownErr66(e) {
127091
+ function toKnownErr74(e) {
126580
127092
  if (e instanceof XRPCError) {
126581
127093
  if (e.error === "BlockedActor")
126582
127094
  return new BlockedActorError(e);
@@ -126597,7 +127109,7 @@ var BlockedByActorError2 = class extends XRPCError {
126597
127109
  super(src3.status, src3.error, src3.message, src3.headers);
126598
127110
  }
126599
127111
  };
126600
- function toKnownErr67(e) {
127112
+ function toKnownErr75(e) {
126601
127113
  if (e instanceof XRPCError) {
126602
127114
  if (e.error === "BlockedActor")
126603
127115
  return new BlockedActorError2(e);
@@ -126613,7 +127125,7 @@ var UnknownFeedError = class extends XRPCError {
126613
127125
  super(src3.status, src3.error, src3.message, src3.headers);
126614
127126
  }
126615
127127
  };
126616
- function toKnownErr68(e) {
127128
+ function toKnownErr76(e) {
126617
127129
  if (e instanceof XRPCError) {
126618
127130
  if (e.error === "UnknownFeed")
126619
127131
  return new UnknownFeedError(e);
@@ -126622,14 +127134,14 @@ function toKnownErr68(e) {
126622
127134
  }
126623
127135
 
126624
127136
  // ../api/src/client/types/app/bsky/feed/getFeedGenerator.ts
126625
- function toKnownErr69(e) {
127137
+ function toKnownErr77(e) {
126626
127138
  if (e instanceof XRPCError) {
126627
127139
  }
126628
127140
  return e;
126629
127141
  }
126630
127142
 
126631
127143
  // ../api/src/client/types/app/bsky/feed/getFeedGenerators.ts
126632
- function toKnownErr70(e) {
127144
+ function toKnownErr78(e) {
126633
127145
  if (e instanceof XRPCError) {
126634
127146
  }
126635
127147
  return e;
@@ -126639,14 +127151,14 @@ function toKnownErr70(e) {
126639
127151
  var getFeedSkeleton_exports = {};
126640
127152
  __export(getFeedSkeleton_exports, {
126641
127153
  UnknownFeedError: () => UnknownFeedError2,
126642
- toKnownErr: () => toKnownErr71
127154
+ toKnownErr: () => toKnownErr79
126643
127155
  });
126644
127156
  var UnknownFeedError2 = class extends XRPCError {
126645
127157
  constructor(src3) {
126646
127158
  super(src3.status, src3.error, src3.message, src3.headers);
126647
127159
  }
126648
127160
  };
126649
- function toKnownErr71(e) {
127161
+ function toKnownErr79(e) {
126650
127162
  if (e instanceof XRPCError) {
126651
127163
  if (e.error === "UnknownFeed")
126652
127164
  return new UnknownFeedError2(e);
@@ -126655,7 +127167,7 @@ function toKnownErr71(e) {
126655
127167
  }
126656
127168
 
126657
127169
  // ../api/src/client/types/app/bsky/feed/getLikes.ts
126658
- function toKnownErr72(e) {
127170
+ function toKnownErr80(e) {
126659
127171
  if (e instanceof XRPCError) {
126660
127172
  }
126661
127173
  return e;
@@ -126667,7 +127179,7 @@ var UnknownListError = class extends XRPCError {
126667
127179
  super(src3.status, src3.error, src3.message, src3.headers);
126668
127180
  }
126669
127181
  };
126670
- function toKnownErr73(e) {
127182
+ function toKnownErr81(e) {
126671
127183
  if (e instanceof XRPCError) {
126672
127184
  if (e.error === "UnknownList")
126673
127185
  return new UnknownListError(e);
@@ -126681,7 +127193,7 @@ var NotFoundError = class extends XRPCError {
126681
127193
  super(src3.status, src3.error, src3.message, src3.headers);
126682
127194
  }
126683
127195
  };
126684
- function toKnownErr74(e) {
127196
+ function toKnownErr82(e) {
126685
127197
  if (e instanceof XRPCError) {
126686
127198
  if (e.error === "NotFound")
126687
127199
  return new NotFoundError(e);
@@ -126690,28 +127202,28 @@ function toKnownErr74(e) {
126690
127202
  }
126691
127203
 
126692
127204
  // ../api/src/client/types/app/bsky/feed/getPosts.ts
126693
- function toKnownErr75(e) {
127205
+ function toKnownErr83(e) {
126694
127206
  if (e instanceof XRPCError) {
126695
127207
  }
126696
127208
  return e;
126697
127209
  }
126698
127210
 
126699
127211
  // ../api/src/client/types/app/bsky/feed/getRepostedBy.ts
126700
- function toKnownErr76(e) {
127212
+ function toKnownErr84(e) {
126701
127213
  if (e instanceof XRPCError) {
126702
127214
  }
126703
127215
  return e;
126704
127216
  }
126705
127217
 
126706
127218
  // ../api/src/client/types/app/bsky/feed/getSuggestedFeeds.ts
126707
- function toKnownErr77(e) {
127219
+ function toKnownErr85(e) {
126708
127220
  if (e instanceof XRPCError) {
126709
127221
  }
126710
127222
  return e;
126711
127223
  }
126712
127224
 
126713
127225
  // ../api/src/client/types/app/bsky/feed/getTimeline.ts
126714
- function toKnownErr78(e) {
127226
+ function toKnownErr86(e) {
126715
127227
  if (e instanceof XRPCError) {
126716
127228
  }
126717
127229
  return e;
@@ -126723,7 +127235,7 @@ var BadQueryStringError = class extends XRPCError {
126723
127235
  super(src3.status, src3.error, src3.message, src3.headers);
126724
127236
  }
126725
127237
  };
126726
- function toKnownErr79(e) {
127238
+ function toKnownErr87(e) {
126727
127239
  if (e instanceof XRPCError) {
126728
127240
  if (e.error === "BadQueryString")
126729
127241
  return new BadQueryStringError(e);
@@ -126732,133 +127244,133 @@ function toKnownErr79(e) {
126732
127244
  }
126733
127245
 
126734
127246
  // ../api/src/client/types/app/bsky/graph/getBlocks.ts
126735
- function toKnownErr80(e) {
127247
+ function toKnownErr88(e) {
126736
127248
  if (e instanceof XRPCError) {
126737
127249
  }
126738
127250
  return e;
126739
127251
  }
126740
127252
 
126741
127253
  // ../api/src/client/types/app/bsky/graph/getFollowers.ts
126742
- function toKnownErr81(e) {
127254
+ function toKnownErr89(e) {
126743
127255
  if (e instanceof XRPCError) {
126744
127256
  }
126745
127257
  return e;
126746
127258
  }
126747
127259
 
126748
127260
  // ../api/src/client/types/app/bsky/graph/getFollows.ts
126749
- function toKnownErr82(e) {
127261
+ function toKnownErr90(e) {
126750
127262
  if (e instanceof XRPCError) {
126751
127263
  }
126752
127264
  return e;
126753
127265
  }
126754
127266
 
126755
127267
  // ../api/src/client/types/app/bsky/graph/getList.ts
126756
- function toKnownErr83(e) {
127268
+ function toKnownErr91(e) {
126757
127269
  if (e instanceof XRPCError) {
126758
127270
  }
126759
127271
  return e;
126760
127272
  }
126761
127273
 
126762
127274
  // ../api/src/client/types/app/bsky/graph/getListBlocks.ts
126763
- function toKnownErr84(e) {
127275
+ function toKnownErr92(e) {
126764
127276
  if (e instanceof XRPCError) {
126765
127277
  }
126766
127278
  return e;
126767
127279
  }
126768
127280
 
126769
127281
  // ../api/src/client/types/app/bsky/graph/getListMutes.ts
126770
- function toKnownErr85(e) {
127282
+ function toKnownErr93(e) {
126771
127283
  if (e instanceof XRPCError) {
126772
127284
  }
126773
127285
  return e;
126774
127286
  }
126775
127287
 
126776
127288
  // ../api/src/client/types/app/bsky/graph/getLists.ts
126777
- function toKnownErr86(e) {
127289
+ function toKnownErr94(e) {
126778
127290
  if (e instanceof XRPCError) {
126779
127291
  }
126780
127292
  return e;
126781
127293
  }
126782
127294
 
126783
127295
  // ../api/src/client/types/app/bsky/graph/getMutes.ts
126784
- function toKnownErr87(e) {
127296
+ function toKnownErr95(e) {
126785
127297
  if (e instanceof XRPCError) {
126786
127298
  }
126787
127299
  return e;
126788
127300
  }
126789
127301
 
126790
127302
  // ../api/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts
126791
- function toKnownErr88(e) {
127303
+ function toKnownErr96(e) {
126792
127304
  if (e instanceof XRPCError) {
126793
127305
  }
126794
127306
  return e;
126795
127307
  }
126796
127308
 
126797
127309
  // ../api/src/client/types/app/bsky/graph/muteActor.ts
126798
- function toKnownErr89(e) {
127310
+ function toKnownErr97(e) {
126799
127311
  if (e instanceof XRPCError) {
126800
127312
  }
126801
127313
  return e;
126802
127314
  }
126803
127315
 
126804
127316
  // ../api/src/client/types/app/bsky/graph/muteActorList.ts
126805
- function toKnownErr90(e) {
127317
+ function toKnownErr98(e) {
126806
127318
  if (e instanceof XRPCError) {
126807
127319
  }
126808
127320
  return e;
126809
127321
  }
126810
127322
 
126811
127323
  // ../api/src/client/types/app/bsky/graph/unmuteActor.ts
126812
- function toKnownErr91(e) {
127324
+ function toKnownErr99(e) {
126813
127325
  if (e instanceof XRPCError) {
126814
127326
  }
126815
127327
  return e;
126816
127328
  }
126817
127329
 
126818
127330
  // ../api/src/client/types/app/bsky/graph/unmuteActorList.ts
126819
- function toKnownErr92(e) {
127331
+ function toKnownErr100(e) {
126820
127332
  if (e instanceof XRPCError) {
126821
127333
  }
126822
127334
  return e;
126823
127335
  }
126824
127336
 
126825
127337
  // ../api/src/client/types/app/bsky/notification/getUnreadCount.ts
126826
- function toKnownErr93(e) {
127338
+ function toKnownErr101(e) {
126827
127339
  if (e instanceof XRPCError) {
126828
127340
  }
126829
127341
  return e;
126830
127342
  }
126831
127343
 
126832
127344
  // ../api/src/client/types/app/bsky/notification/listNotifications.ts
126833
- function toKnownErr94(e) {
127345
+ function toKnownErr102(e) {
126834
127346
  if (e instanceof XRPCError) {
126835
127347
  }
126836
127348
  return e;
126837
127349
  }
126838
127350
 
126839
127351
  // ../api/src/client/types/app/bsky/notification/registerPush.ts
126840
- function toKnownErr95(e) {
127352
+ function toKnownErr103(e) {
126841
127353
  if (e instanceof XRPCError) {
126842
127354
  }
126843
127355
  return e;
126844
127356
  }
126845
127357
 
126846
127358
  // ../api/src/client/types/app/bsky/notification/updateSeen.ts
126847
- function toKnownErr96(e) {
127359
+ function toKnownErr104(e) {
126848
127360
  if (e instanceof XRPCError) {
126849
127361
  }
126850
127362
  return e;
126851
127363
  }
126852
127364
 
126853
127365
  // ../api/src/client/types/app/bsky/unspecced/getPopular.ts
126854
- function toKnownErr97(e) {
127366
+ function toKnownErr105(e) {
126855
127367
  if (e instanceof XRPCError) {
126856
127368
  }
126857
127369
  return e;
126858
127370
  }
126859
127371
 
126860
127372
  // ../api/src/client/types/app/bsky/unspecced/getPopularFeedGenerators.ts
126861
- function toKnownErr98(e) {
127373
+ function toKnownErr106(e) {
126862
127374
  if (e instanceof XRPCError) {
126863
127375
  }
126864
127376
  return e;
@@ -126870,7 +127382,7 @@ var UnknownFeedError3 = class extends XRPCError {
126870
127382
  super(src3.status, src3.error, src3.message, src3.headers);
126871
127383
  }
126872
127384
  };
126873
- function toKnownErr99(e) {
127385
+ function toKnownErr107(e) {
126874
127386
  if (e instanceof XRPCError) {
126875
127387
  if (e.error === "UnknownFeed")
126876
127388
  return new UnknownFeedError3(e);
@@ -126884,7 +127396,7 @@ var BadQueryStringError2 = class extends XRPCError {
126884
127396
  super(src3.status, src3.error, src3.message, src3.headers);
126885
127397
  }
126886
127398
  };
126887
- function toKnownErr100(e) {
127399
+ function toKnownErr108(e) {
126888
127400
  if (e instanceof XRPCError) {
126889
127401
  if (e.error === "BadQueryString")
126890
127402
  return new BadQueryStringError2(e);
@@ -126898,7 +127410,7 @@ var BadQueryStringError3 = class extends XRPCError {
126898
127410
  super(src3.status, src3.error, src3.message, src3.headers);
126899
127411
  }
126900
127412
  };
126901
- function toKnownErr101(e) {
127413
+ function toKnownErr109(e) {
126902
127414
  if (e instanceof XRPCError) {
126903
127415
  if (e.error === "BadQueryString")
126904
127416
  return new BadQueryStringError3(e);
@@ -126964,74 +127476,89 @@ var AdminNS = class {
126964
127476
  throw toKnownErr3(e);
126965
127477
  });
126966
127478
  }
127479
+ getAccountInfo(params2, opts) {
127480
+ return this._service.xrpc.call("com.atproto.admin.getAccountInfo", params2, void 0, opts).catch((e) => {
127481
+ throw toKnownErr4(e);
127482
+ });
127483
+ }
126967
127484
  getInviteCodes(params2, opts) {
126968
127485
  return this._service.xrpc.call("com.atproto.admin.getInviteCodes", params2, void 0, opts).catch((e) => {
126969
- throw toKnownErr4(e);
127486
+ throw toKnownErr5(e);
126970
127487
  });
126971
127488
  }
126972
127489
  getModerationAction(params2, opts) {
126973
127490
  return this._service.xrpc.call("com.atproto.admin.getModerationAction", params2, void 0, opts).catch((e) => {
126974
- throw toKnownErr5(e);
127491
+ throw toKnownErr6(e);
126975
127492
  });
126976
127493
  }
126977
127494
  getModerationActions(params2, opts) {
126978
127495
  return this._service.xrpc.call("com.atproto.admin.getModerationActions", params2, void 0, opts).catch((e) => {
126979
- throw toKnownErr6(e);
127496
+ throw toKnownErr7(e);
126980
127497
  });
126981
127498
  }
126982
127499
  getModerationReport(params2, opts) {
126983
127500
  return this._service.xrpc.call("com.atproto.admin.getModerationReport", params2, void 0, opts).catch((e) => {
126984
- throw toKnownErr7(e);
127501
+ throw toKnownErr8(e);
126985
127502
  });
126986
127503
  }
126987
127504
  getModerationReports(params2, opts) {
126988
127505
  return this._service.xrpc.call("com.atproto.admin.getModerationReports", params2, void 0, opts).catch((e) => {
126989
- throw toKnownErr8(e);
127506
+ throw toKnownErr9(e);
126990
127507
  });
126991
127508
  }
126992
127509
  getRecord(params2, opts) {
126993
127510
  return this._service.xrpc.call("com.atproto.admin.getRecord", params2, void 0, opts).catch((e) => {
126994
- throw toKnownErr9(e);
127511
+ throw toKnownErr10(e);
126995
127512
  });
126996
127513
  }
126997
127514
  getRepo(params2, opts) {
126998
127515
  return this._service.xrpc.call("com.atproto.admin.getRepo", params2, void 0, opts).catch((e) => {
126999
- throw toKnownErr10(e);
127516
+ throw toKnownErr11(e);
127517
+ });
127518
+ }
127519
+ getSubjectStatus(params2, opts) {
127520
+ return this._service.xrpc.call("com.atproto.admin.getSubjectStatus", params2, void 0, opts).catch((e) => {
127521
+ throw toKnownErr12(e);
127000
127522
  });
127001
127523
  }
127002
127524
  resolveModerationReports(data, opts) {
127003
127525
  return this._service.xrpc.call("com.atproto.admin.resolveModerationReports", opts?.qp, data, opts).catch((e) => {
127004
- throw toKnownErr11(e);
127526
+ throw toKnownErr13(e);
127005
127527
  });
127006
127528
  }
127007
127529
  reverseModerationAction(data, opts) {
127008
127530
  return this._service.xrpc.call("com.atproto.admin.reverseModerationAction", opts?.qp, data, opts).catch((e) => {
127009
- throw toKnownErr12(e);
127531
+ throw toKnownErr14(e);
127010
127532
  });
127011
127533
  }
127012
127534
  searchRepos(params2, opts) {
127013
127535
  return this._service.xrpc.call("com.atproto.admin.searchRepos", params2, void 0, opts).catch((e) => {
127014
- throw toKnownErr13(e);
127536
+ throw toKnownErr15(e);
127015
127537
  });
127016
127538
  }
127017
127539
  sendEmail(data, opts) {
127018
127540
  return this._service.xrpc.call("com.atproto.admin.sendEmail", opts?.qp, data, opts).catch((e) => {
127019
- throw toKnownErr14(e);
127541
+ throw toKnownErr16(e);
127020
127542
  });
127021
127543
  }
127022
127544
  takeModerationAction(data, opts) {
127023
127545
  return this._service.xrpc.call("com.atproto.admin.takeModerationAction", opts?.qp, data, opts).catch((e) => {
127024
- throw toKnownErr15(e);
127546
+ throw toKnownErr17(e);
127025
127547
  });
127026
127548
  }
127027
127549
  updateAccountEmail(data, opts) {
127028
127550
  return this._service.xrpc.call("com.atproto.admin.updateAccountEmail", opts?.qp, data, opts).catch((e) => {
127029
- throw toKnownErr16(e);
127551
+ throw toKnownErr18(e);
127030
127552
  });
127031
127553
  }
127032
127554
  updateAccountHandle(data, opts) {
127033
127555
  return this._service.xrpc.call("com.atproto.admin.updateAccountHandle", opts?.qp, data, opts).catch((e) => {
127034
- throw toKnownErr17(e);
127556
+ throw toKnownErr19(e);
127557
+ });
127558
+ }
127559
+ updateSubjectStatus(data, opts) {
127560
+ return this._service.xrpc.call("com.atproto.admin.updateSubjectStatus", opts?.qp, data, opts).catch((e) => {
127561
+ throw toKnownErr20(e);
127035
127562
  });
127036
127563
  }
127037
127564
  };
@@ -127041,12 +127568,12 @@ var IdentityNS = class {
127041
127568
  }
127042
127569
  resolveHandle(params2, opts) {
127043
127570
  return this._service.xrpc.call("com.atproto.identity.resolveHandle", params2, void 0, opts).catch((e) => {
127044
- throw toKnownErr18(e);
127571
+ throw toKnownErr21(e);
127045
127572
  });
127046
127573
  }
127047
127574
  updateHandle(data, opts) {
127048
127575
  return this._service.xrpc.call("com.atproto.identity.updateHandle", opts?.qp, data, opts).catch((e) => {
127049
- throw toKnownErr19(e);
127576
+ throw toKnownErr22(e);
127050
127577
  });
127051
127578
  }
127052
127579
  };
@@ -127056,7 +127583,7 @@ var LabelNS = class {
127056
127583
  }
127057
127584
  queryLabels(params2, opts) {
127058
127585
  return this._service.xrpc.call("com.atproto.label.queryLabels", params2, void 0, opts).catch((e) => {
127059
- throw toKnownErr20(e);
127586
+ throw toKnownErr23(e);
127060
127587
  });
127061
127588
  }
127062
127589
  };
@@ -127066,7 +127593,7 @@ var ModerationNS = class {
127066
127593
  }
127067
127594
  createReport(data, opts) {
127068
127595
  return this._service.xrpc.call("com.atproto.moderation.createReport", opts?.qp, data, opts).catch((e) => {
127069
- throw toKnownErr21(e);
127596
+ throw toKnownErr24(e);
127070
127597
  });
127071
127598
  }
127072
127599
  };
@@ -127076,42 +127603,42 @@ var RepoNS = class {
127076
127603
  }
127077
127604
  applyWrites(data, opts) {
127078
127605
  return this._service.xrpc.call("com.atproto.repo.applyWrites", opts?.qp, data, opts).catch((e) => {
127079
- throw toKnownErr22(e);
127606
+ throw toKnownErr25(e);
127080
127607
  });
127081
127608
  }
127082
127609
  createRecord(data, opts) {
127083
127610
  return this._service.xrpc.call("com.atproto.repo.createRecord", opts?.qp, data, opts).catch((e) => {
127084
- throw toKnownErr23(e);
127611
+ throw toKnownErr26(e);
127085
127612
  });
127086
127613
  }
127087
127614
  deleteRecord(data, opts) {
127088
127615
  return this._service.xrpc.call("com.atproto.repo.deleteRecord", opts?.qp, data, opts).catch((e) => {
127089
- throw toKnownErr24(e);
127616
+ throw toKnownErr27(e);
127090
127617
  });
127091
127618
  }
127092
127619
  describeRepo(params2, opts) {
127093
127620
  return this._service.xrpc.call("com.atproto.repo.describeRepo", params2, void 0, opts).catch((e) => {
127094
- throw toKnownErr25(e);
127621
+ throw toKnownErr28(e);
127095
127622
  });
127096
127623
  }
127097
127624
  getRecord(params2, opts) {
127098
127625
  return this._service.xrpc.call("com.atproto.repo.getRecord", params2, void 0, opts).catch((e) => {
127099
- throw toKnownErr26(e);
127626
+ throw toKnownErr29(e);
127100
127627
  });
127101
127628
  }
127102
127629
  listRecords(params2, opts) {
127103
127630
  return this._service.xrpc.call("com.atproto.repo.listRecords", params2, void 0, opts).catch((e) => {
127104
- throw toKnownErr27(e);
127631
+ throw toKnownErr30(e);
127105
127632
  });
127106
127633
  }
127107
127634
  putRecord(data, opts) {
127108
127635
  return this._service.xrpc.call("com.atproto.repo.putRecord", opts?.qp, data, opts).catch((e) => {
127109
- throw toKnownErr28(e);
127636
+ throw toKnownErr31(e);
127110
127637
  });
127111
127638
  }
127112
127639
  uploadBlob(data, opts) {
127113
127640
  return this._service.xrpc.call("com.atproto.repo.uploadBlob", opts?.qp, data, opts).catch((e) => {
127114
- throw toKnownErr29(e);
127641
+ throw toKnownErr32(e);
127115
127642
  });
127116
127643
  }
127117
127644
  };
@@ -127119,84 +127646,109 @@ var ServerNS = class {
127119
127646
  constructor(service2) {
127120
127647
  this._service = service2;
127121
127648
  }
127649
+ confirmEmail(data, opts) {
127650
+ return this._service.xrpc.call("com.atproto.server.confirmEmail", opts?.qp, data, opts).catch((e) => {
127651
+ throw toKnownErr33(e);
127652
+ });
127653
+ }
127122
127654
  createAccount(data, opts) {
127123
127655
  return this._service.xrpc.call("com.atproto.server.createAccount", opts?.qp, data, opts).catch((e) => {
127124
- throw toKnownErr30(e);
127656
+ throw toKnownErr34(e);
127125
127657
  });
127126
127658
  }
127127
127659
  createAppPassword(data, opts) {
127128
127660
  return this._service.xrpc.call("com.atproto.server.createAppPassword", opts?.qp, data, opts).catch((e) => {
127129
- throw toKnownErr31(e);
127661
+ throw toKnownErr35(e);
127130
127662
  });
127131
127663
  }
127132
127664
  createInviteCode(data, opts) {
127133
127665
  return this._service.xrpc.call("com.atproto.server.createInviteCode", opts?.qp, data, opts).catch((e) => {
127134
- throw toKnownErr32(e);
127666
+ throw toKnownErr36(e);
127135
127667
  });
127136
127668
  }
127137
127669
  createInviteCodes(data, opts) {
127138
127670
  return this._service.xrpc.call("com.atproto.server.createInviteCodes", opts?.qp, data, opts).catch((e) => {
127139
- throw toKnownErr33(e);
127671
+ throw toKnownErr37(e);
127140
127672
  });
127141
127673
  }
127142
127674
  createSession(data, opts) {
127143
127675
  return this._service.xrpc.call("com.atproto.server.createSession", opts?.qp, data, opts).catch((e) => {
127144
- throw toKnownErr34(e);
127676
+ throw toKnownErr38(e);
127145
127677
  });
127146
127678
  }
127147
127679
  deleteAccount(data, opts) {
127148
127680
  return this._service.xrpc.call("com.atproto.server.deleteAccount", opts?.qp, data, opts).catch((e) => {
127149
- throw toKnownErr35(e);
127681
+ throw toKnownErr39(e);
127150
127682
  });
127151
127683
  }
127152
127684
  deleteSession(data, opts) {
127153
127685
  return this._service.xrpc.call("com.atproto.server.deleteSession", opts?.qp, data, opts).catch((e) => {
127154
- throw toKnownErr36(e);
127686
+ throw toKnownErr40(e);
127155
127687
  });
127156
127688
  }
127157
127689
  describeServer(params2, opts) {
127158
127690
  return this._service.xrpc.call("com.atproto.server.describeServer", params2, void 0, opts).catch((e) => {
127159
- throw toKnownErr37(e);
127691
+ throw toKnownErr41(e);
127160
127692
  });
127161
127693
  }
127162
127694
  getAccountInviteCodes(params2, opts) {
127163
127695
  return this._service.xrpc.call("com.atproto.server.getAccountInviteCodes", params2, void 0, opts).catch((e) => {
127164
- throw toKnownErr38(e);
127696
+ throw toKnownErr42(e);
127165
127697
  });
127166
127698
  }
127167
127699
  getSession(params2, opts) {
127168
127700
  return this._service.xrpc.call("com.atproto.server.getSession", params2, void 0, opts).catch((e) => {
127169
- throw toKnownErr39(e);
127701
+ throw toKnownErr43(e);
127170
127702
  });
127171
127703
  }
127172
127704
  listAppPasswords(params2, opts) {
127173
127705
  return this._service.xrpc.call("com.atproto.server.listAppPasswords", params2, void 0, opts).catch((e) => {
127174
- throw toKnownErr40(e);
127706
+ throw toKnownErr44(e);
127175
127707
  });
127176
127708
  }
127177
127709
  refreshSession(data, opts) {
127178
127710
  return this._service.xrpc.call("com.atproto.server.refreshSession", opts?.qp, data, opts).catch((e) => {
127179
- throw toKnownErr41(e);
127711
+ throw toKnownErr45(e);
127180
127712
  });
127181
127713
  }
127182
127714
  requestAccountDelete(data, opts) {
127183
127715
  return this._service.xrpc.call("com.atproto.server.requestAccountDelete", opts?.qp, data, opts).catch((e) => {
127184
- throw toKnownErr42(e);
127716
+ throw toKnownErr46(e);
127717
+ });
127718
+ }
127719
+ requestEmailConfirmation(data, opts) {
127720
+ return this._service.xrpc.call("com.atproto.server.requestEmailConfirmation", opts?.qp, data, opts).catch((e) => {
127721
+ throw toKnownErr47(e);
127722
+ });
127723
+ }
127724
+ requestEmailUpdate(data, opts) {
127725
+ return this._service.xrpc.call("com.atproto.server.requestEmailUpdate", opts?.qp, data, opts).catch((e) => {
127726
+ throw toKnownErr48(e);
127185
127727
  });
127186
127728
  }
127187
127729
  requestPasswordReset(data, opts) {
127188
127730
  return this._service.xrpc.call("com.atproto.server.requestPasswordReset", opts?.qp, data, opts).catch((e) => {
127189
- throw toKnownErr43(e);
127731
+ throw toKnownErr49(e);
127732
+ });
127733
+ }
127734
+ reserveSigningKey(data, opts) {
127735
+ return this._service.xrpc.call("com.atproto.server.reserveSigningKey", opts?.qp, data, opts).catch((e) => {
127736
+ throw toKnownErr50(e);
127190
127737
  });
127191
127738
  }
127192
127739
  resetPassword(data, opts) {
127193
127740
  return this._service.xrpc.call("com.atproto.server.resetPassword", opts?.qp, data, opts).catch((e) => {
127194
- throw toKnownErr44(e);
127741
+ throw toKnownErr51(e);
127195
127742
  });
127196
127743
  }
127197
127744
  revokeAppPassword(data, opts) {
127198
127745
  return this._service.xrpc.call("com.atproto.server.revokeAppPassword", opts?.qp, data, opts).catch((e) => {
127199
- throw toKnownErr45(e);
127746
+ throw toKnownErr52(e);
127747
+ });
127748
+ }
127749
+ updateEmail(data, opts) {
127750
+ return this._service.xrpc.call("com.atproto.server.updateEmail", opts?.qp, data, opts).catch((e) => {
127751
+ throw toKnownErr53(e);
127200
127752
  });
127201
127753
  }
127202
127754
  };
@@ -127206,57 +127758,57 @@ var SyncNS = class {
127206
127758
  }
127207
127759
  getBlob(params2, opts) {
127208
127760
  return this._service.xrpc.call("com.atproto.sync.getBlob", params2, void 0, opts).catch((e) => {
127209
- throw toKnownErr46(e);
127761
+ throw toKnownErr54(e);
127210
127762
  });
127211
127763
  }
127212
127764
  getBlocks(params2, opts) {
127213
127765
  return this._service.xrpc.call("com.atproto.sync.getBlocks", params2, void 0, opts).catch((e) => {
127214
- throw toKnownErr47(e);
127766
+ throw toKnownErr55(e);
127215
127767
  });
127216
127768
  }
127217
127769
  getCheckout(params2, opts) {
127218
127770
  return this._service.xrpc.call("com.atproto.sync.getCheckout", params2, void 0, opts).catch((e) => {
127219
- throw toKnownErr48(e);
127771
+ throw toKnownErr56(e);
127220
127772
  });
127221
127773
  }
127222
127774
  getHead(params2, opts) {
127223
127775
  return this._service.xrpc.call("com.atproto.sync.getHead", params2, void 0, opts).catch((e) => {
127224
- throw toKnownErr49(e);
127776
+ throw toKnownErr57(e);
127225
127777
  });
127226
127778
  }
127227
127779
  getLatestCommit(params2, opts) {
127228
127780
  return this._service.xrpc.call("com.atproto.sync.getLatestCommit", params2, void 0, opts).catch((e) => {
127229
- throw toKnownErr50(e);
127781
+ throw toKnownErr58(e);
127230
127782
  });
127231
127783
  }
127232
127784
  getRecord(params2, opts) {
127233
127785
  return this._service.xrpc.call("com.atproto.sync.getRecord", params2, void 0, opts).catch((e) => {
127234
- throw toKnownErr51(e);
127786
+ throw toKnownErr59(e);
127235
127787
  });
127236
127788
  }
127237
127789
  getRepo(params2, opts) {
127238
127790
  return this._service.xrpc.call("com.atproto.sync.getRepo", params2, void 0, opts).catch((e) => {
127239
- throw toKnownErr52(e);
127791
+ throw toKnownErr60(e);
127240
127792
  });
127241
127793
  }
127242
127794
  listBlobs(params2, opts) {
127243
127795
  return this._service.xrpc.call("com.atproto.sync.listBlobs", params2, void 0, opts).catch((e) => {
127244
- throw toKnownErr53(e);
127796
+ throw toKnownErr61(e);
127245
127797
  });
127246
127798
  }
127247
127799
  listRepos(params2, opts) {
127248
127800
  return this._service.xrpc.call("com.atproto.sync.listRepos", params2, void 0, opts).catch((e) => {
127249
- throw toKnownErr54(e);
127801
+ throw toKnownErr62(e);
127250
127802
  });
127251
127803
  }
127252
127804
  notifyOfUpdate(data, opts) {
127253
127805
  return this._service.xrpc.call("com.atproto.sync.notifyOfUpdate", opts?.qp, data, opts).catch((e) => {
127254
- throw toKnownErr55(e);
127806
+ throw toKnownErr63(e);
127255
127807
  });
127256
127808
  }
127257
127809
  requestCrawl(data, opts) {
127258
127810
  return this._service.xrpc.call("com.atproto.sync.requestCrawl", opts?.qp, data, opts).catch((e) => {
127259
- throw toKnownErr56(e);
127811
+ throw toKnownErr64(e);
127260
127812
  });
127261
127813
  }
127262
127814
  };
@@ -127285,37 +127837,37 @@ var ActorNS = class {
127285
127837
  }
127286
127838
  getPreferences(params2, opts) {
127287
127839
  return this._service.xrpc.call("app.bsky.actor.getPreferences", params2, void 0, opts).catch((e) => {
127288
- throw toKnownErr57(e);
127840
+ throw toKnownErr65(e);
127289
127841
  });
127290
127842
  }
127291
127843
  getProfile(params2, opts) {
127292
127844
  return this._service.xrpc.call("app.bsky.actor.getProfile", params2, void 0, opts).catch((e) => {
127293
- throw toKnownErr58(e);
127845
+ throw toKnownErr66(e);
127294
127846
  });
127295
127847
  }
127296
127848
  getProfiles(params2, opts) {
127297
127849
  return this._service.xrpc.call("app.bsky.actor.getProfiles", params2, void 0, opts).catch((e) => {
127298
- throw toKnownErr59(e);
127850
+ throw toKnownErr67(e);
127299
127851
  });
127300
127852
  }
127301
127853
  getSuggestions(params2, opts) {
127302
127854
  return this._service.xrpc.call("app.bsky.actor.getSuggestions", params2, void 0, opts).catch((e) => {
127303
- throw toKnownErr60(e);
127855
+ throw toKnownErr68(e);
127304
127856
  });
127305
127857
  }
127306
127858
  putPreferences(data, opts) {
127307
127859
  return this._service.xrpc.call("app.bsky.actor.putPreferences", opts?.qp, data, opts).catch((e) => {
127308
- throw toKnownErr61(e);
127860
+ throw toKnownErr69(e);
127309
127861
  });
127310
127862
  }
127311
127863
  searchActors(params2, opts) {
127312
127864
  return this._service.xrpc.call("app.bsky.actor.searchActors", params2, void 0, opts).catch((e) => {
127313
- throw toKnownErr62(e);
127865
+ throw toKnownErr70(e);
127314
127866
  });
127315
127867
  }
127316
127868
  searchActorsTypeahead(params2, opts) {
127317
127869
  return this._service.xrpc.call("app.bsky.actor.searchActorsTypeahead", params2, void 0, opts).catch((e) => {
127318
- throw toKnownErr63(e);
127870
+ throw toKnownErr71(e);
127319
127871
  });
127320
127872
  }
127321
127873
  };
@@ -127362,82 +127914,82 @@ var FeedNS = class {
127362
127914
  }
127363
127915
  describeFeedGenerator(params2, opts) {
127364
127916
  return this._service.xrpc.call("app.bsky.feed.describeFeedGenerator", params2, void 0, opts).catch((e) => {
127365
- throw toKnownErr64(e);
127917
+ throw toKnownErr72(e);
127366
127918
  });
127367
127919
  }
127368
127920
  getActorFeeds(params2, opts) {
127369
127921
  return this._service.xrpc.call("app.bsky.feed.getActorFeeds", params2, void 0, opts).catch((e) => {
127370
- throw toKnownErr65(e);
127922
+ throw toKnownErr73(e);
127371
127923
  });
127372
127924
  }
127373
127925
  getActorLikes(params2, opts) {
127374
127926
  return this._service.xrpc.call("app.bsky.feed.getActorLikes", params2, void 0, opts).catch((e) => {
127375
- throw toKnownErr66(e);
127927
+ throw toKnownErr74(e);
127376
127928
  });
127377
127929
  }
127378
127930
  getAuthorFeed(params2, opts) {
127379
127931
  return this._service.xrpc.call("app.bsky.feed.getAuthorFeed", params2, void 0, opts).catch((e) => {
127380
- throw toKnownErr67(e);
127932
+ throw toKnownErr75(e);
127381
127933
  });
127382
127934
  }
127383
127935
  getFeed(params2, opts) {
127384
127936
  return this._service.xrpc.call("app.bsky.feed.getFeed", params2, void 0, opts).catch((e) => {
127385
- throw toKnownErr68(e);
127937
+ throw toKnownErr76(e);
127386
127938
  });
127387
127939
  }
127388
127940
  getFeedGenerator(params2, opts) {
127389
127941
  return this._service.xrpc.call("app.bsky.feed.getFeedGenerator", params2, void 0, opts).catch((e) => {
127390
- throw toKnownErr69(e);
127942
+ throw toKnownErr77(e);
127391
127943
  });
127392
127944
  }
127393
127945
  getFeedGenerators(params2, opts) {
127394
127946
  return this._service.xrpc.call("app.bsky.feed.getFeedGenerators", params2, void 0, opts).catch((e) => {
127395
- throw toKnownErr70(e);
127947
+ throw toKnownErr78(e);
127396
127948
  });
127397
127949
  }
127398
127950
  getFeedSkeleton(params2, opts) {
127399
127951
  return this._service.xrpc.call("app.bsky.feed.getFeedSkeleton", params2, void 0, opts).catch((e) => {
127400
- throw toKnownErr71(e);
127952
+ throw toKnownErr79(e);
127401
127953
  });
127402
127954
  }
127403
127955
  getLikes(params2, opts) {
127404
127956
  return this._service.xrpc.call("app.bsky.feed.getLikes", params2, void 0, opts).catch((e) => {
127405
- throw toKnownErr72(e);
127957
+ throw toKnownErr80(e);
127406
127958
  });
127407
127959
  }
127408
127960
  getListFeed(params2, opts) {
127409
127961
  return this._service.xrpc.call("app.bsky.feed.getListFeed", params2, void 0, opts).catch((e) => {
127410
- throw toKnownErr73(e);
127962
+ throw toKnownErr81(e);
127411
127963
  });
127412
127964
  }
127413
127965
  getPostThread(params2, opts) {
127414
127966
  return this._service.xrpc.call("app.bsky.feed.getPostThread", params2, void 0, opts).catch((e) => {
127415
- throw toKnownErr74(e);
127967
+ throw toKnownErr82(e);
127416
127968
  });
127417
127969
  }
127418
127970
  getPosts(params2, opts) {
127419
127971
  return this._service.xrpc.call("app.bsky.feed.getPosts", params2, void 0, opts).catch((e) => {
127420
- throw toKnownErr75(e);
127972
+ throw toKnownErr83(e);
127421
127973
  });
127422
127974
  }
127423
127975
  getRepostedBy(params2, opts) {
127424
127976
  return this._service.xrpc.call("app.bsky.feed.getRepostedBy", params2, void 0, opts).catch((e) => {
127425
- throw toKnownErr76(e);
127977
+ throw toKnownErr84(e);
127426
127978
  });
127427
127979
  }
127428
127980
  getSuggestedFeeds(params2, opts) {
127429
127981
  return this._service.xrpc.call("app.bsky.feed.getSuggestedFeeds", params2, void 0, opts).catch((e) => {
127430
- throw toKnownErr77(e);
127982
+ throw toKnownErr85(e);
127431
127983
  });
127432
127984
  }
127433
127985
  getTimeline(params2, opts) {
127434
127986
  return this._service.xrpc.call("app.bsky.feed.getTimeline", params2, void 0, opts).catch((e) => {
127435
- throw toKnownErr78(e);
127987
+ throw toKnownErr86(e);
127436
127988
  });
127437
127989
  }
127438
127990
  searchPosts(params2, opts) {
127439
127991
  return this._service.xrpc.call("app.bsky.feed.searchPosts", params2, void 0, opts).catch((e) => {
127440
- throw toKnownErr79(e);
127992
+ throw toKnownErr87(e);
127441
127993
  });
127442
127994
  }
127443
127995
  };
@@ -127587,67 +128139,67 @@ var GraphNS = class {
127587
128139
  }
127588
128140
  getBlocks(params2, opts) {
127589
128141
  return this._service.xrpc.call("app.bsky.graph.getBlocks", params2, void 0, opts).catch((e) => {
127590
- throw toKnownErr80(e);
128142
+ throw toKnownErr88(e);
127591
128143
  });
127592
128144
  }
127593
128145
  getFollowers(params2, opts) {
127594
128146
  return this._service.xrpc.call("app.bsky.graph.getFollowers", params2, void 0, opts).catch((e) => {
127595
- throw toKnownErr81(e);
128147
+ throw toKnownErr89(e);
127596
128148
  });
127597
128149
  }
127598
128150
  getFollows(params2, opts) {
127599
128151
  return this._service.xrpc.call("app.bsky.graph.getFollows", params2, void 0, opts).catch((e) => {
127600
- throw toKnownErr82(e);
128152
+ throw toKnownErr90(e);
127601
128153
  });
127602
128154
  }
127603
128155
  getList(params2, opts) {
127604
128156
  return this._service.xrpc.call("app.bsky.graph.getList", params2, void 0, opts).catch((e) => {
127605
- throw toKnownErr83(e);
128157
+ throw toKnownErr91(e);
127606
128158
  });
127607
128159
  }
127608
128160
  getListBlocks(params2, opts) {
127609
128161
  return this._service.xrpc.call("app.bsky.graph.getListBlocks", params2, void 0, opts).catch((e) => {
127610
- throw toKnownErr84(e);
128162
+ throw toKnownErr92(e);
127611
128163
  });
127612
128164
  }
127613
128165
  getListMutes(params2, opts) {
127614
128166
  return this._service.xrpc.call("app.bsky.graph.getListMutes", params2, void 0, opts).catch((e) => {
127615
- throw toKnownErr85(e);
128167
+ throw toKnownErr93(e);
127616
128168
  });
127617
128169
  }
127618
128170
  getLists(params2, opts) {
127619
128171
  return this._service.xrpc.call("app.bsky.graph.getLists", params2, void 0, opts).catch((e) => {
127620
- throw toKnownErr86(e);
128172
+ throw toKnownErr94(e);
127621
128173
  });
127622
128174
  }
127623
128175
  getMutes(params2, opts) {
127624
128176
  return this._service.xrpc.call("app.bsky.graph.getMutes", params2, void 0, opts).catch((e) => {
127625
- throw toKnownErr87(e);
128177
+ throw toKnownErr95(e);
127626
128178
  });
127627
128179
  }
127628
128180
  getSuggestedFollowsByActor(params2, opts) {
127629
128181
  return this._service.xrpc.call("app.bsky.graph.getSuggestedFollowsByActor", params2, void 0, opts).catch((e) => {
127630
- throw toKnownErr88(e);
128182
+ throw toKnownErr96(e);
127631
128183
  });
127632
128184
  }
127633
128185
  muteActor(data, opts) {
127634
128186
  return this._service.xrpc.call("app.bsky.graph.muteActor", opts?.qp, data, opts).catch((e) => {
127635
- throw toKnownErr89(e);
128187
+ throw toKnownErr97(e);
127636
128188
  });
127637
128189
  }
127638
128190
  muteActorList(data, opts) {
127639
128191
  return this._service.xrpc.call("app.bsky.graph.muteActorList", opts?.qp, data, opts).catch((e) => {
127640
- throw toKnownErr90(e);
128192
+ throw toKnownErr98(e);
127641
128193
  });
127642
128194
  }
127643
128195
  unmuteActor(data, opts) {
127644
128196
  return this._service.xrpc.call("app.bsky.graph.unmuteActor", opts?.qp, data, opts).catch((e) => {
127645
- throw toKnownErr91(e);
128197
+ throw toKnownErr99(e);
127646
128198
  });
127647
128199
  }
127648
128200
  unmuteActorList(data, opts) {
127649
128201
  return this._service.xrpc.call("app.bsky.graph.unmuteActorList", opts?.qp, data, opts).catch((e) => {
127650
- throw toKnownErr92(e);
128202
+ throw toKnownErr100(e);
127651
128203
  });
127652
128204
  }
127653
128205
  };
@@ -127792,22 +128344,22 @@ var NotificationNS = class {
127792
128344
  }
127793
128345
  getUnreadCount(params2, opts) {
127794
128346
  return this._service.xrpc.call("app.bsky.notification.getUnreadCount", params2, void 0, opts).catch((e) => {
127795
- throw toKnownErr93(e);
128347
+ throw toKnownErr101(e);
127796
128348
  });
127797
128349
  }
127798
128350
  listNotifications(params2, opts) {
127799
128351
  return this._service.xrpc.call("app.bsky.notification.listNotifications", params2, void 0, opts).catch((e) => {
127800
- throw toKnownErr94(e);
128352
+ throw toKnownErr102(e);
127801
128353
  });
127802
128354
  }
127803
128355
  registerPush(data, opts) {
127804
128356
  return this._service.xrpc.call("app.bsky.notification.registerPush", opts?.qp, data, opts).catch((e) => {
127805
- throw toKnownErr95(e);
128357
+ throw toKnownErr103(e);
127806
128358
  });
127807
128359
  }
127808
128360
  updateSeen(data, opts) {
127809
128361
  return this._service.xrpc.call("app.bsky.notification.updateSeen", opts?.qp, data, opts).catch((e) => {
127810
- throw toKnownErr96(e);
128362
+ throw toKnownErr104(e);
127811
128363
  });
127812
128364
  }
127813
128365
  };
@@ -127822,27 +128374,27 @@ var UnspeccedNS = class {
127822
128374
  }
127823
128375
  getPopular(params2, opts) {
127824
128376
  return this._service.xrpc.call("app.bsky.unspecced.getPopular", params2, void 0, opts).catch((e) => {
127825
- throw toKnownErr97(e);
128377
+ throw toKnownErr105(e);
127826
128378
  });
127827
128379
  }
127828
128380
  getPopularFeedGenerators(params2, opts) {
127829
128381
  return this._service.xrpc.call("app.bsky.unspecced.getPopularFeedGenerators", params2, void 0, opts).catch((e) => {
127830
- throw toKnownErr98(e);
128382
+ throw toKnownErr106(e);
127831
128383
  });
127832
128384
  }
127833
128385
  getTimelineSkeleton(params2, opts) {
127834
128386
  return this._service.xrpc.call("app.bsky.unspecced.getTimelineSkeleton", params2, void 0, opts).catch((e) => {
127835
- throw toKnownErr99(e);
128387
+ throw toKnownErr107(e);
127836
128388
  });
127837
128389
  }
127838
128390
  searchActorsSkeleton(params2, opts) {
127839
128391
  return this._service.xrpc.call("app.bsky.unspecced.searchActorsSkeleton", params2, void 0, opts).catch((e) => {
127840
- throw toKnownErr100(e);
128392
+ throw toKnownErr108(e);
127841
128393
  });
127842
128394
  }
127843
128395
  searchPostsSkeleton(params2, opts) {
127844
128396
  return this._service.xrpc.call("app.bsky.unspecced.searchPostsSkeleton", params2, void 0, opts).catch((e) => {
127845
- throw toKnownErr101(e);
128397
+ throw toKnownErr109(e);
127846
128398
  });
127847
128399
  }
127848
128400
  };
@@ -127886,8 +128438,10 @@ var _AtpAgent = class {
127886
128438
  refreshJwt: res.data.refreshJwt,
127887
128439
  handle: res.data.handle,
127888
128440
  did: res.data.did,
127889
- email: opts.email
128441
+ email: opts.email,
128442
+ emailConfirmed: false
127890
128443
  };
128444
+ this._updateApiEndpoint(res.data.didDoc);
127891
128445
  return res;
127892
128446
  } catch (e) {
127893
128447
  this.session = void 0;
@@ -127911,8 +128465,10 @@ var _AtpAgent = class {
127911
128465
  refreshJwt: res.data.refreshJwt,
127912
128466
  handle: res.data.handle,
127913
128467
  did: res.data.did,
127914
- email: res.data.email
128468
+ email: res.data.email,
128469
+ emailConfirmed: res.data.emailConfirmed
127915
128470
  };
128471
+ this._updateApiEndpoint(res.data.didDoc);
127916
128472
  return res;
127917
128473
  } catch (e) {
127918
128474
  this.session = void 0;
@@ -127934,6 +128490,7 @@ var _AtpAgent = class {
127934
128490
  }
127935
128491
  this.session.email = res.data.email;
127936
128492
  this.session.handle = res.data.handle;
128493
+ this.session.emailConfirmed = res.data.emailConfirmed;
127937
128494
  return res;
127938
128495
  } catch (e) {
127939
128496
  this.session = void 0;
@@ -127985,7 +128542,7 @@ var _AtpAgent = class {
127985
128542
  if (!this.session?.refreshJwt) {
127986
128543
  return;
127987
128544
  }
127988
- const url = new URL(this.service.origin);
128545
+ const url = new URL((this.pdsUrl || this.service).origin);
127989
128546
  url.pathname = `/xrpc/${REFRESH_SESSION}`;
127990
128547
  const res = await _AtpAgent.fetch(url.toString(), "POST", {
127991
128548
  authorization: `Bearer ${this.session.refreshJwt}`
@@ -127995,14 +128552,23 @@ var _AtpAgent = class {
127995
128552
  this._persistSession?.("expired", void 0);
127996
128553
  } else if (isNewSessionObject(this._baseClient, res.body)) {
127997
128554
  this.session = {
128555
+ ...this.session || {},
127998
128556
  accessJwt: res.body.accessJwt,
127999
128557
  refreshJwt: res.body.refreshJwt,
128000
128558
  handle: res.body.handle,
128001
128559
  did: res.body.did
128002
128560
  };
128561
+ this._updateApiEndpoint(res.body.didDoc);
128003
128562
  this._persistSession?.("update", this.session);
128004
128563
  }
128005
128564
  }
128565
+ _updateApiEndpoint(didDoc) {
128566
+ if (isValidDidDoc(didDoc)) {
128567
+ const endpoint = getPdsEndpoint(didDoc);
128568
+ this.pdsUrl = endpoint ? new URL(endpoint) : void 0;
128569
+ }
128570
+ this.api.xrpc.uri = this.pdsUrl || this.service;
128571
+ }
128006
128572
  };
128007
128573
  var AtpAgent = _AtpAgent;
128008
128574
  AtpAgent.fetch = defaultFetchHandler;
@@ -129023,7 +129589,7 @@ var skeletonFromFeedGen = async (ctx, params2) => {
129023
129589
  if (!resolved) {
129024
129590
  throw new InvalidRequestError(`could not resolve did document: ${feedDid}`);
129025
129591
  }
129026
- const fgEndpoint = getFeedGen(resolved);
129592
+ const fgEndpoint = getFeedGenEndpoint(resolved);
129027
129593
  if (!fgEndpoint) {
129028
129594
  throw new InvalidRequestError(`invalid feed generator service details in did document: ${feedDid}`);
129029
129595
  }
@@ -129098,7 +129664,7 @@ function getFeedGenerator_default(server, ctx) {
129098
129664
  if (!resolved) {
129099
129665
  throw new InvalidRequestError(`could not resolve did document: ${feedDid}`);
129100
129666
  }
129101
- const fgEndpoint = getFeedGen(resolved);
129667
+ const fgEndpoint = getFeedGenEndpoint(resolved);
129102
129668
  if (!fgEndpoint) {
129103
129669
  throw new InvalidRequestError(`invalid feed generator service details in did document: ${feedDid}`);
129104
129670
  }
@@ -129348,6 +129914,18 @@ var schemaDict2 = {
129348
129914
  lexicon: 1,
129349
129915
  id: "com.atproto.admin.defs",
129350
129916
  defs: {
129917
+ statusAttr: {
129918
+ type: "object",
129919
+ required: ["applied"],
129920
+ properties: {
129921
+ applied: {
129922
+ type: "boolean"
129923
+ },
129924
+ ref: {
129925
+ type: "string"
129926
+ }
129927
+ }
129928
+ },
129351
129929
  actionView: {
129352
129930
  type: "object",
129353
129931
  required: [
@@ -129757,6 +130335,44 @@ var schemaDict2 = {
129757
130335
  }
129758
130336
  }
129759
130337
  },
130338
+ accountView: {
130339
+ type: "object",
130340
+ required: ["did", "handle", "indexedAt"],
130341
+ properties: {
130342
+ did: {
130343
+ type: "string",
130344
+ format: "did"
130345
+ },
130346
+ handle: {
130347
+ type: "string",
130348
+ format: "handle"
130349
+ },
130350
+ email: {
130351
+ type: "string"
130352
+ },
130353
+ indexedAt: {
130354
+ type: "string",
130355
+ format: "datetime"
130356
+ },
130357
+ invitedBy: {
130358
+ type: "ref",
130359
+ ref: "lex:com.atproto.server.defs#inviteCode"
130360
+ },
130361
+ invites: {
130362
+ type: "array",
130363
+ items: {
130364
+ type: "ref",
130365
+ ref: "lex:com.atproto.server.defs#inviteCode"
130366
+ }
130367
+ },
130368
+ invitesDisabled: {
130369
+ type: "boolean"
130370
+ },
130371
+ inviteNote: {
130372
+ type: "string"
130373
+ }
130374
+ }
130375
+ },
129760
130376
  repoViewNotFound: {
129761
130377
  type: "object",
129762
130378
  required: ["did"],
@@ -129777,6 +130393,24 @@ var schemaDict2 = {
129777
130393
  }
129778
130394
  }
129779
130395
  },
130396
+ repoBlobRef: {
130397
+ type: "object",
130398
+ required: ["did", "cid"],
130399
+ properties: {
130400
+ did: {
130401
+ type: "string",
130402
+ format: "did"
130403
+ },
130404
+ cid: {
130405
+ type: "string",
130406
+ format: "cid"
130407
+ },
130408
+ recordUri: {
130409
+ type: "string",
130410
+ format: "at-uri"
130411
+ }
130412
+ }
130413
+ },
129780
130414
  recordView: {
129781
130415
  type: "object",
129782
130416
  required: [
@@ -130059,6 +130693,33 @@ var schemaDict2 = {
130059
130693
  }
130060
130694
  }
130061
130695
  },
130696
+ ComAtprotoAdminGetAccountInfo: {
130697
+ lexicon: 1,
130698
+ id: "com.atproto.admin.getAccountInfo",
130699
+ defs: {
130700
+ main: {
130701
+ type: "query",
130702
+ description: "View details about an account.",
130703
+ parameters: {
130704
+ type: "params",
130705
+ required: ["did"],
130706
+ properties: {
130707
+ did: {
130708
+ type: "string",
130709
+ format: "did"
130710
+ }
130711
+ }
130712
+ },
130713
+ output: {
130714
+ encoding: "application/json",
130715
+ schema: {
130716
+ type: "ref",
130717
+ ref: "lex:com.atproto.admin.defs#accountView"
130718
+ }
130719
+ }
130720
+ }
130721
+ }
130722
+ },
130062
130723
  ComAtprotoAdminGetInviteCodes: {
130063
130724
  lexicon: 1,
130064
130725
  id: "com.atproto.admin.getInviteCodes",
@@ -130353,6 +131014,54 @@ var schemaDict2 = {
130353
131014
  }
130354
131015
  }
130355
131016
  },
131017
+ ComAtprotoAdminGetSubjectStatus: {
131018
+ lexicon: 1,
131019
+ id: "com.atproto.admin.getSubjectStatus",
131020
+ defs: {
131021
+ main: {
131022
+ type: "query",
131023
+ description: "Fetch the service-specific the admin status of a subject (account, record, or blob)",
131024
+ parameters: {
131025
+ type: "params",
131026
+ properties: {
131027
+ did: {
131028
+ type: "string",
131029
+ format: "did"
131030
+ },
131031
+ uri: {
131032
+ type: "string",
131033
+ format: "at-uri"
131034
+ },
131035
+ blob: {
131036
+ type: "string",
131037
+ format: "cid"
131038
+ }
131039
+ }
131040
+ },
131041
+ output: {
131042
+ encoding: "application/json",
131043
+ schema: {
131044
+ type: "object",
131045
+ required: ["subject"],
131046
+ properties: {
131047
+ subject: {
131048
+ type: "union",
131049
+ refs: [
131050
+ "lex:com.atproto.admin.defs#repoRef",
131051
+ "lex:com.atproto.repo.strongRef",
131052
+ "lex:com.atproto.admin.defs#repoBlobRef"
131053
+ ]
131054
+ },
131055
+ takedown: {
131056
+ type: "ref",
131057
+ ref: "lex:com.atproto.admin.defs#statusAttr"
131058
+ }
131059
+ }
131060
+ }
131061
+ }
131062
+ }
131063
+ }
131064
+ },
130356
131065
  ComAtprotoAdminResolveModerationReports: {
130357
131066
  lexicon: 1,
130358
131067
  id: "com.atproto.admin.resolveModerationReports",
@@ -130445,9 +131154,6 @@ var schemaDict2 = {
130445
131154
  q: {
130446
131155
  type: "string"
130447
131156
  },
130448
- invitedBy: {
130449
- type: "string"
130450
- },
130451
131157
  limit: {
130452
131158
  type: "integer",
130453
131159
  minimum: 1,
@@ -130652,6 +131358,58 @@ var schemaDict2 = {
130652
131358
  }
130653
131359
  }
130654
131360
  },
131361
+ ComAtprotoAdminUpdateSubjectStatus: {
131362
+ lexicon: 1,
131363
+ id: "com.atproto.admin.updateSubjectStatus",
131364
+ defs: {
131365
+ main: {
131366
+ type: "procedure",
131367
+ description: "Update the service-specific admin status of a subject (account, record, or blob)",
131368
+ input: {
131369
+ encoding: "application/json",
131370
+ schema: {
131371
+ type: "object",
131372
+ required: ["subject"],
131373
+ properties: {
131374
+ subject: {
131375
+ type: "union",
131376
+ refs: [
131377
+ "lex:com.atproto.admin.defs#repoRef",
131378
+ "lex:com.atproto.repo.strongRef",
131379
+ "lex:com.atproto.admin.defs#repoBlobRef"
131380
+ ]
131381
+ },
131382
+ takedown: {
131383
+ type: "ref",
131384
+ ref: "lex:com.atproto.admin.defs#statusAttr"
131385
+ }
131386
+ }
131387
+ }
131388
+ },
131389
+ output: {
131390
+ encoding: "application/json",
131391
+ schema: {
131392
+ type: "object",
131393
+ required: ["subject"],
131394
+ properties: {
131395
+ subject: {
131396
+ type: "union",
131397
+ refs: [
131398
+ "lex:com.atproto.admin.defs#repoRef",
131399
+ "lex:com.atproto.repo.strongRef",
131400
+ "lex:com.atproto.admin.defs#repoBlobRef"
131401
+ ]
131402
+ },
131403
+ takedown: {
131404
+ type: "ref",
131405
+ ref: "lex:com.atproto.admin.defs#statusAttr"
131406
+ }
131407
+ }
131408
+ }
131409
+ }
131410
+ }
131411
+ }
131412
+ },
130655
131413
  ComAtprotoIdentityResolveHandle: {
130656
131414
  lexicon: 1,
130657
131415
  id: "com.atproto.identity.resolveHandle",
@@ -130949,7 +131707,9 @@ var schemaDict2 = {
130949
131707
  ref: "lex:com.atproto.moderation.defs#reasonType"
130950
131708
  },
130951
131709
  reason: {
130952
- type: "string"
131710
+ type: "string",
131711
+ maxGraphemes: 2e3,
131712
+ maxLength: 2e4
130953
131713
  },
130954
131714
  subject: {
130955
131715
  type: "union",
@@ -131548,6 +132308,45 @@ var schemaDict2 = {
131548
132308
  }
131549
132309
  }
131550
132310
  },
132311
+ ComAtprotoServerConfirmEmail: {
132312
+ lexicon: 1,
132313
+ id: "com.atproto.server.confirmEmail",
132314
+ defs: {
132315
+ main: {
132316
+ type: "procedure",
132317
+ description: "Confirm an email using a token from com.atproto.server.requestEmailConfirmation.",
132318
+ input: {
132319
+ encoding: "application/json",
132320
+ schema: {
132321
+ type: "object",
132322
+ required: ["email", "token"],
132323
+ properties: {
132324
+ email: {
132325
+ type: "string"
132326
+ },
132327
+ token: {
132328
+ type: "string"
132329
+ }
132330
+ }
132331
+ }
132332
+ },
132333
+ errors: [
132334
+ {
132335
+ name: "AccountNotFound"
132336
+ },
132337
+ {
132338
+ name: "ExpiredToken"
132339
+ },
132340
+ {
132341
+ name: "InvalidToken"
132342
+ },
132343
+ {
132344
+ name: "InvalidEmail"
132345
+ }
132346
+ ]
132347
+ }
132348
+ }
132349
+ },
131551
132350
  ComAtprotoServerCreateAccount: {
131552
132351
  lexicon: 1,
131553
132352
  id: "com.atproto.server.createAccount",
@@ -131580,6 +132379,9 @@ var schemaDict2 = {
131580
132379
  },
131581
132380
  recoveryKey: {
131582
132381
  type: "string"
132382
+ },
132383
+ plcOp: {
132384
+ type: "bytes"
131583
132385
  }
131584
132386
  }
131585
132387
  }
@@ -131603,6 +132405,9 @@ var schemaDict2 = {
131603
132405
  did: {
131604
132406
  type: "string",
131605
132407
  format: "did"
132408
+ },
132409
+ didDoc: {
132410
+ type: "unknown"
131606
132411
  }
131607
132412
  }
131608
132413
  }
@@ -131828,8 +132633,14 @@ var schemaDict2 = {
131828
132633
  type: "string",
131829
132634
  format: "did"
131830
132635
  },
132636
+ didDoc: {
132637
+ type: "unknown"
132638
+ },
131831
132639
  email: {
131832
132640
  type: "string"
132641
+ },
132642
+ emailConfirmed: {
132643
+ type: "boolean"
131833
132644
  }
131834
132645
  }
131835
132646
  }
@@ -132059,6 +132870,9 @@ var schemaDict2 = {
132059
132870
  },
132060
132871
  email: {
132061
132872
  type: "string"
132873
+ },
132874
+ emailConfirmed: {
132875
+ type: "boolean"
132062
132876
  }
132063
132877
  }
132064
132878
  }
@@ -132136,6 +132950,9 @@ var schemaDict2 = {
132136
132950
  did: {
132137
132951
  type: "string",
132138
132952
  format: "did"
132953
+ },
132954
+ didDoc: {
132955
+ type: "unknown"
132139
132956
  }
132140
132957
  }
132141
132958
  }
@@ -132158,6 +132975,38 @@ var schemaDict2 = {
132158
132975
  }
132159
132976
  }
132160
132977
  },
132978
+ ComAtprotoServerRequestEmailConfirmation: {
132979
+ lexicon: 1,
132980
+ id: "com.atproto.server.requestEmailConfirmation",
132981
+ defs: {
132982
+ main: {
132983
+ type: "procedure",
132984
+ description: "Request an email with a code to confirm ownership of email"
132985
+ }
132986
+ }
132987
+ },
132988
+ ComAtprotoServerRequestEmailUpdate: {
132989
+ lexicon: 1,
132990
+ id: "com.atproto.server.requestEmailUpdate",
132991
+ defs: {
132992
+ main: {
132993
+ type: "procedure",
132994
+ description: "Request a token in order to update email.",
132995
+ output: {
132996
+ encoding: "application/json",
132997
+ schema: {
132998
+ type: "object",
132999
+ required: ["tokenRequired"],
133000
+ properties: {
133001
+ tokenRequired: {
133002
+ type: "boolean"
133003
+ }
133004
+ }
133005
+ }
133006
+ }
133007
+ }
133008
+ }
133009
+ },
132161
133010
  ComAtprotoServerRequestPasswordReset: {
132162
133011
  lexicon: 1,
132163
133012
  id: "com.atproto.server.requestPasswordReset",
@@ -132180,6 +133029,29 @@ var schemaDict2 = {
132180
133029
  }
132181
133030
  }
132182
133031
  },
133032
+ ComAtprotoServerReserveSigningKey: {
133033
+ lexicon: 1,
133034
+ id: "com.atproto.server.reserveSigningKey",
133035
+ defs: {
133036
+ main: {
133037
+ type: "procedure",
133038
+ description: "Reserve a repo signing key for account creation.",
133039
+ output: {
133040
+ encoding: "application/json",
133041
+ schema: {
133042
+ type: "object",
133043
+ required: ["signingKey"],
133044
+ properties: {
133045
+ signingKey: {
133046
+ type: "string",
133047
+ description: "Public signing key in the form of a did:key."
133048
+ }
133049
+ }
133050
+ }
133051
+ }
133052
+ }
133053
+ }
133054
+ },
132183
133055
  ComAtprotoServerResetPassword: {
132184
133056
  lexicon: 1,
132185
133057
  id: "com.atproto.server.resetPassword",
@@ -132235,6 +133107,43 @@ var schemaDict2 = {
132235
133107
  }
132236
133108
  }
132237
133109
  },
133110
+ ComAtprotoServerUpdateEmail: {
133111
+ lexicon: 1,
133112
+ id: "com.atproto.server.updateEmail",
133113
+ defs: {
133114
+ main: {
133115
+ type: "procedure",
133116
+ description: "Update an account's email.",
133117
+ input: {
133118
+ encoding: "application/json",
133119
+ schema: {
133120
+ type: "object",
133121
+ required: ["email"],
133122
+ properties: {
133123
+ email: {
133124
+ type: "string"
133125
+ },
133126
+ token: {
133127
+ type: "string",
133128
+ description: "Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed."
133129
+ }
133130
+ }
133131
+ }
133132
+ },
133133
+ errors: [
133134
+ {
133135
+ name: "ExpiredToken"
133136
+ },
133137
+ {
133138
+ name: "InvalidToken"
133139
+ },
133140
+ {
133141
+ name: "TokenRequired"
133142
+ }
133143
+ ]
133144
+ }
133145
+ }
133146
+ },
132238
133147
  ComAtprotoSyncGetBlob: {
132239
133148
  lexicon: 1,
132240
133149
  id: "com.atproto.sync.getBlob",
@@ -132560,7 +133469,7 @@ var schemaDict2 = {
132560
133469
  },
132561
133470
  repo: {
132562
133471
  type: "object",
132563
- required: ["did", "head"],
133472
+ required: ["did", "head", "rev"],
132564
133473
  properties: {
132565
133474
  did: {
132566
133475
  type: "string",
@@ -132569,6 +133478,9 @@ var schemaDict2 = {
132569
133478
  head: {
132570
133479
  type: "string",
132571
133480
  format: "cid"
133481
+ },
133482
+ rev: {
133483
+ type: "string"
132572
133484
  }
132573
133485
  }
132574
133486
  }
@@ -132969,6 +133881,10 @@ var schemaDict2 = {
132969
133881
  type: "string",
132970
133882
  format: "at-uri"
132971
133883
  },
133884
+ blockingByList: {
133885
+ type: "ref",
133886
+ ref: "lex:app.bsky.graph.defs#listViewBasic"
133887
+ },
132972
133888
  following: {
132973
133889
  type: "string",
132974
133890
  format: "at-uri"
@@ -136476,6 +137392,7 @@ var ids = {
136476
137392
  ComAtprotoAdminDisableAccountInvites: "com.atproto.admin.disableAccountInvites",
136477
137393
  ComAtprotoAdminDisableInviteCodes: "com.atproto.admin.disableInviteCodes",
136478
137394
  ComAtprotoAdminEnableAccountInvites: "com.atproto.admin.enableAccountInvites",
137395
+ ComAtprotoAdminGetAccountInfo: "com.atproto.admin.getAccountInfo",
136479
137396
  ComAtprotoAdminGetInviteCodes: "com.atproto.admin.getInviteCodes",
136480
137397
  ComAtprotoAdminGetModerationAction: "com.atproto.admin.getModerationAction",
136481
137398
  ComAtprotoAdminGetModerationActions: "com.atproto.admin.getModerationActions",
@@ -136483,6 +137400,7 @@ var ids = {
136483
137400
  ComAtprotoAdminGetModerationReports: "com.atproto.admin.getModerationReports",
136484
137401
  ComAtprotoAdminGetRecord: "com.atproto.admin.getRecord",
136485
137402
  ComAtprotoAdminGetRepo: "com.atproto.admin.getRepo",
137403
+ ComAtprotoAdminGetSubjectStatus: "com.atproto.admin.getSubjectStatus",
136486
137404
  ComAtprotoAdminResolveModerationReports: "com.atproto.admin.resolveModerationReports",
136487
137405
  ComAtprotoAdminReverseModerationAction: "com.atproto.admin.reverseModerationAction",
136488
137406
  ComAtprotoAdminSearchRepos: "com.atproto.admin.searchRepos",
@@ -136490,6 +137408,7 @@ var ids = {
136490
137408
  ComAtprotoAdminTakeModerationAction: "com.atproto.admin.takeModerationAction",
136491
137409
  ComAtprotoAdminUpdateAccountEmail: "com.atproto.admin.updateAccountEmail",
136492
137410
  ComAtprotoAdminUpdateAccountHandle: "com.atproto.admin.updateAccountHandle",
137411
+ ComAtprotoAdminUpdateSubjectStatus: "com.atproto.admin.updateSubjectStatus",
136493
137412
  ComAtprotoIdentityResolveHandle: "com.atproto.identity.resolveHandle",
136494
137413
  ComAtprotoIdentityUpdateHandle: "com.atproto.identity.updateHandle",
136495
137414
  ComAtprotoLabelDefs: "com.atproto.label.defs",
@@ -136506,6 +137425,7 @@ var ids = {
136506
137425
  ComAtprotoRepoPutRecord: "com.atproto.repo.putRecord",
136507
137426
  ComAtprotoRepoStrongRef: "com.atproto.repo.strongRef",
136508
137427
  ComAtprotoRepoUploadBlob: "com.atproto.repo.uploadBlob",
137428
+ ComAtprotoServerConfirmEmail: "com.atproto.server.confirmEmail",
136509
137429
  ComAtprotoServerCreateAccount: "com.atproto.server.createAccount",
136510
137430
  ComAtprotoServerCreateAppPassword: "com.atproto.server.createAppPassword",
136511
137431
  ComAtprotoServerCreateInviteCode: "com.atproto.server.createInviteCode",
@@ -136520,9 +137440,13 @@ var ids = {
136520
137440
  ComAtprotoServerListAppPasswords: "com.atproto.server.listAppPasswords",
136521
137441
  ComAtprotoServerRefreshSession: "com.atproto.server.refreshSession",
136522
137442
  ComAtprotoServerRequestAccountDelete: "com.atproto.server.requestAccountDelete",
137443
+ ComAtprotoServerRequestEmailConfirmation: "com.atproto.server.requestEmailConfirmation",
137444
+ ComAtprotoServerRequestEmailUpdate: "com.atproto.server.requestEmailUpdate",
136523
137445
  ComAtprotoServerRequestPasswordReset: "com.atproto.server.requestPasswordReset",
137446
+ ComAtprotoServerReserveSigningKey: "com.atproto.server.reserveSigningKey",
136524
137447
  ComAtprotoServerResetPassword: "com.atproto.server.resetPassword",
136525
137448
  ComAtprotoServerRevokeAppPassword: "com.atproto.server.revokeAppPassword",
137449
+ ComAtprotoServerUpdateEmail: "com.atproto.server.updateEmail",
136526
137450
  ComAtprotoSyncGetBlob: "com.atproto.sync.getBlob",
136527
137451
  ComAtprotoSyncGetBlocks: "com.atproto.sync.getBlocks",
136528
137452
  ComAtprotoSyncGetCheckout: "com.atproto.sync.getCheckout",
@@ -136724,9 +137648,9 @@ var threadgateToPostUri = (gateUri) => {
136724
137648
  function getPostThread_default(server, ctx) {
136725
137649
  const getPostThread = createPipeline(skeleton7, hydration7, noRules, presentation7);
136726
137650
  server.app.bsky.feed.getPostThread({
136727
- auth: ctx.authOptionalVerifier,
137651
+ auth: ctx.authOptionalAccessOrRoleVerifier,
136728
137652
  handler: async ({ params: params2, auth, res }) => {
136729
- const viewer = auth.credentials.did;
137653
+ const viewer = "did" in auth.credentials ? auth.credentials.did : null;
136730
137654
  const db = ctx.db.getReplica("thread");
136731
137655
  const feedService = ctx.services.feed(db);
136732
137656
  const actorService = ctx.services.actor(db);
@@ -137733,7 +138657,7 @@ function getSuggestedFollowsByActor_default(server, ctx) {
137733
138657
  }
137734
138658
  async function getSkeleton(params2, ctx) {
137735
138659
  const actorsViewerFollows = ctx.db.db.selectFrom("follow").where("creator", "=", params2.viewer).select("subjectDid");
137736
- const mostLikedAccounts = await ctx.db.db.selectFrom(ctx.db.db.selectFrom("like").where("creator", "=", params2.actor).select(sql`split_part(subject, '/', 3)`.as("subjectDid")).limit(1e3).as("likes")).select("likes.subjectDid as did").select((qb) => qb.fn.count("likes.subjectDid").as("count")).where("likes.subjectDid", "not in", actorsViewerFollows).where("likes.subjectDid", "not in", [params2.actor, params2.viewer]).groupBy("likes.subjectDid").orderBy("count", "desc").limit(RESULT_LENGTH).execute();
138660
+ const mostLikedAccounts = await ctx.db.db.selectFrom(ctx.db.db.selectFrom("like").where("creator", "=", params2.actor).select(sql`split_part(subject, '/', 3)`.as("subjectDid")).orderBy("sortAt", "desc").limit(1e3).as("likes")).select("likes.subjectDid as did").select((qb) => qb.fn.count("likes.subjectDid").as("count")).where("likes.subjectDid", "not in", actorsViewerFollows).where("likes.subjectDid", "not in", [params2.actor, params2.viewer]).groupBy("likes.subjectDid").orderBy("count", "desc").limit(RESULT_LENGTH).execute();
137737
138661
  const resultDids = mostLikedAccounts.map((a) => ({ did: a.did }));
137738
138662
  if (resultDids.length < RESULT_LENGTH) {
137739
138663
  const mostPopularAccountsActorFollows = await ctx.db.db.selectFrom("follow").innerJoin("profile_agg", "follow.subjectDid", "profile_agg.did").select("follow.subjectDid as did").where("follow.creator", "=", params2.actor).where("follow.subjectDid", "!=", params2.viewer).where("follow.subjectDid", "not in", actorsViewerFollows).if(resultDids.length > 0, (qb) => qb.where("subjectDid", "not in", resultDids.map((a) => a.did))).orderBy("profile_agg.followersCount", "desc").limit(RESULT_LENGTH).execute();
@@ -137749,17 +138673,17 @@ async function getSkeleton(params2, ctx) {
137749
138673
  // src/services/util/search.ts
137750
138674
  var getUserSearchQuery = (db, opts) => {
137751
138675
  const { ref } = db.db.dynamic;
137752
- const { term, limit, cursor, includeSoftDeleted } = opts;
137753
- const distanceAccount = distance(term, ref("handle"));
137754
- let accountsQb = getMatchingAccountsQb(db, { term, includeSoftDeleted });
138676
+ const { query, limit, cursor, includeSoftDeleted } = opts;
138677
+ const distanceAccount = distance(query, ref("handle"));
138678
+ let accountsQb = getMatchingAccountsQb(db, { query, includeSoftDeleted });
137755
138679
  accountsQb = paginate(accountsQb, {
137756
138680
  limit,
137757
138681
  cursor,
137758
138682
  direction: "asc",
137759
138683
  keyset: new SearchKeyset(distanceAccount, ref("actor.did"))
137760
138684
  });
137761
- const distanceProfile = distance(term, ref("displayName"));
137762
- let profilesQb = getMatchingProfilesQb(db, { term, includeSoftDeleted });
138685
+ const distanceProfile = distance(query, ref("displayName"));
138686
+ let profilesQb = getMatchingProfilesQb(db, { query, includeSoftDeleted });
137763
138687
  profilesQb = paginate(profilesQb, {
137764
138688
  limit,
137765
138689
  cursor,
@@ -137775,9 +138699,9 @@ var getUserSearchQuery = (db, opts) => {
137775
138699
  };
137776
138700
  var getUserSearchQuerySimple = (db, opts) => {
137777
138701
  const { ref } = db.db.dynamic;
137778
- const { term, limit } = opts;
137779
- const accountsQb = getMatchingAccountsQb(db, { term }).orderBy("distance", "asc").limit(limit);
137780
- const profilesQb = getMatchingProfilesQb(db, { term }).orderBy("distance", "asc").limit(limit);
138702
+ const { query, limit } = opts;
138703
+ const accountsQb = getMatchingAccountsQb(db, { query }).orderBy("distance", "asc").limit(limit);
138704
+ const profilesQb = getMatchingProfilesQb(db, { query }).orderBy("distance", "asc").limit(limit);
137781
138705
  return paginate(combineAccountsAndProfilesQb(db, accountsQb, profilesQb), {
137782
138706
  limit,
137783
138707
  direction: "asc",
@@ -137786,24 +138710,24 @@ var getUserSearchQuerySimple = (db, opts) => {
137786
138710
  };
137787
138711
  var getMatchingAccountsQb = (db, opts) => {
137788
138712
  const { ref } = db.db.dynamic;
137789
- const { term, includeSoftDeleted } = opts;
137790
- const distanceAccount = distance(term, ref("handle"));
137791
- return db.db.selectFrom("actor").if(!includeSoftDeleted, (qb) => qb.where(notSoftDeletedClause(ref("actor")))).where("actor.handle", "is not", null).where(similar(term, ref("handle"))).select(["actor.did as did", distanceAccount.as("distance")]);
138713
+ const { query, includeSoftDeleted } = opts;
138714
+ const distanceAccount = distance(query, ref("handle"));
138715
+ return db.db.selectFrom("actor").if(!includeSoftDeleted, (qb) => qb.where(notSoftDeletedClause(ref("actor")))).where("actor.handle", "is not", null).where(similar(query, ref("handle"))).select(["actor.did as did", distanceAccount.as("distance")]);
137792
138716
  };
137793
138717
  var getMatchingProfilesQb = (db, opts) => {
137794
138718
  const { ref } = db.db.dynamic;
137795
- const { term, includeSoftDeleted } = opts;
137796
- const distanceProfile = distance(term, ref("displayName"));
137797
- return db.db.selectFrom("profile").innerJoin("actor", "actor.did", "profile.creator").if(!includeSoftDeleted, (qb) => qb.where(notSoftDeletedClause(ref("actor")))).where("actor.handle", "is not", null).where(similar(term, ref("displayName"))).select(["profile.creator as did", distanceProfile.as("distance")]);
138719
+ const { query, includeSoftDeleted } = opts;
138720
+ const distanceProfile = distance(query, ref("displayName"));
138721
+ return db.db.selectFrom("profile").innerJoin("actor", "actor.did", "profile.creator").if(!includeSoftDeleted, (qb) => qb.where(notSoftDeletedClause(ref("actor")))).where("actor.handle", "is not", null).where(similar(query, ref("displayName"))).select(["profile.creator as did", distanceProfile.as("distance")]);
137798
138722
  };
137799
138723
  var combineAccountsAndProfilesQb = (db, accountsQb, profilesQb) => {
137800
138724
  const emptyQb = db.db.selectFrom("actor").where(sql`1 = 0`).select([sql.literal("").as("did"), sql`0`.as("distance")]);
137801
138725
  const resultsQb = db.db.selectFrom(emptyQb.unionAll(sql`${accountsQb}`).unionAll(sql`${profilesQb}`).as("accounts_and_profiles")).selectAll().distinctOn("did").orderBy("did").orderBy("distance");
137802
138726
  return db.db.selectFrom(resultsQb.as("results")).innerJoin("actor", "actor.did", "results.did");
137803
138727
  };
137804
- var cleanTerm = (term) => term.trim().replace(/^@/g, "");
137805
- var distance = (term, ref) => sql`(${term} <<-> ${ref})`;
137806
- var similar = (term, ref) => sql`(${term} <% ${ref})`;
138728
+ var cleanQuery = (query) => query.trim().replace(/^@/g, "");
138729
+ var distance = (query, ref) => sql`(${query} <<-> ${ref})`;
138730
+ var similar = (query, ref) => sql`(${query} <% ${ref})`;
137807
138731
  var SearchKeyset = class extends GenericKeyset {
137808
138732
  labelResult(result) {
137809
138733
  return {
@@ -137834,21 +138758,41 @@ function searchActors_default(server, ctx) {
137834
138758
  server.app.bsky.actor.searchActors({
137835
138759
  auth: ctx.authOptionalVerifier,
137836
138760
  handler: async ({ auth, params: params2 }) => {
137837
- let { cursor, limit, term: rawTerm, q: rawQ } = params2;
138761
+ const { cursor, limit } = params2;
137838
138762
  const requester = auth.credentials.did;
137839
- if (rawQ) {
137840
- rawTerm = rawQ;
137841
- }
137842
- const term = cleanTerm(rawTerm || "");
138763
+ const rawQuery = params2.q ?? params2.term;
138764
+ const query = cleanQuery(rawQuery || "");
137843
138765
  const db = ctx.db.getReplica("search");
137844
- const results = term ? await getUserSearchQuery(db, { term, limit, cursor }).select("distance").selectAll("actor").execute() : [];
137845
- const keyset = new SearchKeyset(sql``, sql``);
137846
- const actors = await ctx.services.actor(db).views.profilesList(results, requester);
137847
- const filtered = actors.filter((actor) => !actor.viewer?.blocking && !actor.viewer?.blockedBy);
138766
+ let results;
138767
+ let resCursor;
138768
+ if (ctx.searchAgent) {
138769
+ const res = await ctx.searchAgent.api.app.bsky.unspecced.searchActorsSkeleton({
138770
+ q: query,
138771
+ cursor,
138772
+ limit
138773
+ });
138774
+ results = res.data.actors.map((a) => a.did);
138775
+ resCursor = res.data.cursor;
138776
+ } else {
138777
+ const res = query ? await getUserSearchQuery(db, { query, limit, cursor }).select("distance").selectAll("actor").execute() : [];
138778
+ results = res.map((a) => a.did);
138779
+ const keyset = new SearchKeyset(sql``, sql``);
138780
+ resCursor = keyset.packFromResult(res);
138781
+ }
138782
+ const actors = await ctx.services.actor(db).views.profiles(results, requester);
138783
+ const SKIP = [];
138784
+ const filtered = results.flatMap((did2) => {
138785
+ const actor = actors[did2];
138786
+ if (!actor)
138787
+ return SKIP;
138788
+ if (actor.viewer?.blocking || actor.viewer?.blockedBy)
138789
+ return SKIP;
138790
+ return actor;
138791
+ });
137848
138792
  return {
137849
138793
  encoding: "application/json",
137850
138794
  body: {
137851
- cursor: keyset.packFromResult(results),
138795
+ cursor: resCursor,
137852
138796
  actors: filtered
137853
138797
  }
137854
138798
  };
@@ -137861,18 +138805,29 @@ function searchActorsTypeahead_default(server, ctx) {
137861
138805
  server.app.bsky.actor.searchActorsTypeahead({
137862
138806
  auth: ctx.authOptionalVerifier,
137863
138807
  handler: async ({ params: params2, auth }) => {
137864
- let { limit, term: rawTerm, q: rawQ } = params2;
138808
+ const { limit } = params2;
137865
138809
  const requester = auth.credentials.did;
137866
- if (rawQ) {
137867
- rawTerm = rawQ;
137868
- }
137869
- const term = cleanTerm(rawTerm || "");
138810
+ const rawQuery = params2.q ?? params2.term;
138811
+ const query = cleanQuery(rawQuery || "");
137870
138812
  const db = ctx.db.getReplica("search");
137871
- const results = term ? await getUserSearchQuerySimple(db, { term, limit }).selectAll("actor").execute() : [];
138813
+ let results;
138814
+ if (ctx.searchAgent) {
138815
+ const res = await ctx.searchAgent.api.app.bsky.unspecced.searchActorsSkeleton({
138816
+ q: query,
138817
+ typeahead: true,
138818
+ limit
138819
+ });
138820
+ results = res.data.actors.map((a) => a.did);
138821
+ } else {
138822
+ const res = query ? await getUserSearchQuerySimple(db, { query, limit }).selectAll("actor").execute() : [];
138823
+ results = res.map((a) => a.did);
138824
+ }
137872
138825
  const actors = await ctx.services.actor(db).views.profilesBasic(results, requester, { omitLabels: true });
137873
138826
  const SKIP = [];
137874
- const filtered = results.flatMap((res) => {
137875
- const actor = actors[res.did];
138827
+ const filtered = results.flatMap((did2) => {
138828
+ const actor = actors[did2];
138829
+ if (!actor)
138830
+ return SKIP;
137876
138831
  if (actor.viewer?.blocking || actor.viewer?.blockedBy)
137877
138832
  return SKIP;
137878
138833
  return actor;
@@ -138104,23 +139059,20 @@ var skeleton18 = async (params2, ctx) => {
138104
139059
  if (params2.seenAt) {
138105
139060
  throw new InvalidRequestError("The seenAt parameter is unsupported");
138106
139061
  }
138107
- let notifBuilder = db.db.selectFrom("notification as notif").innerJoin("record", "record.uri", "notif.recordUri").innerJoin("actor as author", "author.did", "notif.author").where(notSoftDeletedClause(ref("record"))).where(notSoftDeletedClause(ref("author"))).where("notif.did", "=", viewer).where((clause) => clause.where("reasonSubject", "is", null).orWhereExists(db.db.selectFrom("record as subject").selectAll().whereRef("subject.uri", "=", ref("notif.reasonSubject")))).select([
139062
+ let notifBuilder = db.db.selectFrom("notification as notif").where("notif.did", "=", viewer).where((clause) => clause.where("reasonSubject", "is", null).orWhereExists(db.db.selectFrom("record as subject").selectAll().whereRef("subject.uri", "=", ref("notif.reasonSubject")))).select([
139063
+ "notif.author as authorDid",
138108
139064
  "notif.recordUri as uri",
138109
139065
  "notif.recordCid as cid",
138110
- "author.did as authorDid",
138111
- "author.handle as authorHandle",
138112
- "author.indexedAt as authorIndexedAt",
138113
- "author.takedownId as authorTakedownId",
138114
139066
  "notif.reason as reason",
138115
139067
  "notif.reasonSubject as reasonSubject",
138116
- "notif.sortAt as indexedAt",
138117
- "record.json as recordJson"
139068
+ "notif.sortAt as indexedAt"
138118
139069
  ]);
138119
139070
  const keyset = new NotifsKeyset(ref("notif.sortAt"), ref("notif.recordCid"));
138120
139071
  notifBuilder = paginate(notifBuilder, {
138121
139072
  cursor,
138122
139073
  limit,
138123
- keyset
139074
+ keyset,
139075
+ tryIndex: true
138124
139076
  });
138125
139077
  const actorStateQuery = db.db.selectFrom("actor_state").selectAll().where("did", "=", viewer);
138126
139078
  const [notifs, actorState] = await Promise.all([
@@ -138135,17 +139087,18 @@ var skeleton18 = async (params2, ctx) => {
138135
139087
  };
138136
139088
  };
138137
139089
  var hydration18 = async (state, ctx) => {
138138
- const { graphService, actorService, labelService } = ctx;
139090
+ const { graphService, actorService, labelService, db } = ctx;
138139
139091
  const { params: params2, notifs } = state;
138140
139092
  const { viewer } = params2;
138141
139093
  const dids = notifs.map((notif) => notif.authorDid);
138142
139094
  const uris = notifs.map((notif) => notif.uri);
138143
- const [actors, labels, bam] = await Promise.all([
139095
+ const [actors, records, labels, bam] = await Promise.all([
138144
139096
  actorService.views.profiles(dids, viewer),
139097
+ getRecordMap(db, uris),
138145
139098
  labelService.getLabelsForUris(uris),
138146
139099
  graphService.getBlockAndMuteState(dids.map((did2) => [viewer, did2]))
138147
139100
  ]);
138148
- return { ...state, actors, labels, bam };
139101
+ return { ...state, actors, records, labels, bam };
138149
139102
  };
138150
139103
  var noBlockOrMutes = (state) => {
138151
139104
  const { viewer } = state.params;
@@ -138153,12 +139106,12 @@ var noBlockOrMutes = (state) => {
138153
139106
  return state;
138154
139107
  };
138155
139108
  var presentation18 = (state) => {
138156
- const { notifs, cursor, actors, labels, lastSeenNotifs } = state;
139109
+ const { notifs, cursor, actors, records, labels, lastSeenNotifs } = state;
138157
139110
  const notifications = mapDefined(notifs, (notif) => {
138158
139111
  const author = actors[notif.authorDid];
138159
- if (!author)
139112
+ const record = records[notif.uri];
139113
+ if (!author || !record)
138160
139114
  return void 0;
138161
- const record = jsonStringToLex(notif.recordJson);
138162
139115
  const recordLabels = labels[notif.uri] ?? [];
138163
139116
  const recordSelfLabels = getSelfLabels({
138164
139117
  uri: notif.uri,
@@ -138179,6 +139132,16 @@ var presentation18 = (state) => {
138179
139132
  });
138180
139133
  return { notifications, cursor };
138181
139134
  };
139135
+ var getRecordMap = async (db, uris) => {
139136
+ if (!uris.length)
139137
+ return {};
139138
+ const { ref } = db.db.dynamic;
139139
+ const recordRows = await db.db.selectFrom("record").select(["uri", "json"]).where("uri", "in", uris).where(notSoftDeletedClause(ref("record"))).execute();
139140
+ return recordRows.reduce((acc, { uri: uri2, json }) => {
139141
+ acc[uri2] = jsonStringToLex(json);
139142
+ return acc;
139143
+ }, {});
139144
+ };
138182
139145
  var NotifsKeyset = class extends TimeCidKeyset {
138183
139146
  labelResult(result) {
138184
139147
  return { primary: result.indexedAt, secondary: result.cid };
@@ -138321,6 +139284,12 @@ var TAKEDOWN = "com.atproto.admin.defs#takedown";
138321
139284
  var FLAG = "com.atproto.admin.defs#flag";
138322
139285
  var ACKNOWLEDGE = "com.atproto.admin.defs#acknowledge";
138323
139286
  var ESCALATE = "com.atproto.admin.defs#escalate";
139287
+ function isRepoView(v) {
139288
+ return isObj3(v) && hasProp3(v, "$type") && v.$type === "com.atproto.admin.defs#repoView";
139289
+ }
139290
+ function isRecordView(v) {
139291
+ return isObj3(v) && hasProp3(v, "$type") && v.$type === "com.atproto.admin.defs#recordView";
139292
+ }
138324
139293
 
138325
139294
  // src/lexicon/types/com/atproto/moderation/defs.ts
138326
139295
  var REASONSPAM = "com.atproto.moderation.defs#reasonSpam";
@@ -138414,6 +139383,67 @@ function resolveModerationReports_default(server, ctx) {
138414
139383
  });
138415
139384
  }
138416
139385
 
139386
+ // src/util/retry.ts
139387
+ var import_axios3 = __toESM(require_axios2());
139388
+ async function retry(fn, opts = {}) {
139389
+ const { max = 3, retryable = () => true } = opts;
139390
+ let retries = 0;
139391
+ let doneError;
139392
+ while (!doneError) {
139393
+ try {
139394
+ if (retries)
139395
+ await backoff(retries);
139396
+ return await fn();
139397
+ } catch (err) {
139398
+ const willRetry = retries < max && retryable(err);
139399
+ if (!willRetry)
139400
+ doneError = err;
139401
+ retries += 1;
139402
+ }
139403
+ }
139404
+ throw doneError;
139405
+ }
139406
+ async function retryHttp(fn, opts = {}) {
139407
+ return retry(fn, { retryable: retryableHttp, ...opts });
139408
+ }
139409
+ function retryableHttp(err) {
139410
+ if (err instanceof XRPCError) {
139411
+ if (err.status === 1 /* Unknown */)
139412
+ return true;
139413
+ return retryableHttpStatusCodes.has(err.status);
139414
+ }
139415
+ if (err instanceof import_axios3.AxiosError) {
139416
+ if (!err.response)
139417
+ return true;
139418
+ return retryableHttpStatusCodes.has(err.response.status);
139419
+ }
139420
+ return false;
139421
+ }
139422
+ var retryableHttpStatusCodes = /* @__PURE__ */ new Set([
139423
+ 408,
139424
+ 425,
139425
+ 429,
139426
+ 500,
139427
+ 502,
139428
+ 503,
139429
+ 504,
139430
+ 522,
139431
+ 524
139432
+ ]);
139433
+ async function backoff(n, multiplier = 50, max = 1e3) {
139434
+ const exponentialMs = Math.pow(2, n) * multiplier;
139435
+ const ms = Math.min(exponentialMs, max);
139436
+ await wait(jitter2(ms));
139437
+ }
139438
+ function jitter2(value) {
139439
+ const delta = value * 0.15;
139440
+ return value + randomRange(-delta, delta);
139441
+ }
139442
+ function randomRange(from3, to) {
139443
+ const rand = Math.random() * (to - from3);
139444
+ return rand + from3;
139445
+ }
139446
+
138417
139447
  // src/api/com/atproto/admin/reverseModerationAction.ts
138418
139448
  function reverseModerationAction_default(server, ctx) {
138419
139449
  server.com.atproto.admin.reverseModerationAction({
@@ -138423,7 +139453,7 @@ function reverseModerationAction_default(server, ctx) {
138423
139453
  const db = ctx.db.getPrimary();
138424
139454
  const moderationService = ctx.services.moderation(db);
138425
139455
  const { id, createdBy, reason } = input.body;
138426
- const moderationAction = await db.transaction(async (dbTxn) => {
139456
+ const { result, restored } = await db.transaction(async (dbTxn) => {
138427
139457
  const moderationTxn = ctx.services.moderation(dbTxn);
138428
139458
  const labelTxn = ctx.services.label(dbTxn);
138429
139459
  const now = new Date();
@@ -138440,21 +139470,35 @@ function reverseModerationAction_default(server, ctx) {
138440
139470
  if (!access.moderator && existing.action === TAKEDOWN && existing.subjectType === "com.atproto.admin.defs#repoRef") {
138441
139471
  throw new AuthRequiredError("Must be a full moderator to reverse an account takedown");
138442
139472
  }
138443
- const result = await moderationTxn.revertAction({
139473
+ const { result: result2, restored: restored2 } = await moderationTxn.revertAction({
138444
139474
  id,
138445
139475
  createdAt: now,
138446
139476
  createdBy,
138447
139477
  reason
138448
139478
  });
138449
- const { createLabelVals, negateLabelVals } = result;
139479
+ const { createLabelVals, negateLabelVals } = result2;
138450
139480
  const negate = createLabelVals && createLabelVals.length > 0 ? createLabelVals.split(" ") : void 0;
138451
139481
  const create3 = negateLabelVals && negateLabelVals.length > 0 ? negateLabelVals.split(" ") : void 0;
138452
- await labelTxn.formatAndCreate(ctx.cfg.labelerDid, result.subjectUri ?? result.subjectDid, result.subjectCid, { create: create3, negate });
138453
- return result;
139482
+ await labelTxn.formatAndCreate(ctx.cfg.labelerDid, result2.subjectUri ?? result2.subjectDid, result2.subjectCid, { create: create3, negate });
139483
+ return { result: result2, restored: restored2 };
138454
139484
  });
139485
+ if (restored) {
139486
+ const { did: did2, subjects } = restored;
139487
+ const agent = await ctx.pdsAdminAgent(did2);
139488
+ const results = await Promise.allSettled(subjects.map((subject) => retryHttp(() => agent.api.com.atproto.admin.updateSubjectStatus({
139489
+ subject,
139490
+ takedown: {
139491
+ applied: false
139492
+ }
139493
+ }))));
139494
+ const hadFailure = results.some((r) => r.status === "rejected");
139495
+ if (hadFailure) {
139496
+ throw new UpstreamFailureError("failed to revert action on PDS");
139497
+ }
139498
+ }
138455
139499
  return {
138456
139500
  encoding: "application/json",
138457
- body: await moderationService.views.action(moderationAction)
139501
+ body: await moderationService.views.action(result)
138458
139502
  };
138459
139503
  }
138460
139504
  });
@@ -138488,10 +139532,10 @@ function takeModerationAction_default(server, ctx) {
138488
139532
  throw new AuthRequiredError("Must be a full moderator to label content");
138489
139533
  }
138490
139534
  validateLabels([...createLabelVals ?? [], ...negateLabelVals ?? []]);
138491
- const moderationAction = await db.transaction(async (dbTxn) => {
139535
+ const { result, takenDown } = await db.transaction(async (dbTxn) => {
138492
139536
  const moderationTxn = ctx.services.moderation(dbTxn);
138493
139537
  const labelTxn = ctx.services.label(dbTxn);
138494
- const result = await moderationTxn.logAction({
139538
+ const result2 = await moderationTxn.logAction({
138495
139539
  action: getAction(action),
138496
139540
  subject: getSubject(subject),
138497
139541
  subjectBlobCids: subjectBlobCids?.map((cid2) => CID.parse(cid2)) ?? [],
@@ -138501,25 +139545,44 @@ function takeModerationAction_default(server, ctx) {
138501
139545
  reason,
138502
139546
  durationInHours
138503
139547
  });
138504
- if (result.action === TAKEDOWN && result.subjectType === "com.atproto.admin.defs#repoRef" && result.subjectDid) {
138505
- await moderationTxn.takedownRepo({
138506
- takedownId: result.id,
138507
- did: result.subjectDid
139548
+ let takenDown2;
139549
+ if (result2.action === TAKEDOWN && result2.subjectType === "com.atproto.admin.defs#repoRef" && result2.subjectDid) {
139550
+ takenDown2 = await moderationTxn.takedownRepo({
139551
+ takedownId: result2.id,
139552
+ did: result2.subjectDid
138508
139553
  });
138509
139554
  }
138510
- if (result.action === TAKEDOWN && result.subjectType === "com.atproto.repo.strongRef" && result.subjectUri) {
138511
- await moderationTxn.takedownRecord({
138512
- takedownId: result.id,
138513
- uri: new AtUri(result.subjectUri),
139555
+ if (result2.action === TAKEDOWN && result2.subjectType === "com.atproto.repo.strongRef" && result2.subjectUri && result2.subjectCid) {
139556
+ takenDown2 = await moderationTxn.takedownRecord({
139557
+ takedownId: result2.id,
139558
+ uri: new AtUri(result2.subjectUri),
139559
+ cid: CID.parse(result2.subjectCid),
138514
139560
  blobCids: subjectBlobCids?.map((cid2) => CID.parse(cid2)) ?? []
138515
139561
  });
138516
139562
  }
138517
- await labelTxn.formatAndCreate(ctx.cfg.labelerDid, result.subjectUri ?? result.subjectDid, result.subjectCid, { create: createLabelVals, negate: negateLabelVals });
138518
- return result;
139563
+ await labelTxn.formatAndCreate(ctx.cfg.labelerDid, result2.subjectUri ?? result2.subjectDid, result2.subjectCid, { create: createLabelVals, negate: negateLabelVals });
139564
+ return { result: result2, takenDown: takenDown2 };
138519
139565
  });
139566
+ if (takenDown) {
139567
+ const { did: did2, subjects } = takenDown;
139568
+ if (did2 && subjects.length > 0) {
139569
+ const agent = await ctx.pdsAdminAgent(did2);
139570
+ const results = await Promise.allSettled(subjects.map((subject2) => retryHttp(() => agent.api.com.atproto.admin.updateSubjectStatus({
139571
+ subject: subject2,
139572
+ takedown: {
139573
+ applied: true,
139574
+ ref: result.id.toString()
139575
+ }
139576
+ }))));
139577
+ const hadFailure = results.some((r) => r.status === "rejected");
139578
+ if (hadFailure) {
139579
+ throw new UpstreamFailureError("failed to apply action on PDS");
139580
+ }
139581
+ }
139582
+ }
138520
139583
  return {
138521
139584
  encoding: "application/json",
138522
- body: await moderationService.views.action(moderationAction)
139585
+ body: await moderationService.views.action(result)
138523
139586
  };
138524
139587
  }
138525
139588
  });
@@ -138542,19 +139605,13 @@ function searchRepos_default(server, ctx) {
138542
139605
  handler: async ({ params: params2 }) => {
138543
139606
  const db = ctx.db.getPrimary();
138544
139607
  const moderationService = ctx.services.moderation(db);
138545
- const { invitedBy } = params2;
138546
- if (invitedBy) {
138547
- throw new InvalidRequestError("The invitedBy parameter is unsupported");
138548
- }
138549
- const { q } = params2;
138550
- if (q) {
138551
- params2.term = q;
138552
- }
138553
- const { results, cursor } = await ctx.services.actor(db).getSearchResults({ ...params2, includeSoftDeleted: true });
139608
+ const { limit, cursor } = params2;
139609
+ const query = params2.q ?? params2.term;
139610
+ const { results, cursor: resCursor } = await ctx.services.actor(db).getSearchResults({ query, limit, cursor, includeSoftDeleted: true });
138554
139611
  return {
138555
139612
  encoding: "application/json",
138556
139613
  body: {
138557
- cursor,
139614
+ cursor: resCursor,
138558
139615
  repos: await moderationService.views.repo(results)
138559
139616
  }
138560
139617
  };
@@ -138562,20 +139619,59 @@ function searchRepos_default(server, ctx) {
138562
139619
  });
138563
139620
  }
138564
139621
 
139622
+ // src/api/com/atproto/admin/util.ts
139623
+ var getPdsAccountInfo = async (ctx, did2) => {
139624
+ try {
139625
+ const agent = await ctx.pdsAdminAgent(did2);
139626
+ const res = await agent.api.com.atproto.admin.getAccountInfo({ did: did2 });
139627
+ return res.data;
139628
+ } catch (err) {
139629
+ return null;
139630
+ }
139631
+ };
139632
+ var addAccountInfoToRepoViewDetail = (repoView, accountInfo, includeEmail = false) => {
139633
+ if (!accountInfo)
139634
+ return repoView;
139635
+ return {
139636
+ ...repoView,
139637
+ email: includeEmail ? accountInfo.email : void 0,
139638
+ invitedBy: accountInfo.invitedBy,
139639
+ invitesDisabled: accountInfo.invitesDisabled,
139640
+ inviteNote: accountInfo.inviteNote,
139641
+ invites: accountInfo.invites
139642
+ };
139643
+ };
139644
+ var addAccountInfoToRepoView = (repoView, accountInfo, includeEmail = false) => {
139645
+ if (!accountInfo)
139646
+ return repoView;
139647
+ return {
139648
+ ...repoView,
139649
+ email: includeEmail ? accountInfo.email : void 0,
139650
+ invitedBy: accountInfo.invitedBy,
139651
+ invitesDisabled: accountInfo.invitesDisabled,
139652
+ inviteNote: accountInfo.inviteNote
139653
+ };
139654
+ };
139655
+
138565
139656
  // src/api/com/atproto/admin/getRecord.ts
138566
139657
  function getRecord_default(server, ctx) {
138567
139658
  server.com.atproto.admin.getRecord({
138568
139659
  auth: ctx.roleVerifier,
138569
- handler: async ({ params: params2 }) => {
139660
+ handler: async ({ params: params2, auth }) => {
138570
139661
  const { uri: uri2, cid: cid2 } = params2;
138571
139662
  const db = ctx.db.getPrimary();
138572
139663
  const result = await db.db.selectFrom("record").selectAll().where("uri", "=", uri2).if(!!cid2, (qb) => qb.where("cid", "=", cid2 ?? "")).executeTakeFirst();
138573
139664
  if (!result) {
138574
139665
  throw new InvalidRequestError("Record not found", "RecordNotFound");
138575
139666
  }
139667
+ const [record, accountInfo] = await Promise.all([
139668
+ ctx.services.moderation(db).views.recordDetail(result),
139669
+ getPdsAccountInfo(ctx, result.did)
139670
+ ]);
139671
+ record.repo = addAccountInfoToRepoView(record.repo, accountInfo, auth.credentials.moderator);
138576
139672
  return {
138577
139673
  encoding: "application/json",
138578
- body: await ctx.services.moderation(db).views.recordDetail(result)
139674
+ body: record
138579
139675
  };
138580
139676
  }
138581
139677
  });
@@ -138585,16 +139681,21 @@ function getRecord_default(server, ctx) {
138585
139681
  function getRepo_default(server, ctx) {
138586
139682
  server.com.atproto.admin.getRepo({
138587
139683
  auth: ctx.roleVerifier,
138588
- handler: async ({ params: params2 }) => {
139684
+ handler: async ({ params: params2, auth }) => {
138589
139685
  const { did: did2 } = params2;
138590
139686
  const db = ctx.db.getPrimary();
138591
139687
  const result = await ctx.services.actor(db).getActor(did2, true);
138592
139688
  if (!result) {
138593
139689
  throw new InvalidRequestError("Repo not found", "RepoNotFound");
138594
139690
  }
139691
+ const [partialRepo, accountInfo] = await Promise.all([
139692
+ ctx.services.moderation(db).views.repoDetail(result),
139693
+ getPdsAccountInfo(ctx, result.did)
139694
+ ]);
139695
+ const repo = addAccountInfoToRepoViewDetail(partialRepo, accountInfo, auth.credentials.moderator);
138595
139696
  return {
138596
139697
  encoding: "application/json",
138597
- body: await ctx.services.moderation(db).views.repoDetail(result)
139698
+ body: repo
138598
139699
  };
138599
139700
  }
138600
139701
  });
@@ -138604,14 +139705,23 @@ function getRepo_default(server, ctx) {
138604
139705
  function getModerationAction_default(server, ctx) {
138605
139706
  server.com.atproto.admin.getModerationAction({
138606
139707
  auth: ctx.roleVerifier,
138607
- handler: async ({ params: params2 }) => {
139708
+ handler: async ({ params: params2, auth }) => {
138608
139709
  const { id } = params2;
138609
139710
  const db = ctx.db.getPrimary();
138610
139711
  const moderationService = ctx.services.moderation(db);
138611
139712
  const result = await moderationService.getActionOrThrow(id);
139713
+ const [action, accountInfo] = await Promise.all([
139714
+ moderationService.views.actionDetail(result),
139715
+ getPdsAccountInfo(ctx, result.subjectDid)
139716
+ ]);
139717
+ if (isRepoView(action.subject)) {
139718
+ action.subject = addAccountInfoToRepoView(action.subject, accountInfo, auth.credentials.moderator);
139719
+ } else if (isRecordView(action.subject)) {
139720
+ action.subject.repo = addAccountInfoToRepoView(action.subject.repo, accountInfo, auth.credentials.moderator);
139721
+ }
138612
139722
  return {
138613
139723
  encoding: "application/json",
138614
- body: await moderationService.views.actionDetail(result)
139724
+ body: action
138615
139725
  };
138616
139726
  }
138617
139727
  });
@@ -138645,14 +139755,23 @@ function getModerationActions_default(server, ctx) {
138645
139755
  function getModerationReport_default(server, ctx) {
138646
139756
  server.com.atproto.admin.getModerationReport({
138647
139757
  auth: ctx.roleVerifier,
138648
- handler: async ({ params: params2 }) => {
139758
+ handler: async ({ params: params2, auth }) => {
138649
139759
  const { id } = params2;
138650
139760
  const db = ctx.db.getPrimary();
138651
139761
  const moderationService = ctx.services.moderation(db);
138652
139762
  const result = await moderationService.getReportOrThrow(id);
139763
+ const [report, accountInfo] = await Promise.all([
139764
+ moderationService.views.reportDetail(result),
139765
+ getPdsAccountInfo(ctx, result.subjectDid)
139766
+ ]);
139767
+ if (isRepoView(report.subject)) {
139768
+ report.subject = addAccountInfoToRepoView(report.subject, accountInfo, auth.credentials.moderator);
139769
+ } else if (isRecordView(report.subject)) {
139770
+ report.subject.repo = addAccountInfoToRepoView(report.subject.repo, accountInfo, auth.credentials.moderator);
139771
+ }
138653
139772
  return {
138654
139773
  encoding: "application/json",
138655
- body: await moderationService.views.reportDetail(result)
139774
+ body: report
138656
139775
  };
138657
139776
  }
138658
139777
  });
@@ -138791,6 +139910,14 @@ var createRouter2 = (ctx) => {
138791
139910
  res.json({
138792
139911
  "@context": ["https://www.w3.org/ns/did/v1"],
138793
139912
  id: ctx.cfg.serverDid,
139913
+ verificationMethod: [
139914
+ {
139915
+ id: `${ctx.cfg.serverDid}#atproto`,
139916
+ type: "Multikey",
139917
+ controller: ctx.cfg.serverDid,
139918
+ publicKeyMultibase: ctx.signingKey.did().replace("did:key:", "")
139919
+ }
139920
+ ],
138794
139921
  service: [
138795
139922
  {
138796
139923
  id: "#bsky_notif",
@@ -138821,69 +139948,16 @@ var subLogger = subsystemLogger("bsky:sub");
138821
139948
  var labelerLogger = subsystemLogger("bsky:labeler");
138822
139949
  var httpLogger = subsystemLogger("bsky");
138823
139950
  var loggerMiddleware = (0, import_pino_http.default)({
138824
- logger: httpLogger
138825
- });
138826
-
138827
- // src/util/retry.ts
138828
- var import_axios3 = __toESM(require_axios2());
138829
- async function retry(fn, opts = {}) {
138830
- const { max = 3, retryable = () => true } = opts;
138831
- let retries = 0;
138832
- let doneError;
138833
- while (!doneError) {
138834
- try {
138835
- if (retries)
138836
- await backoff(retries);
138837
- return await fn();
138838
- } catch (err) {
138839
- const willRetry = retries < max && retryable(err);
138840
- if (!willRetry)
138841
- doneError = err;
138842
- retries += 1;
139951
+ logger: httpLogger,
139952
+ serializers: {
139953
+ err: (err) => {
139954
+ return {
139955
+ code: err?.code,
139956
+ message: err?.message
139957
+ };
138843
139958
  }
138844
139959
  }
138845
- throw doneError;
138846
- }
138847
- async function retryHttp(fn, opts = {}) {
138848
- return retry(fn, { retryable: retryableHttp, ...opts });
138849
- }
138850
- function retryableHttp(err) {
138851
- if (err instanceof XRPCError) {
138852
- if (err.status === 1 /* Unknown */)
138853
- return true;
138854
- return retryableHttpStatusCodes.has(err.status);
138855
- }
138856
- if (err instanceof import_axios3.AxiosError) {
138857
- if (!err.response)
138858
- return true;
138859
- return retryableHttpStatusCodes.has(err.response.status);
138860
- }
138861
- return false;
138862
- }
138863
- var retryableHttpStatusCodes = /* @__PURE__ */ new Set([
138864
- 408,
138865
- 425,
138866
- 429,
138867
- 500,
138868
- 502,
138869
- 503,
138870
- 504,
138871
- 522,
138872
- 524
138873
- ]);
138874
- async function backoff(n, multiplier = 50, max = 1e3) {
138875
- const exponentialMs = Math.pow(2, n) * multiplier;
138876
- const ms = Math.min(exponentialMs, max);
138877
- await wait(jitter2(ms));
138878
- }
138879
- function jitter2(value) {
138880
- const delta = value * 0.15;
138881
- return value + randomRange(-delta, delta);
138882
- }
138883
- function randomRange(from3, to) {
138884
- const rand = Math.random() * (to - from3);
138885
- return rand + from3;
138886
- }
139960
+ });
138887
139961
 
138888
139962
  // src/api/blob-resolver.ts
138889
139963
  var createRouter3 = (ctx) => {
@@ -139074,6 +140148,10 @@ var AdminNS2 = class {
139074
140148
  const nsid2 = "com.atproto.admin.enableAccountInvites";
139075
140149
  return this._server.xrpc.method(nsid2, cfg);
139076
140150
  }
140151
+ getAccountInfo(cfg) {
140152
+ const nsid2 = "com.atproto.admin.getAccountInfo";
140153
+ return this._server.xrpc.method(nsid2, cfg);
140154
+ }
139077
140155
  getInviteCodes(cfg) {
139078
140156
  const nsid2 = "com.atproto.admin.getInviteCodes";
139079
140157
  return this._server.xrpc.method(nsid2, cfg);
@@ -139102,6 +140180,10 @@ var AdminNS2 = class {
139102
140180
  const nsid2 = "com.atproto.admin.getRepo";
139103
140181
  return this._server.xrpc.method(nsid2, cfg);
139104
140182
  }
140183
+ getSubjectStatus(cfg) {
140184
+ const nsid2 = "com.atproto.admin.getSubjectStatus";
140185
+ return this._server.xrpc.method(nsid2, cfg);
140186
+ }
139105
140187
  resolveModerationReports(cfg) {
139106
140188
  const nsid2 = "com.atproto.admin.resolveModerationReports";
139107
140189
  return this._server.xrpc.method(nsid2, cfg);
@@ -139130,6 +140212,10 @@ var AdminNS2 = class {
139130
140212
  const nsid2 = "com.atproto.admin.updateAccountHandle";
139131
140213
  return this._server.xrpc.method(nsid2, cfg);
139132
140214
  }
140215
+ updateSubjectStatus(cfg) {
140216
+ const nsid2 = "com.atproto.admin.updateSubjectStatus";
140217
+ return this._server.xrpc.method(nsid2, cfg);
140218
+ }
139133
140219
  };
139134
140220
  var IdentityNS2 = class {
139135
140221
  constructor(server) {
@@ -139207,6 +140293,10 @@ var ServerNS2 = class {
139207
140293
  constructor(server) {
139208
140294
  this._server = server;
139209
140295
  }
140296
+ confirmEmail(cfg) {
140297
+ const nsid2 = "com.atproto.server.confirmEmail";
140298
+ return this._server.xrpc.method(nsid2, cfg);
140299
+ }
139210
140300
  createAccount(cfg) {
139211
140301
  const nsid2 = "com.atproto.server.createAccount";
139212
140302
  return this._server.xrpc.method(nsid2, cfg);
@@ -139259,10 +140349,22 @@ var ServerNS2 = class {
139259
140349
  const nsid2 = "com.atproto.server.requestAccountDelete";
139260
140350
  return this._server.xrpc.method(nsid2, cfg);
139261
140351
  }
140352
+ requestEmailConfirmation(cfg) {
140353
+ const nsid2 = "com.atproto.server.requestEmailConfirmation";
140354
+ return this._server.xrpc.method(nsid2, cfg);
140355
+ }
140356
+ requestEmailUpdate(cfg) {
140357
+ const nsid2 = "com.atproto.server.requestEmailUpdate";
140358
+ return this._server.xrpc.method(nsid2, cfg);
140359
+ }
139262
140360
  requestPasswordReset(cfg) {
139263
140361
  const nsid2 = "com.atproto.server.requestPasswordReset";
139264
140362
  return this._server.xrpc.method(nsid2, cfg);
139265
140363
  }
140364
+ reserveSigningKey(cfg) {
140365
+ const nsid2 = "com.atproto.server.reserveSigningKey";
140366
+ return this._server.xrpc.method(nsid2, cfg);
140367
+ }
139266
140368
  resetPassword(cfg) {
139267
140369
  const nsid2 = "com.atproto.server.resetPassword";
139268
140370
  return this._server.xrpc.method(nsid2, cfg);
@@ -139271,6 +140373,10 @@ var ServerNS2 = class {
139271
140373
  const nsid2 = "com.atproto.server.revokeAppPassword";
139272
140374
  return this._server.xrpc.method(nsid2, cfg);
139273
140375
  }
140376
+ updateEmail(cfg) {
140377
+ const nsid2 = "com.atproto.server.updateEmail";
140378
+ return this._server.xrpc.method(nsid2, cfg);
140379
+ }
139274
140380
  };
139275
140381
  var SyncNS2 = class {
139276
140382
  constructor(server) {
@@ -139965,7 +141071,7 @@ var UnexpectedObjectError = class extends Error {
139965
141071
 
139966
141072
  // ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/reader.js
139967
141073
  var import_fs = __toESM(require("fs"), 1);
139968
- var import_util77 = require("util");
141074
+ var import_util81 = require("util");
139969
141075
 
139970
141076
  // ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/decoder.js
139971
141077
  var import_varint2 = __toESM(require_varint(), 1);
@@ -140230,7 +141336,7 @@ async function decodeReaderComplete(reader) {
140230
141336
  }
140231
141337
 
140232
141338
  // ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/reader.js
140233
- var fsread = (0, import_util77.promisify)(import_fs.default.read);
141339
+ var fsread = (0, import_util81.promisify)(import_fs.default.read);
140234
141340
  var CarReader2 = class extends CarReader {
140235
141341
  static async readRaw(fd, blockIndex) {
140236
141342
  const { cid: cid2, blockLength, blockOffset } = blockIndex;
@@ -140255,7 +141361,7 @@ var CarReader2 = class extends CarReader {
140255
141361
 
140256
141362
  // ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/writer.js
140257
141363
  var import_fs2 = __toESM(require("fs"), 1);
140258
- var import_util78 = require("util");
141364
+ var import_util82 = require("util");
140259
141365
 
140260
141366
  // ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/encoder.js
140261
141367
  var import_varint3 = __toESM(require_varint(), 1);
@@ -140275,8 +141381,8 @@ var CarWriterOut = class {
140275
141381
  };
140276
141382
 
140277
141383
  // ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/writer.js
140278
- var fsread2 = (0, import_util78.promisify)(import_fs2.default.read);
140279
- var fswrite = (0, import_util78.promisify)(import_fs2.default.write);
141384
+ var fsread2 = (0, import_util82.promisify)(import_fs2.default.read);
141385
+ var fswrite = (0, import_util82.promisify)(import_fs2.default.write);
140280
141386
 
140281
141387
  // ../repo/src/util.ts
140282
141388
  async function* verifyIncomingCarBlocks(car) {
@@ -140290,7 +141396,7 @@ var readCar = async (bytes3) => {
140290
141396
  const roots = await car.getRoots();
140291
141397
  const blocks = new block_map_default();
140292
141398
  for await (const block of verifyIncomingCarBlocks(car.blocks())) {
140293
- await blocks.set(block.cid, block.bytes);
141399
+ blocks.set(block.cid, block.bytes);
140294
141400
  }
140295
141401
  return {
140296
141402
  roots,
@@ -141803,27 +142909,43 @@ var BlockAndMuteState = class {
141803
142909
  constructor(items = []) {
141804
142910
  this.hasIdx = /* @__PURE__ */ new Map();
141805
142911
  this.blockIdx = /* @__PURE__ */ new Map();
142912
+ this.blockListIdx = /* @__PURE__ */ new Map();
141806
142913
  this.muteIdx = /* @__PURE__ */ new Map();
141807
142914
  this.muteListIdx = /* @__PURE__ */ new Map();
141808
142915
  items.forEach((item) => this.add(item));
141809
142916
  }
141810
142917
  add(item) {
141811
- const blocking = item.blocking || item.blockingViaList;
141812
- if (blocking) {
142918
+ if (item.source === item.target) {
142919
+ return;
142920
+ }
142921
+ if (item.blocking) {
141813
142922
  const map = this.blockIdx.get(item.source) ?? /* @__PURE__ */ new Map();
141814
- map.set(item.target, blocking);
142923
+ map.set(item.target, item.blocking);
141815
142924
  if (!this.blockIdx.has(item.source)) {
141816
142925
  this.blockIdx.set(item.source, map);
141817
142926
  }
141818
142927
  }
141819
- const blockedBy = item.blockedBy || item.blockedByViaList;
141820
- if (blockedBy) {
142928
+ if (item.blockingViaList) {
142929
+ const map = this.blockListIdx.get(item.source) ?? /* @__PURE__ */ new Map();
142930
+ map.set(item.target, item.blockingViaList);
142931
+ if (!this.blockListIdx.has(item.source)) {
142932
+ this.blockListIdx.set(item.source, map);
142933
+ }
142934
+ }
142935
+ if (item.blockedBy) {
141821
142936
  const map = this.blockIdx.get(item.target) ?? /* @__PURE__ */ new Map();
141822
- map.set(item.source, blockedBy);
142937
+ map.set(item.source, item.blockedBy);
141823
142938
  if (!this.blockIdx.has(item.target)) {
141824
142939
  this.blockIdx.set(item.target, map);
141825
142940
  }
141826
142941
  }
142942
+ if (item.blockedByViaList) {
142943
+ const map = this.blockListIdx.get(item.target) ?? /* @__PURE__ */ new Map();
142944
+ map.set(item.source, item.blockedByViaList);
142945
+ if (!this.blockListIdx.has(item.target)) {
142946
+ this.blockListIdx.set(item.target, map);
142947
+ }
142948
+ }
141827
142949
  if (item.muting) {
141828
142950
  const set2 = this.muteIdx.get(item.source) ?? /* @__PURE__ */ new Set();
141829
142951
  set2.add(item.target);
@@ -141848,7 +142970,7 @@ var BlockAndMuteState = class {
141848
142970
  return !!this.blocking(pair) || !!this.blockedBy(pair);
141849
142971
  }
141850
142972
  blocking(pair) {
141851
- return this.blockIdx.get(pair[0])?.get(pair[1]) ?? null;
142973
+ return this.blockIdx.get(pair[0])?.get(pair[1]) ?? this.blockList(pair);
141852
142974
  }
141853
142975
  blockedBy(pair) {
141854
142976
  return this.blocking([pair[1], pair[0]]);
@@ -141856,6 +142978,9 @@ var BlockAndMuteState = class {
141856
142978
  mute(pair) {
141857
142979
  return !!this.muteIdx.get(pair[0])?.has(pair[1]) || !!this.muteList(pair);
141858
142980
  }
142981
+ blockList(pair) {
142982
+ return this.blockListIdx.get(pair[0])?.get(pair[1]) ?? null;
142983
+ }
141859
142984
  muteList(pair) {
141860
142985
  return this.muteListIdx.get(pair[0])?.get(pair[1]) ?? null;
141861
142986
  }
@@ -141939,11 +143064,15 @@ var ActorViews = class {
141939
143064
  this.services.graph.getBlockAndMuteState(viewer ? dids.map((did2) => [viewer, did2]) : [], state?.bam)
141940
143065
  ]);
141941
143066
  const listUris = mapDefined(profiles, ({ did: did2 }) => {
141942
- const list = viewer && bam.muteList([viewer, did2]);
141943
- if (!list)
141944
- return;
141945
- return list;
141946
- });
143067
+ const muteList = viewer && bam.muteList([viewer, did2]);
143068
+ const blockList = viewer && bam.blockList([viewer, did2]);
143069
+ const lists2 = [];
143070
+ if (muteList)
143071
+ lists2.push(muteList);
143072
+ if (blockList)
143073
+ lists2.push(blockList);
143074
+ return lists2;
143075
+ }).flat();
141947
143076
  const lists = await this.services.graph.getListViews(listUris, viewer);
141948
143077
  return { profilesDetailed: toMapByDid(profiles), labels, bam, lists };
141949
143078
  }
@@ -141958,6 +143087,8 @@ var ActorViews = class {
141958
143087
  const banner = prof?.bannerCid ? this.imgUriBuilder.getPresetUri("banner", prof.did, prof.bannerCid) : void 0;
141959
143088
  const mutedByListUri = viewer && bam.muteList([viewer, did2]);
141960
143089
  const mutedByList = mutedByListUri && lists[mutedByListUri] ? this.services.graph.formatListViewBasic(lists[mutedByListUri]) : void 0;
143090
+ const blockingByListUri = viewer && bam.blockList([viewer, did2]);
143091
+ const blockingByList = blockingByListUri && lists[blockingByListUri] ? this.services.graph.formatListViewBasic(lists[blockingByListUri]) : void 0;
141961
143092
  const actorLabels = labels[did2] ?? [];
141962
143093
  const selfLabels = getSelfLabels({
141963
143094
  uri: prof.profileUri,
@@ -141980,6 +143111,7 @@ var ActorViews = class {
141980
143111
  mutedByList,
141981
143112
  blockedBy: !!bam.blockedBy([viewer, did2]),
141982
143113
  blocking: bam.blocking([viewer, did2]) ?? void 0,
143114
+ blockingByList,
141983
143115
  following: prof?.viewerFollowing && !bam.block([viewer, did2]) ? prof.viewerFollowing : void 0,
141984
143116
  followedBy: prof?.viewerFollowedBy && !bam.block([viewer, did2]) ? prof.viewerFollowedBy : void 0
141985
143117
  } : void 0,
@@ -142010,11 +143142,15 @@ var ActorViews = class {
142010
143142
  this.services.graph.getBlockAndMuteState(viewer ? dids.map((did2) => [viewer, did2]) : [], state?.bam)
142011
143143
  ]);
142012
143144
  const listUris = mapDefined(profiles, ({ did: did2 }) => {
142013
- const list = viewer && bam.muteList([viewer, did2]);
142014
- if (!list)
142015
- return;
142016
- return list;
142017
- });
143145
+ const muteList = viewer && bam.muteList([viewer, did2]);
143146
+ const blockList = viewer && bam.blockList([viewer, did2]);
143147
+ const lists2 = [];
143148
+ if (muteList)
143149
+ lists2.push(muteList);
143150
+ if (blockList)
143151
+ lists2.push(blockList);
143152
+ return lists2;
143153
+ }).flat();
142018
143154
  const lists = await this.services.graph.getListViews(listUris, viewer);
142019
143155
  return { profiles: toMapByDid(profiles), labels, bam, lists };
142020
143156
  }
@@ -142028,6 +143164,8 @@ var ActorViews = class {
142028
143164
  const avatar = prof?.avatarCid ? this.imgUriBuilder.getPresetUri("avatar", prof.did, prof.avatarCid) : void 0;
142029
143165
  const mutedByListUri = viewer && bam.muteList([viewer, did2]);
142030
143166
  const mutedByList = mutedByListUri && lists[mutedByListUri] ? this.services.graph.formatListViewBasic(lists[mutedByListUri]) : void 0;
143167
+ const blockingByListUri = viewer && bam.blockList([viewer, did2]);
143168
+ const blockingByList = blockingByListUri && lists[blockingByListUri] ? this.services.graph.formatListViewBasic(lists[blockingByListUri]) : void 0;
142031
143169
  const actorLabels = labels[did2] ?? [];
142032
143170
  const selfLabels = getSelfLabels({
142033
143171
  uri: prof.profileUri,
@@ -142046,6 +143184,7 @@ var ActorViews = class {
142046
143184
  mutedByList,
142047
143185
  blockedBy: !!bam.blockedBy([viewer, did2]),
142048
143186
  blocking: bam.blocking([viewer, did2]) ?? void 0,
143187
+ blockingByList,
142049
143188
  following: prof?.viewerFollowing && !bam.block([viewer, did2]) ? prof.viewerFollowing : void 0,
142050
143189
  followedBy: prof?.viewerFollowedBy && !bam.block([viewer, did2]) ? prof.viewerFollowedBy : void 0
142051
143190
  } : void 0,
@@ -142112,7 +143251,7 @@ var ActorService = class {
142112
143251
  qb = qb.orWhere("actor.did", "in", dids);
142113
143252
  }
142114
143253
  if (handles.length) {
142115
- qb = qb.orWhere("actor.handle", "in", handles);
143254
+ qb = qb.orWhere("actor.handle", "in", handles.length === 1 ? [handles[0], handles[0]] : handles);
142116
143255
  }
142117
143256
  return qb;
142118
143257
  }).selectAll().execute();
@@ -142125,10 +143264,10 @@ var ActorService = class {
142125
143264
  async getSearchResults({
142126
143265
  cursor,
142127
143266
  limit = 25,
142128
- term = "",
143267
+ query = "",
142129
143268
  includeSoftDeleted
142130
143269
  }) {
142131
- const searchField = term.startsWith("did:") ? "did" : "handle";
143270
+ const searchField = query.startsWith("did:") ? "did" : "handle";
142132
143271
  let paginatedBuilder;
142133
143272
  const { ref } = this.db.db.dynamic;
142134
143273
  const paginationOptions = {
@@ -142137,18 +143276,18 @@ var ActorService = class {
142137
143276
  direction: "asc"
142138
143277
  };
142139
143278
  let keyset;
142140
- if (term && searchField === "handle") {
143279
+ if (query && searchField === "handle") {
142141
143280
  keyset = new SearchKeyset(sql``, sql``);
142142
143281
  paginatedBuilder = getUserSearchQuery(this.db, {
142143
- term,
143282
+ query,
142144
143283
  includeSoftDeleted,
142145
143284
  ...paginationOptions
142146
143285
  }).select("distance");
142147
143286
  } else {
142148
143287
  paginatedBuilder = this.db.db.selectFrom("actor").select([sql`0`.as("distance")]);
142149
143288
  keyset = new ListKeyset(ref("indexedAt"), ref("did"));
142150
- if (term && searchField === "did") {
142151
- paginatedBuilder = paginatedBuilder.where("actor.did", "=", term);
143289
+ if (query && searchField === "did") {
143290
+ paginatedBuilder = paginatedBuilder.where("actor.did", "=", query);
142152
143291
  }
142153
143292
  paginatedBuilder = paginate(paginatedBuilder, {
142154
143293
  keyset,
@@ -142854,7 +143993,7 @@ var ModerationViews = class {
142854
143993
  async recordDetail(result) {
142855
143994
  const [record, reportResults, actionResults] = await Promise.all([
142856
143995
  this.record(result),
142857
- this.db.db.selectFrom("moderation_report").where("subjectType", "=", "com.atproto.repo.strongRef").where("subjectUri", "=", result.uri).orderBy("id", "desc").selectAll().execute(),
143996
+ this.db.db.selectFrom("moderation_report").where("subjectType", "=", "com.atproto.repo.strongRef").where("subjectUri", "=", result.uri).leftJoin("actor", "actor.did", "moderation_report.subjectDid").orderBy("id", "desc").selectAll().execute(),
142858
143997
  this.db.db.selectFrom("moderation_action").where("subjectType", "=", "com.atproto.repo.strongRef").where("subjectUri", "=", result.uri).orderBy("id", "desc").selectAll().execute()
142859
143998
  ]);
142860
143999
  const [reports, actions, blobs, labels] = await Promise.all([
@@ -143299,17 +144438,46 @@ var ModerationService = class {
143299
144438
  createdBy,
143300
144439
  reason
143301
144440
  });
144441
+ let restored;
143302
144442
  if (result.action === TAKEDOWN && result.subjectType === "com.atproto.admin.defs#repoRef" && result.subjectDid) {
143303
144443
  await this.reverseTakedownRepo({
143304
144444
  did: result.subjectDid
143305
144445
  });
144446
+ restored = {
144447
+ did: result.subjectDid,
144448
+ subjects: [
144449
+ {
144450
+ $type: "com.atproto.admin.defs#repoRef",
144451
+ did: result.subjectDid
144452
+ }
144453
+ ]
144454
+ };
143306
144455
  }
143307
144456
  if (result.action === TAKEDOWN && result.subjectType === "com.atproto.repo.strongRef" && result.subjectUri) {
144457
+ const uri2 = new AtUri(result.subjectUri);
143308
144458
  await this.reverseTakedownRecord({
143309
- uri: new AtUri(result.subjectUri)
144459
+ uri: uri2
143310
144460
  });
144461
+ const did2 = uri2.hostname;
144462
+ const actionBlobs = await this.db.db.selectFrom("moderation_action_subject_blob").where("actionId", "=", id).select("cid").execute();
144463
+ restored = {
144464
+ did: did2,
144465
+ subjects: [
144466
+ {
144467
+ $type: "com.atproto.repo.strongRef",
144468
+ uri: result.subjectUri,
144469
+ cid: result.subjectCid ?? ""
144470
+ },
144471
+ ...actionBlobs.map((row) => ({
144472
+ $type: "com.atproto.admin.defs#repoBlobRef",
144473
+ did: did2,
144474
+ cid: row.cid,
144475
+ recordUri: result.subjectUri
144476
+ }))
144477
+ ]
144478
+ };
143311
144479
  }
143312
- return result;
144480
+ return { result, restored };
143313
144481
  }
143314
144482
  async logReverseAction(info) {
143315
144483
  const { id, createdBy, reason, createdAt = new Date() } = info;
@@ -143324,23 +144492,51 @@ var ModerationService = class {
143324
144492
  return result;
143325
144493
  }
143326
144494
  async takedownRepo(info) {
143327
- await this.db.db.updateTable("actor").set({ takedownId: info.takedownId }).where("did", "=", info.did).where("takedownId", "is", null).executeTakeFirst();
144495
+ const { takedownId, did: did2 } = info;
144496
+ await this.db.db.updateTable("actor").set({ takedownId }).where("did", "=", did2).where("takedownId", "is", null).executeTakeFirst();
144497
+ return {
144498
+ did: did2,
144499
+ subjects: [
144500
+ {
144501
+ $type: "com.atproto.admin.defs#repoRef",
144502
+ did: did2
144503
+ }
144504
+ ]
144505
+ };
143328
144506
  }
143329
144507
  async reverseTakedownRepo(info) {
143330
144508
  await this.db.db.updateTable("actor").set({ takedownId: null }).where("did", "=", info.did).execute();
143331
144509
  }
143332
144510
  async takedownRecord(info) {
144511
+ const { takedownId, uri: uri2, cid: cid2, blobCids } = info;
144512
+ const did2 = uri2.hostname;
143333
144513
  this.db.assertTransaction();
143334
- await this.db.db.updateTable("record").set({ takedownId: info.takedownId }).where("uri", "=", info.uri.toString()).where("takedownId", "is", null).executeTakeFirst();
143335
- if (info.blobCids) {
143336
- await Promise.all(info.blobCids.map(async (cid2) => {
144514
+ await this.db.db.updateTable("record").set({ takedownId }).where("uri", "=", uri2.toString()).where("takedownId", "is", null).executeTakeFirst();
144515
+ if (blobCids) {
144516
+ await Promise.all(blobCids.map(async (cid3) => {
143337
144517
  const paths = ImageUriBuilder.presets.map((id) => {
143338
- const uri2 = this.imgUriBuilder.getPresetUri(id, info.uri.host, cid2);
143339
- return uri2.replace(this.imgUriBuilder.endpoint, "");
144518
+ const imgUri = this.imgUriBuilder.getPresetUri(id, uri2.host, cid3);
144519
+ return imgUri.replace(this.imgUriBuilder.endpoint, "");
143340
144520
  });
143341
- await this.imgInvalidator.invalidate(cid2.toString(), paths);
144521
+ await this.imgInvalidator.invalidate(cid3.toString(), paths);
143342
144522
  }));
143343
144523
  }
144524
+ return {
144525
+ did: did2,
144526
+ subjects: [
144527
+ {
144528
+ $type: "com.atproto.repo.strongRef",
144529
+ uri: uri2.toString(),
144530
+ cid: cid2.toString()
144531
+ },
144532
+ ...(blobCids || []).map((cid3) => ({
144533
+ $type: "com.atproto.admin.defs#repoBlobRef",
144534
+ did: did2,
144535
+ cid: cid3.toString(),
144536
+ recordUri: uri2.toString()
144537
+ }))
144538
+ ]
144539
+ };
143344
144540
  }
143345
144541
  async reverseTakedownRecord(info) {
143346
144542
  this.db.assertTransaction();
@@ -143428,11 +144624,11 @@ var authVerifier = (idResolver, opts) => async (reqCtx) => {
143428
144624
  if (!jwtStr) {
143429
144625
  throw new AuthRequiredError("missing jwt", "MissingJwt");
143430
144626
  }
143431
- const did2 = await verifyJwt(jwtStr, opts.aud, async (did3) => {
143432
- const atprotoData = await idResolver.did.resolveAtprotoData(did3);
144627
+ const payload = await verifyJwt(jwtStr, opts.aud, async (did2, forceRefresh) => {
144628
+ const atprotoData = await idResolver.did.resolveAtprotoData(did2, forceRefresh);
143433
144629
  return atprotoData.signingKey;
143434
144630
  });
143435
- return { credentials: { did: did2 }, artifacts: { aud: opts.aud } };
144631
+ return { credentials: { did: payload.iss }, artifacts: { aud: opts.aud } };
143436
144632
  };
143437
144633
  var authOptionalVerifier = (idResolver, opts) => async (reqCtx) => {
143438
144634
  if (!reqCtx.req.headers.authorization) {
@@ -143535,6 +144731,9 @@ var AppContext = class {
143535
144731
  get services() {
143536
144732
  return this.opts.services;
143537
144733
  }
144734
+ get signingKey() {
144735
+ return this.opts.signingKey;
144736
+ }
143538
144737
  get plcClient() {
143539
144738
  return new plc.Client(this.cfg.didPlcUrl);
143540
144739
  }
@@ -143550,6 +144749,9 @@ var AppContext = class {
143550
144749
  get notifServer() {
143551
144750
  return this.opts.notifServer;
143552
144751
  }
144752
+ get searchAgent() {
144753
+ return this.opts.searchAgent;
144754
+ }
143553
144755
  get authVerifier() {
143554
144756
  return authVerifier(this.idResolver, { aud: this.cfg.serverDid });
143555
144757
  }
@@ -143567,6 +144769,21 @@ var AppContext = class {
143567
144769
  get roleVerifier() {
143568
144770
  return roleVerifier(this.cfg);
143569
144771
  }
144772
+ async serviceAuthJwt(aud) {
144773
+ const iss = this.cfg.serverDid;
144774
+ return createServiceJwt({
144775
+ iss,
144776
+ aud,
144777
+ keypair: this.signingKey
144778
+ });
144779
+ }
144780
+ async pdsAdminAgent(did2) {
144781
+ const data = await this.idResolver.did.resolveAtprotoData(did2);
144782
+ const agent = new AtpAgent({ service: data.pds });
144783
+ const jwt = await this.serviceAuthJwt(did2);
144784
+ agent.api.setHeader("authorization", `Bearer ${jwt}`);
144785
+ return agent;
144786
+ }
143570
144787
  get backgroundQueue() {
143571
144788
  return this.opts.backgroundQueue;
143572
144789
  }
@@ -143585,15 +144802,22 @@ var DidSqlCache = class {
143585
144802
  this.maxTTL = maxTTL;
143586
144803
  this.pQueue = new import_p_queue.default();
143587
144804
  }
143588
- async cacheDid(did2, doc) {
143589
- await this.db.db.insertInto("did_cache").values({ did: did2, doc, updatedAt: Date.now() }).onConflict((oc) => oc.column("did").doUpdateSet({ doc, updatedAt: Date.now() })).executeTakeFirst();
144805
+ async cacheDid(did2, doc, prevResult) {
144806
+ if (prevResult) {
144807
+ await this.db.db.updateTable("did_cache").set({ doc, updatedAt: Date.now() }).where("did", "=", did2).where("updatedAt", "=", prevResult.updatedAt).execute();
144808
+ } else {
144809
+ await this.db.db.insertInto("did_cache").values({ did: did2, doc, updatedAt: Date.now() }).onConflict((oc) => oc.column("did").doUpdateSet({
144810
+ doc: excluded(this.db.db, "doc"),
144811
+ updatedAt: excluded(this.db.db, "updatedAt")
144812
+ })).executeTakeFirst();
144813
+ }
143590
144814
  }
143591
- async refreshCache(did2, getDoc) {
144815
+ async refreshCache(did2, getDoc, prevResult) {
143592
144816
  this.pQueue?.add(async () => {
143593
144817
  try {
143594
144818
  const doc = await getDoc();
143595
144819
  if (doc) {
143596
- await this.cacheDid(did2, doc);
144820
+ await this.cacheDid(did2, doc, prevResult);
143597
144821
  } else {
143598
144822
  await this.clearEntry(did2);
143599
144823
  }
@@ -143609,15 +144833,13 @@ var DidSqlCache = class {
143609
144833
  const now = Date.now();
143610
144834
  const updatedAt = new Date(res.updatedAt).getTime();
143611
144835
  const expired = now > updatedAt + this.maxTTL;
143612
- if (expired) {
143613
- return null;
143614
- }
143615
144836
  const stale = now > updatedAt + this.staleTTL;
143616
144837
  return {
143617
144838
  doc: res.doc,
143618
144839
  updatedAt,
143619
144840
  did: did2,
143620
- stale
144841
+ stale,
144842
+ expired
143621
144843
  };
143622
144844
  }
143623
144845
  async clearEntry(did2) {
@@ -143988,6 +145210,7 @@ var ServerConfig = class {
143988
145210
  const handleResolveNameservers = process.env.HANDLE_RESOLVE_NAMESERVERS ? process.env.HANDLE_RESOLVE_NAMESERVERS.split(",") : [];
143989
145211
  const imgUriEndpoint = process.env.IMG_URI_ENDPOINT;
143990
145212
  const blobCacheLocation = process.env.BLOB_CACHE_LOC;
145213
+ const searchEndpoint = process.env.SEARCH_ENDPOINT;
143991
145214
  const dbPrimaryPostgresUrl = overrides?.dbPrimaryPostgresUrl || process.env.DB_PRIMARY_POSTGRES_URL;
143992
145215
  let dbReplicaPostgresUrls = overrides?.dbReplicaPostgresUrls;
143993
145216
  if (!dbReplicaPostgresUrls && process.env.DB_REPLICA_POSTGRES_URLS) {
@@ -144025,6 +145248,7 @@ var ServerConfig = class {
144025
145248
  handleResolveNameservers,
144026
145249
  imgUriEndpoint,
144027
145250
  blobCacheLocation,
145251
+ searchEndpoint,
144028
145252
  labelerDid,
144029
145253
  adminPassword,
144030
145254
  moderatorPassword,
@@ -144089,6 +145313,9 @@ var ServerConfig = class {
144089
145313
  get blobCacheLocation() {
144090
145314
  return this.cfg.blobCacheLocation;
144091
145315
  }
145316
+ get searchEndpoint() {
145317
+ return this.cfg.searchEndpoint;
145318
+ }
144092
145319
  get labelerDid() {
144093
145320
  return this.cfg.labelerDid;
144094
145321
  }
@@ -144150,7 +145377,8 @@ __export(migrations_exports, {
144150
145377
  _20230830T205507322Z: () => T205507322Z_suggested_feeds_exports,
144151
145378
  _20230904T211011773Z: () => T211011773Z_block_lists_exports,
144152
145379
  _20230906T222220386Z: () => T222220386Z_thread_gating_exports,
144153
- _20230920T213858047Z: () => T213858047Z_add_tags_to_post_exports
145380
+ _20230920T213858047Z: () => T213858047Z_add_tags_to_post_exports,
145381
+ _20230929T192920807Z: () => T192920807Z_record_cursor_indexes_exports
144154
145382
  });
144155
145383
 
144156
145384
  // src/db/migrations/20230309T045948368Z-init.ts
@@ -144628,6 +145856,27 @@ async function down27(db) {
144628
145856
  await db.schema.alterTable("post").dropColumn("tags").execute();
144629
145857
  }
144630
145858
 
145859
+ // src/db/migrations/20230929T192920807Z-record-cursor-indexes.ts
145860
+ var T192920807Z_record_cursor_indexes_exports = {};
145861
+ __export(T192920807Z_record_cursor_indexes_exports, {
145862
+ down: () => down28,
145863
+ up: () => up28
145864
+ });
145865
+ async function up28(db) {
145866
+ await db.schema.createIndex("like_creator_cursor_idx").on("like").columns(["creator", "sortAt", "cid"]).execute();
145867
+ await db.schema.createIndex("follow_creator_cursor_idx").on("follow").columns(["creator", "sortAt", "cid"]).execute();
145868
+ await db.schema.createIndex("follow_subject_cursor_idx").on("follow").columns(["subjectDid", "sortAt", "cid"]).execute();
145869
+ await db.schema.dropIndex("like_creator_idx").execute();
145870
+ await db.schema.dropIndex("follow_subjectdid_idx").execute();
145871
+ }
145872
+ async function down28(db) {
145873
+ await db.schema.createIndex("like_creator_idx").on("like").column("creator").execute();
145874
+ await db.schema.createIndex("follow_subjectdid_idx").on("follow").column("subjectDid").execute();
145875
+ await db.schema.dropIndex("like_creator_cursor_idx").execute();
145876
+ await db.schema.dropIndex("follow_creator_cursor_idx").execute();
145877
+ await db.schema.dropIndex("follow_subject_cursor_idx").execute();
145878
+ }
145879
+
144631
145880
  // src/db/migrations/provider.ts
144632
145881
  var CtxMigrationProvider = class {
144633
145882
  constructor(migrations, ctx) {
@@ -145189,9 +146438,9 @@ var handler2 = async (ctx, params2, requester) => {
145189
146438
  const db = ctx.db.getReplica("feed");
145190
146439
  const feedService = ctx.services.feed(db);
145191
146440
  const { ref } = db.db.dynamic;
145192
- const keyset = new FeedKeyset(ref("post.indexedAt"), ref("post.cid"));
146441
+ const keyset = new FeedKeyset(ref("post.sortAt"), ref("post.cid"));
145193
146442
  const sortFrom = keyset.unpack(cursor)?.primary;
145194
- let postsQb = feedService.selectPostQb().innerJoin("follow", "follow.subjectDid", "post.creator").innerJoin("post_agg", "post_agg.uri", "post.uri").where("post_agg.likeCount", ">=", 5).where("follow.creator", "=", requester).where("post.indexedAt", ">", getFeedDateThreshold(sortFrom));
146443
+ let postsQb = feedService.selectPostQb().innerJoin("follow", "follow.subjectDid", "post.creator").innerJoin("post_agg", "post_agg.uri", "post.uri").where("post_agg.likeCount", ">=", 5).where("follow.creator", "=", requester).where("post.sortAt", ">", getFeedDateThreshold(sortFrom));
145195
146444
  postsQb = paginate(postsQb, { limit, cursor, keyset, tryIndex: true });
145196
146445
  const feedItems = await postsQb.execute();
145197
146446
  return {
@@ -146338,11 +147587,9 @@ var IndexingService = class {
146338
147587
  const atpData = await this.idResolver.did.resolveAtprotoData(did2, true);
146339
147588
  const handleToDid = await this.idResolver.handle.resolve(atpData.handle);
146340
147589
  const handle2 = did2 === handleToDid ? atpData.handle.toLowerCase() : null;
146341
- if (actor && actor.handle !== handle2) {
146342
- const actorWithHandle = handle2 !== null ? await this.db.db.selectFrom("actor").where("handle", "=", handle2).selectAll().executeTakeFirst() : null;
146343
- if (handle2 && actorWithHandle && did2 !== actorWithHandle.did) {
146344
- await this.db.db.updateTable("actor").where("actor.did", "=", actorWithHandle.did).set({ handle: null }).execute();
146345
- }
147590
+ const actorWithHandle = handle2 !== null ? await this.db.db.selectFrom("actor").where("handle", "=", handle2).selectAll().executeTakeFirst() : null;
147591
+ if (handle2 && actorWithHandle && did2 !== actorWithHandle.did) {
147592
+ await this.db.db.updateTable("actor").where("actor.did", "=", actorWithHandle.did).set({ handle: null }).execute();
146346
147593
  }
146347
147594
  const actorInfo = { handle: handle2, indexedAt: timestamp };
146348
147595
  await this.db.db.insertInto("actor").values({ did: did2, ...actorInfo }).onConflict((oc) => oc.column("did").doUpdateSet(actorInfo)).returning("did").executeTakeFirst();
@@ -146430,7 +147677,7 @@ var IndexingService = class {
146430
147677
  }
146431
147678
  async getActorIsHosted(did2) {
146432
147679
  const doc = await this.idResolver.did.resolve(did2, true);
146433
- const pds = doc && getPds(doc);
147680
+ const pds = doc && getPdsEndpoint(doc);
146434
147681
  if (!pds)
146435
147682
  return false;
146436
147683
  const { api } = new AtpAgent({ service: pds });
@@ -146881,19 +148128,6 @@ function partitionId(key) {
146881
148128
  function partitionKey(p) {
146882
148129
  return `repo:${p}`;
146883
148130
  }
146884
- function handleAllSettledErrors(results) {
146885
- const errors = results.filter(isRejected).map((res) => res.reason);
146886
- if (errors.length === 0) {
146887
- return;
146888
- }
146889
- if (errors.length === 1) {
146890
- throw errors[0];
146891
- }
146892
- throw new AggregateError(errors, "Multiple errors: " + errors.map((err) => err?.message).join("\n"));
146893
- }
146894
- function isRejected(result) {
146895
- return result.status === "rejected";
146896
- }
146897
148131
 
146898
148132
  // src/lexicon/types/app/bsky/actor/profile.ts
146899
148133
  function isRecord2(v) {
@@ -147445,6 +148679,7 @@ var AutoModerator = class {
147445
148679
  await modSrvc.takedownRecord({
147446
148680
  takedownId: action.id,
147447
148681
  uri: uri2,
148682
+ cid: recordCid,
147448
148683
  blobCids: takedownCids
147449
148684
  });
147450
148685
  });
@@ -148128,7 +149363,7 @@ var BskyAppView = class {
148128
149363
  this.app = opts.app;
148129
149364
  }
148130
149365
  static create(opts) {
148131
- const { db, config: config2, algos = {} } = opts;
149366
+ const { db, config: config2, signingKey, algos = {} } = opts;
148132
149367
  let maybeImgInvalidator = opts.imgInvalidator;
148133
149368
  const app = (0, import_express7.default)();
148134
149369
  app.use((0, import_cors.default)());
@@ -148156,6 +149391,7 @@ var BskyAppView = class {
148156
149391
  const backgroundQueue = new BackgroundQueue(db.getPrimary());
148157
149392
  const labelCache = new LabelCache(db.getPrimary());
148158
149393
  const notifServer = new NotificationServer(db.getPrimary());
149394
+ const searchAgent = config2.searchEndpoint ? new AtpAgent({ service: config2.searchEndpoint }) : void 0;
148159
149395
  const services = createServices({
148160
149396
  imgUriBuilder,
148161
149397
  imgInvalidator,
@@ -148166,10 +149402,12 @@ var BskyAppView = class {
148166
149402
  cfg: config2,
148167
149403
  services,
148168
149404
  imgUriBuilder,
149405
+ signingKey,
148169
149406
  idResolver,
148170
149407
  didCache,
148171
149408
  labelCache,
148172
149409
  backgroundQueue,
149410
+ searchAgent,
148173
149411
  algos,
148174
149412
  notifServer
148175
149413
  });