@atproto/pds 0.3.0-beta.2 → 0.3.0-beta.3

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.
package/dist/index.js CHANGED
@@ -221804,6 +221804,32 @@ var schemaDict = {
221804
221804
  }
221805
221805
  }
221806
221806
  },
221807
+ ComAtprotoTempUpgradeRepoVersion: {
221808
+ lexicon: 1,
221809
+ id: "com.atproto.temp.upgradeRepoVersion",
221810
+ defs: {
221811
+ main: {
221812
+ type: "procedure",
221813
+ description: "Upgrade a repo to v3",
221814
+ input: {
221815
+ encoding: "application/json",
221816
+ schema: {
221817
+ type: "object",
221818
+ required: ["did"],
221819
+ properties: {
221820
+ did: {
221821
+ type: "string",
221822
+ format: "did"
221823
+ },
221824
+ force: {
221825
+ type: "boolean"
221826
+ }
221827
+ }
221828
+ }
221829
+ }
221830
+ }
221831
+ }
221832
+ },
221807
221833
  AppBskyActorDefs: {
221808
221834
  lexicon: 1,
221809
221835
  id: "app.bsky.actor.defs",
@@ -225107,6 +225133,7 @@ var ids = {
225107
225133
  ComAtprotoSyncNotifyOfUpdate: "com.atproto.sync.notifyOfUpdate",
225108
225134
  ComAtprotoSyncRequestCrawl: "com.atproto.sync.requestCrawl",
225109
225135
  ComAtprotoSyncSubscribeRepos: "com.atproto.sync.subscribeRepos",
225136
+ ComAtprotoTempUpgradeRepoVersion: "com.atproto.temp.upgradeRepoVersion",
225110
225137
  AppBskyActorDefs: "app.bsky.actor.defs",
225111
225138
  AppBskyActorGetPreferences: "app.bsky.actor.getPreferences",
225112
225139
  AppBskyActorGetProfile: "app.bsky.actor.getProfile",
@@ -235414,6 +235441,60 @@ var ReadableBlockstore = class {
235414
235441
  return cborToLexRecord(bytes4);
235415
235442
  }
235416
235443
  };
235444
+ var readable_blockstore_default = ReadableBlockstore;
235445
+
235446
+ // ../repo/src/storage/memory-blockstore.ts
235447
+ var MemoryBlockstore = class extends readable_blockstore_default {
235448
+ constructor(blocks) {
235449
+ super();
235450
+ this.root = null;
235451
+ this.blocks = new block_map_default();
235452
+ if (blocks) {
235453
+ this.blocks.addMap(blocks);
235454
+ }
235455
+ }
235456
+ async getRoot() {
235457
+ return this.root;
235458
+ }
235459
+ async getBytes(cid2) {
235460
+ return this.blocks.get(cid2) || null;
235461
+ }
235462
+ async has(cid2) {
235463
+ return this.blocks.has(cid2);
235464
+ }
235465
+ async getBlocks(cids) {
235466
+ return this.blocks.getMany(cids);
235467
+ }
235468
+ async putBlock(cid2, block) {
235469
+ this.blocks.set(cid2, block);
235470
+ }
235471
+ async putMany(blocks) {
235472
+ this.blocks.addMap(blocks);
235473
+ }
235474
+ async updateRoot(cid2) {
235475
+ this.root = cid2;
235476
+ }
235477
+ async applyCommit(commit2) {
235478
+ this.root = commit2.cid;
235479
+ const rmCids = commit2.removedCids.toList();
235480
+ for (const cid2 of rmCids) {
235481
+ this.blocks.delete(cid2);
235482
+ }
235483
+ commit2.newBlocks.forEach((bytes4, cid2) => {
235484
+ this.blocks.set(cid2, bytes4);
235485
+ });
235486
+ }
235487
+ async sizeInBytes() {
235488
+ let total = 0;
235489
+ this.blocks.forEach((bytes4) => {
235490
+ total += bytes4.byteLength;
235491
+ });
235492
+ return total;
235493
+ }
235494
+ async destroy() {
235495
+ this.blocks.clear();
235496
+ }
235497
+ };
235417
235498
 
235418
235499
  // ../repo/src/storage/types.ts
235419
235500
  var BlobNotFoundError = class extends Error {
@@ -240802,6 +240883,93 @@ function sync_default(server, ctx) {
240802
240883
  getHead_default(server, ctx);
240803
240884
  }
240804
240885
 
240886
+ // src/api/com/atproto/upgradeRepoVersion.ts
240887
+ function upgradeRepoVersion_default(server, ctx) {
240888
+ server.com.atproto.temp.upgradeRepoVersion({
240889
+ auth: ctx.roleVerifier,
240890
+ handler: async ({ input, auth }) => {
240891
+ if (!auth.credentials.admin) {
240892
+ throw new InvalidRequestError("must be admin");
240893
+ }
240894
+ const { did: did2, force } = input.body;
240895
+ await ctx.db.transaction(async (dbTxn) => {
240896
+ const storage = new sql_repo_storage_default(dbTxn, did2);
240897
+ await obtainLock(storage);
240898
+ const prevCid = await storage.getRoot();
240899
+ if (!prevCid) {
240900
+ throw new InvalidRequestError("Could not find repo");
240901
+ }
240902
+ const prev = await storage.readObj(prevCid, def2.versionedCommit);
240903
+ const records = await dbTxn.db.selectFrom("record").select(["collection", "rkey", "cid"]).where("did", "=", did2).execute();
240904
+ const memoryStore = new MemoryBlockstore();
240905
+ let data = await MST.create(memoryStore);
240906
+ for (const record of records) {
240907
+ const dataKey = record.collection + "/" + record.rkey;
240908
+ const cid2 = CID.parse(record.cid);
240909
+ data = await data.add(dataKey, cid2);
240910
+ }
240911
+ const dataCid = await data.getPointer();
240912
+ if (!force && !dataCid.equals(prev.data)) {
240913
+ throw new InvalidRequestError("Data cid did not match");
240914
+ }
240915
+ const recordCids = records.map((r) => r.cid);
240916
+ const diff = await DataDiff.of(data, null);
240917
+ const cidsToKeep = [...recordCids, ...diff.newMstBlocks.cids()];
240918
+ const rev = TID.nextStr(prev.rev);
240919
+ if (force) {
240920
+ const got = await storage.getBlocks(diff.newMstBlocks.cids());
240921
+ const toAdd = diff.newMstBlocks.getMany(got.missing);
240922
+ httpLogger.info({ missing: got.missing.length }, "force added missing blocks");
240923
+ await storage.putMany(toAdd.blocks, rev);
240924
+ }
240925
+ for (const chunk of chunkArray(cidsToKeep, 500)) {
240926
+ const cidStrs = chunk.map((c) => c.toString());
240927
+ await dbTxn.db.updateTable("ipld_block").set({ repoRev: rev }).where("creator", "=", did2).where("cid", "in", cidStrs).execute();
240928
+ }
240929
+ await dbTxn.db.deleteFrom("ipld_block").where("creator", "=", did2).where((qb) => qb.where("repoRev", "is", null).orWhere("repoRev", "!=", rev)).execute();
240930
+ await dbTxn.db.updateTable("repo_blob").set({ repoRev: rev }).where("did", "=", did2).execute();
240931
+ await dbTxn.db.updateTable("record").set({ repoRev: rev }).where("did", "=", did2).execute();
240932
+ const commit2 = await signCommit({
240933
+ did: did2,
240934
+ version: 3,
240935
+ rev: TID.nextStr(),
240936
+ prev: prevCid,
240937
+ data: dataCid
240938
+ }, ctx.repoSigningKey);
240939
+ const newBlocks = new BlockMap();
240940
+ const commitCid = await newBlocks.add(commit2);
240941
+ await storage.putMany(newBlocks, rev);
240942
+ await dbTxn.db.updateTable("repo_root").set({
240943
+ root: commitCid.toString(),
240944
+ rev,
240945
+ indexedAt: storage.getTimestamp()
240946
+ }).where("did", "=", did2).execute();
240947
+ const commitData = {
240948
+ cid: commitCid,
240949
+ rev,
240950
+ prev: prevCid,
240951
+ since: null,
240952
+ newBlocks,
240953
+ removedCids: new CidSet()
240954
+ };
240955
+ const seqEvt = await formatSeqCommit(did2, commitData, []);
240956
+ await sequenceEvt(dbTxn, seqEvt);
240957
+ });
240958
+ }
240959
+ });
240960
+ }
240961
+ var obtainLock = async (storage, tries = 20) => {
240962
+ const obtained = await storage.lockRepo();
240963
+ if (obtained) {
240964
+ return;
240965
+ }
240966
+ if (tries < 1) {
240967
+ throw new InvalidRequestError("could not obtain lock");
240968
+ }
240969
+ await wait(50);
240970
+ return obtainLock(storage, tries - 1);
240971
+ };
240972
+
240805
240973
  // src/api/com/atproto/index.ts
240806
240974
  function atproto_default(server, ctx) {
240807
240975
  admin_default(server, ctx);
@@ -240810,6 +240978,7 @@ function atproto_default(server, ctx) {
240810
240978
  repo_default(server, ctx);
240811
240979
  server_default(server, ctx);
240812
240980
  sync_default(server, ctx);
240981
+ upgradeRepoVersion_default(server, ctx);
240813
240982
  }
240814
240983
 
240815
240984
  // src/api/app/bsky/simple.ts
@@ -244570,6 +244739,32 @@ var schemaDict2 = {
244570
244739
  }
244571
244740
  }
244572
244741
  },
244742
+ ComAtprotoTempUpgradeRepoVersion: {
244743
+ lexicon: 1,
244744
+ id: "com.atproto.temp.upgradeRepoVersion",
244745
+ defs: {
244746
+ main: {
244747
+ type: "procedure",
244748
+ description: "Upgrade a repo to v3",
244749
+ input: {
244750
+ encoding: "application/json",
244751
+ schema: {
244752
+ type: "object",
244753
+ required: ["did"],
244754
+ properties: {
244755
+ did: {
244756
+ type: "string",
244757
+ format: "did"
244758
+ },
244759
+ force: {
244760
+ type: "boolean"
244761
+ }
244762
+ }
244763
+ }
244764
+ }
244765
+ }
244766
+ }
244767
+ },
244573
244768
  AppBskyActorDefs: {
244574
244769
  lexicon: 1,
244575
244770
  id: "app.bsky.actor.defs",
@@ -248377,69 +248572,76 @@ function toKnownErr56(e) {
248377
248572
  return e;
248378
248573
  }
248379
248574
 
248380
- // ../api/src/client/types/app/bsky/actor/getPreferences.ts
248575
+ // ../api/src/client/types/com/atproto/temp/upgradeRepoVersion.ts
248381
248576
  function toKnownErr57(e) {
248382
248577
  if (e instanceof XRPCError) {
248383
248578
  }
248384
248579
  return e;
248385
248580
  }
248386
248581
 
248387
- // ../api/src/client/types/app/bsky/actor/getProfile.ts
248582
+ // ../api/src/client/types/app/bsky/actor/getPreferences.ts
248388
248583
  function toKnownErr58(e) {
248389
248584
  if (e instanceof XRPCError) {
248390
248585
  }
248391
248586
  return e;
248392
248587
  }
248393
248588
 
248394
- // ../api/src/client/types/app/bsky/actor/getProfiles.ts
248589
+ // ../api/src/client/types/app/bsky/actor/getProfile.ts
248395
248590
  function toKnownErr59(e) {
248396
248591
  if (e instanceof XRPCError) {
248397
248592
  }
248398
248593
  return e;
248399
248594
  }
248400
248595
 
248401
- // ../api/src/client/types/app/bsky/actor/getSuggestions.ts
248596
+ // ../api/src/client/types/app/bsky/actor/getProfiles.ts
248402
248597
  function toKnownErr60(e) {
248403
248598
  if (e instanceof XRPCError) {
248404
248599
  }
248405
248600
  return e;
248406
248601
  }
248407
248602
 
248408
- // ../api/src/client/types/app/bsky/actor/putPreferences.ts
248603
+ // ../api/src/client/types/app/bsky/actor/getSuggestions.ts
248409
248604
  function toKnownErr61(e) {
248410
248605
  if (e instanceof XRPCError) {
248411
248606
  }
248412
248607
  return e;
248413
248608
  }
248414
248609
 
248415
- // ../api/src/client/types/app/bsky/actor/searchActors.ts
248610
+ // ../api/src/client/types/app/bsky/actor/putPreferences.ts
248416
248611
  function toKnownErr62(e) {
248417
248612
  if (e instanceof XRPCError) {
248418
248613
  }
248419
248614
  return e;
248420
248615
  }
248421
248616
 
248422
- // ../api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts
248617
+ // ../api/src/client/types/app/bsky/actor/searchActors.ts
248423
248618
  function toKnownErr63(e) {
248424
248619
  if (e instanceof XRPCError) {
248425
248620
  }
248426
248621
  return e;
248427
248622
  }
248428
248623
 
248429
- // ../api/src/client/types/app/bsky/feed/describeFeedGenerator.ts
248624
+ // ../api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts
248430
248625
  function toKnownErr64(e) {
248431
248626
  if (e instanceof XRPCError) {
248432
248627
  }
248433
248628
  return e;
248434
248629
  }
248435
248630
 
248436
- // ../api/src/client/types/app/bsky/feed/getActorFeeds.ts
248631
+ // ../api/src/client/types/app/bsky/feed/describeFeedGenerator.ts
248437
248632
  function toKnownErr65(e) {
248438
248633
  if (e instanceof XRPCError) {
248439
248634
  }
248440
248635
  return e;
248441
248636
  }
248442
248637
 
248638
+ // ../api/src/client/types/app/bsky/feed/getActorFeeds.ts
248639
+ function toKnownErr66(e) {
248640
+ if (e instanceof XRPCError) {
248641
+ }
248642
+ return e;
248643
+ }
248644
+
248443
248645
  // ../api/src/client/types/app/bsky/feed/getActorLikes.ts
248444
248646
  var BlockedActorError = class extends XRPCError {
248445
248647
  constructor(src3) {
@@ -248451,7 +248653,7 @@ var BlockedByActorError = class extends XRPCError {
248451
248653
  super(src3.status, src3.error, src3.message, src3.headers);
248452
248654
  }
248453
248655
  };
248454
- function toKnownErr66(e) {
248656
+ function toKnownErr67(e) {
248455
248657
  if (e instanceof XRPCError) {
248456
248658
  if (e.error === "BlockedActor")
248457
248659
  return new BlockedActorError(e);
@@ -248472,7 +248674,7 @@ var BlockedByActorError2 = class extends XRPCError {
248472
248674
  super(src3.status, src3.error, src3.message, src3.headers);
248473
248675
  }
248474
248676
  };
248475
- function toKnownErr67(e) {
248677
+ function toKnownErr68(e) {
248476
248678
  if (e instanceof XRPCError) {
248477
248679
  if (e.error === "BlockedActor")
248478
248680
  return new BlockedActorError2(e);
@@ -248488,7 +248690,7 @@ var UnknownFeedError = class extends XRPCError {
248488
248690
  super(src3.status, src3.error, src3.message, src3.headers);
248489
248691
  }
248490
248692
  };
248491
- function toKnownErr68(e) {
248693
+ function toKnownErr69(e) {
248492
248694
  if (e instanceof XRPCError) {
248493
248695
  if (e.error === "UnknownFeed")
248494
248696
  return new UnknownFeedError(e);
@@ -248497,14 +248699,14 @@ function toKnownErr68(e) {
248497
248699
  }
248498
248700
 
248499
248701
  // ../api/src/client/types/app/bsky/feed/getFeedGenerator.ts
248500
- function toKnownErr69(e) {
248702
+ function toKnownErr70(e) {
248501
248703
  if (e instanceof XRPCError) {
248502
248704
  }
248503
248705
  return e;
248504
248706
  }
248505
248707
 
248506
248708
  // ../api/src/client/types/app/bsky/feed/getFeedGenerators.ts
248507
- function toKnownErr70(e) {
248709
+ function toKnownErr71(e) {
248508
248710
  if (e instanceof XRPCError) {
248509
248711
  }
248510
248712
  return e;
@@ -248516,7 +248718,7 @@ var UnknownFeedError2 = class extends XRPCError {
248516
248718
  super(src3.status, src3.error, src3.message, src3.headers);
248517
248719
  }
248518
248720
  };
248519
- function toKnownErr71(e) {
248721
+ function toKnownErr72(e) {
248520
248722
  if (e instanceof XRPCError) {
248521
248723
  if (e.error === "UnknownFeed")
248522
248724
  return new UnknownFeedError2(e);
@@ -248525,7 +248727,7 @@ function toKnownErr71(e) {
248525
248727
  }
248526
248728
 
248527
248729
  // ../api/src/client/types/app/bsky/feed/getLikes.ts
248528
- function toKnownErr72(e) {
248730
+ function toKnownErr73(e) {
248529
248731
  if (e instanceof XRPCError) {
248530
248732
  }
248531
248733
  return e;
@@ -248535,14 +248737,14 @@ function toKnownErr72(e) {
248535
248737
  var getPostThread_exports = {};
248536
248738
  __export(getPostThread_exports, {
248537
248739
  NotFoundError: () => NotFoundError,
248538
- toKnownErr: () => toKnownErr73
248740
+ toKnownErr: () => toKnownErr74
248539
248741
  });
248540
248742
  var NotFoundError = class extends XRPCError {
248541
248743
  constructor(src3) {
248542
248744
  super(src3.status, src3.error, src3.message, src3.headers);
248543
248745
  }
248544
248746
  };
248545
- function toKnownErr73(e) {
248747
+ function toKnownErr74(e) {
248546
248748
  if (e instanceof XRPCError) {
248547
248749
  if (e.error === "NotFound")
248548
248750
  return new NotFoundError(e);
@@ -248551,168 +248753,168 @@ function toKnownErr73(e) {
248551
248753
  }
248552
248754
 
248553
248755
  // ../api/src/client/types/app/bsky/feed/getPosts.ts
248554
- function toKnownErr74(e) {
248756
+ function toKnownErr75(e) {
248555
248757
  if (e instanceof XRPCError) {
248556
248758
  }
248557
248759
  return e;
248558
248760
  }
248559
248761
 
248560
248762
  // ../api/src/client/types/app/bsky/feed/getRepostedBy.ts
248561
- function toKnownErr75(e) {
248763
+ function toKnownErr76(e) {
248562
248764
  if (e instanceof XRPCError) {
248563
248765
  }
248564
248766
  return e;
248565
248767
  }
248566
248768
 
248567
248769
  // ../api/src/client/types/app/bsky/feed/getSuggestedFeeds.ts
248568
- function toKnownErr76(e) {
248770
+ function toKnownErr77(e) {
248569
248771
  if (e instanceof XRPCError) {
248570
248772
  }
248571
248773
  return e;
248572
248774
  }
248573
248775
 
248574
248776
  // ../api/src/client/types/app/bsky/feed/getTimeline.ts
248575
- function toKnownErr77(e) {
248777
+ function toKnownErr78(e) {
248576
248778
  if (e instanceof XRPCError) {
248577
248779
  }
248578
248780
  return e;
248579
248781
  }
248580
248782
 
248581
248783
  // ../api/src/client/types/app/bsky/graph/getBlocks.ts
248582
- function toKnownErr78(e) {
248784
+ function toKnownErr79(e) {
248583
248785
  if (e instanceof XRPCError) {
248584
248786
  }
248585
248787
  return e;
248586
248788
  }
248587
248789
 
248588
248790
  // ../api/src/client/types/app/bsky/graph/getFollowers.ts
248589
- function toKnownErr79(e) {
248791
+ function toKnownErr80(e) {
248590
248792
  if (e instanceof XRPCError) {
248591
248793
  }
248592
248794
  return e;
248593
248795
  }
248594
248796
 
248595
248797
  // ../api/src/client/types/app/bsky/graph/getFollows.ts
248596
- function toKnownErr80(e) {
248798
+ function toKnownErr81(e) {
248597
248799
  if (e instanceof XRPCError) {
248598
248800
  }
248599
248801
  return e;
248600
248802
  }
248601
248803
 
248602
248804
  // ../api/src/client/types/app/bsky/graph/getList.ts
248603
- function toKnownErr81(e) {
248805
+ function toKnownErr82(e) {
248604
248806
  if (e instanceof XRPCError) {
248605
248807
  }
248606
248808
  return e;
248607
248809
  }
248608
248810
 
248609
248811
  // ../api/src/client/types/app/bsky/graph/getListBlocks.ts
248610
- function toKnownErr82(e) {
248812
+ function toKnownErr83(e) {
248611
248813
  if (e instanceof XRPCError) {
248612
248814
  }
248613
248815
  return e;
248614
248816
  }
248615
248817
 
248616
248818
  // ../api/src/client/types/app/bsky/graph/getListMutes.ts
248617
- function toKnownErr83(e) {
248819
+ function toKnownErr84(e) {
248618
248820
  if (e instanceof XRPCError) {
248619
248821
  }
248620
248822
  return e;
248621
248823
  }
248622
248824
 
248623
248825
  // ../api/src/client/types/app/bsky/graph/getLists.ts
248624
- function toKnownErr84(e) {
248826
+ function toKnownErr85(e) {
248625
248827
  if (e instanceof XRPCError) {
248626
248828
  }
248627
248829
  return e;
248628
248830
  }
248629
248831
 
248630
248832
  // ../api/src/client/types/app/bsky/graph/getMutes.ts
248631
- function toKnownErr85(e) {
248833
+ function toKnownErr86(e) {
248632
248834
  if (e instanceof XRPCError) {
248633
248835
  }
248634
248836
  return e;
248635
248837
  }
248636
248838
 
248637
248839
  // ../api/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts
248638
- function toKnownErr86(e) {
248840
+ function toKnownErr87(e) {
248639
248841
  if (e instanceof XRPCError) {
248640
248842
  }
248641
248843
  return e;
248642
248844
  }
248643
248845
 
248644
248846
  // ../api/src/client/types/app/bsky/graph/muteActor.ts
248645
- function toKnownErr87(e) {
248847
+ function toKnownErr88(e) {
248646
248848
  if (e instanceof XRPCError) {
248647
248849
  }
248648
248850
  return e;
248649
248851
  }
248650
248852
 
248651
248853
  // ../api/src/client/types/app/bsky/graph/muteActorList.ts
248652
- function toKnownErr88(e) {
248854
+ function toKnownErr89(e) {
248653
248855
  if (e instanceof XRPCError) {
248654
248856
  }
248655
248857
  return e;
248656
248858
  }
248657
248859
 
248658
248860
  // ../api/src/client/types/app/bsky/graph/unmuteActor.ts
248659
- function toKnownErr89(e) {
248861
+ function toKnownErr90(e) {
248660
248862
  if (e instanceof XRPCError) {
248661
248863
  }
248662
248864
  return e;
248663
248865
  }
248664
248866
 
248665
248867
  // ../api/src/client/types/app/bsky/graph/unmuteActorList.ts
248666
- function toKnownErr90(e) {
248868
+ function toKnownErr91(e) {
248667
248869
  if (e instanceof XRPCError) {
248668
248870
  }
248669
248871
  return e;
248670
248872
  }
248671
248873
 
248672
248874
  // ../api/src/client/types/app/bsky/notification/getUnreadCount.ts
248673
- function toKnownErr91(e) {
248875
+ function toKnownErr92(e) {
248674
248876
  if (e instanceof XRPCError) {
248675
248877
  }
248676
248878
  return e;
248677
248879
  }
248678
248880
 
248679
248881
  // ../api/src/client/types/app/bsky/notification/listNotifications.ts
248680
- function toKnownErr92(e) {
248882
+ function toKnownErr93(e) {
248681
248883
  if (e instanceof XRPCError) {
248682
248884
  }
248683
248885
  return e;
248684
248886
  }
248685
248887
 
248686
248888
  // ../api/src/client/types/app/bsky/notification/registerPush.ts
248687
- function toKnownErr93(e) {
248889
+ function toKnownErr94(e) {
248688
248890
  if (e instanceof XRPCError) {
248689
248891
  }
248690
248892
  return e;
248691
248893
  }
248692
248894
 
248693
248895
  // ../api/src/client/types/app/bsky/notification/updateSeen.ts
248694
- function toKnownErr94(e) {
248896
+ function toKnownErr95(e) {
248695
248897
  if (e instanceof XRPCError) {
248696
248898
  }
248697
248899
  return e;
248698
248900
  }
248699
248901
 
248700
248902
  // ../api/src/client/types/app/bsky/unspecced/applyLabels.ts
248701
- function toKnownErr95(e) {
248903
+ function toKnownErr96(e) {
248702
248904
  if (e instanceof XRPCError) {
248703
248905
  }
248704
248906
  return e;
248705
248907
  }
248706
248908
 
248707
248909
  // ../api/src/client/types/app/bsky/unspecced/getPopular.ts
248708
- function toKnownErr96(e) {
248910
+ function toKnownErr97(e) {
248709
248911
  if (e instanceof XRPCError) {
248710
248912
  }
248711
248913
  return e;
248712
248914
  }
248713
248915
 
248714
248916
  // ../api/src/client/types/app/bsky/unspecced/getPopularFeedGenerators.ts
248715
- function toKnownErr97(e) {
248917
+ function toKnownErr98(e) {
248716
248918
  if (e instanceof XRPCError) {
248717
248919
  }
248718
248920
  return e;
@@ -248724,7 +248926,7 @@ var UnknownFeedError3 = class extends XRPCError {
248724
248926
  super(src3.status, src3.error, src3.message, src3.headers);
248725
248927
  }
248726
248928
  };
248727
- function toKnownErr98(e) {
248929
+ function toKnownErr99(e) {
248728
248930
  if (e instanceof XRPCError) {
248729
248931
  if (e.error === "UnknownFeed")
248730
248932
  return new UnknownFeedError3(e);
@@ -248769,6 +248971,7 @@ var AtprotoNS = class {
248769
248971
  this.repo = new RepoNS(service2);
248770
248972
  this.server = new ServerNS(service2);
248771
248973
  this.sync = new SyncNS(service2);
248974
+ this.temp = new TempNS(service2);
248772
248975
  }
248773
248976
  };
248774
248977
  var AdminNS = class {
@@ -249086,6 +249289,16 @@ var SyncNS = class {
249086
249289
  });
249087
249290
  }
249088
249291
  };
249292
+ var TempNS = class {
249293
+ constructor(service2) {
249294
+ this._service = service2;
249295
+ }
249296
+ upgradeRepoVersion(data, opts) {
249297
+ return this._service.xrpc.call("com.atproto.temp.upgradeRepoVersion", opts?.qp, data, opts).catch((e) => {
249298
+ throw toKnownErr57(e);
249299
+ });
249300
+ }
249301
+ };
249089
249302
  var AppNS = class {
249090
249303
  constructor(service2) {
249091
249304
  this._service = service2;
@@ -249111,37 +249324,37 @@ var ActorNS = class {
249111
249324
  }
249112
249325
  getPreferences(params2, opts) {
249113
249326
  return this._service.xrpc.call("app.bsky.actor.getPreferences", params2, void 0, opts).catch((e) => {
249114
- throw toKnownErr57(e);
249327
+ throw toKnownErr58(e);
249115
249328
  });
249116
249329
  }
249117
249330
  getProfile(params2, opts) {
249118
249331
  return this._service.xrpc.call("app.bsky.actor.getProfile", params2, void 0, opts).catch((e) => {
249119
- throw toKnownErr58(e);
249332
+ throw toKnownErr59(e);
249120
249333
  });
249121
249334
  }
249122
249335
  getProfiles(params2, opts) {
249123
249336
  return this._service.xrpc.call("app.bsky.actor.getProfiles", params2, void 0, opts).catch((e) => {
249124
- throw toKnownErr59(e);
249337
+ throw toKnownErr60(e);
249125
249338
  });
249126
249339
  }
249127
249340
  getSuggestions(params2, opts) {
249128
249341
  return this._service.xrpc.call("app.bsky.actor.getSuggestions", params2, void 0, opts).catch((e) => {
249129
- throw toKnownErr60(e);
249342
+ throw toKnownErr61(e);
249130
249343
  });
249131
249344
  }
249132
249345
  putPreferences(data, opts) {
249133
249346
  return this._service.xrpc.call("app.bsky.actor.putPreferences", opts?.qp, data, opts).catch((e) => {
249134
- throw toKnownErr61(e);
249347
+ throw toKnownErr62(e);
249135
249348
  });
249136
249349
  }
249137
249350
  searchActors(params2, opts) {
249138
249351
  return this._service.xrpc.call("app.bsky.actor.searchActors", params2, void 0, opts).catch((e) => {
249139
- throw toKnownErr62(e);
249352
+ throw toKnownErr63(e);
249140
249353
  });
249141
249354
  }
249142
249355
  searchActorsTypeahead(params2, opts) {
249143
249356
  return this._service.xrpc.call("app.bsky.actor.searchActorsTypeahead", params2, void 0, opts).catch((e) => {
249144
- throw toKnownErr63(e);
249357
+ throw toKnownErr64(e);
249145
249358
  });
249146
249359
  }
249147
249360
  };
@@ -249187,72 +249400,72 @@ var FeedNS = class {
249187
249400
  }
249188
249401
  describeFeedGenerator(params2, opts) {
249189
249402
  return this._service.xrpc.call("app.bsky.feed.describeFeedGenerator", params2, void 0, opts).catch((e) => {
249190
- throw toKnownErr64(e);
249403
+ throw toKnownErr65(e);
249191
249404
  });
249192
249405
  }
249193
249406
  getActorFeeds(params2, opts) {
249194
249407
  return this._service.xrpc.call("app.bsky.feed.getActorFeeds", params2, void 0, opts).catch((e) => {
249195
- throw toKnownErr65(e);
249408
+ throw toKnownErr66(e);
249196
249409
  });
249197
249410
  }
249198
249411
  getActorLikes(params2, opts) {
249199
249412
  return this._service.xrpc.call("app.bsky.feed.getActorLikes", params2, void 0, opts).catch((e) => {
249200
- throw toKnownErr66(e);
249413
+ throw toKnownErr67(e);
249201
249414
  });
249202
249415
  }
249203
249416
  getAuthorFeed(params2, opts) {
249204
249417
  return this._service.xrpc.call("app.bsky.feed.getAuthorFeed", params2, void 0, opts).catch((e) => {
249205
- throw toKnownErr67(e);
249418
+ throw toKnownErr68(e);
249206
249419
  });
249207
249420
  }
249208
249421
  getFeed(params2, opts) {
249209
249422
  return this._service.xrpc.call("app.bsky.feed.getFeed", params2, void 0, opts).catch((e) => {
249210
- throw toKnownErr68(e);
249423
+ throw toKnownErr69(e);
249211
249424
  });
249212
249425
  }
249213
249426
  getFeedGenerator(params2, opts) {
249214
249427
  return this._service.xrpc.call("app.bsky.feed.getFeedGenerator", params2, void 0, opts).catch((e) => {
249215
- throw toKnownErr69(e);
249428
+ throw toKnownErr70(e);
249216
249429
  });
249217
249430
  }
249218
249431
  getFeedGenerators(params2, opts) {
249219
249432
  return this._service.xrpc.call("app.bsky.feed.getFeedGenerators", params2, void 0, opts).catch((e) => {
249220
- throw toKnownErr70(e);
249433
+ throw toKnownErr71(e);
249221
249434
  });
249222
249435
  }
249223
249436
  getFeedSkeleton(params2, opts) {
249224
249437
  return this._service.xrpc.call("app.bsky.feed.getFeedSkeleton", params2, void 0, opts).catch((e) => {
249225
- throw toKnownErr71(e);
249438
+ throw toKnownErr72(e);
249226
249439
  });
249227
249440
  }
249228
249441
  getLikes(params2, opts) {
249229
249442
  return this._service.xrpc.call("app.bsky.feed.getLikes", params2, void 0, opts).catch((e) => {
249230
- throw toKnownErr72(e);
249443
+ throw toKnownErr73(e);
249231
249444
  });
249232
249445
  }
249233
249446
  getPostThread(params2, opts) {
249234
249447
  return this._service.xrpc.call("app.bsky.feed.getPostThread", params2, void 0, opts).catch((e) => {
249235
- throw toKnownErr73(e);
249448
+ throw toKnownErr74(e);
249236
249449
  });
249237
249450
  }
249238
249451
  getPosts(params2, opts) {
249239
249452
  return this._service.xrpc.call("app.bsky.feed.getPosts", params2, void 0, opts).catch((e) => {
249240
- throw toKnownErr74(e);
249453
+ throw toKnownErr75(e);
249241
249454
  });
249242
249455
  }
249243
249456
  getRepostedBy(params2, opts) {
249244
249457
  return this._service.xrpc.call("app.bsky.feed.getRepostedBy", params2, void 0, opts).catch((e) => {
249245
- throw toKnownErr75(e);
249458
+ throw toKnownErr76(e);
249246
249459
  });
249247
249460
  }
249248
249461
  getSuggestedFeeds(params2, opts) {
249249
249462
  return this._service.xrpc.call("app.bsky.feed.getSuggestedFeeds", params2, void 0, opts).catch((e) => {
249250
- throw toKnownErr76(e);
249463
+ throw toKnownErr77(e);
249251
249464
  });
249252
249465
  }
249253
249466
  getTimeline(params2, opts) {
249254
249467
  return this._service.xrpc.call("app.bsky.feed.getTimeline", params2, void 0, opts).catch((e) => {
249255
- throw toKnownErr77(e);
249468
+ throw toKnownErr78(e);
249256
249469
  });
249257
249470
  }
249258
249471
  };
@@ -249375,67 +249588,67 @@ var GraphNS = class {
249375
249588
  }
249376
249589
  getBlocks(params2, opts) {
249377
249590
  return this._service.xrpc.call("app.bsky.graph.getBlocks", params2, void 0, opts).catch((e) => {
249378
- throw toKnownErr78(e);
249591
+ throw toKnownErr79(e);
249379
249592
  });
249380
249593
  }
249381
249594
  getFollowers(params2, opts) {
249382
249595
  return this._service.xrpc.call("app.bsky.graph.getFollowers", params2, void 0, opts).catch((e) => {
249383
- throw toKnownErr79(e);
249596
+ throw toKnownErr80(e);
249384
249597
  });
249385
249598
  }
249386
249599
  getFollows(params2, opts) {
249387
249600
  return this._service.xrpc.call("app.bsky.graph.getFollows", params2, void 0, opts).catch((e) => {
249388
- throw toKnownErr80(e);
249601
+ throw toKnownErr81(e);
249389
249602
  });
249390
249603
  }
249391
249604
  getList(params2, opts) {
249392
249605
  return this._service.xrpc.call("app.bsky.graph.getList", params2, void 0, opts).catch((e) => {
249393
- throw toKnownErr81(e);
249606
+ throw toKnownErr82(e);
249394
249607
  });
249395
249608
  }
249396
249609
  getListBlocks(params2, opts) {
249397
249610
  return this._service.xrpc.call("app.bsky.graph.getListBlocks", params2, void 0, opts).catch((e) => {
249398
- throw toKnownErr82(e);
249611
+ throw toKnownErr83(e);
249399
249612
  });
249400
249613
  }
249401
249614
  getListMutes(params2, opts) {
249402
249615
  return this._service.xrpc.call("app.bsky.graph.getListMutes", params2, void 0, opts).catch((e) => {
249403
- throw toKnownErr83(e);
249616
+ throw toKnownErr84(e);
249404
249617
  });
249405
249618
  }
249406
249619
  getLists(params2, opts) {
249407
249620
  return this._service.xrpc.call("app.bsky.graph.getLists", params2, void 0, opts).catch((e) => {
249408
- throw toKnownErr84(e);
249621
+ throw toKnownErr85(e);
249409
249622
  });
249410
249623
  }
249411
249624
  getMutes(params2, opts) {
249412
249625
  return this._service.xrpc.call("app.bsky.graph.getMutes", params2, void 0, opts).catch((e) => {
249413
- throw toKnownErr85(e);
249626
+ throw toKnownErr86(e);
249414
249627
  });
249415
249628
  }
249416
249629
  getSuggestedFollowsByActor(params2, opts) {
249417
249630
  return this._service.xrpc.call("app.bsky.graph.getSuggestedFollowsByActor", params2, void 0, opts).catch((e) => {
249418
- throw toKnownErr86(e);
249631
+ throw toKnownErr87(e);
249419
249632
  });
249420
249633
  }
249421
249634
  muteActor(data, opts) {
249422
249635
  return this._service.xrpc.call("app.bsky.graph.muteActor", opts?.qp, data, opts).catch((e) => {
249423
- throw toKnownErr87(e);
249636
+ throw toKnownErr88(e);
249424
249637
  });
249425
249638
  }
249426
249639
  muteActorList(data, opts) {
249427
249640
  return this._service.xrpc.call("app.bsky.graph.muteActorList", opts?.qp, data, opts).catch((e) => {
249428
- throw toKnownErr88(e);
249641
+ throw toKnownErr89(e);
249429
249642
  });
249430
249643
  }
249431
249644
  unmuteActor(data, opts) {
249432
249645
  return this._service.xrpc.call("app.bsky.graph.unmuteActor", opts?.qp, data, opts).catch((e) => {
249433
- throw toKnownErr89(e);
249646
+ throw toKnownErr90(e);
249434
249647
  });
249435
249648
  }
249436
249649
  unmuteActorList(data, opts) {
249437
249650
  return this._service.xrpc.call("app.bsky.graph.unmuteActorList", opts?.qp, data, opts).catch((e) => {
249438
- throw toKnownErr90(e);
249651
+ throw toKnownErr91(e);
249439
249652
  });
249440
249653
  }
249441
249654
  };
@@ -249580,22 +249793,22 @@ var NotificationNS = class {
249580
249793
  }
249581
249794
  getUnreadCount(params2, opts) {
249582
249795
  return this._service.xrpc.call("app.bsky.notification.getUnreadCount", params2, void 0, opts).catch((e) => {
249583
- throw toKnownErr91(e);
249796
+ throw toKnownErr92(e);
249584
249797
  });
249585
249798
  }
249586
249799
  listNotifications(params2, opts) {
249587
249800
  return this._service.xrpc.call("app.bsky.notification.listNotifications", params2, void 0, opts).catch((e) => {
249588
- throw toKnownErr92(e);
249801
+ throw toKnownErr93(e);
249589
249802
  });
249590
249803
  }
249591
249804
  registerPush(data, opts) {
249592
249805
  return this._service.xrpc.call("app.bsky.notification.registerPush", opts?.qp, data, opts).catch((e) => {
249593
- throw toKnownErr93(e);
249806
+ throw toKnownErr94(e);
249594
249807
  });
249595
249808
  }
249596
249809
  updateSeen(data, opts) {
249597
249810
  return this._service.xrpc.call("app.bsky.notification.updateSeen", opts?.qp, data, opts).catch((e) => {
249598
- throw toKnownErr94(e);
249811
+ throw toKnownErr95(e);
249599
249812
  });
249600
249813
  }
249601
249814
  };
@@ -249610,22 +249823,22 @@ var UnspeccedNS = class {
249610
249823
  }
249611
249824
  applyLabels(data, opts) {
249612
249825
  return this._service.xrpc.call("app.bsky.unspecced.applyLabels", opts?.qp, data, opts).catch((e) => {
249613
- throw toKnownErr95(e);
249826
+ throw toKnownErr96(e);
249614
249827
  });
249615
249828
  }
249616
249829
  getPopular(params2, opts) {
249617
249830
  return this._service.xrpc.call("app.bsky.unspecced.getPopular", params2, void 0, opts).catch((e) => {
249618
- throw toKnownErr96(e);
249831
+ throw toKnownErr97(e);
249619
249832
  });
249620
249833
  }
249621
249834
  getPopularFeedGenerators(params2, opts) {
249622
249835
  return this._service.xrpc.call("app.bsky.unspecced.getPopularFeedGenerators", params2, void 0, opts).catch((e) => {
249623
- throw toKnownErr97(e);
249836
+ throw toKnownErr98(e);
249624
249837
  });
249625
249838
  }
249626
249839
  getTimelineSkeleton(params2, opts) {
249627
249840
  return this._service.xrpc.call("app.bsky.unspecced.getTimelineSkeleton", params2, void 0, opts).catch((e) => {
249628
- throw toKnownErr98(e);
249841
+ throw toKnownErr99(e);
249629
249842
  });
249630
249843
  }
249631
249844
  };
@@ -251287,6 +251500,7 @@ var AtprotoNS2 = class {
251287
251500
  this.repo = new RepoNS2(server);
251288
251501
  this.server = new ServerNS2(server);
251289
251502
  this.sync = new SyncNS2(server);
251503
+ this.temp = new TempNS2(server);
251290
251504
  }
251291
251505
  };
251292
251506
  var AdminNS2 = class {
@@ -251556,6 +251770,15 @@ var SyncNS2 = class {
251556
251770
  return this._server.xrpc.streamMethod(nsid2, cfg);
251557
251771
  }
251558
251772
  };
251773
+ var TempNS2 = class {
251774
+ constructor(server) {
251775
+ this._server = server;
251776
+ }
251777
+ upgradeRepoVersion(cfg) {
251778
+ const nsid2 = "com.atproto.temp.upgradeRepoVersion";
251779
+ return this._server.xrpc.method(nsid2, cfg);
251780
+ }
251781
+ };
251559
251782
  var AppNS2 = class {
251560
251783
  constructor(server) {
251561
251784
  this._server = server;
@@ -253156,19 +253379,20 @@ function isMain5(v) {
253156
253379
 
253157
253380
  // src/services/local/index.ts
253158
253381
  var LocalService = class {
253159
- constructor(db, signingKey, appviewAgent, appviewDid, appviewCdnUrlPattern) {
253382
+ constructor(db, signingKey, pdsHostname, appviewAgent, appviewDid, appviewCdnUrlPattern) {
253160
253383
  this.db = db;
253161
253384
  this.signingKey = signingKey;
253385
+ this.pdsHostname = pdsHostname;
253162
253386
  this.appviewAgent = appviewAgent;
253163
253387
  this.appviewDid = appviewDid;
253164
253388
  this.appviewCdnUrlPattern = appviewCdnUrlPattern;
253165
253389
  }
253166
- static creator(signingKey, appviewAgent, appviewDid, appviewCdnUrlPattern) {
253167
- return (db) => new LocalService(db, signingKey, appviewAgent, appviewDid, appviewCdnUrlPattern);
253390
+ static creator(signingKey, pdsHostname, appviewAgent, appviewDid, appviewCdnUrlPattern) {
253391
+ return (db) => new LocalService(db, signingKey, pdsHostname, appviewAgent, appviewDid, appviewCdnUrlPattern);
253168
253392
  }
253169
253393
  getImageUrl(pattern, did2, cid2) {
253170
253394
  if (!this.appviewCdnUrlPattern) {
253171
- return "";
253395
+ return `https://${this.pdsHostname}/xrpc/${ids.ComAtprotoSyncGetBlob}?did=${did2}&cid=${cid2}`;
253172
253396
  }
253173
253397
  return import_util98.default.format(this.appviewCdnUrlPattern, pattern, did2, cid2);
253174
253398
  }
@@ -253375,6 +253599,7 @@ function createServices(resources) {
253375
253599
  const {
253376
253600
  repoSigningKey,
253377
253601
  blobstore,
253602
+ pdsHostname,
253378
253603
  appViewAgent,
253379
253604
  appViewDid,
253380
253605
  appViewCdnUrlPattern,
@@ -253386,7 +253611,7 @@ function createServices(resources) {
253386
253611
  auth: AuthService.creator(),
253387
253612
  record: RecordService.creator(),
253388
253613
  repo: RepoService.creator(repoSigningKey, blobstore, backgroundQueue, crawlers),
253389
- local: LocalService.creator(repoSigningKey, appViewAgent, appViewDid, appViewCdnUrlPattern),
253614
+ local: LocalService.creator(repoSigningKey, pdsHostname, appViewAgent, appViewDid, appViewCdnUrlPattern),
253390
253615
  moderation: ModerationService.creator(blobstore)
253391
253616
  };
253392
253617
  }
@@ -254889,6 +255114,7 @@ var AppContext = class {
254889
255114
  repoSigningKey,
254890
255115
  blobstore,
254891
255116
  appViewAgent,
255117
+ pdsHostname: cfg.service.hostname,
254892
255118
  appViewDid: cfg.bskyAppView.did,
254893
255119
  appViewCdnUrlPattern: cfg.bskyAppView.cdnUrlPattern,
254894
255120
  backgroundQueue,