1 | import { JSONObject } from "../queryExecutionContext";
|
2 | import { PartitionKeyDefinition } from "../documents";
|
3 | import { RequestOptions } from "..";
|
4 | import { PatchRequestBody } from "./patch";
|
5 | export declare type Operation = CreateOperation | UpsertOperation | ReadOperation | DeleteOperation | ReplaceOperation | BulkPatchOperation;
|
6 | export interface Batch {
|
7 | min: string;
|
8 | max: string;
|
9 | rangeId: string;
|
10 | indexes: number[];
|
11 | operations: Operation[];
|
12 | }
|
13 | export interface OperationResponse {
|
14 | statusCode: number;
|
15 | requestCharge: number;
|
16 | eTag?: string;
|
17 | resourceBody?: JSONObject;
|
18 | }
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | export interface BulkOptions {
|
24 | continueOnError?: boolean;
|
25 | }
|
26 | export declare function isKeyInRange(min: string, max: string, key: string): boolean;
|
27 | export interface OperationBase {
|
28 | partitionKey?: string;
|
29 | ifMatch?: string;
|
30 | ifNoneMatch?: string;
|
31 | }
|
32 | export declare const BulkOperationType: {
|
33 | readonly Create: "Create";
|
34 | readonly Upsert: "Upsert";
|
35 | readonly Read: "Read";
|
36 | readonly Delete: "Delete";
|
37 | readonly Replace: "Replace";
|
38 | readonly Patch: "Patch";
|
39 | };
|
40 | export declare type OperationInput = CreateOperationInput | UpsertOperationInput | ReadOperationInput | DeleteOperationInput | ReplaceOperationInput | PatchOperationInput;
|
41 | export interface CreateOperationInput {
|
42 | partitionKey?: string | number | null | Record<string, unknown> | undefined;
|
43 | ifMatch?: string;
|
44 | ifNoneMatch?: string;
|
45 | operationType: typeof BulkOperationType.Create;
|
46 | resourceBody: JSONObject;
|
47 | }
|
48 | export interface UpsertOperationInput {
|
49 | partitionKey?: string | number | null | Record<string, unknown> | undefined;
|
50 | ifMatch?: string;
|
51 | ifNoneMatch?: string;
|
52 | operationType: typeof BulkOperationType.Upsert;
|
53 | resourceBody: JSONObject;
|
54 | }
|
55 | export interface ReadOperationInput {
|
56 | partitionKey?: string | number | boolean | null | Record<string, unknown> | undefined;
|
57 | operationType: typeof BulkOperationType.Read;
|
58 | id: string;
|
59 | }
|
60 | export interface DeleteOperationInput {
|
61 | partitionKey?: string | number | null | Record<string, unknown> | undefined;
|
62 | operationType: typeof BulkOperationType.Delete;
|
63 | id: string;
|
64 | }
|
65 | export interface ReplaceOperationInput {
|
66 | partitionKey?: string | number | null | Record<string, unknown> | undefined;
|
67 | ifMatch?: string;
|
68 | ifNoneMatch?: string;
|
69 | operationType: typeof BulkOperationType.Replace;
|
70 | resourceBody: JSONObject;
|
71 | id: string;
|
72 | }
|
73 | export interface PatchOperationInput {
|
74 | partitionKey?: string | number | null | Record<string, unknown> | undefined;
|
75 | ifMatch?: string;
|
76 | ifNoneMatch?: string;
|
77 | operationType: typeof BulkOperationType.Patch;
|
78 | resourceBody: PatchRequestBody;
|
79 | id: string;
|
80 | }
|
81 | export declare type OperationWithItem = OperationBase & {
|
82 | resourceBody: JSONObject;
|
83 | };
|
84 | export declare type CreateOperation = OperationWithItem & {
|
85 | operationType: typeof BulkOperationType.Create;
|
86 | };
|
87 | export declare type UpsertOperation = OperationWithItem & {
|
88 | operationType: typeof BulkOperationType.Upsert;
|
89 | };
|
90 | export declare type ReadOperation = OperationBase & {
|
91 | operationType: typeof BulkOperationType.Read;
|
92 | id: string;
|
93 | };
|
94 | export declare type DeleteOperation = OperationBase & {
|
95 | operationType: typeof BulkOperationType.Delete;
|
96 | id: string;
|
97 | };
|
98 | export declare type ReplaceOperation = OperationWithItem & {
|
99 | operationType: typeof BulkOperationType.Replace;
|
100 | id: string;
|
101 | };
|
102 | export declare type BulkPatchOperation = OperationBase & {
|
103 | operationType: typeof BulkOperationType.Patch;
|
104 | id: string;
|
105 | };
|
106 | export declare function hasResource(operation: Operation): operation is CreateOperation | UpsertOperation | ReplaceOperation;
|
107 | export declare function getPartitionKeyToHash(operation: Operation, partitionProperty: string): any;
|
108 | export declare function decorateOperation(operation: OperationInput, definition: PartitionKeyDefinition, options?: RequestOptions): Operation;
|
109 | export declare function decorateBatchOperation(operation: OperationInput, options?: RequestOptions): Operation;
|
110 |
|
111 |
|
112 |
|
113 |
|
114 | export declare function deepFind<T, P extends string>(document: T, path: P): string | JSONObject;
|
115 |
|
\ | No newline at end of file |