@fireproof/core 0.19.0-dev-publish → 0.19.0-dev-use-fix
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/{chunk-EVSZA26U.js → chunk-AZVWSRER.js} +2 -2
- package/{chunk-UCMXU3DH.js → chunk-NZNG6TQT.js} +103 -1
- package/chunk-NZNG6TQT.js.map +1 -0
- package/{chunk-5X6APJDY.js → chunk-ZHO4NMWL.js} +2 -2
- package/index.cjs +122 -92
- package/index.cjs.map +1 -1
- package/index.d.cts +21 -1
- package/index.d.ts +21 -1
- package/index.js +41 -122
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +1 -1
- package/{sqlite-data-store-RIH56645.js → sqlite-data-store-3ST7XOLX.js} +3 -3
- package/{sqlite-meta-store-6347MWOR.js → sqlite-meta-store-QOIMCSJ7.js} +3 -3
- package/{sqlite-wal-store-G5YGK77N.js → sqlite-wal-store-JFBQPOYT.js} +3 -3
- package/{store-file-D472VFCS.js → store-file-CSS5THFH.js} +2 -2
- package/{store-indexdb-FRX5PTKR.js → store-indexdb-DR4HELVP.js} +3 -3
- package/{store-sql-MDSU23Y7.js → store-sql-BG6SMGQJ.js} +5 -5
- package/tests/blockstore/loader.test.ts +265 -0
- package/tests/blockstore/store.test.ts +164 -0
- package/tests/blockstore/transaction.test.ts +121 -0
- package/tests/fireproof/config.test.ts +212 -0
- package/tests/fireproof/crdt.test.ts +434 -0
- package/tests/fireproof/database.test.ts +466 -0
- package/tests/fireproof/fireproof.test.ts +602 -0
- package/tests/fireproof/hello.test.ts +54 -0
- package/tests/fireproof/indexer.test.ts +389 -0
- package/tests/helpers.ts +81 -0
- package/tests/react/useFireproof.test.tsx +19 -0
- package/tests/www/gallery.html +132 -0
- package/tests/www/iife.html +42 -0
- package/tests/www/todo-aws.html +232 -0
- package/tests/www/todo-ipfs.html +213 -0
- package/tests/www/todo-local.html +214 -0
- package/tests/www/todo-netlify.html +227 -0
- package/tests/www/todo.html +236 -0
- package/chunk-UCMXU3DH.js.map +0 -1
- /package/{chunk-EVSZA26U.js.map → chunk-AZVWSRER.js.map} +0 -0
- /package/{chunk-5X6APJDY.js.map → chunk-ZHO4NMWL.js.map} +0 -0
- /package/{sqlite-data-store-RIH56645.js.map → sqlite-data-store-3ST7XOLX.js.map} +0 -0
- /package/{sqlite-meta-store-6347MWOR.js.map → sqlite-meta-store-QOIMCSJ7.js.map} +0 -0
- /package/{sqlite-wal-store-G5YGK77N.js.map → sqlite-wal-store-JFBQPOYT.js.map} +0 -0
- /package/{store-file-D472VFCS.js.map → store-file-CSS5THFH.js.map} +0 -0
- /package/{store-indexdb-FRX5PTKR.js.map → store-indexdb-DR4HELVP.js.map} +0 -0
- /package/{store-sql-MDSU23Y7.js.map → store-sql-BG6SMGQJ.js.map} +0 -0
package/index.d.cts
CHANGED
@@ -966,6 +966,25 @@ declare namespace index$1 {
|
|
966
966
|
export { type index$1_DBConnection as DBConnection, type index$1_DataRecord as DataRecord, type index$1_DataSQLStore as DataSQLStore, index$1_DefaultSQLTableNames as DefaultSQLTableNames, type index$1_MetaRecord as MetaRecord, type index$1_MetaRecordKey as MetaRecordKey, type index$1_MetaSQLStore as MetaSQLStore, type index$1_MetaType as MetaType, type index$1_SQLOpts as SQLOpts, type index$1_SQLStore as SQLStore, type index$1_SQLTableNames as SQLTableNames, type index$1_WalKey as WalKey, type index$1_WalRecord as WalRecord, type index$1_WalSQLStore as WalSQLStore, index$1_ensureSQLOpts as ensureSQLOpts };
|
967
967
|
}
|
968
968
|
|
969
|
+
declare function toCryptoOpts(cryptoOpts?: Partial<CryptoOpts>): CryptoOpts;
|
970
|
+
|
971
|
+
declare const crypto$1_toCryptoOpts: typeof toCryptoOpts;
|
972
|
+
declare namespace crypto$1 {
|
973
|
+
export { crypto$1_toCryptoOpts as toCryptoOpts };
|
974
|
+
}
|
975
|
+
|
976
|
+
declare function encodeFile(blob: BlobLike): Promise<{
|
977
|
+
cid: AnyLink;
|
978
|
+
blocks: AnyBlock[];
|
979
|
+
}>;
|
980
|
+
declare function decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<File>;
|
981
|
+
|
982
|
+
declare const files_decodeFile: typeof decodeFile;
|
983
|
+
declare const files_encodeFile: typeof encodeFile;
|
984
|
+
declare namespace files {
|
985
|
+
export { files_decodeFile as decodeFile, files_encodeFile as encodeFile };
|
986
|
+
}
|
987
|
+
|
969
988
|
declare const FILESTORE_VERSION = "v0.19-file";
|
970
989
|
|
971
990
|
declare const INDEXDB_VERSION = "v0.19-indexdb";
|
@@ -979,11 +998,12 @@ declare const index_SQLITE_VERSION: typeof SQLITE_VERSION;
|
|
979
998
|
declare const index_SysContainer: typeof SysContainer;
|
980
999
|
declare const index_dataDir: typeof dataDir;
|
981
1000
|
declare const index_ensureIndexName: typeof ensureIndexName;
|
1001
|
+
declare const index_files: typeof files;
|
982
1002
|
declare const index_getFileName: typeof getFileName;
|
983
1003
|
declare const index_getPath: typeof getPath;
|
984
1004
|
declare const index_join: typeof join;
|
985
1005
|
declare namespace index {
|
986
|
-
export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, type index_NodeMap as NodeMap, index_SQLITE_VERSION as SQLITE_VERSION, index_SysContainer as SysContainer, index_dataDir as dataDir, index_ensureIndexName as ensureIndexName, index_getFileName as getFileName, index_getPath as getPath, index_join as join, index$1 as sql };
|
1006
|
+
export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, type index_NodeMap as NodeMap, index_SQLITE_VERSION as SQLITE_VERSION, index_SysContainer as SysContainer, crypto$1 as crypto, index_dataDir as dataDir, index_ensureIndexName as ensureIndexName, index_files as files, index_getFileName as getFileName, index_getPath as getPath, index_join as join, index$1 as sql };
|
987
1007
|
}
|
988
1008
|
|
989
1009
|
declare const PACKAGE_VERSION: string;
|
package/index.d.ts
CHANGED
@@ -966,6 +966,25 @@ declare namespace index$1 {
|
|
966
966
|
export { type index$1_DBConnection as DBConnection, type index$1_DataRecord as DataRecord, type index$1_DataSQLStore as DataSQLStore, index$1_DefaultSQLTableNames as DefaultSQLTableNames, type index$1_MetaRecord as MetaRecord, type index$1_MetaRecordKey as MetaRecordKey, type index$1_MetaSQLStore as MetaSQLStore, type index$1_MetaType as MetaType, type index$1_SQLOpts as SQLOpts, type index$1_SQLStore as SQLStore, type index$1_SQLTableNames as SQLTableNames, type index$1_WalKey as WalKey, type index$1_WalRecord as WalRecord, type index$1_WalSQLStore as WalSQLStore, index$1_ensureSQLOpts as ensureSQLOpts };
|
967
967
|
}
|
968
968
|
|
969
|
+
declare function toCryptoOpts(cryptoOpts?: Partial<CryptoOpts>): CryptoOpts;
|
970
|
+
|
971
|
+
declare const crypto$1_toCryptoOpts: typeof toCryptoOpts;
|
972
|
+
declare namespace crypto$1 {
|
973
|
+
export { crypto$1_toCryptoOpts as toCryptoOpts };
|
974
|
+
}
|
975
|
+
|
976
|
+
declare function encodeFile(blob: BlobLike): Promise<{
|
977
|
+
cid: AnyLink;
|
978
|
+
blocks: AnyBlock[];
|
979
|
+
}>;
|
980
|
+
declare function decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<File>;
|
981
|
+
|
982
|
+
declare const files_decodeFile: typeof decodeFile;
|
983
|
+
declare const files_encodeFile: typeof encodeFile;
|
984
|
+
declare namespace files {
|
985
|
+
export { files_decodeFile as decodeFile, files_encodeFile as encodeFile };
|
986
|
+
}
|
987
|
+
|
969
988
|
declare const FILESTORE_VERSION = "v0.19-file";
|
970
989
|
|
971
990
|
declare const INDEXDB_VERSION = "v0.19-indexdb";
|
@@ -979,11 +998,12 @@ declare const index_SQLITE_VERSION: typeof SQLITE_VERSION;
|
|
979
998
|
declare const index_SysContainer: typeof SysContainer;
|
980
999
|
declare const index_dataDir: typeof dataDir;
|
981
1000
|
declare const index_ensureIndexName: typeof ensureIndexName;
|
1001
|
+
declare const index_files: typeof files;
|
982
1002
|
declare const index_getFileName: typeof getFileName;
|
983
1003
|
declare const index_getPath: typeof getPath;
|
984
1004
|
declare const index_join: typeof join;
|
985
1005
|
declare namespace index {
|
986
|
-
export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, type index_NodeMap as NodeMap, index_SQLITE_VERSION as SQLITE_VERSION, index_SysContainer as SysContainer, index_dataDir as dataDir, index_ensureIndexName as ensureIndexName, index_getFileName as getFileName, index_getPath as getPath, index_join as join, index$1 as sql };
|
1006
|
+
export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, type index_NodeMap as NodeMap, index_SQLITE_VERSION as SQLITE_VERSION, index_SysContainer as SysContainer, crypto$1 as crypto, index_dataDir as dataDir, index_ensureIndexName as ensureIndexName, index_files as files, index_getFileName as getFileName, index_getPath as getPath, index_join as join, index$1 as sql };
|
987
1007
|
}
|
988
1008
|
|
989
1009
|
declare const PACKAGE_VERSION: string;
|
package/index.js
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
import {
|
2
2
|
guardVersion
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-AZVWSRER.js";
|
4
4
|
import {
|
5
5
|
NotFoundError,
|
6
6
|
isNotFoundError
|
7
7
|
} from "./chunk-VZGT7ZYP.js";
|
8
8
|
import {
|
9
9
|
dataDir,
|
10
|
+
decodeFile,
|
11
|
+
encodeFile,
|
10
12
|
ensureLogger,
|
11
13
|
exception2Result,
|
12
14
|
exceptionWrapper,
|
13
15
|
getKey,
|
14
16
|
getName,
|
15
17
|
getStore,
|
16
|
-
runtime_exports
|
17
|
-
|
18
|
+
runtime_exports,
|
19
|
+
toCryptoOpts
|
20
|
+
} from "./chunk-NZNG6TQT.js";
|
18
21
|
import {
|
19
22
|
SysContainer,
|
20
23
|
__export,
|
@@ -274,72 +277,6 @@ var ConnectREST = class extends ConnectionBase {
|
|
274
277
|
// src/blockstore/store-factory.ts
|
275
278
|
import { KeyedResolvOnce } from "@adviser/cement";
|
276
279
|
|
277
|
-
// src/runtime/files.ts
|
278
|
-
import * as UnixFS from "@ipld/unixfs";
|
279
|
-
import * as raw from "multiformats/codecs/raw";
|
280
|
-
import { withMaxChunkSize } from "@ipld/unixfs/file/chunker/fixed";
|
281
|
-
import { withWidth } from "@ipld/unixfs/file/layout/balanced";
|
282
|
-
import { exporter } from "ipfs-unixfs-exporter";
|
283
|
-
var queuingStrategy = UnixFS.withCapacity();
|
284
|
-
var settings = UnixFS.configure({
|
285
|
-
fileChunkEncoder: raw,
|
286
|
-
smallFileEncoder: raw,
|
287
|
-
chunker: withMaxChunkSize(1024 * 1024),
|
288
|
-
fileLayout: withWidth(1024)
|
289
|
-
});
|
290
|
-
async function collect(collectable) {
|
291
|
-
const chunks = [];
|
292
|
-
await collectable.pipeTo(
|
293
|
-
new WritableStream({
|
294
|
-
write(chunk) {
|
295
|
-
chunks.push(chunk);
|
296
|
-
}
|
297
|
-
})
|
298
|
-
);
|
299
|
-
return chunks;
|
300
|
-
}
|
301
|
-
async function encodeFile(blob) {
|
302
|
-
const readable = createFileEncoderStream(blob);
|
303
|
-
const blocks = await collect(readable);
|
304
|
-
return { cid: blocks.at(-1).cid, blocks };
|
305
|
-
}
|
306
|
-
async function decodeFile(blocks, cid, meta) {
|
307
|
-
const entry = await exporter(cid.toString(), blocks, { length: meta.size });
|
308
|
-
const chunks = [];
|
309
|
-
for await (const chunk of entry.content()) {
|
310
|
-
chunks.push(chunk);
|
311
|
-
}
|
312
|
-
return new File(chunks, entry.name, { type: meta.type, lastModified: 0 });
|
313
|
-
}
|
314
|
-
function createFileEncoderStream(blob) {
|
315
|
-
const { readable, writable } = new TransformStream({}, queuingStrategy);
|
316
|
-
const unixfsWriter = UnixFS.createWriter({ writable, settings });
|
317
|
-
const fileBuilder = new UnixFSFileBuilder("", blob);
|
318
|
-
void (async () => {
|
319
|
-
await fileBuilder.finalize(unixfsWriter);
|
320
|
-
await unixfsWriter.close();
|
321
|
-
})();
|
322
|
-
return readable;
|
323
|
-
}
|
324
|
-
var UnixFSFileBuilder = class {
|
325
|
-
#file;
|
326
|
-
constructor(name, file) {
|
327
|
-
this.name = name;
|
328
|
-
this.#file = file;
|
329
|
-
}
|
330
|
-
async finalize(writer) {
|
331
|
-
const unixfsFileWriter = UnixFS.createFileWriter(writer);
|
332
|
-
await this.#file.stream().pipeTo(
|
333
|
-
new WritableStream({
|
334
|
-
async write(chunk) {
|
335
|
-
await unixfsFileWriter.write(chunk);
|
336
|
-
}
|
337
|
-
})
|
338
|
-
);
|
339
|
-
return await unixfsFileWriter.close();
|
340
|
-
}
|
341
|
-
};
|
342
|
-
|
343
280
|
// src/blockstore/store.ts
|
344
281
|
import pLimit2 from "p-limit";
|
345
282
|
import { format, parse } from "@ipld/dag-json";
|
@@ -358,7 +295,7 @@ function toCIDBlock(block) {
|
|
358
295
|
// src/blockstore/loader-helpers.ts
|
359
296
|
import { encode, decode } from "multiformats/block";
|
360
297
|
import { sha256 as hasher } from "multiformats/hashes/sha2";
|
361
|
-
import * as
|
298
|
+
import * as raw from "multiformats/codecs/raw";
|
362
299
|
import * as CBW from "@ipld/car/buffer-writer";
|
363
300
|
import * as codec from "@ipld/dag-cbor";
|
364
301
|
async function encodeCarFile(roots, t) {
|
@@ -377,7 +314,7 @@ async function encodeCarFile(roots, t) {
|
|
377
314
|
writer.write({ cid, bytes });
|
378
315
|
}
|
379
316
|
writer.close();
|
380
|
-
return await encode({ value: writer.bytes, hasher, codec:
|
317
|
+
return await encode({ value: writer.bytes, hasher, codec: raw });
|
381
318
|
}
|
382
319
|
async function encodeCarHeader(fp) {
|
383
320
|
return await encode({
|
@@ -410,7 +347,7 @@ import { create, load } from "prolly-trees/cid-set";
|
|
410
347
|
|
411
348
|
// src/blockstore/encrypt-codec.ts
|
412
349
|
import { CID } from "multiformats";
|
413
|
-
function makeCodec(ilogger,
|
350
|
+
function makeCodec(ilogger, crypto, randomBytes) {
|
414
351
|
const logger = ensureLogger(ilogger, "makeCodec");
|
415
352
|
const enc32 = (value) => {
|
416
353
|
value = +value;
|
@@ -444,7 +381,7 @@ function makeCodec(ilogger, crypto2, randomBytes2) {
|
|
444
381
|
};
|
445
382
|
const code = 3145728 + 1337;
|
446
383
|
async function subtleKey(key) {
|
447
|
-
return await
|
384
|
+
return await crypto.importKey(
|
448
385
|
"raw",
|
449
386
|
// raw or jwk
|
450
387
|
key,
|
@@ -458,7 +395,7 @@ function makeCodec(ilogger, crypto2, randomBytes2) {
|
|
458
395
|
const decrypt = async ({ key, value }) => {
|
459
396
|
const { bytes: inBytes, iv } = value;
|
460
397
|
const cryKey = await subtleKey(key);
|
461
|
-
const deBytes = await
|
398
|
+
const deBytes = await crypto.decrypt(
|
462
399
|
{
|
463
400
|
name: "AES-GCM",
|
464
401
|
iv,
|
@@ -474,11 +411,11 @@ function makeCodec(ilogger, crypto2, randomBytes2) {
|
|
474
411
|
};
|
475
412
|
const encrypt = async ({ key, cid, bytes }) => {
|
476
413
|
const len = enc32(cid.bytes.byteLength);
|
477
|
-
const iv =
|
414
|
+
const iv = randomBytes(12);
|
478
415
|
const msg = concat([len, cid.bytes, bytes]);
|
479
416
|
try {
|
480
417
|
const cryKey = await subtleKey(key);
|
481
|
-
const deBytes = await
|
418
|
+
const deBytes = await crypto.encrypt(
|
482
419
|
{
|
483
420
|
name: "AES-GCM",
|
484
421
|
iv,
|
@@ -506,8 +443,8 @@ function carLogIncludesGroup(list, cidMatch) {
|
|
506
443
|
return cid.toString() === cidMatch.toString();
|
507
444
|
});
|
508
445
|
}
|
509
|
-
function makeEncDec(logger,
|
510
|
-
const codec4 = makeCodec(logger,
|
446
|
+
function makeEncDec(logger, crypto, randomBytes) {
|
447
|
+
const codec4 = makeCodec(logger, crypto, randomBytes);
|
511
448
|
const encrypt = async function* ({
|
512
449
|
get: get2,
|
513
450
|
cids,
|
@@ -600,7 +537,7 @@ function hexStringToUint8Array(hexString) {
|
|
600
537
|
}
|
601
538
|
return uint8Array;
|
602
539
|
}
|
603
|
-
async function encryptedEncodeCarFile(logger,
|
540
|
+
async function encryptedEncodeCarFile(logger, crypto, key, rootCid, t) {
|
604
541
|
const encryptionKey = hexStringToUint8Array(key);
|
605
542
|
const encryptedBlocks = new MemoryBlockstore2();
|
606
543
|
const cidsToEncrypt = [];
|
@@ -610,7 +547,7 @@ async function encryptedEncodeCarFile(logger, crypto2, key, rootCid, t) {
|
|
610
547
|
if (!g) throw logger.Error().Ref("cid", cid).Int("bytes", bytes.length).Msg("missing cid block").AsError();
|
611
548
|
}
|
612
549
|
let last = null;
|
613
|
-
const { encrypt } = makeEncDec(logger,
|
550
|
+
const { encrypt } = makeEncDec(logger, crypto, crypto.randomBytes);
|
614
551
|
for await (const block of encrypt({
|
615
552
|
cids: cidsToEncrypt,
|
616
553
|
get: t.get.bind(t),
|
@@ -627,17 +564,17 @@ async function encryptedEncodeCarFile(logger, crypto2, key, rootCid, t) {
|
|
627
564
|
const encryptedCar = await encodeCarFile([last.cid], encryptedBlocks);
|
628
565
|
return encryptedCar;
|
629
566
|
}
|
630
|
-
async function decodeEncryptedCar(logger,
|
567
|
+
async function decodeEncryptedCar(logger, crypto, key, reader) {
|
631
568
|
const roots = await reader.getRoots();
|
632
569
|
const root3 = roots[0];
|
633
|
-
return await decodeCarBlocks(logger,
|
570
|
+
return await decodeCarBlocks(logger, crypto, root3, reader.get.bind(reader), key);
|
634
571
|
}
|
635
|
-
async function decodeCarBlocks(logger,
|
572
|
+
async function decodeCarBlocks(logger, crypto, root3, get2, keyMaterial) {
|
636
573
|
const decryptionKeyUint8 = hexStringToUint8Array(keyMaterial);
|
637
574
|
const decryptionKey = decryptionKeyUint8.buffer.slice(0, decryptionKeyUint8.byteLength);
|
638
575
|
const decryptedBlocks = new MemoryBlockstore2();
|
639
576
|
let last = null;
|
640
|
-
const { decrypt } = makeEncDec(logger,
|
577
|
+
const { decrypt } = makeEncDec(logger, crypto, crypto.randomBytes);
|
641
578
|
for await (const block of decrypt({
|
642
579
|
root: root3,
|
643
580
|
get: get2,
|
@@ -655,30 +592,6 @@ async function decodeCarBlocks(logger, crypto2, root3, get2, keyMaterial) {
|
|
655
592
|
|
656
593
|
// src/blockstore/transaction.ts
|
657
594
|
import { MemoryBlockstore as MemoryBlockstore3 } from "@web3-storage/pail/block";
|
658
|
-
|
659
|
-
// src/runtime/crypto.ts
|
660
|
-
function randomBytes(size) {
|
661
|
-
const bytes = new Uint8Array(size);
|
662
|
-
if (size > 0) {
|
663
|
-
crypto.getRandomValues(bytes);
|
664
|
-
}
|
665
|
-
return bytes;
|
666
|
-
}
|
667
|
-
function digestSHA256(data) {
|
668
|
-
return Promise.resolve(crypto.subtle.digest("SHA-256", data));
|
669
|
-
}
|
670
|
-
function toCryptoOpts(cryptoOpts = {}) {
|
671
|
-
const opts = {
|
672
|
-
importKey: cryptoOpts.importKey || crypto.subtle.importKey.bind(crypto.subtle),
|
673
|
-
encrypt: cryptoOpts.encrypt || crypto.subtle.encrypt.bind(crypto.subtle),
|
674
|
-
decrypt: cryptoOpts.decrypt || crypto.subtle.decrypt.bind(crypto.subtle),
|
675
|
-
randomBytes: cryptoOpts.randomBytes || randomBytes,
|
676
|
-
digestSHA256: cryptoOpts.digestSHA256 || digestSHA256
|
677
|
-
};
|
678
|
-
return opts;
|
679
|
-
}
|
680
|
-
|
681
|
-
// src/blockstore/transaction.ts
|
682
595
|
var CarTransaction = class extends MemoryBlockstore3 {
|
683
596
|
constructor(parent, opts = { add: true }) {
|
684
597
|
super();
|
@@ -1689,6 +1602,11 @@ function toURL(pathOrUrl, isIndex) {
|
|
1689
1602
|
}
|
1690
1603
|
}
|
1691
1604
|
var storeFactory = /* @__PURE__ */ new Map();
|
1605
|
+
function ensureName(name, url) {
|
1606
|
+
if (!url.searchParams.has("name")) {
|
1607
|
+
url.searchParams.set("name", name);
|
1608
|
+
}
|
1609
|
+
}
|
1692
1610
|
function buildURL(optURL, loader) {
|
1693
1611
|
const storeOpts = loader.ebOpts.store;
|
1694
1612
|
const obuItem = Array.from(storeFactory.values()).find((items) => items.overrideBaseURL);
|
@@ -1729,6 +1647,7 @@ function loadDataGateway(url, logger) {
|
|
1729
1647
|
var onceDataStoreFactory = new KeyedResolvOnce();
|
1730
1648
|
async function dataStoreFactory(loader) {
|
1731
1649
|
const url = buildURL(loader.ebOpts.store.stores?.data, loader);
|
1650
|
+
ensureName(loader.name, url);
|
1732
1651
|
const logger = ensureLogger(loader.logger, "dataStoreFactory", { url: url.toString() });
|
1733
1652
|
url.searchParams.set("store", "data");
|
1734
1653
|
return onceDataStoreFactory.get(url.toString()).once(async () => {
|
@@ -1748,15 +1667,14 @@ function loadMetaGateway(url, logger) {
|
|
1748
1667
|
var onceMetaStoreFactory = new KeyedResolvOnce();
|
1749
1668
|
async function metaStoreFactory(loader) {
|
1750
1669
|
const url = buildURL(loader.ebOpts.store.stores?.meta, loader);
|
1670
|
+
ensureName(loader.name, url);
|
1751
1671
|
const logger = ensureLogger(loader.logger, "metaStoreFactory", { url: () => url.toString() });
|
1752
1672
|
url.searchParams.set("store", "meta");
|
1753
1673
|
return onceMetaStoreFactory.get(url.toString()).once(async () => {
|
1754
1674
|
logger.Debug().Str("protocol", url.protocol).Msg("pre-protocol switch");
|
1755
1675
|
const gateway = await loadMetaGateway(url, logger);
|
1756
1676
|
const store = new MetaStore(loader.name, url, loader.logger, gateway);
|
1757
|
-
logger.Debug().Msg("pre-start");
|
1758
1677
|
await store.start();
|
1759
|
-
logger.Debug().Msg("post-start");
|
1760
1678
|
return store;
|
1761
1679
|
});
|
1762
1680
|
}
|
@@ -1769,6 +1687,7 @@ function loadWalGateway(url, logger) {
|
|
1769
1687
|
var onceRemoteWalFactory = new KeyedResolvOnce();
|
1770
1688
|
async function remoteWalFactory(loader) {
|
1771
1689
|
const url = buildURL(loader.ebOpts.store.stores?.meta, loader);
|
1690
|
+
ensureName(loader.name, url);
|
1772
1691
|
const logger = ensureLogger(loader.logger, "remoteWalFactory", { url: url.toString() });
|
1773
1692
|
url.searchParams.set("store", "wal");
|
1774
1693
|
return onceRemoteWalFactory.get(url.toString()).once(async () => {
|
@@ -1810,57 +1729,57 @@ function toStoreRuntime(opts, ilogger) {
|
|
1810
1729
|
registerStoreProtocol({
|
1811
1730
|
protocol: "file:",
|
1812
1731
|
data: async (logger) => {
|
1813
|
-
const { FileDataGateway } = await import("./store-file-
|
1732
|
+
const { FileDataGateway } = await import("./store-file-CSS5THFH.js");
|
1814
1733
|
return new FileDataGateway(logger);
|
1815
1734
|
},
|
1816
1735
|
meta: async (logger) => {
|
1817
|
-
const { FileMetaGateway } = await import("./store-file-
|
1736
|
+
const { FileMetaGateway } = await import("./store-file-CSS5THFH.js");
|
1818
1737
|
return new FileMetaGateway(logger);
|
1819
1738
|
},
|
1820
1739
|
wal: async (logger) => {
|
1821
|
-
const { FileWALGateway } = await import("./store-file-
|
1740
|
+
const { FileWALGateway } = await import("./store-file-CSS5THFH.js");
|
1822
1741
|
return new FileWALGateway(logger);
|
1823
1742
|
},
|
1824
1743
|
test: async (logger) => {
|
1825
|
-
const { FileTestStore } = await import("./store-file-
|
1744
|
+
const { FileTestStore } = await import("./store-file-CSS5THFH.js");
|
1826
1745
|
return new FileTestStore(logger);
|
1827
1746
|
}
|
1828
1747
|
});
|
1829
1748
|
registerStoreProtocol({
|
1830
1749
|
protocol: "indexdb:",
|
1831
1750
|
data: async (logger) => {
|
1832
|
-
const { IndexDBDataGateway } = await import("./store-indexdb-
|
1751
|
+
const { IndexDBDataGateway } = await import("./store-indexdb-DR4HELVP.js");
|
1833
1752
|
return new IndexDBDataGateway(logger);
|
1834
1753
|
},
|
1835
1754
|
meta: async (logger) => {
|
1836
|
-
const { IndexDBMetaGateway } = await import("./store-indexdb-
|
1755
|
+
const { IndexDBMetaGateway } = await import("./store-indexdb-DR4HELVP.js");
|
1837
1756
|
return new IndexDBMetaGateway(logger);
|
1838
1757
|
},
|
1839
1758
|
wal: async (logger) => {
|
1840
|
-
const { IndexDBMetaGateway } = await import("./store-indexdb-
|
1759
|
+
const { IndexDBMetaGateway } = await import("./store-indexdb-DR4HELVP.js");
|
1841
1760
|
return new IndexDBMetaGateway(logger);
|
1842
1761
|
},
|
1843
1762
|
test: async (logger) => {
|
1844
|
-
const { IndexDBTestStore } = await import("./store-indexdb-
|
1763
|
+
const { IndexDBTestStore } = await import("./store-indexdb-DR4HELVP.js");
|
1845
1764
|
return new IndexDBTestStore(logger);
|
1846
1765
|
}
|
1847
1766
|
});
|
1848
1767
|
registerStoreProtocol({
|
1849
1768
|
protocol: "sqlite:",
|
1850
1769
|
data: async (logger) => {
|
1851
|
-
const { SQLDataGateway } = await import("./store-sql-
|
1770
|
+
const { SQLDataGateway } = await import("./store-sql-BG6SMGQJ.js");
|
1852
1771
|
return new SQLDataGateway(logger);
|
1853
1772
|
},
|
1854
1773
|
meta: async (logger) => {
|
1855
|
-
const { SQLMetaGateway } = await import("./store-sql-
|
1774
|
+
const { SQLMetaGateway } = await import("./store-sql-BG6SMGQJ.js");
|
1856
1775
|
return new SQLMetaGateway(logger);
|
1857
1776
|
},
|
1858
1777
|
wal: async (logger) => {
|
1859
|
-
const { SQLWalGateway } = await import("./store-sql-
|
1778
|
+
const { SQLWalGateway } = await import("./store-sql-BG6SMGQJ.js");
|
1860
1779
|
return new SQLWalGateway(logger);
|
1861
1780
|
},
|
1862
1781
|
test: async (logger) => {
|
1863
|
-
const { SQLTestStore } = await import("./store-sql-
|
1782
|
+
const { SQLTestStore } = await import("./store-sql-BG6SMGQJ.js");
|
1864
1783
|
return new SQLTestStore(logger);
|
1865
1784
|
}
|
1866
1785
|
});
|