@fireproof/core 0.20.0-dev-preview-27 → 0.20.0-dev-preview-28

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/index.d.cts CHANGED
@@ -1384,7 +1384,7 @@ interface Ledger extends HasCRDT {
1384
1384
  subscribe<T extends DocTypes>(listener: ListenerFn<T>, updates?: boolean): () => void;
1385
1385
  }
1386
1386
 
1387
- declare function keyConfigOpts(sthis: SuperThis, name?: string, opts?: ConfigOpts): string;
1387
+ declare function keyConfigOpts(sthis: SuperThis, name: string, opts?: ConfigOpts): string;
1388
1388
  declare function isLedger(db: unknown): db is Ledger;
1389
1389
  declare function LedgerFactory(name: string, opts?: ConfigOpts): Ledger;
1390
1390
  declare class LedgerShell implements Ledger {
@@ -1430,7 +1430,7 @@ declare class LedgerImpl implements Ledger {
1430
1430
  private _notify;
1431
1431
  private _no_update_notify;
1432
1432
  }
1433
- declare function toStoreURIRuntime(sthis: SuperThis, name?: string, sopts?: StoreUrlsOpts): StoreURIRuntime;
1433
+ declare function toStoreURIRuntime(sthis: SuperThis, name: string, sopts?: StoreUrlsOpts): StoreURIRuntime;
1434
1434
  declare function fireproof(name: string, opts?: ConfigOpts): Database;
1435
1435
 
1436
1436
  declare function isDatabase(db: unknown): db is Database;
package/index.d.ts CHANGED
@@ -1384,7 +1384,7 @@ interface Ledger extends HasCRDT {
1384
1384
  subscribe<T extends DocTypes>(listener: ListenerFn<T>, updates?: boolean): () => void;
1385
1385
  }
1386
1386
 
1387
- declare function keyConfigOpts(sthis: SuperThis, name?: string, opts?: ConfigOpts): string;
1387
+ declare function keyConfigOpts(sthis: SuperThis, name: string, opts?: ConfigOpts): string;
1388
1388
  declare function isLedger(db: unknown): db is Ledger;
1389
1389
  declare function LedgerFactory(name: string, opts?: ConfigOpts): Ledger;
1390
1390
  declare class LedgerShell implements Ledger {
@@ -1430,7 +1430,7 @@ declare class LedgerImpl implements Ledger {
1430
1430
  private _notify;
1431
1431
  private _no_update_notify;
1432
1432
  }
1433
- declare function toStoreURIRuntime(sthis: SuperThis, name?: string, sopts?: StoreUrlsOpts): StoreURIRuntime;
1433
+ declare function toStoreURIRuntime(sthis: SuperThis, name: string, sopts?: StoreUrlsOpts): StoreURIRuntime;
1434
1434
  declare function fireproof(name: string, opts?: ConfigOpts): Database;
1435
1435
 
1436
1436
  declare function isDatabase(db: unknown): db is Database;
package/index.js CHANGED
@@ -4789,15 +4789,11 @@ var LedgerImpl = class {
4789
4789
  }
4790
4790
  }
4791
4791
  };
4792
- function defaultURI2(sthis, curi, uri, store, ctx) {
4792
+ function defaultURI2(sthis, name, curi, uri, store, ctx) {
4793
4793
  ctx = ctx || {};
4794
- const ret = (curi ? URI13.from(curi) : uri).build().setParam(PARAM.STORE, store);
4794
+ const ret = (curi ? URI13.from(curi) : uri).build().setParam(PARAM.STORE, store).defParam(PARAM.NAME, name);
4795
4795
  if (!ret.hasParam(PARAM.NAME)) {
4796
- const name = sthis.pathOps.basename(ret.URI().pathname);
4797
- if (!name) {
4798
- throw sthis.logger.Error().Url(ret).Any("ctx", ctx).Msg("Ledger name is required").AsError();
4799
- }
4800
- ret.setParam(PARAM.NAME, name);
4796
+ throw sthis.logger.Error().Url(ret).Any("ctx", ctx).Msg("Ledger name is required").AsError();
4801
4797
  }
4802
4798
  if (ctx.idx) {
4803
4799
  ret.defParam(PARAM.INDEX, "idx");
@@ -4823,23 +4819,19 @@ function toStoreURIRuntime(sthis, name, sopts) {
4823
4819
  sopts = { ...sopts, base: getDefaultURI(sthis).build().setParam(PARAM.URL_GEN, "default") };
4824
4820
  }
4825
4821
  }
4826
- const bbase = BuildURI2.from(sopts.base);
4827
- if (name) {
4828
- bbase.setParam(PARAM.NAME, name);
4829
- }
4830
- const base = bbase.URI();
4822
+ const base = URI13.from(sopts.base);
4831
4823
  return {
4832
4824
  idx: {
4833
- data: defaultURI2(sthis, sopts.idx?.data, base, "data", { idx: true }),
4834
- file: defaultURI2(sthis, sopts.idx?.data, base, "data", { file: true, idx: true }),
4835
- meta: defaultURI2(sthis, sopts.idx?.meta, base, "meta", { idx: true }),
4836
- wal: defaultURI2(sthis, sopts.idx?.wal, base, "wal", { idx: true })
4825
+ data: defaultURI2(sthis, name, sopts.idx?.data, base, "data", { idx: true }),
4826
+ file: defaultURI2(sthis, name, sopts.idx?.data, base, "data", { file: true, idx: true }),
4827
+ meta: defaultURI2(sthis, name, sopts.idx?.meta, base, "meta", { idx: true }),
4828
+ wal: defaultURI2(sthis, name, sopts.idx?.wal, base, "wal", { idx: true })
4837
4829
  },
4838
4830
  data: {
4839
- data: defaultURI2(sthis, sopts.data?.data, base, "data"),
4840
- file: defaultURI2(sthis, sopts.data?.data, base, "data", { file: true }),
4841
- meta: defaultURI2(sthis, sopts.data?.meta, base, "meta"),
4842
- wal: defaultURI2(sthis, sopts.data?.wal, base, "wal")
4831
+ data: defaultURI2(sthis, name, sopts.data?.data, base, "data"),
4832
+ file: defaultURI2(sthis, name, sopts.data?.data, base, "data", { file: true }),
4833
+ meta: defaultURI2(sthis, name, sopts.data?.meta, base, "meta"),
4834
+ wal: defaultURI2(sthis, name, sopts.data?.wal, base, "wal")
4843
4835
  }
4844
4836
  };
4845
4837
  }
@@ -4903,7 +4895,7 @@ __export(file_exports, {
4903
4895
 
4904
4896
  // src/version.ts
4905
4897
  var PACKAGE_VERSION = Object.keys({
4906
- "0.20.0-dev-preview-27": "xxxx"
4898
+ "0.20.0-dev-preview-28": "xxxx"
4907
4899
  })[0];
4908
4900
  export {
4909
4901
  CRDTImpl,