@fireproof/core 0.20.0-dev-preview-16 → 0.20.0-dev-preview-18
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs +10 -5
- package/index.cjs.map +1 -1
- package/index.d.cts +22 -16
- package/index.d.ts +22 -16
- package/index.js +10 -5
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +1 -1
- package/tests/blockstore/keyed-crypto-indexdb-file.test.ts +1 -1
- package/tests/blockstore/keyed-crypto.test.ts +1 -1
package/index.d.cts
CHANGED
@@ -133,7 +133,7 @@ interface KeyBagRuntime {
|
|
133
133
|
readonly logger: Logger;
|
134
134
|
readonly sthis: SuperThis;
|
135
135
|
readonly keyLength: number;
|
136
|
-
|
136
|
+
getBagProvider(): Promise<KeyBagProvider>;
|
137
137
|
id(): string;
|
138
138
|
}
|
139
139
|
type KeyBackProviderFactory = (url: URI, sthis: SuperThis) => Promise<KeyBagProvider>;
|
@@ -852,6 +852,11 @@ declare namespace index$5 {
|
|
852
852
|
export { type index$5_AnyAnyBlock as AnyAnyBlock, type index$5_AnyAnyLink as AnyAnyLink, type index$5_AnyBlock as AnyBlock, type index$5_AnyDecodedBlock as AnyDecodedBlock, type index$5_AnyLink as AnyLink, type index$5_AnyLinkFn as AnyLinkFn, index$5_BaseBlockstoreImpl as BaseBlockstoreImpl, type index$5_BaseStore as BaseStore, type index$5_BlobLike as BlobLike, type index$5_BlockFetcher as BlockFetcher, type index$5_BlockstoreOpts as BlockstoreOpts, type index$5_BlockstoreParams as BlockstoreParams, type index$5_BlockstoreRuntime as BlockstoreRuntime, type index$5_BytesWithIv as BytesWithIv, type index$5_CIDBlock as CIDBlock, index$5_Car2FPMsg as Car2FPMsg, type index$5_CarClockHead as CarClockHead, type index$5_CarClockLink as CarClockLink, type index$5_CarGroup as CarGroup, type index$5_CarHeader as CarHeader, type index$5_CarLog as CarLog, type index$5_CarMakeable as CarMakeable, index$5_CarTransactionImpl as CarTransactionImpl, type index$5_CarTransactionOpts as CarTransactionOpts, type index$5_CodecOpts as CodecOpts, type index$5_CommitOpts as CommitOpts, type index$5_CompactFetcher as CompactFetcher, type index$5_CompactFn as CompactFn, index$5_CompactionFetcher as CompactionFetcher, type index$5_Connection as Connection, index$5_ConnectionBase as ConnectionBase, type index$5_DataSaveOpts as DataSaveOpts, type index$5_DataStore as DataStore, type index$5_DbMeta as DbMeta, type index$5_DbMetaBinary as DbMetaBinary, type index$5_DbMetaEvent as DbMetaEvent, type index$5_DbMetaEventBlock as DbMetaEventBlock, index$5_DbMetaEventEqual as DbMetaEventEqual, index$5_DbMetaEventsEqual as DbMetaEventsEqual, type index$5_EncryptedBlock as EncryptedBlock, index$5_EncryptedBlockstore as EncryptedBlockstore, type index$5_FPEnvelope as FPEnvelope, type index$5_FPEnvelopeCar as FPEnvelopeCar, type index$5_FPEnvelopeFile as FPEnvelopeFile, type index$5_FPEnvelopeMeta as FPEnvelopeMeta, index$5_FPEnvelopeType as FPEnvelopeType, type index$5_FPEnvelopeWAL as FPEnvelopeWAL, type index$5_FPWALCarsOps as FPWALCarsOps, index$5_File2FPMsg as File2FPMsg, type index$5_Gateway as Gateway, type index$5_GatewayOpts as GatewayOpts, type index$5_GetResult as GetResult, index$5_InterceptorGateway as InterceptorGateway, type index$5_IvAndBytes as IvAndBytes, type index$5_IvKeyIdData as IvKeyIdData, type index$5_KeyMaterial as KeyMaterial, type index$5_KeyWithFingerExtract as KeyWithFingerExtract, type index$5_KeyWithFingerPrint as KeyWithFingerPrint, type index$5_KeyedCrypto as KeyedCrypto, type index$5_LoadHandler as LoadHandler, type index$5_Loadable as Loadable, index$5_Loader as Loader, type index$5_MetaStore as MetaStore, index$5_PassThroughGateway as PassThroughGateway, type index$5_RefBlockstore as RefBlockstore, type index$5_RefLoadable as RefLoadable, type index$5_SerdeGateway as SerdeGateway, type index$5_SerdeGatewayBuildUrlOp as SerdeGatewayBuildUrlOp, type index$5_SerdeGatewayBuildUrlReturn as SerdeGatewayBuildUrlReturn, type index$5_SerdeGatewayCloseOp as SerdeGatewayCloseOp, type index$5_SerdeGatewayCloseReturn as SerdeGatewayCloseReturn, type index$5_SerdeGatewayDeleteOp as SerdeGatewayDeleteOp, type index$5_SerdeGatewayDeleteReturn as SerdeGatewayDeleteReturn, type index$5_SerdeGatewayDestroyOp as SerdeGatewayDestroyOp, type index$5_SerdeGatewayDestroyReturn as SerdeGatewayDestroyReturn, type index$5_SerdeGatewayFactoryItem as SerdeGatewayFactoryItem, type index$5_SerdeGatewayGetOp as SerdeGatewayGetOp, type index$5_SerdeGatewayGetReturn as SerdeGatewayGetReturn, type index$5_SerdeGatewayInterceptor as SerdeGatewayInterceptor, type index$5_SerdeGatewayOpts as SerdeGatewayOpts, type index$5_SerdeGatewayPutOp as SerdeGatewayPutOp, type index$5_SerdeGatewayPutReturn as SerdeGatewayPutReturn, type index$5_SerdeGatewayReturn as SerdeGatewayReturn, type index$5_SerdeGatewayStartOp as SerdeGatewayStartOp, type index$5_SerdeGatewayStartReturn as SerdeGatewayStartReturn, type index$5_SerdeGatewaySubscribeOp as SerdeGatewaySubscribeOp, type index$5_SerdeGatewaySubscribeReturn as SerdeGatewaySubscribeReturn, type index$5_SerdeGetResult as SerdeGetResult, type index$5_SerdeOrGatewayFactoryItem as SerdeOrGatewayFactoryItem, type index$5_StoreEnDeFile as StoreEnDeFile, type index$5_StoreFactory as StoreFactory, type index$5_StoreFactoryItem as StoreFactoryItem, type index$5_StoreRuntime as StoreRuntime, type index$5_StoreRuntimeUrls as StoreRuntimeUrls, type index$5_StoreURIRuntime as StoreURIRuntime, type index$5_StoreURIs as StoreURIs, type index$5_StoreUrls as StoreUrls, type index$5_StoreUrlsOpts as StoreUrlsOpts, type index$5_TransactionMeta as TransactionMeta, type index$5_TransactionWrapper as TransactionWrapper, type index$5_UnsubscribeResult as UnsubscribeResult, type index$5_VoidResult as VoidResult, type index$5_WALState as WALState, type index$5_WALStore as WALStore, index$5_createDbMetaEvent as createDbMetaEvent, index$5_defaultGatewayFactoryItem as defaultGatewayFactoryItem, index$5_ensureStoreEnDeFile as ensureStoreEnDeFile, index$5_getDefaultURI as getDefaultURI, index$5_getGatewayFactoryItem as getGatewayFactoryItem, index$5_getStartedGateway as getStartedGateway, index$5_parseCarFile as parseCarFile, index$5_registerStoreProtocol as registerStoreProtocol, index$5_toCIDBlock as toCIDBlock, index$5_toStoreRuntime as toStoreRuntime };
|
853
853
|
}
|
854
854
|
|
855
|
+
interface WriteQueueParams {
|
856
|
+
readonly chunkSize: number;
|
857
|
+
}
|
858
|
+
declare function defaultWriteQueueOpts(opts?: Partial<WriteQueueParams>): WriteQueueParams;
|
859
|
+
|
855
860
|
declare class IndexTree<K extends IndexKeyType, R extends DocFragment> {
|
856
861
|
cid?: AnyLink;
|
857
862
|
root?: ProllyNode<K, R>;
|
@@ -1253,7 +1258,17 @@ interface WriteQueue<T extends DocUpdate<S>, S extends DocTypes = DocTypes> {
|
|
1253
1258
|
bulk(tasks: T[]): Promise<MetaType>;
|
1254
1259
|
close(): Promise<void>;
|
1255
1260
|
}
|
1261
|
+
interface LedgerOpts {
|
1262
|
+
readonly name?: string;
|
1263
|
+
readonly meta?: DbMeta;
|
1264
|
+
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
1265
|
+
readonly writeQueue: WriteQueueParams;
|
1266
|
+
readonly storeUrls: StoreURIRuntime;
|
1267
|
+
readonly storeEnDe: StoreEnDeFile;
|
1268
|
+
readonly keyBag: KeyBagRuntime;
|
1269
|
+
}
|
1256
1270
|
interface Ledger extends HasCRDT {
|
1271
|
+
readonly opts: LedgerOpts;
|
1257
1272
|
readonly writeQueue: WriteQueue<DocUpdate<DocTypes>>;
|
1258
1273
|
readonly logger: Logger;
|
1259
1274
|
readonly sthis: SuperThis;
|
@@ -1267,21 +1282,7 @@ interface Ledger extends HasCRDT {
|
|
1267
1282
|
subscribe<T extends DocTypes>(listener: ListenerFn<T>, updates?: boolean): () => void;
|
1268
1283
|
}
|
1269
1284
|
|
1270
|
-
interface WriteQueueParams {
|
1271
|
-
readonly chunkSize: number;
|
1272
|
-
}
|
1273
|
-
declare function defaultWriteQueueOpts(opts?: Partial<WriteQueueParams>): WriteQueueParams;
|
1274
|
-
|
1275
1285
|
declare function keyConfigOpts(sthis: SuperThis, name?: string, opts?: ConfigOpts): string;
|
1276
|
-
interface LedgerOpts {
|
1277
|
-
readonly name?: string;
|
1278
|
-
readonly meta?: DbMeta;
|
1279
|
-
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
1280
|
-
readonly writeQueue: WriteQueueParams;
|
1281
|
-
readonly storeUrls: StoreURIRuntime;
|
1282
|
-
readonly storeEnDe: StoreEnDeFile;
|
1283
|
-
readonly keyBag: KeyBagRuntime;
|
1284
|
-
}
|
1285
1286
|
declare function isLedger(db: unknown): db is Ledger;
|
1286
1287
|
declare function LedgerFactory(name: string | undefined, opts?: ConfigOpts): Ledger;
|
1287
1288
|
declare class LedgerShell implements Ledger {
|
@@ -1289,6 +1290,7 @@ declare class LedgerShell implements Ledger {
|
|
1289
1290
|
readonly writeQueue: WriteQueue<DocUpdate<DocTypes>>;
|
1290
1291
|
readonly name: string;
|
1291
1292
|
constructor(ref: LedgerImpl);
|
1293
|
+
get opts(): LedgerOpts;
|
1292
1294
|
get context(): Context;
|
1293
1295
|
get id(): string;
|
1294
1296
|
get logger(): Logger;
|
@@ -1474,6 +1476,7 @@ interface SerializedMeta {
|
|
1474
1476
|
readonly parents: string[];
|
1475
1477
|
readonly cid: string;
|
1476
1478
|
}
|
1479
|
+
declare function dbMetaEvent2Serialized(sthis: SuperThis, dbEvents: Omit<DbMetaEvent, "eventCid">[]): Promise<SerializedMeta[]>;
|
1477
1480
|
type CAREncodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise<Result<Uint8Array>>;
|
1478
1481
|
type FILEEncodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise<Result<Uint8Array>>;
|
1479
1482
|
type METAEncodeEnvelope = (sthis: SuperThis, payload: SerializedMeta[]) => Promise<Result<Uint8Array>>;
|
@@ -1485,6 +1488,7 @@ interface Encoder {
|
|
1485
1488
|
readonly wal: WALEncodeEnvelope;
|
1486
1489
|
}
|
1487
1490
|
declare function fpSerialize<T>(sthis: SuperThis, env: FPEnvelope<T>, pencoder?: Partial<Encoder>): Promise<Result<Uint8Array>>;
|
1491
|
+
declare function decode2DbMetaEvents(sthis: SuperThis, rserializedMeta: Result<SerializedMeta[]>): Promise<Result<DbMetaEvent[]>>;
|
1488
1492
|
type linkOrCid = {
|
1489
1493
|
"/": string;
|
1490
1494
|
} | string;
|
@@ -1585,10 +1589,12 @@ type index$1_SerializedMeta = SerializedMeta;
|
|
1585
1589
|
type index$1_SerializedWAL = SerializedWAL;
|
1586
1590
|
type index$1_WALDecodeEnvelope = WALDecodeEnvelope;
|
1587
1591
|
type index$1_WALEncodeEnvelope = WALEncodeEnvelope;
|
1592
|
+
declare const index$1_dbMetaEvent2Serialized: typeof dbMetaEvent2Serialized;
|
1593
|
+
declare const index$1_decode2DbMetaEvents: typeof decode2DbMetaEvents;
|
1588
1594
|
declare const index$1_fpDeserialize: typeof fpDeserialize;
|
1589
1595
|
declare const index$1_fpSerialize: typeof fpSerialize;
|
1590
1596
|
declare namespace index$1 {
|
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 };
|
1597
|
+
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$1_dbMetaEvent2Serialized as dbMetaEvent2Serialized, index$1_decode2DbMetaEvents as decode2DbMetaEvents, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize, gateway as memory };
|
1592
1598
|
}
|
1593
1599
|
|
1594
1600
|
declare const FILESTORE_VERSION = "v0.19-file";
|
package/index.d.ts
CHANGED
@@ -133,7 +133,7 @@ interface KeyBagRuntime {
|
|
133
133
|
readonly logger: Logger;
|
134
134
|
readonly sthis: SuperThis;
|
135
135
|
readonly keyLength: number;
|
136
|
-
|
136
|
+
getBagProvider(): Promise<KeyBagProvider>;
|
137
137
|
id(): string;
|
138
138
|
}
|
139
139
|
type KeyBackProviderFactory = (url: URI, sthis: SuperThis) => Promise<KeyBagProvider>;
|
@@ -852,6 +852,11 @@ declare namespace index$5 {
|
|
852
852
|
export { type index$5_AnyAnyBlock as AnyAnyBlock, type index$5_AnyAnyLink as AnyAnyLink, type index$5_AnyBlock as AnyBlock, type index$5_AnyDecodedBlock as AnyDecodedBlock, type index$5_AnyLink as AnyLink, type index$5_AnyLinkFn as AnyLinkFn, index$5_BaseBlockstoreImpl as BaseBlockstoreImpl, type index$5_BaseStore as BaseStore, type index$5_BlobLike as BlobLike, type index$5_BlockFetcher as BlockFetcher, type index$5_BlockstoreOpts as BlockstoreOpts, type index$5_BlockstoreParams as BlockstoreParams, type index$5_BlockstoreRuntime as BlockstoreRuntime, type index$5_BytesWithIv as BytesWithIv, type index$5_CIDBlock as CIDBlock, index$5_Car2FPMsg as Car2FPMsg, type index$5_CarClockHead as CarClockHead, type index$5_CarClockLink as CarClockLink, type index$5_CarGroup as CarGroup, type index$5_CarHeader as CarHeader, type index$5_CarLog as CarLog, type index$5_CarMakeable as CarMakeable, index$5_CarTransactionImpl as CarTransactionImpl, type index$5_CarTransactionOpts as CarTransactionOpts, type index$5_CodecOpts as CodecOpts, type index$5_CommitOpts as CommitOpts, type index$5_CompactFetcher as CompactFetcher, type index$5_CompactFn as CompactFn, index$5_CompactionFetcher as CompactionFetcher, type index$5_Connection as Connection, index$5_ConnectionBase as ConnectionBase, type index$5_DataSaveOpts as DataSaveOpts, type index$5_DataStore as DataStore, type index$5_DbMeta as DbMeta, type index$5_DbMetaBinary as DbMetaBinary, type index$5_DbMetaEvent as DbMetaEvent, type index$5_DbMetaEventBlock as DbMetaEventBlock, index$5_DbMetaEventEqual as DbMetaEventEqual, index$5_DbMetaEventsEqual as DbMetaEventsEqual, type index$5_EncryptedBlock as EncryptedBlock, index$5_EncryptedBlockstore as EncryptedBlockstore, type index$5_FPEnvelope as FPEnvelope, type index$5_FPEnvelopeCar as FPEnvelopeCar, type index$5_FPEnvelopeFile as FPEnvelopeFile, type index$5_FPEnvelopeMeta as FPEnvelopeMeta, index$5_FPEnvelopeType as FPEnvelopeType, type index$5_FPEnvelopeWAL as FPEnvelopeWAL, type index$5_FPWALCarsOps as FPWALCarsOps, index$5_File2FPMsg as File2FPMsg, type index$5_Gateway as Gateway, type index$5_GatewayOpts as GatewayOpts, type index$5_GetResult as GetResult, index$5_InterceptorGateway as InterceptorGateway, type index$5_IvAndBytes as IvAndBytes, type index$5_IvKeyIdData as IvKeyIdData, type index$5_KeyMaterial as KeyMaterial, type index$5_KeyWithFingerExtract as KeyWithFingerExtract, type index$5_KeyWithFingerPrint as KeyWithFingerPrint, type index$5_KeyedCrypto as KeyedCrypto, type index$5_LoadHandler as LoadHandler, type index$5_Loadable as Loadable, index$5_Loader as Loader, type index$5_MetaStore as MetaStore, index$5_PassThroughGateway as PassThroughGateway, type index$5_RefBlockstore as RefBlockstore, type index$5_RefLoadable as RefLoadable, type index$5_SerdeGateway as SerdeGateway, type index$5_SerdeGatewayBuildUrlOp as SerdeGatewayBuildUrlOp, type index$5_SerdeGatewayBuildUrlReturn as SerdeGatewayBuildUrlReturn, type index$5_SerdeGatewayCloseOp as SerdeGatewayCloseOp, type index$5_SerdeGatewayCloseReturn as SerdeGatewayCloseReturn, type index$5_SerdeGatewayDeleteOp as SerdeGatewayDeleteOp, type index$5_SerdeGatewayDeleteReturn as SerdeGatewayDeleteReturn, type index$5_SerdeGatewayDestroyOp as SerdeGatewayDestroyOp, type index$5_SerdeGatewayDestroyReturn as SerdeGatewayDestroyReturn, type index$5_SerdeGatewayFactoryItem as SerdeGatewayFactoryItem, type index$5_SerdeGatewayGetOp as SerdeGatewayGetOp, type index$5_SerdeGatewayGetReturn as SerdeGatewayGetReturn, type index$5_SerdeGatewayInterceptor as SerdeGatewayInterceptor, type index$5_SerdeGatewayOpts as SerdeGatewayOpts, type index$5_SerdeGatewayPutOp as SerdeGatewayPutOp, type index$5_SerdeGatewayPutReturn as SerdeGatewayPutReturn, type index$5_SerdeGatewayReturn as SerdeGatewayReturn, type index$5_SerdeGatewayStartOp as SerdeGatewayStartOp, type index$5_SerdeGatewayStartReturn as SerdeGatewayStartReturn, type index$5_SerdeGatewaySubscribeOp as SerdeGatewaySubscribeOp, type index$5_SerdeGatewaySubscribeReturn as SerdeGatewaySubscribeReturn, type index$5_SerdeGetResult as SerdeGetResult, type index$5_SerdeOrGatewayFactoryItem as SerdeOrGatewayFactoryItem, type index$5_StoreEnDeFile as StoreEnDeFile, type index$5_StoreFactory as StoreFactory, type index$5_StoreFactoryItem as StoreFactoryItem, type index$5_StoreRuntime as StoreRuntime, type index$5_StoreRuntimeUrls as StoreRuntimeUrls, type index$5_StoreURIRuntime as StoreURIRuntime, type index$5_StoreURIs as StoreURIs, type index$5_StoreUrls as StoreUrls, type index$5_StoreUrlsOpts as StoreUrlsOpts, type index$5_TransactionMeta as TransactionMeta, type index$5_TransactionWrapper as TransactionWrapper, type index$5_UnsubscribeResult as UnsubscribeResult, type index$5_VoidResult as VoidResult, type index$5_WALState as WALState, type index$5_WALStore as WALStore, index$5_createDbMetaEvent as createDbMetaEvent, index$5_defaultGatewayFactoryItem as defaultGatewayFactoryItem, index$5_ensureStoreEnDeFile as ensureStoreEnDeFile, index$5_getDefaultURI as getDefaultURI, index$5_getGatewayFactoryItem as getGatewayFactoryItem, index$5_getStartedGateway as getStartedGateway, index$5_parseCarFile as parseCarFile, index$5_registerStoreProtocol as registerStoreProtocol, index$5_toCIDBlock as toCIDBlock, index$5_toStoreRuntime as toStoreRuntime };
|
853
853
|
}
|
854
854
|
|
855
|
+
interface WriteQueueParams {
|
856
|
+
readonly chunkSize: number;
|
857
|
+
}
|
858
|
+
declare function defaultWriteQueueOpts(opts?: Partial<WriteQueueParams>): WriteQueueParams;
|
859
|
+
|
855
860
|
declare class IndexTree<K extends IndexKeyType, R extends DocFragment> {
|
856
861
|
cid?: AnyLink;
|
857
862
|
root?: ProllyNode<K, R>;
|
@@ -1253,7 +1258,17 @@ interface WriteQueue<T extends DocUpdate<S>, S extends DocTypes = DocTypes> {
|
|
1253
1258
|
bulk(tasks: T[]): Promise<MetaType>;
|
1254
1259
|
close(): Promise<void>;
|
1255
1260
|
}
|
1261
|
+
interface LedgerOpts {
|
1262
|
+
readonly name?: string;
|
1263
|
+
readonly meta?: DbMeta;
|
1264
|
+
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
1265
|
+
readonly writeQueue: WriteQueueParams;
|
1266
|
+
readonly storeUrls: StoreURIRuntime;
|
1267
|
+
readonly storeEnDe: StoreEnDeFile;
|
1268
|
+
readonly keyBag: KeyBagRuntime;
|
1269
|
+
}
|
1256
1270
|
interface Ledger extends HasCRDT {
|
1271
|
+
readonly opts: LedgerOpts;
|
1257
1272
|
readonly writeQueue: WriteQueue<DocUpdate<DocTypes>>;
|
1258
1273
|
readonly logger: Logger;
|
1259
1274
|
readonly sthis: SuperThis;
|
@@ -1267,21 +1282,7 @@ interface Ledger extends HasCRDT {
|
|
1267
1282
|
subscribe<T extends DocTypes>(listener: ListenerFn<T>, updates?: boolean): () => void;
|
1268
1283
|
}
|
1269
1284
|
|
1270
|
-
interface WriteQueueParams {
|
1271
|
-
readonly chunkSize: number;
|
1272
|
-
}
|
1273
|
-
declare function defaultWriteQueueOpts(opts?: Partial<WriteQueueParams>): WriteQueueParams;
|
1274
|
-
|
1275
1285
|
declare function keyConfigOpts(sthis: SuperThis, name?: string, opts?: ConfigOpts): string;
|
1276
|
-
interface LedgerOpts {
|
1277
|
-
readonly name?: string;
|
1278
|
-
readonly meta?: DbMeta;
|
1279
|
-
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
1280
|
-
readonly writeQueue: WriteQueueParams;
|
1281
|
-
readonly storeUrls: StoreURIRuntime;
|
1282
|
-
readonly storeEnDe: StoreEnDeFile;
|
1283
|
-
readonly keyBag: KeyBagRuntime;
|
1284
|
-
}
|
1285
1286
|
declare function isLedger(db: unknown): db is Ledger;
|
1286
1287
|
declare function LedgerFactory(name: string | undefined, opts?: ConfigOpts): Ledger;
|
1287
1288
|
declare class LedgerShell implements Ledger {
|
@@ -1289,6 +1290,7 @@ declare class LedgerShell implements Ledger {
|
|
1289
1290
|
readonly writeQueue: WriteQueue<DocUpdate<DocTypes>>;
|
1290
1291
|
readonly name: string;
|
1291
1292
|
constructor(ref: LedgerImpl);
|
1293
|
+
get opts(): LedgerOpts;
|
1292
1294
|
get context(): Context;
|
1293
1295
|
get id(): string;
|
1294
1296
|
get logger(): Logger;
|
@@ -1474,6 +1476,7 @@ interface SerializedMeta {
|
|
1474
1476
|
readonly parents: string[];
|
1475
1477
|
readonly cid: string;
|
1476
1478
|
}
|
1479
|
+
declare function dbMetaEvent2Serialized(sthis: SuperThis, dbEvents: Omit<DbMetaEvent, "eventCid">[]): Promise<SerializedMeta[]>;
|
1477
1480
|
type CAREncodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise<Result<Uint8Array>>;
|
1478
1481
|
type FILEEncodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise<Result<Uint8Array>>;
|
1479
1482
|
type METAEncodeEnvelope = (sthis: SuperThis, payload: SerializedMeta[]) => Promise<Result<Uint8Array>>;
|
@@ -1485,6 +1488,7 @@ interface Encoder {
|
|
1485
1488
|
readonly wal: WALEncodeEnvelope;
|
1486
1489
|
}
|
1487
1490
|
declare function fpSerialize<T>(sthis: SuperThis, env: FPEnvelope<T>, pencoder?: Partial<Encoder>): Promise<Result<Uint8Array>>;
|
1491
|
+
declare function decode2DbMetaEvents(sthis: SuperThis, rserializedMeta: Result<SerializedMeta[]>): Promise<Result<DbMetaEvent[]>>;
|
1488
1492
|
type linkOrCid = {
|
1489
1493
|
"/": string;
|
1490
1494
|
} | string;
|
@@ -1585,10 +1589,12 @@ type index$1_SerializedMeta = SerializedMeta;
|
|
1585
1589
|
type index$1_SerializedWAL = SerializedWAL;
|
1586
1590
|
type index$1_WALDecodeEnvelope = WALDecodeEnvelope;
|
1587
1591
|
type index$1_WALEncodeEnvelope = WALEncodeEnvelope;
|
1592
|
+
declare const index$1_dbMetaEvent2Serialized: typeof dbMetaEvent2Serialized;
|
1593
|
+
declare const index$1_decode2DbMetaEvents: typeof decode2DbMetaEvents;
|
1588
1594
|
declare const index$1_fpDeserialize: typeof fpDeserialize;
|
1589
1595
|
declare const index$1_fpSerialize: typeof fpSerialize;
|
1590
1596
|
declare namespace index$1 {
|
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 };
|
1597
|
+
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$1_dbMetaEvent2Serialized as dbMetaEvent2Serialized, index$1_decode2DbMetaEvents as decode2DbMetaEvents, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize, gateway as memory };
|
1592
1598
|
}
|
1593
1599
|
|
1594
1600
|
declare const FILESTORE_VERSION = "v0.19-file";
|
package/index.js
CHANGED
@@ -685,7 +685,7 @@ var KeyBag = class {
|
|
685
685
|
name,
|
686
686
|
key
|
687
687
|
};
|
688
|
-
const bag = await this.rt.
|
688
|
+
const bag = await this.rt.getBagProvider();
|
689
689
|
this.logger.Debug().Str("name", name).Msg("setNamedKey");
|
690
690
|
await bag.set(name, item);
|
691
691
|
return await this.toKeyWithFingerPrint(item.key);
|
@@ -710,7 +710,7 @@ var KeyBag = class {
|
|
710
710
|
async getNamedKey(name, failIfNotFound = false) {
|
711
711
|
const id = this.rt.sthis.nextId(4).str;
|
712
712
|
return this._seq.add(async () => {
|
713
|
-
const bag = await this.rt.
|
713
|
+
const bag = await this.rt.getBagProvider();
|
714
714
|
const named = await bag.get(name);
|
715
715
|
if (named) {
|
716
716
|
const fpr = await this.toKeyWithFingerPrint(named.key);
|
@@ -813,7 +813,7 @@ function defaultKeyBagOpts(sthis, kbo) {
|
|
813
813
|
sthis,
|
814
814
|
logger,
|
815
815
|
keyLength: kbo.keyLength || 16,
|
816
|
-
|
816
|
+
getBagProvider: () => kitem.factory(url, sthis),
|
817
817
|
id: () => {
|
818
818
|
return url.toString();
|
819
819
|
}
|
@@ -4426,6 +4426,9 @@ var LedgerShell = class {
|
|
4426
4426
|
this.name = ref.name;
|
4427
4427
|
ref.addShell(this);
|
4428
4428
|
}
|
4429
|
+
get opts() {
|
4430
|
+
return this.ref.opts;
|
4431
|
+
}
|
4429
4432
|
get context() {
|
4430
4433
|
return this.ref.context;
|
4431
4434
|
}
|
@@ -4483,7 +4486,7 @@ var LedgerImpl = class {
|
|
4483
4486
|
this.crdt.clock.onTock(() => this._no_update_notify());
|
4484
4487
|
}
|
4485
4488
|
get name() {
|
4486
|
-
return this.opts.storeUrls.data.data.getParam("name" /* NAME */)
|
4489
|
+
return this.opts.storeUrls.data.data.getParam("name" /* NAME */) ?? "default";
|
4487
4490
|
}
|
4488
4491
|
addShell(shell) {
|
4489
4492
|
this.shells.add(shell);
|
@@ -4662,6 +4665,8 @@ import { runtimeFn as runtimeFn4 } from "@adviser/cement";
|
|
4662
4665
|
var gateways_exports = {};
|
4663
4666
|
__export(gateways_exports, {
|
4664
4667
|
DefSerdeGateway: () => DefSerdeGateway,
|
4668
|
+
dbMetaEvent2Serialized: () => dbMetaEvent2Serialized,
|
4669
|
+
decode2DbMetaEvents: () => decode2DbMetaEvents,
|
4665
4670
|
file: () => file_exports,
|
4666
4671
|
fpDeserialize: () => fpDeserialize,
|
4667
4672
|
fpSerialize: () => fpSerialize,
|
@@ -4677,7 +4682,7 @@ __export(file_exports, {
|
|
4677
4682
|
|
4678
4683
|
// src/version.ts
|
4679
4684
|
var PACKAGE_VERSION = Object.keys({
|
4680
|
-
"0.20.0-dev-preview-
|
4685
|
+
"0.20.0-dev-preview-18": "xxxx"
|
4681
4686
|
})[0];
|
4682
4687
|
export {
|
4683
4688
|
CRDTImpl,
|