@fireproof/core 0.19.118 → 0.19.119
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/README.md +8 -0
- package/deno.json +4 -4
- package/index.cjs +26 -4
- package/index.cjs.map +1 -1
- package/index.d.cts +1 -0
- package/index.d.ts +1 -0
- package/index.js +23 -1
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +5 -5
- package/react/index.cjs +3 -3
- package/tests/blockstore/fragment-gateway.test.ts +2 -3
- package/tests/blockstore/keyed-crypto.test.ts +7 -7
- package/tests/blockstore/loader.test.ts +4 -5
- package/tests/blockstore/store.test.ts +5 -6
- package/tests/blockstore/transaction.test.ts +5 -6
- package/tests/fireproof/all-gateway.test.ts +4 -5
- package/tests/fireproof/config.test.ts +2 -3
- package/tests/fireproof/crdt.test.ts +10 -11
- package/tests/fireproof/database.test.ts +9 -9
- package/tests/fireproof/fireproof.test.ts +11 -11
- package/tests/fireproof/indexer.test.ts +9 -10
- package/tests/fireproof/multiple-ledger.test.ts +2 -3
- package/tests/fireproof/utils.test.ts +2 -3
- package/tests/helpers.ts +15 -15
- package/web/gateway-impl.d.cts +1 -0
- package/web/gateway-impl.d.ts +1 -0
package/index.d.cts
CHANGED
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -3268,11 +3268,17 @@ var Database = class {
|
|
3268
3268
|
static {
|
3269
3269
|
this.databases = /* @__PURE__ */ new Map();
|
3270
3270
|
}
|
3271
|
+
/**
|
3272
|
+
* Close the database and release resources
|
3273
|
+
*/
|
3271
3274
|
async close() {
|
3272
3275
|
await this.ready();
|
3273
3276
|
await this._crdt.close();
|
3274
3277
|
await this.blockstore.close();
|
3275
3278
|
}
|
3279
|
+
/**
|
3280
|
+
* Destroy the database and release all resources
|
3281
|
+
*/
|
3276
3282
|
async destroy() {
|
3277
3283
|
await this.ready();
|
3278
3284
|
await this._crdt.destroy();
|
@@ -3285,6 +3291,12 @@ var Database = class {
|
|
3285
3291
|
await this.blockstore.ready();
|
3286
3292
|
});
|
3287
3293
|
}
|
3294
|
+
/**
|
3295
|
+
* Get a document from the database
|
3296
|
+
* @param id - the document id
|
3297
|
+
* @returns the document with the _id
|
3298
|
+
* @throws NotFoundError if the document is not found
|
3299
|
+
*/
|
3288
3300
|
async get(id) {
|
3289
3301
|
if (!id) throw this.logger.Error().Str("db", this.name).Msg(`Doc id is required`).AsError();
|
3290
3302
|
await this.ready();
|
@@ -3296,6 +3308,11 @@ var Database = class {
|
|
3296
3308
|
const { doc } = got;
|
3297
3309
|
return { ...doc, _id: id };
|
3298
3310
|
}
|
3311
|
+
/**
|
3312
|
+
* Put a document from the database
|
3313
|
+
* @param doc - the document to put
|
3314
|
+
* @returns add DocResponse with the id and clock
|
3315
|
+
*/
|
3299
3316
|
async put(doc) {
|
3300
3317
|
await this.ready();
|
3301
3318
|
this.logger.Debug().Str("id", doc._id).Msg("put");
|
@@ -3310,6 +3327,11 @@ var Database = class {
|
|
3310
3327
|
});
|
3311
3328
|
return { id: docId, clock: result?.head, name: this.name };
|
3312
3329
|
}
|
3330
|
+
/**
|
3331
|
+
* delete a document from the database
|
3332
|
+
* @param id Document id
|
3333
|
+
* @returns DocResponse with the id and clock
|
3334
|
+
*/
|
3313
3335
|
async del(id) {
|
3314
3336
|
await this.ready();
|
3315
3337
|
this.logger.Debug().Str("id", id).Msg("del");
|
@@ -3462,7 +3484,7 @@ var INDEXDB_VERSION = "v0.19-indexdb";
|
|
3462
3484
|
|
3463
3485
|
// src/version.ts
|
3464
3486
|
var PACKAGE_VERSION = Object.keys({
|
3465
|
-
"0.19.
|
3487
|
+
"0.19.119": "xxxx"
|
3466
3488
|
})[0];
|
3467
3489
|
export {
|
3468
3490
|
CRDT,
|