@fireproof/core 0.19.112-dev-iife → 0.19.112-dev-usefp

Sign up to get free protection for your applications and to get access to all the features.
package/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  getFileName,
6
6
  getFileSystem,
7
7
  getPath
8
- } from "./chunk-OKACCIGZ.js";
8
+ } from "./chunk-PWEDYV5H.js";
9
9
  import {
10
10
  NotFoundError,
11
11
  Result,
@@ -557,6 +557,7 @@ var CommitQueue = class {
557
557
  var key_bag_exports = {};
558
558
  __export(key_bag_exports, {
559
559
  KeyBag: () => KeyBag,
560
+ defaultKeyBagUrl: () => defaultKeyBagUrl,
560
561
  getKeyBag: () => getKeyBag,
561
562
  registerKeyBagProviderFactory: () => registerKeyBagProviderFactory
562
563
  });
@@ -682,14 +683,14 @@ var keyBagProviderFactories = new Map(
682
683
  {
683
684
  protocol: "file:",
684
685
  factory: async (url, sthis) => {
685
- const { KeyBagProviderFile } = await import("./key-bag-file-QCOF7UFH.js");
686
+ const { KeyBagProviderFile } = await import("./key-bag-file-VP6Y7N26.js");
686
687
  return new KeyBagProviderFile(url, sthis);
687
688
  }
688
689
  },
689
690
  {
690
691
  protocol: "indexdb:",
691
692
  factory: async (url, sthis) => {
692
- const { KeyBagProviderIndexDB } = await import("./key-bag-indexdb-VHX3MZ66.js");
693
+ const { KeyBagProviderIndexDB } = await import("./key-bag-indexdb-VOVNNCXQ.js");
693
694
  return new KeyBagProviderIndexDB(url, sthis);
694
695
  }
695
696
  }
@@ -702,6 +703,24 @@ function registerKeyBagProviderFactory(item) {
702
703
  protocol
703
704
  });
704
705
  }
706
+ function defaultKeyBagUrl(sthis) {
707
+ let bagFnameOrUrl = sthis.env.get("FP_KEYBAG_URL");
708
+ let url;
709
+ if (runtimeFn().isBrowser) {
710
+ url = URI.from(bagFnameOrUrl || "indexdb://fp-keybag");
711
+ } else {
712
+ if (!bagFnameOrUrl) {
713
+ const home = sthis.env.get("HOME");
714
+ bagFnameOrUrl = `${home}/.fireproof/keybag`;
715
+ url = URI.from(`file://${bagFnameOrUrl}`);
716
+ } else {
717
+ url = URI.from(bagFnameOrUrl);
718
+ }
719
+ }
720
+ const logger = ensureLogger(sthis, "defaultKeyBagUrl");
721
+ logger.Debug().Url(url).Msg("from env");
722
+ return url;
723
+ }
705
724
  function defaultKeyBagOpts(sthis, kbo) {
706
725
  if (kbo.keyRuntime) {
707
726
  return kbo.keyRuntime;
@@ -712,19 +731,7 @@ function defaultKeyBagOpts(sthis, kbo) {
712
731
  url = URI.from(kbo.url);
713
732
  logger.Debug().Url(url).Msg("from opts");
714
733
  } else {
715
- let bagFnameOrUrl = sthis.env.get("FP_KEYBAG_URL");
716
- if (runtimeFn().isBrowser) {
717
- url = URI.from(bagFnameOrUrl || "indexdb://fp-keybag");
718
- } else {
719
- if (!bagFnameOrUrl) {
720
- const home = sthis.env.get("HOME");
721
- bagFnameOrUrl = `${home}/.fireproof/keybag`;
722
- url = URI.from(`file://${bagFnameOrUrl}`);
723
- } else {
724
- url = URI.from(bagFnameOrUrl);
725
- }
726
- }
727
- logger.Debug().Url(url).Msg("from env");
734
+ url = defaultKeyBagUrl(sthis);
728
735
  }
729
736
  const kitem = keyBagProviderFactories.get(url.protocol);
730
737
  if (!kitem) {
@@ -2227,22 +2234,22 @@ function toStoreRuntime(opts, sthis) {
2227
2234
  registerStoreProtocol({
2228
2235
  protocol: "file:",
2229
2236
  gateway: async (sthis) => {
2230
- const { FileGateway } = await import("./gateway-HUSQCAA7.js");
2237
+ const { FileGateway } = await import("./gateway-72EUHYEL.js");
2231
2238
  return new FileGateway(sthis);
2232
2239
  },
2233
2240
  test: async (sthis) => {
2234
- const { FileTestStore } = await import("./gateway-HUSQCAA7.js");
2241
+ const { FileTestStore } = await import("./gateway-72EUHYEL.js");
2235
2242
  return new FileTestStore(sthis);
2236
2243
  }
2237
2244
  });
2238
2245
  registerStoreProtocol({
2239
2246
  protocol: "indexdb:",
2240
2247
  gateway: async (sthis) => {
2241
- const { IndexDBGateway } = await import("./gateway-3YJXDXD3.js");
2248
+ const { IndexDBGateway } = await import("./gateway-G4CPXEQF.js");
2242
2249
  return new IndexDBGateway(sthis);
2243
2250
  },
2244
2251
  test: async (sthis) => {
2245
- const { IndexDBTestStore } = await import("./gateway-3YJXDXD3.js");
2252
+ const { IndexDBTestStore } = await import("./gateway-G4CPXEQF.js");
2246
2253
  return new IndexDBTestStore(sthis);
2247
2254
  }
2248
2255
  });
@@ -3446,7 +3453,7 @@ var INDEXDB_VERSION = "v0.19-indexdb";
3446
3453
 
3447
3454
  // src/version.ts
3448
3455
  var PACKAGE_VERSION = Object.keys({
3449
- "0.19.112-dev-iife": "xxxx"
3456
+ "0.19.112-dev-usefp": "xxxx"
3450
3457
  })[0];
3451
3458
  export {
3452
3459
  CRDT,