import { SerializableClass, Serializable } from './internals/serializable.js'; import { ClassConstructor, NamedFunction, AnyFn, AnyConstructable } from './internals/types.js'; /** * Copyright 2025 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ declare const SerializerSelfRefIdentifier = "__self_ref"; declare const SerializerRefIdentifier = "__ref"; 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 final(): T; } 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; }) => void; declare function traverseObject(obj: unknown, handler: TraverseObjectFn, stopFn?: (_obj: unknown) => boolean): void; 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; 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 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ interface SerializeFactory { ref: ClassConstructor | NamedFunction; createEmpty?: () => A; updateInstance?: (instance: A, update: A) => void; toPlain: (value: A) => B; fromPlain: (value: B) => A; } 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): string; /** @internal */ static deserializeWithMeta(raw: string, extraClasses?: SerializableClass[]): RootNode; static deserialize(raw: string, extraClasses?: SerializableClass[]): T; protected static _createOutputBuilder(): { _container: T; get(): T; update(path: readonly string[], value: any): void; toJSON(): string; }; } export { RefPlaceholder as R, type SerializeFactory as S, Serializer as a, SerializerSelfRefIdentifier as b, SerializerRefIdentifier as c, type SerializerNode as d, type RootNode as e, isRootNode as f, extractClassName as g, isSerializationRequired as h, isSerializerNode as i, traverseWithUpdate as j, toBoundedFunction as k, getFunctionBinds as l, primitiveToSerializableClass as p, shallowCopy as s, traverseObject as t };