@sap-cloud-sdk/core
Version:
SAP Cloud SDK for JavaScript core
19 lines • 1.22 kB
TypeScript
import { Constructable, Entity, ComplexTypeNamespace, EdmTypeShared } from '../odata-common';
/**
* Interface representing the return type of the builder function [[entitySerializer]].
*/
export interface EntitySerializer<EntityT extends Entity = any, ComplexTypeNamespaceT extends ComplexTypeNamespace<any> = any> {
serializeEntity: (entity: EntityT, entityConstructor: Constructable<EntityT>, diff?: boolean) => Record<string, any>;
serializeComplexType: (fieldValue: any, complexTypeNameSpace: ComplexTypeNamespaceT) => any;
serializeEntityNonCustomFields: (entity: EntityT, entityConstructor: Constructable<EntityT>) => Record<string, any>;
}
declare type TsToEdmType = (value: any, edmType: EdmTypeShared<'v2'> | EdmTypeShared<'v4'>) => any;
/**
* Constructs an entitySerializer given the OData v2 or v4 specific tsToEdm method.
* The concrete serializers are created in odata/v2/entity-serializer.ts and odata/v4/entity-serializer.ts
* @param tsToEdm - Converters ts input to EDM values
* @returns a entity serializer as defined by [[EntitySerializer]]
*/
export declare function entitySerializer(tsToEdm: TsToEdmType): EntitySerializer;
export {};
//# sourceMappingURL=entity-serializer.d.ts.map