UNPKG

6.05 kBTypeScriptView Raw
1import { MutationToken } from './mutationstate';
2import { Cas } from './utilities';
3/**
4 * Contains the results of a Get operation.
5 *
6 * @category Key-Value
7 */
8export declare class GetResult {
9 /**
10 * The content of the document.
11 */
12 content: any;
13 /**
14 * The CAS of the document.
15 */
16 cas: Cas;
17 /**
18 * The expiry of the document, if it was requested.
19 *
20 * @see {@link GetOptions.withExpiry}
21 */
22 expiryTime?: number;
23 /**
24 * @internal
25 */
26 constructor(data: {
27 content: any;
28 cas: Cas;
29 expiryTime?: number;
30 });
31 /**
32 * BUG(JSCBC-784): This previously held the content of the document.
33 *
34 * @deprecated Use {@link GetResult.content} instead.
35 */
36 get value(): any;
37 set value(v: any);
38 /**
39 * BUG(JSCBC-873): This was incorrectly named at release.
40 *
41 * @deprecated Use {@link GetResult.expiryTime} instead.
42 */
43 get expiry(): number | undefined;
44}
45/**
46 * Contains the results of a Range or Sampling Scan operation.
47 *
48 * @category Key-Value
49 */
50export declare class ScanResult {
51 /**
52 * The content of the document.
53 */
54 id: string;
55 /**
56 * The content of the document.
57 */
58 content?: any;
59 /**
60 * The CAS of the document.
61 */
62 cas?: Cas;
63 /**
64 * The expiry of the document, if it was requested.
65 *
66 * @see {@link GetOptions.withExpiry}
67 */
68 expiryTime?: number;
69 /**
70 * @internal
71 */
72 constructor(data: {
73 id: string;
74 content?: any;
75 cas?: Cas;
76 expiryTime?: number;
77 });
78}
79/**
80 * Contains the results of an exists operation.
81 *
82 * @category Key-Value
83 */
84export declare class ExistsResult {
85 /**
86 * Indicates whether the document existed or not.
87 */
88 exists: boolean;
89 /**
90 * The CAS of the document.
91 */
92 cas: Cas | undefined;
93 /**
94 * @internal
95 */
96 constructor(data: ExistsResult);
97}
98/**
99 * Contains the results of a mutate-in operation.
100 *
101 * @category Key-Value
102 */
103export declare class MutationResult {
104 /**
105 * The updated CAS for the document.
106 */
107 cas: Cas;
108 /**
109 * The token representing the mutation performed.
110 */
111 token?: MutationToken;
112 /**
113 * @internal
114 */
115 constructor(data: MutationResult);
116}
117/**
118 * Contains the results of a get from replica operation.
119 *
120 * @category Key-Value
121 */
122export declare class GetReplicaResult {
123 /**
124 * The content of the document, as it existed on the replica.
125 */
126 content: any;
127 /**
128 * The cas of the document, as it is known by the replica.
129 */
130 cas: Cas;
131 /**
132 * Indicates whether this result came from a replica or the primary.
133 */
134 isReplica: boolean;
135 /**
136 * @internal
137 */
138 constructor(data: {
139 content: any;
140 cas: Cas;
141 isReplica: boolean;
142 });
143}
144/**
145 * Contains the results of a specific sub-operation within a lookup-in operation.
146 *
147 * @category Key-Value
148 */
149export declare class LookupInResultEntry {
150 /**
151 * The error, if any, which occured when attempting to perform this sub-operation.
152 */
153 error: Error | null;
154 /**
155 * The value returned by the sub-operation.
156 */
157 value?: any;
158 /**
159 * @internal
160 */
161 constructor(data: LookupInResultEntry);
162}
163/**
164 * Contains the results of a lookup-in operation.
165 *
166 * @category Key-Value
167 */
168export declare class LookupInResult {
169 /**
170 * A list of result entries for each sub-operation performed.
171 */
172 content: LookupInResultEntry[];
173 /**
174 * The cas of the document.
175 */
176 cas: Cas;
177 /**
178 * @internal
179 */
180 constructor(data: {
181 content: LookupInResultEntry[];
182 cas: Cas;
183 });
184 /**
185 * BUG(JSCBC-730): Previously held the content of the document.
186 *
187 * @deprecated Use {@link LookupInResult.content} instead.
188 */
189 get results(): LookupInResultEntry[];
190 set results(v: LookupInResultEntry[]);
191}
192/**
193 * Contains the results of a lookup-in replica operation.
194 *
195 * @category Key-Value
196 */
197export declare class LookupInReplicaResult {
198 /**
199 * A list of result entries for each sub-operation performed.
200 */
201 content: LookupInResultEntry[];
202 /**
203 * The cas of the document.
204 */
205 cas: Cas;
206 /**
207 * Indicates whether this result came from a replica or the primary.
208 */
209 isReplica: boolean;
210 constructor(data: {
211 content: LookupInResultEntry[];
212 cas: Cas;
213 isReplica: boolean;
214 });
215}
216/**
217 * Contains the results of a specific sub-operation within a mutate-in operation.
218 *
219 * @category Key-Value
220 */
221export declare class MutateInResultEntry {
222 /**
223 * The resulting value after the completion of the sub-operation. This namely
224 * returned in the case of a counter operation (increment/decrement) and is not
225 * included for general operations.
226 */
227 value: any | undefined;
228 /**
229 * @internal
230 */
231 constructor(data: MutateInResultEntry);
232}
233/**
234 * Contains the results of a mutate-in operation.
235 *
236 * @category Key-Value
237 */
238export declare class MutateInResult {
239 /**
240 * A list of result entries for each sub-operation performed.
241 */
242 content: MutateInResultEntry[];
243 /**
244 * The updated CAS for the document.
245 */
246 cas: Cas;
247 /**
248 * The token representing the mutation performed.
249 */
250 token?: MutationToken;
251 /**
252 * @internal
253 */
254 constructor(data: MutateInResult);
255}
256/**
257 * Contains the results of a counter operation (binary increment/decrement).
258 *
259 * @category Key-Value
260 */
261export declare class CounterResult {
262 /**
263 * The new value of the document after the operation completed.
264 */
265 value: number;
266 /**
267 * The updated CAS for the document.
268 */
269 cas: Cas;
270 /**
271 * The token representing the mutation performed.
272 */
273 token?: MutationToken;
274 /**
275 * @internal
276 */
277 constructor(data: CounterResult);
278}