@fireproof/core 0.19.118 → 0.19.119

Sign up to get free protection for your applications and to get access to all the features.
package/index.d.cts CHANGED
@@ -718,6 +718,7 @@ interface SuperThisOpts {
718
718
  }
719
719
  interface SuperThis {
720
720
  readonly logger: Logger;
721
+ readonly loggerCollector?: Logger;
721
722
  readonly env: Env;
722
723
  readonly pathOps: PathOps;
723
724
  readonly ctx: Record<string, unknown>;
package/index.d.ts CHANGED
@@ -718,6 +718,7 @@ interface SuperThisOpts {
718
718
  }
719
719
  interface SuperThis {
720
720
  readonly logger: Logger;
721
+ readonly loggerCollector?: Logger;
721
722
  readonly env: Env;
722
723
  readonly pathOps: PathOps;
723
724
  readonly ctx: Record<string, unknown>;
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.118": "xxxx"
3487
+ "0.19.119": "xxxx"
3466
3488
  })[0];
3467
3489
  export {
3468
3490
  CRDT,