-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathbatch-change-set.ts
39 lines (36 loc) · 1.18 KB
/
batch-change-set.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. */
import { v4 as uuid } from 'uuid';
import { BatchChangeSet } from '../odata-common/request-builder/batch/batch-change-set';
import { EntityV2 } from './entity';
import {
CreateRequestBuilderV2,
DeleteRequestBuilderV2,
UpdateRequestBuilderV2
} from './request-builder';
/**
* @deprecated Since v1.30.0. Use [[BatchChangeSet]] directly
* Representation of a batch change set, which holds a collection of write operations.
*/
export class ODataBatchChangeSetV2<
RequestT extends
| CreateRequestBuilderV2<EntityV2>
| UpdateRequestBuilderV2<EntityV2>
| DeleteRequestBuilderV2<EntityV2>
> implements BatchChangeSet<RequestT> {
/**
* @deprecated Since v1.30.0. Use [[boundary]] instead.
*/
get changeSetId() {
return this.boundary;
}
/**
* Create an instance of ODataBatchChangeSetV2.
* @param requests Requests to combine to one change set.
* @param boundary Boundary used in the multipart request.
*/
constructor(
readonly requests: RequestT[],
readonly boundary: string = `changeset_${uuid()}`
) {}
}
export { ODataBatchChangeSetV2 as ODataBatchChangeSet };