@fireproof/core 0.20.0-dev-preview-14 → 0.20.0-dev-preview-16
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs +88 -48
- package/index.cjs.map +1 -1
- package/index.d.cts +43 -19
- package/index.d.ts +43 -19
- package/index.js +78 -38
- package/index.js.map +1 -1
- package/{web → indexdb}/index.cjs +5 -5
- package/indexdb/index.cjs.map +1 -0
- package/{web → indexdb}/index.d.cts +1 -1
- package/{web → indexdb}/index.d.ts +1 -1
- package/{web → indexdb}/index.js +4 -4
- package/indexdb/index.js.map +1 -0
- package/indexdb/metafile-cjs.json +1 -0
- package/indexdb/metafile-esm.json +1 -0
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +10 -10
- package/react/index.d.cts +1 -1
- package/react/index.d.ts +1 -1
- package/tests/blockstore/keyed-crypto-indexdb-file.test.ts +1 -1
- package/tests/blockstore/keyed-crypto.test.ts +1 -1
- package/web/index.cjs.map +0 -1
- package/web/index.js.map +0 -1
- package/web/metafile-cjs.json +0 -1
- package/web/metafile-esm.json +0 -1
package/index.d.cts
CHANGED
@@ -295,6 +295,13 @@ interface SerdeGatewayInterceptor {
|
|
295
295
|
subscribe(sthis: SuperThis, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void>, loader: Loadable): Promise<Result<SerdeGatewaySubscribeReturn>>;
|
296
296
|
}
|
297
297
|
|
298
|
+
declare class Context {
|
299
|
+
private ctx;
|
300
|
+
set<T>(key: string, value: T): void;
|
301
|
+
get<T>(key: string): T | undefined;
|
302
|
+
delete(key: string): void;
|
303
|
+
}
|
304
|
+
|
298
305
|
type AnyLink = Link<unknown, number, number, Version>;
|
299
306
|
type CarGroup = AnyLink[];
|
300
307
|
type CarLog = CarGroup[];
|
@@ -450,7 +457,8 @@ interface RefBlockstore {
|
|
450
457
|
readonly blockstore: RefLoadable;
|
451
458
|
}
|
452
459
|
interface Connection {
|
453
|
-
|
460
|
+
loaded(): Future<void>;
|
461
|
+
readonly context: Context;
|
454
462
|
connectStorage(ref: RefLoadable | RefBlockstore): void;
|
455
463
|
}
|
456
464
|
interface BaseStore {
|
@@ -703,10 +711,13 @@ declare function parseCarFile<T>(reader: CarReader$1, logger: Logger): Promise<C
|
|
703
711
|
declare abstract class ConnectionBase implements Connection {
|
704
712
|
private loader?;
|
705
713
|
taskManager?: TaskManager;
|
706
|
-
|
714
|
+
readonly context: Context;
|
707
715
|
readonly url: URI;
|
708
716
|
readonly logger: Logger;
|
709
717
|
constructor(url: URI, logger: Logger);
|
718
|
+
private readonly _loaded;
|
719
|
+
private _metaIsLoading;
|
720
|
+
loaded(): Future<void>;
|
710
721
|
refresh(): Promise<void>;
|
711
722
|
connect(refl: RefLoadable | RefBlockstore): Promise<void>;
|
712
723
|
connectMeta(refl: RefLoadable | RefBlockstore): Promise<void>;
|
@@ -897,13 +908,6 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
|
|
897
908
|
_updateIndex(): Promise<IndexTransactionMeta>;
|
898
909
|
}
|
899
910
|
|
900
|
-
declare class Context {
|
901
|
-
private ctx;
|
902
|
-
set<T>(key: string, value: T): void;
|
903
|
-
get<T>(key: string): T | undefined;
|
904
|
-
delete(key: string): void;
|
905
|
-
}
|
906
|
-
|
907
911
|
type Falsy = false | null | undefined;
|
908
912
|
declare function isFalsy(value: unknown): value is Falsy;
|
909
913
|
declare enum PARAM {
|
@@ -1532,19 +1536,39 @@ declare namespace index$2 {
|
|
1532
1536
|
export { index$2_KeyBagProviderFile as KeyBagProviderFile, index$2_sysFileSystemFactory as sysFileSystemFactory };
|
1533
1537
|
}
|
1534
1538
|
|
1539
|
+
declare class MemoryGateway implements Gateway {
|
1540
|
+
readonly memorys: Map<string, Uint8Array>;
|
1541
|
+
readonly sthis: SuperThis;
|
1542
|
+
constructor(sthis: SuperThis, memorys: Map<string, Uint8Array>);
|
1543
|
+
buildUrl(baseUrl: URI, key: string): Promise<Result<URI>>;
|
1544
|
+
start(baseUrl: URI): Promise<Result<URI>>;
|
1545
|
+
close(baseUrl: URI): Promise<VoidResult>;
|
1546
|
+
destroy(baseUrl: URI): Promise<VoidResult>;
|
1547
|
+
put(url: URI, bytes: Uint8Array): Promise<VoidResult>;
|
1548
|
+
get(url: URI): Promise<GetResult>;
|
1549
|
+
delete(url: URI): Promise<VoidResult>;
|
1550
|
+
getPlain(url: URI, key: string): Promise<Result<Uint8Array>>;
|
1551
|
+
}
|
1552
|
+
|
1553
|
+
type gateway_MemoryGateway = MemoryGateway;
|
1554
|
+
declare const gateway_MemoryGateway: typeof MemoryGateway;
|
1555
|
+
declare namespace gateway {
|
1556
|
+
export { gateway_MemoryGateway as MemoryGateway };
|
1557
|
+
}
|
1558
|
+
|
1535
1559
|
declare class DefSerdeGateway implements SerdeGateway {
|
1536
1560
|
readonly gw: Gateway;
|
1537
1561
|
constructor(gw: Gateway);
|
1538
|
-
start(sthis: SuperThis, baseURL: URI): Promise<Result<URI>>;
|
1539
|
-
buildUrl(sthis: SuperThis, baseUrl: URI, key: string): Promise<Result<URI>>;
|
1540
|
-
close(sthis: SuperThis, uri: URI): Promise<Result<void>>;
|
1562
|
+
start(sthis: SuperThis, baseURL: URI, loader?: Loadable): Promise<Result<URI>>;
|
1563
|
+
buildUrl(sthis: SuperThis, baseUrl: URI, key: string, loader?: Loadable): Promise<Result<URI>>;
|
1564
|
+
close(sthis: SuperThis, uri: URI, loader?: Loadable): Promise<Result<void>>;
|
1541
1565
|
private subscribeFn;
|
1542
|
-
put<T>(sthis: SuperThis, url: URI, env: FPEnvelope<T
|
1543
|
-
get<S>(sthis: SuperThis, url: URI): Promise<SerdeGetResult<S>>;
|
1544
|
-
subscribe(sthis: SuperThis, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void
|
1545
|
-
delete(sthis: SuperThis, url: URI): Promise<Result<void>>;
|
1546
|
-
destroy(sthis: SuperThis, baseURL: URI): Promise<Result<void>>;
|
1547
|
-
getPlain(sthis: SuperThis, iurl: URI, key: string): Promise<Result<Uint8Array<ArrayBufferLike>, Error>>;
|
1566
|
+
put<T>(sthis: SuperThis, url: URI, env: FPEnvelope<T>, loader?: Loadable): Promise<Result<void>>;
|
1567
|
+
get<S>(sthis: SuperThis, url: URI, loader?: Loadable): Promise<SerdeGetResult<S>>;
|
1568
|
+
subscribe(sthis: SuperThis, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void>, loader?: Loadable): Promise<Result<() => void>>;
|
1569
|
+
delete(sthis: SuperThis, url: URI, loader?: Loadable): Promise<Result<void>>;
|
1570
|
+
destroy(sthis: SuperThis, baseURL: URI, loader?: Loadable): Promise<Result<void>>;
|
1571
|
+
getPlain(sthis: SuperThis, iurl: URI, key: string, loader?: Loadable): Promise<Result<Uint8Array<ArrayBufferLike>, Error>>;
|
1548
1572
|
}
|
1549
1573
|
|
1550
1574
|
type index$1_CARDecodeEnvelope = CARDecodeEnvelope;
|
@@ -1564,7 +1588,7 @@ type index$1_WALEncodeEnvelope = WALEncodeEnvelope;
|
|
1564
1588
|
declare const index$1_fpDeserialize: typeof fpDeserialize;
|
1565
1589
|
declare const index$1_fpSerialize: typeof fpSerialize;
|
1566
1590
|
declare namespace index$1 {
|
1567
|
-
export { type index$1_CARDecodeEnvelope as CARDecodeEnvelope, type index$1_CAREncodeEnvelope as CAREncodeEnvelope, type index$1_Decoder as Decoder, index$1_DefSerdeGateway as DefSerdeGateway, type index$1_Encoder as Encoder, type index$1_FILEDecodeEnvelope as FILEDecodeEnvelope, type index$1_FILEEncodeEnvelope as FILEEncodeEnvelope, type index$1_METADecodeEnvelope as METADecodeEnvelope, type index$1_METAEncodeEnvelope as METAEncodeEnvelope, type index$1_SerializedMeta as SerializedMeta, type index$1_SerializedWAL as SerializedWAL, type index$1_WALDecodeEnvelope as WALDecodeEnvelope, type index$1_WALEncodeEnvelope as WALEncodeEnvelope, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize };
|
1591
|
+
export { type index$1_CARDecodeEnvelope as CARDecodeEnvelope, type index$1_CAREncodeEnvelope as CAREncodeEnvelope, type index$1_Decoder as Decoder, index$1_DefSerdeGateway as DefSerdeGateway, type index$1_Encoder as Encoder, type index$1_FILEDecodeEnvelope as FILEDecodeEnvelope, type index$1_FILEEncodeEnvelope as FILEEncodeEnvelope, type index$1_METADecodeEnvelope as METADecodeEnvelope, type index$1_METAEncodeEnvelope as METAEncodeEnvelope, type index$1_SerializedMeta as SerializedMeta, type index$1_SerializedWAL as SerializedWAL, type index$1_WALDecodeEnvelope as WALDecodeEnvelope, type index$1_WALEncodeEnvelope as WALEncodeEnvelope, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize, gateway as memory };
|
1568
1592
|
}
|
1569
1593
|
|
1570
1594
|
declare const FILESTORE_VERSION = "v0.19-file";
|
package/index.d.ts
CHANGED
@@ -295,6 +295,13 @@ interface SerdeGatewayInterceptor {
|
|
295
295
|
subscribe(sthis: SuperThis, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void>, loader: Loadable): Promise<Result<SerdeGatewaySubscribeReturn>>;
|
296
296
|
}
|
297
297
|
|
298
|
+
declare class Context {
|
299
|
+
private ctx;
|
300
|
+
set<T>(key: string, value: T): void;
|
301
|
+
get<T>(key: string): T | undefined;
|
302
|
+
delete(key: string): void;
|
303
|
+
}
|
304
|
+
|
298
305
|
type AnyLink = Link<unknown, number, number, Version>;
|
299
306
|
type CarGroup = AnyLink[];
|
300
307
|
type CarLog = CarGroup[];
|
@@ -450,7 +457,8 @@ interface RefBlockstore {
|
|
450
457
|
readonly blockstore: RefLoadable;
|
451
458
|
}
|
452
459
|
interface Connection {
|
453
|
-
|
460
|
+
loaded(): Future<void>;
|
461
|
+
readonly context: Context;
|
454
462
|
connectStorage(ref: RefLoadable | RefBlockstore): void;
|
455
463
|
}
|
456
464
|
interface BaseStore {
|
@@ -703,10 +711,13 @@ declare function parseCarFile<T>(reader: CarReader$1, logger: Logger): Promise<C
|
|
703
711
|
declare abstract class ConnectionBase implements Connection {
|
704
712
|
private loader?;
|
705
713
|
taskManager?: TaskManager;
|
706
|
-
|
714
|
+
readonly context: Context;
|
707
715
|
readonly url: URI;
|
708
716
|
readonly logger: Logger;
|
709
717
|
constructor(url: URI, logger: Logger);
|
718
|
+
private readonly _loaded;
|
719
|
+
private _metaIsLoading;
|
720
|
+
loaded(): Future<void>;
|
710
721
|
refresh(): Promise<void>;
|
711
722
|
connect(refl: RefLoadable | RefBlockstore): Promise<void>;
|
712
723
|
connectMeta(refl: RefLoadable | RefBlockstore): Promise<void>;
|
@@ -897,13 +908,6 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
|
|
897
908
|
_updateIndex(): Promise<IndexTransactionMeta>;
|
898
909
|
}
|
899
910
|
|
900
|
-
declare class Context {
|
901
|
-
private ctx;
|
902
|
-
set<T>(key: string, value: T): void;
|
903
|
-
get<T>(key: string): T | undefined;
|
904
|
-
delete(key: string): void;
|
905
|
-
}
|
906
|
-
|
907
911
|
type Falsy = false | null | undefined;
|
908
912
|
declare function isFalsy(value: unknown): value is Falsy;
|
909
913
|
declare enum PARAM {
|
@@ -1532,19 +1536,39 @@ declare namespace index$2 {
|
|
1532
1536
|
export { index$2_KeyBagProviderFile as KeyBagProviderFile, index$2_sysFileSystemFactory as sysFileSystemFactory };
|
1533
1537
|
}
|
1534
1538
|
|
1539
|
+
declare class MemoryGateway implements Gateway {
|
1540
|
+
readonly memorys: Map<string, Uint8Array>;
|
1541
|
+
readonly sthis: SuperThis;
|
1542
|
+
constructor(sthis: SuperThis, memorys: Map<string, Uint8Array>);
|
1543
|
+
buildUrl(baseUrl: URI, key: string): Promise<Result<URI>>;
|
1544
|
+
start(baseUrl: URI): Promise<Result<URI>>;
|
1545
|
+
close(baseUrl: URI): Promise<VoidResult>;
|
1546
|
+
destroy(baseUrl: URI): Promise<VoidResult>;
|
1547
|
+
put(url: URI, bytes: Uint8Array): Promise<VoidResult>;
|
1548
|
+
get(url: URI): Promise<GetResult>;
|
1549
|
+
delete(url: URI): Promise<VoidResult>;
|
1550
|
+
getPlain(url: URI, key: string): Promise<Result<Uint8Array>>;
|
1551
|
+
}
|
1552
|
+
|
1553
|
+
type gateway_MemoryGateway = MemoryGateway;
|
1554
|
+
declare const gateway_MemoryGateway: typeof MemoryGateway;
|
1555
|
+
declare namespace gateway {
|
1556
|
+
export { gateway_MemoryGateway as MemoryGateway };
|
1557
|
+
}
|
1558
|
+
|
1535
1559
|
declare class DefSerdeGateway implements SerdeGateway {
|
1536
1560
|
readonly gw: Gateway;
|
1537
1561
|
constructor(gw: Gateway);
|
1538
|
-
start(sthis: SuperThis, baseURL: URI): Promise<Result<URI>>;
|
1539
|
-
buildUrl(sthis: SuperThis, baseUrl: URI, key: string): Promise<Result<URI>>;
|
1540
|
-
close(sthis: SuperThis, uri: URI): Promise<Result<void>>;
|
1562
|
+
start(sthis: SuperThis, baseURL: URI, loader?: Loadable): Promise<Result<URI>>;
|
1563
|
+
buildUrl(sthis: SuperThis, baseUrl: URI, key: string, loader?: Loadable): Promise<Result<URI>>;
|
1564
|
+
close(sthis: SuperThis, uri: URI, loader?: Loadable): Promise<Result<void>>;
|
1541
1565
|
private subscribeFn;
|
1542
|
-
put<T>(sthis: SuperThis, url: URI, env: FPEnvelope<T
|
1543
|
-
get<S>(sthis: SuperThis, url: URI): Promise<SerdeGetResult<S>>;
|
1544
|
-
subscribe(sthis: SuperThis, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void
|
1545
|
-
delete(sthis: SuperThis, url: URI): Promise<Result<void>>;
|
1546
|
-
destroy(sthis: SuperThis, baseURL: URI): Promise<Result<void>>;
|
1547
|
-
getPlain(sthis: SuperThis, iurl: URI, key: string): Promise<Result<Uint8Array<ArrayBufferLike>, Error>>;
|
1566
|
+
put<T>(sthis: SuperThis, url: URI, env: FPEnvelope<T>, loader?: Loadable): Promise<Result<void>>;
|
1567
|
+
get<S>(sthis: SuperThis, url: URI, loader?: Loadable): Promise<SerdeGetResult<S>>;
|
1568
|
+
subscribe(sthis: SuperThis, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void>, loader?: Loadable): Promise<Result<() => void>>;
|
1569
|
+
delete(sthis: SuperThis, url: URI, loader?: Loadable): Promise<Result<void>>;
|
1570
|
+
destroy(sthis: SuperThis, baseURL: URI, loader?: Loadable): Promise<Result<void>>;
|
1571
|
+
getPlain(sthis: SuperThis, iurl: URI, key: string, loader?: Loadable): Promise<Result<Uint8Array<ArrayBufferLike>, Error>>;
|
1548
1572
|
}
|
1549
1573
|
|
1550
1574
|
type index$1_CARDecodeEnvelope = CARDecodeEnvelope;
|
@@ -1564,7 +1588,7 @@ type index$1_WALEncodeEnvelope = WALEncodeEnvelope;
|
|
1564
1588
|
declare const index$1_fpDeserialize: typeof fpDeserialize;
|
1565
1589
|
declare const index$1_fpSerialize: typeof fpSerialize;
|
1566
1590
|
declare namespace index$1 {
|
1567
|
-
export { type index$1_CARDecodeEnvelope as CARDecodeEnvelope, type index$1_CAREncodeEnvelope as CAREncodeEnvelope, type index$1_Decoder as Decoder, index$1_DefSerdeGateway as DefSerdeGateway, type index$1_Encoder as Encoder, type index$1_FILEDecodeEnvelope as FILEDecodeEnvelope, type index$1_FILEEncodeEnvelope as FILEEncodeEnvelope, type index$1_METADecodeEnvelope as METADecodeEnvelope, type index$1_METAEncodeEnvelope as METAEncodeEnvelope, type index$1_SerializedMeta as SerializedMeta, type index$1_SerializedWAL as SerializedWAL, type index$1_WALDecodeEnvelope as WALDecodeEnvelope, type index$1_WALEncodeEnvelope as WALEncodeEnvelope, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize };
|
1591
|
+
export { type index$1_CARDecodeEnvelope as CARDecodeEnvelope, type index$1_CAREncodeEnvelope as CAREncodeEnvelope, type index$1_Decoder as Decoder, index$1_DefSerdeGateway as DefSerdeGateway, type index$1_Encoder as Encoder, type index$1_FILEDecodeEnvelope as FILEDecodeEnvelope, type index$1_FILEEncodeEnvelope as FILEEncodeEnvelope, type index$1_METADecodeEnvelope as METADecodeEnvelope, type index$1_METAEncodeEnvelope as METAEncodeEnvelope, type index$1_SerializedMeta as SerializedMeta, type index$1_SerializedWAL as SerializedWAL, type index$1_WALDecodeEnvelope as WALDecodeEnvelope, type index$1_WALEncodeEnvelope as WALEncodeEnvelope, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize, gateway as memory };
|
1568
1592
|
}
|
1569
1593
|
|
1570
1594
|
declare const FILESTORE_VERSION = "v0.19-file";
|
package/index.js
CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
5
5
|
};
|
6
6
|
|
7
7
|
// src/ledger.ts
|
8
|
-
import { BuildURI as BuildURI2, KeyedResolvOnce as KeyedResolvOnce4, ResolveOnce as ResolveOnce7, URI as
|
8
|
+
import { BuildURI as BuildURI2, KeyedResolvOnce as KeyedResolvOnce4, ResolveOnce as ResolveOnce7, URI as URI13 } from "@adviser/cement";
|
9
9
|
|
10
10
|
// src/utils.ts
|
11
11
|
import {
|
@@ -738,7 +738,7 @@ var keyBagProviderFactories = new Map(
|
|
738
738
|
{
|
739
739
|
protocol: "indexdb:",
|
740
740
|
factory: async (url, sthis) => {
|
741
|
-
const { KeyBagProviderImpl } = await import("@fireproof/core/
|
741
|
+
const { KeyBagProviderImpl } = await import("@fireproof/core/indexdb");
|
742
742
|
return new KeyBagProviderImpl(url, sthis);
|
743
743
|
}
|
744
744
|
},
|
@@ -832,7 +832,7 @@ 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/indexdb
|
835
|
+
// src/runtime/gateways/indexdb-version.ts
|
836
836
|
var INDEXDB_VERSION = "v0.19-indexdb";
|
837
837
|
|
838
838
|
// src/runtime/gateways/file/gateway-impl.ts
|
@@ -975,6 +975,10 @@ var FileGateway = class {
|
|
975
975
|
};
|
976
976
|
|
977
977
|
// src/runtime/gateways/memory/gateway.ts
|
978
|
+
var gateway_exports = {};
|
979
|
+
__export(gateway_exports, {
|
980
|
+
MemoryGateway: () => MemoryGateway
|
981
|
+
});
|
978
982
|
import { Result as Result4 } from "@adviser/cement";
|
979
983
|
|
980
984
|
// src/runtime/gateways/memory/version.ts
|
@@ -1203,16 +1207,20 @@ var DefSerdeGateway = class {
|
|
1203
1207
|
this.subscribeFn = /* @__PURE__ */ new Map();
|
1204
1208
|
this.gw = gw;
|
1205
1209
|
}
|
1206
|
-
|
1210
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1211
|
+
start(sthis, baseURL, loader) {
|
1207
1212
|
return this.gw.start(baseURL, sthis);
|
1208
1213
|
}
|
1209
|
-
|
1214
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1215
|
+
async buildUrl(sthis, baseUrl, key, loader) {
|
1210
1216
|
return this.gw.buildUrl(baseUrl, key, sthis);
|
1211
1217
|
}
|
1212
|
-
|
1218
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1219
|
+
async close(sthis, uri, loader) {
|
1213
1220
|
return this.gw.close(uri, sthis);
|
1214
1221
|
}
|
1215
|
-
|
1222
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1223
|
+
async put(sthis, url, env, loader) {
|
1216
1224
|
const rUint8 = await fpSerialize(sthis, env);
|
1217
1225
|
if (rUint8.isErr()) return rUint8;
|
1218
1226
|
const ret = this.gw.put(url, rUint8.Ok(), sthis);
|
@@ -1223,12 +1231,13 @@ var DefSerdeGateway = class {
|
|
1223
1231
|
}
|
1224
1232
|
return ret;
|
1225
1233
|
}
|
1226
|
-
|
1234
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1235
|
+
async get(sthis, url, loader) {
|
1227
1236
|
const res = await this.gw.get(url, sthis);
|
1228
1237
|
if (res.isErr()) return Result7.Err(res.Err());
|
1229
1238
|
return fpDeserialize(sthis, url, res);
|
1230
1239
|
}
|
1231
|
-
async subscribe(sthis, url, callback) {
|
1240
|
+
async subscribe(sthis, url, callback, loader) {
|
1232
1241
|
if (!this.gw.subscribe) {
|
1233
1242
|
this.subscribeFn.set(url.toString(), callback);
|
1234
1243
|
return Result7.Ok(() => {
|
@@ -1247,13 +1256,16 @@ var DefSerdeGateway = class {
|
|
1247
1256
|
);
|
1248
1257
|
return unreg;
|
1249
1258
|
}
|
1250
|
-
|
1259
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1260
|
+
async delete(sthis, url, loader) {
|
1251
1261
|
return this.gw.delete(url, sthis);
|
1252
1262
|
}
|
1253
|
-
|
1263
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1264
|
+
async destroy(sthis, baseURL, loader) {
|
1254
1265
|
return this.gw.destroy(baseURL, sthis);
|
1255
1266
|
}
|
1256
|
-
|
1267
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1268
|
+
async getPlain(sthis, iurl, key, loader) {
|
1257
1269
|
return this.gw.getPlain(iurl, key, sthis);
|
1258
1270
|
}
|
1259
1271
|
};
|
@@ -1338,7 +1350,7 @@ if (runtimeFn3().isBrowser) {
|
|
1338
1350
|
return BuildURI.from("indexdb://").pathname("fp").setParam("version" /* VERSION */, INDEXDB_VERSION).setParam("runtime" /* RUNTIME */, "browser").URI();
|
1339
1351
|
},
|
1340
1352
|
gateway: async () => {
|
1341
|
-
const { GatewayImpl } = await import("@fireproof/core/
|
1353
|
+
const { GatewayImpl } = await import("@fireproof/core/indexdb");
|
1342
1354
|
return new GatewayImpl();
|
1343
1355
|
}
|
1344
1356
|
});
|
@@ -3639,6 +3651,9 @@ function toStoreRuntime(sthis, endeOpts = {}) {
|
|
3639
3651
|
};
|
3640
3652
|
}
|
3641
3653
|
|
3654
|
+
// src/blockstore/connection-base.ts
|
3655
|
+
import { exception2Result as exception2Result4, Future as Future3 } from "@adviser/cement";
|
3656
|
+
|
3642
3657
|
// src/blockstore/store-remote.ts
|
3643
3658
|
async function RemoteDataStore(sthis, url, opts) {
|
3644
3659
|
const ds = new DataStoreImpl(sthis, url, opts);
|
@@ -3651,6 +3666,22 @@ async function RemoteMetaStore(sthis, url, opts) {
|
|
3651
3666
|
return ms;
|
3652
3667
|
}
|
3653
3668
|
|
3669
|
+
// src/context.ts
|
3670
|
+
var Context = class {
|
3671
|
+
constructor() {
|
3672
|
+
this.ctx = /* @__PURE__ */ new Map();
|
3673
|
+
}
|
3674
|
+
set(key, value) {
|
3675
|
+
this.ctx.set(key, value);
|
3676
|
+
}
|
3677
|
+
get(key) {
|
3678
|
+
return this.ctx.get(key);
|
3679
|
+
}
|
3680
|
+
delete(key) {
|
3681
|
+
this.ctx.delete(key);
|
3682
|
+
}
|
3683
|
+
};
|
3684
|
+
|
3654
3685
|
// src/blockstore/connection-base.ts
|
3655
3686
|
function coerceLoader(ref) {
|
3656
3687
|
const refl = ref;
|
@@ -3665,10 +3696,22 @@ function coerceLoader(ref) {
|
|
3665
3696
|
}
|
3666
3697
|
var ConnectionBase = class {
|
3667
3698
|
constructor(url, logger) {
|
3668
|
-
|
3699
|
+
// loaded: Promise<void> = Promise.resolve();
|
3700
|
+
this.context = new Context();
|
3701
|
+
this._loaded = /* @__PURE__ */ new Set();
|
3702
|
+
this._metaIsLoading = false;
|
3669
3703
|
this.logger = logger;
|
3670
3704
|
this.url = url;
|
3671
3705
|
}
|
3706
|
+
loaded() {
|
3707
|
+
const f = new Future3();
|
3708
|
+
if (!this._metaIsLoading) {
|
3709
|
+
f.resolve();
|
3710
|
+
} else {
|
3711
|
+
this._loaded.add(f);
|
3712
|
+
}
|
3713
|
+
return f;
|
3714
|
+
}
|
3672
3715
|
async refresh() {
|
3673
3716
|
await throwFalsy(throwFalsy(this.loader).remoteMetaStore).load();
|
3674
3717
|
await (await throwFalsy(this.loader).WALStore()).process();
|
@@ -3696,22 +3739,34 @@ var ConnectionBase = class {
|
|
3696
3739
|
loader
|
3697
3740
|
});
|
3698
3741
|
this.loader.remoteMetaStore = remote;
|
3699
|
-
this.
|
3742
|
+
this._metaIsLoading = true;
|
3743
|
+
this.loader.ready().then(async () => {
|
3700
3744
|
return remote.load().then(async () => {
|
3701
|
-
|
3745
|
+
const res = await exception2Result4(async () => {
|
3746
|
+
return await (await throwFalsy(this.loader).WALStore()).process();
|
3747
|
+
});
|
3748
|
+
this._metaIsLoading = false;
|
3749
|
+
for (const f of this._loaded) {
|
3750
|
+
if (res.isErr()) {
|
3751
|
+
f.reject(res.Err());
|
3752
|
+
} else {
|
3753
|
+
f.resolve();
|
3754
|
+
}
|
3755
|
+
}
|
3756
|
+
this._loaded.clear();
|
3702
3757
|
});
|
3703
3758
|
});
|
3704
3759
|
}
|
3705
3760
|
async connectStorage(refl) {
|
3706
3761
|
const loader = coerceLoader(refl);
|
3707
|
-
if (!loader) throw this.logger.Error().Msg("
|
3762
|
+
if (!loader) throw this.logger.Error().Msg("connectStorage: loader is required").AsError();
|
3708
3763
|
this.loader = loader;
|
3709
3764
|
const dataUrl = this.url.build().defParam("store" /* STORE */, "data").URI();
|
3710
3765
|
const rgateway = await getStartedGateway(loader.sthis, dataUrl);
|
3711
3766
|
if (rgateway.isErr())
|
3712
|
-
throw this.logger.Error().Result("err", rgateway).Url(dataUrl).Msg("
|
3767
|
+
throw this.logger.Error().Result("err", rgateway).Url(dataUrl).Msg("connectStorage: gateway is required").AsError();
|
3713
3768
|
const name = dataUrl.getParam("name" /* NAME */);
|
3714
|
-
if (!name) throw this.logger.Error().Url(dataUrl).Msg("
|
3769
|
+
if (!name) throw this.logger.Error().Url(dataUrl).Msg("connectStorage: name is required").AsError;
|
3715
3770
|
loader.remoteCarStore = await RemoteDataStore(loader.sthis, this.url, {
|
3716
3771
|
gateway: rgateway.Ok().gateway,
|
3717
3772
|
loader
|
@@ -4327,22 +4382,6 @@ var CRDTImpl = class {
|
|
4327
4382
|
}
|
4328
4383
|
};
|
4329
4384
|
|
4330
|
-
// src/context.ts
|
4331
|
-
var Context = class {
|
4332
|
-
constructor() {
|
4333
|
-
this.ctx = /* @__PURE__ */ new Map();
|
4334
|
-
}
|
4335
|
-
set(key, value) {
|
4336
|
-
this.ctx.set(key, value);
|
4337
|
-
}
|
4338
|
-
get(key) {
|
4339
|
-
return this.ctx.get(key);
|
4340
|
-
}
|
4341
|
-
delete(key) {
|
4342
|
-
this.ctx.delete(key);
|
4343
|
-
}
|
4344
|
-
};
|
4345
|
-
|
4346
4385
|
// src/ledger.ts
|
4347
4386
|
var ledgers = new KeyedResolvOnce4();
|
4348
4387
|
function keyConfigOpts(sthis, name, opts) {
|
@@ -4530,7 +4569,7 @@ var LedgerImpl = class {
|
|
4530
4569
|
};
|
4531
4570
|
function defaultURI2(sthis, curi, uri, store, ctx) {
|
4532
4571
|
ctx = ctx || {};
|
4533
|
-
const ret = (curi ?
|
4572
|
+
const ret = (curi ? URI13.from(curi) : uri).build().setParam("store" /* STORE */, store);
|
4534
4573
|
if (!ret.hasParam("name" /* NAME */)) {
|
4535
4574
|
const name = sthis.pathOps.basename(ret.URI().pathname);
|
4536
4575
|
if (!name) {
|
@@ -4625,7 +4664,8 @@ __export(gateways_exports, {
|
|
4625
4664
|
DefSerdeGateway: () => DefSerdeGateway,
|
4626
4665
|
file: () => file_exports,
|
4627
4666
|
fpDeserialize: () => fpDeserialize,
|
4628
|
-
fpSerialize: () => fpSerialize
|
4667
|
+
fpSerialize: () => fpSerialize,
|
4668
|
+
memory: () => gateway_exports
|
4629
4669
|
});
|
4630
4670
|
|
4631
4671
|
// src/runtime/gateways/file/index.ts
|
@@ -4637,7 +4677,7 @@ __export(file_exports, {
|
|
4637
4677
|
|
4638
4678
|
// src/version.ts
|
4639
4679
|
var PACKAGE_VERSION = Object.keys({
|
4640
|
-
"0.20.0-dev-preview-
|
4680
|
+
"0.20.0-dev-preview-16": "xxxx"
|
4641
4681
|
})[0];
|
4642
4682
|
export {
|
4643
4683
|
CRDTImpl,
|