UNPKG

1.22 kBTypeScriptView Raw
1import { Constructable, Entity, ComplexTypeNamespace, EdmTypeShared } from '../odata-common';
2/**
3 * Interface representing the return type of the builder function [[entitySerializer]].
4 */
5export interface EntitySerializer<EntityT extends Entity = any, ComplexTypeNamespaceT extends ComplexTypeNamespace<any> = any> {
6 serializeEntity: (entity: EntityT, entityConstructor: Constructable<EntityT>, diff?: boolean) => Record<string, any>;
7 serializeComplexType: (fieldValue: any, complexTypeNameSpace: ComplexTypeNamespaceT) => any;
8 serializeEntityNonCustomFields: (entity: EntityT, entityConstructor: Constructable<EntityT>) => Record<string, any>;
9}
10declare type TsToEdmType = (value: any, edmType: EdmTypeShared<'v2'> | EdmTypeShared<'v4'>) => any;
11/**
12 * Constructs an entitySerializer given the OData v2 or v4 specific tsToEdm method.
13 * The concrete serializers are created in odata/v2/entity-serializer.ts and odata/v4/entity-serializer.ts
14 * @param tsToEdm - Converters ts input to EDM values
15 * @returns a entity serializer as defined by [[EntitySerializer]]
16 */
17export declare function entitySerializer(tsToEdm: TsToEdmType): EntitySerializer;
18export {};
19//# sourceMappingURL=entity-serializer.d.ts.map
\No newline at end of file