UNPKG

2.91 kBTypeScriptView Raw
1import { ErrorResponse, ReadResponse, WriteResponses } from '../../batch-response';
2import { Constructable, Entity } from '../../entity';
3import { EntityDeserializer } from '../../entity-deserializer';
4import { ResponseDataAccessor } from '../../response-data-accessor';
5import { ResponseData } from './batch-response-parser';
6/**
7 * Represents the state needed to deserialize a parsed batch response using OData version specific deserialization data access.
8 */
9export declare class BatchResponseDeserializer {
10 private readonly entityToConstructorMap;
11 private readonly responseDataAccessor;
12 private readonly deserializer;
13 /**
14 * Creates an instance of BatchResponseTransformer.
15 * @param entityToConstructorMap - A map that holds the entity type to constructor mapping.
16 * @param responseDataAccessor - Response data access module.
17 * @param deserializer - Entity deserializer.
18 */
19 constructor(entityToConstructorMap: Record<string, Constructable<Entity>>, responseDataAccessor: ResponseDataAccessor, deserializer: EntityDeserializer);
20 /**
21 * Deserialize the parsed batch response.
22 * @param parsedBatchResponse - Two dimensional list of parsed batch sub responses.
23 * @returns An array of parsed sub responses of the batch response.
24 */
25 deserializeBatchResponse(parsedBatchResponse: (ResponseData[] | ResponseData)[]): (ErrorResponse | ReadResponse | WriteResponses)[];
26 private deserializeRetrieveResponse;
27 private deserializeErrorResponse;
28 private deserializeChangeSetSubResponse;
29 private deserializeChangeSet;
30 /**
31 * Retrieve the constructor for a specific single response body.
32 * @param responseBody - The body of a single response as an object.
33 * @returns The constructor if found in the mapping, `undefined` otherwise.
34 */
35 private getConstructor;
36}
37/**
38 * Deserialize the parsed batch response.
39 * @param parsedBatchResponse - Two dimensional list of parsed batch sub responses.
40 * @param entityToConstructorMap - A map that holds the entity type to constructor mapping.
41 * @param responseDataAccessor - Response data access module.
42 * @param deserializer - Entity deserializer.
43 * @returns An array of parsed sub responses of the batch response.
44 */
45export declare function deserializeBatchResponse(parsedBatchResponse: (ResponseData[] | ResponseData)[], entityToConstructorMap: Record<string, Constructable<Entity>>, responseDataAccessor: ResponseDataAccessor, deserializer: EntityDeserializer): (ErrorResponse | ReadResponse | WriteResponses)[];
46/**
47 * Parse the entity name from the metadata uri. This should be the `__metadata` property of a single entity in the response.
48 * @param uri - The URI to parse the entity name from
49 * @returns The entity name.
50 */
51export declare function parseEntityNameFromMetadataUri(uri: string): string;
52//# sourceMappingURL=batch-response-deserializer.d.ts.map
\No newline at end of file