@atproto/repo 0.1.0 → 0.3.0

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 (49) hide show
  1. package/dist/block-map.d.ts +2 -0
  2. package/dist/data-diff.d.ts +12 -10
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +12388 -4431
  5. package/dist/index.js.map +4 -4
  6. package/dist/mst/mst.d.ts +19 -16
  7. package/dist/readable-repo.d.ts +4 -3
  8. package/dist/repo.d.ts +3 -2
  9. package/dist/storage/index.d.ts +0 -1
  10. package/dist/storage/memory-blockstore.d.ts +6 -10
  11. package/dist/storage/types.d.ts +29 -0
  12. package/dist/sync/consumer.d.ts +13 -16
  13. package/dist/sync/provider.d.ts +2 -6
  14. package/dist/types.d.ts +236 -48
  15. package/dist/util.d.ts +9 -7
  16. package/jest.bench.config.js +2 -1
  17. package/package.json +12 -7
  18. package/src/block-map.ts +8 -0
  19. package/src/data-diff.ts +47 -49
  20. package/src/index.ts +1 -1
  21. package/src/mst/diff.ts +14 -36
  22. package/src/mst/mst.ts +15 -14
  23. package/src/readable-repo.ts +5 -5
  24. package/src/repo.ts +50 -40
  25. package/src/storage/index.ts +0 -1
  26. package/src/storage/memory-blockstore.ts +19 -59
  27. package/src/storage/types.ts +30 -0
  28. package/src/sync/consumer.ts +170 -113
  29. package/src/sync/provider.ts +6 -44
  30. package/src/types.ts +49 -25
  31. package/src/util.ts +57 -91
  32. package/tests/_util.ts +38 -67
  33. package/tests/mst.test.ts +4 -1
  34. package/tests/{sync/narrow.test.ts → proofs.test.ts} +14 -21
  35. package/tests/repo.test.ts +5 -4
  36. package/tests/sync.test.ts +97 -0
  37. package/tests/util.test.ts +21 -0
  38. package/tsconfig.build.tsbuildinfo +1 -1
  39. package/tsconfig.json +1 -1
  40. package/dist/blockstore/index.d.ts +0 -2
  41. package/dist/blockstore/ipld-store.d.ts +0 -27
  42. package/dist/blockstore/memory-blockstore.d.ts +0 -13
  43. package/dist/storage/repo-storage.d.ts +0 -18
  44. package/dist/sync.d.ts +0 -9
  45. package/dist/verify.d.ts +0 -27
  46. package/src/storage/repo-storage.ts +0 -42
  47. package/src/verify.ts +0 -227
  48. package/tests/sync/checkout.test.ts +0 -57
  49. package/tests/sync/diff.test.ts +0 -87
@@ -5,6 +5,7 @@ export declare class BlockMap {
5
5
  add(value: LexValue): Promise<CID>;
6
6
  set(cid: CID, bytes: Uint8Array): void;
7
7
  get(cid: CID): Uint8Array | undefined;
8
+ delete(cid: CID): void;
8
9
  getMany(cids: CID[]): {
9
10
  blocks: BlockMap;
10
11
  missing: CID[];
@@ -13,6 +14,7 @@ export declare class BlockMap {
13
14
  clear(): void;
14
15
  forEach(cb: (bytes: Uint8Array, cid: CID) => void): void;
15
16
  entries(): Entry[];
17
+ cids(): CID[];
16
18
  addMap(toAdd: BlockMap): void;
17
19
  get size(): number;
18
20
  get byteSize(): number;
@@ -1,23 +1,25 @@
1
1
  import { CID } from 'multiformats';
2
2
  import CidSet from './cid-set';
3
- import { DataStore } from './types';
3
+ import { MST, NodeEntry } from './mst';
4
+ import BlockMap from './block-map';
4
5
  export declare class DataDiff {
5
6
  adds: Record<string, DataAdd>;
6
7
  updates: Record<string, DataUpdate>;
7
8
  deletes: Record<string, DataDelete>;
8
- newCids: CidSet;
9
+ newMstBlocks: BlockMap;
10
+ newLeafCids: CidSet;
9
11
  removedCids: CidSet;
10
- static of(curr: DataStore, prev: DataStore | null): Promise<DataDiff>;
11
- recordAdd(key: string, cid: CID): void;
12
- recordUpdate(key: string, prev: CID, cid: CID): void;
13
- recordDelete(key: string, cid: CID): void;
14
- recordNewCid(cid: CID): void;
15
- recordRemovedCid(cid: CID): void;
16
- addDiff(diff: DataDiff): void;
12
+ static of(curr: MST, prev: MST | null): Promise<DataDiff>;
13
+ nodeAdd(node: NodeEntry): Promise<void>;
14
+ nodeDelete(node: NodeEntry): Promise<void>;
15
+ leafAdd(key: string, cid: CID): void;
16
+ leafUpdate(key: string, prev: CID, cid: CID): void;
17
+ leafDelete(key: string, cid: CID): void;
18
+ treeAdd(cid: CID, bytes: Uint8Array): void;
19
+ treeDelete(cid: CID): void;
17
20
  addList(): DataAdd[];
18
21
  updateList(): DataUpdate[];
19
22
  deleteList(): DataDelete[];
20
- newCidList(): CID[];
21
23
  updatedKeys(): string[];
22
24
  }
23
25
  export declare type DataAdd = {
package/dist/index.d.ts CHANGED
@@ -5,5 +5,5 @@ export * from './mst';
5
5
  export * from './storage';
6
6
  export * from './sync';
7
7
  export * from './types';
8
- export * from './verify';
8
+ export * from './data-diff';
9
9
  export * from './util';