route to get delta ids

This commit is contained in:
Ladd Hoffman 2024-12-30 01:32:51 -06:00
parent 198c996231
commit 940c3212be
2 changed files with 36 additions and 30 deletions

View File

@ -3,39 +3,39 @@
> jest --coverage
PASS __tests__/peer-address.ts
PASS __tests__/lossless.ts
PASS __tests__/lossy.ts
PASS __tests__/lossless.ts
PASS __tests__/run/001-single-node.ts
PASS __tests__/run/002-two-nodes.ts
----------------------|---------|----------|---------|---------|----------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------------------|---------|----------|---------|---------|----------------------------
All files | 87.12 | 61.48 | 83.91 | 87.54 |
src | 93.04 | 82.02 | 92 | 93.18 |
collection.ts | 89.47 | 66.66 | 80 | 91.54 | 59-67,99,139
config.ts | 94.44 | 89.65 | 50 | 94.44 | 22
delta.ts | 100 | 100 | 100 | 100 |
deltas.ts | 66.66 | 60 | 78.57 | 66.66 | 33-36,48-52,61-62,70-79
lossless.ts | 100 | 100 | 100 | 100 |
lossy.ts | 100 | 85.71 | 100 | 100 | 48
node.ts | 100 | 100 | 100 | 100 |
peers.ts | 96.82 | 100 | 100 | 96.61 | 126-127
pub-sub.ts | 100 | 100 | 100 | 100 |
request-reply.ts | 95.65 | 0 | 100 | 95.34 | 46,59
typed-collection.ts | 100 | 100 | 100 | 100 |
types.ts | 100 | 100 | 100 | 100 |
src/http | 66.25 | 13.04 | 52.17 | 66.66 |
api.ts | 56.41 | 0 | 42.85 | 56.75 | 15,20,27-43,49,66-67,82-88
html.ts | 56.52 | 0 | 40 | 56.52 | 17-18,23-30,35
index.ts | 100 | 75 | 100 | 100 | 36
src/util | 70.68 | 30.43 | 77.77 | 73.58 |
md-files.ts | 70.68 | 30.43 | 77.77 | 73.58 | 53-57,74-77,98-102,116-123
util | 100 | 100 | 100 | 100 |
app.ts | 100 | 100 | 100 | 100 |
----------------------|---------|----------|---------|---------|----------------------------
-------------------|---------|----------|---------|---------|----------------------------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------|---------|----------|---------|---------|----------------------------------------------------
All files | 81.01 | 72.28 | 77.4 | 85.03 |
src | 86.71 | 79.89 | 83.67 | 91.2 |
collection.ts | 79.54 | 68.18 | 76 | 82.92 | 10,60,69,113-120,125,128,139,142,146,173,180
config.ts | 95 | 89.65 | 50 | 95 | 24
delta.ts | 95 | 83.33 | 100 | 95 | 31
deltas.ts | 68.65 | 70.96 | 78.26 | 72.58 | 6,43-46,57-61,69-70,77-85
lossless.ts | 93.02 | 90.24 | 92.85 | 93.02 | 36-40,56,113
lossy.ts | 97.29 | 81.81 | 100 | 97.29 | 36
node.ts | 91.07 | 85 | 88.23 | 97.87 | 6
peers.ts | 91.86 | 88.46 | 93.54 | 96.1 | 6,121-122
pub-sub.ts | 81.81 | 69.44 | 73.07 | 93.65 | 6,15-16,51
request-reply.ts | 81.17 | 68.42 | 75.86 | 91.54 | 6,15-16,58,72,100
transactions.ts | 98.11 | 95.55 | 93.33 | 98 | 99
types.ts | 100 | 100 | 100 | 100 |
src/http | 55.72 | 47.45 | 50 | 59.66 |
api.ts | 43.66 | 31.42 | 42.3 | 45.31 | 6,22,26,31-48,53,67-68,81-120
html.ts | 60 | 0 | 40 | 60 | 17-18,22-29,33
index.ts | 77.14 | 77.27 | 69.23 | 90 | 3,5-6
src/util | 72.16 | 53.52 | 75 | 72.94 |
md-files.ts | 72.16 | 53.52 | 75 | 72.94 | 10-11,16,21-23,74-78,92-95,108,110,114-118,131-138
util | 100 | 100 | 100 | 100 |
app.ts | 100 | 100 | 100 | 100 |
-------------------|---------|----------|---------|---------|----------------------------------------------------
Test Suites: 5 passed, 5 total
Tests: 7 passed, 7 total
Test Suites: 1 skipped, 5 passed, 5 of 6 total
Tests: 2 skipped, 7 passed, 9 total
Snapshots: 0 total
Time: 4.47 s
Time: 4.51 s, estimated 5 s
Ran all test suites.

View File

@ -15,6 +15,12 @@ export class HttpApi {
res.json(this.rhizomeNode.deltaStream.deltasAccepted);
});
this.router.get("/delta/ids", (_req: express.Request, res: express.Response) => {
res.json({
ids: this.rhizomeNode.deltaStream.deltasAccepted.map(({id}) => id)
});
});
// Get the number of deltas ingested by this node
this.router.get("/deltas/count", (_req: express.Request, res: express.Response) => {
res.json(this.rhizomeNode.deltaStream.deltasAccepted.length);