import { SerializableClass, Serializable } from './internals/serializable.js'; import { AnyConstructable, ClassConstructor, NamedFunction, AnyFn } from './internals/types.js'; /** * Copyright 2025 © BeeAI a Series of LF Projects, LLC * SPDX-License-Identifier: Apache-2.0 */ declare const SerializerSelfRefIdentifier = "__self_ref"; declare const SerializerRefIdentifier = "__ref"; declare class ClassConstructorPlaceholder { } declare class RefPlaceholder { protected readonly node: SerializerNode; protected readonly factory: SerializeFactory; private static EmptyPlaceholder; private partialResult; constructor(node: SerializerNode, factory: SerializeFactory); get value(): T; get rawValue(): unknown; final(): Promise; } interface SerializerNode { __class: string; __ref: string; __value: unknown; __serializer: true; } declare function isSerializerNode(data: unknown): data is SerializerNode; interface RootNode { __version: string; __root: T; } declare function isRootNode(data: unknown): data is RootNode; declare const extractClassName: (value: unknown) => string; declare function primitiveToSerializableClass(value: unknown): SymbolConstructor | ObjectConstructor | FunctionConstructor | BooleanConstructor | StringConstructor | NumberConstructor | BigIntConstructor | { new (): {}; } | { new (): {}; }; type TraverseObjectFn = (el: { key: string; path: readonly string[]; value: any; }) => Promise; declare function traverseObject(obj: unknown, handler: TraverseObjectFn, stopFn?: (_obj: unknown) => boolean): Promise; declare function isSerializationRequired(factory: ClassConstructor | NamedFunction): boolean; declare function traverseWithUpdate(_obj: unknown): Generator<{ value: T; update: (value: T) => void; }>; declare function shallowCopy(value: T): T; declare function deepCopy(source: T): Promise; type Bounded = { name: string; value: any; } | AnyConstructable; declare function toBoundedFunction(fn: T, binds: [Bounded, ...Bounded[]]): T; declare namespace toBoundedFunction { var symbol: symbol; } declare function getFunctionBinds(fn: T): Bounded[]; /** * Copyright 2025 © BeeAI a Series of LF Projects, LLC * SPDX-License-Identifier: Apache-2.0 */ declare function isFunctionDeserializationAllowed(): boolean; interface SerializeFactory { ref: ClassConstructor | NamedFunction; createEmpty?: () => A; updateInstance?: (instance: A, update: A) => void | Promise; toPlain: (value: A) => B | Promise; fromPlain: (value: B, ref: ClassConstructor | NamedFunction) => A | Promise; } declare class Serializer { private static factories; static registerSerializable(ref: SerializableClass, processors?: Partial, A>, "ref">>, aliases?: string[]): void; static deregister(ref: ClassConstructor | NamedFunction): void; static register(ref: ClassConstructor | NamedFunction, processors: Omit, "ref">, aliases?: string[]): void; static getFactory(clsName: string): SerializeFactory; static findFactory(value: unknown): { targetClass: string; factory: SerializeFactory; isSelfRef: boolean; } | { targetClass: string; factory: SerializeFactory; isSelfRef: boolean; }; static hasFactory(clsName: string): boolean; static serialize(rawData: T): Promise; /** @internal */ static deserializeWithMeta(raw: string, extraClasses?: SerializableClass[], keepPlain?: boolean, options?: { allowFunctionDeserialization?: boolean; }): Promise>; private static _deserializeWithMetaInner; static deserialize(raw: string, extraClasses?: SerializableClass[], keepPlain?: boolean, options?: { allowFunctionDeserialization?: boolean; }): Promise; protected static _createOutputBuilder(): { _container: T; get(): T; update(path: readonly string[], value: any): void; toJSON(): string; }; } export { ClassConstructorPlaceholder as C, RefPlaceholder as R, type SerializeFactory as S, Serializer as a, type RootNode as b, type SerializerNode as c, SerializerRefIdentifier as d, SerializerSelfRefIdentifier as e, deepCopy as f, extractClassName as g, getFunctionBinds as h, isFunctionDeserializationAllowed as i, isRootNode as j, isSerializationRequired as k, isSerializerNode as l, traverseObject as m, traverseWithUpdate as n, primitiveToSerializableClass as p, shallowCopy as s, toBoundedFunction as t };