Add Zapier interface simulator, tree-node Merkle lookups, and user docs
Some checks are pending
offline / test (push) Waiting to run
Some checks are pending
offline / test (push) Waiting to run
In-process trace console validates hops, faults, recoveries, and suggested changes before zapier-platform push. User guide covers signup through central-chain and bulk-summary tree-node hash lookup.
This commit is contained in:
parent
3daa88866d
commit
f3dc0e6eee
56 changed files with 2341 additions and 8 deletions
|
|
@ -41,13 +41,26 @@ export function aggregateAttached({ sha256, tenantId, kinds = ['publicMeta', 'pr
|
|||
* @param {object[]} archiveRecords
|
||||
*/
|
||||
export function mergeReceipts(chainReceipts, archiveRecords) {
|
||||
const extra = archiveRecords
|
||||
.filter((r) => r.kind === 'publicMeta' || r.kind === 'privateMeta' || r.kind === 'file')
|
||||
.map((r) => ({
|
||||
const extra = archiveRecords.map((r) => {
|
||||
if (r.kind === 'tree') {
|
||||
return {
|
||||
kind: 'tree-leaf',
|
||||
archiveId: r.archiveId,
|
||||
attachedAt: r.storedAt,
|
||||
itemizedOnMainChain: false,
|
||||
merkleRoot: r.record?.merkleRoot,
|
||||
proof: r.record?.proof,
|
||||
leafIndex: r.record?.leafIndex,
|
||||
chainSealJobId: r.record?.chainSealJobId,
|
||||
...r.record,
|
||||
};
|
||||
}
|
||||
return {
|
||||
kind: r.kind === 'file' ? 'file-attach' : 'metadata-attach',
|
||||
archiveId: r.archiveId,
|
||||
attachedAt: r.storedAt,
|
||||
...r.record,
|
||||
}));
|
||||
};
|
||||
});
|
||||
return [...chainReceipts, ...extra];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,4 +25,20 @@ describe('aggregateAttached', () => {
|
|||
assert.equal(merged[0].kind, 'seal');
|
||||
assert.equal(merged[1].kind, 'metadata-attach');
|
||||
});
|
||||
|
||||
it('merges tree-leaf receipts from bulk summaries', () => {
|
||||
const seal = [{ kind: 'seal', of: 'merkleRoot', sha256: 'aa'.repeat(32) }];
|
||||
const recs = [
|
||||
{
|
||||
kind: 'tree',
|
||||
archiveId: 'tree-node-east',
|
||||
storedAt: '2026-01-02T00:00:00Z',
|
||||
record: { merkleRoot: 'aa'.repeat(32), leafIndex: 1, proof: [] },
|
||||
},
|
||||
];
|
||||
const merged = mergeReceipts(seal, recs);
|
||||
assert.equal(merged[1].kind, 'tree-leaf');
|
||||
assert.equal(merged[1].itemizedOnMainChain, false);
|
||||
assert.equal(merged[1].archiveId, 'tree-node-east');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue