@getcirrus/pds 0.10.3 → 0.10.5
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.d.ts +17 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +69 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -105,6 +105,18 @@ declare class SqliteRepoStorage extends ReadableBlockstore implements RepoStorag
|
|
|
105
105
|
* Set the email address.
|
|
106
106
|
*/
|
|
107
107
|
setEmail(email: string): void;
|
|
108
|
+
/**
|
|
109
|
+
* Get all cached collection names.
|
|
110
|
+
*/
|
|
111
|
+
getCollections(): string[];
|
|
112
|
+
/**
|
|
113
|
+
* Add a collection name to the cache (no-op if already present).
|
|
114
|
+
*/
|
|
115
|
+
addCollection(collection: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* Check if the collections cache has been populated.
|
|
118
|
+
*/
|
|
119
|
+
hasCollections(): boolean;
|
|
108
120
|
/**
|
|
109
121
|
* Add a blob reference from a record.
|
|
110
122
|
*/
|
|
@@ -476,9 +488,9 @@ declare class AccountDurableObject extends DurableObject<PDSEnv> {
|
|
|
476
488
|
rev: string;
|
|
477
489
|
}>;
|
|
478
490
|
/**
|
|
479
|
-
* RPC
|
|
491
|
+
* Handle streaming getRepo via fetch (not RPC, to enable streaming response).
|
|
480
492
|
*/
|
|
481
|
-
|
|
493
|
+
private handleGetRepo;
|
|
482
494
|
/**
|
|
483
495
|
* RPC method: Get specific blocks by CID as CAR file
|
|
484
496
|
* Used for partial sync and migration.
|
|
@@ -703,8 +715,9 @@ declare class AccountDurableObject extends DurableObject<PDSEnv> {
|
|
|
703
715
|
/** Consume a WebAuthn challenge (single-use) */
|
|
704
716
|
rpcConsumeWebAuthnChallenge(challenge: string): Promise<boolean>;
|
|
705
717
|
/**
|
|
706
|
-
* HTTP fetch handler for WebSocket upgrades.
|
|
707
|
-
*
|
|
718
|
+
* HTTP fetch handler for WebSocket upgrades and streaming responses.
|
|
719
|
+
* Used instead of RPC when the response can't be serialized (WebSocket)
|
|
720
|
+
* or when streaming is needed to avoid buffering large payloads (getRepo).
|
|
708
721
|
*/
|
|
709
722
|
fetch(request: Request): Promise<Response>;
|
|
710
723
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/storage.ts","../src/oauth-storage.ts","../src/blobs.ts","../src/types.ts","../src/account-do.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;cAUa,iBAAA,SACJ,kBAAA,YACG;EAFC,QAAA,GAAA;EAIa,WAAA,CAAA,GAAA,EAAA,UAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/storage.ts","../src/oauth-storage.ts","../src/blobs.ts","../src/types.ts","../src/account-do.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;cAUa,iBAAA,SACJ,kBAAA,YACG;EAFC,QAAA,GAAA;EAIa,WAAA,CAAA,GAAA,EAAA,UAAA;EAwGA;;;;EAiCR,UAAA,CAAA,aAAA,CAAA,EAAA,OAAA,CAAA,EAAA,IAAA;EAQG;;;EAcL,OAAA,CAAA,CAAA,EAvDE,OAuDF,CAvDU,GAuDV,GAAA,IAAA,CAAA;EAAM;;;EAU8C,MAAA,CAAA,CAAA,EApDnD,OAoDmD,CAAA,MAAA,GAAA,IAAA,CAAA;EAArC;;;EAmB4B,MAAA,CAAA,CAAA,EA7D1C,OA6D0C,CAAA,MAAA,CAAA;EAYpC;;;EAoBmB,OAAA,CAAA,CAAA,EAnFxB,OAmFwB,CAAA,MAAA,CAAA;EAWf;;;EA6CT,QAAA,CAAA,GAAA,EAnIG,GAmIH,CAAA,EAnIS,OAmIT,CAnIiB,UAmIjB,GAAA,IAAA,CAAA;EAUI;;;EAoCF,GAAA,CAAA,GAAA,EAnKJ,GAmKI,CAAA,E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@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DurableObject, env, waitUntil } from "cloudflare:workers";
|
|
2
|
-
import { BlockMap, ReadableBlockstore, Repo, WriteOpAction, blocksToCarFile, getRecords, readCarWithRoot } from "@atproto/repo";
|
|
2
|
+
import { BlockMap, ReadableBlockstore, Repo, WriteOpAction, blocksToCarFile, getRecords, readCarWithRoot, writeCarStream } from "@atproto/repo";
|
|
3
3
|
import { Secp256k1Keypair, randomStr, verifySignature } from "@atproto/crypto";
|
|
4
4
|
import { CID, asCid, isBlobRef } from "@atproto/lex-data";
|
|
5
5
|
import { now } from "@atcute/tid";
|
|
@@ -172,6 +172,11 @@ var SqliteRepoStorage = class extends ReadableBlockstore {
|
|
|
172
172
|
createdAt TEXT NOT NULL DEFAULT (datetime('now'))
|
|
173
173
|
);
|
|
174
174
|
|
|
175
|
+
-- Collection name cache (for describeRepo)
|
|
176
|
+
CREATE TABLE IF NOT EXISTS collections (
|
|
177
|
+
collection TEXT PRIMARY KEY
|
|
178
|
+
);
|
|
179
|
+
|
|
175
180
|
-- Passkey credentials (WebAuthn)
|
|
176
181
|
CREATE TABLE IF NOT EXISTS passkeys (
|
|
177
182
|
credential_id TEXT PRIMARY KEY,
|
|
@@ -350,6 +355,24 @@ var SqliteRepoStorage = class extends ReadableBlockstore {
|
|
|
350
355
|
this.sql.exec("UPDATE repo_state SET email = ? WHERE id = 1", email);
|
|
351
356
|
}
|
|
352
357
|
/**
|
|
358
|
+
* Get all cached collection names.
|
|
359
|
+
*/
|
|
360
|
+
getCollections() {
|
|
361
|
+
return this.sql.exec("SELECT collection FROM collections ORDER BY collection").toArray().map((row) => row.collection);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Add a collection name to the cache (no-op if already present).
|
|
365
|
+
*/
|
|
366
|
+
addCollection(collection) {
|
|
367
|
+
this.sql.exec("INSERT OR IGNORE INTO collections (collection) VALUES (?)", collection);
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Check if the collections cache has been populated.
|
|
371
|
+
*/
|
|
372
|
+
hasCollections() {
|
|
373
|
+
return this.sql.exec("SELECT 1 FROM collections LIMIT 1").toArray().length > 0;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
353
376
|
* Add a blob reference from a record.
|
|
354
377
|
*/
|
|
355
378
|
addRecordBlob(recordUri, blobCid) {
|
|
@@ -1033,15 +1056,17 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1033
1056
|
*/
|
|
1034
1057
|
async rpcDescribeRepo() {
|
|
1035
1058
|
const repo = await this.getRepo();
|
|
1036
|
-
const
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1059
|
+
const storage = await this.getStorage();
|
|
1060
|
+
if (!storage.hasCollections() && await storage.getRoot()) {
|
|
1061
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1062
|
+
for await (const record of repo.walkRecords()) if (!seen.has(record.collection)) {
|
|
1063
|
+
seen.add(record.collection);
|
|
1064
|
+
storage.addCollection(record.collection);
|
|
1065
|
+
}
|
|
1041
1066
|
}
|
|
1042
1067
|
return {
|
|
1043
1068
|
did: repo.did,
|
|
1044
|
-
collections,
|
|
1069
|
+
collections: storage.getCollections(),
|
|
1045
1070
|
cid: repo.cid.toString()
|
|
1046
1071
|
};
|
|
1047
1072
|
}
|
|
@@ -1106,6 +1131,7 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1106
1131
|
const dataKey = `${collection}/${actualRkey}`;
|
|
1107
1132
|
const recordCid = await this.repo.data.get(dataKey);
|
|
1108
1133
|
if (!recordCid) throw new Error(`Failed to create record: ${collection}/${actualRkey}`);
|
|
1134
|
+
this.storage.addCollection(collection);
|
|
1109
1135
|
if (this.sequencer) {
|
|
1110
1136
|
const newBlocks = new BlockMap();
|
|
1111
1137
|
const rows = this.ctx.storage.sql.exec("SELECT cid, bytes FROM blocks WHERE rev = ?", this.repo.commit.rev).toArray();
|
|
@@ -1203,6 +1229,7 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1203
1229
|
const dataKey = `${collection}/${rkey}`;
|
|
1204
1230
|
const recordCid = await this.repo.data.get(dataKey);
|
|
1205
1231
|
if (!recordCid) throw new Error(`Failed to put record: ${collection}/${rkey}`);
|
|
1232
|
+
this.storage.addCollection(collection);
|
|
1206
1233
|
if (this.sequencer) {
|
|
1207
1234
|
const newBlocks = new BlockMap();
|
|
1208
1235
|
const rows = this.ctx.storage.sql.exec("SELECT cid, bytes FROM blocks WHERE rev = ?", this.repo.commit.rev).toArray();
|
|
@@ -1292,6 +1319,7 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1292
1319
|
} else throw new Error(`Unknown write type: ${write.$type}`);
|
|
1293
1320
|
const prevRev = repo.commit.rev;
|
|
1294
1321
|
this.repo = await repo.applyWrites(ops, keypair);
|
|
1322
|
+
for (const op of ops) if (op.action !== WriteOpAction.Delete) this.storage.addCollection(op.collection);
|
|
1295
1323
|
const finalResults = [];
|
|
1296
1324
|
const opsWithCids = [];
|
|
1297
1325
|
for (let i = 0; i < results.length; i++) {
|
|
@@ -1354,19 +1382,28 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1354
1382
|
};
|
|
1355
1383
|
}
|
|
1356
1384
|
/**
|
|
1357
|
-
* RPC
|
|
1385
|
+
* Handle streaming getRepo via fetch (not RPC, to enable streaming response).
|
|
1358
1386
|
*/
|
|
1359
|
-
async
|
|
1387
|
+
async handleGetRepo() {
|
|
1360
1388
|
const root = await (await this.getStorage()).getRoot();
|
|
1361
|
-
if (!root)
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1389
|
+
if (!root) return Response.json({
|
|
1390
|
+
error: "RepoNotFound",
|
|
1391
|
+
message: "No repository root found"
|
|
1392
|
+
}, { status: 404 });
|
|
1393
|
+
const cursor = this.ctx.storage.sql.exec("SELECT cid, bytes FROM blocks");
|
|
1394
|
+
async function* blocks() {
|
|
1395
|
+
for (const row of cursor) yield {
|
|
1396
|
+
cid: CID.parse(row.cid),
|
|
1397
|
+
bytes: new Uint8Array(row.bytes)
|
|
1398
|
+
};
|
|
1368
1399
|
}
|
|
1369
|
-
|
|
1400
|
+
const carIter = writeCarStream(root, blocks())[Symbol.asyncIterator]();
|
|
1401
|
+
const stream = new ReadableStream({ async pull(controller) {
|
|
1402
|
+
const { value, done } = await carIter.next();
|
|
1403
|
+
if (done) controller.close();
|
|
1404
|
+
else controller.enqueue(value);
|
|
1405
|
+
} });
|
|
1406
|
+
return new Response(stream, { headers: { "Content-Type": "application/vnd.ipld.car" } });
|
|
1370
1407
|
}
|
|
1371
1408
|
/**
|
|
1372
1409
|
* RPC method: Get specific blocks by CID as CAR file
|
|
@@ -1434,7 +1471,12 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1434
1471
|
throw new Error(`DID mismatch: CAR file contains DID ${this.repo.did}, but expected ${this.env.DID}`);
|
|
1435
1472
|
}
|
|
1436
1473
|
this.repoInitialized = true;
|
|
1474
|
+
const seenCollections = /* @__PURE__ */ new Set();
|
|
1437
1475
|
for await (const record of this.repo.walkRecords()) {
|
|
1476
|
+
if (!seenCollections.has(record.collection)) {
|
|
1477
|
+
seenCollections.add(record.collection);
|
|
1478
|
+
this.storage.addCollection(record.collection);
|
|
1479
|
+
}
|
|
1438
1480
|
const blobCids = extractBlobCids(record.record);
|
|
1439
1481
|
if (blobCids.length > 0) {
|
|
1440
1482
|
const uri = `at://${this.repo.did}/${record.collection}/${record.rkey}`;
|
|
@@ -1827,11 +1869,14 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1827
1869
|
return (await this.getOAuthStorage()).consumeWebAuthnChallenge(challenge);
|
|
1828
1870
|
}
|
|
1829
1871
|
/**
|
|
1830
|
-
* HTTP fetch handler for WebSocket upgrades.
|
|
1831
|
-
*
|
|
1872
|
+
* HTTP fetch handler for WebSocket upgrades and streaming responses.
|
|
1873
|
+
* Used instead of RPC when the response can't be serialized (WebSocket)
|
|
1874
|
+
* or when streaming is needed to avoid buffering large payloads (getRepo).
|
|
1832
1875
|
*/
|
|
1833
1876
|
async fetch(request) {
|
|
1834
|
-
|
|
1877
|
+
const url = new URL(request.url);
|
|
1878
|
+
if (url.pathname === "/xrpc/com.atproto.sync.subscribeRepos") return this.handleFirehoseUpgrade(request);
|
|
1879
|
+
if (url.pathname === "/xrpc/com.atproto.sync.getRepo") return this.handleGetRepo();
|
|
1835
1880
|
return new Response("Method not allowed", { status: 405 });
|
|
1836
1881
|
}
|
|
1837
1882
|
};
|
|
@@ -2759,14 +2804,7 @@ async function getRepo(c, accountDO) {
|
|
|
2759
2804
|
error: "RepoNotFound",
|
|
2760
2805
|
message: `Repository not found for DID: ${did}`
|
|
2761
2806
|
}, 404);
|
|
2762
|
-
|
|
2763
|
-
return new Response(carBytes, {
|
|
2764
|
-
status: 200,
|
|
2765
|
-
headers: {
|
|
2766
|
-
"Content-Type": "application/vnd.ipld.car",
|
|
2767
|
-
"Content-Length": carBytes.length.toString()
|
|
2768
|
-
}
|
|
2769
|
-
});
|
|
2807
|
+
return accountDO.fetch(new Request("https://do/xrpc/com.atproto.sync.getRepo"));
|
|
2770
2808
|
}
|
|
2771
2809
|
async function getRepoStatus(c, accountDO) {
|
|
2772
2810
|
const did = c.req.query("did");
|
|
@@ -4177,7 +4215,7 @@ function renderPasskeyErrorPage(error, description) {
|
|
|
4177
4215
|
|
|
4178
4216
|
//#endregion
|
|
4179
4217
|
//#region package.json
|
|
4180
|
-
var version = "0.10.
|
|
4218
|
+
var version = "0.10.5";
|
|
4181
4219
|
|
|
4182
4220
|
//#endregion
|
|
4183
4221
|
//#region src/index.ts
|
|
@@ -4260,12 +4298,12 @@ app.get("/xrpc/_health", async (c) => {
|
|
|
4260
4298
|
await getAccountDO(c.env).rpcHealthCheck();
|
|
4261
4299
|
return c.json({
|
|
4262
4300
|
status: "ok",
|
|
4263
|
-
version
|
|
4301
|
+
version: `cirrus ${version}`
|
|
4264
4302
|
});
|
|
4265
4303
|
} catch {
|
|
4266
4304
|
return c.json({
|
|
4267
4305
|
status: "unhealthy",
|
|
4268
|
-
version
|
|
4306
|
+
version: `cirrus ${version}`
|
|
4269
4307
|
}, 503);
|
|
4270
4308
|
}
|
|
4271
4309
|
});
|