@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/README.md CHANGED
@@ -155,6 +155,14 @@ It might be that using our provided deno.json is somekind of odd
155
155
  deno run --config node_modules/@fireproof/core/deno.json --allow-read --allow-write --allow-env --unstable-sloppy-imports ./node-test.ts
156
156
  ```
157
157
 
158
+ ### Create Docs
159
+
160
+ Caution it will be pushed directly
161
+
162
+ ```shell
163
+ pnpm run build:doc
164
+ ```
165
+
158
166
  ## Thanks 🙏
159
167
 
160
168
  Fireproof is a synthesis of work done by people in the web community over the years. I couldn't even begin to name all the folks who made pivotal contributions. Without npm, React, and VS Code all this would have taken so much longer. Thanks to everyone who supported me getting into database development via Apache CouchDB, one of the original document databases. The distinguishing work on immutable data-structures comes from the years of consideration [IPFS](https://ipfs.tech), [IPLD](https://ipld.io), and the [Filecoin APIs](https://docs.filecoin.io) have enjoyed.
package/deno.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "imports": {
3
3
  "@fireproof/core": "./index.js",
4
- "@adviser/cement": "npm:@adviser/cement@^0.2.41",
4
+ "@adviser/cement": "npm:@adviser/cement@^0.3.0",
5
5
  "@fireproof/vendor": "npm:@fireproof/vendor@^1.0.0",
6
6
  "@ipld/unixfs": "npm:@ipld/unixfs@^3.0.0",
7
7
  "multiformats": "npm:multiformats@^13.3.1",
8
8
  "charwise": "npm:charwise@^3.0.1",
9
9
  "prolly-trees": "npm:prolly-trees@^1.0.4",
10
- "idb": "npm:idb@^8.0.0",
11
- "memfs": "npm:memfs@^4.15.0",
12
- "p-limit": "npm:p-limit@^6.1.0",
10
+ "idb": "npm:idb@^8.0.1",
11
+ "memfs": "npm:memfs@^4.15.1",
12
+ "p-limit": "npm:p-limit@^6.2.0",
13
13
  "p-map": "npm:p-map@^7.0.3",
14
14
  "p-retry": "npm:p-retry@^6.2.1"
15
15
  }
package/index.cjs CHANGED
@@ -714,8 +714,8 @@ var init_gateway2 = __esm({
714
714
  });
715
715
 
716
716
  // src/index.ts
717
- var src_exports = {};
718
- __export(src_exports, {
717
+ var index_exports = {};
718
+ __export(index_exports, {
719
719
  CRDT: () => CRDT,
720
720
  Database: () => Database,
721
721
  Index: () => Index,
@@ -742,7 +742,7 @@ __export(src_exports, {
742
742
  runtime: () => runtime_exports,
743
743
  throwFalsy: () => throwFalsy
744
744
  });
745
- module.exports = __toCommonJS(src_exports);
745
+ module.exports = __toCommonJS(index_exports);
746
746
 
747
747
  // src/database.ts
748
748
  var import_cement16 = require("@adviser/cement");
@@ -3994,11 +3994,17 @@ var Database = class {
3994
3994
  static {
3995
3995
  this.databases = /* @__PURE__ */ new Map();
3996
3996
  }
3997
+ /**
3998
+ * Close the database and release resources
3999
+ */
3997
4000
  async close() {
3998
4001
  await this.ready();
3999
4002
  await this._crdt.close();
4000
4003
  await this.blockstore.close();
4001
4004
  }
4005
+ /**
4006
+ * Destroy the database and release all resources
4007
+ */
4002
4008
  async destroy() {
4003
4009
  await this.ready();
4004
4010
  await this._crdt.destroy();
@@ -4011,6 +4017,12 @@ var Database = class {
4011
4017
  await this.blockstore.ready();
4012
4018
  });
4013
4019
  }
4020
+ /**
4021
+ * Get a document from the database
4022
+ * @param id - the document id
4023
+ * @returns the document with the _id
4024
+ * @throws NotFoundError if the document is not found
4025
+ */
4014
4026
  async get(id) {
4015
4027
  if (!id) throw this.logger.Error().Str("db", this.name).Msg(`Doc id is required`).AsError();
4016
4028
  await this.ready();
@@ -4022,6 +4034,11 @@ var Database = class {
4022
4034
  const { doc } = got;
4023
4035
  return { ...doc, _id: id };
4024
4036
  }
4037
+ /**
4038
+ * Put a document from the database
4039
+ * @param doc - the document to put
4040
+ * @returns add DocResponse with the id and clock
4041
+ */
4025
4042
  async put(doc) {
4026
4043
  await this.ready();
4027
4044
  this.logger.Debug().Str("id", doc._id).Msg("put");
@@ -4036,6 +4053,11 @@ var Database = class {
4036
4053
  });
4037
4054
  return { id: docId, clock: result?.head, name: this.name };
4038
4055
  }
4056
+ /**
4057
+ * delete a document from the database
4058
+ * @param id Document id
4059
+ * @returns DocResponse with the id and clock
4060
+ */
4039
4061
  async del(id) {
4040
4062
  await this.ready();
4041
4063
  this.logger.Debug().Str("id", id).Msg("del");
@@ -4193,6 +4215,6 @@ init_utils();
4193
4215
 
4194
4216
  // src/version.ts
4195
4217
  var PACKAGE_VERSION = Object.keys({
4196
- "0.19.118": "xxxx"
4218
+ "0.19.119": "xxxx"
4197
4219
  })[0];
4198
4220
  //# sourceMappingURL=index.cjs.map