@web3-storage/pail 0.6.0-alpha.4 → 0.6.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.
package/cli.js CHANGED
@@ -2,19 +2,19 @@
2
2
  import fs from 'fs'
3
3
  import os from 'os'
4
4
  import { join } from 'path'
5
- import { Readable } from 'stream'
5
+ import { Readable, Writable } from 'stream'
6
6
  import sade from 'sade'
7
7
  import { CID } from 'multiformats/cid'
8
- import { CarIndexedReader, CarReader, CarWriter } from '@ipld/car'
8
+ import { CARReaderStream, CARWriterStream } from 'carstream'
9
9
  import clc from 'cli-color'
10
10
  import archy from 'archy'
11
11
  // eslint-disable-next-line no-unused-vars
12
12
  import * as API from './src/api.js'
13
- import { put, get, del, entries } from './src/v1/index.js'
14
- import { ShardFetcher, ShardBlock } from './src/v1/shard.js'
15
- import { MaxShardSize } from './src/shard.js'
13
+ import { put, get, del, entries } from './src/index.js'
14
+ import { ShardFetcher, ShardBlock, isShardLink } from './src/shard.js'
16
15
  import { difference } from './src/diff.js'
17
16
  import { merge } from './src/merge.js'
17
+ import { MemoryBlockstore, MultiBlockFetcher } from './src/block.js'
18
18
 
19
19
  const cli = sade('pail')
20
20
  .option('--path', 'Path to data store.', './pail.car')
@@ -22,77 +22,64 @@ const cli = sade('pail')
22
22
  cli.command('put <key> <value>')
23
23
  .describe('Put a value (a CID) for the given key. If the key exists it\'s value is overwritten.')
24
24
  .alias('set')
25
- .option('--max-shard-size', 'Maximum shard size in bytes.', MaxShardSize)
26
25
  .action(async (key, value, opts) => {
27
- const maxShardSize = opts['max-shard-size'] ?? MaxShardSize
28
- const blocks = await openPail(opts.path, { maxSize: maxShardSize })
29
- const roots = await blocks.getRoots()
30
- // @ts-expect-error
31
- const { root, additions, removals } = await put(blocks, roots[0], key, CID.parse(value))
26
+ const { root: prevRoot, blocks } = await openPail(opts.path)
27
+ const { root, additions, removals } = await put(blocks, prevRoot, key, CID.parse(value))
32
28
  await updatePail(opts.path, blocks, root, { additions, removals })
33
29
 
34
- console.log(clc.red(`--- ${roots[0]}`))
30
+ console.log(clc.red(`--- ${prevRoot}`))
35
31
  console.log(clc.green(`+++ ${root}`))
36
32
  console.log(clc.magenta('@@ -1 +1 @@'))
37
33
  additions.forEach(b => console.log(clc.green(`+${b.cid}`)))
38
34
  removals.forEach(b => console.log(clc.red(`-${b.cid}`)))
39
- await closePail(blocks)
40
35
  })
41
36
 
42
37
  cli.command('get <key>')
43
38
  .describe('Get the stored value for the given key from the pail. If the key is not found, `undefined` is returned.')
44
39
  .action(async (key, opts) => {
45
- const blocks = await openPail(opts.path)
46
- // @ts-expect-error
47
- const value = await get(blocks, (await blocks.getRoots())[0], key)
40
+ const { root, blocks } = await openPail(opts.path)
41
+ const value = await get(blocks, root, key)
48
42
  if (value) console.log(value.toString())
49
- await closePail(blocks)
50
43
  })
51
44
 
52
45
  cli.command('del <key>')
53
46
  .describe('Delete the value for the given key from the pail. If the key is not found no operation occurs.')
54
47
  .alias('delete', 'rm', 'remove')
55
48
  .action(async (key, opts) => {
56
- const blocks = await openPail(opts.path)
57
- const roots = await blocks.getRoots()
58
- // @ts-expect-error
59
- const { root, additions, removals } = await del(blocks, roots[0], key)
49
+ const { root: prevRoot, blocks } = await openPail(opts.path)
50
+ const { root, additions, removals } = await del(blocks, prevRoot, key)
60
51
  await updatePail(opts.path, blocks, root, { additions, removals })
61
52
 
62
- console.log(clc.red(`--- ${roots[0]}`))
53
+ console.log(clc.red(`--- ${prevRoot}`))
63
54
  console.log(clc.green(`+++ ${root}`))
64
55
  console.log(clc.magenta('@@ -1 +1 @@'))
65
56
  additions.forEach(b => console.log(clc.green(`+ ${b.cid}`)))
66
57
  removals.forEach(b => console.log(clc.red(`- ${b.cid}`)))
67
- await closePail(blocks)
68
58
  })
69
59
 
70
60
  cli.command('ls')
71
61
  .describe('List entries in the pail.')
72
62
  .alias('list')
73
63
  .option('-p, --prefix', 'Key prefix to filter by.')
64
+ .option('--gt', 'Filter results by keys greater than this string.')
65
+ .option('--lt', 'Filter results by keys less than this string.')
74
66
  .option('--json', 'Format output as newline delimted JSON.')
75
67
  .action(async (opts) => {
76
- const blocks = await openPail(opts.path)
77
- const root = (await blocks.getRoots())[0]
68
+ const { root, blocks } = await openPail(opts.path)
78
69
  let n = 0
79
- // @ts-expect-error
80
- for await (const [k, v] of entries(blocks, root, { prefix: opts.prefix })) {
70
+ for await (const [k, v] of entries(blocks, root, { prefix: opts.prefix, gt: opts.gt, lt: opts.lt })) {
81
71
  console.log(opts.json ? JSON.stringify({ key: k, value: v.toString() }) : `${k}\t${v}`)
82
72
  n++
83
73
  }
84
74
  if (!opts.json) console.log(`total ${n}`)
85
- await closePail(blocks)
86
75
  })
87
76
 
88
77
  cli.command('tree')
89
78
  .describe('Visualise the pail.')
79
+ .alias('vis')
90
80
  .action(async (opts) => {
91
- const blocks = await openPail(opts.path)
92
- const root = (await blocks.getRoots())[0]
93
- // @ts-expect-error
81
+ const { root, blocks } = await openPail(opts.path)
94
82
  const shards = new ShardFetcher(blocks)
95
- // @ts-expect-error
96
83
  const rshard = await shards.get(root)
97
84
 
98
85
  /** @type {archy.Data} */
@@ -119,27 +106,19 @@ cli.command('tree')
119
106
  }
120
107
 
121
108
  console.log(archy(archyRoot))
122
- await closePail(blocks)
123
109
  })
124
110
 
125
111
  cli.command('diff <path>')
126
112
  .describe('Find the differences between this pail and the passed pail.')
127
113
  .option('-k, --keys', 'Output key/value diff.')
128
114
  .action(async (path, opts) => {
129
- const [ablocks, bblocks] = await Promise.all([openPail(opts.path), openPail(path)])
130
- const [aroot, broot] = await Promise.all([ablocks, bblocks].map(async blocks => {
131
- return /** @type {API.ShardLink} */((await blocks.getRoots())[0])
132
- }))
115
+ const [
116
+ { root: aroot, blocks: ablocks },
117
+ { root: broot, blocks: bblocks }
118
+ ] = await Promise.all([openPail(opts.path), openPail(path)])
133
119
  if (aroot.toString() === broot.toString()) return
134
120
 
135
- const fetcher = {
136
- async get (cid) {
137
- const blk = await ablocks.get(cid)
138
- if (blk) return blk
139
- return bblocks.get(cid)
140
- }
141
- }
142
- // @ts-expect-error CarReader is not BlockFetcher
121
+ const fetcher = new MultiBlockFetcher(ablocks, bblocks)
143
122
  const { shards: { additions, removals }, keys } = await difference(fetcher, aroot, broot)
144
123
 
145
124
  console.log(clc.red(`--- ${aroot}`))
@@ -155,27 +134,18 @@ cli.command('diff <path>')
155
134
  additions.forEach(b => console.log(clc.green(`+ ${b.cid}`)))
156
135
  removals.forEach(b => console.log(clc.red(`- ${b.cid}`)))
157
136
  }
158
-
159
- await Promise.all([closePail(ablocks), closePail(bblocks)])
160
137
  })
161
138
 
162
139
  cli.command('merge <path>')
163
140
  .describe('Merge the passed pail into this pail.')
164
141
  .action(async (path, opts) => {
165
- const [ablocks, bblocks] = await Promise.all([openPail(opts.path), openPail(path)])
166
- const [aroot, broot] = await Promise.all([ablocks, bblocks].map(async blocks => {
167
- return /** @type {API.ShardLink} */((await blocks.getRoots())[0])
168
- }))
142
+ const [
143
+ { root: aroot, blocks: ablocks },
144
+ { root: broot, blocks: bblocks }
145
+ ] = await Promise.all([openPail(opts.path), openPail(path)])
169
146
  if (aroot.toString() === broot.toString()) return
170
147
 
171
- const fetcher = {
172
- async get (cid) {
173
- const blk = await ablocks.get(cid)
174
- if (blk) return blk
175
- return bblocks.get(cid)
176
- }
177
- }
178
- // @ts-expect-error CarReader is not BlockFetcher
148
+ const fetcher = new MultiBlockFetcher(ablocks, bblocks)
179
149
  const { root, additions, removals } = await merge(fetcher, aroot, [broot])
180
150
 
181
151
  await updatePail(opts.path, ablocks, root, { additions, removals })
@@ -185,65 +155,53 @@ cli.command('merge <path>')
185
155
  console.log(clc.magenta('@@ -1 +1 @@'))
186
156
  additions.forEach(b => console.log(clc.green(`+ ${b.cid}`)))
187
157
  removals.forEach(b => console.log(clc.red(`- ${b.cid}`)))
188
-
189
- await Promise.all([closePail(ablocks), closePail(bblocks)])
190
158
  })
191
159
 
192
160
  cli.parse(process.argv)
193
161
 
194
162
  /**
195
163
  * @param {string} path
196
- * @param {{ maxSize?: number }} [config]
197
- * @returns {Promise<import('@ipld/car/api').CarReader>}
164
+ * @returns {Promise<{ root: API.ShardLink, blocks: MemoryBlockstore }>}
198
165
  */
199
- async function openPail (path, config) {
166
+ async function openPail (path) {
167
+ const blocks = new MemoryBlockstore()
200
168
  try {
201
- return await CarIndexedReader.fromFile(path)
169
+ const carReader = new CARReaderStream()
170
+ const readable = /** @type {ReadableStream<Uint8Array>} */ (Readable.toWeb(fs.createReadStream(path)))
171
+ await readable.pipeThrough(carReader).pipeTo(new WritableStream({ write: b => blocks.put(b.cid, b.bytes) }))
172
+ const header = await carReader.getHeader()
173
+ if (!isShardLink(header.roots[0])) throw new Error(`not a shard: ${header.roots[0]}`)
174
+ return { root: header.roots[0], blocks }
202
175
  } catch (err) {
203
176
  if (err.code !== 'ENOENT') throw new Error('failed to open bucket', { cause: err })
204
- const rootblk = await ShardBlock.create(config)
205
- const { writer, out } = CarWriter.create(rootblk.cid)
206
- writer.put(rootblk)
207
- writer.close()
208
- return CarReader.fromIterable(out)
209
- }
210
- }
211
-
212
- /** @param {import('@ipld/car/api').CarReader} reader */
213
- async function closePail (reader) {
214
- if (reader instanceof CarIndexedReader) {
215
- await reader.close()
177
+ const rootblk = await ShardBlock.create()
178
+ blocks.put(rootblk.cid, rootblk.bytes)
179
+ return { root: rootblk.cid, blocks }
216
180
  }
217
181
  }
218
182
 
219
183
  /**
220
184
  * @param {string} path
221
- * @param {import('@ipld/car/api').CarReader} reader
185
+ * @param {MemoryBlockstore} blocks
222
186
  * @param {API.ShardLink} root
223
187
  * @param {API.ShardDiff} diff
224
188
  */
225
- async function updatePail (path, reader, root, { additions, removals }) {
226
- // @ts-expect-error
227
- const { writer, out } = CarWriter.create(root)
189
+ async function updatePail (path, blocks, root, { additions, removals }) {
228
190
  const tmp = join(os.tmpdir(), `pail${Date.now()}.car`)
229
-
230
- const finishPromise = new Promise(resolve => {
231
- Readable.from(out).pipe(fs.createWriteStream(tmp)).on('finish', resolve)
232
- })
233
-
234
- // put new blocks
235
- for (const b of additions) {
236
- await writer.put(b)
237
- }
238
- // put old blocks without removals
239
- for await (const b of reader.blocks()) {
240
- if (removals.some(r => b.cid.toString() === r.cid.toString())) {
241
- continue
191
+ const iterator = blocks.entries()
192
+ const readable = new ReadableStream({
193
+ start (controller) {
194
+ for (const b of additions) controller.enqueue(b)
195
+ },
196
+ pull (controller) {
197
+ for (const b of iterator) {
198
+ if (removals.some(r => b.cid.toString() === r.cid.toString())) continue
199
+ return controller.enqueue(b)
200
+ }
201
+ controller.close()
242
202
  }
243
- await writer.put(b)
244
- }
245
- await writer.close()
246
- await finishPromise
203
+ })
204
+ await readable.pipeThrough(new CARWriterStream([root])).pipeTo(Writable.toWeb(fs.createWriteStream(tmp)))
247
205
 
248
206
  const old = `${path}-${new Date().toISOString()}`
249
207
  try {
@@ -2,12 +2,10 @@ import { UnknownLink, ShardLink, ShardDiff, ShardEntry, ShardEntryValueValue, Sh
2
2
  export { UnknownLink, ShardLink, ShardDiff, ShardEntry, ShardEntryValueValue, ShardEntryLinkValue, ShardEntryLinkAndValueValue, ShardConfig, ShardOptions, ShardBlockView, BlockFetcher };
3
3
  export interface BatcherShard extends ShardConfig {
4
4
  base?: ShardBlockView;
5
- prefix: string;
6
5
  entries: BatcherShardEntry[];
7
6
  }
8
7
  export interface BatcherShardInit extends ShardOptions {
9
8
  base?: ShardBlockView;
10
- prefix?: string;
11
9
  entries?: BatcherShardEntry[];
12
10
  }
13
11
  export type BatcherShardEntry = [
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/batch/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACb,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACb,CAAA;AAED,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAC9B;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,oBAAoB,GAAG,mBAAmB,GAAG,2BAA2B,GAAG,oBAAoB,GAAG,4BAA4B;CACtI,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,YAAY,CAAC,CAAA;AAEjD,MAAM,MAAM,4BAA4B,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;AAEtE,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,GAAG,CAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD;;;OAGG;IACH,MAAM,IAAK,OAAO,CAAC;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,GAAG,SAAS,CAAC,CAAA;CACpD"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/batch/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACb,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACb,CAAA;AAED,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAC9B;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,oBAAoB,GAAG,mBAAmB,GAAG,2BAA2B,GAAG,oBAAoB,GAAG,4BAA4B;CACtI,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,YAAY,CAAC,CAAA;AAEjD,MAAM,MAAM,4BAA4B,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;AAEtE,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,GAAG,CAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD;;;OAGG;IACH,MAAM,IAAK,OAAO,CAAC;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,GAAG,SAAS,CAAC,CAAA;CACpD"}
@@ -1,5 +1,5 @@
1
1
  export function put(blocks: API.BlockFetcher, shard: API.BatcherShard, key: string, value: API.UnknownLink): Promise<void>;
2
- export function traverse(shards: ShardFetcher, key: string, shard: API.BatcherShard): Promise<{
2
+ export function traverse(shards: ShardFetcher, shard: API.BatcherShard, key: string): Promise<{
3
3
  shard: API.BatcherShard;
4
4
  key: string;
5
5
  }>;
@@ -27,36 +27,37 @@ declare class Batcher implements API.Batcher {
27
27
  * @param {object} init
28
28
  * @param {API.BlockFetcher} init.blocks Block storage.
29
29
  * @param {API.ShardLink} init.link CID of the shard block.
30
- * @param {string} init.prefix
31
30
  */
32
- static create({ blocks, link, prefix }: {
31
+ static create({ blocks, link }: {
33
32
  blocks: API.BlockFetcher;
34
33
  link: API.ShardLink;
35
- prefix: string;
36
34
  }): Promise<Batcher>;
37
35
  /**
38
36
  * @param {object} init
39
37
  * @param {API.BlockFetcher} init.blocks Block storage.
40
38
  * @param {API.BatcherShardEntry[]} init.entries The entries in this shard.
41
39
  * @param {string} init.prefix Key prefix.
42
- * @param {number} init.maxSize
43
- * @param {number} init.maxKeyLength
40
+ * @param {number} init.version Shard compatibility version.
41
+ * @param {string} init.keyChars Characters allowed in keys, referring to a known character set.
42
+ * @param {number} init.maxKeySize Max key size in bytes.
44
43
  * @param {API.ShardBlockView} init.base Original shard this batcher is based on.
45
44
  */
46
- constructor({ blocks, entries, prefix, maxSize, maxKeyLength, base }: {
45
+ constructor({ blocks, entries, prefix, version, keyChars, maxKeySize, base }: {
47
46
  blocks: API.BlockFetcher;
48
47
  entries: API.BatcherShardEntry[];
49
48
  prefix: string;
50
- maxSize: number;
51
- maxKeyLength: number;
49
+ version: number;
50
+ keyChars: string;
51
+ maxKeySize: number;
52
52
  base: API.ShardBlockView;
53
53
  });
54
54
  blocks: API.BlockFetcher;
55
55
  prefix: string;
56
56
  entries: API.BatcherShardEntry[];
57
57
  base: API.ShardBlockView;
58
- maxSize: number;
59
- maxKeyLength: number;
58
+ version: number;
59
+ keyChars: string;
60
+ maxKeySize: number;
60
61
  /**
61
62
  * @param {string} key The key of the value to put.
62
63
  * @param {API.UnknownLink} value The value to put.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/batch/index.js"],"names":[],"mappings":"AAgEO,4BANI,IAAI,YAAY,SAChB,gBAAgB,OAChB,MAAM,SACN,IAAI,WAAW,GACb,QAAQ,IAAI,CAAC,CA4FzB;AAWM,iCALI,YAAY,OACZ,MAAM,SACN,gBAAgB,GACd,QAAQ;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAe7D;AAQM,8BAFI,gBAAgB;;;;GAkC1B;AAaM,+BAJI,IAAI,YAAY,QAChB,IAAI,SAAS,GACX,QAAQ,WAAW,CAAC,CAEyD;AAE1F;IAUE,oBAAmC;IATnC;;;OAGG;IACH,8EAGC;IADC,aAAoC;CAIvC;qBAnPoB,UAAU;8BAGD,YAAY;6BAFb,aAAa;AAI1C,gCAAgC;AAChC,iCADiB,GAAG,CAAC,OAAO;IAsC1B;;;;;OAKG;IACH;QAJkC,MAAM,EAA7B,IAAI,YAAY;QACI,IAAI,EAAxB,IAAI,SAAS;QACA,MAAM,EAAnB,MAAM;yBAMhB;IA5CD;;;;;;;;OAQG;IACH;QAPkC,MAAM,EAA7B,IAAI,YAAY;QACc,OAAO,EAArC,uBAAuB;QACV,MAAM,EAAnB,MAAM;QACO,OAAO,EAApB,MAAM;QACO,YAAY,EAAzB,MAAM;QACmB,IAAI,EAA7B,IAAI,cAAc;OAS5B;IANC,yBAAoB;IACpB,eAAoB;IACpB,iCAAsB;IACtB,yBAAgB;IAChB,gBAAsB;IACtB,qBAAgC;IAGlC;;;;OAIG;IACH,SAJW,MAAM,SACN,IAAI,WAAW,GACb,QAAQ,IAAI,CAAC,CAKzB;IAED;;;;OAIC;;CAaF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/batch/index.js"],"names":[],"mappings":"AAiEO,4BANI,IAAI,YAAY,SAChB,gBAAgB,OAChB,MAAM,SACN,IAAI,WAAW,GACb,QAAQ,IAAI,CAAC,CAsGzB;AAWM,iCALI,YAAY,SACZ,gBAAgB,OAChB,MAAM,GACJ,QAAQ;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAiB7D;AAQM,8BAFI,gBAAgB;;;;GAkC1B;AAaM,+BAJI,IAAI,YAAY,QAChB,IAAI,SAAS,GACX,QAAQ,WAAW,CAAC,CAE6C;AAE9E;IAUE,oBAAmC;IATnC;;;OAGG;IACH,8EAGC;IADC,aAAoC;CAIvC;qBAhQoB,UAAU;8BAGD,YAAY;6BAFK,aAAa;AAI5D,gCAAgC;AAChC,iCADiB,GAAG,CAAC,OAAO;IAwC1B;;;;OAIG;IACH;QAHkC,MAAM,EAA7B,IAAI,YAAY;QACI,IAAI,EAAxB,IAAI,SAAS;yBAMvB;IA7CD;;;;;;;;;OASG;IACH;QARkC,MAAM,EAA7B,IAAI,YAAY;QACc,OAAO,EAArC,uBAAuB;QACV,MAAM,EAAnB,MAAM;QACO,OAAO,EAApB,MAAM;QACO,QAAQ,EAArB,MAAM;QACO,UAAU,EAAvB,MAAM;QACmB,IAAI,EAA7B,IAAI,cAAc;OAU5B;IAPC,yBAAoB;IACpB,eAAoB;IACpB,iCAA2B;IAC3B,yBAAgB;IAChB,gBAAsB;IACtB,iBAAwB;IACxB,mBAA4B;IAG9B;;;;OAIG;IACH,SAJW,MAAM,SACN,IAAI,WAAW,GACb,QAAQ,IAAI,CAAC,CAKzB;IAED;;;;OAIC;;CAYF"}
@@ -1 +1 @@
1
- {"version":3,"file":"shard.d.ts","sourceRoot":"","sources":["../../../src/batch/shard.js"],"names":[],"mappings":"AAQO,iEAFM,IAAI,YAAY,CAO3B;qBAZmB,UAAU"}
1
+ {"version":3,"file":"shard.d.ts","sourceRoot":"","sources":["../../../src/batch/shard.js"],"names":[],"mappings":"AAQO,iEAFM,IAAI,YAAY,CAM3B;qBAXmB,UAAU"}
@@ -20,7 +20,7 @@ export class MemoryBlockstore implements API.BlockFetcher {
20
20
  /** @param {API.UnknownLink} cid */
21
21
  deleteSync(cid: API.UnknownLink): void;
22
22
  entries(): Generator<{
23
- cid: API.Link<unknown, number, number, API.Version>;
23
+ cid: API.Link<any, number, number, API.Version>;
24
24
  bytes: Uint8Array;
25
25
  }, void, unknown>;
26
26
  #private;
@@ -1,6 +1,6 @@
1
1
  import { ShardDiff, ShardLink, UnknownLink } from '../api.js';
2
2
  import { EventLink, EventBlockView } from '../clock/api.js';
3
- export { BlockFetcher, UnknownLink, ShardBlockView, ShardDiff, ShardLink } from '../api.js';
3
+ export { BlockFetcher, UnknownLink, ShardBlockView, ShardDiff, ShardLink, EntriesOptions } from '../api.js';
4
4
  export { EventBlockView, EventLink } from '../clock/api.js';
5
5
  export interface Result extends ShardDiff {
6
6
  root: ShardLink;
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/crdt/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAE3D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC3F,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,WAAW,MAAO,SAAQ,SAAS;IACvC,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,CAAA;IAC5B,KAAK,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;CAClC;AAED,MAAM,MAAM,SAAS,GAAG,CACpB,YAAY,GACZ,eAAe,GACf,cAAc,CACjB,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAEvB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,WAAW,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,KAAK,CAAC,YAAY,GAAC,eAAe,CAAC,CAAA;CACzC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/crdt/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAE3D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC3G,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,WAAW,MAAO,SAAQ,SAAS;IACvC,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,CAAA;IAC5B,KAAK,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;CAClC;AAED,MAAM,MAAM,SAAS,GAAG,CACpB,YAAY,GACZ,eAAe,GACf,cAAc,CACjB,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAEvB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,WAAW,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,KAAK,CAAC,YAAY,GAAC,eAAe,CAAC,CAAA;CACzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/crdt/batch/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,iBAAiB,EAEjB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACZ,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAExE,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACX,SAAS,EACT,cAAc,EACd,SAAS,EACT,MAAM,EACP,CAAA;AAED,MAAM,WAAW,WAAY,SAAQ,OAAO;IAC1C;;;OAGG;IACH,MAAM,IAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC3B"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/crdt/batch/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACZ,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAExE,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACX,SAAS,EACT,cAAc,EACd,SAAS,EACT,MAAM,EACP,CAAA;AAED,MAAM,WAAW,WAAY,SAAQ,OAAO;IAC1C;;;OAGG;IACH,MAAM,IAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/crdt/batch/index.js"],"names":[],"mappings":";AA2JO,+BAJI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE,GAC5B,QAAQ,IAAI,WAAW,CAAC,CAE+C;oCAtJhD,sBAAsB;qBAJrC,UAAU"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/crdt/batch/index.js"],"names":[],"mappings":";AA0JO,+BAJI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE,GAC5B,QAAQ,IAAI,WAAW,CAAC,CAEmC;oCArJpC,sBAAsB;qBAJrC,UAAU"}
@@ -4,8 +4,6 @@ export function root(blocks: API.BlockFetcher, head: API.EventLink<API.Operation
4
4
  root: API.ShardLink;
5
5
  } & API.ShardDiff>;
6
6
  export function get(blocks: API.BlockFetcher, head: API.EventLink<API.Operation>[], key: string): Promise<import("multiformats").Link<unknown, number, number, import("multiformats").Version> | undefined>;
7
- export function entries(blocks: API.BlockFetcher, head: API.EventLink<API.Operation>[], options?: {
8
- prefix?: string | undefined;
9
- } | undefined): AsyncGenerator<import("../api.js").ShardValueEntry, void, undefined>;
7
+ export function entries(blocks: API.BlockFetcher, head: API.EventLink<API.Operation>[], options?: API.EntriesOptions | undefined): AsyncGenerator<import("../api.js").ShardValueEntry, void, undefined>;
10
8
  import * as API from './api.js';
11
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crdt/index.js"],"names":[],"mappings":"AAmBO,4BANI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE,OAC9B,MAAM,SACN,IAAI,WAAW,GACb,QAAQ,IAAI,MAAM,CAAC,CAoG/B;AAYM,4BANI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE,OAC9B,MAAM,iCAEJ,QAAQ,IAAI,MAAM,CAAC,CAI/B;AAYM,6BAJI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE;UACZ,IAAI,SAAS;mBAsEzC;AAOM,4BAJI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE,OAC9B,MAAM,6GAShB;AAQM,gCALI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE;;qFAWxC;qBA/OoB,UAAU"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crdt/index.js"],"names":[],"mappings":"AAmBO,4BANI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE,OAC9B,MAAM,SACN,IAAI,WAAW,GACb,QAAQ,IAAI,MAAM,CAAC,CAoG/B;AAYM,4BANI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE,OAC9B,MAAM,iCAEJ,QAAQ,IAAI,MAAM,CAAC,CAI/B;AAYM,6BAJI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE;UACZ,IAAI,SAAS;mBAsEzC;AAOM,4BAJI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE,OAC9B,MAAM,6GAShB;AAOM,gCAJI,IAAI,YAAY,QAChB,IAAI,SAAS,CAAC,IAAI,SAAS,CAAC,EAAE,kHAUxC;qBA9OoB,UAAU"}
@@ -1 +1 @@
1
- {"program":{"fileNames":["../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es5.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.dom.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.scripthost.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.full.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/bases/interface.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/hashes/interface.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/link/interface.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/cid.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/block/interface.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/codecs/interface.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/interface.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/hashes/digest.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/hashes/hasher.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/varint.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/bytes.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/index.d.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/hashes/sha2.d.ts","../node_modules/.pnpm/multiformats@13.0.1/node_modules/multiformats/dist/src/bases/interface.d.ts","../node_modules/.pnpm/multiformats@13.0.1/node_modules/multiformats/dist/src/block/interface.d.ts","../node_modules/.pnpm/multiformats@13.0.1/node_modules/multiformats/dist/src/hashes/interface.d.ts","../node_modules/.pnpm/multiformats@13.0.1/node_modules/multiformats/dist/src/link/interface.d.ts","../node_modules/.pnpm/multiformats@13.0.1/node_modules/multiformats/dist/src/cid.d.ts","../node_modules/.pnpm/multiformats@13.0.1/node_modules/multiformats/dist/src/codecs/interface.d.ts","../node_modules/.pnpm/@ipld+dag-cbor@9.0.8/node_modules/@ipld/dag-cbor/dist/src/index.d.ts","../src/api.ts","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/link.d.ts","../src/block.js","../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/dist/types/src/block.d.ts","../src/shard.js","../src/diff.js","../src/index.js","../src/merge.js","../src/clock/api.ts","../src/clock/index.js","../node_modules/@types/istanbul-lib-coverage/index.d.ts","../node_modules/@types/json5/index.d.ts"],"fileInfos":[{"version":"f33e5332b24c3773e930e212cbb8b6867c8ba3ec4492064ea78e55a524d57450","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","26f2f787e82c4222710f3b676b4d83eb5ad0a72fa7b746f03449e7a026ce5073","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc",{"version":"21e41a76098aa7a191028256e52a726baafd45a925ea5cf0222eb430c96c1d83","affectsGlobalScope":true},{"version":"35299ae4a62086698444a5aaee27fc7aa377c68cbb90b441c9ace246ffd05c97","affectsGlobalScope":true},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true},{"version":"138fb588d26538783b78d1e3b2c2cc12d55840b97bf5e08bca7f7a174fbe2f17","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"e0275cd0e42990dc3a16f0b7c8bca3efe87f1c8ad404f80c6db1c7c0b828c59f","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"49ed889be54031e1044af0ad2c603d627b8bda8b50c1a68435fe85583901d072","affectsGlobalScope":true},{"version":"e93d098658ce4f0c8a0779e6cab91d0259efb88a318137f686ad76f8410ca270","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"acae90d417bee324b1372813b5a00829d31c7eb670d299cd7f8f9a648ac05688","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"51e547984877a62227042850456de71a5c45e7fe86b7c975c6e68896c86fa23b","affectsGlobalScope":true},{"version":"62a4966981264d1f04c44eb0f4b5bdc3d81c1a54725608861e44755aa24ad6a5","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"86a34c7a13de9cabc43161348f663624b56871ed80986e41d214932ddd8d6719","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"1df2366de6650547b3dc1d7c4147355c0f6b4729c964e3839636fa418982d131","f997c5be1eb27b8c37d50d3f61fc5671fb79efd80c499e0e16b5d56c32182f8d","0828334538f604701c9dd0bf54abb758803f9efb4acb4aedd9b18acde4b1bcdf","552223520e823223ee13c5764e9b69b1819c985818a8bcda435d8d1dbd909bee","671efcb4cb21897b43dec53d0218afcac3d1e13c7d50158b0c1a0b300acdb69e","e68d682c8224a5c2e5f5e3720537cec720c41a829e1367316ea9acf6fec48ecc","f9e46527ef7833f803a47c256179c05e5149a8dc776c5a6952572052c9e00b24","557b8c7481296f4b7ed362320f3bbb40bb87404edf880c81224f365a8d1e17f3","467a7c09abfde00a7fc41d06c1c599f01e944c9f4948d38a0bde82b766a7e364","7697d44896d7082a0195b088b1a5c49bb70aea87721448982bee34720cfa73f4","77c738b0671d324f6cb2c7c1d7dfc0282a5836c67af55c9ba6df315c62207f57","f2dc47a6b115cd100153d2aaa3dbec094e7a55c5e471c9df8cf7fd651925d63f","2d57b5c1d1ef4cf78480539c0e0650af78ccf387d95f0585b12dbd658691a30f","5b563db2a9fdba4950d49351dae9909146ca93bec867e748754d255769e169e0","4a3605bef1a5ef29fd5a1696dd95b0b4e2259e2d07a4d88fac79f3a9765c44a2","d3df79602ca0303c65d2197c9e71222db97a4a0e5a691bdab49a65f83397558f","90240231e730deed31569f6c686766a538e4a024bbc33ea1738fe924f477ba61","552223520e823223ee13c5764e9b69b1819c985818a8bcda435d8d1dbd909bee","49b7c3ddd683c09aa437dd92681699387441f522524b14d2331ce494a9bf2f27","f9e46527ef7833f803a47c256179c05e5149a8dc776c5a6952572052c9e00b24","096e5d8e4e2faca903221837f5c249153aa5d98405d4150bd41e54f7efbc8929",{"version":"3d12b7b8957e4bc533d51d9bb1838a19c5343923db0982be1114e0f2cac13ced","signature":"04589c0e60491c7735394092de3a2c6bd33a5c079d7e898855b1e5080a990819"},"894510c4bac920c0ffbdc60e3743438be522c3f2bc029367aaae438b7ecee16b",{"version":"3c60343b48438de7de857209f3272804f325705e05945d0b5c6b77d8c0b91271","signature":"6bb7ea47ab2fdff568fb0958e303868ab4d62acc1c8de4d4633d0ee767de7d8d"},"dfd8fa0db9817c18d04f46d320051bf96638e0ef03b732c1abedf7b00337f0e6",{"version":"da90eb2d7d795885d978a33a0d37fc875f4749c30ddf1b6ef4642d767b572828","signature":"e770bf4d01b19862ab3dbef25eca5d2a5ea1df83c031f17952fcad94c39767bd"},{"version":"4efb0e55bdb87c1fc5ede5dceba6bbd330daee81c9acf55110f1d68fbea8e34c","signature":"4cfe33e746c7117c1343aff4b084d4416d300437fe1080e066a4ea961ba45f49"},{"version":"10d638b1e0877b6af4f6ac5d6d5a4749ca96bc4dab30b9632b9435c669b34fd0","signature":"505954d8cc8064fc12f834d5a5a48ae23042c566a361b60543f2ae23a9dd1df1"},{"version":"229faf86cd68a721d11b73a0b398ee241a57172cb3eef98351fa6adc4ed96aec","signature":"6bfa5af024804ea22f15370d2feb92958199fd3827bc97bf0487d29fb488925f"},{"version":"634e303df54ddd9c2e20bce6784a7fef1ea06183d75161fbf57e3324d4d6f07e","signature":"de94446f7a45df1aa8cfbe6aba6041f18551e6cee0067f29ecbe8615baf45360"},{"version":"31e758d6640ef652be142972a0002fed5ff026c20a61c51266ac73463c34e4fb","signature":"8404e591edea1a6f802f4099ced1c87a143250519ae18e88be1d8bf0eaf6ace5"},"8b06ac3faeacb8484d84ddb44571d8f410697f98d7bfa86c0fda60373a9f5215","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538"],"root":[82,84,[86,91]],"options":{"allowJs":true,"checkJs":true,"composite":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":7,"outDir":"./","skipLibCheck":true,"strict":true,"target":9},"fileIdsList":[[79,80],[68,73],[64,65],[64],[66],[63],[63,69],[70],[65,68,69,70,71,72],[62,63,64,66,67],[62,63,66],[78,79],[78],[76],[75,76,77],[73,74,81],[73,82,83],[73,82],[73,74,81,85,90],[82,86],[82,87,88],[74,81,82,83,85]],"referencedMap":[[81,1],[85,2],[66,3],[65,4],[67,5],[69,6],[70,7],[74,8],[73,9],[68,10],[83,3],[64,11],[76,12],[79,13],[80,14],[78,15],[82,16],[84,17],[90,18],[91,19],[87,20],[88,20],[89,21],[86,22]],"exportedModulesMap":[[81,1],[85,2],[66,3],[65,4],[67,5],[69,6],[70,7],[74,8],[73,9],[68,10],[83,3],[64,11],[76,12],[79,13],[80,14],[78,15],[82,16],[90,18]],"semanticDiagnosticsPerFile":[81,62,85,66,72,65,67,69,70,63,74,73,68,83,64,71,75,76,79,80,77,78,59,60,10,11,15,14,2,16,17,18,19,20,21,22,23,3,4,24,28,25,26,27,29,30,31,5,32,33,34,35,6,39,36,37,38,40,7,41,46,47,42,43,44,45,8,51,48,49,50,52,9,53,61,54,55,58,56,57,1,13,12,92,93,82,84,90,91,87,88,89,86],"latestChangedDtsFile":"./src/index.d.ts"},"version":"5.3.3"}
1
+ {"program":{"fileNames":["../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es5.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.dom.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.scripthost.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.full.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/bytes.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/bases/interface.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/block/interface.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/hashes/interface.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/link/interface.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/cid.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/hashes/digest.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/hashes/hasher.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/varint.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/codecs/interface.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/interface.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/index.d.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/hashes/sha2.d.ts","../node_modules/.pnpm/cborg@4.0.7/node_modules/cborg/types/lib/token.d.ts","../node_modules/.pnpm/cborg@4.0.7/node_modules/cborg/types/lib/bl.d.ts","../node_modules/.pnpm/cborg@4.0.7/node_modules/cborg/types/interface.d.ts","../node_modules/.pnpm/cborg@4.0.7/node_modules/cborg/types/lib/decode.d.ts","../node_modules/.pnpm/cborg@4.0.7/node_modules/cborg/types/lib/encode.d.ts","../node_modules/.pnpm/cborg@4.0.7/node_modules/cborg/types/cborg.d.ts","../node_modules/.pnpm/@ipld+dag-cbor@9.2.0/node_modules/@ipld/dag-cbor/dist/src/index.d.ts","../src/api.ts","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/link.d.ts","../src/block.js","../node_modules/.pnpm/multiformats@13.1.0/node_modules/multiformats/dist/src/block.d.ts","../src/shard.js","../src/diff.js","../src/index.js","../src/merge.js","../src/batch/api.ts","../src/batch/shard.js","../src/batch/index.js","../src/clock/api.ts","../src/clock/index.js","../src/crdt/api.ts","../src/crdt/index.js","../src/crdt/batch/api.ts","../src/crdt/batch/index.js","../node_modules/@types/istanbul-lib-coverage/index.d.ts","../node_modules/@types/json5/index.d.ts"],"fileInfos":[{"version":"f33e5332b24c3773e930e212cbb8b6867c8ba3ec4492064ea78e55a524d57450","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","26f2f787e82c4222710f3b676b4d83eb5ad0a72fa7b746f03449e7a026ce5073","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc",{"version":"21e41a76098aa7a191028256e52a726baafd45a925ea5cf0222eb430c96c1d83","affectsGlobalScope":true},{"version":"35299ae4a62086698444a5aaee27fc7aa377c68cbb90b441c9ace246ffd05c97","affectsGlobalScope":true},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true},{"version":"138fb588d26538783b78d1e3b2c2cc12d55840b97bf5e08bca7f7a174fbe2f17","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"e0275cd0e42990dc3a16f0b7c8bca3efe87f1c8ad404f80c6db1c7c0b828c59f","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"49ed889be54031e1044af0ad2c603d627b8bda8b50c1a68435fe85583901d072","affectsGlobalScope":true},{"version":"e93d098658ce4f0c8a0779e6cab91d0259efb88a318137f686ad76f8410ca270","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"acae90d417bee324b1372813b5a00829d31c7eb670d299cd7f8f9a648ac05688","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"51e547984877a62227042850456de71a5c45e7fe86b7c975c6e68896c86fa23b","affectsGlobalScope":true},{"version":"62a4966981264d1f04c44eb0f4b5bdc3d81c1a54725608861e44755aa24ad6a5","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"86a34c7a13de9cabc43161348f663624b56871ed80986e41d214932ddd8d6719","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"1df2366de6650547b3dc1d7c4147355c0f6b4729c964e3839636fa418982d131","929fc31f7523aaa1d19735b77e637af06e58d76007648ec088ecfbec1521cbfe","4a3605bef1a5ef29fd5a1696dd95b0b4e2259e2d07a4d88fac79f3a9765c44a2","370079895f1acdd4bb5194a403c85bf60cfbb2654bced9430a6c7210e7246be8","90240231e730deed31569f6c686766a538e4a024bbc33ea1738fe924f477ba61","552223520e823223ee13c5764e9b69b1819c985818a8bcda435d8d1dbd909bee","49b7c3ddd683c09aa437dd92681699387441f522524b14d2331ce494a9bf2f27","8510595d2ca2660e6407be65d8bf95f0c53877dbb812e269cdd980fc34de5f78","a6eb23f2a83113ce0ab7203bfda2be0888720f8d694a20abaef83b9f62832061","363dca5004ac5a3d9c2bba12812b97a64461911762f0b8f9320a8856ec53bcad","1447d46bff9e7c5c77da14515a7456ea5e919ce6e28f5e6746edf99818e4be47","557b8c7481296f4b7ed362320f3bbb40bb87404edf880c81224f365a8d1e17f3","283ed3d075bf7d3e8793f63b2a52f475ed84d95b7b6351c5d5bcc6c49d4b845b","130e4655e30a6d7a8004566642e24bf3016b5e5a2e5dcd72c0a61b663f7df711","0e84a640a449bd767be2ebebf4acf7cac1b1f92e72941b30d370ca0c8f1a30b3","a32c2dd5736b27da05ddf1034df28c75e8db3ef26effe60df4bd608f5c7a03d8","f65fb2149519d5e7cdf1245e0d5e5c6369855d9f14cfd1da9a678750da3f3fe6","15f502c247a60ad85c2a87635e7b0a71701a7f6d75fecba0f541e2b28d66f6fd","730fedb3e76078f11d9a8a595c3f337dadfb1c687810999b02394e853b668c5a","babe35042b7448cb38bbc24c357a358c5e1e71d2692a818f21a8550340e41329","f559fb70d8e4823601376e26e0ade0d4e1c50a5f8c349affbd3590c8d3666866",{"version":"3d12b7b8957e4bc533d51d9bb1838a19c5343923db0982be1114e0f2cac13ced","signature":"04589c0e60491c7735394092de3a2c6bd33a5c079d7e898855b1e5080a990819"},"a1e5af4d821aeeee056db8fa6ce613f957af652cdab1c1b8058803684bdb23df",{"version":"3c60343b48438de7de857209f3272804f325705e05945d0b5c6b77d8c0b91271","signature":"d429ddafb1e359c44e532fa7c48bba4f258d44d6a1f8fde8d50e1882014ab07a"},"36a2b2bca10a1e53acaaae2f85c2737447ab9d66ebb05aee53f9f7de251e3c93",{"version":"da90eb2d7d795885d978a33a0d37fc875f4749c30ddf1b6ef4642d767b572828","signature":"e770bf4d01b19862ab3dbef25eca5d2a5ea1df83c031f17952fcad94c39767bd"},{"version":"4efb0e55bdb87c1fc5ede5dceba6bbd330daee81c9acf55110f1d68fbea8e34c","signature":"4cfe33e746c7117c1343aff4b084d4416d300437fe1080e066a4ea961ba45f49"},{"version":"10d638b1e0877b6af4f6ac5d6d5a4749ca96bc4dab30b9632b9435c669b34fd0","signature":"505954d8cc8064fc12f834d5a5a48ae23042c566a361b60543f2ae23a9dd1df1"},{"version":"229faf86cd68a721d11b73a0b398ee241a57172cb3eef98351fa6adc4ed96aec","signature":"6bfa5af024804ea22f15370d2feb92958199fd3827bc97bf0487d29fb488925f"},{"version":"ecdb20ce70028bfb135f2c6475d6500c92148473be5347e1c3c527413176d65d","signature":"0b43e07b80bc9186dad45a6fe6ca756ea04ba9514b28f1a178910a0c7d8712ad"},{"version":"d913e4e7f031f401daed294c2308e81384c22c81cc6e7510f4f513bbb4717c67","signature":"d5a68a94dc567b806248a014e5267fe7f47c62048b91824581efd4aee7c67e02"},{"version":"340c655e4885b071b70ec4dbc2a4ca517e473017c96467ca96679b767007b545","signature":"f1ee3b188315b86d2756c4ca9b759518eb5f8cdb62acc199c6a39f6750a63583"},{"version":"634e303df54ddd9c2e20bce6784a7fef1ea06183d75161fbf57e3324d4d6f07e","signature":"de94446f7a45df1aa8cfbe6aba6041f18551e6cee0067f29ecbe8615baf45360"},{"version":"31e758d6640ef652be142972a0002fed5ff026c20a61c51266ac73463c34e4fb","signature":"8404e591edea1a6f802f4099ced1c87a143250519ae18e88be1d8bf0eaf6ace5"},{"version":"857a4ca072a3a8d8e9be87699f3e9e2cf35989c2541551256724ace7c2ea1979","signature":"ac8e46be3c88e8f148a521f4719e07e1be9078cf37ec1f12b519d6bc569d5f14"},{"version":"8bcfa3cca1e71f4ed6e02e022c76853939a4588400bf396a828e33d1407dbccb","signature":"8df2355f24cc279ffbd5e4e3781d98f7f7a3a928a5db79e8c7552366c64e70f7"},{"version":"0e0efe474d811ce52d4f8a73b2ab588aab64c3b7ff9180d36cb59c43034a44d6","signature":"39eaa64d9ce59d3a874d8f8d738db4428f23f1983b0aa99e0fefdcaf6ec5f9ae"},{"version":"aa856deef38ee724cda58a8d4ee451125f95c35af9fafcb0050169a519a17032","signature":"c69bc379f337d1e362506c4b44d64004801262c7b4c6ee280a131c86eb1ced15"},"8b06ac3faeacb8484d84ddb44571d8f410697f98d7bfa86c0fda60373a9f5215","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538"],"root":[82,84,[86,98]],"options":{"allowJs":true,"checkJs":true,"composite":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":7,"outDir":"./","skipLibCheck":true,"strict":true,"target":9},"fileIdsList":[[67,71,77,80],[75,77,78,79],[75,76],[75,77],[77],[72,73],[66,67],[66],[64],[65],[65,68],[69],[62,67,68,69,70,72],[63,64,65,66,71],[63,64,65],[73,74,81],[82],[86,90,91],[86,90],[73,82,83],[73,82],[73,74,81,85,93],[82,93],[90,95],[84,86,92,94,96,97],[84,86,88,92,94,95],[82,86],[82,87,88],[74,81,82,83,85]],"referencedMap":[[81,1],[80,2],[77,3],[78,4],[79,5],[85,6],[64,7],[67,8],[71,9],[68,10],[69,11],[74,12],[73,13],[72,14],[83,7],[66,15],[82,16],[90,17],[92,18],[91,19],[84,20],[93,21],[94,22],[95,23],[97,24],[98,25],[96,26],[87,27],[88,27],[89,28],[86,29]],"exportedModulesMap":[[81,1],[80,2],[77,3],[78,4],[79,5],[85,6],[64,7],[67,8],[71,9],[68,10],[69,11],[74,12],[73,13],[72,14],[83,7],[66,15],[82,16],[90,17],[92,21],[93,21],[95,23],[97,24],[96,21]],"semanticDiagnosticsPerFile":[81,80,77,76,78,79,75,63,85,64,62,67,71,68,69,65,74,73,72,83,66,70,59,60,10,11,15,14,2,16,17,18,19,20,21,22,23,3,4,24,28,25,26,27,29,30,31,5,32,33,34,35,6,39,36,37,38,40,7,41,46,47,42,43,44,45,8,51,48,49,50,52,9,53,61,54,55,58,56,57,1,13,12,99,100,82,90,92,91,84,93,94,95,97,98,96,87,88,89,86],"latestChangedDtsFile":"./src/crdt/batch/index.d.ts"},"version":"5.3.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web3-storage/pail",
3
- "version": "0.6.0-alpha.4",
3
+ "version": "0.6.0",
4
4
  "description": "DAG based key value store.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -143,17 +143,17 @@
143
143
  "dist"
144
144
  ],
145
145
  "dependencies": {
146
- "@ipld/car": "^5.2.4",
147
- "@ipld/dag-cbor": "^9.0.6",
148
- "archy": "^1.0.0",
149
- "cli-color": "^2.0.3",
150
- "multiformats": "^12.1.3",
151
- "sade": "^1.8.1"
146
+ "@ipld/dag-cbor": "^9.2.0",
147
+ "multiformats": "^13.1.0"
152
148
  },
153
149
  "devDependencies": {
150
+ "archy": "^1.0.0",
154
151
  "c8": "^8.0.1",
152
+ "carstream": "^2.0.0",
153
+ "cli-color": "^2.0.3",
155
154
  "mocha": "^10.2.0",
156
155
  "nanoid": "^4.0.0",
156
+ "sade": "^1.8.1",
157
157
  "standard": "^17.0.0",
158
158
  "typescript": "^5.0.2"
159
159
  },
@@ -1,6 +1,6 @@
1
1
  // eslint-disable-next-line no-unused-vars
2
2
  import * as API from './api.js'
3
- import { ShardFetcher } from '../shard.js'
3
+ import { ShardFetcher, isPrintableASCII } from '../shard.js'
4
4
  import * as Shard from '../shard.js'
5
5
  import * as BatcherShard from './shard.js'
6
6
 
@@ -64,95 +64,105 @@ class Batcher {
64
64
  * @returns {Promise<void>}
65
65
  */
66
66
  export const put = async (blocks, shard, key, value) => {
67
+ if (shard.keyChars !== Shard.KeyCharsASCII) {
68
+ throw new Error(`unsupported key character set: ${shard.keyChars}`)
69
+ }
70
+ if (!isPrintableASCII(key)) {
71
+ throw new Error('key contains non-ASCII characters')
72
+ }
73
+ // ensure utf8 encoded key is smaller than max
74
+ if (new TextEncoder().encode(key).length > shard.maxKeySize) {
75
+ throw new Error(`UTF-8 encoded key exceeds max size of ${shard.maxKeySize} bytes`)
76
+ }
77
+
67
78
  const shards = new ShardFetcher(blocks)
68
- const dest = await traverse(shards, key, shard)
79
+ const dest = await traverse(shards, shard, key)
69
80
  if (dest.shard !== shard) {
70
81
  shard = dest.shard
71
82
  key = dest.key
72
83
  }
73
84
 
74
85
  /** @type {API.BatcherShardEntry} */
75
- let entry = [key, value]
76
- /** @type {API.BatcherShard|undefined} */
77
- let batcher
78
-
79
- // if the key in this shard is longer than allowed, then we need to make some
80
- // intermediate shards.
81
- if (key.length > shard.maxKeyLength) {
82
- const pfxskeys = Array.from(Array(Math.ceil(key.length / shard.maxKeyLength)), (_, i) => {
83
- const start = i * shard.maxKeyLength
84
- return {
85
- prefix: shard.prefix + key.slice(0, start),
86
- key: key.slice(start, start + shard.maxKeyLength)
87
- }
88
- })
89
-
90
- entry = [pfxskeys[pfxskeys.length - 1].key, value]
91
- batcher = BatcherShard.create({
92
- entries: [entry],
93
- prefix: pfxskeys[pfxskeys.length - 1].prefix,
94
- ...Shard.configure(shard)
95
- })
96
-
97
- for (let i = pfxskeys.length - 2; i > 0; i--) {
98
- entry = [pfxskeys[i].key, [batcher]]
99
- batcher = BatcherShard.create({
100
- entries: [entry],
101
- prefix: pfxskeys[i].prefix,
102
- ...Shard.configure(shard)
103
- })
86
+ let entry = [dest.key, value]
87
+ let targetEntries = [...dest.shard.entries]
88
+
89
+ for (const [i, e] of targetEntries.entries()) {
90
+ const [k, v] = e
91
+
92
+ // is this just a replace?
93
+ if (k === dest.key) break
94
+
95
+ // do we need to shard this entry?
96
+ const shortest = k.length < dest.key.length ? k : dest.key
97
+ const other = shortest === k ? dest.key : k
98
+ let common = ''
99
+ for (const char of shortest) {
100
+ const next = common + char
101
+ if (!other.startsWith(next)) break
102
+ common = next
104
103
  }
104
+ if (common.length) {
105
+ /** @type {API.ShardEntry[]} */
106
+ let entries = []
105
107
 
106
- entry = [pfxskeys[0].key, [batcher]]
107
- }
108
+ // if the existing entry key or new key is equal to the common prefix,
109
+ // then the existing value / new value needs to persist in the parent
110
+ // shard. Otherwise they persist in this new shard.
111
+ if (common !== dest.key) {
112
+ entries = Shard.putEntry(entries, [dest.key.slice(common.length), value])
113
+ }
114
+ if (common !== k) {
115
+ entries = Shard.putEntry(entries, asShardEntry([k.slice(common.length), v]))
116
+ }
108
117
 
109
- shard.entries = Shard.putEntry(asShardEntries(shard.entries), asShardEntry(entry))
110
-
111
- // TODO: adjust size automatically
112
- const size = BatcherShard.encodedLength(shard)
113
- if (size > shard.maxSize) {
114
- const common = Shard.findCommonPrefix(
115
- asShardEntries(shard.entries),
116
- entry[0]
117
- )
118
- if (!common) throw new Error('shard limit reached')
119
- const { prefix } = common
120
- /** @type {API.BatcherShardEntry[]} */
121
- const matches = common.matches
122
-
123
- const entries = matches
124
- .filter(m => m[0] !== prefix)
125
- .map(m => {
126
- m = [...m]
127
- m[0] = m[0].slice(prefix.length)
128
- return m
118
+ let child = BatcherShard.create({
119
+ ...Shard.configure(dest.shard),
120
+ prefix: dest.shard.prefix + common,
121
+ entries
129
122
  })
123
+
124
+ // need to spread as access by index does not consider utf-16 surrogates
125
+ const commonChars = [...common]
130
126
 
131
- const batcher = BatcherShard.create({
132
- entries,
133
- prefix: shard.prefix + prefix,
134
- ...Shard.configure(shard)
135
- })
136
-
137
- /** @type {API.ShardEntryShardValue | API.ShardEntryShardAndValueValue} */
138
- let value
139
- const pfxmatch = matches.find(m => m[0] === prefix)
140
- if (pfxmatch) {
141
- if (Array.isArray(pfxmatch[1])) {
142
- // should not happen! all entries with this prefix should have been
143
- // placed within this shard already.
144
- throw new Error(`expected "${prefix}" to be a shard value but found a shard link`)
127
+ // create parent shards for each character of the common prefix
128
+ for (let i = commonChars.length - 1; i > 0; i--) {
129
+ /** @type {API.ShardEntryShardValue | API.ShardEntryShardAndValueValue} */
130
+ let parentValue
131
+ // if the first iteration and the existing entry key is equal to the
132
+ // common prefix, then existing value needs to persist in this parent
133
+ if (i === commonChars.length - 1 && common === k) {
134
+ if (Array.isArray(v)) throw new Error('found a shard link when expecting a value')
135
+ parentValue = [child, v]
136
+ } else if (i === commonChars.length - 1 && common === dest.key) {
137
+ parentValue = [child, value]
138
+ } else {
139
+ parentValue = [child]
140
+ }
141
+ const parent = BatcherShard.create({
142
+ ...Shard.configure(dest.shard),
143
+ prefix: dest.shard.prefix + commonChars.slice(0, i).join(''),
144
+ entries: [[commonChars[i], parentValue]]
145
+ })
146
+ child = parent
145
147
  }
146
- value = [batcher, pfxmatch[1]]
147
- } else {
148
- value = [batcher]
149
- }
150
148
 
151
- shard.entries = Shard.putEntry(
152
- asShardEntries(shard.entries.filter(e => matches.every(m => e[0] !== m[0]))),
153
- asShardEntry([prefix, value])
154
- )
149
+ // remove the sharded entry
150
+ targetEntries.splice(i, 1)
151
+
152
+ // create the entry that will be added to target
153
+ if (commonChars.length === 1 && common === k) {
154
+ if (Array.isArray(v)) throw new Error('found a shard link when expecting a value')
155
+ entry = [commonChars[0], [child, v]]
156
+ } else if (commonChars.length === 1 && common === dest.key) {
157
+ entry = [commonChars[0], [child, value]]
158
+ } else {
159
+ entry = [commonChars[0], [child]]
160
+ }
161
+ break
162
+ }
155
163
  }
164
+
165
+ shard.entries = Shard.putEntry(asShardEntries(targetEntries), asShardEntry(entry))
156
166
  }
157
167
 
158
168
  /**
@@ -160,11 +170,11 @@ export const put = async (blocks, shard, key, value) => {
160
170
  * key.
161
171
  *
162
172
  * @param {ShardFetcher} shards
163
- * @param {string} key
164
173
  * @param {API.BatcherShard} shard
174
+ * @param {string} key
165
175
  * @returns {Promise<{ shard: API.BatcherShard, key: string }>}
166
176
  */
167
- export const traverse = async (shards, key, shard) => {
177
+ export const traverse = async (shards, shard, key) => {
168
178
  for (let i = 0; i < shard.entries.length; i++) {
169
179
  const [k, v] = shard.entries[i]
170
180
  if (key <= k) break
@@ -173,9 +183,9 @@ export const traverse = async (shards, key, shard) => {
173
183
  const blk = await shards.get(v[0])
174
184
  const batcher = BatcherShard.create({ base: blk, ...blk.value })
175
185
  shard.entries[i] = [k, v[1] == null ? [batcher] : [batcher, v[1]]]
176
- return traverse(shards, key.slice(k.length), batcher)
186
+ return traverse(shards, batcher, key.slice(k.length))
177
187
  }
178
- return traverse(shards, key.slice(k.length), v[0])
188
+ return traverse(shards, v[0], key.slice(k.length))
179
189
  }
180
190
  }
181
191
  return { shard, key }
package/src/crdt/api.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ShardDiff, ShardLink, UnknownLink } from '../api.js'
2
2
  import { EventLink, EventBlockView } from '../clock/api.js'
3
3
 
4
- export { BlockFetcher, UnknownLink, ShardBlockView, ShardDiff, ShardLink } from '../api.js'
4
+ export { BlockFetcher, UnknownLink, ShardBlockView, ShardDiff, ShardLink, EntriesOptions } from '../api.js'
5
5
  export { EventBlockView, EventLink } from '../clock/api.js'
6
6
 
7
7
  export interface Result extends ShardDiff {
@@ -21,20 +21,22 @@ class Batcher {
21
21
  * @param {API.EventLink<API.Operation>[]} init.head Merkle clock head.
22
22
  * @param {API.BatcherShardEntry[]} init.entries The entries in this shard.
23
23
  * @param {string} init.prefix Key prefix.
24
- * @param {number} init.maxSize
25
- * @param {number} init.maxKeyLength
24
+ * @param {number} init.version Shard compatibility version.
25
+ * @param {string} init.keyChars Characters allowed in keys, referring to a known character set.
26
+ * @param {number} init.maxKeySize Max key size in bytes.
26
27
  * @param {API.ShardBlockView} init.base Original shard this batcher is based on.
27
28
  * @param {API.ShardBlockView[]} init.additions Additions to include in the committed batch.
28
29
  * @param {API.ShardBlockView[]} init.removals Removals to include in the committed batch.
29
30
  */
30
- constructor ({ blocks, head, entries, prefix, maxSize, maxKeyLength, base, additions, removals }) {
31
+ constructor ({ blocks, head, entries, prefix, version, keyChars, maxKeySize, base, additions, removals }) {
31
32
  this.blocks = blocks
32
33
  this.head = head
33
34
  this.prefix = prefix
34
35
  this.entries = [...entries]
35
36
  this.base = base
36
- this.maxSize = maxSize
37
- this.maxKeyLength = maxKeyLength
37
+ this.version = version
38
+ this.keyChars = keyChars
39
+ this.maxKeySize = maxKeySize
38
40
  this.additions = additions
39
41
  this.removals = removals
40
42
  /** @type {API.BatchOperation['ops']} */
@@ -107,9 +109,8 @@ class Batcher {
107
109
  * @param {object} init
108
110
  * @param {API.BlockFetcher} init.blocks Block storage.
109
111
  * @param {API.EventLink<API.Operation>[]} init.head Merkle clock head.
110
- * @param {string} init.prefix
111
112
  */
112
- static async create ({ blocks, head, prefix }) {
113
+ static async create ({ blocks, head }) {
113
114
  const mblocks = new MemoryBlockstore()
114
115
  blocks = new MultiBlockFetcher(mblocks, blocks)
115
116
 
@@ -120,7 +121,6 @@ class Batcher {
120
121
  blocks,
121
122
  head,
122
123
  entries: [],
123
- prefix,
124
124
  base,
125
125
  additions: [base],
126
126
  removals: [],
@@ -139,7 +139,6 @@ class Batcher {
139
139
  blocks,
140
140
  head,
141
141
  entries: base.value.entries,
142
- prefix,
143
142
  base,
144
143
  additions,
145
144
  removals,
@@ -153,4 +152,4 @@ class Batcher {
153
152
  * @param {API.EventLink<API.Operation>[]} head Merkle clock head.
154
153
  * @returns {Promise<API.CRDTBatcher>}
155
154
  */
156
- export const create = (blocks, head) => Batcher.create({ blocks, head, prefix: '' })
155
+ export const create = (blocks, head) => Batcher.create({ blocks, head })
package/src/crdt/index.js CHANGED
@@ -228,8 +228,7 @@ export const get = async (blocks, head, key) => {
228
228
  /**
229
229
  * @param {API.BlockFetcher} blocks Bucket block storage.
230
230
  * @param {API.EventLink<API.Operation>[]} head Merkle clock head.
231
- * @param {object} [options]
232
- * @param {string} [options.prefix]
231
+ * @param {API.EntriesOptions} [options]
233
232
  */
234
233
  export const entries = async function * (blocks, head, options) {
235
234
  if (!head.length) return
@@ -1,62 +0,0 @@
1
- export function create(blocks: API.BlockFetcher, root: API.ShardLink): Promise<API.Batcher>;
2
- export type BatcherShardEntry = [
3
- key: string,
4
- value: API.ShardEntryValueValue | [API.ShardLink] | [API.ShardLink, Link.UnknownLink],
5
- batcher?: Batcher
6
- ];
7
- import * as API from './api.js';
8
- /** @implements {API.Batcher} */
9
- declare class Batcher implements API.Batcher {
10
- /**
11
- * @param {ShardFetcher} shards Shard storage.
12
- * @param {API.ShardLink} link CID of the shard block.
13
- * @param {string} prefix
14
- */
15
- static create(shards: ShardFetcher, link: API.ShardLink, prefix: string): Promise<Batcher>;
16
- /**
17
- * @param {object} arg
18
- * @param {ShardFetcher} arg.shards Shard storage.
19
- * @param {BatcherShardEntry[]} arg.entries The entries in this shard.
20
- * @param {string} arg.prefix Key prefix.
21
- * @param {API.ShardConfig} arg.config Shard config.
22
- * @param {API.ShardBlockView} [arg.base] Original shard this batcher is based on.
23
- */
24
- constructor({ shards, entries, prefix, config, base }: {
25
- shards: ShardFetcher;
26
- entries: BatcherShardEntry[];
27
- prefix: string;
28
- config: API.ShardConfig;
29
- base?: API.ShardBlockView | undefined;
30
- });
31
- shards: ShardFetcher;
32
- prefix: string;
33
- entries: BatcherShardEntry[];
34
- config: API.ShardConfig;
35
- base: API.ShardBlockView | undefined;
36
- /**
37
- * @param {string} key The key of the value to put.
38
- * @param {API.UnknownLink} value The value to put.
39
- * @returns {Promise<void>}
40
- */
41
- put(key: string, value: API.UnknownLink): Promise<void>;
42
- /**
43
- * Traverse from this batcher through the shard to the correct batcher for
44
- * the passed key.
45
- *
46
- * @param {string} key
47
- * @returns {Promise<{ batcher: Batcher, key: string }>}
48
- */
49
- traverse(key: string): Promise<{
50
- batcher: Batcher;
51
- key: string;
52
- }>;
53
- commit(): Promise<{
54
- root: import("multiformats").CID<API.Shard, 113, 18, 1>;
55
- additions: API.ShardBlockView[];
56
- removals: API.ShardBlockView[];
57
- }>;
58
- }
59
- import * as Link from 'multiformats/link';
60
- import { ShardFetcher } from './shard.js';
61
- export {};
62
- //# sourceMappingURL=batch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../src/batch.js"],"names":[],"mappings":"AA2NO,+BAJI,IAAI,YAAY,QAChB,IAAI,SAAS,GACX,QAAQ,WAAW,CAAC,CAKhC;gCAvNY;IACZ,GAAO,EAAE,MAAM;IACf,KAAS,EAAE,IAAI,oBAAoB,sDAA4D;IAC/F,OAAW,CAAC,EAAE,OAAO;CAClB;qBATiB,UAAU;AAc/B,gCAAgC;AAChC,iCADiB,GAAG,CAAC,OAAO;IA4K1B;;;;OAIG;IACH,sBAJW,YAAY,QACZ,IAAI,SAAS,UACb,MAAM,oBAWhB;IAxLD;;;;;;;OAOG;IACH;QAN6B,MAAM,EAAxB,YAAY;QACa,OAAO,EAAhC,mBAAmB;QACP,MAAM,EAAlB,MAAM;QACe,MAAM,EAA3B,IAAI,WAAW;QACU,IAAI;OAQvC;IALC,qBAAoB;IACpB,eAAoB;IACpB,6BAAsB;IACtB,wBAAoB;IACpB,qCAAgB;IAGlB;;;;OAIG;IACH,SAJW,MAAM,SACN,IAAI,WAAW,GACb,QAAQ,IAAI,CAAC,CA6FzB;IAED;;;;;;OAMG;IACH,cAHW,MAAM,GACJ,QAAQ;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAetD;IAED;;;;OAgCC;CAiBF;sBA3MqB,mBAAmB;6BAGZ,YAAY"}
@@ -1,3 +0,0 @@
1
- export function create(blocks: API.BlockFetcher, root: API.ShardLink): Promise<API.Batcher>;
2
- import * as API from '../api.js';
3
- //# sourceMappingURL=batch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../../src/crdt/batch.js"],"names":[],"mappings":"AASO,+BAJI,IAAI,YAAY,QAChB,IAAI,SAAS,GACX,QAAQ,IAAI,OAAO,CAAC,CAKhC;qBAXoB,WAAW"}
File without changes