@fireproof/core 0.19.119-dev-log → 0.19.120

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. package/README.md +8 -0
  2. package/{chunk-WVN66YAN.js → chunk-F4FC6B2T.js} +5 -13
  3. package/chunk-F4FC6B2T.js.map +1 -0
  4. package/{chunk-2D2X6HIB.js → chunk-RXC4JGJT.js} +13 -2
  5. package/chunk-RXC4JGJT.js.map +1 -0
  6. package/deno.json +5 -5
  7. package/{gateway-G4CPXEQF.js → gateway-C62S56GY.js} +2 -2
  8. package/{gateway-G4CPXEQF.js.map → gateway-C62S56GY.js.map} +1 -1
  9. package/{gateway-2O7QPHGW.js → gateway-VVS4QWDA.js} +3 -3
  10. package/gateway-VVS4QWDA.js.map +1 -0
  11. package/index.cjs +47 -21
  12. package/index.cjs.map +1 -1
  13. package/index.d.cts +2 -1
  14. package/index.d.ts +2 -1
  15. package/index.js +34 -10
  16. package/index.js.map +1 -1
  17. package/{key-bag-file-CBCAWTVG.js → key-bag-file-PWZ3QE7B.js} +3 -3
  18. package/{key-bag-indexdb-RTSMSGM7.js → key-bag-indexdb-SYG3YD4D.js} +3 -3
  19. package/metafile-cjs.json +1 -1
  20. package/metafile-esm.json +1 -1
  21. package/node/mem-filesystem.cjs.map +1 -1
  22. package/node/mem-filesystem.d.cts +1 -1
  23. package/node/mem-filesystem.d.ts +1 -1
  24. package/node/mem-filesystem.js.map +1 -1
  25. package/node/metafile-cjs.json +1 -1
  26. package/node/metafile-esm.json +1 -1
  27. package/node/node-filesystem.cjs.map +1 -1
  28. package/node/node-filesystem.d.cts +1 -2
  29. package/node/node-filesystem.d.ts +1 -2
  30. package/node/node-filesystem.js.map +1 -1
  31. package/package.json +17 -17
  32. package/react/index.cjs +3 -3
  33. package/tests/fireproof/config.test.ts +1 -0
  34. package/tests/fireproof/multiple-ledger.test.ts +1 -1
  35. package/{utils-XESRUKDJ.js → utils-ZVVGAXFE.js} +3 -3
  36. package/web/gateway-impl.cjs +24 -167
  37. package/web/gateway-impl.cjs.map +1 -1
  38. package/web/gateway-impl.d.cts +5 -59
  39. package/web/gateway-impl.d.ts +5 -59
  40. package/web/gateway-impl.js +7 -162
  41. package/web/gateway-impl.js.map +1 -1
  42. package/web/metafile-cjs.json +1 -1
  43. package/web/metafile-esm.json +1 -1
  44. package/chunk-2D2X6HIB.js.map +0 -1
  45. package/chunk-WVN66YAN.js.map +0 -1
  46. package/gateway-2O7QPHGW.js.map +0 -1
  47. package/node/types-DARSfXlb.d.cts +0 -23
  48. package/node/types-DARSfXlb.d.ts +0 -23
  49. /package/{key-bag-file-CBCAWTVG.js.map → key-bag-file-PWZ3QE7B.js.map} +0 -0
  50. /package/{key-bag-indexdb-RTSMSGM7.js.map → key-bag-indexdb-SYG3YD4D.js.map} +0 -0
  51. /package/{utils-XESRUKDJ.js.map → utils-ZVVGAXFE.js.map} +0 -0
package/index.d.cts CHANGED
@@ -43,6 +43,7 @@ declare class CommitQueue<T = void> {
43
43
  processNext(): void;
44
44
  }
45
45
 
46
+ declare function onSuperThis(fn: (sthis: SuperThis) => void): () => void;
46
47
  declare function ensureSuperThis(osthis?: Partial<SuperThisOpts>): SuperThis;
47
48
  declare function ensureSuperLog(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): SuperThis;
48
49
  declare function ensureLogger(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): Logger;
@@ -1137,5 +1138,5 @@ declare namespace index {
1137
1138
 
1138
1139
  declare const PACKAGE_VERSION: string;
1139
1140
 
1140
- export { type AllDocsQueryOpts, type AllDocsResponse, CRDT, type CRDTEntry, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type Connectable, Database, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, type DocResponse, type DocSet, type DocTypes, type DocUpdate, type DocValue, type DocWithId, type Falsy, type FileTransactionMeta, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type ListenerFn, type MapFn, type MetaType, type NoUpdateListenerFn, NotFoundError, PACKAGE_VERSION, type PathOps, type QueryOpts, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, UInt8ArrayEqual, type UnknownDoc, type UpdateListenerFn, index$3 as blockstore, index$3 as bs, dataDir, ensureLogger, ensureSuperLog, ensureSuperThis, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$2 as index, isFalsy, isNotFoundError, index as rt, index as runtime, throwFalsy };
1141
+ export { type AllDocsQueryOpts, type AllDocsResponse, CRDT, type CRDTEntry, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type Connectable, Database, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, type DocResponse, type DocSet, type DocTypes, type DocUpdate, type DocValue, type DocWithId, type Falsy, type FileTransactionMeta, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type ListenerFn, type MapFn, type MetaType, type NoUpdateListenerFn, NotFoundError, PACKAGE_VERSION, type PathOps, type QueryOpts, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, UInt8ArrayEqual, type UnknownDoc, type UpdateListenerFn, index$3 as blockstore, index$3 as bs, dataDir, ensureLogger, ensureSuperLog, ensureSuperThis, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$2 as index, isFalsy, isNotFoundError, onSuperThis, index as rt, index as runtime, throwFalsy };
1141
1142
  declare module '@fireproof/core'
package/index.d.ts CHANGED
@@ -43,6 +43,7 @@ declare class CommitQueue<T = void> {
43
43
  processNext(): void;
44
44
  }
45
45
 
46
+ declare function onSuperThis(fn: (sthis: SuperThis) => void): () => void;
46
47
  declare function ensureSuperThis(osthis?: Partial<SuperThisOpts>): SuperThis;
47
48
  declare function ensureSuperLog(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): SuperThis;
48
49
  declare function ensureLogger(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): Logger;
@@ -1137,5 +1138,5 @@ declare namespace index {
1137
1138
 
1138
1139
  declare const PACKAGE_VERSION: string;
1139
1140
 
1140
- export { type AllDocsQueryOpts, type AllDocsResponse, CRDT, type CRDTEntry, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type Connectable, Database, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, type DocResponse, type DocSet, type DocTypes, type DocUpdate, type DocValue, type DocWithId, type Falsy, type FileTransactionMeta, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type ListenerFn, type MapFn, type MetaType, type NoUpdateListenerFn, NotFoundError, PACKAGE_VERSION, type PathOps, type QueryOpts, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, UInt8ArrayEqual, type UnknownDoc, type UpdateListenerFn, index$3 as blockstore, index$3 as bs, dataDir, ensureLogger, ensureSuperLog, ensureSuperThis, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$2 as index, isFalsy, isNotFoundError, index as rt, index as runtime, throwFalsy };
1141
+ export { type AllDocsQueryOpts, type AllDocsResponse, CRDT, type CRDTEntry, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type Connectable, Database, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, type DocResponse, type DocSet, type DocTypes, type DocUpdate, type DocValue, type DocWithId, type Falsy, type FileTransactionMeta, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type ListenerFn, type MapFn, type MetaType, type NoUpdateListenerFn, NotFoundError, PACKAGE_VERSION, type PathOps, type QueryOpts, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, UInt8ArrayEqual, type UnknownDoc, type UpdateListenerFn, index$3 as blockstore, index$3 as bs, dataDir, ensureLogger, ensureSuperLog, ensureSuperThis, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$2 as index, isFalsy, isNotFoundError, onSuperThis, index as rt, index as runtime, throwFalsy };
1141
1142
  declare module '@fireproof/core'
package/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  getFileName,
6
6
  getFileSystem,
7
7
  getPath
8
- } from "./chunk-WVN66YAN.js";
8
+ } from "./chunk-F4FC6B2T.js";
9
9
  import {
10
10
  NotFoundError,
11
11
  Result,
@@ -18,8 +18,9 @@ import {
18
18
  getKey,
19
19
  getName,
20
20
  getStore,
21
- isNotFoundError
22
- } from "./chunk-2D2X6HIB.js";
21
+ isNotFoundError,
22
+ onSuperThis
23
+ } from "./chunk-RXC4JGJT.js";
23
24
  import {
24
25
  __export
25
26
  } from "./chunk-PZ5AY32C.js";
@@ -683,14 +684,14 @@ var keyBagProviderFactories = new Map(
683
684
  {
684
685
  protocol: "file:",
685
686
  factory: async (url, sthis) => {
686
- const { KeyBagProviderFile } = await import("./key-bag-file-CBCAWTVG.js");
687
+ const { KeyBagProviderFile } = await import("./key-bag-file-PWZ3QE7B.js");
687
688
  return new KeyBagProviderFile(url, sthis);
688
689
  }
689
690
  },
690
691
  {
691
692
  protocol: "indexdb:",
692
693
  factory: async (url, sthis) => {
693
- const { KeyBagProviderIndexDB } = await import("./key-bag-indexdb-RTSMSGM7.js");
694
+ const { KeyBagProviderIndexDB } = await import("./key-bag-indexdb-SYG3YD4D.js");
694
695
  return new KeyBagProviderIndexDB(url, sthis);
695
696
  }
696
697
  }
@@ -2243,22 +2244,22 @@ function toStoreRuntime(opts, sthis) {
2243
2244
  registerStoreProtocol({
2244
2245
  protocol: "file:",
2245
2246
  gateway: async (sthis) => {
2246
- const { FileGateway } = await import("./gateway-2O7QPHGW.js");
2247
+ const { FileGateway } = await import("./gateway-VVS4QWDA.js");
2247
2248
  return new FileGateway(sthis);
2248
2249
  },
2249
2250
  test: async (sthis) => {
2250
- const { FileTestStore } = await import("./gateway-2O7QPHGW.js");
2251
+ const { FileTestStore } = await import("./gateway-VVS4QWDA.js");
2251
2252
  return new FileTestStore(sthis);
2252
2253
  }
2253
2254
  });
2254
2255
  registerStoreProtocol({
2255
2256
  protocol: "indexdb:",
2256
2257
  gateway: async (sthis) => {
2257
- const { IndexDBGateway } = await import("./gateway-G4CPXEQF.js");
2258
+ const { IndexDBGateway } = await import("./gateway-C62S56GY.js");
2258
2259
  return new IndexDBGateway(sthis);
2259
2260
  },
2260
2261
  test: async (sthis) => {
2261
- const { IndexDBTestStore } = await import("./gateway-G4CPXEQF.js");
2262
+ const { IndexDBTestStore } = await import("./gateway-C62S56GY.js");
2262
2263
  return new IndexDBTestStore(sthis);
2263
2264
  }
2264
2265
  });
@@ -3268,11 +3269,17 @@ var Database = class {
3268
3269
  static {
3269
3270
  this.databases = /* @__PURE__ */ new Map();
3270
3271
  }
3272
+ /**
3273
+ * Close the database and release resources
3274
+ */
3271
3275
  async close() {
3272
3276
  await this.ready();
3273
3277
  await this._crdt.close();
3274
3278
  await this.blockstore.close();
3275
3279
  }
3280
+ /**
3281
+ * Destroy the database and release all resources
3282
+ */
3276
3283
  async destroy() {
3277
3284
  await this.ready();
3278
3285
  await this._crdt.destroy();
@@ -3285,6 +3292,12 @@ var Database = class {
3285
3292
  await this.blockstore.ready();
3286
3293
  });
3287
3294
  }
3295
+ /**
3296
+ * Get a document from the database
3297
+ * @param id - the document id
3298
+ * @returns the document with the _id
3299
+ * @throws NotFoundError if the document is not found
3300
+ */
3288
3301
  async get(id) {
3289
3302
  if (!id) throw this.logger.Error().Str("db", this.name).Msg(`Doc id is required`).AsError();
3290
3303
  await this.ready();
@@ -3296,6 +3309,11 @@ var Database = class {
3296
3309
  const { doc } = got;
3297
3310
  return { ...doc, _id: id };
3298
3311
  }
3312
+ /**
3313
+ * Put a document from the database
3314
+ * @param doc - the document to put
3315
+ * @returns add DocResponse with the id and clock
3316
+ */
3299
3317
  async put(doc) {
3300
3318
  await this.ready();
3301
3319
  this.logger.Debug().Str("id", doc._id).Msg("put");
@@ -3310,6 +3328,11 @@ var Database = class {
3310
3328
  });
3311
3329
  return { id: docId, clock: result?.head, name: this.name };
3312
3330
  }
3331
+ /**
3332
+ * delete a document from the database
3333
+ * @param id Document id
3334
+ * @returns DocResponse with the id and clock
3335
+ */
3313
3336
  async del(id) {
3314
3337
  await this.ready();
3315
3338
  this.logger.Debug().Str("id", id).Msg("del");
@@ -3462,7 +3485,7 @@ var INDEXDB_VERSION = "v0.19-indexdb";
3462
3485
 
3463
3486
  // src/version.ts
3464
3487
  var PACKAGE_VERSION = Object.keys({
3465
- "0.19.119-dev-log": "xxxx"
3488
+ "0.19.120": "xxxx"
3466
3489
  })[0];
3467
3490
  export {
3468
3491
  CRDT,
@@ -3487,6 +3510,7 @@ export {
3487
3510
  index,
3488
3511
  isFalsy,
3489
3512
  isNotFoundError,
3513
+ onSuperThis,
3490
3514
  runtime_exports as rt,
3491
3515
  runtime_exports as runtime,
3492
3516
  throwFalsy