@fireproof/core 0.20.0-dev-preview-19 → 0.20.0-dev-preview-21
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/deno.json +7 -2
- package/index.cjs +34 -34
- package/index.cjs.map +1 -1
- package/index.d.cts +5 -5
- package/index.d.ts +5 -5
- package/index.js +34 -34
- package/index.js.map +1 -1
- package/{indexdb → indexeddb}/index.cjs +17 -17
- package/indexeddb/index.cjs.map +1 -0
- package/{indexdb → indexeddb}/index.d.cts +4 -4
- package/{indexdb → indexeddb}/index.d.ts +4 -4
- package/{indexdb → indexeddb}/index.js +16 -16
- package/indexeddb/index.js.map +1 -0
- package/indexeddb/metafile-cjs.json +1 -0
- package/indexeddb/metafile-esm.json +1 -0
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +17 -12
- package/react/index.d.cts +1 -1
- package/react/index.d.ts +1 -1
- package/tests/blockstore/{keyed-crypto-indexdb-file.test.ts → keyed-crypto-indexeddb-file.test.ts} +7 -7
- package/tests/blockstore/keyed-crypto.test.ts +8 -8
- package/tests/blockstore/loader.test.ts +1 -1
- package/tests/gateway/{indexdb → indexeddb}/loader-config.test.ts +10 -10
- package/tests/helpers.ts +1 -1
- package/indexdb/index.cjs.map +0 -1
- package/indexdb/index.js.map +0 -1
- package/indexdb/metafile-cjs.json +0 -1
- package/indexdb/metafile-esm.json +0 -1
package/index.d.cts
CHANGED
@@ -4,9 +4,9 @@ import { Operation } from '@fireproof/vendor/@web3-storage/pail/crdt/api';
|
|
4
4
|
import { ByteView, ArrayBufferView, Version, Block as Block$1, UnknownLink, CID, Link, BlockView, MultihashHasher } from 'multiformats';
|
5
5
|
import { BlockFetcher as BlockFetcher$1 } from '@fireproof/vendor/@web3-storage/pail/api';
|
6
6
|
import { EventBlock } from '@fireproof/vendor/@web3-storage/pail/clock';
|
7
|
-
import { CarReader } from '@
|
7
|
+
import { CarReader } from '@ipld/car';
|
8
8
|
import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
|
9
|
-
import { CarReader as CarReader$1 } from '@
|
9
|
+
import { CarReader as CarReader$1 } from '@ipld/car/reader';
|
10
10
|
import { SuperThis as SuperThis$1 } from '@fireproof/core';
|
11
11
|
import { Block as Block$2 } from 'multiformats/block';
|
12
12
|
|
@@ -1604,10 +1604,10 @@ declare namespace index$1 {
|
|
1604
1604
|
|
1605
1605
|
declare const FILESTORE_VERSION = "v0.19-file";
|
1606
1606
|
|
1607
|
-
declare const
|
1607
|
+
declare const INDEXEDDB_VERSION = "v0.19-indexeddb";
|
1608
1608
|
|
1609
1609
|
declare const index_FILESTORE_VERSION: typeof FILESTORE_VERSION;
|
1610
|
-
declare const
|
1610
|
+
declare const index_INDEXEDDB_VERSION: typeof INDEXEDDB_VERSION;
|
1611
1611
|
type index_KeyBackProviderFactory = KeyBackProviderFactory;
|
1612
1612
|
type index_KeyBag = KeyBag;
|
1613
1613
|
declare const index_KeyBag: typeof KeyBag;
|
@@ -1626,7 +1626,7 @@ declare const index_getPath: typeof getPath;
|
|
1626
1626
|
declare const index_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
|
1627
1627
|
declare const index_runtimeFn: typeof runtimeFn;
|
1628
1628
|
declare namespace index {
|
1629
|
-
export { index_FILESTORE_VERSION as FILESTORE_VERSION,
|
1629
|
+
export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXEDDB_VERSION as INDEXEDDB_VERSION, type index_KeyBackProviderFactory as KeyBackProviderFactory, index_KeyBag as KeyBag, type index_KeyBagFile as KeyBagFile, type index_KeyBagOpts as KeyBagOpts, type index_KeyBagProvider as KeyBagProvider, type index_KeyBagProviderFactoryItem as KeyBagProviderFactoryItem, type index_KeyBagRuntime as KeyBagRuntime, type index_KeyItem as KeyItem, index_defaultKeyBagOpts as defaultKeyBagOpts, index_defaultKeyBagUrl as defaultKeyBagUrl, index_files as files, index_getFileName as getFileName, index_getKeyBag as getKeyBag, index_getPath as getPath, index$1 as gw, keyBag as kb, keyedCrypto as kc, index$3 as mf, index_registerKeyBagProviderFactory as registerKeyBagProviderFactory, index_runtimeFn as runtimeFn };
|
1630
1630
|
}
|
1631
1631
|
|
1632
1632
|
declare const PACKAGE_VERSION: string;
|
package/index.d.ts
CHANGED
@@ -4,9 +4,9 @@ import { Operation } from '@fireproof/vendor/@web3-storage/pail/crdt/api';
|
|
4
4
|
import { ByteView, ArrayBufferView, Version, Block as Block$1, UnknownLink, CID, Link, BlockView, MultihashHasher } from 'multiformats';
|
5
5
|
import { BlockFetcher as BlockFetcher$1 } from '@fireproof/vendor/@web3-storage/pail/api';
|
6
6
|
import { EventBlock } from '@fireproof/vendor/@web3-storage/pail/clock';
|
7
|
-
import { CarReader } from '@
|
7
|
+
import { CarReader } from '@ipld/car';
|
8
8
|
import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
|
9
|
-
import { CarReader as CarReader$1 } from '@
|
9
|
+
import { CarReader as CarReader$1 } from '@ipld/car/reader';
|
10
10
|
import { SuperThis as SuperThis$1 } from '@fireproof/core';
|
11
11
|
import { Block as Block$2 } from 'multiformats/block';
|
12
12
|
|
@@ -1604,10 +1604,10 @@ declare namespace index$1 {
|
|
1604
1604
|
|
1605
1605
|
declare const FILESTORE_VERSION = "v0.19-file";
|
1606
1606
|
|
1607
|
-
declare const
|
1607
|
+
declare const INDEXEDDB_VERSION = "v0.19-indexeddb";
|
1608
1608
|
|
1609
1609
|
declare const index_FILESTORE_VERSION: typeof FILESTORE_VERSION;
|
1610
|
-
declare const
|
1610
|
+
declare const index_INDEXEDDB_VERSION: typeof INDEXEDDB_VERSION;
|
1611
1611
|
type index_KeyBackProviderFactory = KeyBackProviderFactory;
|
1612
1612
|
type index_KeyBag = KeyBag;
|
1613
1613
|
declare const index_KeyBag: typeof KeyBag;
|
@@ -1626,7 +1626,7 @@ declare const index_getPath: typeof getPath;
|
|
1626
1626
|
declare const index_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
|
1627
1627
|
declare const index_runtimeFn: typeof runtimeFn;
|
1628
1628
|
declare namespace index {
|
1629
|
-
export { index_FILESTORE_VERSION as FILESTORE_VERSION,
|
1629
|
+
export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXEDDB_VERSION as INDEXEDDB_VERSION, type index_KeyBackProviderFactory as KeyBackProviderFactory, index_KeyBag as KeyBag, type index_KeyBagFile as KeyBagFile, type index_KeyBagOpts as KeyBagOpts, type index_KeyBagProvider as KeyBagProvider, type index_KeyBagProviderFactoryItem as KeyBagProviderFactoryItem, type index_KeyBagRuntime as KeyBagRuntime, type index_KeyItem as KeyItem, index_defaultKeyBagOpts as defaultKeyBagOpts, index_defaultKeyBagUrl as defaultKeyBagUrl, index_files as files, index_getFileName as getFileName, index_getKeyBag as getKeyBag, index_getPath as getPath, index$1 as gw, keyBag as kb, keyedCrypto as kc, index$3 as mf, index_registerKeyBagProviderFactory as registerKeyBagProviderFactory, index_runtimeFn as runtimeFn };
|
1630
1630
|
}
|
1631
1631
|
|
1632
1632
|
declare const PACKAGE_VERSION: string;
|
package/index.js
CHANGED
@@ -460,7 +460,7 @@ import * as UnixFS from "@ipld/unixfs";
|
|
460
460
|
import * as raw from "multiformats/codecs/raw";
|
461
461
|
import { withMaxChunkSize } from "@ipld/unixfs/file/chunker/fixed";
|
462
462
|
import { withWidth } from "@ipld/unixfs/file/layout/balanced";
|
463
|
-
import { exporter } from "
|
463
|
+
import { exporter } from "ipfs-unixfs-exporter";
|
464
464
|
var queuingStrategy = UnixFS.withCapacity();
|
465
465
|
var settings = UnixFS.configure({
|
466
466
|
fileChunkEncoder: raw,
|
@@ -736,9 +736,9 @@ var keyBagProviderFactories = new Map(
|
|
736
736
|
}
|
737
737
|
},
|
738
738
|
{
|
739
|
-
protocol: "
|
739
|
+
protocol: "indexeddb:",
|
740
740
|
factory: async (url, sthis) => {
|
741
|
-
const { KeyBagProviderImpl } = await import("@fireproof/core/
|
741
|
+
const { KeyBagProviderImpl } = await import("@fireproof/core/indexeddb");
|
742
742
|
return new KeyBagProviderImpl(url, sthis);
|
743
743
|
}
|
744
744
|
},
|
@@ -761,7 +761,7 @@ function defaultKeyBagUrl(sthis) {
|
|
761
761
|
let bagFnameOrUrl = sthis.env.get("FP_KEYBAG_URL");
|
762
762
|
let url;
|
763
763
|
if (runtimeFn2().isBrowser) {
|
764
|
-
url = URI3.from(bagFnameOrUrl || "
|
764
|
+
url = URI3.from(bagFnameOrUrl || "indexeddb://fp-keybag");
|
765
765
|
} else {
|
766
766
|
if (!bagFnameOrUrl) {
|
767
767
|
const home = sthis.env.get("HOME");
|
@@ -788,7 +788,7 @@ function defaultKeyBagOpts(sthis, kbo) {
|
|
788
788
|
} else {
|
789
789
|
let bagFnameOrUrl = sthis.env.get("FP_KEYBAG_URL");
|
790
790
|
if (runtimeFn2().isBrowser) {
|
791
|
-
url = URI3.from(bagFnameOrUrl || "
|
791
|
+
url = URI3.from(bagFnameOrUrl || "indexeddb://fp-keybag");
|
792
792
|
} else {
|
793
793
|
if (!bagFnameOrUrl) {
|
794
794
|
const home = sthis.env.get("HOME");
|
@@ -832,8 +832,8 @@ import { BuildURI, runtimeFn as runtimeFn3 } from "@adviser/cement";
|
|
832
832
|
// src/runtime/gateways/file/version.ts
|
833
833
|
var FILESTORE_VERSION = "v0.19-file";
|
834
834
|
|
835
|
-
// src/runtime/gateways/
|
836
|
-
var
|
835
|
+
// src/runtime/gateways/indexeddb-version.ts
|
836
|
+
var INDEXEDDB_VERSION = "v0.19-indexeddb";
|
837
837
|
|
838
838
|
// src/runtime/gateways/file/gateway-impl.ts
|
839
839
|
import { exception2Result, KeyedResolvOnce as KeyedResolvOnce2, Result as Result3 } from "@adviser/cement";
|
@@ -1055,7 +1055,7 @@ import { decodeEventBlock, EventBlock } from "@fireproof/vendor/@web3-storage/pa
|
|
1055
1055
|
import { base64pad } from "multiformats/bases/base64";
|
1056
1056
|
import { CID } from "multiformats";
|
1057
1057
|
import { fromJSON } from "multiformats/link";
|
1058
|
-
import { format, parse } from "@
|
1058
|
+
import { format, parse } from "@ipld/dag-json";
|
1059
1059
|
async function dbMetaEvent2Serialized(sthis, dbEvents) {
|
1060
1060
|
return await Promise.all(
|
1061
1061
|
dbEvents.map(async (dbEvent) => {
|
@@ -1222,7 +1222,7 @@ var DefSerdeGateway = class {
|
|
1222
1222
|
const ret = this.gw.put(url, rUint8.Ok(), sthis);
|
1223
1223
|
if (env.type === "meta" /* META */) {
|
1224
1224
|
if (this.subscribeFn.has(url.toString())) {
|
1225
|
-
this.subscribeFn.get(url.toString())(
|
1225
|
+
this.subscribeFn.get(url.toString())(rUint8.Ok());
|
1226
1226
|
}
|
1227
1227
|
}
|
1228
1228
|
return ret;
|
@@ -1233,22 +1233,22 @@ var DefSerdeGateway = class {
|
|
1233
1233
|
return fpDeserialize(sthis, url, res, decoder);
|
1234
1234
|
}
|
1235
1235
|
async subscribe({ loader: { sthis }, decoder }, url, callback) {
|
1236
|
+
function rawCallback(raw2) {
|
1237
|
+
return fpDeserialize(sthis, url, Result7.Ok(raw2), decoder).then((res) => {
|
1238
|
+
if (res.isErr()) {
|
1239
|
+
sthis.logger.Error().Err(res).Msg("Failed to deserialize");
|
1240
|
+
return;
|
1241
|
+
}
|
1242
|
+
callback(res.Ok());
|
1243
|
+
});
|
1244
|
+
}
|
1236
1245
|
if (!this.gw.subscribe) {
|
1237
|
-
this.subscribeFn.set(url.toString(),
|
1246
|
+
this.subscribeFn.set(url.toString(), rawCallback);
|
1238
1247
|
return Result7.Ok(() => {
|
1239
1248
|
this.subscribeFn.delete(url.toString());
|
1240
1249
|
});
|
1241
1250
|
}
|
1242
|
-
const unreg = await this.gw.subscribe(
|
1243
|
-
url,
|
1244
|
-
(raw2) => {
|
1245
|
-
fpDeserialize(sthis, url, Result7.Ok(raw2), decoder).then((res) => {
|
1246
|
-
if (res.isErr()) return;
|
1247
|
-
callback(res.Ok());
|
1248
|
-
});
|
1249
|
-
},
|
1250
|
-
sthis
|
1251
|
-
);
|
1251
|
+
const unreg = await this.gw.subscribe(url, rawCallback, sthis);
|
1252
1252
|
return unreg;
|
1253
1253
|
}
|
1254
1254
|
async delete({ loader: { sthis } }, url) {
|
@@ -1336,13 +1336,13 @@ if (runtimeFn3().isNodeIsh || runtimeFn3().isDeno) {
|
|
1336
1336
|
}
|
1337
1337
|
if (runtimeFn3().isBrowser) {
|
1338
1338
|
registerStoreProtocol({
|
1339
|
-
protocol: "
|
1339
|
+
protocol: "indexeddb:",
|
1340
1340
|
isDefault: true,
|
1341
1341
|
defaultURI: () => {
|
1342
|
-
return BuildURI.from("
|
1342
|
+
return BuildURI.from("indexeddb://").pathname("fp").setParam("version" /* VERSION */, INDEXEDDB_VERSION).setParam("runtime" /* RUNTIME */, "browser").URI();
|
1343
1343
|
},
|
1344
1344
|
gateway: async () => {
|
1345
|
-
const { GatewayImpl } = await import("@fireproof/core/
|
1345
|
+
const { GatewayImpl } = await import("@fireproof/core/indexeddb");
|
1346
1346
|
return new GatewayImpl();
|
1347
1347
|
}
|
1348
1348
|
});
|
@@ -1432,7 +1432,7 @@ async function createUnsafe({
|
|
1432
1432
|
|
1433
1433
|
// src/indexer-helpers.ts
|
1434
1434
|
import { sha256 as hasher } from "multiformats/hashes/sha2";
|
1435
|
-
import * as codec from "@
|
1435
|
+
import * as codec from "@ipld/dag-cbor";
|
1436
1436
|
import charwise from "charwise";
|
1437
1437
|
import * as DbIndex from "prolly-trees/db-index";
|
1438
1438
|
import { bf, simpleCompare } from "prolly-trees/utils";
|
@@ -1941,12 +1941,12 @@ import { exception2Result as exception2Result3, ResolveOnce as ResolveOnce4, Res
|
|
1941
1941
|
|
1942
1942
|
// src/blockstore/loader.ts
|
1943
1943
|
import pLimit from "p-limit";
|
1944
|
-
import { CarReader } from "@
|
1944
|
+
import { CarReader } from "@ipld/car/reader";
|
1945
1945
|
import { ResolveOnce as ResolveOnce3 } from "@adviser/cement";
|
1946
1946
|
|
1947
1947
|
// src/blockstore/loader-helpers.ts
|
1948
1948
|
import { sha256 as hasher2 } from "multiformats/hashes/sha2";
|
1949
|
-
import * as dagCodec from "@
|
1949
|
+
import * as dagCodec from "@ipld/dag-cbor";
|
1950
1950
|
async function parseCarFile(reader, logger) {
|
1951
1951
|
const roots = await reader.getRoots();
|
1952
1952
|
const header = await reader.get(roots[0]);
|
@@ -2233,9 +2233,9 @@ var CommitQueue = class {
|
|
2233
2233
|
};
|
2234
2234
|
|
2235
2235
|
// src/blockstore/commitor.ts
|
2236
|
-
import * as CBW from "@
|
2236
|
+
import * as CBW from "@ipld/car/buffer-writer";
|
2237
2237
|
import { sha256 as hasher3 } from "multiformats/hashes/sha2";
|
2238
|
-
import * as dagCodec2 from "@
|
2238
|
+
import * as dagCodec2 from "@ipld/dag-cbor";
|
2239
2239
|
async function encodeCarFile(roots, t, codec3) {
|
2240
2240
|
let size = 0;
|
2241
2241
|
const headerSize = CBW.headerLength({ roots });
|
@@ -2714,7 +2714,7 @@ var Loader = class {
|
|
2714
2714
|
let loadedCar = void 0;
|
2715
2715
|
let activeStore = local;
|
2716
2716
|
try {
|
2717
|
-
this.logger.Debug().
|
2717
|
+
this.logger.Debug().Any("cid", cidsString).Msg("loading car");
|
2718
2718
|
loadedCar = await local.load(cid);
|
2719
2719
|
this.logger.Debug().Bool("loadedCar", loadedCar).Msg("loaded");
|
2720
2720
|
} catch (e) {
|
@@ -2771,7 +2771,7 @@ __export(keyed_crypto_exports, {
|
|
2771
2771
|
});
|
2772
2772
|
import { base58btc as base58btc3 } from "multiformats/bases/base58";
|
2773
2773
|
import { sha256 as hasher5 } from "multiformats/hashes/sha2";
|
2774
|
-
import * as CBOR from "
|
2774
|
+
import * as CBOR from "cborg";
|
2775
2775
|
var generateIV = {
|
2776
2776
|
random: {
|
2777
2777
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
@@ -2937,7 +2937,7 @@ async function keyedCryptoFactory(url, kb, sthis) {
|
|
2937
2937
|
|
2938
2938
|
// src/blockstore/store.ts
|
2939
2939
|
import { EventBlock as EventBlock2 } from "@fireproof/vendor/@web3-storage/pail/clock";
|
2940
|
-
import { format as format2 } from "@
|
2940
|
+
import { format as format2 } from "@ipld/dag-json";
|
2941
2941
|
import pRetry from "p-retry";
|
2942
2942
|
import pMap from "p-map";
|
2943
2943
|
|
@@ -3788,7 +3788,7 @@ var ConnectionBase = class {
|
|
3788
3788
|
// src/crdt-helpers.ts
|
3789
3789
|
import { parse as parse2 } from "multiformats/link";
|
3790
3790
|
import { sha256 as hasher6 } from "multiformats/hashes/sha2";
|
3791
|
-
import * as codec2 from "@
|
3791
|
+
import * as codec2 from "@ipld/dag-cbor";
|
3792
3792
|
import { put, get, entries, root } from "@fireproof/vendor/@web3-storage/pail/crdt";
|
3793
3793
|
import { EventFetcher, vis } from "@fireproof/vendor/@web3-storage/pail/clock";
|
3794
3794
|
import * as Batch from "@fireproof/vendor/@web3-storage/pail/crdt/batch";
|
@@ -4609,7 +4609,7 @@ function fireproof(name, opts) {
|
|
4609
4609
|
var runtime_exports = {};
|
4610
4610
|
__export(runtime_exports, {
|
4611
4611
|
FILESTORE_VERSION: () => FILESTORE_VERSION,
|
4612
|
-
|
4612
|
+
INDEXEDDB_VERSION: () => INDEXEDDB_VERSION,
|
4613
4613
|
KeyBag: () => KeyBag,
|
4614
4614
|
defaultKeyBagOpts: () => defaultKeyBagOpts,
|
4615
4615
|
defaultKeyBagUrl: () => defaultKeyBagUrl,
|
@@ -4659,7 +4659,7 @@ __export(file_exports, {
|
|
4659
4659
|
|
4660
4660
|
// src/version.ts
|
4661
4661
|
var PACKAGE_VERSION = Object.keys({
|
4662
|
-
"0.20.0-dev-preview-
|
4662
|
+
"0.20.0-dev-preview-21": "xxxx"
|
4663
4663
|
})[0];
|
4664
4664
|
export {
|
4665
4665
|
CRDTImpl,
|