UNPKG

@sap-cloud-sdk/odata-common

Version:

SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.

57 lines (56 loc) 3.1 kB
import type { BatchResponse, ErrorResponse, ReadResponse, WriteResponses } from '../../batch-response'; import type { DeSerializers } from '../../de-serializers'; import type { EntityBase } from '../../entity-base'; import type { EntityDeserializer } from '../../entity-deserializer'; import type { ResponseDataAccessor } from '../../response-data-accessor'; import type { EntityApi } from '../../entity-api'; import type { ResponseData } from './batch-response-parser'; /** * Represents the state needed to deserialize a parsed batch response using OData version specific deserialization data access. * @internal */ export declare class BatchResponseDeserializer<DeSerializersT extends DeSerializers> { private readonly entityToApi; private readonly responseDataAccessor; private readonly deserializer; /** * Creates an instance of BatchResponseTransformer. * @param entityToApi - A map that holds the entity type to constructor mapping. * @param responseDataAccessor - Response data access module. * @param deserializer - Entity deserializer. */ constructor(entityToApi: Record<string, EntityApi<EntityBase, DeSerializersT>>, responseDataAccessor: ResponseDataAccessor, deserializer: EntityDeserializer); /** * Deserialize the parsed batch response. * @param parsedBatchResponse - Two dimensional list of parsed batch sub responses. * @returns An array of parsed sub responses of the batch response. */ deserializeBatchResponse(parsedBatchResponse: (ResponseData[] | ResponseData)[]): BatchResponse<DeSerializersT>[]; private deserializeRetrieveResponse; private deserializeErrorResponse; private deserializeChangeSetSubResponse; private deserializeChangeSet; /** * Retrieve the constructor for a specific single response body. * @param responseBody - The body of a single response as an object. * @returns The constructor if found in the mapping, `undefined` otherwise. */ private getApi; } /** * Deserialize the parsed batch response. * @param parsedBatchResponse - Two dimensional list of parsed batch sub responses. * @param entityToApi - A map that holds the entity type to constructor mapping. * @param responseDataAccessor - Response data access module. * @param deserializer - Entity deserializer. * @returns An array of parsed sub responses of the batch response. * @internal */ export declare function deserializeBatchResponse<DeSerializersT extends DeSerializers>(parsedBatchResponse: (ResponseData[] | ResponseData)[], entityToApi: Record<string, EntityApi<EntityBase, DeSerializersT>>, responseDataAccessor: ResponseDataAccessor, deserializer: EntityDeserializer): (ErrorResponse | ReadResponse<DeSerializersT> | WriteResponses<DeSerializersT>)[]; /** * Parse the entity name from the metadata uri. This should be the `__metadata` property of a single entity in the response. * @param uri - The URI to parse the entity name from * @returns The entity name. * @internal */ export declare function parseEntityNameFromMetadataUri(uri: string): string;