@fireproof/core 0.20.0-dev-preview-53 → 0.20.0-dev-preview-55

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/index.d.cts CHANGED
@@ -1,11 +1,10 @@
1
- import { Logger, Future, URI, CryptoRuntime, ResolveOnce, Result, ResolveSeq, CTCryptoKey, CoerceURI, LRUSet, Env, EnvFactoryOpts, runtimeFn } from '@adviser/cement';
1
+ import { Logger, Future, URI, CryptoRuntime, ResolveOnce, Result, ResolveSeq, CTCryptoKey, CoerceURI, Promisable, LRUSet, Env, EnvFactoryOpts, runtimeFn } from '@adviser/cement';
2
2
  import { EventLink } from '@fireproof/vendor/@web3-storage/pail/clock/api';
3
3
  import { Operation } from '@fireproof/vendor/@web3-storage/pail/crdt/api';
4
4
  import { Version, Block as Block$1, UnknownLink, CID, ByteView, ArrayBufferView, Link, MultihashHasher, BlockView } 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
7
  import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
8
- import { SuperThis as SuperThis$1 } from '@fireproof/core';
9
8
  import { Block as Block$2 } from 'multiformats/block';
10
9
 
11
10
  type BlockFetcher = BlockFetcher$1;
@@ -521,11 +520,8 @@ interface CryptoAction {
521
520
  _decrypt(data: IvAndKeyAndBytes): Promise<Uint8Array>;
522
521
  _encrypt(data: BytesAndKeyWithIv): Promise<Uint8Array>;
523
522
  }
524
- interface BlobLike {
525
- stream: () => ReadableStream;
526
- }
527
523
  interface StoreFactory {
528
- encodeFile?: (blob: BlobLike) => Promise<{
524
+ encodeFile?: (blob: Blob) => Promise<{
529
525
  cid: AnyLink;
530
526
  blocks: AnyBlock[];
531
527
  }>;
@@ -538,11 +534,11 @@ interface StoreUrls {
538
534
  readonly wal: CoerceURI;
539
535
  }
540
536
  interface StoreEnDeFile {
541
- readonly encodeFile: (blob: BlobLike) => Promise<{
537
+ readonly encodeFile: (blob: Blob) => Promise<{
542
538
  cid: AnyLink;
543
539
  blocks: AnyBlock[];
544
540
  }>;
545
- readonly decodeFile: (blocks: unknown, cid: AnyLink, meta: DocFileMeta) => Promise<File>;
541
+ readonly decodeFile: (blocks: unknown, cid: AnyLink, meta: DocFileMeta) => Promise<Result<File>>;
546
542
  }
547
543
  interface StoreUrlsOpts {
548
544
  readonly base?: CoerceURI;
@@ -569,11 +565,11 @@ interface StoreFactoryItem {
569
565
  }
570
566
  interface StoreRuntime {
571
567
  makeStores(sfi: StoreFactoryItem): Promise<DataAndMetaAndWalStore>;
572
- encodeFile(blob: BlobLike): Promise<{
568
+ encodeFile(blob: Blob): Promise<{
573
569
  cid: AnyLink;
574
570
  blocks: AnyBlock[];
575
571
  }>;
576
- decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<File>;
572
+ decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<Result<File>>;
577
573
  }
578
574
  interface CommitOpts {
579
575
  readonly noLoader?: boolean;
@@ -810,32 +806,6 @@ type DbMetaEventBlock = EventBlock<DbMetaBinary>;
810
806
  type CarClockLink = Link<DbMetaEventBlock, number, number, Version>;
811
807
  type CarClockHead = CarClockLink[];
812
808
 
813
- interface SerdeGatewayInstances {
814
- readonly gateway: SerdeGateway;
815
- }
816
- interface GatewayReady extends SerdeGatewayInstances {
817
- readonly url: URI;
818
- }
819
- declare function getStartedGateway(ctx: SerdeGatewayCtx, url: URI): Promise<Result<GatewayReady>>;
820
- declare function ensureStoreEnDeFile(ende?: Partial<StoreEnDeFile>): StoreEnDeFile;
821
- declare function toStoreRuntime(sthis: SuperThis, endeOpts?: Partial<StoreEnDeFile>): StoreRuntime;
822
-
823
- interface GatewayOpts {
824
- readonly gateway: Gateway;
825
- }
826
- type GetResult = Result<Uint8Array, NotFoundError | Error>;
827
- interface Gateway {
828
- buildUrl(baseUrl: URI, key: string, sthis: SuperThis): Promise<Result<URI>>;
829
- start(baseUrl: URI, sthis: SuperThis): Promise<Result<URI>>;
830
- close(baseUrl: URI, sthis: SuperThis): Promise<VoidResult>;
831
- destroy(baseUrl: URI, sthis: SuperThis): Promise<VoidResult>;
832
- put(url: URI, body: Uint8Array, sthis: SuperThis): Promise<VoidResult>;
833
- get(url: URI, sthis: SuperThis): Promise<GetResult>;
834
- delete(url: URI, sthis: SuperThis): Promise<VoidResult>;
835
- subscribe?(url: URI, callback: (meta: Uint8Array) => void, sthis: SuperThis): Promise<UnsubscribeResult>;
836
- getPlain(url: URI, key: string, sthis: SuperThis): Promise<Result<Uint8Array>>;
837
- }
838
-
839
809
  declare class PassThroughGateway implements SerdeGatewayInterceptor {
840
810
  buildUrl(ctx: SerdeGatewayCtx, url: URI, key: string): Promise<Result<SerdeGatewayBuildUrlReturn>>;
841
811
  start(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayStartReturn>>;
@@ -861,6 +831,28 @@ declare class InterceptorGateway implements SerdeGateway {
861
831
  getPlain(ctx: SerdeGatewayCtx, url: URI, key: string): Promise<Result<Uint8Array>>;
862
832
  }
863
833
 
834
+ declare function getInterceptableGateway(ctx: SerdeGatewayCtx, url: URI, opt: {
835
+ gatewayInterceptor?: SerdeGatewayInterceptor;
836
+ }): Promise<Result<InterceptorGateway>>;
837
+ declare function ensureStoreEnDeFile(ende?: Partial<StoreEnDeFile>): StoreEnDeFile;
838
+ declare function toStoreRuntime(sthis: SuperThis, endeOpts?: Partial<StoreEnDeFile>): StoreRuntime;
839
+
840
+ interface GatewayOpts {
841
+ readonly gateway: Gateway;
842
+ }
843
+ type GetResult = Result<Uint8Array, NotFoundError | Error>;
844
+ interface Gateway {
845
+ buildUrl(baseUrl: URI, key: string, sthis: SuperThis): Promise<Result<URI>>;
846
+ start(baseUrl: URI, sthis: SuperThis): Promise<Result<URI>>;
847
+ close(baseUrl: URI, sthis: SuperThis): Promise<VoidResult>;
848
+ destroy(baseUrl: URI, sthis: SuperThis): Promise<VoidResult>;
849
+ put(url: URI, body: Uint8Array, sthis: SuperThis): Promise<VoidResult>;
850
+ get(url: URI, sthis: SuperThis): Promise<GetResult>;
851
+ delete(url: URI, sthis: SuperThis): Promise<VoidResult>;
852
+ subscribe?(url: URI, callback: (meta: Uint8Array) => void, sthis: SuperThis): Promise<UnsubscribeResult>;
853
+ getPlain(url: URI, key: string, sthis: SuperThis): Promise<Result<Uint8Array>>;
854
+ }
855
+
864
856
  declare function createDbMetaEvent(sthis: SuperThis, dbMeta: DbMeta, parents: CarClockHead): Promise<DbMetaEvent>;
865
857
 
866
858
  interface SerdeGatewayFactoryItem {
@@ -895,6 +887,21 @@ declare class AttachedRemotesImpl implements AttachedStores {
895
887
  attach(attached: Attachable): Promise<Attached>;
896
888
  }
897
889
 
890
+ type URIMapper = (uri: URI) => Promisable<URI>;
891
+ declare class URIInterceptor extends PassThroughGateway {
892
+ #private;
893
+ static withMapper(mapper: URIMapper): URIInterceptor;
894
+ addMapper(mapper: URIMapper): URIInterceptor;
895
+ buildUrl(ctx: SerdeGatewayCtx, url: URI, key: string): Promise<Result<SerdeGatewayBuildUrlReturn>>;
896
+ start(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayStartReturn>>;
897
+ close(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayCloseReturn>>;
898
+ delete(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayDeleteReturn>>;
899
+ destroy(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayDestroyReturn>>;
900
+ put<T>(ctx: SerdeGatewayCtx, url: URI, body: FPEnvelope<T>): Promise<Result<SerdeGatewayPutReturn<T>>>;
901
+ get<S>(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayGetReturn<S>>>;
902
+ subscribe(ctx: SerdeGatewayCtx, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void>): Promise<Result<SerdeGatewaySubscribeReturn>>;
903
+ }
904
+
898
905
  declare class Loader implements Loadable {
899
906
  readonly ebOpts: BlockstoreRuntime;
900
907
  readonly logger: Logger;
@@ -951,7 +958,6 @@ type index$5_BaseAttachedStores = BaseAttachedStores;
951
958
  type index$5_BaseBlockstoreImpl = BaseBlockstoreImpl;
952
959
  declare const index$5_BaseBlockstoreImpl: typeof BaseBlockstoreImpl;
953
960
  type index$5_BaseStore = BaseStore;
954
- type index$5_BlobLike = BlobLike;
955
961
  type index$5_BlockFetcher = BlockFetcher;
956
962
  type index$5_BlockstoreOpts = BlockstoreOpts;
957
963
  type index$5_BlockstoreParams = BlockstoreParams;
@@ -1072,6 +1078,9 @@ declare const index$5_TaskManager: typeof TaskManager;
1072
1078
  type index$5_TaskManagerParams = TaskManagerParams;
1073
1079
  type index$5_TransactionMeta = TransactionMeta;
1074
1080
  type index$5_TransactionWrapper<M extends TransactionMeta> = TransactionWrapper<M>;
1081
+ type index$5_URIInterceptor = URIInterceptor;
1082
+ declare const index$5_URIInterceptor: typeof URIInterceptor;
1083
+ type index$5_URIMapper = URIMapper;
1075
1084
  type index$5_UnsubscribeResult = UnsubscribeResult;
1076
1085
  type index$5_UrlAndInterceptor = UrlAndInterceptor;
1077
1086
  type index$5_VoidResult = VoidResult;
@@ -1088,13 +1097,13 @@ declare const index$5_defaultGatewayFactoryItem: typeof defaultGatewayFactoryIte
1088
1097
  declare const index$5_ensureStoreEnDeFile: typeof ensureStoreEnDeFile;
1089
1098
  declare const index$5_getDefaultURI: typeof getDefaultURI;
1090
1099
  declare const index$5_getGatewayFactoryItem: typeof getGatewayFactoryItem;
1091
- declare const index$5_getStartedGateway: typeof getStartedGateway;
1100
+ declare const index$5_getInterceptableGateway: typeof getInterceptableGateway;
1092
1101
  declare const index$5_parseCarFile: typeof parseCarFile;
1093
1102
  declare const index$5_registerStoreProtocol: typeof registerStoreProtocol;
1094
1103
  declare const index$5_toCIDBlock: typeof toCIDBlock;
1095
1104
  declare const index$5_toStoreRuntime: typeof toStoreRuntime;
1096
1105
  declare namespace index$5 {
1097
- export { type index$5_ActiveStore as ActiveStore, 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_AttachedRemotesImpl as AttachedRemotesImpl, type index$5_AttachedStores as AttachedStores, index$5_BaseActiveStore as BaseActiveStore, type index$5_BaseAttachedStores as BaseAttachedStores, 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_BytesAndKeyWithIv as BytesAndKeyWithIv, type index$5_CIDActiveStore as CIDActiveStore, type index$5_CIDBlock as CIDBlock, index$5_Car2FPMsg as Car2FPMsg, index$5_CarActiveStore as CarActiveStore, type index$5_CarAttachedStores as CarAttachedStores, type index$5_CarCacheItem as CarCacheItem, type index$5_CarClockHead as CarClockHead, type index$5_CarClockLink as CarClockLink, type index$5_CarGroup as CarGroup, type index$5_CarHeader as CarHeader, index$5_CarLog as CarLog, type index$5_CarMakeable as CarMakeable, type index$5_CarStore as CarStore, 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, type index$5_CryptoAction as CryptoAction, type index$5_DataAndMetaAndWalStore as DataAndMetaAndWalStore, type index$5_DataAndMetaStore as DataAndMetaStore, type index$5_DataSaveOpts as DataSaveOpts, 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, type index$5_FPEnvelopeType as FPEnvelopeType, index$5_FPEnvelopeTypes as FPEnvelopeTypes, type index$5_FPEnvelopeWAL as FPEnvelopeWAL, type index$5_FPWALCarsOps as FPWALCarsOps, index$5_File2FPMsg as File2FPMsg, index$5_FileActiveStore as FileActiveStore, type index$5_FileAttachedStores as FileAttachedStores, type index$5_FileStore as FileStore, type index$5_FroozenCarLog as FroozenCarLog, 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_IvAndKeyAndBytes as IvAndKeyAndBytes, type index$5_IvKeyIdData as IvKeyIdData, type index$5_KeyMaterial as KeyMaterial, type index$5_KeyUpsertResult as KeyUpsertResult, type index$5_KeyWithFingerPrint as KeyWithFingerPrint, type index$5_KeysByFingerprint as KeysByFingerprint, type index$5_LoadHandler as LoadHandler, type index$5_Loadable as Loadable, index$5_Loader as Loader, type index$5_LocalActiveStore as LocalActiveStore, type index$5_LocalDataAndMetaAndWalStore as LocalDataAndMetaAndWalStore, index$5_MetaActiveStore as MetaActiveStore, type index$5_MetaAttachedStores as MetaAttachedStores, 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_SerdeGatewayCtx as SerdeGatewayCtx, 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, index$5_TaskManager as TaskManager, type index$5_TaskManagerParams as TaskManagerParams, type index$5_TransactionMeta as TransactionMeta, type index$5_TransactionWrapper as TransactionWrapper, type index$5_UnsubscribeResult as UnsubscribeResult, type index$5_UrlAndInterceptor as UrlAndInterceptor, type index$5_VoidResult as VoidResult, index$5_WALActiveStore as WALActiveStore, type index$5_WALAttachedStores as WALAttachedStores, type index$5_WALState as WALState, type index$5_WALStore as WALStore, type index$5_WriteableDataAndMetaAndWalStore as WriteableDataAndMetaAndWalStore, type index$5_WriteableDataAndMetaStore as WriteableDataAndMetaStore, index$5_createAttachedStores as createAttachedStores, 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 };
1106
+ export { type index$5_ActiveStore as ActiveStore, 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_AttachedRemotesImpl as AttachedRemotesImpl, type index$5_AttachedStores as AttachedStores, index$5_BaseActiveStore as BaseActiveStore, type index$5_BaseAttachedStores as BaseAttachedStores, index$5_BaseBlockstoreImpl as BaseBlockstoreImpl, type index$5_BaseStore as BaseStore, 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_BytesAndKeyWithIv as BytesAndKeyWithIv, type index$5_CIDActiveStore as CIDActiveStore, type index$5_CIDBlock as CIDBlock, index$5_Car2FPMsg as Car2FPMsg, index$5_CarActiveStore as CarActiveStore, type index$5_CarAttachedStores as CarAttachedStores, type index$5_CarCacheItem as CarCacheItem, type index$5_CarClockHead as CarClockHead, type index$5_CarClockLink as CarClockLink, type index$5_CarGroup as CarGroup, type index$5_CarHeader as CarHeader, index$5_CarLog as CarLog, type index$5_CarMakeable as CarMakeable, type index$5_CarStore as CarStore, 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, type index$5_CryptoAction as CryptoAction, type index$5_DataAndMetaAndWalStore as DataAndMetaAndWalStore, type index$5_DataAndMetaStore as DataAndMetaStore, type index$5_DataSaveOpts as DataSaveOpts, 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, type index$5_FPEnvelopeType as FPEnvelopeType, index$5_FPEnvelopeTypes as FPEnvelopeTypes, type index$5_FPEnvelopeWAL as FPEnvelopeWAL, type index$5_FPWALCarsOps as FPWALCarsOps, index$5_File2FPMsg as File2FPMsg, index$5_FileActiveStore as FileActiveStore, type index$5_FileAttachedStores as FileAttachedStores, type index$5_FileStore as FileStore, type index$5_FroozenCarLog as FroozenCarLog, 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_IvAndKeyAndBytes as IvAndKeyAndBytes, type index$5_IvKeyIdData as IvKeyIdData, type index$5_KeyMaterial as KeyMaterial, type index$5_KeyUpsertResult as KeyUpsertResult, type index$5_KeyWithFingerPrint as KeyWithFingerPrint, type index$5_KeysByFingerprint as KeysByFingerprint, type index$5_LoadHandler as LoadHandler, type index$5_Loadable as Loadable, index$5_Loader as Loader, type index$5_LocalActiveStore as LocalActiveStore, type index$5_LocalDataAndMetaAndWalStore as LocalDataAndMetaAndWalStore, index$5_MetaActiveStore as MetaActiveStore, type index$5_MetaAttachedStores as MetaAttachedStores, 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_SerdeGatewayCtx as SerdeGatewayCtx, 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, index$5_TaskManager as TaskManager, type index$5_TaskManagerParams as TaskManagerParams, type index$5_TransactionMeta as TransactionMeta, type index$5_TransactionWrapper as TransactionWrapper, index$5_URIInterceptor as URIInterceptor, type index$5_URIMapper as URIMapper, type index$5_UnsubscribeResult as UnsubscribeResult, type index$5_UrlAndInterceptor as UrlAndInterceptor, type index$5_VoidResult as VoidResult, index$5_WALActiveStore as WALActiveStore, type index$5_WALAttachedStores as WALAttachedStores, type index$5_WALState as WALState, type index$5_WALStore as WALStore, type index$5_WriteableDataAndMetaAndWalStore as WriteableDataAndMetaAndWalStore, type index$5_WriteableDataAndMetaStore as WriteableDataAndMetaStore, index$5_createAttachedStores as createAttachedStores, 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_getInterceptableGateway as getInterceptableGateway, index$5_parseCarFile as parseCarFile, index$5_registerStoreProtocol as registerStoreProtocol, index$5_toCIDBlock as toCIDBlock, index$5_toStoreRuntime as toStoreRuntime };
1098
1107
  }
1099
1108
 
1100
1109
  interface WriteQueueParams {
@@ -1291,6 +1300,7 @@ interface DocFileMeta {
1291
1300
  readonly size: number;
1292
1301
  readonly cid: AnyLink;
1293
1302
  readonly car?: AnyLink;
1303
+ readonly lastModified?: number;
1294
1304
  url?: string;
1295
1305
  file?: () => Promise<File>;
1296
1306
  }
@@ -1528,6 +1538,7 @@ interface Database extends ReadyCloseDestroy, HasLogger, HasSuperThis {
1528
1538
  put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
1529
1539
  bulk<T extends DocTypes>(docs: DocSet<T>[]): Promise<BulkResponse>;
1530
1540
  del(id: string): Promise<DocResponse>;
1541
+ remove(id: string): Promise<DocResponse>;
1531
1542
  changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
1532
1543
  allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
1533
1544
  allDocuments<T extends DocTypes>(): Promise<{
@@ -1639,6 +1650,7 @@ declare class DatabaseImpl implements Database {
1639
1650
  put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
1640
1651
  bulk<T extends DocTypes>(docs: DocSet<T>[]): Promise<BulkResponse>;
1641
1652
  del(id: string): Promise<DocResponse>;
1653
+ remove(id: string): Promise<DocResponse>;
1642
1654
  changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
1643
1655
  allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
1644
1656
  allDocuments<T extends DocTypes>(): Promise<{
@@ -1683,19 +1695,23 @@ declare class CRDTImpl implements CRDT {
1683
1695
  compact(): Promise<void>;
1684
1696
  }
1685
1697
 
1686
- declare function getPath(url: URI, sthis: SuperThis$1): string;
1687
- declare function getFileName(url: URI, sthis: SuperThis$1): string;
1698
+ declare function getPath(url: URI, sthis: SuperThis): string;
1699
+ declare function getFileName(url: URI, sthis: SuperThis): string;
1688
1700
 
1689
- declare function encodeFile(blob: BlobLike): Promise<{
1701
+ declare function encodeFile(blob: Blob): Promise<{
1690
1702
  cid: AnyLink;
1691
1703
  blocks: AnyBlock[];
1692
1704
  }>;
1693
- declare function decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<File>;
1705
+ interface BlockGetter {
1706
+ get(cid: AnyLink): Promise<Uint8Array>;
1707
+ }
1708
+ declare function decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<Result<File>>;
1694
1709
 
1710
+ type files_BlockGetter = BlockGetter;
1695
1711
  declare const files_decodeFile: typeof decodeFile;
1696
1712
  declare const files_encodeFile: typeof encodeFile;
1697
1713
  declare namespace files {
1698
- export { files_decodeFile as decodeFile, files_encodeFile as encodeFile };
1714
+ export { type files_BlockGetter as BlockGetter, files_decodeFile as decodeFile, files_encodeFile as encodeFile };
1699
1715
  }
1700
1716
 
1701
1717
  declare class BlockIvKeyIdCodec implements AsyncBlockCodec<24, Uint8Array, IvKeyIdData> {
package/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import { Logger, Future, URI, CryptoRuntime, ResolveOnce, Result, ResolveSeq, CTCryptoKey, CoerceURI, LRUSet, Env, EnvFactoryOpts, runtimeFn } from '@adviser/cement';
1
+ import { Logger, Future, URI, CryptoRuntime, ResolveOnce, Result, ResolveSeq, CTCryptoKey, CoerceURI, Promisable, LRUSet, Env, EnvFactoryOpts, runtimeFn } from '@adviser/cement';
2
2
  import { EventLink } from '@fireproof/vendor/@web3-storage/pail/clock/api';
3
3
  import { Operation } from '@fireproof/vendor/@web3-storage/pail/crdt/api';
4
4
  import { Version, Block as Block$1, UnknownLink, CID, ByteView, ArrayBufferView, Link, MultihashHasher, BlockView } 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
7
  import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
8
- import { SuperThis as SuperThis$1 } from '@fireproof/core';
9
8
  import { Block as Block$2 } from 'multiformats/block';
10
9
 
11
10
  type BlockFetcher = BlockFetcher$1;
@@ -521,11 +520,8 @@ interface CryptoAction {
521
520
  _decrypt(data: IvAndKeyAndBytes): Promise<Uint8Array>;
522
521
  _encrypt(data: BytesAndKeyWithIv): Promise<Uint8Array>;
523
522
  }
524
- interface BlobLike {
525
- stream: () => ReadableStream;
526
- }
527
523
  interface StoreFactory {
528
- encodeFile?: (blob: BlobLike) => Promise<{
524
+ encodeFile?: (blob: Blob) => Promise<{
529
525
  cid: AnyLink;
530
526
  blocks: AnyBlock[];
531
527
  }>;
@@ -538,11 +534,11 @@ interface StoreUrls {
538
534
  readonly wal: CoerceURI;
539
535
  }
540
536
  interface StoreEnDeFile {
541
- readonly encodeFile: (blob: BlobLike) => Promise<{
537
+ readonly encodeFile: (blob: Blob) => Promise<{
542
538
  cid: AnyLink;
543
539
  blocks: AnyBlock[];
544
540
  }>;
545
- readonly decodeFile: (blocks: unknown, cid: AnyLink, meta: DocFileMeta) => Promise<File>;
541
+ readonly decodeFile: (blocks: unknown, cid: AnyLink, meta: DocFileMeta) => Promise<Result<File>>;
546
542
  }
547
543
  interface StoreUrlsOpts {
548
544
  readonly base?: CoerceURI;
@@ -569,11 +565,11 @@ interface StoreFactoryItem {
569
565
  }
570
566
  interface StoreRuntime {
571
567
  makeStores(sfi: StoreFactoryItem): Promise<DataAndMetaAndWalStore>;
572
- encodeFile(blob: BlobLike): Promise<{
568
+ encodeFile(blob: Blob): Promise<{
573
569
  cid: AnyLink;
574
570
  blocks: AnyBlock[];
575
571
  }>;
576
- decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<File>;
572
+ decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<Result<File>>;
577
573
  }
578
574
  interface CommitOpts {
579
575
  readonly noLoader?: boolean;
@@ -810,32 +806,6 @@ type DbMetaEventBlock = EventBlock<DbMetaBinary>;
810
806
  type CarClockLink = Link<DbMetaEventBlock, number, number, Version>;
811
807
  type CarClockHead = CarClockLink[];
812
808
 
813
- interface SerdeGatewayInstances {
814
- readonly gateway: SerdeGateway;
815
- }
816
- interface GatewayReady extends SerdeGatewayInstances {
817
- readonly url: URI;
818
- }
819
- declare function getStartedGateway(ctx: SerdeGatewayCtx, url: URI): Promise<Result<GatewayReady>>;
820
- declare function ensureStoreEnDeFile(ende?: Partial<StoreEnDeFile>): StoreEnDeFile;
821
- declare function toStoreRuntime(sthis: SuperThis, endeOpts?: Partial<StoreEnDeFile>): StoreRuntime;
822
-
823
- interface GatewayOpts {
824
- readonly gateway: Gateway;
825
- }
826
- type GetResult = Result<Uint8Array, NotFoundError | Error>;
827
- interface Gateway {
828
- buildUrl(baseUrl: URI, key: string, sthis: SuperThis): Promise<Result<URI>>;
829
- start(baseUrl: URI, sthis: SuperThis): Promise<Result<URI>>;
830
- close(baseUrl: URI, sthis: SuperThis): Promise<VoidResult>;
831
- destroy(baseUrl: URI, sthis: SuperThis): Promise<VoidResult>;
832
- put(url: URI, body: Uint8Array, sthis: SuperThis): Promise<VoidResult>;
833
- get(url: URI, sthis: SuperThis): Promise<GetResult>;
834
- delete(url: URI, sthis: SuperThis): Promise<VoidResult>;
835
- subscribe?(url: URI, callback: (meta: Uint8Array) => void, sthis: SuperThis): Promise<UnsubscribeResult>;
836
- getPlain(url: URI, key: string, sthis: SuperThis): Promise<Result<Uint8Array>>;
837
- }
838
-
839
809
  declare class PassThroughGateway implements SerdeGatewayInterceptor {
840
810
  buildUrl(ctx: SerdeGatewayCtx, url: URI, key: string): Promise<Result<SerdeGatewayBuildUrlReturn>>;
841
811
  start(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayStartReturn>>;
@@ -861,6 +831,28 @@ declare class InterceptorGateway implements SerdeGateway {
861
831
  getPlain(ctx: SerdeGatewayCtx, url: URI, key: string): Promise<Result<Uint8Array>>;
862
832
  }
863
833
 
834
+ declare function getInterceptableGateway(ctx: SerdeGatewayCtx, url: URI, opt: {
835
+ gatewayInterceptor?: SerdeGatewayInterceptor;
836
+ }): Promise<Result<InterceptorGateway>>;
837
+ declare function ensureStoreEnDeFile(ende?: Partial<StoreEnDeFile>): StoreEnDeFile;
838
+ declare function toStoreRuntime(sthis: SuperThis, endeOpts?: Partial<StoreEnDeFile>): StoreRuntime;
839
+
840
+ interface GatewayOpts {
841
+ readonly gateway: Gateway;
842
+ }
843
+ type GetResult = Result<Uint8Array, NotFoundError | Error>;
844
+ interface Gateway {
845
+ buildUrl(baseUrl: URI, key: string, sthis: SuperThis): Promise<Result<URI>>;
846
+ start(baseUrl: URI, sthis: SuperThis): Promise<Result<URI>>;
847
+ close(baseUrl: URI, sthis: SuperThis): Promise<VoidResult>;
848
+ destroy(baseUrl: URI, sthis: SuperThis): Promise<VoidResult>;
849
+ put(url: URI, body: Uint8Array, sthis: SuperThis): Promise<VoidResult>;
850
+ get(url: URI, sthis: SuperThis): Promise<GetResult>;
851
+ delete(url: URI, sthis: SuperThis): Promise<VoidResult>;
852
+ subscribe?(url: URI, callback: (meta: Uint8Array) => void, sthis: SuperThis): Promise<UnsubscribeResult>;
853
+ getPlain(url: URI, key: string, sthis: SuperThis): Promise<Result<Uint8Array>>;
854
+ }
855
+
864
856
  declare function createDbMetaEvent(sthis: SuperThis, dbMeta: DbMeta, parents: CarClockHead): Promise<DbMetaEvent>;
865
857
 
866
858
  interface SerdeGatewayFactoryItem {
@@ -895,6 +887,21 @@ declare class AttachedRemotesImpl implements AttachedStores {
895
887
  attach(attached: Attachable): Promise<Attached>;
896
888
  }
897
889
 
890
+ type URIMapper = (uri: URI) => Promisable<URI>;
891
+ declare class URIInterceptor extends PassThroughGateway {
892
+ #private;
893
+ static withMapper(mapper: URIMapper): URIInterceptor;
894
+ addMapper(mapper: URIMapper): URIInterceptor;
895
+ buildUrl(ctx: SerdeGatewayCtx, url: URI, key: string): Promise<Result<SerdeGatewayBuildUrlReturn>>;
896
+ start(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayStartReturn>>;
897
+ close(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayCloseReturn>>;
898
+ delete(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayDeleteReturn>>;
899
+ destroy(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayDestroyReturn>>;
900
+ put<T>(ctx: SerdeGatewayCtx, url: URI, body: FPEnvelope<T>): Promise<Result<SerdeGatewayPutReturn<T>>>;
901
+ get<S>(ctx: SerdeGatewayCtx, url: URI): Promise<Result<SerdeGatewayGetReturn<S>>>;
902
+ subscribe(ctx: SerdeGatewayCtx, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void>): Promise<Result<SerdeGatewaySubscribeReturn>>;
903
+ }
904
+
898
905
  declare class Loader implements Loadable {
899
906
  readonly ebOpts: BlockstoreRuntime;
900
907
  readonly logger: Logger;
@@ -951,7 +958,6 @@ type index$5_BaseAttachedStores = BaseAttachedStores;
951
958
  type index$5_BaseBlockstoreImpl = BaseBlockstoreImpl;
952
959
  declare const index$5_BaseBlockstoreImpl: typeof BaseBlockstoreImpl;
953
960
  type index$5_BaseStore = BaseStore;
954
- type index$5_BlobLike = BlobLike;
955
961
  type index$5_BlockFetcher = BlockFetcher;
956
962
  type index$5_BlockstoreOpts = BlockstoreOpts;
957
963
  type index$5_BlockstoreParams = BlockstoreParams;
@@ -1072,6 +1078,9 @@ declare const index$5_TaskManager: typeof TaskManager;
1072
1078
  type index$5_TaskManagerParams = TaskManagerParams;
1073
1079
  type index$5_TransactionMeta = TransactionMeta;
1074
1080
  type index$5_TransactionWrapper<M extends TransactionMeta> = TransactionWrapper<M>;
1081
+ type index$5_URIInterceptor = URIInterceptor;
1082
+ declare const index$5_URIInterceptor: typeof URIInterceptor;
1083
+ type index$5_URIMapper = URIMapper;
1075
1084
  type index$5_UnsubscribeResult = UnsubscribeResult;
1076
1085
  type index$5_UrlAndInterceptor = UrlAndInterceptor;
1077
1086
  type index$5_VoidResult = VoidResult;
@@ -1088,13 +1097,13 @@ declare const index$5_defaultGatewayFactoryItem: typeof defaultGatewayFactoryIte
1088
1097
  declare const index$5_ensureStoreEnDeFile: typeof ensureStoreEnDeFile;
1089
1098
  declare const index$5_getDefaultURI: typeof getDefaultURI;
1090
1099
  declare const index$5_getGatewayFactoryItem: typeof getGatewayFactoryItem;
1091
- declare const index$5_getStartedGateway: typeof getStartedGateway;
1100
+ declare const index$5_getInterceptableGateway: typeof getInterceptableGateway;
1092
1101
  declare const index$5_parseCarFile: typeof parseCarFile;
1093
1102
  declare const index$5_registerStoreProtocol: typeof registerStoreProtocol;
1094
1103
  declare const index$5_toCIDBlock: typeof toCIDBlock;
1095
1104
  declare const index$5_toStoreRuntime: typeof toStoreRuntime;
1096
1105
  declare namespace index$5 {
1097
- export { type index$5_ActiveStore as ActiveStore, 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_AttachedRemotesImpl as AttachedRemotesImpl, type index$5_AttachedStores as AttachedStores, index$5_BaseActiveStore as BaseActiveStore, type index$5_BaseAttachedStores as BaseAttachedStores, 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_BytesAndKeyWithIv as BytesAndKeyWithIv, type index$5_CIDActiveStore as CIDActiveStore, type index$5_CIDBlock as CIDBlock, index$5_Car2FPMsg as Car2FPMsg, index$5_CarActiveStore as CarActiveStore, type index$5_CarAttachedStores as CarAttachedStores, type index$5_CarCacheItem as CarCacheItem, type index$5_CarClockHead as CarClockHead, type index$5_CarClockLink as CarClockLink, type index$5_CarGroup as CarGroup, type index$5_CarHeader as CarHeader, index$5_CarLog as CarLog, type index$5_CarMakeable as CarMakeable, type index$5_CarStore as CarStore, 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, type index$5_CryptoAction as CryptoAction, type index$5_DataAndMetaAndWalStore as DataAndMetaAndWalStore, type index$5_DataAndMetaStore as DataAndMetaStore, type index$5_DataSaveOpts as DataSaveOpts, 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, type index$5_FPEnvelopeType as FPEnvelopeType, index$5_FPEnvelopeTypes as FPEnvelopeTypes, type index$5_FPEnvelopeWAL as FPEnvelopeWAL, type index$5_FPWALCarsOps as FPWALCarsOps, index$5_File2FPMsg as File2FPMsg, index$5_FileActiveStore as FileActiveStore, type index$5_FileAttachedStores as FileAttachedStores, type index$5_FileStore as FileStore, type index$5_FroozenCarLog as FroozenCarLog, 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_IvAndKeyAndBytes as IvAndKeyAndBytes, type index$5_IvKeyIdData as IvKeyIdData, type index$5_KeyMaterial as KeyMaterial, type index$5_KeyUpsertResult as KeyUpsertResult, type index$5_KeyWithFingerPrint as KeyWithFingerPrint, type index$5_KeysByFingerprint as KeysByFingerprint, type index$5_LoadHandler as LoadHandler, type index$5_Loadable as Loadable, index$5_Loader as Loader, type index$5_LocalActiveStore as LocalActiveStore, type index$5_LocalDataAndMetaAndWalStore as LocalDataAndMetaAndWalStore, index$5_MetaActiveStore as MetaActiveStore, type index$5_MetaAttachedStores as MetaAttachedStores, 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_SerdeGatewayCtx as SerdeGatewayCtx, 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, index$5_TaskManager as TaskManager, type index$5_TaskManagerParams as TaskManagerParams, type index$5_TransactionMeta as TransactionMeta, type index$5_TransactionWrapper as TransactionWrapper, type index$5_UnsubscribeResult as UnsubscribeResult, type index$5_UrlAndInterceptor as UrlAndInterceptor, type index$5_VoidResult as VoidResult, index$5_WALActiveStore as WALActiveStore, type index$5_WALAttachedStores as WALAttachedStores, type index$5_WALState as WALState, type index$5_WALStore as WALStore, type index$5_WriteableDataAndMetaAndWalStore as WriteableDataAndMetaAndWalStore, type index$5_WriteableDataAndMetaStore as WriteableDataAndMetaStore, index$5_createAttachedStores as createAttachedStores, 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 };
1106
+ export { type index$5_ActiveStore as ActiveStore, 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_AttachedRemotesImpl as AttachedRemotesImpl, type index$5_AttachedStores as AttachedStores, index$5_BaseActiveStore as BaseActiveStore, type index$5_BaseAttachedStores as BaseAttachedStores, index$5_BaseBlockstoreImpl as BaseBlockstoreImpl, type index$5_BaseStore as BaseStore, 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_BytesAndKeyWithIv as BytesAndKeyWithIv, type index$5_CIDActiveStore as CIDActiveStore, type index$5_CIDBlock as CIDBlock, index$5_Car2FPMsg as Car2FPMsg, index$5_CarActiveStore as CarActiveStore, type index$5_CarAttachedStores as CarAttachedStores, type index$5_CarCacheItem as CarCacheItem, type index$5_CarClockHead as CarClockHead, type index$5_CarClockLink as CarClockLink, type index$5_CarGroup as CarGroup, type index$5_CarHeader as CarHeader, index$5_CarLog as CarLog, type index$5_CarMakeable as CarMakeable, type index$5_CarStore as CarStore, 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, type index$5_CryptoAction as CryptoAction, type index$5_DataAndMetaAndWalStore as DataAndMetaAndWalStore, type index$5_DataAndMetaStore as DataAndMetaStore, type index$5_DataSaveOpts as DataSaveOpts, 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, type index$5_FPEnvelopeType as FPEnvelopeType, index$5_FPEnvelopeTypes as FPEnvelopeTypes, type index$5_FPEnvelopeWAL as FPEnvelopeWAL, type index$5_FPWALCarsOps as FPWALCarsOps, index$5_File2FPMsg as File2FPMsg, index$5_FileActiveStore as FileActiveStore, type index$5_FileAttachedStores as FileAttachedStores, type index$5_FileStore as FileStore, type index$5_FroozenCarLog as FroozenCarLog, 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_IvAndKeyAndBytes as IvAndKeyAndBytes, type index$5_IvKeyIdData as IvKeyIdData, type index$5_KeyMaterial as KeyMaterial, type index$5_KeyUpsertResult as KeyUpsertResult, type index$5_KeyWithFingerPrint as KeyWithFingerPrint, type index$5_KeysByFingerprint as KeysByFingerprint, type index$5_LoadHandler as LoadHandler, type index$5_Loadable as Loadable, index$5_Loader as Loader, type index$5_LocalActiveStore as LocalActiveStore, type index$5_LocalDataAndMetaAndWalStore as LocalDataAndMetaAndWalStore, index$5_MetaActiveStore as MetaActiveStore, type index$5_MetaAttachedStores as MetaAttachedStores, 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_SerdeGatewayCtx as SerdeGatewayCtx, 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, index$5_TaskManager as TaskManager, type index$5_TaskManagerParams as TaskManagerParams, type index$5_TransactionMeta as TransactionMeta, type index$5_TransactionWrapper as TransactionWrapper, index$5_URIInterceptor as URIInterceptor, type index$5_URIMapper as URIMapper, type index$5_UnsubscribeResult as UnsubscribeResult, type index$5_UrlAndInterceptor as UrlAndInterceptor, type index$5_VoidResult as VoidResult, index$5_WALActiveStore as WALActiveStore, type index$5_WALAttachedStores as WALAttachedStores, type index$5_WALState as WALState, type index$5_WALStore as WALStore, type index$5_WriteableDataAndMetaAndWalStore as WriteableDataAndMetaAndWalStore, type index$5_WriteableDataAndMetaStore as WriteableDataAndMetaStore, index$5_createAttachedStores as createAttachedStores, 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_getInterceptableGateway as getInterceptableGateway, index$5_parseCarFile as parseCarFile, index$5_registerStoreProtocol as registerStoreProtocol, index$5_toCIDBlock as toCIDBlock, index$5_toStoreRuntime as toStoreRuntime };
1098
1107
  }
1099
1108
 
1100
1109
  interface WriteQueueParams {
@@ -1291,6 +1300,7 @@ interface DocFileMeta {
1291
1300
  readonly size: number;
1292
1301
  readonly cid: AnyLink;
1293
1302
  readonly car?: AnyLink;
1303
+ readonly lastModified?: number;
1294
1304
  url?: string;
1295
1305
  file?: () => Promise<File>;
1296
1306
  }
@@ -1528,6 +1538,7 @@ interface Database extends ReadyCloseDestroy, HasLogger, HasSuperThis {
1528
1538
  put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
1529
1539
  bulk<T extends DocTypes>(docs: DocSet<T>[]): Promise<BulkResponse>;
1530
1540
  del(id: string): Promise<DocResponse>;
1541
+ remove(id: string): Promise<DocResponse>;
1531
1542
  changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
1532
1543
  allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
1533
1544
  allDocuments<T extends DocTypes>(): Promise<{
@@ -1639,6 +1650,7 @@ declare class DatabaseImpl implements Database {
1639
1650
  put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
1640
1651
  bulk<T extends DocTypes>(docs: DocSet<T>[]): Promise<BulkResponse>;
1641
1652
  del(id: string): Promise<DocResponse>;
1653
+ remove(id: string): Promise<DocResponse>;
1642
1654
  changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
1643
1655
  allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
1644
1656
  allDocuments<T extends DocTypes>(): Promise<{
@@ -1683,19 +1695,23 @@ declare class CRDTImpl implements CRDT {
1683
1695
  compact(): Promise<void>;
1684
1696
  }
1685
1697
 
1686
- declare function getPath(url: URI, sthis: SuperThis$1): string;
1687
- declare function getFileName(url: URI, sthis: SuperThis$1): string;
1698
+ declare function getPath(url: URI, sthis: SuperThis): string;
1699
+ declare function getFileName(url: URI, sthis: SuperThis): string;
1688
1700
 
1689
- declare function encodeFile(blob: BlobLike): Promise<{
1701
+ declare function encodeFile(blob: Blob): Promise<{
1690
1702
  cid: AnyLink;
1691
1703
  blocks: AnyBlock[];
1692
1704
  }>;
1693
- declare function decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<File>;
1705
+ interface BlockGetter {
1706
+ get(cid: AnyLink): Promise<Uint8Array>;
1707
+ }
1708
+ declare function decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<Result<File>>;
1694
1709
 
1710
+ type files_BlockGetter = BlockGetter;
1695
1711
  declare const files_decodeFile: typeof decodeFile;
1696
1712
  declare const files_encodeFile: typeof encodeFile;
1697
1713
  declare namespace files {
1698
- export { files_decodeFile as decodeFile, files_encodeFile as encodeFile };
1714
+ export { type files_BlockGetter as BlockGetter, files_decodeFile as decodeFile, files_encodeFile as encodeFile };
1699
1715
  }
1700
1716
 
1701
1717
  declare class BlockIvKeyIdCodec implements AsyncBlockCodec<24, Uint8Array, IvKeyIdData> {