@fireproof/core 0.5.1 → 0.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fireproof/core",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Cloudless database for apps, the browser, and IPFS",
5
5
  "main": "dist/src/fireproof.js",
6
6
  "module": "dist/src/fireproof.mjs",
package/src/db-index.js CHANGED
@@ -100,8 +100,8 @@ export class DbIndex {
100
100
  }
101
101
  if (typeof name === 'function') {
102
102
  // app is using deprecated API, remove in 0.7
103
- opts = clock
104
- clock = mapFn
103
+ opts = clock || {}
104
+ clock = mapFn || null
105
105
  mapFn = name
106
106
  name = null
107
107
  }
@@ -244,7 +244,8 @@ export class DbIndex {
244
244
  let removeByIdIndexEntries = []
245
245
  await loadIndex(blocks, this.indexById, idIndexOpts)
246
246
  await loadIndex(blocks, this.indexByKey, dbIndexOpts)
247
- if (this.dbHead) {
247
+ console.log('head', this.dbHead, this.indexById)
248
+ if (this.indexById.root) {
248
249
  const oldChangeEntries = await this.indexById.root.getMany(result.rows.map(({ key }) => key))
249
250
  oldIndexEntries = oldChangeEntries.result.map((key) => ({ key, del: true }))
250
251
  removeByIdIndexEntries = oldIndexEntries.map(({ key }) => ({ key: key[1], del: true }))