1 | import { CppProtocolSubdocOpcode } from './binding';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export declare class LookupInMacro {
|
9 | |
10 |
|
11 |
|
12 | _value: string;
|
13 | constructor(value: string);
|
14 | /**
|
15 | * A macro which references the entirety of the document meta-data.
|
16 | */
|
17 | static get Document(): LookupInMacro;
|
18 | /**
|
19 | * A macro which references the expiry of a document.
|
20 | */
|
21 | static get Expiry(): LookupInMacro;
|
22 | /**
|
23 | * A macro which references the cas of a document.
|
24 | */
|
25 | static get Cas(): LookupInMacro;
|
26 | /**
|
27 | * A macro which references the seqno of a document.
|
28 | */
|
29 | static get SeqNo(): LookupInMacro;
|
30 | /**
|
31 | * A macro which references the last modified time of a document.
|
32 | */
|
33 | static get LastModified(): LookupInMacro;
|
34 | /**
|
35 | * A macro which references the deletion state of a document. This
|
36 | * only makes sense to use in concert with the internal AccessDeleted
|
37 | * flags, which are internal.
|
38 | */
|
39 | static get IsDeleted(): LookupInMacro;
|
40 | /**
|
41 | * A macro which references the size of a document, expressed in bytes.
|
42 | */
|
43 | static get ValueSizeBytes(): LookupInMacro;
|
44 | /**
|
45 | * A macro which references the revision id of a document.
|
46 | */
|
47 | static get RevId(): LookupInMacro;
|
48 | }
|
49 | /**
|
50 | * Represents a macro that can be passed to a mutate-in operation to
|
51 | * write special values such as the expiry, cas, etc...
|
52 | *
|
53 | * @category Key-Value
|
54 | */
|
55 | export declare class MutateInMacro {
|
56 | |
57 |
|
58 |
|
59 | _value: string;
|
60 | constructor(value: string);
|
61 | /**
|
62 | * A macro which references the cas of a document.
|
63 | */
|
64 | static get Cas(): MutateInMacro;
|
65 | /**
|
66 | * A macro which references the seqno of a document.
|
67 | */
|
68 | static get SeqNo(): MutateInMacro;
|
69 | /**
|
70 | * A macro which references the crc32 of the value of a document.
|
71 | */
|
72 | static get ValueCrc32c(): MutateInMacro;
|
73 | }
|
74 | /**
|
75 | * Represents a sub-operation to perform within a lookup-in operation.
|
76 | *
|
77 | * @category Key-Value
|
78 | */
|
79 | export declare class LookupInSpec {
|
80 | |
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 | static get Expiry(): LookupInMacro;
|
87 | |
88 |
|
89 |
|
90 | _op: CppProtocolSubdocOpcode;
|
91 | |
92 |
|
93 |
|
94 | _path: string;
|
95 | |
96 |
|
97 |
|
98 | _flags: number;
|
99 | private constructor();
|
100 | private static _create;
|
101 | /**
|
102 | * Creates a LookupInSpec for fetching a field from the document.
|
103 | *
|
104 | * @param path The path to the field.
|
105 | * @param options Optional parameters for this operation.
|
106 | * @param options.xattr
|
107 | * Whether this operation should reference the document body or the extended
|
108 | * attributes data for the document.
|
109 | */
|
110 | static get(path: string | LookupInMacro, options?: {
|
111 | xattr?: boolean;
|
112 | }): LookupInSpec;
|
113 | /**
|
114 | * Returns whether a specific field exists in the document.
|
115 | *
|
116 | * @param path The path to the field.
|
117 | * @param options Optional parameters for this operation.
|
118 | * @param options.xattr
|
119 | * Whether this operation should reference the document body or the extended
|
120 | * attributes data for the document.
|
121 | */
|
122 | static exists(path: string | LookupInMacro, options?: {
|
123 | xattr?: boolean;
|
124 | }): LookupInSpec;
|
125 | /**
|
126 | * Returns the number of elements in the array reference by the path.
|
127 | *
|
128 | * @param path The path to the field.
|
129 | * @param options Optional parameters for this operation.
|
130 | * @param options.xattr
|
131 | * Whether this operation should reference the document body or the extended
|
132 | * attributes data for the document.
|
133 | */
|
134 | static count(path: string | LookupInMacro, options?: {
|
135 | xattr?: boolean;
|
136 | }): LookupInSpec;
|
137 | }
|
138 | /**
|
139 | * Represents a sub-operation to perform within a mutate-in operation.
|
140 | *
|
141 | * @category Key-Value
|
142 | */
|
143 | export declare class MutateInSpec {
|
144 | |
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 | static get CasPlaceholder(): MutateInMacro;
|
151 | |
152 |
|
153 |
|
154 | _op: CppProtocolSubdocOpcode;
|
155 | |
156 |
|
157 |
|
158 | _path: string;
|
159 | |
160 |
|
161 |
|
162 | _flags: number;
|
163 | |
164 |
|
165 |
|
166 | _data: any;
|
167 | private constructor();
|
168 | private static _create;
|
169 | /**
|
170 | * Creates a MutateInSpec for inserting a field into the document. Failing if
|
171 | * the field already exists at the specified path.
|
172 | *
|
173 | * @param path The path to the field.
|
174 | * @param value The value to insert.
|
175 | * @param options Optional parameters for this operation.
|
176 | * @param options.createPath
|
177 | * Whether or not the path to the field should be created if it does not
|
178 | * already exist.
|
179 | * @param options.xattr
|
180 | * Whether this operation should reference the document body or the extended
|
181 | * attributes data for the document.
|
182 | */
|
183 | static insert(path: string, value: any, options?: {
|
184 | createPath?: boolean;
|
185 | xattr?: boolean;
|
186 | }): MutateInSpec;
|
187 | /**
|
188 | * Creates a MutateInSpec for upserting a field on a document. This updates
|
189 | * the value of the specified field, or creates the field if it does not exits.
|
190 | *
|
191 | * @param path The path to the field.
|
192 | * @param value The value to write.
|
193 | * @param options Optional parameters for this operation.
|
194 | * @param options.createPath
|
195 | * Whether or not the path to the field should be created if it does not
|
196 | * already exist.
|
197 | * @param options.xattr
|
198 | * Whether this operation should reference the document body or the extended
|
199 | * attributes data for the document.
|
200 | */
|
201 | static upsert(path: string, value: any | MutateInMacro, options?: {
|
202 | createPath?: boolean;
|
203 | xattr?: boolean;
|
204 | }): MutateInSpec;
|
205 | /**
|
206 | * Creates a MutateInSpec for replacing a field on a document. This updates
|
207 | * the value of the specified field, failing if the field does not exits.
|
208 | *
|
209 | * @param path The path to the field.
|
210 | * @param value The value to write.
|
211 | * @param options Optional parameters for this operation.
|
212 | * @param options.xattr
|
213 | * Whether this operation should reference the document body or the extended
|
214 | * attributes data for the document.
|
215 | */
|
216 | static replace(path: string, value: any | MutateInMacro, options?: {
|
217 | xattr?: boolean;
|
218 | }): MutateInSpec;
|
219 | /**
|
220 | * Creates a MutateInSpec for remove a field from a document.
|
221 | *
|
222 | * @param path The path to the field.
|
223 | * @param options Optional parameters for this operation.
|
224 | * @param options.xattr
|
225 | * Whether this operation should reference the document body or the extended
|
226 | * attributes data for the document.
|
227 | */
|
228 | static remove(path: string, options?: {
|
229 | xattr?: boolean;
|
230 | }): MutateInSpec;
|
231 | /**
|
232 | * Creates a MutateInSpec for adding a value to the end of an array in a document.
|
233 | *
|
234 | * @param path The path to the field.
|
235 | * @param value The value to add.
|
236 | * @param options Optional parameters for this operation.
|
237 | * @param options.createPath
|
238 | * Whether or not the path to the field should be created if it does not
|
239 | * already exist.
|
240 | * @param options.multi
|
241 | * If set, this enables an array of values to be passed as value, and each
|
242 | * element of the passed array is added to the array.
|
243 | * @param options.xattr
|
244 | * Whether this operation should reference the document body or the extended
|
245 | * attributes data for the document.
|
246 | */
|
247 | static arrayAppend(path: string, value: any | MutateInMacro, options?: {
|
248 | createPath?: boolean;
|
249 | multi?: boolean;
|
250 | xattr?: boolean;
|
251 | }): MutateInSpec;
|
252 | /**
|
253 | * Creates a MutateInSpec for adding a value to the beginning of an array in a document.
|
254 | *
|
255 | * @param path The path to the field.
|
256 | * @param value The value to add.
|
257 | * @param options Optional parameters for this operation.
|
258 | * @param options.createPath
|
259 | * Whether or not the path to the field should be created if it does not
|
260 | * already exist.
|
261 | * @param options.multi
|
262 | * If set, this enables an array of values to be passed as value, and each
|
263 | * element of the passed array is added to the array.
|
264 | * @param options.xattr
|
265 | * Whether this operation should reference the document body or the extended
|
266 | * attributes data for the document.
|
267 | */
|
268 | static arrayPrepend(path: string, value: any | MutateInMacro, options?: {
|
269 | createPath?: boolean;
|
270 | multi?: boolean;
|
271 | xattr?: boolean;
|
272 | }): MutateInSpec;
|
273 | /**
|
274 | * Creates a MutateInSpec for adding a value to a specified location in an array in a
|
275 | * document. The path should specify a specific index in the array and the new values
|
276 | * are inserted at this location.
|
277 | *
|
278 | * @param path The path to an element of an array.
|
279 | * @param value The value to add.
|
280 | * @param options Optional parameters for this operation.
|
281 | * @param options.createPath
|
282 | * Whether or not the path to the field should be created if it does not
|
283 | * already exist.
|
284 | * @param options.multi
|
285 | * If set, this enables an array of values to be passed as value, and each
|
286 | * element of the passed array is added to the array.
|
287 | * @param options.xattr
|
288 | * Whether this operation should reference the document body or the extended
|
289 | * attributes data for the document.
|
290 | */
|
291 | static arrayInsert(path: string, value: any | MutateInMacro, options?: {
|
292 | createPath?: boolean;
|
293 | multi?: boolean;
|
294 | xattr?: boolean;
|
295 | }): MutateInSpec;
|
296 | /**
|
297 | * Creates a MutateInSpec for adding unique values to an array in a document. This
|
298 | * operation will only add values if they do not already exist elsewhere in the array.
|
299 | *
|
300 | * @param path The path to the field.
|
301 | * @param value The value to add.
|
302 | * @param options Optional parameters for this operation.
|
303 | * @param options.createPath
|
304 | * Whether or not the path to the field should be created if it does not
|
305 | * already exist.
|
306 | * @param options.multi
|
307 | * If set, this enables an array of values to be passed as value, and each
|
308 | * element of the passed array is added to the array.
|
309 | * @param options.xattr
|
310 | * Whether this operation should reference the document body or the extended
|
311 | * attributes data for the document.
|
312 | */
|
313 | static arrayAddUnique(path: string, value: any | MutateInMacro, options?: {
|
314 | createPath?: boolean;
|
315 | multi?: boolean;
|
316 | xattr?: boolean;
|
317 | }): MutateInSpec;
|
318 | /**
|
319 | * Creates a MutateInSpec for incrementing the value of a field in a document.
|
320 | *
|
321 | * @param path The path to the field.
|
322 | * @param value The value to add.
|
323 | * @param options Optional parameters for this operation.
|
324 | * @param options.createPath
|
325 | * Whether or not the path to the field should be created if it does not
|
326 | * already exist.
|
327 | * @param options.xattr
|
328 | * Whether this operation should reference the document body or the extended
|
329 | * attributes data for the document.
|
330 | */
|
331 | static increment(path: string, value: any, options?: {
|
332 | createPath?: boolean;
|
333 | xattr?: boolean;
|
334 | }): MutateInSpec;
|
335 | /**
|
336 | * Creates a MutateInSpec for decrementing the value of a field in a document.
|
337 | *
|
338 | * @param path The path to the field.
|
339 | * @param value The value to subtract.
|
340 | * @param options Optional parameters for this operation.
|
341 | * @param options.createPath
|
342 | * Whether or not the path to the field should be created if it does not
|
343 | * already exist.
|
344 | * @param options.xattr
|
345 | * Whether this operation should reference the document body or the extended
|
346 | * attributes data for the document.
|
347 | */
|
348 | static decrement(path: string, value: any, options?: {
|
349 | createPath?: boolean;
|
350 | xattr?: boolean;
|
351 | }): MutateInSpec;
|
352 | }
|