import type { PublicSignKey } from "@peerbit/crypto"; import type { Context } from "@peerbit/document-interface"; export type DocumentTransformFacts = { entryPublicKeys?: readonly PublicSignKey[]; }; export type DocumentTransformer = (obj: T, context: Context, facts?: DocumentTransformFacts) => I | Promise; type DocumentTransformSourceDescriptor = { readonly kind: "field"; readonly path: string | readonly string[]; } | { readonly kind: "context"; readonly field: "created" | "modified" | "head" | "gid" | "size"; } | { readonly kind: "entryFirstSignerPublicKey"; }; export type DocumentTransformDescriptor = { readonly kind: "identity"; } | { readonly kind: "pick"; readonly fields: readonly (string | readonly string[])[]; } | { readonly kind: "project"; readonly fields: readonly { readonly target: string | readonly string[]; readonly source: DocumentTransformSourceDescriptor; }[]; }; type DocumentTransformSource = string | readonly string[] | DocumentTransformSourceDescriptor; /** Distinguish library-created transforms from forgeable public descriptors. */ export declare const isBuiltInDocumentTransformer: (transformer: DocumentTransformer | undefined) => boolean; export declare const getDocumentTransformDescriptor: (transformer: DocumentTransformer | undefined) => DocumentTransformDescriptor | undefined; export declare const canPrepareDocumentTransformBeforeAppend: (descriptor: DocumentTransformDescriptor | undefined) => boolean; export declare const canPrepareDocumentTransformWithAppendFacts: (descriptor: DocumentTransformDescriptor | undefined) => boolean; export declare const documentTransformPreservesFieldPath: (descriptor: DocumentTransformDescriptor | undefined, path: string | readonly string[]) => boolean; export declare const transform: { readonly identity: () => DocumentTransformer; readonly pick: , I extends object = Partial>(fields: readonly (string | readonly string[])[]) => DocumentTransformer; readonly field: (path: string | readonly string[]) => DocumentTransformSourceDescriptor; readonly context: (field: "created" | "modified" | "head" | "gid" | "size") => DocumentTransformSourceDescriptor; readonly entryFirstSignerPublicKey: () => DocumentTransformSourceDescriptor; readonly project: >(fields: Record) => DocumentTransformer; }; export {}; //# sourceMappingURL=transform.d.ts.map