@fireproof/core 0.5.18 → 0.5.19
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/dist/src/clock.js +3 -3
- package/dist/src/database.js +13 -3
- package/dist/src/fireproof.d.ts +4 -28
- package/dist/src/fireproof.js +17 -6
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +17 -6
- package/dist/src/fireproof.mjs.map +1 -1
- package/package.json +2 -2
- package/src/clock.js +3 -3
- package/src/database.js +14 -3
package/dist/src/fireproof.mjs
CHANGED
@@ -5564,7 +5564,7 @@ class EventBlock extends Block {
|
|
5564
5564
|
* @param {Uint8Array} config.bytes
|
5565
5565
|
*/
|
5566
5566
|
constructor ({ cid, value, bytes }) {
|
5567
|
-
// @ts-
|
5567
|
+
// @ts-ignore
|
5568
5568
|
super({ cid, value, bytes });
|
5569
5569
|
}
|
5570
5570
|
|
@@ -5618,7 +5618,7 @@ class EventFetcher {
|
|
5618
5618
|
async function encodeEventBlock (value) {
|
5619
5619
|
// TODO: sort parents
|
5620
5620
|
const { cid, bytes } = await encode$7({ value, codec: codec$1, hasher: sha256$2 });
|
5621
|
-
// @ts-
|
5621
|
+
// @ts-ignore
|
5622
5622
|
return new Block({ cid, value, bytes })
|
5623
5623
|
}
|
5624
5624
|
|
@@ -5629,7 +5629,7 @@ async function encodeEventBlock (value) {
|
|
5629
5629
|
*/
|
5630
5630
|
async function decodeEventBlock (bytes) {
|
5631
5631
|
const { cid, value } = await decode$9({ bytes, codec: codec$1, hasher: sha256$2 });
|
5632
|
-
// @ts-
|
5632
|
+
// @ts-ignore
|
5633
5633
|
return new Block({ cid, value, bytes })
|
5634
5634
|
}
|
5635
5635
|
|
@@ -41012,6 +41012,18 @@ class Database {
|
|
41012
41012
|
}
|
41013
41013
|
}
|
41014
41014
|
|
41015
|
+
index (name) {
|
41016
|
+
// iterate over the indexes and gather any with the same name
|
41017
|
+
// if there are more than one, throw an error
|
41018
|
+
// if there is one, return it
|
41019
|
+
// if there are none, return null
|
41020
|
+
const indexes = [...this.indexes.values()].filter(index => index.name === name);
|
41021
|
+
if (indexes.length > 1) {
|
41022
|
+
throw new Error(`Multiple indexes found with name ${name}`)
|
41023
|
+
}
|
41024
|
+
return indexes[0] || null
|
41025
|
+
}
|
41026
|
+
|
41015
41027
|
/**
|
41016
41028
|
* Triggers a notification to all listeners
|
41017
41029
|
* of the Fireproof instance so they can repaint UI, etc.
|
@@ -41159,12 +41171,11 @@ class Database {
|
|
41159
41171
|
return doc
|
41160
41172
|
}
|
41161
41173
|
/**
|
41162
|
-
* @typedef {
|
41174
|
+
* @typedef {any} Document
|
41163
41175
|
* @property {string} _id - The ID of the document (required)
|
41164
41176
|
* @property {string} [_proof] - The proof of the document (optional)
|
41165
41177
|
* @property {string} [_clock] - The clock of the document (optional)
|
41166
|
-
* @property {any} [
|
41167
|
-
* * @property {Object.<string, any>} [otherProperties] - Any other unknown properties (optional)
|
41178
|
+
* @property {Object.<string, any>} [unknown: string] - Any other unknown properties (optional)
|
41168
41179
|
*/
|
41169
41180
|
|
41170
41181
|
/**
|