UNPKG

4.48 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.CounterResult = exports.MutateInResult = exports.MutateInResultEntry = exports.LookupInReplicaResult = exports.LookupInResult = exports.LookupInResultEntry = exports.GetReplicaResult = exports.MutationResult = exports.ExistsResult = exports.ScanResult = exports.GetResult = void 0;
4/**
5 * Contains the results of a Get operation.
6 *
7 * @category Key-Value
8 */
9class GetResult {
10 /**
11 * @internal
12 */
13 constructor(data) {
14 this.content = data.content;
15 this.cas = data.cas;
16 this.expiryTime = data.expiryTime;
17 }
18 /**
19 * BUG(JSCBC-784): This previously held the content of the document.
20 *
21 * @deprecated Use {@link GetResult.content} instead.
22 */
23 get value() {
24 return this.content;
25 }
26 set value(v) {
27 this.content = v;
28 }
29 /**
30 * BUG(JSCBC-873): This was incorrectly named at release.
31 *
32 * @deprecated Use {@link GetResult.expiryTime} instead.
33 */
34 get expiry() {
35 return this.expiryTime;
36 }
37}
38exports.GetResult = GetResult;
39/**
40 * Contains the results of a Range or Sampling Scan operation.
41 *
42 * @category Key-Value
43 */
44class ScanResult {
45 /**
46 * @internal
47 */
48 constructor(data) {
49 this.id = data.id;
50 this.content = data.content;
51 this.cas = data.cas;
52 this.expiryTime = data.expiryTime;
53 }
54}
55exports.ScanResult = ScanResult;
56/**
57 * Contains the results of an exists operation.
58 *
59 * @category Key-Value
60 */
61class ExistsResult {
62 /**
63 * @internal
64 */
65 constructor(data) {
66 this.exists = data.exists;
67 this.cas = data.cas;
68 }
69}
70exports.ExistsResult = ExistsResult;
71/**
72 * Contains the results of a mutate-in operation.
73 *
74 * @category Key-Value
75 */
76class MutationResult {
77 /**
78 * @internal
79 */
80 constructor(data) {
81 this.cas = data.cas;
82 this.token = data.token;
83 }
84}
85exports.MutationResult = MutationResult;
86/**
87 * Contains the results of a get from replica operation.
88 *
89 * @category Key-Value
90 */
91class GetReplicaResult {
92 /**
93 * @internal
94 */
95 constructor(data) {
96 this.content = data.content;
97 this.cas = data.cas;
98 this.isReplica = data.isReplica;
99 }
100}
101exports.GetReplicaResult = GetReplicaResult;
102/**
103 * Contains the results of a specific sub-operation within a lookup-in operation.
104 *
105 * @category Key-Value
106 */
107class LookupInResultEntry {
108 /**
109 * @internal
110 */
111 constructor(data) {
112 this.error = data.error;
113 this.value = data.value;
114 }
115}
116exports.LookupInResultEntry = LookupInResultEntry;
117/**
118 * Contains the results of a lookup-in operation.
119 *
120 * @category Key-Value
121 */
122class LookupInResult {
123 /**
124 * @internal
125 */
126 constructor(data) {
127 this.content = data.content;
128 this.cas = data.cas;
129 }
130 /**
131 * BUG(JSCBC-730): Previously held the content of the document.
132 *
133 * @deprecated Use {@link LookupInResult.content} instead.
134 */
135 get results() {
136 return this.content;
137 }
138 set results(v) {
139 this.content = v;
140 }
141}
142exports.LookupInResult = LookupInResult;
143/**
144 * Contains the results of a lookup-in replica operation.
145 *
146 * @category Key-Value
147 */
148class LookupInReplicaResult {
149 constructor(data) {
150 this.content = data.content;
151 this.cas = data.cas;
152 this.isReplica = data.isReplica;
153 }
154}
155exports.LookupInReplicaResult = LookupInReplicaResult;
156/**
157 * Contains the results of a specific sub-operation within a mutate-in operation.
158 *
159 * @category Key-Value
160 */
161class MutateInResultEntry {
162 /**
163 * @internal
164 */
165 constructor(data) {
166 this.value = data.value;
167 }
168}
169exports.MutateInResultEntry = MutateInResultEntry;
170/**
171 * Contains the results of a mutate-in operation.
172 *
173 * @category Key-Value
174 */
175class MutateInResult {
176 /**
177 * @internal
178 */
179 constructor(data) {
180 this.content = data.content;
181 this.cas = data.cas;
182 this.token = data.token;
183 }
184}
185exports.MutateInResult = MutateInResult;
186/**
187 * Contains the results of a counter operation (binary increment/decrement).
188 *
189 * @category Key-Value
190 */
191class CounterResult {
192 /**
193 * @internal
194 */
195 constructor(data) {
196 this.value = data.value;
197 this.cas = data.cas;
198 this.token = data.token;
199 }
200}
201exports.CounterResult = CounterResult;