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

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.
@@ -13,6 +13,7 @@ describe("Fresh crdt", function () {
13
13
  beforeEach(async function () {
14
14
  await sthis.start();
15
15
  const dbOpts: LedgerOpts = {
16
+ name: "test-crdt",
16
17
  writeQueue: defaultWriteQueueOpts({}),
17
18
  keyBag: rt.defaultKeyBagOpts(sthis),
18
19
  storeUrls: toStoreURIRuntime(sthis, "test-crdt-cold"),
@@ -56,6 +57,7 @@ describe("CRDT with one record", function () {
56
57
  beforeEach(async function () {
57
58
  await sthis.start();
58
59
  const dbOpts: LedgerOpts = {
60
+ name: "test-crdt",
59
61
  writeQueue: defaultWriteQueueOpts({}),
60
62
  keyBag: rt.defaultKeyBagOpts(sthis),
61
63
  storeUrls: toStoreURIRuntime(sthis, `test@${sthis.nextId().str}`),
@@ -112,6 +114,7 @@ describe("CRDT with a multi-write", function () {
112
114
  beforeEach(async function () {
113
115
  await sthis.start();
114
116
  const dbOpts: LedgerOpts = {
117
+ name: "test-crdt",
115
118
  writeQueue: defaultWriteQueueOpts({}),
116
119
  keyBag: rt.defaultKeyBagOpts(sthis),
117
120
  storeUrls: toStoreURIRuntime(sthis, "test-crdt-cold"),
@@ -182,6 +185,7 @@ describe("CRDT with two multi-writes", function () {
182
185
  beforeEach(async () => {
183
186
  await sthis.start();
184
187
  const dbOpts: LedgerOpts = {
188
+ name: "test-crdt",
185
189
  writeQueue: defaultWriteQueueOpts({}),
186
190
  keyBag: rt.defaultKeyBagOpts(sthis),
187
191
  storeUrls: toStoreURIRuntime(sthis, `test-multiple-writes@${sthis.nextId().str}`),
@@ -236,6 +240,7 @@ describe("Compact a named CRDT with writes", function () {
236
240
  beforeEach(async function () {
237
241
  await sthis.start();
238
242
  const dbOpts: LedgerOpts = {
243
+ name: "test-crdt",
239
244
  writeQueue: defaultWriteQueueOpts({}),
240
245
  keyBag: rt.defaultKeyBagOpts(sthis),
241
246
  storeUrls: toStoreURIRuntime(sthis, `named-crdt-compaction`),
@@ -298,6 +303,7 @@ describe("CRDT with an index", function () {
298
303
  beforeEach(async function () {
299
304
  await sthis.start();
300
305
  const dbOpts: LedgerOpts = {
306
+ name: "test-crdt",
301
307
  writeQueue: defaultWriteQueueOpts({}),
302
308
  keyBag: rt.defaultKeyBagOpts(sthis),
303
309
  storeUrls: toStoreURIRuntime(sthis, "test-crdt-cold"),
@@ -347,6 +353,7 @@ describe("Loader with a committed transaction", function () {
347
353
  beforeEach(async function () {
348
354
  await sthis.start();
349
355
  const dbOpts: LedgerOpts = {
356
+ name: "test-crdt",
350
357
  writeQueue: defaultWriteQueueOpts({}),
351
358
  keyBag: rt.defaultKeyBagOpts(sthis),
352
359
  storeUrls: toStoreURIRuntime(sthis, dbname),
@@ -398,6 +405,7 @@ describe("Loader with two committed transactions", function () {
398
405
  beforeEach(async function () {
399
406
  await sthis.start();
400
407
  const dbOpts: LedgerOpts = {
408
+ name: "test-crdt",
401
409
  writeQueue: defaultWriteQueueOpts({}),
402
410
  keyBag: rt.defaultKeyBagOpts(sthis),
403
411
  storeUrls: toStoreURIRuntime(sthis, "test-loader"),
@@ -451,6 +459,7 @@ describe("Loader with many committed transactions", function () {
451
459
  beforeEach(async function () {
452
460
  await sthis.start();
453
461
  const dbOpts: LedgerOpts = {
462
+ name: "test-crdt",
454
463
  writeQueue: defaultWriteQueueOpts({}),
455
464
  keyBag: rt.defaultKeyBagOpts(sthis),
456
465
  storeUrls: toStoreURIRuntime(sthis, "test-loader-many"),
@@ -16,6 +16,8 @@ import {
16
16
  Database,
17
17
  isDatabase,
18
18
  } from "@fireproof/core";
19
+ import { getDefaultURI } from "../../src/blockstore/register-store-protocol.js";
20
+ import { URI } from "@adviser/cement";
19
21
 
20
22
  export function carLogIncludesGroup(list: bs.AnyLink[], cid: CID) {
21
23
  return list.some((c) => c.equals(cid));
@@ -114,6 +116,39 @@ describe("public API", function () {
114
116
  });
115
117
  });
116
118
 
119
+ describe("database fullconfig", () => {
120
+ const sthis = ensureSuperThis();
121
+ it("have the right name", async () => {
122
+ let protocol: string | undefined;
123
+ const url = sthis.env.get("FP_STORAGE_URL");
124
+ if (url) {
125
+ protocol = URI.from(url).protocol;
126
+ }
127
+ const base = getDefaultURI(sthis, protocol);
128
+ const db = fireproof("my-funky-name", {
129
+ storeUrls: {
130
+ base: base,
131
+ // meta: `${base}/meta?taste=${taste}`,
132
+ data: {
133
+ meta: base.build().pathname("dist/full/meta"),
134
+ data: base.build().pathname("dist/full/data"),
135
+ wal: base.build().pathname("dist/full/wal"),
136
+ },
137
+ idx: {
138
+ meta: base.build().pathname("dist/full/idx-meta"),
139
+ data: base.build().pathname("dist/full/idx-data"),
140
+ wal: base.build().pathname("dist/full/idx-wal"),
141
+ },
142
+ // wal: `${base}/wal?taste=${taste}`,
143
+ },
144
+ });
145
+ expect(db).toBeTruthy();
146
+ expect(db.name).toBe("my-funky-name");
147
+ await db.put({ _id: "test", foo: "bar" });
148
+ expect(db.name).toBe("my-funky-name");
149
+ });
150
+ });
151
+
117
152
  describe("basic ledger", function () {
118
153
  interface Doc {
119
154
  foo: string;
@@ -291,6 +291,7 @@ describe("basic Index upon cold start", function () {
291
291
  const logger = sthis.logger.With().Module("IndexerTest").Logger();
292
292
  logger.Debug().Msg("enter beforeEach");
293
293
  dbOpts = {
294
+ name: "test-indexer-cold",
294
295
  writeQueue: defaultWriteQueueOpts({}),
295
296
  keyBag: rt.kb.defaultKeyBagOpts(sthis),
296
297
  storeUrls: toStoreURIRuntime(sthis, "test-indexer-cold"),