import { Result } from "@adviser/cement"; import { SuperThis } from "@fireproof/core-types-base"; export interface SerializedMeta { readonly data: string; readonly parents: string[]; readonly cid: string; } export type LinkOrCid = { "/": string; } | string; export interface SerializedWAL { readonly fileOperations?: { cid: LinkOrCid; public: boolean; }[]; readonly noLoaderOps?: { cars: LinkOrCid[]; }[]; readonly operations?: { cars: LinkOrCid[]; }[]; } export type CARDecodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise>; export type FILEDecodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise>; export type METADecodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise>; export type WALDecodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise>; export interface FPDecoder { readonly car: CARDecodeEnvelope; readonly file: FILEDecodeEnvelope; readonly meta: METADecodeEnvelope; readonly wal: WALDecodeEnvelope; } export type CAREncodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise>; export type FILEEncodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise>; export type METAEncodeEnvelope = (sthis: SuperThis, payload: SerializedMeta[]) => Promise>; export type WALEncodeEnvelope = (sthis: SuperThis, payload: SerializedWAL) => Promise>; export interface FPEncoder { readonly car: CAREncodeEnvelope; readonly file: FILEEncodeEnvelope; readonly meta: METAEncodeEnvelope; readonly wal: WALEncodeEnvelope; } export interface V2SerializedMetaKey { readonly metas: SerializedMeta[]; readonly keys: string[]; }